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::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
bool booked_
 
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 21 of file TrigPrimTask.cc.

21  :
22  DQWorkerTask(),
23  realTps_(0),
24  runOnEmul_(false),
25  // HLTCaloPath_(""),
26  // HLTMuonPath_(""),
27  // HLTCaloBit_(false),
28  // HLTMuonBit_(false),
29  bxBinEdges_{1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565},
30  bxBin_(0.),
32  {
33  }
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 &  _es 
)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 55 of file TrigPrimTask.cc.

References edm::EventBase::bunchCrossing(), bxBin_, bxBinEdges_, EcalBarrel, EcalEndcap, edm::EventSetup::get(), EcalTPGTowerStatus::getMap(), EcalTPGStripStatus::getMap(), ecaldqm::DQWorker::MEs_, nBXBins, realTps_, EcalTrigTowerDetId::subDet(), EcalElectronicsId::subdet(), and towerReadouts_.

56  {
57  using namespace std;
58 
59  towerReadouts_.clear();
60 
61  realTps_ = 0;
62 
63  // HLTCaloBit_ = false;
64  // HLTMuonBit_ = false;
65 
66  int* pBin(std::upper_bound(bxBinEdges_, bxBinEdges_ + nBXBins + 1, _evt.bunchCrossing()));
67  bxBin_ = static_cast<int>(pBin - bxBinEdges_) - 0.5;
68 
70  _es.get<EcalTPGTowerStatusRcd>().get(TTStatusRcd);
71  const EcalTPGTowerStatus * TTStatus=TTStatusRcd.product();
72  const EcalTPGTowerStatusMap &towerMap=TTStatus->getMap();
73 
74  edm::ESHandle<EcalTPGStripStatus> StripStatusRcd;
75  _es.get<EcalTPGStripStatusRcd>().get(StripStatusRcd);
76  const EcalTPGStripStatus * StripStatus=StripStatusRcd.product();
77  const EcalTPGStripStatusMap &stripMap=StripStatus->getMap();
78 
79  MESet& meTTMaskMap(MEs_.at("TTMaskMap"));
80 
81  for(EcalTPGTowerStatusMap::const_iterator ttItr(towerMap.begin()); ttItr != towerMap.end(); ++ttItr){
82 
83  if ((*ttItr).second > 0)
84  {
85  const EcalTrigTowerDetId ttid((*ttItr).first);
86  if(ttid.subDet() == EcalBarrel)
87  meTTMaskMap.fill(ttid,1);
88  }//masked
89  }//loop on towers
90 
91  for(EcalTPGStripStatusMap::const_iterator stItr(stripMap.begin()); stItr != stripMap.end(); ++stItr){
92 
93  if ((*stItr).second > 0)
94  {
95  const EcalElectronicsId stid((*stItr).first);
96  if(stid.subdet() == EcalEndcap);
97  meTTMaskMap.fill(stid,1);
98  }//masked
99  }//loop on pseudo-strips
100 
101  // if(HLTCaloPath_.size() || HLTMuonPath_.size()){
102  // edm::TriggerResultsByName results(_evt.triggerResultsByName("HLT"));
103  // if(!results.isValid()) results = _evt.triggerResultsByName("RECO");
104  // if(results.isValid()){
105  // const vector<string>& pathNames(results.triggerNames());
106 
107  // size_t caloStar(HLTCaloPath_.find('*'));
108  // if(caloStar != string::npos){
109  // string caloSub(HLTCaloPath_.substr(0, caloStar));
110  // bool found(false);
111  // for(unsigned iP(0); iP < pathNames.size(); ++iP){
112  // if(pathNames[iP].substr(0, caloStar) == caloSub){
113  // HLTCaloPath_ = pathNames[iP];
114  // found = true;
115  // break;
116  // }
117  // }
118  // if(!found) HLTCaloPath_ = "";
119  // }
120 
121  // size_t muonStar(HLTMuonPath_.find('*'));
122  // if(muonStar != string::npos){
123  // string muonSub(HLTMuonPath_.substr(0, muonStar));
124  // bool found(false);
125  // for(unsigned iP(0); iP < pathNames.size(); ++iP){
126  // if(pathNames[iP].substr(0, muonStar) == muonSub){
127  // HLTMuonPath_ = pathNames[iP];
128  // found = true;
129  // break;
130  // }
131  // }
132  // if(!found) HLTMuonPath_ = "";
133  // }
134 
135  // if(HLTCaloPath_.size()){
136  // try{
137  // HLTCaloBit_ = results.accept(HLTCaloPath_);
138  // }
139  // catch(cms::Exception e){
140  // if(e.category() != "LogicError") throw e;
141  // HLTCaloPath_ = "";
142  // }
143  // }
144  // if(HLTMuonPath_.size()){
145  // try{
146  // HLTMuonBit_ = results.accept(HLTMuonPath_);
147  // }
148  // catch(cms::Exception e){
149  // if(e.category() != "LogicError") throw e;
150  // HLTMuonPath_ = "";
151  // }
152  // }
153  // }
154  // }
155  }
std::map< uint32_t, uint16_t > EcalTPGTowerStatusMap
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::map< uint32_t, unsigned > towerReadouts_
Definition: TrigPrimTask.h:44
const std::map< uint32_t, uint16_t > & getMap() const
EcalTrigPrimDigiCollection const * realTps_
Definition: TrigPrimTask.h:32
int bxBinEdges_[nBXBins+1]
Definition: TrigPrimTask.h:41
MESetCollection MEs_
Definition: DQWorker.h:75
const std::map< uint32_t, uint16_t > & getMap() const
std::map< uint32_t, uint16_t > EcalTPGStripStatusMap
template<typename DigiCollection >
void ecaldqm::TrigPrimTask::runOnDigis ( DigiCollection const &  _digis)

