CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::TimingTask Class Reference

#include <TimingTask.h>

Inheritance diagram for ecaldqm::TimingTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

Public Types

enum  Constants { nBXBins = 15 }
 
- Public Types inherited from ecaldqm::DQWorkerTask
typedef EcalDCCHeaderBlock::EcalDCCEventSettings EventSettings
 

Public Member Functions

bool analyze (void const *, Collections) override
 
bool filterRunType (short const *) override
 
void runOnRecHits (EcalRecHitCollection const &, Collections)
 
void runOnUncalibRecHits (EcalUncalibratedRecHitCollection const &)
 
 TimingTask ()
 
 ~TimingTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
virtual void addDependencies (DependencySet &)
 
 DQWorkerTask ()
 
virtual void endEvent (edm::Event const &, edm::EventSetup const &)
 
virtual bool filterTrigger (edm::TriggerResultsByName const &)
 
void recoverStats ()
 
virtual void setTokens (edm::ConsumesCollector &)
 
void softReset ()
 
virtual ~DQWorkerTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
std::string const & getName () const
 
bool onlineMode () const
 
virtual void releaseMEs ()
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setTime (time_t _t)
 
virtual ~DQWorker ()(false)
 

Private Member Functions

void beginEvent (edm::Event const &, edm::EventSetup const &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void setParams (edm::ParameterSet const &) override
 

Private Attributes

double bxBin_
 
std::array< int, nBXBins+1 > bxBinEdges_
 
float chi2ThresholdEB_
 
float chi2ThresholdEE_
 
float energyThresholdEB_
 
float energyThresholdEE_
 
MESetmeTimeMapByLS
 

Additional Inherited Members

- Static Public Member Functions inherited from ecaldqm::DQWorkerTask
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Protected Member Functions inherited from ecaldqm::DQWorkerTask
void setME (edm::ParameterSet const &) final
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
virtual void setSource (edm::ParameterSet const &)
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorkerTask
std::set< std::string > resettable_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 10 of file TimingTask.h.

Member Enumeration Documentation

Enumerator
nBXBins 

Definition at line 22 of file TimingTask.h.

22  {
23  nBXBins = 15
24  };

Constructor & Destructor Documentation

ecaldqm::TimingTask::TimingTask ( )

Definition at line 14 of file TimingTask.cc.

References bxBin_, chi2ThresholdEB_, chi2ThresholdEE_, energyThresholdEB_, energyThresholdEE_, and meTimeMapByLS.

14  :
15  DQWorkerTask(),
16  bxBinEdges_{ {1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565} },
17  bxBin_(0.),
18  chi2ThresholdEB_(0.),
19  chi2ThresholdEE_(0.),
22  meTimeMapByLS(0)
23  {
24  }
std::array< int, nBXBins+1 > bxBinEdges_
Definition: TimingTask.h:31
float energyThresholdEE_
Definition: TimingTask.h:37
MESet * meTimeMapByLS
Definition: TimingTask.h:39
float energyThresholdEB_
Definition: TimingTask.h:36
ecaldqm::TimingTask::~TimingTask ( )
inline

Definition at line 13 of file TimingTask.h.

References analyze(), filterRunType(), runOnRecHits(), and runOnUncalibRecHits().

13 {}

Member Function Documentation

bool ecaldqm::TimingTask::analyze ( void const *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 42 of file TimingTask.h.

References ecaldqm::kEBRecHit, ecaldqm::kEBUncalibRecHit, ecaldqm::kEERecHit, ecaldqm::kEEUncalibRecHit, runOnRecHits(), and runOnUncalibRecHits().

Referenced by ~TimingTask().

42  {
43  switch(_collection){
44  case kEBRecHit:
45  case kEERecHit:
46  if(_p) runOnRecHits(*static_cast<EcalRecHitCollection const*>(_p), _collection);
47  return true;
48  break;
49  case kEBUncalibRecHit:
50  case kEEUncalibRecHit:
51  if(_p) runOnUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(_p));
52  return true;
53  break;
54  default:
55  break;
56  }
57  return false;
58  }
void runOnRecHits(EcalRecHitCollection const &, Collections)
Definition: TimingTask.cc:70
void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const &)
Definition: TimingTask.cc:126
void ecaldqm::TimingTask::beginEvent ( edm::Event const &  _evt,
edm::EventSetup const &  _es 
)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 62 of file TimingTask.cc.

References edm::EventBase::bunchCrossing(), bxBin_, and bxBinEdges_.

