CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TimingTask.cc
Go to the documentation of this file.
1 #include "../interface/TimingTask.h"
2 
4 
6 
8 
9 namespace ecaldqm
10 {
12  DQWorkerTask(),
13  chi2ThresholdEB_(0.),
14  chi2ThresholdEE_(0.),
15  energyThresholdEB_(0.),
16  energyThresholdEE_(0.)
17  {
18  }
19 
20  void
22  {
23  chi2ThresholdEB_ = _params.getUntrackedParameter<double>("chi2ThresholdEB");
24  chi2ThresholdEE_ = _params.getUntrackedParameter<double>("chi2ThresholdEE");
25  energyThresholdEB_ = _params.getUntrackedParameter<double>("energyThresholdEB");
26  energyThresholdEE_ = _params.getUntrackedParameter<double>("energyThresholdEE");
27  }
28 
29  bool
30  TimingTask::filterRunType(short const* _runType)
31  {
32  for(int iFED(0); iFED < nDCC; iFED++){
33  if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC ||
34  _runType[iFED] == EcalDCCHeaderBlock::MTCC ||
35  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
36  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
37  _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
38  _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true;
39  }
40 
41  return false;
42  }
43 
44  void
46  {
47  MESet& meTimeAmp(MEs_.at("TimeAmp"));
48  MESet& meTimeAmpAll(MEs_.at("TimeAmpAll"));
49  MESet& meTimeAll(MEs_.at("TimeAll"));
50  MESet& meTimeAllMap(MEs_.at("TimeAllMap"));
51  MESet& meTimeMap(MEs_.at("TimeMap"));
52  MESet& meTime1D(MEs_.at("Time1D"));
53 
54  uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime)));
55  float threshold(_collection == kEBRecHit ? energyThresholdEB_ : energyThresholdEE_);
56 
57  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){
58  if(hit.checkFlagMask(mask)) return;
59 
60  DetId id(hit.id());
61 
62  float time(hit.time());
63  float energy(hit.energy());
64 
65  float chi2Threshold = ( id.subdetId() == EcalBarrel ) ? chi2ThresholdEB_ : chi2ThresholdEE_;
66  if( hit.chi2() > chi2Threshold ) return;
67 
68  meTimeAmp.fill(id, energy, time);
69  meTimeAmpAll.fill(id, energy, time);
70 
71  if(energy > threshold){
72  meTimeAll.fill(id, time);
73  meTimeMap.fill(id, time);
74  meTime1D.fill(id, time);
75  meTimeAllMap.fill(id, time);
76  }
77  });
78  }
79 
80  // For In-time vs Out-of-Time amplitude correlation MEs:
81  // Only UncalibRecHits carry information about OOT amplitude
82  // But still need to make sure we apply similar cuts as on RecHits
84  {
85  MESet& meTimeAmpBXm( MEs_.at("TimeAmpBXm") );
86  MESet& meTimeAmpBXp( MEs_.at("TimeAmpBXp") );
87 
88  for( EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr ) {
89 
90  // Apply reconstruction quality cuts
91  if( !uhitItr->checkFlag(EcalUncalibratedRecHit::kGood) ) continue;
92  DetId id( uhitItr->id() );
93  float chi2Threshold = ( id.subdetId() == EcalBarrel ) ? chi2ThresholdEB_ : chi2ThresholdEE_;
94  if( uhitItr->chi2() > chi2Threshold ) continue;
95 
96  // Apply amplitude cut based on approx rechit energy
97  float amp( uhitItr->amplitude() );
98  float ampThreshold( id.subdetId() == EcalBarrel ? energyThresholdEB_*20. : energyThresholdEE_*5. ); // 1 GeV ~ ( EB:20, EE:5 ) ADC
99  if( amp < ampThreshold ) continue;
100 
101  // Apply jitter timing cut based on approx rechit timing
102  float timeOff( id.subdetId() == EcalBarrel ? 0.4 : 1.8 );
103  float hitTime( uhitItr->jitter()*25. + timeOff ); // 1 jitter ~ 25 ns
104  if( abs(hitTime) >= 5. ) continue;
105 
106  // Fill MEs
107  meTimeAmpBXm.fill( id,amp,uhitItr->outOfTimeAmplitude(4) ); // BX-1
108  meTimeAmpBXp.fill( id,amp,uhitItr->outOfTimeAmplitude(6) ); // BX+1
109 
110  }
111  }
112 
114 }
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:108
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
void setParams(edm::ParameterSet const &) override
Definition: TimingTask.cc:21
void runOnRecHits(EcalRecHitCollection const &, Collections)
Definition: TimingTask.cc:45
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
Definition: TimingTask.cc:83
float energyThresholdEE_
Definition: TimingTask.h:28
unsigned int id
const_iterator end() const
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
float energyThresholdEB_
Definition: TimingTask.h:27
bool filterRunType(short const *) override
Definition: TimingTask.cc:30
const_iterator begin() const