CMS 3D CMS Logo

List of all members | 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 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::vector< int > bxBinEdges_
 
float chi2ThresholdEB_
 
float chi2ThresholdEE_
 
float energyThresholdEB_
 
float energyThresholdEE_
 
MESetmeTimeMapByLS
 
float timingVsBXThreshold_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerTask
typedef EcalDCCHeaderBlock::EcalDCCEventSettings EventSettings
 
- 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.

Constructor & Destructor Documentation

ecaldqm::TimingTask::TimingTask ( )

Definition at line 14 of file TimingTask.cc.

14  :
15  DQWorkerTask(),
16  bxBinEdges_(),
17  bxBin_(0.),
18  chi2ThresholdEB_(0.),
19  chi2ThresholdEE_(0.),
23  meTimeMapByLS(nullptr)
24  {
25  }
float timingVsBXThreshold_
Definition: TimingTask.h:34
float energyThresholdEE_
Definition: TimingTask.h:33
MESet * meTimeMapByLS
Definition: TimingTask.h:36
float energyThresholdEB_
Definition: TimingTask.h:32
std::vector< int > bxBinEdges_
Definition: TimingTask.h:27
ecaldqm::TimingTask::~TimingTask ( )
inline

Member Function Documentation

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 39 of file TimingTask.h.

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

Referenced by ~TimingTask().

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 65 of file TimingTask.cc.

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

Referenced by ~TimingTask().

66  {
67  using namespace std;
68  std::vector<int>::iterator pBin = std::upper_bound(bxBinEdges_.begin(), bxBinEdges_.end(), _evt.bunchCrossing());
69  bxBin_ = static_cast<int>(pBin - bxBinEdges_.begin()) - 0.5;
70  }
std::vector< int > bxBinEdges_
Definition: TimingTask.h:27
void ecaldqm::TimingTask::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 54 of file TimingTask.cc.

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

Referenced by ~TimingTask().

55  {
56  // Fill separate MEs with only 10 LSs worth of stats
57  // Used to correctly fill Presample Trend plots:
58  // 1 pt:10 LS in Trend plots
59  meTimeMapByLS = &MEs_.at("TimeMapByLS");
60  if ( timestamp_.iLumi % 10 == 0 )
62  }
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:36
bool ecaldqm::TimingTask::filterRunType ( short const *  _runType)
overridevirtual
void ecaldqm::TimingTask::runOnRecHits ( EcalRecHitCollection const &  _hits,
Collections  _collection 
)

Definition at line 73 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(), triggerObjects_cff::id, hit::id, ecaldqm::kEBRecHit, EcalRecHit::kGood, EcalRecHit::kOutOfTime, RecoTauDiscriminantConfiguration::mask, ecaldqm::DQWorker::MEs_, meTimeMapByLS, ecaldqm::DQWorker::onlineMode_, electronIdCutBased_cfi::threshold, ntuplemaker::time, timingVsBXThreshold_, and globals_cff::x1.

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

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

Definition at line 129 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_, triggerObjects_cff::id, EcalUncalibratedRecHit::kGood, and ecaldqm::DQWorker::MEs_.

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

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 28 of file TimingTask.cc.

References bxBinEdges_, chi2ThresholdEB_, chi2ThresholdEE_, energyThresholdEB_, energyThresholdEE_, edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorker::onlineMode_, and timingVsBXThreshold_.

Referenced by ~TimingTask().

29  {
30  bxBinEdges_ = onlineMode_? _params.getUntrackedParameter<std::vector<int> >("bxBins"): _params.getUntrackedParameter<std::vector<int> >("bxBinsFine");
31  chi2ThresholdEB_ = _params.getUntrackedParameter<double>("chi2ThresholdEB");
32  chi2ThresholdEE_ = _params.getUntrackedParameter<double>("chi2ThresholdEE");
33  energyThresholdEB_ = _params.getUntrackedParameter<double>("energyThresholdEB");
34  energyThresholdEE_ = _params.getUntrackedParameter<double>("energyThresholdEE");
35  timingVsBXThreshold_ = _params.getUntrackedParameter<double>("timingVsBXThreshold");
36  }
float timingVsBXThreshold_
Definition: TimingTask.h:34
float energyThresholdEE_
Definition: TimingTask.h:33
float energyThresholdEB_
Definition: TimingTask.h:32
std::vector< int > bxBinEdges_
Definition: TimingTask.h:27

Member Data Documentation

double ecaldqm::TimingTask::bxBin_
private

Definition at line 28 of file TimingTask.h.

Referenced by beginEvent(), and runOnRecHits().

std::vector<int> ecaldqm::TimingTask::bxBinEdges_
private

Definition at line 27 of file TimingTask.h.

Referenced by beginEvent(), and setParams().

float ecaldqm::TimingTask::chi2ThresholdEB_
private

Definition at line 30 of file TimingTask.h.

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

float ecaldqm::TimingTask::chi2ThresholdEE_
private

Definition at line 31 of file TimingTask.h.

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

float ecaldqm::TimingTask::energyThresholdEB_
private

Definition at line 32 of file TimingTask.h.

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

float ecaldqm::TimingTask::energyThresholdEE_
private

Definition at line 33 of file TimingTask.h.

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

MESet* ecaldqm::TimingTask::meTimeMapByLS
private

Definition at line 36 of file TimingTask.h.

Referenced by beginLuminosityBlock(), and runOnRecHits().

float ecaldqm::TimingTask::timingVsBXThreshold_
private

Definition at line 34 of file TimingTask.h.

Referenced by runOnRecHits(), and setParams().