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/";
105 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
106 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
114 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
115 <<
"[DTLocalTriggerBaseTask]: BeginJob" << endl;
122 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
123 <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
131 for (
int wh=-2;wh<3;++wh){
132 for (
int stat=1;stat<5;++stat){
133 for (
int sect=1;sect<13;++sect){
149 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
150 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
152 if(
nLumis%resetCycle == 0 ) {
153 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
154 map<uint32_t,map<string,MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
155 for(;chambIt!=chambEnd;++chambIt) {
156 map<string,MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
157 map<string,MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
158 for(;histoIt!=histoEnd;++histoIt) {
159 histoIt->second->Reset();
168 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
169 <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
171 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambIt =
trendHistos.begin();
172 map<uint32_t,DTTimeEvolutionHisto* >::const_iterator chambEnd =
trendHistos.end();
173 for(;chambIt!=chambEnd;++chambIt) {
182 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
183 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
210 runDCCAnalysis(phiTrigsDCC->getContainer(),thetaTrigsDCC->getContainer());
212 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
213 <<
"[DTLocalTriggerBaseTask]: one or more DCC handles for Input Tag "
214 << inputTagDCC <<
" not found!" << endl;
226 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
227 <<
"[DTLocalTriggerBaseTask]: one or more DDU handles for Input Tag "
228 << inputTagDDU <<
" not found!" << endl;
241 uint32_t rawId = dtCh.
rawId();
243 stringstream wheel; wheel << dtCh.
wheel();
245 stringstream sector; sector << dtCh.
sector();
247 map<string,int> minBX;
248 map<string,int> maxBX;
258 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
260 vector<string>::const_iterator typeIt =
theTypes.begin();
261 vector<string>::const_iterator typeEnd =
theTypes.end();
263 for (; typeIt!=typeEnd; ++typeIt) {
265 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
266 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel"
267 << wheel.str() <<
"/Sector" << sector.str() <<
"/Station"<< station.str() << endl;
271 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
273 string histoTag = (*typeIt) +
"_BXvsQual";
275 7,-0.5,6.5,(
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
279 histoTag = (*typeIt) +
"_BestQual";
281 "Trigger quality of best primitives",7,-0.5,6.5);
284 histoTag = (*typeIt) +
"_Flag1stvsQual";
286 "1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
290 if (*typeIt==
"DCC") {
291 float minPh, maxPh;
int nBinsPh;
294 histoTag = (*typeIt) +
"_QualvsPhirad";
296 "Trigger quality vs local position",nBinsPh,minPh,maxPh,7,-0.5,6.5);
300 histoTag = (*typeIt) +
"_QualvsPhibend";
302 "Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
309 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerTheta");
311 if((*typeIt)==
"DCC") {
312 histoTag = (*typeIt) +
"_PositionvsBX";
314 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5,7,-0.5,6.5);
316 histoTag = (*typeIt) +
"_ThetaBXvsQual";
318 (
int)(maxBX[(*typeIt)]-minBX[*typeIt]+1),minBX[*typeIt]-.5,maxBX[*typeIt]+.5);
321 histoTag = (*typeIt) +
"_ThetaBestQual";
323 "Trigger quality of best primitives (theta)",7,-0.5,6.5);
332 + sector.str() +
"/Station" + station.str() +
"/LocalTriggerPhi");
334 string histoTag =
"COM_QualDDUvsQualDCC";
336 "DDU quality vs DCC quality",8,-1.5,6.5,8,-1.5,6.5);
340 histoTag =
"COM_MatchingTrend";
342 "Fraction of DDU-DCC matches w.r.t. proc evts",
343 nTimeBins,nLSTimeBin,
true,0);
350 stringstream wheel; wheel << wh;
352 string whTag =
"_W" + wheel.str();
354 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
355 <<
"[DTLocalTriggerBaseTask]: booking wheel histos for "
356 <<
topFolder(
"DDU") <<
"Wheel" << wh << endl;
358 string histoTag =
"COM_BXDiff";
360 "DDU-DCC BX Difference",12,1,13,4,1,5,0.,20.);
369 std::vector<L1MuDTChambThDigi>
const* thTrigs )
371 vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
372 vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
374 for(; iph !=iphe ; ++iph) {
376 int wh = iph->whNum();
377 int sec = iph->scNum() + 1;
378 int st = iph->stNum();
379 int qual = iph->code();
380 int is1st = iph->Ts2Tag() ? 1 : 0;
381 int bx = iph->bxNum() - is1st;
383 if (qual <0 || qual>6)
continue;
386 uint32_t rawId = dtChId.
rawId();
395 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
397 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
398 innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
400 innerME[
"DCC_BXvsQual"]->Fill(qual,bx);
401 innerME[
"DCC_Flag1stvsQual"]->Fill(qual,is1st);
402 if (!is1st) innerME[
"DCC_QualvsPhirad"]->Fill(pos,qual);
404 innerME[
"DCC_QualvsPhibend"]->Fill(dir,qual);
410 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
411 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
413 for(; ith != ithe; ++ith) {
414 int wh = ith->whNum();
415 int sec = ith->scNum() + 1;
416 int st = ith->stNum();
417 int bx = ith->bxNum();
421 for (
int pos=0; pos<7; pos++)
422 thcode[pos] = ith->code(pos);
425 uint32_t rawId = dtChId.
rawId();
427 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
429 for (
int pos=0; pos<7; pos++)
431 innerME[
"DCC_PositionvsBX"]->Fill(bx,pos);
437 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
438 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
439 for (; compIt!=compEnd; ++compIt) {
440 int bestQual = compIt->second.qualDCC();
442 chamberHistos[compIt->first][
"DCC_BestQual"]->Fill(bestQual);
454 for (; detUnitIt!=detUnitEnd; ++detUnitIt){
457 uint32_t rawId = chId.
rawId();
461 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
463 int bestQualTheta = -1;
465 for (; trigIt!=range.second; ++trigIt){
467 int qualPhi = trigIt->quality();
468 int qualTheta = trigIt->trTheta();
469 int flag1st = trigIt->secondTrack() ? 1 : 0;
470 int bx = trigIt->bx();
471 int bxPhi = bx - flag1st;
473 if( qualPhi>-1 && qualPhi<7 ) {
478 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
480 innerME[
"DDU_BXvsQual"]->Fill(qualPhi,bxPhi);
481 innerME[
"DDU_Flag1stvsQual"]->Fill(qualPhi,flag1st);
485 if( qualTheta>0 && !
tpMode ){
486 if (qualTheta > bestQualTheta){
487 bestQualTheta = qualTheta;
489 innerME[
"DDU_ThetaBXvsQual"]->Fill(qualTheta,bx);
495 int bestQualPhi =
theCompMap[rawId].qualDDU();
497 innerME[
"DDU_BestQual"]->Fill(bestQualPhi);
498 if(bestQualTheta>0) {
499 innerME[
"DDU_ThetaBestQual"]->Fill(bestQualTheta);
509 map<uint32_t,DTTPGCompareUnit>::const_iterator compIt =
theCompMap.begin();
510 map<uint32_t,DTTPGCompareUnit>::const_iterator compEnd =
theCompMap.end();
512 for (; compIt!=compEnd; ++compIt) {
514 uint32_t rawId = compIt->first;
516 map<string, MonitorElement*> &innerME =
chamberHistos[rawId];
520 innerME[
"COM_QualDDUvsQualDCC"]->Fill(compUnit.
qualDCC(),compUnit.
qualDDU());
540 axis=histo->GetXaxis();
543 axis=histo->GetYaxis();
547 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
548 int istart = axis->GetXmin()<-1 ? 2 : 1;
549 for (
int i=0;
i<7;
i++) {
550 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.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void rmdir(const std::string &fullpath)
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.
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.
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< L1MuDTChambThContainer > dcc_theta_Token_
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
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
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.
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 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")