CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::TrigPrimTask Class Reference

#include <TrigPrimTask.h>

Inheritance diagram for ecaldqm::TrigPrimTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

Public Types

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

Public Member Functions

void addDependencies (DependencySet &) override
 
bool analyze (void const *, Collections) override
 
void beginEvent (edm::Event const &, edm::EventSetup const &) override
 
template<typename DigiCollection >
void runOnDigis (DigiCollection const &)
 
void runOnEmulTPs (EcalTrigPrimDigiCollection const &)
 
void runOnRealTPs (EcalTrigPrimDigiCollection const &)
 
 TrigPrimTask ()
 
 ~TrigPrimTask ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
 DQWorkerTask ()
 
virtual void endEvent (edm::Event const &, edm::EventSetup const &)
 
virtual bool filterRunType (short 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 beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore &)
 
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 ()
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

double bxBin_
 
int bxBinEdges_ [nBXBins+1]
 
EcalTrigPrimDigiCollection const * realTps_
 
bool runOnEmul_
 
std::map< uint32_t, unsigned > towerReadouts_
 

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
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 10 of file TrigPrimTask.h.

Member Enumeration Documentation

Enumerator
nBXBins 

Definition at line 25 of file TrigPrimTask.h.

25  {
26  nBXBins = 15
27  };

Constructor & Destructor Documentation

ecaldqm::TrigPrimTask::TrigPrimTask ( )

Definition at line 14 of file TrigPrimTask.cc.

14  :
15  DQWorkerTask(),
16  realTps_(0),
17  runOnEmul_(false),
18  // HLTCaloPath_(""),
19  // HLTMuonPath_(""),
20  // HLTCaloBit_(false),
21  // HLTMuonBit_(false),
22  bxBinEdges_{1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565},
23  bxBin_(0.),
25  {
26  }
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
EcalTrigPrimDigiCollection const * realTps_
Definition: TrigPrimTask.h:32
int bxBinEdges_[nBXBins+1]
Definition: TrigPrimTask.h:41
ecaldqm::TrigPrimTask::~TrigPrimTask ( )
inline

Definition at line 13 of file TrigPrimTask.h.

13 {}

Member Function Documentation

