CMS 3D CMS Logo

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