38 setConfig(ps,
"DTLocalTrigger");
39 baseFolderDCC =
"DT/03-LocalTrigger-DCC/";
40 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
55 vector<string>::const_iterator iTr = trigSources.begin();
56 vector<string>::const_iterator trEnd = trigSources.end();
57 vector<string>::const_iterator iHw = hwSources.begin();
58 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") {
70 bookWheelHistos(wh,
"MatchingPhi");
73 for (
int sect=1; sect<=12; ++sect){
74 bookSectorHistos(wh,sect,
"BXDistribPhi");
75 bookSectorHistos(wh,sect,
"QualDistribPhi");
77 bookWheelHistos(wh,
"CorrectBXPhi");
78 bookWheelHistos(wh,
"ResidualBXPhi");
79 bookWheelHistos(wh,
"CorrFractionPhi");
80 bookWheelHistos(wh,
"2ndFractionPhi");
81 bookWheelHistos(wh,
"TriggerInclusivePhi");
82 bookWheelHistos(wh,
"CorrectBXTheta");
83 if (hwSource==
"DDU") {
84 bookWheelHistos(wh,
"HFractionTheta");
92 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
94 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
97 for (
int wh=-2; wh<=2; ++wh){
98 if (hwSource==
"COM") {
99 bookWheelHistos(wh,
"MatchingSummary",
"Summaries");
102 bookWheelHistos(wh,
"CorrFractionSummary",
"Summaries");
103 bookWheelHistos(wh,
"2ndFractionSummary",
"Summaries");
106 if (hwSource==
"COM") {
107 bookCmsHistos(
"MatchingSummary",
"Summaries");
110 bookCmsHistos(
"CorrFractionSummary");
111 bookCmsHistos(
"2ndFractionSummary");
113 if (hwSource==
"DCC") {
114 bookCmsHistos(
"TrigGlbSummary",
"",
true);
133 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
135 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
138 for (
int stat=1; stat<=4; ++stat){
139 for (
int wh=-2; wh<=2; ++wh){
140 for (
int sect=1; sect<=12; ++sect){
142 int sector_id = (wh+3)+(sect-1)*5;
145 if (hwSource==
"COM") {
147 TH2F * DDUvsDCC = getHisto<TH2F>(dbe->get(getMEName(
"QualDDUvsQualDCC",
"LocalTriggerPhi", chId)));
150 int matchSummary = 1;
152 if (DDUvsDCC->GetEntries()>1) {
154 double entries = DDUvsDCC->GetEntries();
155 double corrEntries = 0;
156 for (
int ibin=2; ibin<=8; ++ibin) {
157 corrEntries += DDUvsDCC->GetBinContent(ibin,ibin);
159 double corrRatio = corrEntries/
entries;
161 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
164 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
172 bookWheelHistos(wh,
"MatchingPhi");
175 whME[wh].find(
fullName(
"MatchingPhi"))->second->setBinContent(sect,stat,corrRatio);
179 whME[wh].find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,stat,matchSummary);
185 TH2F * BXvsQual = getHisto<TH2F>(dbe->get(getMEName(
"BXvsQual",
"LocalTriggerPhi", chId)));
186 TH1F * BestQual = getHisto<TH1F>(dbe->get(getMEName(
"BestQual",
"LocalTriggerPhi", chId)));
187 TH2F * Flag1stvsQual = getHisto<TH2F>(dbe->get(getMEName(
"Flag1stvsQual",
"LocalTriggerPhi", chId)));
188 if (BXvsQual && Flag1stvsQual && BestQual) {
191 int secondSummary = 1;
193 if (BestQual->GetEntries()>1) {
195 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
196 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
197 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
198 double BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
199 double BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
200 double trigsFlag2nd = Flag1st->GetBinContent(2);
201 double trigs = Flag1st->GetEntries();
202 double besttrigs = BestQual->GetEntries();
203 double besttrigsCorr = BestQual->Integral(5,7,
"");
207 double corrFrac = besttrigsCorr/besttrigs;
208 double secondFrac = trigsFlag2nd/trigs;
209 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
212 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
218 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
221 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
228 if( secME[sector_id].
find(
fullName(
"BXDistribPhi")) == secME[sector_id].
end() ){
229 bookSectorHistos(wh,sect,
"QualDistribPhi");
230 bookSectorHistos(wh,sect,
"BXDistribPhi");
233 TH1D* BXDistr = BXvsQual->ProjectionY();
234 TH1D* QualDistr = BXvsQual->ProjectionX();
235 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
237 int nbinsBX = BXDistr->GetNbinsX();
238 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
239 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
240 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
241 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
242 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
243 innerME->find(
fullName(
"BXDistribPhi"))->second->setBinContent(ibin,stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
245 for (
int ibin=1;ibin<=7;++ibin) {
246 innerME->find(
fullName(
"QualDistribPhi"))->second->setBinContent(ibin,stat,QualDistr->GetBinContent(ibin));
252 if( whME[wh].
find(
fullName(
"CorrectBXPhi")) == whME[wh].end() ){
253 bookWheelHistos(wh,
"ResidualBXPhi");
254 bookWheelHistos(wh,
"CorrectBXPhi");
255 bookWheelHistos(wh,
"CorrFractionPhi");
256 bookWheelHistos(wh,
"2ndFractionPhi");
257 bookWheelHistos(wh,
"TriggerInclusivePhi");
260 innerME = &(whME[wh]);
261 innerME->find(
fullName(
"CorrectBXPhi"))->second->setBinContent(sect,stat,BX_OK+0.00001);
262 innerME->find(
fullName(
"ResidualBXPhi"))->second->setBinContent(sect,stat,round(25.*(BXMean-BX_OK))+0.00001);
263 innerME->find(
fullName(
"CorrFractionPhi"))->second->setBinContent(sect,stat,corrFrac);
264 innerME->find(
fullName(
"TriggerInclusivePhi"))->second->setBinContent(sect,stat,besttrigs);
265 innerME->find(
fullName(
"2ndFractionPhi"))->second->setBinContent(sect,stat,secondFrac);
269 whME[wh].find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,stat,corrSummary);
270 whME[wh].find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,stat,secondSummary);
274 if (hwSource==
"DDU") {
276 TH2F * ThetaBXvsQual = getHisto<TH2F>(dbe->get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
277 TH1F * ThetaBestQual = getHisto<TH1F>(dbe->get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
280 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
281 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
282 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
283 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
284 double trigs = ThetaBestQual->GetEntries();
285 double trigsH = ThetaBestQual->GetBinContent(4);
297 bookWheelHistos(wh,
"CorrectBXTheta");
298 bookWheelHistos(wh,
"HFractionTheta");
300 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
301 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
302 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,stat,trigsH/trigs);
306 else if (hwSource==
"DCC") {
308 TH2F * ThetaPosvsBX = getHisto<TH2F>(dbe->get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
311 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
312 TH1D* BX = ThetaPosvsBX->ProjectionX();
313 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
314 double BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
318 bookWheelHistos(wh,
"CorrectBXTheta");
320 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
321 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,stat,BX_OK+0.00001);
333 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
335 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
337 for (
int wh=-2; wh<=2; ++wh){
338 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
339 if(hwSource==
"COM") {
340 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"MatchingSummary"))->second);
341 for (
int sect=1; sect<=12; ++sect){
344 for (
int stat=1; stat<=4; ++stat){
345 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,stat))) {
352 if (matchNoData == 4) matchErr = 5;
353 cmsME.find(
fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+3,matchErr);
357 TH2F* corrWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummary"))->second);
358 TH2F* secondWhSummary = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummary"))->second);
359 for (
int sect=1; sect<=12; ++sect){
363 int secondNoData = 0;
364 for (
int stat=1; stat<=4; ++stat){
365 switch (static_cast<int>(corrWhSummary->GetBinContent(sect,stat))) {
371 switch (static_cast<int>(secondWhSummary->GetBinContent(sect,stat))) {
378 if (corrNoData == 4) corrErr = 5;
379 if (secondNoData == 4) secondErr = 5;
380 cmsME.find(
fullName(
"CorrFractionSummary"))->second->setBinContent(sect,wh+3,corrErr);
381 cmsME.find(
fullName(
"2ndFractionSummary"))->second->setBinContent(sect,wh+3,secondErr);
394 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
400 for (
int wh=-2; wh<=2; ++wh) {
401 for (
int sect=1; sect<=12; ++sect) {
404 int corr = cmsME.find(
fullName(
"CorrFractionSummary"))->second->getBinContent(sect,wh+3);
405 int second = cmsME.find(
fullName(
"2ndFractionSummary"))->second->getBinContent(sect,wh+3);
407 MonitorElement * lutsME = dbe->get(topFolder(hwSource==
"DCC") +
"Summaries/TrigLutSummary");
413 <<
"Test]: DCC Lut test Summary histo not found." << endl;
415 (corr <5 || second<5) && nSecReadout++;
416 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
417 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
418 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+3,glbPerc[errcode]);
424 cmsME.find(
"TrigGlbSummary")->second->Reset();
426 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
431 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
433 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
435 <<
"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.