63  {
64  using namespace std;
65  int* pBin(std::upper_bound(bxBinEdges_.begin(), bxBinEdges_.end(), _evt.bunchCrossing()));
66  bxBin_ = static_cast<int>(pBin - bxBinEdges_.begin()) - 0.5;
67  }
std::array< int, nBXBins+1 > bxBinEdges_
Definition: TimingTask.h:31
void ecaldqm::TimingTask::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 51 of file TimingTask.cc.

References ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::DQWorker::MEs_, meTimeMapByLS, ecaldqm::MESet::reset(), and ecaldqm::DQWorker::timestamp_.

52  {
53  // Fill separate MEs with only 10 LSs worth of stats
54  // Used to correctly fill Presample Trend plots:
55  // 1 pt:10 LS in Trend plots
56  meTimeMapByLS = &MEs_.at("TimeMapByLS");
57  if ( timestamp_.iLumi % 10 == 0 )
59  }
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
virtual void reset(double=0., double=0., double=0.)
Definition: MESet.cc:110
Timestamp timestamp_
Definition: DQWorker.h:78
MESetCollection MEs_
Definition: DQWorker.h:75
MESet * meTimeMapByLS
Definition: TimingTask.h:39
bool ecaldqm::TimingTask::filterRunType ( short const *  _runType)
overridevirtual
void ecaldqm::TimingTask::runOnRecHits ( EcalRecHitCollection const &  _hits,
Collections  _collection 
)

Definition at line 70 of file TimingTask.cc.

References edm::SortedCollection< T, SORT >::begin(), bxBin_, chi2ThresholdEB_, chi2ThresholdEE_, EcalBarrel, EcalEndcap, edm::SortedCollection< T, SORT >::end(), energyThresholdEB_, energyThresholdEE_, ecaldqm::MESet::fill(), hcalTTPDigis_cfi::id, hit::id, ecaldqm::kEBRecHit, EcalRecHit::kGood, EcalRecHit::kOutOfTime, RecoTauDiscriminantConfiguration::mask, ecaldqm::DQWorker::MEs_, meTimeMapByLS, ctppsDiamondLocalTracks_cfi::threshold, and ntuplemaker::time.

Referenced by analyze(), and ~TimingTask().

71  {
72  MESet& meTimeAmp(MEs_.at("TimeAmp"));
73  MESet& meTimeAmpAll(MEs_.at("TimeAmpAll"));
74  MESet& meTimingVsBX(MEs_.at("TimingVsBX"));
75  MESet& meTimeAll(MEs_.at("TimeAll"));
76  MESet& meTimeAllMap(MEs_.at("TimeAllMap"));
77  MESet& meTimeMap(MEs_.at("TimeMap")); // contains cumulative run stats => not suitable for Trend plots
78  MESet& meTime1D(MEs_.at("Time1D"));
79  MESet& meChi2(MEs_.at("Chi2"));
80 
81  uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime)));
82  float threshold(_collection == kEBRecHit ? energyThresholdEB_ : energyThresholdEE_);
83  int signedSubdet;
84 
85  std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){
86  if(hit.checkFlagMask(mask)) return;
87 
88  DetId id(hit.id());
89 
90  float time(hit.time());
91  float energy(hit.energy());
92 
93  // Apply cut on chi2 of pulse shape fit
94  float chi2Threshold = ( id.subdetId() == EcalBarrel ) ? chi2ThresholdEB_ : chi2ThresholdEE_;
95  if ( id.subdetId() == EcalBarrel )
96  signedSubdet = EcalBarrel;
97  else {
98  EEDetId eeId( hit.id() );
99  if ( eeId.zside() < 0 )
100  signedSubdet = -EcalEndcap;
101  else
102  signedSubdet = EcalEndcap;
103  }
104  if ( energy > threshold )
105  meChi2.fill(signedSubdet, hit.chi2());
106  if ( hit.chi2() > chi2Threshold ) return;
107 
108  meTimeAmp.fill(id, energy, time);
109  meTimeAmpAll.fill(id, energy, time);
110 
111  meTimingVsBX.fill(signedSubdet, bxBin_, time);
112 
113  if(energy > threshold){
114  meTimeAll.fill(id, time);
115  meTimeMap.fill(id, time);
116  meTimeMapByLS->fill(id, time);
117  meTime1D.fill(id, time);
118  meTimeAllMap.fill(id, time);
119  }
120  });
121  }
float energyThresholdEE_
Definition: TimingTask.h:37
unsigned int id
Definition: DetId.h:18
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
MESetCollection MEs_
Definition: DQWorker.h:75
MESet * meTimeMapByLS
Definition: TimingTask.h:39
float energyThresholdEB_
Definition: TimingTask.h:36
void ecaldqm::TimingTask::runOnUncalibRecHits ( EcalUncalibratedRecHitCollection const &  _uhits)

