39 setConfig(ps,
"DTLocalTrigger");
40 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
41 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
57 if (bookingdone)
return;
59 vector<string>::const_iterator iTr = trigSources.begin();
60 vector<string>::const_iterator trEnd = trigSources.end();
61 vector<string>::const_iterator iHw = hwSources.begin();
62 vector<string>::const_iterator hwEnd = hwSources.end();
65 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
66 for (; iTr != trEnd; ++iTr){
68 for (; iHw != hwEnd; ++iHw){
71 for (
int wh=-2; wh<=2; ++wh){
72 if (hwSource==
"COM") {
74 bookWheelHistos(ibooker,wh,
"MatchingPhi");
77 for (
int sect=1; sect<=12; ++sect){
79 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhi");
80 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhi");
83 bookWheelHistos(ibooker,wh,
"CorrectBXPhi");
84 bookWheelHistos(ibooker,wh,
"ResidualBXPhi");
85 bookWheelHistos(ibooker,wh,
"CorrFractionPhi");
86 bookWheelHistos(ibooker,wh,
"2ndFractionPhi");
87 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhi");
88 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
89 if (hwSource==
"DDU") {
91 bookWheelHistos(ibooker,wh,
"HFractionTheta");
99 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
101 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
104 for (
int wh=-2; wh<=2; ++wh){
105 if (hwSource==
"COM") {
107 bookWheelHistos(ibooker,wh,
"MatchingSummary",
"Summaries");
111 bookWheelHistos(ibooker,wh,
"CorrFractionSummary",
"Summaries");
112 bookWheelHistos(ibooker,wh,
"2ndFractionSummary",
"Summaries");
115 if (hwSource==
"COM") {
117 bookCmsHistos(ibooker,
"MatchingSummary",
"Summaries");
121 bookCmsHistos(ibooker,
"CorrFractionSummary");
122 bookCmsHistos(ibooker,
"2ndFractionSummary");
124 if (hwSource==
"DCC") {
126 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
127 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
146 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
148 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
151 for (
int stat=1; stat<=4; ++stat){
152 for (
int wh=-2; wh<=2; ++wh){
153 for (
int sect=1; sect<=12; ++sect){
155 int sector_id = (wh+3)+(sect-1)*5;
157 if (hwSource==
"COM") {
159 TH2F * DDUvsDCC = getHisto<TH2F>(igetter.
get(getMEName(
"QualDDUvsQualDCC",
"LocalTriggerPhi", chId)));
162 int matchSummary = 1;
164 if (DDUvsDCC->GetEntries()>1) {
166 double entries = DDUvsDCC->GetEntries();
167 double corrEntries = 0;
168 for (
int ibin=2; ibin<=8; ++ibin) {
169 corrEntries += DDUvsDCC->GetBinContent(ibin,ibin);
171 double corrRatio = corrEntries/
entries;
173 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
176 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
184 bookWheelHistos(ibooker,wh,
"MatchingPhi");
187 whME[wh].find(
fullName(
"MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
191 whME[wh].find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
197 TH2F * BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual",
"LocalTriggerPhi", chId)));
198 TH1F * BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual",
"LocalTriggerPhi", chId)));
199 TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual",
"LocalTriggerPhi", chId)));
200 if (BXvsQual && Flag1stvsQual && BestQual) {
203 int secondSummary = 1;
205 if (BestQual->GetEntries()>1) {
207 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
208 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
209 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
210 double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
211 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
212 double trigsFlag2nd = Flag1st->GetBinContent(2);
213 double trigs = Flag1st->GetEntries();
214 double besttrigs = BestQual->GetEntries();
215 double besttrigsCorr = BestQual->Integral(5,7,
"");
219 double corrFrac = besttrigsCorr/besttrigs;
220 double secondFrac = trigsFlag2nd/trigs;
221 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
224 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
230 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
233 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
240 if( secME[sector_id].
find(
fullName(
"BXDistribPhi")) == secME[sector_id].
end() ){
241 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhi");
242 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhi");
245 TH1D* BXDistr = BXvsQual->ProjectionY();
246 TH1D* QualDistr = BXvsQual->ProjectionX();
247 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
249 int nbinsBX = BXDistr->GetNbinsX();
250 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
251 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
252 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
253 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
254 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
255 innerME->find(
fullName(
"BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
257 for (
int ibin=1;ibin<=7;++ibin) {
258 innerME->find(
fullName(
"QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
264 if( whME[wh].
find(
fullName(
"CorrectBXPhi")) == whME[wh].end() ){
265 bookWheelHistos(ibooker,wh,
"ResidualBXPhi");
266 bookWheelHistos(ibooker,wh,
"CorrectBXPhi");
267 bookWheelHistos(ibooker,wh,
"CorrFractionPhi");
268 bookWheelHistos(ibooker,wh,
"2ndFractionPhi");
269 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhi");
272 innerME = &(whME[wh]);
273 innerME->find(
fullName(
"CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
274 innerME->find(
fullName(
"ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
275 innerME->find(
fullName(
"CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
276 innerME->find(
fullName(
"TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
277 innerME->find(
fullName(
"2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
281 whME[wh].find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
282 whME[wh].find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
286 if (hwSource==
"DDU") {
287 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
288 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
291 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
292 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
293 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
294 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
295 double trigs = ThetaBestQual->GetEntries();
296 double trigsH = ThetaBestQual->GetBinContent(4);
300 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
301 bookWheelHistos(ibooker,wh,
"HFractionTheta");
303 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
304 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
305 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
309 else if (hwSource==
"DCC") {
311 TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
314 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
315 TH1D*
BX = ThetaPosvsBX->ProjectionX();
316 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
317 double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
321 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
323 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
324 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
336 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
338 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
340 for (
int wh=-2; wh<=2; ++wh){
341 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
342 if(hwSource==
"COM") {
343 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"MatchingSummary"))->second);
344 for (
int sect=1; sect<=12; ++sect){
347 for (
int stat=1; stat<=4; ++stat){
348 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
355 if (matchNoData == 4) matchErr = 5;
356 cmsME.find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
360 TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummary"))->second);
361 TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummary"))->second);
362 for (
int sect=1; sect<=12; ++sect){
366 int secondNoData = 0;
367 for (
int stat=1; stat<=4; ++stat){
368 switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
374 switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
381 if (corrNoData == 4) corrErr = 5;
382 if (secondNoData == 4) secondErr = 5;
383 cmsME.find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
384 cmsME.find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
391 fillGlobalSummary(igetter);
397 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
403 for (
int wh=-2; wh<=2; ++wh) {
404 for (
int sect=1; sect<=12; ++sect) {
407 int corr = cmsME.find(
fullName(
"CorrFractionSummary"))->second->getBinContent(sect,wh+3);
408 int second = cmsME.find(
fullName(
"2ndFractionSummary"))->second->getBinContent(sect,wh+3);
410 MonitorElement * lutsME = igetter.
get(topFolder(hwSource==
"DCC") +
"Summaries/TrigLutSummary");
416 <<
"Test]: DCC Lut test Summary histo not found." << endl;
418 (corr <5 || second<5) && nSecReadout++;
419 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
420 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
421 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
427 cmsME.find(
"TrigGlbSummary")->second->Reset();
429 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
434 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
436 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
438 <<
"Test]: ME: " << nEvtsName <<
" not found!" << endl;
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * get(const std::string &path)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Perform client diagnostic in online.
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &)
Run client analysis.
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
virtual ~DTLocalTriggerTest()
Destructor.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
U second(std::pair< T, U > const &p)
void fillGlobalSummary(DQMStore::IGetter &)
double getFloatValue(void) const
EventID const & min(EventID const &lh, EventID const &rh)
DTLocalTriggerTest(const edm::ParameterSet &ps)
Constructor.
double getBinContent(int binx) const
get content of bin (1-D)
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.