45 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: Constructor" << endl;
53 ddu_Token_ = consumes<DTLocalTriggerCollection>(
56 gmt_Token_ = consumes<L1MuGMTReadoutCollection>(
78 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: analyzed " <<
nevents <<
" events" << endl;
94 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: bookHistograms" << endl;
98 for (
int wh=-2;wh<=2;++wh){
99 vector<string>::const_iterator tagIt =
processTags.begin();
100 vector<string>::const_iterator tagEnd =
processTags.end();
101 for (; tagIt!=tagEnd; ++tagIt) {
105 for (
int stat=1;stat<=4;++stat){
106 for (
int sect=1;sect<=12;++sect){
117 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask") <<
"[DTTriggerEfficiencyTask]: Begin of LS transition"<<endl;
127 map<DTChamberId,const L1MuDTChambPhDigi*> phBestDCC;
128 map<DTChamberId,const DTLocalTrigger*> phBestDDU;
133 vector<L1MuDTChambPhDigi>
const* phTrigs = l1DTTPGPh->getContainer();
135 vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
136 vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
137 for(; iph !=iphe ; ++iph) {
139 int phwheel = iph->whNum();
140 int phsec = iph->scNum() + 1;
141 int phst = iph->stNum();
142 int phcode = iph->code();
146 if( phcode < 7 && (phBestDCC.find(chId) == phBestDCC.end() ||
147 phcode>phBestDCC[chId]->code()) ) phBestDCC[chId] = &(*iph);
155 for (detUnitIt=trigsDDU->begin();detUnitIt!=trigsDDU->end();++detUnitIt){
162 for (; trigIt!= trigEnd;++trigIt){
163 int quality = trigIt->quality();
164 if(quality>-1 && quality<7 &&
165 (phBestDDU.find(
id) == phBestDDU.end() ||
166 quality>phBestDDU[id]->quality()) ) phBestDDU[id] = &(*trigIt);
172 vector<const DTRecSegment4D*> best4DSegments;
176 reco::MuonCollection::const_iterator
mu;
178 for( mu = muons->begin(); mu != muons->end(); ++
mu ) {
181 if( !((*mu).isStandAloneMuon()) ) {
continue;}
184 const vector<reco::MuonChamberMatch> matchedChambers = (*mu).matches();
185 vector<reco::MuonChamberMatch>::const_iterator chamber;
187 for( chamber = matchedChambers.begin(); chamber != matchedChambers.end(); ++chamber ) {
193 const vector<reco::MuonSegmentMatch> matchedSegments = (*chamber).segmentMatches;
194 vector<reco::MuonSegmentMatch>::const_iterator segment;
196 for( segment = matchedSegments.begin(); segment != matchedSegments.end(); ++segment ) {
214 if( (*dtSegment).hasPhi() ) {
215 best4DSegments.push_back(&(*dtSegment));
223 vector<const DTRecSegment4D*>::const_iterator btrack;
224 for ( btrack = best4DSegments.begin(); btrack != best4DSegments.end(); ++btrack ){
226 int wheel = (*btrack)->chamberId().wheel();
227 int station = (*btrack)->chamberId().station();
231 int nHitsPhi = (*btrack)->phiSegment()->degreesOfFreedom()+2;
233 uint32_t indexCh = dtChId.
rawId();
234 map<string, MonitorElement*> &innerChME =
chamberHistos[indexCh];
235 map<string, MonitorElement*> &innerWhME =
wheelHistos[wheel];
239 vector<string>::const_iterator tagIt =
processTags.begin();
240 vector<string>::const_iterator tagEnd =
processTags.end();
242 for (; tagIt!=tagEnd; ++tagIt) {
244 int qual = (*tagIt) ==
"DCC" ?
245 phBestDCC.find(dtChId) != phBestDCC.end() ? phBestDCC[dtChId]->code() : -1 :
246 phBestDDU.find(dtChId) != phBestDDU.end() ? phBestDDU[dtChId]->quality() : -1;
248 innerWhME.find((*tagIt) +
"_TrigEffDenum")->second->Fill(scsector,station);
249 if ( qual>=0 && qual<7 ) {
250 innerWhME.find((*tagIt) +
"_TrigEffNum")->second->Fill(scsector,station);
252 innerWhME.find((*tagIt) +
"_TrigEffCorrNum")->second->Fill(scsector,station);
256 innerChME.find((*tagIt) +
"_TrackPosvsAngle")->second->Fill(xdir,x);
257 if ( qual>=0 && qual<7 ) {
258 innerChME.find((*tagIt) +
"_TrackPosvsAngleAnyQual")->second->Fill(xdir,x);
260 innerChME.find((*tagIt) +
"_TrackPosvsAngleCorr")->second->Fill(xdir,x);
275 std::vector<L1MuGMTReadoutRecord> gmt_records = gmtrc->getRecords();
276 std::vector<L1MuGMTReadoutRecord>::const_iterator igmtrr = gmt_records.begin();
277 std::vector<L1MuGMTReadoutRecord>::const_iterator egmtrr = gmt_records.end();
278 for(; igmtrr!=egmtrr; igmtrr++) {
280 std::vector<L1MuGMTExtendedCand> candsGMT = igmtrr->getGMTCands();
281 std::vector<L1MuGMTExtendedCand>::const_iterator candGMTIt = candsGMT.begin();
282 std::vector<L1MuGMTExtendedCand>::const_iterator candGMTEnd = candsGMT.end();
284 for(; candGMTIt!=candGMTEnd; ++candGMTIt){
285 if(!candGMTIt->empty()) {
286 int quality = candGMTIt->quality();
287 if(candGMTIt->bx()==0 &&
288 (quality == 5 || quality == 7)){
300 string histoType,
string folder) {
302 int wh = dtCh.
wheel();
305 stringstream wheel; wheel << wh;
306 stringstream
station; station << st;
307 stringstream sector; sector << sc;
310 string bookingFolder = hwFolder +
"Wheel" + wheel.str() +
"/Sector" + sector.str() +
"/Station" + station.str() +
"/" + folder;
311 string histoTag =
"_W" + wheel.str() +
"_Sec" + sector.str() +
"_St" + station.str();
315 LogTrace (
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask")
316 <<
"[DTTriggerEfficiencyTask]: booking histos in " << bookingFolder << endl;
322 string histoName = histoType +
"_TrackPosvsAngle" + histoTag;
323 string histoLabel =
"Position vs Angle (phi)";
326 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
328 histoName = histoType +
"_TrackPosvsAngleAnyQual" + histoTag;
329 histoLabel =
"Position vs Angle (phi) for any qual triggers";
332 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
334 histoName = histoType +
"_TrackPosvsAngleCorr" + histoTag;
335 histoLabel =
"Position vs Angle (phi) for correlated triggers";
338 ibooker.
book2D(histoName,histoLabel,12,-30.,30.,nbins,min,max);
345 stringstream wh; wh << wheel;
347 if (hTag.find(
"Summary") != string::npos ) {
350 basedir =
topFolder(hTag) + folder +
"/" ;
355 string hTagName =
"_W" + wh.str();
357 LogTrace(
"DTDQM|DTMonitorModule|DTTriggerEfficiencyTask")
358 <<
"[DTTriggerEfficiencyTask]: booking histos in "<< basedir << endl;
360 string hName = hTag +
"_TrigEffDenum" + hTagName;
372 hName = hTag +
"_TrigEffNum" + hTagName;
373 me = ibooker.
book2D(hName.c_str(),hName.c_str(),12,1,13,4,1,5);
383 hName = hTag +
"_TrigEffCorrNum" + hTagName;
384 me = ibooker.
book2D(hName.c_str(),hName.c_str(),12,1,13,4,1,5);
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< L1MuDTChambPhContainer > dcc_Token_
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)
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.
uint32_t rawId() const
get the raw id
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void bookChamberHistos(DQMStore::IBooker &ibooker, const DTChamberId &dtCh, std::string histoTag, std::string folder="")
Book chamber granularity histograms.
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
edm::ESHandle< DTGeometry > muonGeom
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
BeginRun.
virtual ~DTTriggerEfficiencyTask()
Destructor.
std::vector< DTLocalTrigger >::const_iterator const_iterator
std::vector< std::string > processTags
static const unsigned int BelongsToTrackByDR
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.
edm::ParameterSet parameters
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.