44 void setDDU(
int qual,
int bx) { theQual[0] = qual; theBX[0] = bx; }
45 void setDCC(
int qual,
int bx) { theQual[1] = qual; theBX[1] = bx; }
47 bool hasOne()
const {
return theQual[0]!=-1 || theQual[1]!=-1; };
48 bool hasBoth()
const {
return theQual[0]!=-1 && theQual[1]!=-1; };
49 bool hasSameQual()
const {
return hasBoth() && theQual[0]==theQual[1]; };
50 int deltaBX()
const {
return theBX[0] - theBX[1]; }
51 int qualDDU()
const {
return theQual[0]; }
52 int qualDCC()
const {
return theQual[1]; }
64 nEvents(0), nLumis(0), theTrigGeomUtils(0) {
66 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
67 <<
"[DTLocalTriggerBaseTask]: Constructor"<<endl;
86 if (processDCC)
theTypes.push_back(
"DCC");
87 if (processDDU)
theTypes.push_back(
"DDU");
90 topFolder(
"DCC") =
"DT/11-LocalTriggerTP-DCC/";
91 topFolder(
"DDU") =
"DT/12-LocalTriggerTP-DDU/";
93 topFolder(
"DCC") =
"DT/03-LocalTrigger-DCC/";
94 topFolder(
"DDU") =
"DT/04-LocalTrigger-DDU/";
104 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
105 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
114 for (
int wh=-2;wh<3;++wh){
115 for (
int stat=1;stat<5;++stat){
116 for (
int sect=1;sect<13;++sect){
131 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
132 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
134 if(
nLumis%resetCycle == 0 ) {
135 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
136 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
137 for(;chambIt!=chambEnd;++chambIt) {
138 map<string,MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
139 map<string,MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
140 for(;histoIt!=histoEnd;++histoIt) {
141 histoIt->second->Reset();
150 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
151 <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
153 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambIt =
trendHistos.begin();
154 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambEnd =
trendHistos.end();
155 for(;chambIt!=chambEnd;++chambIt) {
164 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
165 <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
193 runDCCAnalysis(phiTrigsDCC->getContainer(),thetaTrigsDCC->getContainer());
195 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
196 <<
"[DTLocalTriggerBaseTask]: one or more DCC handles for Input Tag "
197 << inputTagDCC <<
" not found!" << endl;
209 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
210 <<
"[DTLocalTriggerBaseTask]: one or more DDU handles for Input Tag "
211 << inputTagDDU <<
" not found!" << endl;
224 uint32_t rawId = dtCh.
rawId();
226 stringstream wheel; wheel << dtCh.
wheel();
228 stringstream sector; sector << dtCh.
sector();
230 map<string,int> minBX;
231 map<string,int> maxBX;
241 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
243 vector<string>::const_iterator typeIt =
theTypes.begin();
244 vector<string>::const_iterator typeEnd =
theTypes.end();
246 for (; typeIt!=typeEnd; ++typeIt) {
248 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
249 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel"
250 << wheel.str() <<
"/Sector" << sector.str() <<
"/Station"<< station.str() << endl;
254 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
256 string histoTag = (*typeIt) +
"_BXvsQual";
258 7,-0.5,6.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
262 histoTag = (*typeIt) +
"_BestQual";
264 "Trigger quality of best primitives",7,-0.5,6.5);
267 histoTag = (*typeIt) +
"_Flag1stvsQual";
269 "1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
273 if (*typeIt==
"DCC") {
274 float minPh, maxPh;
int nBinsPh;
277 histoTag = (*typeIt) +
"_QualvsPhirad";
279 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
283 histoTag = (*typeIt) +
"_QualvsPhibend";
285 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
292 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
294 if((*typeIt)==
"DCC") {
295 histoTag = (*typeIt) +
"_PositionvsBX";
296 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"Theta trigger position vs BX",
297 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
299 histoTag = (*typeIt) +
"_ThetaBXvsQual";
300 chamberHistos[rawId][histoTag] = ibooker.
book2D(histoTag+chTag,
"BX vs trigger quality",7,-0.5,6.5,
301 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
304 histoTag = (*typeIt) +
"_ThetaBestQual";
306 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
315 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
317 string histoTag =
"COM_QualDDUvsQualDCC";
319 "DDU quality vs DCC quality",8,-1.5,6.5,8,-1.5,6.5);
323 histoTag =
"COM_MatchingTrend";
325 "Fraction of DDU-DCC matches w.r.t. proc evts",
326 nTimeBins,nLSTimeBin,
true,0);
333 stringstream wheel; wheel << wh;
335 string whTag =
"_W" + wheel.str();
337 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
338 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for "
339 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
341 string histoTag =
"COM_BXDiff";
343 "DDU-DCC BX Difference",12,1,13,4,1,5,0.,20.);
352 std::vector<L1MuDTChambThDigi>
const* thTrigs )
354 vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
355 vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
357 for(; iph !=iphe ; ++iph) {
359 int wh = iph->whNum();
360 int sec = iph->scNum() + 1;
361 int st = iph->stNum();
362 int qual = iph->code();
363 int is1st = iph->Ts2Tag() ? 1 : 0;
364 int bx = iph->bxNum() - is1st;
366 if (qual <0 || qual>6)
continue;
369 uint32_t rawId = dtChId.
rawId();
378 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
380 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
381 innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
383 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
384 innerME[
"DCC_Flag1stvsQual"]->Fill(qual,is1st);
385 if (!is1st) innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
387 innerME[
"DCC_QualvsPhibend"]->Fill(dir,qual);
393 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
394 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
396 for(; ith != ithe; ++ith) {
397 int wh = ith->whNum();
398 int sec = ith->scNum() + 1;
399 int st = ith->stNum();
400 int bx = ith->bxNum();
404 for (
int pos=0; pos<7; pos++)
405 thcode[pos] = ith->code(pos);
408 uint32_t rawId = dtChId.
rawId();
410 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
412 for (
int pos=0; pos<7; pos++)
414 innerME[
"DCC_PositionvsBX"]->Fill(bx,pos);
420 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
421 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
422 for (; compIt!=compEnd; ++compIt) {
423 int bestQual = compIt->second.qualDCC();
425 chamberHistos[compIt->first][
"DCC_BestQual"]->Fill(bestQual);
437 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
440 uint32_t rawId = chId.
rawId();
444 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
446 int bestQualTheta = -1;
448 for (; trigIt!=range.second; ++trigIt){
450 int qualPhi = trigIt->quality();
451 int qualTheta = trigIt->trTheta();
452 int flag1st = trigIt->secondTrack() ? 1 : 0;
453 int bx = trigIt->bx();
454 int bxPhi = bx - flag1st;
456 if( qualPhi>-1 && qualPhi<7 ) {
461 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
463 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
464 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
468 if( qualTheta>0 && !
tpMode ){
469 if (qualTheta > bestQualTheta){
470 bestQualTheta = qualTheta;
472 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
478 int bestQualPhi =
theCompMap[rawId].qualDDU();
480 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
481 if(bestQualTheta>0) {
482 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
492 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
493 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
495 for (; compIt!=compEnd; ++compIt) {
497 uint32_t rawId = compIt->first;
499 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
503 innerME[
"COM_QualDDUvsQualDCC"]->Fill(compUnit.
qualDCC(),compUnit.
qualDDU());
523 axis=histo->GetXaxis();
526 axis=histo->GetYaxis();
530 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
531 int istart = axis->GetXmin()<-1 ? 2 : 1;
532 for (
int i=0;
i<7;
i++) {
533 axis->SetBinLabel(
i+istart,labels[
i].c_str());
T getUntrackedParameter(std::string const &, T const &) const
void runDCCAnalysis(std::vector< L1MuDTChambPhDigi > const *phTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
Run analysis on DCC data.
void bookHistos(DQMStore::IBooker &, const DTChamberId &chamb)
Book the histograms.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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.
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 setDCC(int qual, int bx)
MonitorElement * bookProfile2D(Args &&...args)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< L1MuDTChambThContainer > dcc_theta_Token_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
Beginrun.
edm::EDGetTokenT< DTLocalTriggerCollection > trig_Token_
MonitorElement * nEventMonitor
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
std::string & topFolder(std::string const &type)
Get the Top folder (different between Physics and TP and DCC/DDU)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
Perform trend plot operations.
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
edm::ParameterSet theParams
std::vector< DTLocalTrigger >::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
MonitorElement * bookFloat(Args &&...args)
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.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
DTLocalTriggerBaseTask(const edm::ParameterSet &ps)
Constructor.
int wheel() const
Return the wheel number.
edm::EDGetTokenT< L1MuDTChambPhContainer > dcc_phi_Token_
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.