48 void setDDU(
int qual,
int bx) { theQual[0] = qual; theBX[0] = bx; }
49 void setDCC(
int qual,
int bx) { theQual[1] = qual; theBX[1] = bx; }
51 bool hasOne()
const {
return theQual[0]!=-1 || theQual[1]!=-1; };
52 bool hasBoth()
const {
return theQual[0]!=-1 && theQual[1]!=-1; };
53 bool hasSameQual()
const {
return hasBoth() && theQual[0]==theQual[1]; };
54 int deltaBX()
const {
return theBX[0] - theBX[1]; }
55 int qualDDU()
const {
return theQual[0]; }
56 int qualDCC()
const {
return theQual[1]; }
68 nEvents(0), nLumis(0), theTrigGeomUtils(0) {
70 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
71 <<
"[DTLocalTriggerBaseTask]: Constructor"<<endl;
83 if (processDCC)
theTypes.push_back(
"DCC");
84 if (processDDU)
theTypes.push_back(
"DDU");
87 topFolder(
"DCC") =
"DT/11-LocalTriggerTP-DCC/";
88 topFolder(
"DDU") =
"DT/12-LocalTriggerTP-DDU/";
90 topFolder(
"DCC") =
"DT/03-LocalTrigger-DCC/";
91 topFolder(
"DDU") =
"DT/04-LocalTrigger-DDU/";
102 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
103 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
111 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
112 <<
"[DTLocalTriggerBaseTask]: BeginJob" << endl;
119 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
120 <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
128 for (
int wh=-2;wh<3;++wh){
129 for (
int stat=1;stat<5;++stat){
130 for (
int sect=1;sect<13;++sect){
146 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
147 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
149 if(
nLumis%resetCycle == 0 ) {
150 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
151 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
152 for(;chambIt!=chambEnd;++chambIt) {
153 map<string,MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
154 map<string,MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
155 for(;histoIt!=histoEnd;++histoIt) {
156 histoIt->second->Reset();
165 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
166 <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
168 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambIt =
trendHistos.begin();
169 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambEnd =
trendHistos.end();
170 for(;chambIt!=chambEnd;++chambIt) {
179 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
180 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
207 runDCCAnalysis(phiTrigsDCC->getContainer(),thetaTrigsDCC->getContainer());
209 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
210 <<
"[DTLocalTriggerBaseTask]: one or more DCC handles for Input Tag "
211 << inputTagDCC <<
" not found!" << endl;
223 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
224 <<
"[DTLocalTriggerBaseTask]: one or more DDU handles for Input Tag "
225 << inputTagDDU <<
" not found!" << endl;
238 uint32_t rawId = dtCh.
rawId();
240 stringstream wheel; wheel << dtCh.
wheel();
242 stringstream sector; sector << dtCh.
sector();
244 map<string,int> minBX;
245 map<string,int> maxBX;
255 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
257 vector<string>::const_iterator typeIt =
theTypes.begin();
258 vector<string>::const_iterator typeEnd =
theTypes.end();
260 for (; typeIt!=typeEnd; ++typeIt) {
262 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
263 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel"
264 << wheel.str() <<
"/Sector" << sector.str() <<
"/Station"<< station.str() << endl;
268 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
270 string histoTag = (*typeIt) +
"_BXvsQual";
272 7,-0.5,6.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
276 histoTag = (*typeIt) +
"_BestQual";
278 "Trigger quality of best primitives",7,-0.5,6.5);
281 histoTag = (*typeIt) +
"_Flag1stvsQual";
283 "1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
287 if (*typeIt==
"DCC") {
288 float minPh, maxPh;
int nBinsPh;
291 histoTag = (*typeIt) +
"_QualvsPhirad";
293 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
297 histoTag = (*typeIt) +
"_QualvsPhibend";
299 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
306 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
308 if((*typeIt)==
"DCC") {
309 histoTag = (*typeIt) +
"_PositionvsBX";
311 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
313 histoTag = (*typeIt) +
"_ThetaBXvsQual";
315 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
318 histoTag = (*typeIt) +
"_ThetaBestQual";
320 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
329 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
331 string histoTag =
"COM_QualDDUvsQualDCC";
333 "DDU quality vs DCC quality",8,-1.5,6.5,8,-1.5,6.5);
337 histoTag =
"COM_MatchingTrend";
339 "Fraction of DDU-DCC matches w.r.t. proc evts",
340 nTimeBins,nLSTimeBin,
true,0);
347 stringstream wheel; wheel << wh;
349 string whTag =
"_W" + wheel.str();
351 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
352 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for "
353 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
355 string histoTag =
"COM_BXDiff";
357 "DDU-DCC BX Difference",12,1,13,4,1,5,0.,20.);
366 std::vector<L1MuDTChambThDigi>* thTrigs ){
368 vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
369 vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
371 for(; iph !=iphe ; ++iph) {
373 int wh = iph->whNum();
374 int sec = iph->scNum() + 1;
375 int st = iph->stNum();
376 int qual = iph->code();
377 int is1st = iph->Ts2Tag() ? 1 : 0;
378 int bx = iph->bxNum() - is1st;
380 if (qual <0 || qual>6)
continue;
383 uint32_t rawId = dtChId.
rawId();
392 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
394 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
395 innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
397 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
398 innerME[
"DCC_Flag1stvsQual"]->Fill(qual,is1st);
399 if (!is1st) innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
401 innerME[
"DCC_QualvsPhibend"]->Fill(dir,qual);
407 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
408 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
410 for(; ith != ithe; ++ith) {
411 int wh = ith->whNum();
412 int sec = ith->scNum() + 1;
413 int st = ith->stNum();
414 int bx = ith->bxNum();
419 thcode[
pos] = ith->code(
pos);
422 uint32_t rawId = dtChId.
rawId();
424 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
428 innerME[
"DCC_PositionvsBX"]->Fill(bx,pos);
434 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
435 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
436 for (; compIt!=compEnd; ++compIt) {
437 int bestQual = compIt->second.qualDCC();
439 chamberHistos[compIt->first][
"DCC_BestQual"]->Fill(bestQual);
451 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
454 uint32_t rawId = chId.
rawId();
458 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
460 int bestQualTheta = -1;
462 for (; trigIt!=range.second; ++trigIt){
464 int qualPhi = trigIt->quality();
465 int qualTheta = trigIt->trTheta();
466 int flag1st = trigIt->secondTrack() ? 1 : 0;
467 int bx = trigIt->bx();
468 int bxPhi = bx - flag1st;
470 if( qualPhi>-1 && qualPhi<7 ) {
475 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
477 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
478 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
482 if( qualTheta>0 && !
tpMode ){
483 if (qualTheta > bestQualTheta){
484 bestQualTheta = qualTheta;
486 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
492 int bestQualPhi =
theCompMap[rawId].qualDDU();
494 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
495 if(bestQualTheta>0) {
496 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
506 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
507 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
509 for (; compIt!=compEnd; ++compIt) {
511 uint32_t rawId = compIt->first;
513 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
517 innerME[
"COM_QualDDUvsQualDCC"]->Fill(compUnit.
qualDCC(),compUnit.
qualDDU());
537 axis=histo->GetXaxis();
540 axis=histo->GetYaxis();
544 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
545 int istart = axis->GetXmin()<-1 ? 2 : 1;
546 for (
int i=0;
i<7;
i++) {
547 axis->SetBinLabel(
i+istart,labels[
i].c_str());
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
void setDDU(int qual, int bx)
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
virtual ~DTLocalTriggerBaseTask()
Destructor.
MonitorElement * bookFloat(const char *name)
Book float.
std::vector< std::string > theTypes
LuminosityBlockNumber_t luminosityBlock() const
uint32_t rawId() const
get the raw id
DTTrigGeomUtils * theTrigGeomUtils
void runDDUvsDCCAnalysis()
Run analysis on ROS data.
void bookHistos(const DTChamberId &chamb)
Book the histograms.
void setDCC(int qual, int bx)
void beginRun(const edm::Run &, const edm::EventSetup &)
Beginrun.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * nEventMonitor
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
Perform trend plot operations.
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
edm::ParameterSet theParams
std::vector< DigiType >::const_iterator const_iterator
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
std::map< uint32_t, DTTPGCompareUnit > theCompMap
std::map< uint32_t, DTTimeEvolutionHisto * > trendHistos
std::pair< const_iterator, const_iterator > Range
void runDDUAnalysis(edm::Handle< DTLocalTriggerCollection > &trigsDDU)
Run analysis on ROS data.
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
int station() const
Return the station number.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
std::string & topFolder(std::string type)
Get the Top folder (different between Physics and TP and DCC/DDU)
DTLocalTriggerBaseTask(const edm::ParameterSet &ps)
Constructor.
int wheel() const
Return the wheel number.
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void runDCCAnalysis(std::vector< L1MuDTChambPhDigi > *phTrigs, std::vector< L1MuDTChambThDigi > *thTrigs)
Run analysis on DCC data.
void setCurrentFolder(const std::string &fullpath)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")