CMS 3D CMS Logo

DTLocalTriggerTPTest.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author C. Battilana S. Marcellini - INFN Bologna
5  *
6  * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my
7  *
8  */
9 
10 
11 // This class header
13 
14 // Framework headers
19 
20 // Geometry
23 
24 // Root
25 #include "TF1.h"
26 #include "TProfile.h"
27 
28 
29 //C++ headers
30 #include <iostream>
31 #include <sstream>
32 
33 using namespace edm;
34 using namespace std;
35 
36 
38 
39  setConfig(ps,"DTLocalTriggerTP");
40  baseFolderTM = "DT/11-LocalTriggerTP-TM/";
41  baseFolderDDU = "DT/12-LocalTriggerTP-DDU/";
42 
43  bookingdone = false;
44 
45 }
46 
47 
49 
50 }
51 
52 
54 
55  vector<string>::const_iterator iTr = trigSources.begin();
56  vector<string>::const_iterator trEnd = trigSources.end();
57  vector<string>::const_iterator iHw = hwSources.begin();
58  vector<string>::const_iterator hwEnd = hwSources.end();
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  bookWheelHistos(ibooker,wh,"CorrectBXPhi");
69  bookWheelHistos(ibooker,wh,"ResidualBXPhi");
70  }
71  }
72  }
73  }
74 
75 
76  bookingdone = true;
77 
78 }
79 
80 
82 
84 
85 }
86 
88  DQMStore::IGetter & igetter) {
89  if (!bookingdone) Bookings(ibooker,igetter);
90 
91  // Loop over Trig & Hw sources
92  for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
93  trigSource = (*iTr);
94  for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
95  hwSource = (*iHw);
96  // Loop over the TriggerUnits
97  for (int stat=1; stat<=4; ++stat){
98  for (int wh=-2; wh<=2; ++wh){
99  for (int sect=1; sect<=12; ++sect){
100  DTChamberId chId(wh,stat,sect);
101 
102  // Perform TM/DDU common plot analysis (Phi ones)
103  TH2F * BXvsQual = getHisto<TH2F>(igetter.get(getMEName("BXvsQual_In","LocalTriggerPhiIn", chId)));
104  if ( BXvsQual ) {
105 
106  if (BXvsQual->GetEntries()>1) {
107 
108  TH1D* BX = BXvsQual->ProjectionY();
109  int BXOK_bin = BX->GetMaximumBin();
110  double BXMean = BX->GetMean();
111  double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
112  delete BX;
113 
114  if( whME[wh].find(fullName("CorrectBXPhi")) == whME[wh].end() ){
115  bookWheelHistos(ibooker,wh,"ResidualBXPhi");
116  bookWheelHistos(ibooker,wh,"CorrectBXPhi");
117  }
118 
119  std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
120  innerME->find(fullName("CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
121  innerME->find(fullName("ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
122  }
123 
124  }
125  }
126  }
127  }
128  }
129  }
130 
131 }
132 
133 
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
DTLocalTriggerTPTest(const edm::ParameterSet &ps)
Constructor.
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
~DTLocalTriggerTPTest() override
Destructor.
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
Run client analysis.
#define end
Definition: vmac.h:39
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
HLT enums.
Definition: Run.h:44