CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDCSByLumiSummary.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2011/03/02 14:00:29 $
5  * $Revision: 1.1 $
6  * \author C. Battilana - CIEMAT
7  * \author P. Bellan - INFN PD
8  * \author A. Branca = INFN PD
9  */
10 
11 
14 
19 
22 
23 #include<string>
24 
25 
26 using namespace std;
27 using namespace edm;
28 
29 
31 
32 
34 
35 
37 
38  theDQMStore = Service<DQMStore>().operator->();
39 
40  // book the ME
41  theDQMStore->setCurrentFolder("DT/EventInfo/DCSContents");
42 
43  totalDCSFraction = theDQMStore->bookFloat("DTDCSSummary");
44  totalDCSFraction->setLumiFlag(); // set LumiFlag to DCS content value (save it by lumi)
45 
46  globalHVSummary = theDQMStore->book2D("HVGlbSummary","HV Status Summary",1,1,13,5,-2,3);
47  globalHVSummary->setAxisTitle("Sectors",1);
48  globalHVSummary->setAxisTitle("Wheel",2);
49 
50  for(int wh=-2;wh<=2;wh++){
51 
52  stringstream wheel_str; wheel_str << wh;
53 
54  MonitorElement* FractionWh = theDQMStore->bookFloat("DT_Wheel"+wheel_str.str());
55  FractionWh->setLumiFlag(); // set LumiFlag to DCS content value (save it by lumi)
56 
57  totalDCSFractionWh.push_back(FractionWh);
58  }
59 
60  globalHVSummary->Reset();
61 
62 }
63 
64 
66 
67  // CB LumiFlag marked products are reset on LS boundaries
68  totalDCSFraction->Reset();
69 
70  for(int wh=-2;wh<=2;wh++){
71  totalDCSFractionWh[wh+2]->Reset();
72  }
73 
74 }
75 
76 
78 
79  // Get the by lumi product plot from the task
80  int lumiNumber = lumi.id().luminosityBlock();
81 
82  bool null_pointer_histo(0);
83 
84  std::vector<float> wh_activeFrac;
85 
86  for(int wh=-2;wh<=2;wh++){
87 
88  stringstream wheel_str; wheel_str << wh;
89 
90  string hActiveUnitsPath = "DT/EventInfo/DCSContents/hActiveUnits"+wheel_str.str();
91  MonitorElement *hActiveUnits = theDQMStore->get(hActiveUnitsPath);
92 
93  if (hActiveUnits) {
94  float activeFrac = static_cast<float>(hActiveUnits->getBinContent(2)) / // CB 2nd bin is # of active channels
95  hActiveUnits->getBinContent(1); // first bin is overall number of channels
96 
97  if(activeFrac < 0.) activeFrac=-1;
98 
99  wh_activeFrac.push_back(activeFrac);
100 
101  // Fill by lumi Certification ME
102  totalDCSFraction->Fill(activeFrac);
103  totalDCSFractionWh[wh+2]->Fill(activeFrac);
104 
105  } else {
106  LogTrace("DTDQM|DTMonitorClient|DTDCSByLumiSummary")
107  << "[DTDCSByLumiSummary]: got null pointer retrieving histo at :"
108  << hActiveUnitsPath << " for lumi # " << lumiNumber
109  << "client operation not performed." << endl;
110 
111  null_pointer_histo=true;
112  }
113 
114  } // end loop on wheels
115 
116  if(!null_pointer_histo) dcsFracPerLumi[lumiNumber] = wh_activeFrac; // Fill map to be used to compute trend plots
117 
118 }
119 
120 
122 
123 
124  // Book trend plots ME & loop on map to fill it with by lumi info
125  map<int,std::vector<float> >::const_iterator fracPerLumiIt = dcsFracPerLumi.begin();
126  map<int,std::vector<float> >::const_iterator fracPerLumiEnd = dcsFracPerLumi.end();
127 
128  int fLumi = dcsFracPerLumi.begin()->first;
129  int lLumi = dcsFracPerLumi.rbegin()->first;
130  theDQMStore->setCurrentFolder("DT/EventInfo/DCSContents");
131 
132  int nLumis = lLumi-fLumi + 1.;
133 
134  // trend plots
135  for(int wh=-2; wh<=2; wh++) {
136 
137  stringstream wheel_str; wheel_str << wh;
138 
139  DTTimeEvolutionHisto* trend;
140 
141  trend = new DTTimeEvolutionHisto(theDQMStore, "hDCSFracTrendWh" + wheel_str.str(), "Fraction of DT-HV ON Wh" + wheel_str.str(),
142  nLumis, fLumi, 1, false, 2);
143 
144  hDCSFracTrend.push_back(trend);
145 
146  }
147 
148  float goodLSperWh[5] = {0,0,0,0,0};
149  float badLSperWh[5] = {0,0,0,0,0};
150 
151  // fill trend plots and save infos for summaryPlot
152  for(;fracPerLumiIt!=fracPerLumiEnd;++fracPerLumiIt) {
153 
154  for(int wh=-2; wh<=2; wh++) {
155 
156  std::vector<float> activeFracPerWh;
157  activeFracPerWh = fracPerLumiIt->second;
158 
159  hDCSFracTrend[wh+2]->setTimeSlotValue(activeFracPerWh[wh+2],fracPerLumiIt->first);
160 
161  if( activeFracPerWh[wh+2] > 0 ) { // we do not count the lumi were the DTs are off (no real problem),
162  // even if this can happen in the middle of a run (real problem: to be fixed)
163  if( activeFracPerWh[wh+2] > 0.9 ) goodLSperWh[wh+2]++;
164  else {
165  badLSperWh[wh+2]++;
166  }
167  } else { // there is no HV value OR all channels OFF
168  if( activeFracPerWh[wh+2] < 0 ) badLSperWh[wh+2]=-1; // if there were no HV values, activeFrac returning -1
169  }
170 
171  }
172 
173  }
174 
175  // fill summaryPlot
176  for(int wh=-2; wh<=2; wh++) {
177 
178  if( goodLSperWh[wh+2] != 0 || badLSperWh[wh+2] == -1 ) {
179 
180  float r = badLSperWh[wh+2]/fabs(goodLSperWh[wh+2] + badLSperWh[wh+2]);
181  if( r > 0.5 ) globalHVSummary->Fill(1,wh,0);
182  else globalHVSummary->Fill(1,wh,1);
183  if( r == -1 ) globalHVSummary->Fill(1,wh,-1);
184 
185  } else {
186 
187  globalHVSummary->Fill(1,wh,0);
188 
189  }
190 
191  }
192 
193 }
194 
195 
197 
198 }
199 
200 
202 
203 }
204 
LuminosityBlockID id() const
virtual void endRun(const edm::Run &run, const edm::EventSetup &setup)
tuple lumi
Definition: fjr2json.py:35
void setTimeSlotValue(float value, int timeSlot)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &setup)
virtual void beginJob()
DTDCSByLumiSummary(const edm::ParameterSet &pset)
Constructor.
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
#define LogTrace(id)
virtual void endLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &setup)
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup)
LuminosityBlockNumber_t luminosityBlock() const
virtual ~DTDCSByLumiSummary()
Destructor.
double getBinContent(int binx) const
get content of bin (1-D)
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Definition: Run.h:33