47 int qualTM()
const {
return theQual; }
56 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: Constructor" << endl;
74 topFolder(
"TM") =
"DT/11-LocalTriggerTP-TM/";
76 topFolder(
"TM") =
"DT/03-LocalTrigger-TM/";
83 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
84 <<
"[DTLocalTriggerBaseTask]: analyzed " <<
nEvents <<
" events" << endl;
95 for (
int wh = -2; wh < 3; ++wh) {
97 for (
int sect = 1; sect < 13; ++sect) {
109 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
110 <<
"[DTLocalTriggerBaseTask]: Begin of LS transition" << endl;
112 if (
nLumis % resetCycle == 0) {
113 map<uint32_t, map<string, MonitorElement*> >::const_iterator chambIt =
chamberHistos.begin();
114 map<uint32_t, map<string, MonitorElement*> >::const_iterator chambEnd =
chamberHistos.end();
115 for (; chambIt != chambEnd; ++chambIt) {
116 map<string, MonitorElement*>::const_iterator histoIt = chambIt->second.begin();
117 map<string, MonitorElement*>::const_iterator histoEnd = chambIt->second.end();
118 for (; histoIt != histoEnd; ++histoIt) {
119 histoIt->second->Reset();
126 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: End of LS transition" << endl;
128 map<uint32_t, DTTimeEvolutionHisto*>::const_iterator chambIt =
trendHistos.begin();
129 map<uint32_t, DTTimeEvolutionHisto*>::const_iterator chambEnd =
trendHistos.end();
130 for (; chambIt != chambEnd; ++chambIt) {
131 cout <<
"updating time slot in DTLocalTriggerBaseTask" << endl;
133 cout <<
"updated time slot in DTLocalTriggerBaseTask" << endl;
138 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask") <<
"[DTLocalTriggerBaseTask]: BeginRun" << endl;
167 LogVerbatim(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
168 <<
"[DTLocalTriggerBaseTask]: one or more TM handles for Input Tag " << inputTagTM <<
" not found!" << endl;
175 uint32_t rawId = dtCh.
rawId();
178 wheel << dtCh.
wheel();
184 map<string, int>
minBX;
185 map<string, int>
maxBX;
190 string chTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
191 string labelInOut =
"";
193 vector<string>::const_iterator typeIt =
theTypes.begin();
194 vector<string>::const_iterator typeEnd =
theTypes.end();
196 for (; typeIt != typeEnd; ++typeIt) {
197 LogTrace(
"DTDQM|DTMonitorModule|DTLocalTriggerBaseTask")
198 <<
"[DTLocalTriggerBaseTask]: booking histos for " <<
topFolder((*typeIt)) <<
"Wheel" << wheel.str()
199 <<
"/Sector" << sector.str() <<
"/Station" << station.str() << endl;
201 for (
int InOut = 0; InOut < 2; InOut++) {
206 station.str() +
"/LocalTriggerPhiIn");
208 }
else if (InOut == 1) {
210 station.str() +
"/LocalTriggerPhiOut");
214 string histoTag = (*typeIt) +
"_BXvsQual" + labelInOut;
216 "BX vs trigger quality",
220 (
int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1),
222 maxBX[*typeIt] + .5);
226 histoTag = (*typeIt) +
"_BestQual" + labelInOut;
228 ibooker.
book1D(histoTag + chTag,
"Trigger quality of best primitives", 7, -0.5, 6.5);
231 histoTag = (*typeIt) +
"_Flag1stvsQual" + labelInOut;
233 ibooker.
book2D(histoTag + chTag,
"1st/2nd trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5);
236 histoTag = (*typeIt) +
"_FlagUpDownvsQual" + labelInOut;
238 ibooker.
book2D(histoTag + chTag,
"Up/Down trig flag vs quality", 7, -0.5, 6.5, 2, -0.5, 1.5);
242 if (*typeIt ==
"TM") {
247 histoTag = (*typeIt) +
"_QualvsPhirad" + labelInOut;
249 ibooker.
book2D(histoTag + chTag,
"Trigger quality vs local position", nBinsPh, minPh, maxPh, 7, -0.5, 6.5);
253 histoTag = (*typeIt) +
"_QualvsPhibend" + labelInOut;
255 ibooker.
book2D(histoTag + chTag,
"Trigger quality vs local direction", 200, -40., 40., 7, -0.5, 6.5);
263 station.str() +
"/LocalTriggerTheta");
266 if ((*typeIt) ==
"TM" && dtCh.
station() != 4) {
267 histoTag = (*typeIt) +
"_PositionvsBX";
269 "Theta trigger position vs BX",
270 (
int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1),
276 histoTag = (*typeIt) +
"_PositionvsQual";
278 ibooker.
book2D(histoTag + chTag,
"Theta trigger position vs quality", 2, 0.5, 2.5, 7, -0.5, 6.5);
280 histoTag = (*typeIt) +
"_ThetaBXvsQual";
282 "BX vs trigger quality",
286 (
int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1),
288 maxBX[*typeIt] + .5);
296 histoTag = (*typeIt) +
"_ThetaBXvsQual";
298 "BX vs trigger quality",
302 (
int)(maxBX[(*typeIt)] - minBX[*typeIt] + 1),
304 maxBX[*typeIt] + .5);
307 histoTag = (*typeIt) +
"_ThetaBestQual";
309 ibooker.
book1D(histoTag + chTag,
"Trigger quality of best primitives (theta)", 7, -0.5, 6.5);
317 std::vector<L1MuDTChambPhDigi>
const* phOutTrigs,
318 std::vector<L1MuDTChambThDigi>
const* thTrigs) {
319 vector<L1MuDTChambPhDigi>::const_iterator iph = phInTrigs->begin();
320 vector<L1MuDTChambPhDigi>::const_iterator iphe = phInTrigs->end();
322 for (; iph != iphe; ++iph) {
323 int wh = iph->whNum();
324 int sec = iph->scNum() + 1;
325 int st = iph->stNum();
326 int qual = iph->code();
327 int is1st = iph->Ts2Tag() ? 1 : 0;
328 int bx = iph->bxNum() - is1st;
329 int updown = iph->UpDownTag();
331 if (qual < 0 || qual > 6)
335 uint32_t rawId = dtChId.
rawId();
343 map<string, MonitorElement*>& innerME =
chamberHistos[rawId];
345 innerME[
"TM_BXvsQual_In"]->Fill(qual, bx);
346 innerME[
"TM_QualvsPhirad_In"]->Fill(pos, qual);
348 innerME[
"TM_BXvsQual_In"]->Fill(qual, bx);
349 innerME[
"TM_Flag1stvsQual_In"]->Fill(qual, is1st);
350 innerME[
"TM_FlagUpDownvsQual_In"]->Fill(qual, updown);
352 innerME[
"TM_QualvsPhirad_In"]->Fill(pos, qual);
354 innerME[
"TM_QualvsPhibend_In"]->Fill(dir, qual);
359 iph = phOutTrigs->begin();
360 iphe = phOutTrigs->end();
362 for (; iph != iphe; ++iph) {
363 int wh = iph->whNum();
364 int sec = iph->scNum() + 1;
365 int st = iph->stNum();
366 int qual = iph->code();
367 int is1st = iph->Ts2Tag() ? 1 : 0;
368 int bx = iph->bxNum() - is1st;
369 int updown = iph->UpDownTag();
370 if (qual < 0 || qual > 6)
374 uint32_t rawId = dtChId.
rawId();
382 map<string, MonitorElement*>& innerME =
chamberHistos[rawId];
384 innerME[
"TM_BXvsQual_Out"]->Fill(qual, bx);
385 innerME[
"TM_QualvsPhirad_Out"]->Fill(pos, qual);
387 innerME[
"TM_BXvsQual_Out"]->Fill(qual, bx);
388 innerME[
"TM_Flag1stvsQual_Out"]->Fill(qual, is1st);
389 innerME[
"TM_FlagUpDownvsQual_Out"]->Fill(qual, updown);
392 innerME[
"TM_QualvsPhirad_Out"]->Fill(pos, qual);
394 innerME[
"TM_QualvsPhibend_Out"]->Fill(dir, qual);
399 vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
400 vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
402 for (; ith != ithe; ++ith) {
403 int wh = ith->whNum();
404 int sec = ith->scNum() + 1;
405 int st = ith->stNum();
406 int bx = ith->bxNum();
411 thcode[
pos] = ith->code(
pos);
414 uint32_t rawId = dtChId.
rawId();
416 map<string, MonitorElement*>& innerME =
chamberHistos[rawId];
419 if (thcode[
pos] > 0) {
420 innerME[
"TM_PositionvsBX"]->Fill(bx,
pos);
421 innerME[
"TM_PositionvsQual"]->Fill(thcode[
pos], pos);
422 innerME[
"TM_ThetaBXvsQual"]->Fill(thcode[pos], bx);
427 map<uint32_t, DTTPGCompareUnit>::const_iterator compIt =
theCompMapIn.begin();
428 map<uint32_t, DTTPGCompareUnit>::const_iterator compEnd =
theCompMapIn.end();
429 for (; compIt != compEnd; ++compIt) {
430 int bestQual = compIt->second.qualTM();
432 chamberHistos[compIt->first][
"TM_BestQual_In"]->Fill(bestQual);
438 map<uint32_t, DTTPGCompareUnit>::const_iterator compIt =
theCompMapOut.begin();
439 map<uint32_t, DTTPGCompareUnit>::const_iterator compEnd =
theCompMapOut.end();
440 for (; compIt != compEnd; ++compIt) {
441 int bestQual = compIt->second.qualTM();
443 chamberHistos[compIt->first][
"TM_BestQual_Out"]->Fill(bestQual);
453 TAxis* axis =
nullptr;
455 axis = histo->GetXaxis();
456 }
else if (iaxis == 2) {
457 axis = histo->GetYaxis();
462 string labels[7] = {
"LI",
"LO",
"HI",
"HO",
"LL",
"HL",
"HH"};
463 int istart = axis->GetXmin() < -1 ? 2 : 1;
464 for (
int i = 0;
i < 7;
i++) {
465 axis->SetBinLabel(
i + istart, labels[
i].c_str());
474 TAxis* axis =
nullptr;
476 axis = histo->GetXaxis();
477 }
else if (iaxis == 2) {
478 axis = histo->GetYaxis();
483 string labels[2] = {
"L",
"H"};
484 int istart = axis->GetXmin() < -1 ? 2 : 1;
485 for (
int i = 0;
i < 2;
i++) {
486 axis->SetBinLabel(
i + istart, labels[
i].c_str());
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
The_Container const * getContainer() const
T getUntrackedParameter(std::string const &, T const &) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Beginrun.
std::map< uint32_t, DTTimeEvolutionHisto * > trendHistos
void bookHistos(DQMStore::IBooker &, const DTChamberId &chamb)
Book the histograms.
MonitorElement * bookFloat(TString const &name)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
constexpr uint32_t rawId() const
get the raw id
void setTM(int qual, int bx)
std::vector< std::string > theTypes
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
LuminosityBlockNumber_t luminosityBlock() const
DTTrigGeomUtils * theTrigGeomUtils
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
Perform trend plot operations.
~DTLocalTriggerBaseTask() override
Destructor.
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
edm::EDGetTokenT< L1MuDTChambThContainer > tm_theta_Token_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Abs< T >::type abs(const T &t)
void runTMAnalysis(std::vector< L1MuDTChambPhDigi > const *phInTrigs, std::vector< L1MuDTChambPhDigi > const *phOutTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
Run analysis on TM data.
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
To reset the MEs.
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 TM)
void setQLabelsTheta(MonitorElement *me, short int iaxis)
edm::ParameterSet theParams
std::map< uint32_t, DTTPGCompareUnit > theCompMapIn
Phi_Container const * getContainer() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_phiIn_Token_
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
int station() const
Return the station number.
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_phiOut_Token_
DTLocalTriggerBaseTask(const edm::ParameterSet &ps)
Constructor.
int wheel() const
Return the wheel number.
std::map< uint32_t, DTTPGCompareUnit > theCompMapOut