Skip to content

Commit 29d368b

Browse files
committed
reduce code duplication in HitResol and SiStripHitResolFromCalibTree
1 parent 20016d9 commit 29d368b

File tree

3 files changed

+4
-75
lines changed

3 files changed

+4
-75
lines changed

CalibTracker/SiStripHitResolution/interface/HitResol.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,9 @@ class TrackerTopology;
4949
class HitResol : public edm::one::EDAnalyzer<edm::one::SharedResources> {
5050
public:
5151
explicit HitResol(const edm::ParameterSet& conf);
52+
~HitResol() override = default;
5253
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
5354
double checkConsistency(const StripClusterParameterEstimator::LocalValues& parameters, double xx, double xerr);
54-
bool isDoubleSided(unsigned int iidd, const TrackerTopology* tTopo) const;
55-
bool check2DPartner(unsigned int iidd, const std::vector<TrajectoryMeasurement>& traj);
56-
~HitResol() override = default;
57-
unsigned int checkLayer(unsigned int iidd, const TrackerTopology* tTopo);
5855
void getSimHitRes(const GeomDetUnit* det,
5956
const LocalVector& trackdirection,
6057
const TrackingRecHit& recHit,

CalibTracker/SiStripHitResolution/plugins/SiStripHitResolFromCalibTree.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
1212
#include "CalibTracker/Records/interface/SiStripQualityRcd.h"
1313
#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h"
14-
#include "CalibTracker/SiStripHitEfficiency/interface/TrajectoryAtInvalidHit.h"
14+
//#include "CalibTracker/SiStripHitEfficiency/interface/TrajectoryAtInvalidHit.h"
1515
#include "CalibTracker/SiStripHitEfficiency/interface/SiStripHitEfficiencyHelpers.h"
1616
#include "CalibTracker/SiStripHitResolution/interface/HitResol.h"
1717
#include "CommonTools/ConditionDBWriter/interface/ConditionDBWriter.h"

CalibTracker/SiStripHitResolution/src/HitResol.cc

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
1717
#include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
1818
#include "CalibTracker/Records/interface/SiStripQualityRcd.h"
19-
#include "CalibTracker/SiStripHitEfficiency/interface/TrajectoryAtInvalidHit.h"
19+
#include "CalibTracker/SiStripHitEfficiency/interface/SiStripHitEfficiencyHelpers.h"
2020
#include "CalibTracker/SiStripHitResolution/interface/HitResol.h"
2121
#include "CommonTools/Statistics/interface/ChiSquaredProbability.h"
2222
#include "DataFormats/Common/interface/DetSetVector.h"
@@ -336,7 +336,7 @@ void HitResol::analyze(const edm::Event& e, const edm::EventSetup& es) {
336336
//must be from the same detector and layer
337337
iidd1 = hit1->geographicalId().rawId();
338338
iidd2 = hit2->geographicalId().rawId();
339-
if (id1.subdetId() != id2.subdetId() || checkLayer(iidd1, tTopo) != checkLayer(iidd2, tTopo))
339+
if (id1.subdetId() != id2.subdetId() || ::checkLayer(iidd1, tTopo) != ::checkLayer(iidd2, tTopo))
340340
break;
341341
//must both be stereo if one is
342342
if (tTopo->isStereo(id1) != tTopo->isStereo(id2))
@@ -469,38 +469,6 @@ double HitResol::checkConsistency(const StripClusterParameterEstimator::LocalVal
469469
return consistency;
470470
}
471471

472-
bool HitResol::isDoubleSided(unsigned int iidd, const TrackerTopology* tTopo) const {
473-
StripSubdetector strip = StripSubdetector(iidd);
474-
unsigned int subid = strip.subdetId();
475-
unsigned int layer = 0;
476-
if (subid == StripSubdetector::TIB) {
477-
layer = tTopo->tibLayer(iidd);
478-
if (layer == 1 || layer == 2)
479-
return true;
480-
else
481-
return false;
482-
} else if (subid == StripSubdetector::TOB) {
483-
layer = tTopo->tobLayer(iidd) + 4;
484-
if (layer == 5 || layer == 6)
485-
return true;
486-
else
487-
return false;
488-
} else if (subid == StripSubdetector::TID) {
489-
layer = tTopo->tidRing(iidd) + 10;
490-
if (layer == 11 || layer == 12)
491-
return true;
492-
else
493-
return false;
494-
} else if (subid == StripSubdetector::TEC) {
495-
layer = tTopo->tecRing(iidd) + 13;
496-
if (layer == 14 || layer == 15 || layer == 18)
497-
return true;
498-
else
499-
return false;
500-
} else
501-
return false;
502-
}
503-
504472
void HitResol::getSimHitRes(const GeomDetUnit* det,
505473
const LocalVector& trackdirection,
506474
const TrackingRecHit& recHit,
@@ -663,42 +631,6 @@ bool HitResol::getPairParameters(const MagneticField* magField_,
663631
return true;
664632
}
665633

666-
bool HitResol::check2DPartner(unsigned int iidd, const std::vector<TrajectoryMeasurement>& traj) {
667-
unsigned int partner_iidd = 0;
668-
bool found2DPartner = false;
669-
// first get the id of the other detector
670-
if ((iidd & 0x3) == 1)
671-
partner_iidd = iidd + 1;
672-
if ((iidd & 0x3) == 2)
673-
partner_iidd = iidd - 1;
674-
// next look in the trajectory measurements for a measurement from that detector
675-
// loop through trajectory measurements to find the partner_iidd
676-
for (const auto& tm : traj) {
677-
if (tm.recHit()->geographicalId().rawId() == partner_iidd) {
678-
found2DPartner = true;
679-
}
680-
}
681-
return found2DPartner;
682-
}
683-
684-
unsigned int HitResol::checkLayer(unsigned int iidd, const TrackerTopology* tTopo) {
685-
StripSubdetector strip = StripSubdetector(iidd);
686-
unsigned int subid = strip.subdetId();
687-
if (subid == StripSubdetector::TIB) {
688-
return tTopo->tibLayer(iidd);
689-
}
690-
if (subid == StripSubdetector::TOB) {
691-
return tTopo->tobLayer(iidd) + 4;
692-
}
693-
if (subid == StripSubdetector::TID) {
694-
return tTopo->tidWheel(iidd) + 10;
695-
}
696-
if (subid == StripSubdetector::TEC) {
697-
return tTopo->tecWheel(iidd) + 13;
698-
}
699-
return 0;
700-
}
701-
702634
void HitResol::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
703635
edm::ParameterSetDescription desc;
704636
desc.add<edm::InputTag>("lumiScalers", edm::InputTag("scalersRawToDigi"));

0 commit comments

Comments
 (0)