CMS 3D CMS Logo

MTDRecHitAlgo.cc
Go to the documentation of this file.
2 
4  public:
7  edm::ConsumesCollector& sumes ) :
8  MTDRecHitAlgoBase( conf, sumes ),
9  thresholdToKeep_( conf.getParameter<double>("thresholdToKeep") ),
10  calibration_( conf.getParameter<double>("calibrationConstant") ) { }
11 
13  ~MTDRecHitAlgo() override { }
14 
16  void getEvent(const edm::Event&) final {}
17  void getEventSetup(const edm::EventSetup&) final {}
18 
20  FTLRecHit makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags ) const final;
21 
22  private:
24 };
25 
26 
27 FTLRecHit
28 MTDRecHitAlgo::makeRecHit(const FTLUncalibratedRecHit& uRecHit, uint32_t& flags) const {
29 
30  unsigned char flagsWord = uRecHit.flags();
31  float timeError = uRecHit.timeError();
32 
33  float energy = 0.;
34  float time = 0.;
35 
36  switch ( flagsWord ) {
37  // BTL bar geometry with only the right SiPM information available
38  case 0x2 : {
39 
40  energy = uRecHit.amplitude().second;
41  time = uRecHit.time().second;
42 
43  break ;
44  }
45  // BTL bar geometry with left and right SiPMs information available
46  case 0x3 : {
47 
48  energy = 0.5*(uRecHit.amplitude().first + uRecHit.amplitude().second);
49  time = 0.5*(uRecHit.time().first + uRecHit.time().second);
50 
51  break ;
52  }
53  // ETL, BTL tile geometry, BTL bar geometry with only the left SiPM information available
54  default: {
55 
56  energy = uRecHit.amplitude().first;
57  time = uRecHit.time().first;
58 
59  break ;
60  }
61  }
62 
63  // --- Energy calibration: for the time being this is just a conversion pC --> MeV
64  energy *= calibration_;
65 
66  FTLRecHit rh( uRecHit.id(), uRecHit.row(), uRecHit.column(), energy, time, timeError );
67 
68  // Now fill flags
69  // all rechits from the digitizer are "good" at present
70  if( energy > thresholdToKeep_ ) {
71  flags = FTLRecHit::kGood;
72  rh.setFlag(flags);
73  } else {
74  flags = FTLRecHit::kKilled;
75  rh.setFlag(flags);
76  }
77 
78  return rh;
79 }
80 
81 
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:6
std::pair< float, float > time() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::pair< float, float > amplitude() const
unsigned char flags() const