CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MTDRecHitAlgo.cc
Go to the documentation of this file.
2 
5 
7 public:
10 
12  ~MTDRecHitAlgo() override {}
13 
15  void getEvent(const edm::Event&) final {}
16  void getEventSetup(const edm::EventSetup&) final;
17 
19  FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const final;
20 
21 private:
25 };
26 
27 MTDRecHitAlgo::MTDRecHitAlgo(const edm::ParameterSet& conf, edm::ConsumesCollector& sumes)
28  : MTDRecHitAlgoBase(conf, sumes),
29  thresholdToKeep_(conf.getParameter<double>("thresholdToKeep")),
30  calibration_(conf.getParameter<double>("calibrationConstant")) {
31  tcToken_ = sumes.esConsumes<MTDTimeCalib, MTDTimeCalibRecord>(edm::ESInputTag("", "MTDTimeCalib"));
32 }
33 
35  auto pTC = es.getHandle(tcToken_);
36  time_calib_ = pTC.product();
37 }
38 
39 FTLRecHit MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const {
40  unsigned char flagsWord = uRecHit.flags();
41  float timeError = uRecHit.timeError();
42 
43  float energy = 0.;
44  float time = 0.;
45 
47  float position = -1.f;
48  float positionError = -1.f;
49 
50  switch (flagsWord) {
51  // BTL bar geometry with only the right SiPM information available
52  case 0x2: {
53  energy = uRecHit.amplitude().second;
54  time = uRecHit.time().second;
55 
56  break;
57  }
58  // BTL bar geometry with left and right SiPMs information available
59  case 0x3: {
60  energy = 0.5 * (uRecHit.amplitude().first + uRecHit.amplitude().second);
61  time = 0.5 * (uRecHit.time().first + uRecHit.time().second);
62 
63  position = uRecHit.position();
64  positionError = uRecHit.positionError();
65 
66  break;
67  }
68  // ETL, BTL tile geometry, BTL bar geometry with only the left SiPM information available
69  default: {
70  energy = uRecHit.amplitude().first;
71  time = uRecHit.time().first;
72 
73  break;
74  }
75  }
76 
77  // --- Energy calibration: for the time being this is just a conversion pC --> MeV
78  energy *= calibration_;
79 
80  // --- Time calibration: for the time being just removes a time offset in BTL
81  time += time_calib_->getTimeCalib(uRecHit.id());
82 
83  FTLRecHit rh(uRecHit.id(), uRecHit.row(), uRecHit.column(), energy, time, timeError, position, positionError);
84 
85  // Now fill flags
86  // all rechits from the digitizer are "good" at present
87  if (energy > thresholdToKeep_) {
88  flags = FTLRecHit::kGood;
89  rh.setFlag(flags);
90  } else {
91  flags = FTLRecHit::kKilled;
92  rh.setFlag(flags);
93  }
94 
95  return rh;
96 }
97 
std::pair< float, float > time() const
FTLRecHit makeRecHit(const FTLUncalibratedRecHit &uRecHit, uint32_t &flags) const final
make the rec hit
void getEvent(const edm::Event &) final
get event and eventsetup information
~MTDRecHitAlgo() override
Destructor.
std::pair< float, float > amplitude() const
double thresholdToKeep_
void getEventSetup(const edm::EventSetup &) final
double calibration_
edm::ESGetToken< MTDTimeCalib, MTDTimeCalibRecord > tcToken_
MTDRecHitAlgo(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Constructor.
float getTimeCalib(const MTDDetId &id) const
Definition: MTDTimeCalib.cc:19
static int position[264][3]
Definition: ReadPGInfo.cc:289
#define DEFINE_EDM_PLUGIN(factory, type, name)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
const MTDTimeCalib * time_calib_
unsigned char flags() const