Definition at line 159 of file TrigPrimTask.cc.

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

Referenced by analyze().

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

Definition at line 231 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().

232  {
233  MESet& meEtMaxEmul(MEs_.at("EtMaxEmul"));
234  MESet& meEmulMaxIndex(MEs_.at("EmulMaxIndex"));
235  MESet& meMatchedIndex(MEs_.at("MatchedIndex"));
236  MESet& meEtEmulError(MEs_.at("EtEmulError"));
237  MESet& meFGEmulError(MEs_.at("FGEmulError"));
238 
239  for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){
240  EcalTrigTowerDetId ttid(tpItr->id());
241 
242  int et(tpItr->compressedEt());
243 
244  float maxEt(0.);
245  int iMax(0);
246  for(int iDigi(0); iDigi < 5; iDigi++){
247  float sampleEt((*tpItr)[iDigi].compressedEt());
248 
249  if(sampleEt > maxEt){
250  maxEt = sampleEt;
251  iMax = iDigi + 1;
252  }
253  }
254 
255  meEtMaxEmul.fill(ttid, maxEt);
256  if(maxEt > 0.)
257  meEmulMaxIndex.fill(ttid, iMax);
258 
259  bool match(true);
260  bool matchFG(true);
261 
263  if(realItr != realTps_->end()){
264 
265  int realEt(realItr->compressedEt());
266 
267  if(realEt > 0){
268 
269  int interest(realItr->ttFlag() & 0x3);
270  if((interest == 1 || interest == 3) && towerReadouts_[ttid.rawId()] == getTrigTowerMap()->constituentsOf(ttid).size()){
271 
272  if(et != realEt) match = false;
273  if(tpItr->fineGrain() != realItr->fineGrain()) matchFG = false;
274 
275  std::vector<int> matchedIndex(0);
276  for(int iDigi(0); iDigi < 5; iDigi++){
277  if((*tpItr)[iDigi].compressedEt() == realEt)
278  matchedIndex.push_back(iDigi + 1);
279  }
280 
281  if(!matchedIndex.size()) matchedIndex.push_back(0);
282  for(std::vector<int>::iterator matchItr(matchedIndex.begin()); matchItr != matchedIndex.end(); ++matchItr){
283  meMatchedIndex.fill(ttid, *matchItr + 0.5);
284 
285  // timing information is only within emulated TPs (real TPs have one time sample)
286  // if(HLTCaloBit_) MEs_[kTimingCalo].fill(ttid, float(*matchItr));
287  // if(HLTMuonBit_) MEs_[kTimingMuon].fill(ttid, float(*matchItr));
288  }
289  }
290 
291  }
292  }
293  else{
294  match = false;
295  matchFG = false;
296  }
297 
298  if(!match) meEtEmulError.fill(ttid);
299  if(!matchFG) meFGEmulError.fill(ttid);
300  }
301  }
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:75
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:10
void ecaldqm::TrigPrimTask::runOnRealTPs ( EcalTrigPrimDigiCollection const &  _tps)