void ecaldqm::TrigPrimTask::addDependencies ( DependencySet _dependencies)
overridevirtual
bool ecaldqm::TrigPrimTask::analyze ( void const *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 47 of file TrigPrimTask.h.

References ecaldqm::kEBDigi, ecaldqm::kEEDigi, ecaldqm::kTrigPrimDigi, ecaldqm::kTrigPrimEmulDigi, runOnDigis(), runOnEmul_, runOnEmulTPs(), and runOnRealTPs().

47  {
48  switch(_collection){
49  case kTrigPrimDigi:
50  if(_p) runOnRealTPs(*static_cast<EcalTrigPrimDigiCollection const*>(_p));
51  return true;
52  break;
53  case kTrigPrimEmulDigi:
54  if(_p && runOnEmul_) runOnEmulTPs(*static_cast<EcalTrigPrimDigiCollection const*>(_p));
55  return runOnEmul_;
56  break;
57  case kEBDigi:
58  if(_p) runOnDigis(*static_cast<EBDigiCollection const*>(_p));
59  return true;
60  break;
61  case kEEDigi:
62  if(_p) runOnDigis(*static_cast<EEDigiCollection const*>(_p));
63  return true;
64  break;
65  default:
66  break;
67  }
68  return false;
69  }
void runOnEmulTPs(EcalTrigPrimDigiCollection const &)
void runOnDigis(DigiCollection const &)
void runOnRealTPs(EcalTrigPrimDigiCollection const &)
void ecaldqm::TrigPrimTask::beginEvent ( edm::Event const &  _evt,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 48 of file TrigPrimTask.cc.

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

49  {
50  using namespace std;
51 
52  towerReadouts_.clear();
53 
54  realTps_ = 0;
55 
56  // HLTCaloBit_ = false;
57  // HLTMuonBit_ = false;
58 
59  int* pBin(std::upper_bound(bxBinEdges_, bxBinEdges_ + nBXBins + 1, _evt.bunchCrossing()));
60  bxBin_ = static_cast<int>(pBin - bxBinEdges_) - 0.5;
61 
62  // if(HLTCaloPath_.size() || HLTMuonPath_.size()){
63  // edm::TriggerResultsByName results(_evt.triggerResultsByName("HLT"));
64  // if(!results.isValid()) results = _evt.triggerResultsByName("RECO");
65  // if(results.isValid()){
66  // const vector<string>& pathNames(results.triggerNames());
67 
68  // size_t caloStar(HLTCaloPath_.find('*'));
69  // if(caloStar != string::npos){
70  // string caloSub(HLTCaloPath_.substr(0, caloStar));
71  // bool found(false);
72  // for(unsigned iP(0); iP < pathNames.size(); ++iP){
73  // if(pathNames[iP].substr(0, caloStar) == caloSub){
74  // HLTCaloPath_ = pathNames[iP];
75  // found = true;
76  // break;
77  // }
78  // }
79  // if(!found) HLTCaloPath_ = "";
80  // }
81 
82  // size_t muonStar(HLTMuonPath_.find('*'));
83  // if(muonStar != string::npos){
84  // string muonSub(HLTMuonPath_.substr(0, muonStar));
85  // bool found(false);
86  // for(unsigned iP(0); iP < pathNames.size(); ++iP){
87  // if(pathNames[iP].substr(0, muonStar) == muonSub){
88  // HLTMuonPath_ = pathNames[iP];
89  // found = true;
90  // break;
91  // }
92  // }
93  // if(!found) HLTMuonPath_ = "";
94  // }
95 
96  // if(HLTCaloPath_.size()){
97  // try{
98  // HLTCaloBit_ = results.accept(HLTCaloPath_);
99  // }
100  // catch(cms::Exception e){
101  // if(e.category() != "LogicError") throw e;
102  // HLTCaloPath_ = "";
103  // }
104  // }
105  // if(HLTMuonPath_.size()){
106  // try{
107  // HLTMuonBit_ = results.accept(HLTMuonPath_);
108  // }
109  // catch(cms::Exception e){
110  // if(e.category() != "LogicError") throw e;
111  // HLTMuonPath_ = "";
112  // }
113  // }
114  // }
115  // }
116  }
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
EcalTrigPrimDigiCollection const * realTps_
Definition: TrigPrimTask.h:32
int bxBinEdges_[nBXBins+1]
Definition: TrigPrimTask.h:41
template<typename DigiCollection >
void ecaldqm::TrigPrimTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 120 of file TrigPrimTask.cc.

References ecaldqm::getTrigTowerMap(), DetId::rawId(), and towerReadouts_.

Referenced by analyze().

121  {
122  for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){
123  EcalTrigTowerDetId ttid(getTrigTowerMap()->towerOf(digiItr->id()));
124  towerReadouts_[ttid.rawId()]++;
125  }
126  }
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
EcalTrigTowerConstituentsMap const * getTrigTowerMap()
void ecaldqm::TrigPrimTask::runOnEmulTPs ( EcalTrigPrimDigiCollection const &  _tps)

Definition at line 192 of file TrigPrimTask.cc.

References edm::SortedCollection< T, SORT >::begin(), EcalTrigTowerConstituentsMap::constituentsOf(), edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), ecaldqm::getTrigTowerMap(), match(), ecaldqm::DQWorker::MEs_, realTps_, and towerReadouts_.

Referenced by analyze().

