CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions
DTLocalTriggerTest Class Reference

#include <DTLocalTriggerTest.h>

Inheritance diagram for DTLocalTriggerTest:
DTLocalTriggerBaseTest edm::EDAnalyzer

Public Member Functions

 DTLocalTriggerTest (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTLocalTriggerTest ()
 Destructor. More...
 
- Public Member Functions inherited from DTLocalTriggerBaseTest
 DTLocalTriggerBaseTest ()
 Constructor. More...
 
virtual ~DTLocalTriggerBaseTest ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void beginJob ()
 BeginJob. More...
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun. More...
 
void runClientDiagnostic ()
 Run client analysis. More...
 
- Protected Member Functions inherited from DTLocalTriggerBaseTest
void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Perform begin lumiblock operations. More...
 
void bookCmsHistos (std::string hTag, std::string folder="")
 Book the new MEs (CMS summary) More...
 
void bookSectorHistos (int wheel, int sector, std::string hTag, std::string folder="")
 Book the new MEs (for each sector) More...
 
void bookWheelHistos (int wheel, std::string hTag, std::string folder="")
 Book the new MEs (for each wheel) More...
 
std::string category ()
 Get message logger name. More...
 
void endJob ()
 EndJob. More...
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Perform client diagnostic in online. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &context)
 Perform client diagnostic in offline. More...
 
std::string fullName (std::string htype)
 Create fullname from histo partial name. More...
 
template<class T >
TgetHisto (MonitorElement *me)
 Convert ME to Histogram fo type T. More...
 
std::string getMEName (std::string histoTag, std::string subfolder, const DTChamberId &chambid)
 Get the ME name (by chamber) More...
 
std::string getMEName (std::string histoTag, std::string subfolder, int wh)
 Get the ME name (by wheel) More...
 
std::pair< float, float > phiRange (const DTChamberId &id)
 Calculate phi range for histograms. More...
 
void setConfig (const edm::ParameterSet &ps, std::string name)
 Set configuration variables. More...
 
std::string & topFolder (bool isDCC)
 Get top folder name. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DTLocalTriggerBaseTest
std::string baseFolderDCC
 
std::string baseFolderDDU
 
std::map< std::string,
MonitorElement * > 
cmsME
 
DQMStoredbe
 
std::string hwSource
 
std::vector< std::string > hwSources
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
unsigned int nLumiSegs
 
edm::ParameterSet parameters
 
int prescaleFactor
 
int run
 
bool runOnline
 
std::map< int, std::map
< std::string, MonitorElement * > > 
secME
 
std::string sourceFolder
 
std::string testName
 
std::string trigSource
 
std::vector< std::string > trigSources
 
std::map< int, std::map
< std::string, MonitorElement * > > 
whME
 

Detailed Description

Definition at line 20 of file DTLocalTriggerTest.h.

Constructor & Destructor Documentation

DTLocalTriggerTest::DTLocalTriggerTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 36 of file DTLocalTriggerTest.cc.

36  {
37 
38  setConfig(ps,"DTLocalTrigger");
39  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
40  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
41 
42 }
void setConfig(const edm::ParameterSet &ps, std::string name)
Set configuration variables.
DTLocalTriggerTest::~DTLocalTriggerTest ( )
virtual

Destructor.

Definition at line 45 of file DTLocalTriggerTest.cc.

45  {
46 
47 }

Member Function Documentation

void DTLocalTriggerTest::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 49 of file DTLocalTriggerTest.cc.

References DTLocalTriggerBaseTest::beginJob(), and Parameters::parameters.