Definition at line 168 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().

169  {
170  MESet& meEtVsBx(MEs_.at("EtVsBx"));
171  MESet& meEtReal(MEs_.at("EtReal"));
172  MESet& meEtRealMap(MEs_.at("EtRealMap"));
173  MESet& meEtSummary(MEs_.at("EtSummary"));
174  MESet& meLowIntMap(MEs_.at("LowIntMap"));
175  MESet& meMedIntMap(MEs_.at("MedIntMap"));
176  MESet& meHighIntMap(MEs_.at("HighIntMap"));
177  MESet& meTTFlags(MEs_.at("TTFlags"));
178  MESet& meTTFMismatch(MEs_.at("TTFMismatch"));
179  MESet& meOccVsBx(MEs_.at("OccVsBx"));
180 
181  realTps_ = &_tps;
182 
183  double nTP[] = {0., 0., 0.};
184 
185  for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){
186  EcalTrigTowerDetId ttid(tpItr->id());
187  float et(tpItr->compressedEt());
188 
189  if(et > 0.){
190  if(ttid.subDet() == EcalBarrel)
191  nTP[0] += 1.;
192  else if(ttid.zside() < 0)
193  nTP[1] += 1.;
194  else
195  nTP[2] += 2.;
196  meEtVsBx.fill(ttid, bxBin_, et);
197  }
198 
199  meEtReal.fill(ttid, et);
200  meEtRealMap.fill(ttid, et);
201  meEtSummary.fill(ttid, et);
202 
203  int interest(tpItr->ttFlag() & 0x3);
204 
205  switch(interest){
206  case 0:
207  meLowIntMap.fill(ttid);
208  break;
209  case 1:
210  meMedIntMap.fill(ttid);
211  break;
212  case 3:
213  meHighIntMap.fill(ttid);
214  break;
215  default:
216  break;
217  }
218 
219  meTTFlags.fill(ttid, float(tpItr->ttFlag()));
220 
221  if((interest == 1 || interest == 3) && towerReadouts_[ttid.rawId()] != getTrigTowerMap()->constituentsOf(ttid).size())
222  meTTFMismatch.fill(ttid);
223  }
224 
225  meOccVsBx.fill(EcalBarrel, bxBin_, nTP[0]);
226  meOccVsBx.fill(-EcalEndcap, bxBin_, nTP[1]);
227  meOccVsBx.fill(EcalEndcap, bxBin_, nTP[2]);
228  }
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:75
void ecaldqm::TrigPrimTask::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 36 of file TrigPrimTask.cc.

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

37  {
38  runOnEmul_ = _params.getUntrackedParameter<bool>("runOnEmul");
39  if(!runOnEmul_){
40  MEs_.erase(std::string("EtMaxEmul"));
41  MEs_.erase(std::string("EmulMaxIndex"));
42  MEs_.erase(std::string("MatchedIndex"));
43  MEs_.erase(std::string("EtEmulError"));
44  MEs_.erase(std::string("FGEmulError"));
45  }
46  }
MESetCollection MEs_
Definition: DQWorker.h:75

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().