193  {
194  MESet& meEtMaxEmul(MEs_.at("EtMaxEmul"));
195  MESet& meEmulMaxIndex(MEs_.at("EmulMaxIndex"));
196  MESet& meMatchedIndex(MEs_.at("MatchedIndex"));
197  MESet& meEtEmulError(MEs_.at("EtEmulError"));
198  MESet& meFGEmulError(MEs_.at("FGEmulError"));
199 
200  for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){
201  EcalTrigTowerDetId ttid(tpItr->id());
202 
203  int et(tpItr->compressedEt());
204 
205  float maxEt(0.);
206  int iMax(0);
207  for(int iDigi(0); iDigi < 5; iDigi++){
208  float sampleEt((*tpItr)[iDigi].compressedEt());
209 
210  if(sampleEt > maxEt){
211  maxEt = sampleEt;
212  iMax = iDigi + 1;
213  }
214  }
215 
216  meEtMaxEmul.fill(ttid, maxEt);
217  if(maxEt > 0.)
218  meEmulMaxIndex.fill(ttid, iMax);
219 
220  bool match(true);
221  bool matchFG(true);
222 
224  if(realItr != realTps_->end()){
225 
226  int realEt(realItr->compressedEt());
227 
228  if(realEt > 0){
229 
230  int interest(realItr->ttFlag() & 0x3);
231  if((interest == 1 || interest == 3) && towerReadouts_[ttid.rawId()] == getTrigTowerMap()->constituentsOf(ttid).size()){
232 
233  if(et != realEt) match = false;
234  if(tpItr->fineGrain() != realItr->fineGrain()) matchFG = false;
235 
236  std::vector<int> matchedIndex(0);
237  for(int iDigi(0); iDigi < 5; iDigi++){
238  if((*tpItr)[iDigi].compressedEt() == realEt)
239  matchedIndex.push_back(iDigi + 1);
240  }
241 
242  if(!matchedIndex.size()) matchedIndex.push_back(0);
243  for(std::vector<int>::iterator matchItr(matchedIndex.begin()); matchItr != matchedIndex.end(); ++matchItr){
244  meMatchedIndex.fill(ttid, *matchItr + 0.5);
245 
246  // timing information is only within emulated TPs (real TPs have one time sample)
247  // if(HLTCaloBit_) MEs_[kTimingCalo].fill(ttid, float(*matchItr));
248  // if(HLTMuonBit_) MEs_[kTimingMuon].fill(ttid, float(*matchItr));
249  }
250  }
251 
252  }
253  }
254  else{
255  match = false;
256  matchFG = false;
257  }
258 
259  if(!match) meEtEmulError.fill(ttid);
260  if(!matchFG) meFGEmulError.fill(ttid);
261  }
262  }
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
EcalTrigTowerConstituentsMap const * getTrigTowerMap()
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
const_iterator end() const
EcalTrigPrimDigiCollection const * realTps_
Definition: TrigPrimTask.h:32
MESetCollection MEs_
Definition: DQWorker.h:76
iterator find(key_type k)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
void ecaldqm::TrigPrimTask::runOnRealTPs ( EcalTrigPrimDigiCollection const &  _tps)

Definition at line 129 of file TrigPrimTask.cc.

References edm::SortedCollection< T, SORT >::begin(), bxBin_, EcalTrigTowerConstituentsMap::constituentsOf(), EcalBarrel, EcalEndcap, edm::SortedCollection< T, SORT >::end(), ecaldqm::getTrigTowerMap(), ecaldqm::DQWorker::MEs_, realTps_, and towerReadouts_.

Referenced by analyze().