Definition at line 126 of file TimingTask.cc.

References funct::abs(), edm::SortedCollection< T, SORT >::begin(), chi2ThresholdEB_, chi2ThresholdEE_, DEFINE_ECALDQM_WORKER, EcalBarrel, edm::SortedCollection< T, SORT >::end(), energyThresholdEB_, energyThresholdEE_, hcalTTPDigis_cfi::id, EcalUncalibratedRecHit::kGood, and ecaldqm::DQWorker::MEs_.

Referenced by analyze(), and ~TimingTask().

127  {
128  MESet& meTimeAmpBXm( MEs_.at("TimeAmpBXm") );
129  MESet& meTimeAmpBXp( MEs_.at("TimeAmpBXp") );
130 
131  for( EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr ) {
132 
133  // Apply reconstruction quality cuts
134  if( !uhitItr->checkFlag(EcalUncalibratedRecHit::kGood) ) continue;
135  DetId id( uhitItr->id() );
136  float chi2Threshold = ( id.subdetId() == EcalBarrel ) ? chi2ThresholdEB_ : chi2ThresholdEE_;
137  if( uhitItr->chi2() > chi2Threshold ) continue;
138 
139  // Apply amplitude cut based on approx rechit energy
140  float amp( uhitItr->amplitude() );
141  float ampThreshold( id.subdetId() == EcalBarrel ? energyThresholdEB_*20. : energyThresholdEE_*5. ); // 1 GeV ~ ( EB:20, EE:5 ) ADC
142  if( amp < ampThreshold ) continue;
143 
144  // Apply jitter timing cut based on approx rechit timing
145  float timeOff( id.subdetId() == EcalBarrel ? 0.4 : 1.8 );
146  float hitTime( uhitItr->jitter()*25. + timeOff ); // 1 jitter ~ 25 ns
147  if( std::abs(hitTime) >= 5. ) continue;
148 
149  // Fill MEs
150  meTimeAmpBXm.fill( id,amp,uhitItr->outOfTimeAmplitude(4) ); // BX-1
151  meTimeAmpBXp.fill( id,amp,uhitItr->outOfTimeAmplitude(6) ); // BX+1
152 
153  }
154  }
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float energyThresholdEE_
Definition: TimingTask.h:37
Definition: DetId.h:18
MESetCollection MEs_
Definition: DQWorker.h:75
float energyThresholdEB_
Definition: TimingTask.h:36
void ecaldqm::TimingTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 27 of file TimingTask.cc.

References chi2ThresholdEB_, chi2ThresholdEE_, energyThresholdEB_, energyThresholdEE_, and edm::ParameterSet::getUntrackedParameter().

28  {
29  chi2ThresholdEB_ = _params.getUntrackedParameter<double>("chi2ThresholdEB");
30  chi2ThresholdEE_ = _params.getUntrackedParameter<double>("chi2ThresholdEE");
31  energyThresholdEB_ = _params.getUntrackedParameter<double>("energyThresholdEB");
32  energyThresholdEE_ = _params.getUntrackedParameter<double>("energyThresholdEE");
33  }
float energyThresholdEE_
Definition: TimingTask.h:37
float energyThresholdEB_
Definition: TimingTask.h:36

Member Data Documentation

double ecaldqm::TimingTask::bxBin_
private

Definition at line 32 of file TimingTask.h.

Referenced by beginEvent(), runOnRecHits(), and TimingTask().

std::array<int,nBXBins+1> ecaldqm::TimingTask::bxBinEdges_
private

Definition at line 31 of file TimingTask.h.

Referenced by beginEvent().

float ecaldqm::TimingTask::chi2ThresholdEB_
private

Definition at line 34 of file TimingTask.h.

Referenced by runOnRecHits(), runOnUncalibRecHits(), setParams(), and TimingTask().

float ecaldqm::TimingTask::chi2ThresholdEE_
private

Definition at line 35 of file TimingTask.h.

Referenced by runOnRecHits(), runOnUncalibRecHits(), setParams(), and TimingTask().

float ecaldqm::TimingTask::energyThresholdEB_
private

Definition at line 36 of file TimingTask.h.

Referenced by runOnRecHits(), runOnUncalibRecHits(), setParams(), and TimingTask().

float ecaldqm::TimingTask::energyThresholdEE_
private

Definition at line 37 of file TimingTask.h.

Referenced by runOnRecHits(), runOnUncalibRecHits(), setParams(), and TimingTask().

MESet* ecaldqm::TimingTask::meTimeMapByLS
private

Definition at line 39 of file TimingTask.h.

Referenced by beginLuminosityBlock(), runOnRecHits(), and TimingTask().