36 setConfig(ps,
"DTLocalTrigger");
37 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
38 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
53 vector<string>::const_iterator iTr = trigSources.begin();
54 vector<string>::const_iterator trEnd = trigSources.end();
55 vector<string>::const_iterator iHw = hwSources.begin();
56 vector<string>::const_iterator hwEnd = hwSources.end();
60 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
61 for (; iTr != trEnd; ++iTr){
63 for (; iHw != hwEnd; ++iHw){
66 for (
int wh=-2; wh<=2; ++wh){
67 if (hwSource==
"COM") {
68 bookWheelHistos(wh,
"MatchingPhi");
71 for (
int sect=1; sect<=12; ++sect){
72 bookSectorHistos(wh,sect,
"BXDistribPhi");
73 bookSectorHistos(wh,sect,
"QualDistribPhi");
75 bookWheelHistos(wh,
"CorrectBXPhi");
76 bookWheelHistos(wh,
"ResidualBXPhi");
77 bookWheelHistos(wh,
"CorrFractionPhi");
78 bookWheelHistos(wh,
"2ndFractionPhi");
79 bookWheelHistos(wh,
"TriggerInclusivePhi");
80 bookWheelHistos(wh,
"CorrectBXTheta");
81 if (hwSource==
"DDU") {
82 bookWheelHistos(wh,
"HFractionTheta");
90 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
92 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
95 for (
int wh=-2; wh<=2; ++wh){
96 if (hwSource==
"COM") {
97 bookWheelHistos(wh,
"MatchingSummary",
"Summaries");
100 bookWheelHistos(wh,
"CorrFractionSummary",
"Summaries");
101 bookWheelHistos(wh,
"2ndFractionSummary",
"Summaries");
104 if (hwSource==
"COM") {
105 bookCmsHistos(
"MatchingSummary",
"Summaries");
108 bookCmsHistos(
"CorrFractionSummary");
109 bookCmsHistos(
"2ndFractionSummary");
111 if (hwSource==
"DCC") {
112 bookCmsHistos(
"TrigGlbSummary",
"",
true);
131 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
133 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
136 for (
int stat=1; stat<=4; ++stat){
137 for (
int wh=-2; wh<=2; ++wh){
138 for (
int sect=1; sect<=12; ++sect){
140 int sector_id = (wh+3)+(sect-1)*5;
143 if (hwSource==
"COM") {
145 TH2F * DDUvsDCC = getHisto<TH2F>(dbe->get(getMEName(
"QualDDUvsQualDCC",
"LocalTriggerPhi", chId)));
148 int matchSummary = 1;
150 if (DDUvsDCC->GetEntries()>1) {
152 double entries = DDUvsDCC->GetEntries();
153 double corrEntries = 0;
154 for (
int ibin=2; ibin<=8; ++ibin) {
155 corrEntries += DDUvsDCC->GetBinContent(ibin,ibin);
157 double corrRatio = corrEntries/
entries;
159 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
162 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
170 bookWheelHistos(wh,
"MatchingPhi");
173 whME[wh].find(
fullName(
"MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
177 whME[wh].find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
183 TH2F * BXvsQual = getHisto<TH2F>(dbe->get(getMEName(
"BXvsQual",
"LocalTriggerPhi", chId)));
184 TH1F * BestQual = getHisto<TH1F>(dbe->get(getMEName(
"BestQual",
"LocalTriggerPhi", chId)));
185 TH2F * Flag1stvsQual = getHisto<TH2F>(dbe->get(getMEName(
"Flag1stvsQual",
"LocalTriggerPhi", chId)));
186 if (BXvsQual && Flag1stvsQual && BestQual) {
189 int secondSummary = 1;
191 if (BestQual->GetEntries()>1) {
193 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
194 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
195 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
196 double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
197 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
198 double trigsFlag2nd = Flag1st->GetBinContent(2);
199 double trigs = Flag1st->GetEntries();
200 double besttrigs = BestQual->GetEntries();
201 double besttrigsCorr = BestQual->Integral(5,7,
"");
205 double corrFrac = besttrigsCorr/besttrigs;
206 double secondFrac = trigsFlag2nd/trigs;
207 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
210 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
216 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
219 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
226 if( secME[sector_id].
find(
fullName(
"BXDistribPhi")) == secME[sector_id].
end() ){
227 bookSectorHistos(wh,sect,
"QualDistribPhi");
228 bookSectorHistos(wh,sect,
"BXDistribPhi");
231 TH1D* BXDistr = BXvsQual->ProjectionY();
232 TH1D* QualDistr = BXvsQual->ProjectionX();
233 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
235 int nbinsBX = BXDistr->GetNbinsX();
236 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
237 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
238 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
239 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
240 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
241 innerME->find(
fullName(
"BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
243 for (
int ibin=1;ibin<=7;++ibin) {
244 innerME->find(
fullName(
"QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
250 if( whME[wh].
find(
fullName(
"CorrectBXPhi")) == whME[wh].end() ){
251 bookWheelHistos(wh,
"ResidualBXPhi");
252 bookWheelHistos(wh,
"CorrectBXPhi");
253 bookWheelHistos(wh,
"CorrFractionPhi");
254 bookWheelHistos(wh,
"2ndFractionPhi");
255 bookWheelHistos(wh,
"TriggerInclusivePhi");
258 innerME = &(whME[wh]);
259 innerME->find(
fullName(
"CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
260 innerME->find(
fullName(
"ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
261 innerME->find(
fullName(
"CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
262 innerME->find(
fullName(
"TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
263 innerME->find(
fullName(
"2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
267 whME[wh].find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
268 whME[wh].find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
272 if (hwSource==
"DDU") {
274 TH2F * ThetaBXvsQual = getHisto<TH2F>(dbe->get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
275 TH1F * ThetaBestQual = getHisto<TH1F>(dbe->get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
278 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
279 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
280 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
281 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
282 double trigs = ThetaBestQual->GetEntries();
283 double trigsH = ThetaBestQual->GetBinContent(4);
295 bookWheelHistos(wh,
"CorrectBXTheta");
296 bookWheelHistos(wh,
"HFractionTheta");
298 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
299 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
300 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
304 else if (hwSource==
"DCC") {
306 TH2F * ThetaPosvsBX = getHisto<TH2F>(dbe->get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
309 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
310 TH1D*
BX = ThetaPosvsBX->ProjectionX();
311 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
312 double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
316 bookWheelHistos(wh,
"CorrectBXTheta");
318 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
319 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
331 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
333 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
335 for (
int wh=-2; wh<=2; ++wh){
336 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
337 if(hwSource==
"COM") {
338 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"MatchingSummary"))->second);
339 for (
int sect=1; sect<=12; ++sect){
342 for (
int stat=1; stat<=4; ++stat){
343 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
350 if (matchNoData == 4) matchErr = 5;
351 cmsME.find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
355 TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummary"))->second);
356 TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummary"))->second);
357 for (
int sect=1; sect<=12; ++sect){
361 int secondNoData = 0;
362 for (
int stat=1; stat<=4; ++stat){
363 switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
369 switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
376 if (corrNoData == 4) corrErr = 5;
377 if (secondNoData == 4) secondErr = 5;
378 cmsME.find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
379 cmsME.find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
392 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
398 for (
int wh=-2; wh<=2; ++wh) {
399 for (
int sect=1; sect<=12; ++sect) {
402 int corr = cmsME.find(
fullName(
"CorrFractionSummary"))->second->getBinContent(sect,wh+3);
403 int second = cmsME.find(
fullName(
"2ndFractionSummary"))->second->getBinContent(sect,wh+3);
405 MonitorElement * lutsME = dbe->get(topFolder(hwSource==
"DCC") +
"Summaries/TrigLutSummary");
411 <<
"Test]: DCC Lut test Summary histo not found." << endl;
413 (corr <5 || second<5) && nSecReadout++;
414 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
415 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
416 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
422 cmsME.find(
"TrigGlbSummary")->second->Reset();
424 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
429 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
431 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
433 <<
"Test]: ME: " << nEvtsName <<
" not found!" << endl;
T getUntrackedParameter(std::string const &, T const &) const
void beginRun(edm::Run const &run, edm::EventSetup const &context)
BeginRun.
virtual ~DTLocalTriggerTest()
Destructor.
void runClientDiagnostic()
Run client analysis.
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)
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.