130  {
131  MESet& meEtVsBx(MEs_.at("EtVsBx"));
132  MESet& meEtReal(MEs_.at("EtReal"));
133  MESet& meEtRealMap(MEs_.at("EtRealMap"));
134  MESet& meEtSummary(MEs_.at("EtSummary"));
135  MESet& meLowIntMap(MEs_.at("LowIntMap"));
136  MESet& meMedIntMap(MEs_.at("MedIntMap"));
137  MESet& meHighIntMap(MEs_.at("HighIntMap"));
138  MESet& meTTFlags(MEs_.at("TTFlags"));
139  MESet& meTTFMismatch(MEs_.at("TTFMismatch"));
140  MESet& meOccVsBx(MEs_.at("OccVsBx"));
141 
142  realTps_ = &_tps;
143 
144  double nTP[] = {0., 0., 0.};
145 
146  for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){
147  EcalTrigTowerDetId ttid(tpItr->id());
148  float et(tpItr->compressedEt());
149 
150  if(et > 0.){
151  if(ttid.subDet() == EcalBarrel)
152  nTP[0] += 1.;
153  else if(ttid.zside() < 0)
154  nTP[1] += 1.;
155  else
156  nTP[2] += 2.;
157  meEtVsBx.fill(ttid, bxBin_, et);
158  }
159 
160  meEtReal.fill(ttid, et);
161  meEtRealMap.fill(ttid, et);
162  meEtSummary.fill(ttid, et);
163 
164  int interest(tpItr->ttFlag() & 0x3);
165 
166  switch(interest){
167  case 0:
168  meLowIntMap.fill(ttid);
169  break;
170  case 1:
171  meMedIntMap.fill(ttid);
172  break;
173  case 3:
174  meHighIntMap.fill(ttid);
175  break;
176  default:
177  break;
178  }
179 
180  meTTFlags.fill(ttid, float(tpItr->ttFlag()));
181 
182  if((interest == 1 || interest == 3) && towerReadouts_[ttid.rawId()] != getTrigTowerMap()->constituentsOf(ttid).size())
183  meTTFMismatch.fill(ttid);
184  }
185 
186  meOccVsBx.fill(EcalBarrel, bxBin_, nTP[0]);
187  meOccVsBx.fill(-EcalEndcap, bxBin_, nTP[1]);
188  meOccVsBx.fill(EcalEndcap, bxBin_, nTP[2]);
189  }
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
EcalTrigTowerConstituentsMap const * getTrigTowerMap()
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
EcalTrigPrimDigiCollection const * realTps_
Definition: TrigPrimTask.h:32
MESetCollection MEs_
Definition: DQWorker.h:76
void ecaldqm::TrigPrimTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 29 of file TrigPrimTask.cc.

References edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorker::MEs_, runOnEmul_, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
31  runOnEmul_ = _params.getUntrackedParameter<bool>("runOnEmul");
32  if(!runOnEmul_){
33  MEs_.erase(std::string("EtMaxEmul"));
34  MEs_.erase(std::string("EmulMaxIndex"));
35  MEs_.erase(std::string("MatchedIndex"));
36  MEs_.erase(std::string("EtEmulError"));
37  MEs_.erase(std::string("FGEmulError"));
38  }
39  }
MESetCollection MEs_
Definition: DQWorker.h:76

Member Data Documentation

double ecaldqm::TrigPrimTask::bxBin_
private

Definition at line 42 of file TrigPrimTask.h.

Referenced by beginEvent(), and runOnRealTPs().

int ecaldqm::TrigPrimTask::bxBinEdges_[nBXBins+1]
private

Definition at line 41 of file TrigPrimTask.h.

Referenced by beginEvent().

EcalTrigPrimDigiCollection const* ecaldqm::TrigPrimTask::realTps_
private

Definition at line 32 of file TrigPrimTask.h.

Referenced by beginEvent(), runOnEmulTPs(), and runOnRealTPs().

bool ecaldqm::TrigPrimTask::runOnEmul_
private

Definition at line 34 of file TrigPrimTask.h.

Referenced by addDependencies(), analyze(), and setParams().

std::map<uint32_t, unsigned> ecaldqm::TrigPrimTask::towerReadouts_
private

Definition at line 44 of file TrigPrimTask.h.

Referenced by beginEvent(), runOnDigis(), runOnEmulTPs(), and runOnRealTPs().