39 setConfig(ps,
"DTLocalTrigger");
40 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
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");
86 if (hwSource==
"DDU") {
88 bookWheelHistos(ibooker,wh,
"HFractionTheta");
96 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
98 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
101 for (
int wh=-2; wh<=2; ++wh){
102 if (hwSource==
"COM") {
104 bookWheelHistos(ibooker,wh,
"MatchingSummary",
"Summaries");
108 bookWheelHistos(ibooker,wh,
"CorrFractionSummary",
"Summaries");
109 bookWheelHistos(ibooker,wh,
"2ndFractionSummary",
"Summaries");
112 if (hwSource==
"COM") {
114 bookCmsHistos(ibooker,
"MatchingSummary",
"Summaries");
118 bookCmsHistos(ibooker,
"CorrFractionSummary");
119 bookCmsHistos(ibooker,
"2ndFractionSummary");
121 if (hwSource==
"DCC") {
123 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
124 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
142 if (!bookingdone) Bookings(ibooker,igetter);
145 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
147 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
150 for (
int stat=1; stat<=4; ++stat){
151 for (
int wh=-2; wh<=2; ++wh){
152 for (
int sect=1; sect<=12; ++sect){
154 int sector_id = (wh+3)+(sect-1)*5;
156 if (hwSource==
"COM") {
158 TH2F * DDUvsDCC = getHisto<TH2F>(igetter.
get(getMEName(
"QualDDUvsQualDCC",
"LocalTriggerPhi", chId)));
161 int matchSummary = 1;
163 if (DDUvsDCC->GetEntries()>1) {
165 double entries = DDUvsDCC->GetEntries();
166 double corrEntries = 0;
167 for (
int ibin=2; ibin<=8; ++ibin) {
168 corrEntries += DDUvsDCC->GetBinContent(ibin,ibin);
170 double corrRatio = corrEntries/
entries;
172 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
175 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
183 bookWheelHistos(ibooker,wh,
"MatchingPhi");
186 whME[wh].find(
fullName(
"MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
190 whME[wh].find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
196 TH2F * BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual",
"LocalTriggerPhi", chId)));
197 TH1F * BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual",
"LocalTriggerPhi", chId)));
198 TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual",
"LocalTriggerPhi", chId)));
199 if (BXvsQual && Flag1stvsQual && BestQual) {
202 int secondSummary = 1;
204 if (BestQual->GetEntries()>1) {
206 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
207 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
208 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
209 double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
210 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
211 double trigsFlag2nd = Flag1st->GetBinContent(2);
212 double trigs = Flag1st->GetEntries();
213 double besttrigs = BestQual->GetEntries();
214 double besttrigsCorr = BestQual->Integral(5,7,
"");
218 double corrFrac = besttrigsCorr/besttrigs;
219 double secondFrac = trigsFlag2nd/trigs;
220 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
223 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
229 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
232 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
239 if( secME[sector_id].
find(
fullName(
"BXDistribPhi")) == secME[sector_id].
end() ){
240 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhi");
241 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhi");
244 TH1D* BXDistr = BXvsQual->ProjectionY();
245 TH1D* QualDistr = BXvsQual->ProjectionX();
246 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
248 int nbinsBX = BXDistr->GetNbinsX();
249 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
250 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
251 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
252 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
253 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
254 innerME->find(
fullName(
"BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
256 for (
int ibin=1;ibin<=7;++ibin) {
257 innerME->find(
fullName(
"QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
263 if( whME[wh].
find(
fullName(
"CorrectBXPhi")) == whME[wh].end() ){
264 bookWheelHistos(ibooker,wh,
"ResidualBXPhi");
265 bookWheelHistos(ibooker,wh,
"CorrectBXPhi");
266 bookWheelHistos(ibooker,wh,
"CorrFractionPhi");
267 bookWheelHistos(ibooker,wh,
"2ndFractionPhi");
268 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhi");
271 innerME = &(whME[wh]);
272 innerME->find(
fullName(
"CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
273 innerME->find(
fullName(
"ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
274 innerME->find(
fullName(
"CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
275 innerME->find(
fullName(
"TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
276 innerME->find(
fullName(
"2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
280 whME[wh].find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
281 whME[wh].find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
285 if (hwSource==
"DDU") {
286 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
287 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
290 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
291 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
292 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
293 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
294 double trigs = ThetaBestQual->GetEntries();
295 double trigsH = ThetaBestQual->GetBinContent(4);
299 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
300 bookWheelHistos(ibooker,wh,
"HFractionTheta");
302 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
303 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
304 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
308 else if (hwSource==
"DCC") {
310 TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
313 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
314 TH1D*
BX = ThetaPosvsBX->ProjectionX();
315 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
316 double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
320 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
322 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
323 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
335 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
337 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
339 for (
int wh=-2; wh<=2; ++wh){
340 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
341 if(hwSource==
"COM") {
342 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"MatchingSummary"))->second);
343 for (
int sect=1; sect<=12; ++sect){
346 for (
int stat=1; stat<=4; ++stat){
347 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
354 if (matchNoData == 4) matchErr = 5;
355 cmsME.find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
359 TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummary"))->second);
360 TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummary"))->second);
361 for (
int sect=1; sect<=12; ++sect){
365 int secondNoData = 0;
366 for (
int stat=1; stat<=4; ++stat){
367 switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
373 switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
380 if (corrNoData == 4) corrErr = 5;
381 if (secondNoData == 4) secondErr = 5;
382 cmsME.find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
383 cmsME.find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
390 fillGlobalSummary(igetter);
396 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
402 for (
int wh=-2; wh<=2; ++wh) {
403 for (
int sect=1; sect<=12; ++sect) {
406 int corr = cmsME.find(
fullName(
"CorrFractionSummary"))->second->getBinContent(sect,wh+3);
407 int second = cmsME.find(
fullName(
"2ndFractionSummary"))->second->getBinContent(sect,wh+3);
409 MonitorElement * lutsME = igetter.
get(topFolder(hwSource==
"DCC") +
"Summaries/TrigLutSummary");
415 <<
"Test]: DCC Lut test Summary histo not found." << endl;
417 (corr <5 || second<5) && nSecReadout++;
418 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
419 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
420 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
426 cmsME.find(
"TrigGlbSummary")->second->Reset();
428 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
433 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
435 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
437 <<
"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.