49  {
50 
52 
53 
54  vector<string>::const_iterator iTr = trigSources.begin();
55  vector<string>::const_iterator trEnd = trigSources.end();
56  vector<string>::const_iterator iHw = hwSources.begin();
57  vector<string>::const_iterator hwEnd = hwSources.end();
58 
59 
60  //Booking
61  if(parameters.getUntrackedParameter<bool>("staticBooking", true)){
62  for (; iTr != trEnd; ++iTr){
63  trigSource = (*iTr);
64  for (; iHw != hwEnd; ++iHw){
65  hwSource = (*iHw);
66  // Loop over the TriggerUnits
67  for (int wh=-2; wh<=2; ++wh){
68  if (hwSource=="COM") {
69  bookWheelHistos(wh,"MatchingPhi");
70  }
71  else {
72  for (int sect=1; sect<=12; ++sect){
73  bookSectorHistos(wh,sect,"BXDistribPhi");
74  bookSectorHistos(wh,sect,"QualDistribPhi");
75  }
76  bookWheelHistos(wh,"CorrectBXPhi");
77  bookWheelHistos(wh,"ResidualBXPhi");
78  bookWheelHistos(wh,"CorrFractionPhi");
79  bookWheelHistos(wh,"2ndFractionPhi");
80  bookWheelHistos(wh,"TriggerInclusivePhi");
81  bookWheelHistos(wh,"CorrectBXTheta");
82  if (hwSource=="DDU") {
83  bookWheelHistos(wh,"HFractionTheta");
84  }
85  }
86  }
87  }
88  }
89  }
90  // Summary test histo booking (only static)
91  for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
92  trigSource = (*iTr);
93  for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
94  hwSource = (*iHw);
95  // Loop over the TriggerUnits
96  for (int wh=-2; wh<=2; ++wh){
97  if (hwSource=="COM") {
98  bookWheelHistos(wh,"MatchingSummary","Matching");
99  }
100  else {
101  bookWheelHistos(wh,"CorrFractionSummary");
102  bookWheelHistos(wh,"2ndFractionSummary");
103  }
104  }
105  if (hwSource=="COM") {
106  bookCmsHistos("MatchingSummary","Matching");
107  }
108  else {
109  bookCmsHistos("CorrFractionSummary");
110  bookCmsHistos("2ndFractionSummary");
111  }
112  }
113  }
114 
115 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
void bookCmsHistos(std::string hTag, std::string folder="")
Book the new MEs (CMS summary)
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
void bookSectorHistos(int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
std::vector< std::string > hwSources
void DTLocalTriggerTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

BeginRun.

Reimplemented from DTLocalTriggerBaseTest.

Definition at line 118 of file DTLocalTriggerTest.cc.

References DTLocalTriggerBaseTest::beginRun().

118  {
119 
121 
122 }
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
void DTLocalTriggerTest::runClientDiagnostic ( )
protectedvirtual

Run client analysis.

Implements DTLocalTriggerBaseTest.

Definition at line 125 of file DTLocalTriggerTest.cc.

References end, python.tagInventory::entries, spr::find(), newFWLiteAna::fullName, and Parameters::parameters.

125  {
126 
127  // Loop over Trig & Hw sources
128  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
129  trigSource = (*iTr);
130  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
131  hwSource = (*iHw);
132  // Loop over the TriggerUnits
133  for (int stat=1; stat<=4; ++stat){
134  for (int wh=-2; wh<=2; ++wh){
135  for (int sect=1; sect<=12; ++sect){
136  DTChamberId chId(wh,stat,sect);
137  int sector_id = (wh+3)+(sect-1)*5;
138  // uint32_t indexCh = chId.rawId();
139 
140  if (hwSource=="COM") {
141  // Perform DCC-DDU matching test and generates summaries (Phi view)
142  TH2F * DDUvsDCC = getHisto<TH2F>(dbe->get(getMEName("QualDDUvsQualDCC","LocalTriggerPhi", chId)));
143  if (DDUvsDCC) {
144 
145  int matchSummary = 1;
146 
147  if (DDUvsDCC->GetEntries()>1) {
148 
149  double entries = DDUvsDCC->GetEntries();
150  double corrEntries = 0;
151  for (int ibin=2; ibin<=8; ++ibin) {
152  corrEntries += DDUvsDCC->GetBinContent(ibin,ibin);
153  }
154  double corrRatio = corrEntries/entries;
155 
156  if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracError",.65)){
157  matchSummary = 2;
158  }
159  else if (corrRatio < parameters.getUntrackedParameter<double>("matchingFracWarning",.85)){
160  matchSummary = 3;
161  }
162  else {
163  matchSummary = 0;
164  }
165 
166  if( whME[wh].find(fullName("MatchingPhi")) == whME[wh].end() ){
167  bookWheelHistos(wh,"MatchingPhi");
168  }
169 
170  whME[wh].find(fullName("MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
171 
172  }
173 
174  whME[wh].find(fullName("MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
175 
176  }
177  }
178  else {
179  // Perform DCC/DDU common plot analysis (Phi ones)
180  TH2F * BXvsQual = getHisto<TH2F>(dbe->get(getMEName("BXvsQual","LocalTriggerPhi", chId)));
181  TH1F * BestQual = getHisto<TH1F>(dbe->get(getMEName("BestQual","LocalTriggerPhi", chId)));
182  TH2F * Flag1stvsQual = getHisto<TH2F>(dbe->get(getMEName("Flag1stvsQual","LocalTriggerPhi", chId)));
183  if (BXvsQual && Flag1stvsQual && BestQual) {
184 
185  int corrSummary = 1;
186  int secondSummary = 1;
187 
188  if (BestQual->GetEntries()>1) {
189 
190  TH1D* BXHH = BXvsQual->ProjectionY("",6,7,"");
191  TH1D* Flag1st = Flag1stvsQual->ProjectionY();
192  int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
193  double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
194  double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
195  double trigsFlag2nd = Flag1st->GetBinContent(2);
196  double trigs = Flag1st->GetEntries();
197  double besttrigs = BestQual->GetEntries();
198  double besttrigsCorr = BestQual->Integral(5,7,"");
199  delete BXHH;
200  delete Flag1st;
201 
202  double corrFrac = besttrigsCorr/besttrigs;
203  double secondFrac = trigsFlag2nd/trigs;
204  if (corrFrac < parameters.getUntrackedParameter<double>("corrFracError",.5)){
205  corrSummary = 2;
206  }
207  else if (corrFrac < parameters.getUntrackedParameter<double>("corrFracWarning",.6)){
208  corrSummary = 3;
209  }
210  else {
211  corrSummary = 0;
212  }
213  if (secondFrac > parameters.getUntrackedParameter<double>("secondFracError",.2)){
214  secondSummary = 2;
215  }
216  else if (secondFrac > parameters.getUntrackedParameter<double>("secondFracWarning",.1)){
217  secondSummary = 3;
218  }
219  else {
220  secondSummary = 0;
221  }
222 
223  if( secME[sector_id].find(fullName("BXDistribPhi")) == secME[sector_id].end() ){
224  bookSectorHistos(wh,sect,"QualDistribPhi");
225  bookSectorHistos(wh,sect,"BXDistribPhi");
226  }
227 
228  TH1D* BXDistr = BXvsQual->ProjectionY();
229  TH1D* QualDistr = BXvsQual->ProjectionX();
230  std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
231 
232  int nbinsBX = BXDistr->GetNbinsX();
233  int firstBinCenter = static_cast<int>(BXDistr->GetBinCenter(1));
234  int lastBinCenter = static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
235  int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
236  int iMax = lastBinCenter<20 ? lastBinCenter : 20;
237  for (int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
238  innerME->find(fullName("BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
239  }
240  for (int ibin=1;ibin<=7;++ibin) {
241  innerME->find(fullName("QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
242  }
243 
244  delete BXDistr;
245  delete QualDistr;
246 
247  if( whME[wh].find(fullName("CorrectBXPhi")) == whME[wh].end() ){
248  bookWheelHistos(wh,"ResidualBXPhi");
249  bookWheelHistos(wh,"CorrectBXPhi");
250  bookWheelHistos(wh,"CorrFractionPhi");
251  bookWheelHistos(wh,"2ndFractionPhi");
252  bookWheelHistos(wh,"TriggerInclusivePhi");
253  }
254 
255  innerME = &(whME[wh]);
256  innerME->find(fullName("CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
257  innerME->find(fullName("ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
258  innerME->find(fullName("CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
259  innerME->find(fullName("TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
260  innerME->find(fullName("2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
261 
262  }
263 
264  whME[wh].find(fullName("CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
265  whME[wh].find(fullName("2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
266 
267  }
268 
269  if (hwSource=="DDU") {
270  // Perform DDU plot analysis (Theta ones)
271  TH2F * ThetaBXvsQual = getHisto<TH2F>(dbe->get(getMEName("ThetaBXvsQual","LocalTriggerTheta", chId)));
272  TH1F * ThetaBestQual = getHisto<TH1F>(dbe->get(getMEName("ThetaBestQual","LocalTriggerTheta", chId)));
273 
274  // no theta triggers in stat 4!
275  if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
276  TH1D* BXH = ThetaBXvsQual->ProjectionY("",4,4,"");
277  int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
278  double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
279  double trigs = ThetaBestQual->GetEntries();
280  double trigsH = ThetaBestQual->GetBinContent(4);
281  delete BXH;
282 
283  // if( secME[sector_id].find(fullName("HFractionTheta")) == secME[sector_id].end() ){
284  // // bookSectorHistos(wh,sect,"CorrectBXTheta");
285  // bookSectorHistos(wh,sect,"HFractionTheta");
286  // }
287  //std::map<std::string,MonitorElement*> *innerME = &(secME.find(sector_id)->second);
288  // innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(stat,BX_OK);
289  //innerME->find(fullName("HFractionTheta"))->second->setBinContent(stat,trigsH/trigs);
290 
291  if( whME[wh].find(fullName("HFractionTheta")) == whME[wh].end() ){
292  bookWheelHistos(wh,"CorrectBXTheta");
293  bookWheelHistos(wh,"HFractionTheta");
294  }
295  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
296  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
297  innerME->find(fullName("HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
298 
299  }
300  }
301  else if (hwSource=="DCC") {
302  // Perform DCC plot analysis (Theta ones)
303  TH2F * ThetaPosvsBX = getHisto<TH2F>(dbe->get(getMEName("PositionvsBX","LocalTriggerTheta", chId)));
304 
305  // no theta triggers in stat 4!
306  if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
307  TH1D* BX = ThetaPosvsBX->ProjectionX();
308  int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
309  double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
310  delete BX;
311 
312  if( whME[wh].find(fullName("CorrectBXTheta")) == whME[wh].end() ){
313  bookWheelHistos(wh,"CorrectBXTheta");
314  }
315  std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
316  innerME->find(fullName("CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
317 
318  }
319  }
320  }
321 
322  }
323  }
324  }
325  }
326  }
327 
328  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
329  trigSource = (*iTr);
330  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
331  hwSource = (*iHw);
332  for (int wh=-2; wh<=2; ++wh){
333  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
334  if(hwSource=="COM") {
335  TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(fullName("MatchingSummary"))->second);
336  for (int sect=1; sect<=12; ++sect){
337  int matchErr = 0;
338  int matchNoData = 0;
339  for (int stat=1; stat<=4; ++stat){
340  switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
341  case 1:
342  matchNoData++;
343  case 2:
344  matchErr++;
345  }
346  }
347  if (matchNoData == 4) matchErr = 5;
348  cmsME.find(fullName("MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
349  }
350  }
351  else {
352  TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(fullName("CorrFractionSummary"))->second);
353  TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(fullName("2ndFractionSummary"))->second);
354  for (int sect=1; sect<=12; ++sect){
355  int corrErr = 0;
356  int secondErr = 0;
357  int corrNoData = 0;
358  int secondNoData = 0;
359  for (int stat=1; stat<=4; ++stat){
360  switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
361  case 1:
362  corrNoData++;
363  case 2:
364  corrErr++;
365  }
366  switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
367  case 1:
368  secondNoData++;
369  case 2:
370  secondErr++;
371  }
372  }
373  if (corrNoData == 4) corrErr = 5;
374  if (secondNoData == 4) secondErr = 5;
375  cmsME.find(fullName("CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
376  cmsME.find(fullName("2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
377  }
378  }
379  }
380  }
381  }
382 
383 }
std::map< int, std::map< std::string, MonitorElement * > > secME
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > trigSources
std::map< int, std::map< std::string, MonitorElement * > > whME
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void bookWheelHistos(int wheel, std::string hTag, std::string folder="")
Book the new MEs (for each wheel)
void bookSectorHistos(int wheel, int sector, std::string hTag, std::string folder="")
Book the new MEs (for each sector)
#define end
Definition: vmac.h:38
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1265
std::string getMEName(std::string histoTag, std::string subfolder, const DTChamberId &chambid)
Get the ME name (by chamber)
std::map< std::string, MonitorElement * > cmsME
std::vector< std::string > hwSources
std::string fullName(std::string htype)
Create fullname from histo partial name.