39 setConfig(ps,
"DTLocalTrigger");
40 baseFolderTM =
"DT/03-LocalTrigger-TM/";
41 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
56 vector<string>::const_iterator iTr = trigSources.begin();
57 vector<string>::const_iterator trEnd = trigSources.end();
58 vector<string>::const_iterator iHw = hwSources.begin();
59 vector<string>::const_iterator hwEnd = hwSources.end();
62 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
63 for (; iTr != trEnd; ++iTr){
65 for (; iHw != hwEnd; ++iHw){
68 for (
int wh=-2; wh<=2; ++wh){
69 if (hwSource==
"COM") {
71 bookWheelHistos(ibooker,wh,
"MatchingPhi");
74 for (
int sect=1; sect<=12; ++sect){
76 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhi");
77 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhi");
80 bookWheelHistos(ibooker,wh,
"CorrectBXPhi");
81 bookWheelHistos(ibooker,wh,
"ResidualBXPhi");
82 bookWheelHistos(ibooker,wh,
"CorrFractionPhi");
83 bookWheelHistos(ibooker,wh,
"2ndFractionPhi");
84 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhi");
85 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
93 bookWheelHistos(ibooker,wh,
"HFractionTheta");
100 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
102 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
105 for (
int wh=-2; wh<=2; ++wh){
106 if (hwSource==
"COM") {
108 bookWheelHistos(ibooker,wh,
"MatchingSummary",
"Summaries");
112 bookWheelHistos(ibooker,wh,
"CorrFractionSummary",
"Summaries");
113 bookWheelHistos(ibooker,wh,
"2ndFractionSummary",
"Summaries");
116 if (hwSource==
"COM") {
118 bookCmsHistos(ibooker,
"MatchingSummary",
"Summaries");
122 bookCmsHistos(ibooker,
"CorrFractionSummary");
123 bookCmsHistos(ibooker,
"2ndFractionSummary");
125 if (hwSource==
"TM") {
127 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
128 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
146 if (!bookingdone) Bookings(ibooker,igetter);
149 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
152 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
155 for (
int stat=1; stat<=4; ++stat){
156 for (
int wh=-2; wh<=2; ++wh){
157 for (
int sect=1; sect<=12; ++sect){
159 int sector_id = (wh+3)+(sect-1)*5;
161 if (hwSource==
"COM") {
163 TH2F * DDUvsTM = getHisto<TH2F>(igetter.
get(getMEName(
"QualDDUvsQualTM",
"LocalTriggerPhiIn", chId)));
166 int matchSummary = 1;
168 if (DDUvsTM->GetEntries()>1) {
170 double entries = DDUvsTM->GetEntries();
171 double corrEntries = 0;
172 for (
int ibin=2; ibin<=8; ++ibin) {
173 corrEntries += DDUvsTM->GetBinContent(ibin,ibin);
175 double corrRatio = corrEntries/entries;
177 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
180 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
188 bookWheelHistos(ibooker,wh,
"MatchingPhi");
191 whME[wh].find(
fullName(
"MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
195 whME[wh].find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
209 TH2F * BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual",
"LocalTriggerPhiIn", chId)));
210 TH1F * BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual",
"LocalTriggerPhiIn", chId)));
211 TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual",
"LocalTriggerPhiIn", chId)));
212 if (BXvsQual && Flag1stvsQual && BestQual) {
215 int secondSummary = 1;
217 if (BestQual->GetEntries()>1) {
219 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
220 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
221 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
222 double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
223 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
224 double trigsFlag2nd = Flag1st->GetBinContent(2);
225 double trigs = Flag1st->GetEntries();
226 double besttrigs = BestQual->GetEntries();
227 double besttrigsCorr = BestQual->Integral(5,7,
"");
231 double corrFrac = besttrigsCorr/besttrigs;
232 double secondFrac = trigsFlag2nd/trigs;
233 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
236 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
242 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
245 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
252 if( secME[sector_id].
find(
fullName(
"BXDistribPhi")) == secME[sector_id].
end() ){
253 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhi");
254 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhi");
257 TH1D* BXDistr = BXvsQual->ProjectionY();
258 TH1D* QualDistr = BXvsQual->ProjectionX();
259 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
261 int nbinsBX = BXDistr->GetNbinsX();
262 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
263 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
264 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
265 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
266 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
267 innerME->find(
fullName(
"BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
269 for (
int ibin=1;ibin<=7;++ibin) {
270 innerME->find(
fullName(
"QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
276 if( whME[wh].
find(
fullName(
"CorrectBXPhi")) == whME[wh].end() ){
277 bookWheelHistos(ibooker,wh,
"ResidualBXPhi");
278 bookWheelHistos(ibooker,wh,
"CorrectBXPhi");
279 bookWheelHistos(ibooker,wh,
"CorrFractionPhi");
280 bookWheelHistos(ibooker,wh,
"2ndFractionPhi");
281 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhi");
284 innerME = &(whME[wh]);
285 innerME->find(
fullName(
"CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
286 innerME->find(
fullName(
"ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
287 innerME->find(
fullName(
"CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
288 innerME->find(
fullName(
"TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
289 innerME->find(
fullName(
"2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
293 whME[wh].find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
294 whME[wh].find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
298 if (hwSource==
"DDU") {
299 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
300 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
303 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
304 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
305 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
306 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
307 double trigs = ThetaBestQual->GetEntries();
308 double trigsH = ThetaBestQual->GetBinContent(4);
312 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
313 bookWheelHistos(ibooker,wh,
"HFractionTheta");
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 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
321 else if (hwSource==
"TM") {
323 TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
326 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
327 TH1D*
BX = ThetaPosvsBX->ProjectionX();
328 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
329 double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
333 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
335 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
336 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
340 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
341 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
342 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
343 double trigs = ThetaBestQual->GetEntries();
344 double trigsH = ThetaBestQual->GetBinContent(2);
346 bookWheelHistos(ibooker,wh,
"HFractionTheta");
348 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
349 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
362 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
364 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
366 for (
int wh=-2; wh<=2; ++wh){
367 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
368 if(hwSource==
"COM") {
369 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"MatchingSummary"))->second);
370 for (
int sect=1; sect<=12; ++sect){
373 for (
int stat=1; stat<=4; ++stat){
374 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
381 if (matchNoData == 4) matchErr = 5;
382 cmsME.find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
386 TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummary"))->second);
387 TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummary"))->second);
388 for (
int sect=1; sect<=12; ++sect){
392 int secondNoData = 0;
393 for (
int stat=1; stat<=4; ++stat){
394 switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
400 switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
407 if (corrNoData == 4) corrErr = 5;
408 if (secondNoData == 4) secondErr = 5;
409 cmsME.find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
410 cmsME.find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
417 fillGlobalSummary(igetter);
423 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
429 for (
int wh=-2; wh<=2; ++wh) {
430 for (
int sect=1; sect<=12; ++sect) {
433 int corr = cmsME.find(
fullName(
"CorrFractionSummary"))->second->getBinContent(sect,wh+3);
434 int second = cmsME.find(
fullName(
"2ndFractionSummary"))->second->getBinContent(sect,wh+3);
436 MonitorElement * lutsME = igetter.
get(topFolder(hwSource==
"TM") +
"Summaries/TrigLutSummary");
442 <<
"Test]: TM Lut test Summary histo not found." << endl;
444 (corr <5 || second<5) && nSecReadout++;
445 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
446 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
447 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
453 cmsME.find(
"TrigGlbSummary")->second->Reset();
455 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
460 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
462 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
464 <<
"Test]: ME: " << nEvtsName <<
" not found!" << endl;
T getUntrackedParameter(std::string const &, T const &) const
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
MonitorElement * get(const std::string &path)
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.