45 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: Constructor" << endl;
51 tm_Token_ = consumes<L1MuDTChambPhContainer>(
53 ddu_Token_ = consumes<DTLocalTriggerCollection>(
56 gmt_Token_ = consumes<L1MuGMTReadoutCollection>(
73 ddu_Token_ = consumes<DTLocalTriggerCollection>(
76 if (!processTM && !processDDU)
LogError (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: Error, no trigger source (DDU or Twinmux) has been selected!!" <<endl;
83 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: analyzed " <<
nevents <<
" events" << endl;
99 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: bookHistograms" << endl;
102 for (
int wh=-2;wh<=2;++wh){
103 vector<string>::const_iterator tagIt =
processTags.begin();
104 vector<string>::const_iterator tagEnd =
processTags.end();
105 for (; tagIt!=tagEnd; ++tagIt) {
110 for (
int sect=1;sect<=12;++sect){
121 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: Begin of LS transition"<<endl;
132 map<DTChamberId,const L1MuDTChambPhDigi*> phBestTM;
133 map<DTChamberId,const DTLocalTrigger*> phBestDDU;
137 vector<L1MuDTChambPhDigi>
const* phTrigs = l1DTTPGPh->
getContainer();
139 vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
140 vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
141 for(; iph !=iphe ; ++iph) {
143 int phwheel = iph->whNum();
144 int phsec = iph->scNum() + 1;
145 int phst = iph->stNum();
146 int phcode = iph->code();
150 if( phcode < 7 && (phBestTM.find(chId) == phBestTM.end() ||
151 phcode>phBestTM[chId]->code()) ) phBestTM[chId] = &(*iph);
160 for (detUnitIt=trigsDDU->begin();detUnitIt!=trigsDDU->end();++detUnitIt){
167 for (; trigIt!= trigEnd;++trigIt){
168 int quality = trigIt->quality();
169 if(quality>-1 && quality<7 &&
170 (phBestDDU.find(
id) == phBestDDU.end() ||
171 quality>phBestDDU[
id]->quality()) ) phBestDDU[
id] = &(*trigIt);
178 vector<const DTRecSegment4D*> best4DSegments;
182 reco::MuonCollection::const_iterator
mu;
184 for( mu = muons->begin(); mu != muons->end(); ++
mu ) {
187 if( !((*mu).isStandAloneMuon()) ) {
continue;}
190 const vector<reco::MuonChamberMatch> matchedChambers = (*mu).matches();
191 vector<reco::MuonChamberMatch>::const_iterator
chamber;
193 for( chamber = matchedChambers.begin(); chamber != matchedChambers.end(); ++
chamber ) {
199 const vector<reco::MuonSegmentMatch> matchedSegments = (*chamber).segmentMatches;
200 vector<reco::MuonSegmentMatch>::const_iterator segment;
202 for( segment = matchedSegments.begin(); segment != matchedSegments.end(); ++segment ) {
220 if( (*dtSegment).hasPhi() ) {
221 best4DSegments.push_back(&(*dtSegment));
229 vector<const DTRecSegment4D*>::const_iterator btrack;
230 for ( btrack = best4DSegments.begin(); btrack != best4DSegments.end(); ++btrack ){
231 int wheel = (*btrack)->chamberId().wheel();
232 int station = (*btrack)->chamberId().station();
236 int nHitsPhi = (*btrack)->phiSegment()->degreesOfFreedom()+2;
238 uint32_t indexCh = dtChId.
rawId();
239 map<string, MonitorElement*> &innerChME =
chamberHistos[indexCh];
243 vector<string>::const_iterator tagIt =
processTags.begin();
244 vector<string>::const_iterator tagEnd =
processTags.end();
245 for (; tagIt!=tagEnd; ++tagIt) {
246 int qual = (*tagIt) ==
"TM" ?
247 phBestTM.find(dtChId) != phBestTM.end() ? phBestTM[dtChId]->code() : -1 :
248 phBestDDU.find(dtChId) != phBestDDU.end() ? phBestDDU[dtChId]->quality() : -1;
249 innerWhME.find((*tagIt) +
"_TrigEffDenum")->second->Fill(scsector,station);
251 if ( qual>=0 && qual<7 ) {
252 innerWhME.find((*tagIt) +
"_TrigEffNum")->second->Fill(scsector,station);
254 innerWhME.find((*tagIt) +
"_TrigEffCorrNum")->second->Fill(scsector,station);
258 innerChME.find((*tagIt) +
"_TrackPosvsAngle")->second->Fill(xdir,x);
259 if ( qual>=0 && qual<7 ) {
260 innerChME.find((*tagIt) +
"_TrackPosvsAngleAnyQual")->second->Fill(xdir,x);
262 innerChME.find((*tagIt) +
"_TrackPosvsAngleCorr")->second->Fill(xdir,x);
277 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->
getRecords();
278 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr = gmt_records.begin();
279 std::vector<L1MuGMTReadoutRecord>::const_iterator egmtrr = gmt_records.end();
280 for(; igmtrr!=egmtrr; igmtrr++) {
282 std::vector<L1MuGMTExtendedCand> candsGMT = igmtrr->getGMTCands();
283 std::vector<L1MuGMTExtendedCand>::const_iterator candGMTIt = candsGMT.begin();
284 std::vector<L1MuGMTExtendedCand>::const_iterator candGMTEnd = candsGMT.end();
286 for(; candGMTIt!=candGMTEnd; ++candGMTIt){
287 if(!candGMTIt->empty()) {
288 int quality = candGMTIt->quality();
289 if(candGMTIt->bx()==0 &&
290 (quality == 5 || quality == 7)){
302 string histoType,
string folder) {
304 int wh = dtCh.
wheel();
307 stringstream
wheel; wheel << wh;
308 stringstream
station; station << st;
309 stringstream sector; sector <<
sc;
312 string bookingFolder = hwFolder +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str() +
"/" +
folder;
313 string histoTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
317 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask")
318 <<
"[DTTriggerEfficiencyTask]: booking histos in " << bookingFolder << endl;
324 string histoName = histoType +
"_TrackPosvsAngle" + histoTag;
325 string histoLabel =
"Position vs Angle (phi)";
328 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
330 histoName = histoType +
"_TrackPosvsAngleAnyQual" + histoTag;
331 histoLabel =
"Position vs Angle (phi) for any qual triggers";
334 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
336 histoName = histoType +
"_TrackPosvsAngleCorr" + histoTag;
337 histoLabel =
"Position vs Angle (phi) for correlated triggers";
340 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
347 stringstream wh; wh <<
wheel;
349 if (hTag.find(
"Summary") != string::npos ) {
352 basedir =
topFolder(hTag) + folder +
"/" ;
357 string hTagName =
"_W" + wh.str();
359 LogTrace(
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask")
360 <<
"[DTTriggerEfficiencyTask]: booking histos in "<< basedir << endl;
362 string hName = hTag +
"_TrigEffDenum" + hTagName;
374 hName = hTag +
"_TrigEffNum" + hTagName;
375 me = ibooker.
book2D(hName.c_str(),hName.c_str(),12,1,13,4,1,5);
385 hName = hTag +
"_TrigEffCorrNum" + hTagName;
386 me = ibooker.
book2D(hName.c_str(),hName.c_str(),12,1,13,4,1,5);
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
edm::EDGetTokenT< L1MuGMTReadoutCollection > gmt_Token_
std::string SegmArbitration
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::MuonCollection > muons_Token_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void bookWheelHistos(DQMStore::IBooker &ibooker, int wheel, std::string histoTag, std::string folder="")
Book wheel granularity histograms.
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_Token_
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
uint32_t rawId() const
get the raw id
void bookChamberHistos(DQMStore::IBooker &ibooker, const DTChamberId &dtCh, std::string histoTag, std::string folder="")
Book chamber granularity histograms.
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
BeginRun.
DTTrigGeomUtils * trigGeomUtils
static const unsigned int BestInChamberByDR
static const unsigned int BelongsToTrackByCleaning
edm::EDGetTokenT< DTLocalTriggerCollection > ddu_Token_
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
bool hasRPCTriggers(const edm::Event &e)
checks for RPC Triggers
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
To reset the MEs.
edm::ESHandle< DTGeometry > muonGeom
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
std::vector< DTLocalTrigger >::const_iterator const_iterator
Phi_Container const * getContainer() const
std::vector< std::string > processTags
static const unsigned int BelongsToTrackByDR
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
std::pair< const_iterator, const_iterator > Range
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
DTTriggerEfficiencyTask(const edm::ParameterSet &ps)
Constructor.
edm::InputTag inputTagSEG
int station() const
Return the station number.
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)
std::string topFolder(std::string source)
return the top folder
void computeSCCoordinates(const DTRecSegment4D *track, int &scsec, float &x, float &xdir, float &y, float &ydir)
Compute track coordinates with SC sector numbering.
~DTTriggerEfficiencyTask() override
Destructor.