CMS 3D CMS Logo

MTDRecHitAlgo.cc
Go to the documentation of this file.
2 
5 
7  public:
10  edm::ConsumesCollector& sumes ) :
11  MTDRecHitAlgoBase( conf, sumes ),
12  thresholdToKeep_( conf.getParameter<double>("thresholdToKeep") ),
13  calibration_( conf.getParameter<double>("calibrationConstant") ) { }
14 
16  ~MTDRecHitAlgo() override { }
17 
19  void getEvent(const edm::Event&) final {}
20  void getEventSetup(const edm::EventSetup&) final;
21 
23  FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags ) const final;
24 
25 private:
28 };
29 
31 {
33  es.get<MTDTimeCalibRecord>().get("MTDTimeCalib",pTC);
34  time_calib_ = pTC.product();
35 }
36 
37 FTLRecHit
38 MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const {
39 
40  unsigned char flagsWord = uRecHit.flags();
41  float timeError = uRecHit.timeError();
42 
43  float energy = 0.;
44  float time = 0.;
45 
46  switch ( flagsWord ) {
47  // BTL bar geometry with only the right SiPM information available
48  case 0x2 : {
49 
50  energy = uRecHit.amplitude().second;
51  time = uRecHit.time().second;
52 
53  break ;
54  }
55  // BTL bar geometry with left and right SiPMs information available
56  case 0x3 : {
57 
58  energy = 0.5*(uRecHit.amplitude().first + uRecHit.amplitude().second);
59  time = 0.5*(uRecHit.time().first + uRecHit.time().second);
60 
61  break ;
62  }
63  // ETL, BTL tile geometry, BTL bar geometry with only the left SiPM information available
64  default: {
65 
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
74  energy *= calibration_;
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 );
80 
81  // Now fill flags
82  // all rechits from the digitizer are "good" at present
83  if( energy > thresholdToKeep_ ) {
84  flags = FTLRecHit::kGood;
85  rh.setFlag(flags);
86  } else {
87  flags = FTLRecHit::kKilled;
88  rh.setFlag(flags);
89  }
90 
91  return rh;
92 }
93 
94 
void getEvent(const edm::Event &) final
get event and eventsetup information
~MTDRecHitAlgo() override
Destructor.
FTLRecHit makeRecHit(const FTLUncalibratedRecHit &uRecHit, uint32_t &flags) const final
make the rec hit
double thresholdToKeep_
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
void getEventSetup(const edm::EventSetup &) final
double calibration_
MTDRecHitAlgo(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
Constructor.
Definition: MTDRecHitAlgo.cc:9
std::pair< float, float > time() const
float getTimeCalib(const MTDDetId &id) const
Definition: MTDTimeCalib.cc:23
T get() const
Definition: EventSetup.h:71
#define DEFINE_EDM_PLUGIN(factory, type, name)
const MTDTimeCalib * time_calib_
std::pair< float, float > amplitude() const
unsigned char flags() const
T const * product() const
Definition: ESHandle.h:86