CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends
DTLocalTriggerTask Class Reference

#include <DTLocalTriggerTask.h>

Inheritance diagram for DTLocalTriggerTask:
one::DQMEDAnalyzer< edm::one::WatchLuminosityBlocks > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

 DTLocalTriggerTask (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~DTLocalTriggerTask () override
 Destructor. More...
 
- Public Member Functions inherited from one::DQMEDAnalyzer< edm::one::WatchLuminosityBlocks >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 To reset the MEs. More...
 
void bookBarrelHistos (DQMStore::IBooker &, std::string histoTag)
 Book the histograms. More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 Book the histograms. More...
 
void bookHistos (DQMStore::IBooker &, const DTChamberId &dtCh, std::string folder, std::string histoTag)
 
void bookWheelHistos (DQMStore::IBooker &, int wh, std::string histoTag)
 Book the histograms. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 Beginrun. More...
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) final
 
void runDDUAnalysis (edm::Handle< DTLocalTriggerCollection > &trigsDDU)
 Run analysis on ROS data. More...
 
void runDDUvsTMAnalysis (std::string &trigsrc)
 Run analysis on ROS data. More...
 
void runSegmentAnalysis (edm::Handle< DTRecSegment4DCollection > &segments4D)
 Run analysis using DT 4D segments. More...
 
void runTMAnalysis (std::vector< L1MuDTChambPhDigi > const *phTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
 Run analysis on TM data. More...
 
void setQLabels (MonitorElement *me, short int iaxis)
 Set Quality labels. More...
 
void setQLabelsTheta (MonitorElement *me, short int iaxis)
 
std::string & topFolder (bool isTM)
 Get the Top folder (different between Physics and TP and TM/DDU) More...
 
void triggerSource (const edm::Event &e)
 Get the L1A source. More...
 

Protected Attributes

const int wheelArrayShift = 3
 

Private Attributes

std::string baseFolderDDU
 
std::string baseFolderTM
 
DTArr3int dduphcode_best
 
DTArr3int dduthcode_best
 
bool detailedAnalysis
 
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
 
bool doTMTheta
 
DTArr3PhDigi iphbest
 
DTArr3LocalTrigger iphbestddu
 
bool isLocalRun
 
DTArr3ThDigi ithbest
 
edm::EDGetTokenT< LTCDigiCollectionltcDigiCollectionToken_
 
DTArr3mapInt mapDTTF
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
edm::ParameterSet parameters
 
DTArr3int phcode_best
 
edm::EDGetTokenT< DTLocalTriggerCollectionros_Token_
 
edm::EDGetTokenT< DTRecSegment4DCollectionseg_Token_
 
DTArr3int thcode_best
 
MonitorElementtm_IDDataErrorPlot
 
edm::EDGetTokenT< L1MuDTChambPhContainertm_Token_
 
edm::EDGetTokenT< L1MuDTChambThContainertmTh_Token_
 
bool tpMode
 
bool track_ok [6][5][15]
 
DTTrigGeomUtilstrigGeomUtils
 
std::string trigsrc
 
bool useDDU
 
bool useSEG
 
bool useTM
 
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
 

Friends

class DTMonitorModule
 

Detailed Description

Definition at line 53 of file DTLocalTriggerTask.h.

Constructor & Destructor Documentation

DTLocalTriggerTask::DTLocalTriggerTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 35 of file DTLocalTriggerTask.cc.

References baseFolderDDU, baseFolderTM, detailedAnalysis, doTMTheta, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isLocalRun, LogTrace, ltcDigiCollectionToken_, ros_Token_, seg_Token_, tm_Token_, tmTh_Token_, and tpMode.

35  :
36  trigGeomUtils(nullptr),
37  isLocalRun(ps.getUntrackedParameter<bool>("localrun", true))
38  {
39  if (!isLocalRun) {
40  ltcDigiCollectionToken_ = consumes<LTCDigiCollection>(
41  ps.getParameter<edm::InputTag>("ltcDigiCollectionTag"));
42  }
43 
44  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: Constructor"<<endl;
45 
46  tpMode = ps.getUntrackedParameter<bool>("testPulseMode", false);
47  detailedAnalysis = ps.getUntrackedParameter<bool>("detailedAnalysis", false);
48  doTMTheta = ps.getUntrackedParameter<bool>("enableTMTheta", false);
49  tm_Token_ = consumes<L1MuDTChambPhContainer>(
50  ps.getUntrackedParameter<InputTag>("tm_label",InputTag("twinMuxStage2Digis:PhIn")));
51  tmTh_Token_ = consumes<L1MuDTChambThContainer>(
52  ps.getUntrackedParameter<edm::InputTag>("tmTh_label",InputTag("twinMuxStage2Digis:ThIn")));
53 
54  ros_Token_ = consumes<DTLocalTriggerCollection>(
55  ps.getUntrackedParameter<InputTag>("ros_label", InputTag("dtunpacker")));
56  seg_Token_ = consumes<DTRecSegment4DCollection>(
57  ps.getUntrackedParameter<InputTag>("seg_label", InputTag("dt4DSegments")));
58 
59  if (tpMode) {
60  baseFolderTM = "DT/11-LocalTriggerTP-TM/";
61  baseFolderDDU = "DT/12-LocalTriggerTP-DDU/";
62  }
63  else {
64  baseFolderTM = "DT/03-LocalTrigger-TM/";
65  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
66  }
67 
68  parameters = ps;
69 
70 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
edm::EDGetTokenT< DTRecSegment4DCollection > seg_Token_
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_Token_
edm::EDGetTokenT< L1MuDTChambThContainer > tmTh_Token_
#define LogTrace(id)
edm::EDGetTokenT< DTLocalTriggerCollection > ros_Token_
DTTrigGeomUtils * trigGeomUtils
DTLocalTriggerTask::~DTLocalTriggerTask ( )
override

Destructor.

Definition at line 73 of file DTLocalTriggerTask.cc.

References LogTrace, nevents, and trigGeomUtils.

73  {
74 
75  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: analyzed " << nevents << " events" << endl;
76  if (trigGeomUtils) { delete trigGeomUtils; }
77 
78 }
#define LogTrace(id)
DTTrigGeomUtils * trigGeomUtils

Member Function Documentation

void DTLocalTriggerTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Analyze.

Definition at line 249 of file DTLocalTriggerTask.cc.

References edm::Event::getByToken(), L1MuDTChambPhContainer::getContainer(), L1MuDTChambThContainer::getContainer(), edm::HandleBase::isValid(), nevents, ros_Token_, runDDUAnalysis(), runDDUvsTMAnalysis(), runSegmentAnalysis(), runTMAnalysis(), seg_Token_, tm_Token_, tmTh_Token_, tpMode, triggerSource(), trigsrc, useDDU, useSEG, and useTM.

249  {
250  if (!nevents){
251 
253  e.getByToken(tm_Token_, l1DTTPGPh);
255  e.getByToken(tmTh_Token_, l1DTTPGTh);
256 
257  useTM = (l1DTTPGPh.isValid() || l1DTTPGTh.isValid()) && parameters.getUntrackedParameter<bool>("process_tm", true) ;
258 
260  e.getByToken(ros_Token_,l1DDUTrigs);
261  useDDU = l1DDUTrigs.isValid() && parameters.getUntrackedParameter<bool>("process_ddu", true) ;
262 
263  Handle<DTRecSegment4DCollection> all4DSegments;
264  e.getByToken(seg_Token_, all4DSegments);
265  useSEG = all4DSegments.isValid() && parameters.getUntrackedParameter<bool>("process_seg", true) ;
266 
267  }
268 
269 
270  nevents++;
271 
272  triggerSource(e);
273 
274  if ( useTM ) {
276  e.getByToken(tm_Token_, l1DTTPGPh);
277  vector<L1MuDTChambPhDigi> const* l1PhTrig = l1DTTPGPh->getContainer();
278 
280  e.getByToken(tmTh_Token_, l1DTTPGTh);
281 
282  vector<L1MuDTChambThDigi> const* l1ThTrig = l1DTTPGTh->getContainer();
283 
284  runTMAnalysis(l1PhTrig, l1ThTrig);
285  }
286  if ( useDDU ) {
288  e.getByToken(ros_Token_, l1DDUTrigs);
289 
290  runDDUAnalysis(l1DDUTrigs);
291  }
292  if ( !tpMode && useSEG ) {
294  e.getByToken(seg_Token_, segments4D);
295 
296  runSegmentAnalysis(segments4D);
297  }
298  if ( !tpMode && useTM && useDDU ) {
300  }
301 
302 
303 }
The_Container const * getContainer() const
void runTMAnalysis(std::vector< L1MuDTChambPhDigi > const *phTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
Run analysis on TM data.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void runSegmentAnalysis(edm::Handle< DTRecSegment4DCollection > &segments4D)
Run analysis using DT 4D segments.
edm::EDGetTokenT< DTRecSegment4DCollection > seg_Token_
edm::EDGetTokenT< L1MuDTChambPhContainer > tm_Token_
edm::EDGetTokenT< L1MuDTChambThContainer > tmTh_Token_
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< DTLocalTriggerCollection > ros_Token_
void runDDUvsTMAnalysis(std::string &trigsrc)
Run analysis on ROS data.
Phi_Container const * getContainer() const
void triggerSource(const edm::Event &e)
Get the L1A source.
void runDDUAnalysis(edm::Handle< DTLocalTriggerCollection > &trigsDDU)
Run analysis on ROS data.
void DTLocalTriggerTask::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprotected

To reset the MEs.

Definition at line 231 of file DTLocalTriggerTask.cc.

References digiHistos, trackerHits::histo, edm::LuminosityBlockBase::id(), LogTrace, edm::LuminosityBlockID::luminosityBlock(), and genParticles_cff::map.

231  {
232 
233  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: Begin of LS transition" << endl;
234 
235  if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) {
236  for(map<uint32_t, map<string, MonitorElement*> > ::const_iterator histo = digiHistos.begin();
237  histo != digiHistos.end();
238  histo++) {
239  for(map<string, MonitorElement*> ::const_iterator ht = (*histo).second.begin();
240  ht != (*histo).second.end();
241  ht++) {
242  (*ht).second->Reset();
243  }
244  }
245  }
246 
247 }
LuminosityBlockID id() const
#define LogTrace(id)
LuminosityBlockNumber_t luminosityBlock() const
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
void DTLocalTriggerTask::bookBarrelHistos ( DQMStore::IBooker ,
std::string  histoTag 
)
protected

Book the histograms.

Definition at line 306 of file DTLocalTriggerTask.cc.

References DQMStore::IBooker::book1D(), MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), tm_IDDataErrorPlot, and topFolder().

Referenced by bookHistograms().

306  {
307 
308  bool isTM = histoTag.substr(0,2) == "TM";
309  ibooker.setCurrentFolder(topFolder(isTM));
310  if (histoTag == "TM_ErrorsChamberID") {
311  tm_IDDataErrorPlot = ibooker.book1D(histoTag.c_str(),"TM Data ID Error",5,-2,3);
312  tm_IDDataErrorPlot->setAxisTitle("wheel",1);
313  }
314 
315  return;
316 
317 }
MonitorElement * tm_IDDataErrorPlot
std::string & topFolder(bool isTM)
Get the Top folder (different between Physics and TP and TM/DDU)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void DTLocalTriggerTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  context 
)
overrideprotected

Book the histograms.

Definition at line 88 of file DTLocalTriggerTask.cc.

References bookBarrelHistos(), bookHistos(), bookWheelHistos(), detailedAnalysis, doTMTheta, LogTrace, trackingPlots::stat, and tpMode.

88  {
89 
90  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: bookHistograms" << endl;
91 
92  if(parameters.getUntrackedParameter<bool>("staticBooking", true)) { // Static histo booking
93 
94  vector<string> trigSources;
95  if(parameters.getUntrackedParameter<bool>("localrun", true)) {
96  trigSources.push_back("");
97  }
98  else {
99  trigSources.push_back("_DTonly");
100  trigSources.push_back("_NoDT");
101  trigSources.push_back("_DTalso");
102  }
103  vector<string>::const_iterator trigSrcIt = trigSources.begin();
104  vector<string>::const_iterator trigSrcEnd = trigSources.end();
105 
106  if(parameters.getUntrackedParameter<bool>("process_tm", true)) {
107  bookBarrelHistos(ibooker, "TM_ErrorsChamberID");
108  }
109 
110  if (tpMode) {
111  for (int stat=1;stat<5;++stat){
112  for (int wh=-2;wh<3;++wh){
113  for (int sect=1;sect<13;++sect){
114  DTChamberId dtChId(wh,stat,sect);
115 
116  if (parameters.getUntrackedParameter<bool>("process_tm", true)){ // TM data
117  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_BXvsQual"+(*trigSrcIt));
118  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_QualvsPhirad"+(*trigSrcIt));
119  }
120 
121  if (parameters.getUntrackedParameter<bool>("process_ddu", true)){ // DDU data
122  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","DDU_BXvsQual"+(*trigSrcIt));
123  }
124 
125  }
126  }
127  } // end of loop
128  }
129  else {
130  for (;trigSrcIt!=trigSrcEnd;++trigSrcIt){
131  for (int wh=-2;wh<3;++wh){
132  if (parameters.getUntrackedParameter<bool>("process_tm", true) &&
133  parameters.getUntrackedParameter<bool>("process_ddu", true)){ // TM+DDU data
134  bookWheelHistos(ibooker, wh,"COM_BXDiff"+(*trigSrcIt));
135  }
136  for (int sect=1;sect<13;++sect){
137  for (int stat=1;stat<5;++stat){
138  DTChamberId dtChId(wh,stat,sect);
139  if (parameters.getUntrackedParameter<bool>("process_tm", true)){ // TM data
140 
141  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_BXvsQual_In"+(*trigSrcIt));
142  if (detailedAnalysis) {
143  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_QualvsPhirad_In"+(*trigSrcIt));
144  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_QualvsPhibend_In"+(*trigSrcIt));
145  }
146  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_Flag1stvsQual_In"+(*trigSrcIt));
147  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_FlagUpDownvsQual_In"+(*trigSrcIt));
148 
149  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","TM_BestQual_In"+(*trigSrcIt));
150  if (stat!=4 && doTMTheta){
151  bookHistos(ibooker, dtChId,"LocalTriggerTheta","TM_PositionvsBX"+(*trigSrcIt));
152  bookHistos(ibooker, dtChId,"LocalTriggerTheta","TM_QualityvsBX"+(*trigSrcIt));
153 
154  bookHistos(ibooker, dtChId,"LocalTriggerTheta","TM_PositionvsQual"+(*trigSrcIt));
155 
156  bookHistos(ibooker, dtChId,"LocalTriggerTheta","TM_ThetaBXvsQual"+(*trigSrcIt));
157  bookHistos(ibooker, dtChId,"LocalTriggerTheta","TM_ThetaBestQual"+(*trigSrcIt));
158  }
159 
160  if (parameters.getUntrackedParameter<bool>("process_seg", true)){ // TM + Segemnt
161  bookHistos(ibooker, dtChId,"Segment","TM_PhitkvsPhitrig"+(*trigSrcIt));
162  bookHistos(ibooker, dtChId,"Segment","TM_PhibtkvsPhibtrig"+(*trigSrcIt));
163  bookHistos(ibooker, dtChId,"Segment","TM_PhiResidual"+(*trigSrcIt));
164  bookHistos(ibooker, dtChId,"Segment","TM_PhiResidualvsLUTPhi"+(*trigSrcIt));
165  bookHistos(ibooker, dtChId,"Segment","TM_PhibResidual"+(*trigSrcIt));
166  bookHistos(ibooker, dtChId,"Segment","TM_HitstkvsQualtrig"+(*trigSrcIt));
167  bookHistos(ibooker, dtChId,"Segment","TM_TrackPosvsAngle"+(*trigSrcIt));
168  bookHistos(ibooker, dtChId,"Segment","TM_TrackPosvsAngleandTrig"+(*trigSrcIt));
169  bookHistos(ibooker, dtChId,"Segment","TM_TrackPosvsAngleandTrigHHHL"+(*trigSrcIt));
170  if(stat!=4){
171  bookHistos(ibooker, dtChId,"Segment","TM_TrackThetaPosvsAngle"+(*trigSrcIt)); // theta view
172  bookHistos(ibooker, dtChId,"Segment","TM_TrackThetaPosvsAngleandTrig"+(*trigSrcIt));
173  bookHistos(ibooker, dtChId,"Segment","TM_TrackThetaPosvsAngleandTrigH"+(*trigSrcIt)); // TM theta quality not available!
174  }
175  }
176 
177  }
178 
179  if (parameters.getUntrackedParameter<bool>("process_ddu", true)){ // DDU data
180 
181  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","DDU_BXvsQual"+(*trigSrcIt));
182  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","DDU_Flag1stvsQual"+(*trigSrcIt));
183  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","DDU_BestQual"+(*trigSrcIt));
184  if(stat!=4){ // theta view
185  bookHistos(ibooker, dtChId,"LocalTriggerTheta","DDU_ThetaBXvsQual"+(*trigSrcIt));
186  bookHistos(ibooker, dtChId,"LocalTriggerTheta","DDU_ThetaBestQual"+(*trigSrcIt));
187  }
188 
189  if (parameters.getUntrackedParameter<bool>("process_seg", true)){ // DDU + Segment
190  bookHistos(ibooker, dtChId,"Segment","DDU_HitstkvsQualtrig"+(*trigSrcIt));
191  bookHistos(ibooker, dtChId,"Segment","DDU_TrackPosvsAngle"+(*trigSrcIt));
192  bookHistos(ibooker, dtChId,"Segment","DDU_TrackPosvsAngleandTrig"+(*trigSrcIt));
193  bookHistos(ibooker, dtChId,"Segment","DDU_TrackPosvsAngleandTrigHHHL"+(*trigSrcIt));
194  if(stat!=4){
195  bookHistos(ibooker, dtChId,"Segment","DDU_TrackThetaPosvsAngle"+(*trigSrcIt)); // theta view
196  bookHistos(ibooker, dtChId,"Segment","DDU_TrackThetaPosvsAngleandTrig"+(*trigSrcIt));
197  bookHistos(ibooker, dtChId,"Segment","DDU_TrackThetaPosvsAngleandTrigH"+(*trigSrcIt));
198  }
199  }
200 
201  }
202 
203  if (parameters.getUntrackedParameter<bool>("process_tm", true) &&
204  parameters.getUntrackedParameter<bool>("process_ddu", true)){ // TM+DDU data
205  bookHistos(ibooker, dtChId,"LocalTriggerPhiIn","COM_QualDDUvsQualTM"+(*trigSrcIt));
206  }
207 
208  }
209  }
210  for (int sect=13;sect<15;++sect){
211  DTChamberId dtChId(wh,4,sect);
212  if (parameters.getUntrackedParameter<bool>("process_tm", true) &&
213  parameters.getUntrackedParameter<bool>("process_seg", true)){ // TM+SEG LUTs data
214  bookHistos(ibooker, dtChId,"Segment","TM_PhitkvsPhitrig"+(*trigSrcIt));
215  bookHistos(ibooker, dtChId,"Segment","TM_PhibtkvsPhibtrig"+(*trigSrcIt));
216  bookHistos(ibooker, dtChId,"Segment","TM_PhiResidual"+(*trigSrcIt));
217  bookHistos(ibooker, dtChId,"Segment","TM_PhiResidualvsLUTPhi"+(*trigSrcIt));
218  bookHistos(ibooker, dtChId,"Segment","TM_PhibResidual"+(*trigSrcIt));
219  }
220  }
221  }
222  }// end of loop
223  }
224 
225  }
226 
227 
228 }
#define LogTrace(id)
void bookHistos(DQMStore::IBooker &, const DTChamberId &dtCh, std::string folder, std::string histoTag)
void bookWheelHistos(DQMStore::IBooker &, int wh, std::string histoTag)
Book the histograms.
void bookBarrelHistos(DQMStore::IBooker &, std::string histoTag)
Book the histograms.
void DTLocalTriggerTask::bookHistos ( DQMStore::IBooker ,
const DTChamberId dtCh,
std::string  folder,
std::string  histoTag 
)
protected

Definition at line 319 of file DTLocalTriggerTask.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), digiHistos, printsummarytable::folder, fftjetimagerecorder_cfi::histoLabel, createfilelist::int, LogTrace, SiStripPI::max, simTrackMatching_cfi::maxBX, min(), simTrackMatching_cfi::minBX, pileupCalc::nbins, DTTrigGeomUtils::phiRange(), DetId::rawId(), mathSSE::return(), SimDataFormats::CaloAnalysis::sc, DTChamberId::sector(), DQMStore::IBooker::setCurrentFolder(), setQLabels(), setQLabelsTheta(), DTChamberId::station(), relativeConstraints::station, DTTrigGeomUtils::thetaRange(), topFolder(), trigGeomUtils, DTChamberId::wheel(), and makeMuonMisalignmentScenario::wheel.

Referenced by bookHistograms().

319  {
320 
321  int wh=dtCh.wheel();
322  int sc=dtCh.sector();
323  stringstream wheel; wheel << wh;
324  stringstream station; station << dtCh.station();
325  stringstream sector; sector << sc;
326 
327  double minBX=0;
328  double maxBX=0;
329  int rangeBX=0;
330 
331  string histoType = histoTag.substr(3,histoTag.find("_",3)-3);
332  bool isTM = histoTag.substr(0,2) == "TM";
333 
334  ibooker.setCurrentFolder(topFolder(isTM) + "Wheel" + wheel.str() +
335  "/Sector" + sector.str() +
336  "/Station" + station.str() + "/" + folder);
337 
338  string histoName = histoTag + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
339 
340  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: booking " << topFolder(isTM) << "Wheel" << wheel.str()
341  << "/Sector" << sector.str()
342  << "/Station"<< station.str() << "/" << folder << "/" << histoName << endl;
343 
344  if (histoType.find("BX") != string::npos){
345  if (histoTag.substr(0,2) == "TM"){
346  minBX= parameters.getUntrackedParameter<int>("minBXTM",-2) - 0.5;
347  maxBX= parameters.getUntrackedParameter<int>("maxBXTM",2) + 0.5;
348  }
349  else {
350  minBX= parameters.getUntrackedParameter<int>("minBXDDU",0) - 0.5;
351  maxBX= parameters.getUntrackedParameter<int>("maxBXDDU",20) + 0.5;
352  }
353  rangeBX = (int)(maxBX-minBX);
354  }
355 
356  if ( folder == "LocalTriggerPhiIn") {
357 
358  if( histoType == "BXvsQual" ){
359  (digiHistos[dtCh.rawId()])[histoTag] =
360  ibooker.book2D(histoName,"BX vs trigger quality",7,-0.5,6.5,rangeBX,minBX,maxBX);
361  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
362  return ;
363  }
364  if( histoType == "BestQual" ){
365  (digiHistos[dtCh.rawId()])[histoTag] =
366  ibooker.book1D(histoName,"Trigger quality of best primitives",7,-0.5,6.5);
367  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
368  return ;
369  }
370  if( histoType == "QualvsPhirad" ){
371  (digiHistos[dtCh.rawId()])[histoTag] =
372  ibooker.book2D(histoName,"Trigger quality vs local position",100,-500.,500.,7,-0.5,6.5);
373  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
374  return ;
375  }
376  if( histoType == "QualvsPhibend" ) {
377  (digiHistos[dtCh.rawId()])[histoTag] =
378  ibooker.book2D(histoName,"Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
379  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
380  return ;
381  }
382  if( histoType == "Flag1stvsQual" ) {
383  (digiHistos[dtCh.rawId()])[histoTag] =
384  ibooker.book2D(histoName,"1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
385  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
386  return ;
387  }
388  if( histoType == "FlagUpDownvsQual" ) {
389  (digiHistos[dtCh.rawId()])[histoTag] =
390  ibooker.book2D(histoName,"Up/Down trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
391  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
392  return ;
393  }
394 
395  if( histoType == "QualDDUvsQualTM" ){
396  (digiHistos[dtCh.rawId()])[histoTag] =
397  ibooker.book2D(histoName,"DDU quality vs TM quality",8,-1.5,6.5,8,-1.5,6.5);
398  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
399  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
400  return ;
401  }
402 
403  }
404  else if ( folder == "LocalTriggerTheta") {
405 
406  if( histoType == "PositionvsBX" ) {
407  (digiHistos[dtCh.rawId()])[histoTag] =
408  ibooker.book2D(histoName,"Theta trigger position vs BX",rangeBX,minBX,maxBX,7,-0.5,6.5);
409  return ;
410  }
411  if( histoType == "PositionvsQual" ) {
412  (digiHistos[dtCh.rawId()])[histoTag] =
413  ibooker.book2D(histoName,"Theta trigger position vs quality",2,0.5,2.5,7,-0.5,6.5);
414  setQLabelsTheta((digiHistos[dtCh.rawId()])[histoTag],1);
415  return ;
416  }
417  if( histoType == "ThetaBXvsQual" ) {
418  (digiHistos[dtCh.rawId()])[histoTag] =
419  ibooker.book2D(histoName,"BX vs trigger quality",2,0.5,2.5,rangeBX,minBX,maxBX);
420  setQLabelsTheta((digiHistos[dtCh.rawId()])[histoTag],1);
421  }
422  if( histoType == "ThetaBestQual" ){ //It does not make sense: 7 positions, how to define best?
423  (digiHistos[dtCh.rawId()])[histoTag] =
424  ibooker.book1D(histoName,"Trigger quality of best primitives (theta)",2,0.5,2.5); // 0 = not fired, 1 = L, 2 = H
425  setQLabelsTheta((digiHistos[dtCh.rawId()])[histoTag],1);
426  return ;
427  }
428 
429  }
430  else if ( folder == "Segment") {
431 
432  if( histoType.find("TrackThetaPosvsAngle" ) == 0 ) {
433 
434  string histoLabel = "Position vs Angle (theta)";
435  if (histoType.find("andTrigH") != string::npos) histoLabel += " for H triggers";
436  else if (histoType.find("andTrig") != string::npos) histoLabel += " for triggers";
437 
438  float min,max;
439  int nbins;
440  trigGeomUtils->thetaRange(dtCh,min,max,nbins);
441  (digiHistos[dtCh.rawId()])[histoTag] =
442  ibooker.book2D(histoName,histoLabel,16,-40.,40.,nbins,min,max);
443  return ;
444  }
445  if( histoType.find("TrackPosvsAngle") == 0 ){
446 
447  float min,max;
448  int nbins;
449  trigGeomUtils->phiRange(dtCh,min,max,nbins);
450 
451  string histoLabel = "Position vs Angle (phi)";
452  if (histoType.find("andTrigHHHL") != string::npos) histoLabel += " for HH/HL triggers";
453  else if (histoType.find("andTrig") != string::npos) histoLabel += " for triggers";
454 
455  (digiHistos[dtCh.rawId()])[histoTag] =
456  ibooker.book2D(histoName,histoLabel,16,-40.,40.,nbins,min,max);
457  return ;
458  }
459  if( histoType == "PhitkvsPhitrig" ){
460  (digiHistos[dtCh.rawId()])[histoTag] =
461  ibooker.book2D(histoName,"Local position: segment vs trigger",100,-500.,500.,100,-500.,500.);
462  return ;
463  }
464  if( histoType == "PhibtkvsPhibtrig" ){
465  (digiHistos[dtCh.rawId()])[histoTag] =
466  ibooker.book2D(histoName,"Local direction : segment vs trigger",200,-40.,40.,200,-40.,40.);
467  return ;
468  }
469  if( histoType == "PhiResidual" ){
470  (digiHistos[dtCh.rawId()])[histoTag] =
471  ibooker.book1D(histoName,"Trigger local position - Segment local position (correlated triggers)",400,-10.,10.);
472  return ;
473  }
474  if( histoType == "PhibResidual" ){
475  (digiHistos[dtCh.rawId()])[histoTag] =
476  ibooker.book1D(histoName,"Trigger local direction - Segment local direction (correlated triggers)",500,-10.,10.);
477  return ;
478  }
479  if( histoType == "HitstkvsQualtrig" ){
480  (digiHistos[dtCh.rawId()])[histoTag] =
481  ibooker.book2D(histoName,"Segment hits (phi) vs trigger quality",7,-0.5,6.5,10,0.5,10.5);
482  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
483  return ;
484  }
485 
486  }
487 
488 }
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
void setQLabelsTheta(MonitorElement *me, short int iaxis)
std::string & topFolder(bool isTM)
Get the Top folder (different between Physics and TP and TM/DDU)
return((rh^lh)&mask)
T min(T a, T b)
Definition: MathUtil.h:58
#define LogTrace(id)
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
DTTrigGeomUtils * trigGeomUtils
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
void DTLocalTriggerTask::bookWheelHistos ( DQMStore::IBooker ,
int  wh,
std::string  histoTag 
)
protected

Book the histograms.

Definition at line 490 of file DTLocalTriggerTask.cc.

References DQMStore::IBooker::bookProfile2D(), LogTrace, mathSSE::return(), MonitorElement::setAxisTitle(), DQMStore::IBooker::setCurrentFolder(), topFolder(), makeMuonMisalignmentScenario::wheel, and wheelHistos.

Referenced by bookHistograms().

490  {
491 
492  stringstream wheel; wheel << wh;
493 
494  string histoType = histoTag.substr(3,histoTag.find("_",3)-3);
495  bool isTM = histoTag.substr(0,2) == "TM";
496 
497  ibooker.setCurrentFolder(topFolder(isTM) + "Wheel" + wheel.str() + "/");
498 
499  string histoName = histoTag + "_W" + wheel.str();
500 
501  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: booking " << topFolder(isTM)
502  << "Wheel" << wheel.str() << "/" << histoName << endl;
503 
504  if( histoType.find("BXDiff") != string::npos ){
505  MonitorElement *me = ibooker.bookProfile2D(histoName,"DDU-TM BX Difference",12,1,13,4,1,5,0.,20.);
506  me->setAxisTitle("Sector",1);
507  me->setAxisTitle("station",2);
508  (wheelHistos[wh])[histoTag] = me;
509  return ;
510  }
511 
512 }
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
std::string & topFolder(bool isTM)
Get the Top folder (different between Physics and TP and TM/DDU)
return((rh^lh)&mask)
#define LogTrace(id)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void DTLocalTriggerTask::dqmBeginRun ( const edm::Run run,
const edm::EventSetup context 
)
overrideprotected

Beginrun.

Definition at line 80 of file DTLocalTriggerTask.cc.

References edm::EventSetup::get(), muonGeom, nevents, and trigGeomUtils.

80  {
81 
82  nevents = 0;
83  context.get<MuonGeometryRecord>().get(muonGeom);
85 
86 }
edm::ESHandle< DTGeometry > muonGeom
DTTrigGeomUtils * trigGeomUtils
T get() const
Definition: EventSetup.h:71
void DTLocalTriggerTask::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
inlinefinalprotected

Definition at line 102 of file DTLocalTriggerTask.h.

References MillePedeFileConverter_cfg::e, and triggerSource().

102 {}
void DTLocalTriggerTask::runDDUAnalysis ( edm::Handle< DTLocalTriggerCollection > &  trigsDDU)
protected

Run analysis on ROS data.

Definition at line 641 of file DTLocalTriggerTask.cc.

References dduphcode_best, dduthcode_best, digiHistos, mps_fire::i, iphbestddu, gen::k, jets_cff::quality, DetId::rawId(), tpMode, trigsrc, and wheelArrayShift.

Referenced by analyze().

641  {
642 
644 
645  for (int i=0;i<5;++i){
646  for (int j=0;j<6;++j){
647  for (int k=0;k<13;++k){
648  dduphcode_best[j][i][k] = -1;
649  dduthcode_best[j][i][k] = -1;
650  }
651  }
652  }
653 
654  for (detUnitIt=trigsDDU->begin();
655  detUnitIt!=trigsDDU->end();
656  ++detUnitIt){
657 
658  const DTChamberId& id = (*detUnitIt).first;
659  const DTLocalTriggerCollection::Range& range = (*detUnitIt).second;
660  uint32_t indexCh = id.rawId();
661  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
662 
663  int wh = id.wheel();
664  int sec = id.sector();
665  int st = id.station();
666 
667  for (DTLocalTriggerCollection::const_iterator trigIt = range.first;
668  trigIt!=range.second;
669  ++trigIt){
670 
671  int bx = trigIt->bx();
672  int quality = trigIt->quality();
673  int thqual = trigIt->trTheta();
674  int flag1st = trigIt->secondTrack() ? 1 : 0;
675 
676  // check if SC data exist: fill for any trigger
677  if( quality>-1 && quality<7 ) { // it is a phi trigger
678 
679  if(quality>dduphcode_best[wh+wheelArrayShift][st][sec]) {
681  iphbestddu[wh+wheelArrayShift][st][sec] = &(*trigIt);
682  }
683 
684  if(tpMode) {
685  innerME.find("DDU_BXvsQual"+trigsrc)->second->Fill(quality,bx-flag1st); // SM BX vs Qual Phi view
686  }
687  else {
688  innerME.find("DDU_BXvsQual"+trigsrc)->second->Fill(quality,bx-flag1st); // SM BX vs Qual Phi view
689  innerME.find("DDU_Flag1stvsQual"+trigsrc)->second->Fill(quality,flag1st); // SM Quality vs 1st/2nd track flag Phi view
690  }
691  }
692  if( thqual>0 && !tpMode ) { // it is a theta trigger
693 
694  if(thqual>dduthcode_best[wh+wheelArrayShift][st][sec] ) {
695  dduthcode_best[wh+wheelArrayShift][st][sec]=thqual;
696  }
697 
698  innerME.find("DDU_ThetaBXvsQual"+trigsrc)->second->Fill(thqual,bx); // SM BX vs Qual Theta view
699  }
700  }
701 
702  // Fill Quality plots with best ddu triggers in phi & theta
703  if (!tpMode) {
704  if (dduphcode_best[wh+wheelArrayShift][st][sec]>-1 &&
705  dduphcode_best[wh+wheelArrayShift][st][sec]<7){
706 
707  innerME.find("DDU_BestQual"+trigsrc)->second->Fill(dduphcode_best[wh+wheelArrayShift][st][sec]); // Best Qual Trigger Phi view
708  }
709  if (dduthcode_best[wh+wheelArrayShift][st][sec]>0){
710  innerME.find("DDU_ThetaBestQual"+trigsrc)->second->Fill(dduthcode_best[wh+wheelArrayShift][st][sec]); // Best Qual Trigger Theta view
711  }
712  }
713  }
714 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
DTArr3LocalTrigger iphbestddu
int k[5][pyjets_maxn]
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
void DTLocalTriggerTask::runDDUvsTMAnalysis ( std::string &  trigsrc)
protected

Run analysis on ROS data.

Definition at line 899 of file DTLocalTriggerTask.cc.

References dduphcode_best, digiHistos, spr::find(), triggerObjects_cff::id, iphbest, iphbestddu, phcode_best, SimDataFormats::CaloAnalysis::sc, wheelArrayShift, and wheelHistos.

Referenced by analyze().

899  {
900 
901  string histoType ;
902  string histoTag ;
903 
904  for (int st=1;st<5;++st){
905  for (int wh=-2;wh<3;++wh){
906  for (int sc=1;sc<13;++sc){
907  if ( (phcode_best[wh+wheelArrayShift][st][sc]>-1 && phcode_best[wh+wheelArrayShift][st][sc]<7) ||
908  (dduphcode_best[wh+wheelArrayShift][st][sc]>-1 && dduphcode_best[wh+wheelArrayShift][st][sc]<7) ){
909  DTChamberId id(wh,st,sc);
910  uint32_t indexCh = id.rawId();
911  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
912 
913  innerME.find("COM_QualDDUvsQualTM"+trigsrc)->second->Fill(phcode_best[wh+wheelArrayShift][st][sc],dduphcode_best[wh+wheelArrayShift][st][sc]);
914  if ( (phcode_best[wh+wheelArrayShift][st][sc]>-1 && phcode_best[wh+wheelArrayShift][st][sc]<7) &&
915  (dduphcode_best[wh+wheelArrayShift][st][sc]>-1 && dduphcode_best[wh+wheelArrayShift][st][sc]<7) ){
916  int bxDDU = iphbestddu[wh+wheelArrayShift][st][sc]->bx() - iphbestddu[wh+wheelArrayShift][st][sc]->secondTrack();
917  int bxTM = iphbest[wh+wheelArrayShift][st][sc]->bxNum() - iphbest[wh+wheelArrayShift][st][sc]->Ts2Tag();
918  (wheelHistos[wh]).find("COM_BXDiff"+trigsrc)->second->Fill(sc,st,bxDDU-bxTM);
919  }
920  }
921  }
922  }
923  }
924 
925 }
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
DTArr3LocalTrigger iphbestddu
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
void DTLocalTriggerTask::runSegmentAnalysis ( edm::Handle< DTRecSegment4DCollection > &  segments4D)
protected

Run analysis using DT 4D segments.

Definition at line 717 of file DTLocalTriggerTask.cc.

References DTTrigGeomUtils::computeSCCoordinates(), dduphcode_best, dduthcode_best, digiHistos, iphbest, phcode_best, DetId::rawId(), relativeConstraints::station, thcode_best, HiIsolationCommonParameters_cff::track, track_ok, DTTrigGeomUtils::trigDir(), trigGeomUtils, DTTrigGeomUtils::trigPos(), trigsrc, DTTrigGeomUtils::trigToSeg(), useDDU, useTM, and makeMuonMisalignmentScenario::wheel.

Referenced by analyze().

717  {
718 
720 
721  // Find best tracks & good tracks
722  memset(track_ok,false,450*sizeof(bool));
723 
725  vector<const DTRecSegment4D*> best4DSegments;
726 
727  // Preliminary loop finds best 4D Segment and high quality ones
728  for (chamberId = segments4D->id_begin(); chamberId != segments4D->id_end(); ++chamberId){
729 
730  DTRecSegment4DCollection::range range = segments4D->get(*chamberId);
731  const DTRecSegment4D* tmpBest=nullptr;
732  int tmpdof = 0;
733  int dof = 0;
734 
735  for ( track = range.first; track != range.second; ++track){
736 
737  if( (*track).hasPhi() ) {
738 
739  dof = (*track).phiSegment()->degreesOfFreedom();
740  if ( dof>tmpdof ){
741  tmpBest = &(*track);
742  tmpdof = dof;
743 
744  int wheel = (*track).chamberId().wheel();
745  int sector = (*track).chamberId().sector();
746  int station = (*track).chamberId().station();
747  if (sector==13){
748  sector=4;
749  }
750  else if (sector==14){
751  sector=10;
752  }
753  track_ok[wheel+3][station][sector] = (!track_ok[wheel+3][station][sector] && dof>=2);
754  }
755 
756  }
757  }
758  if (tmpBest) best4DSegments.push_back(tmpBest);
759  }
760 
761  vector<const DTRecSegment4D*>::const_iterator btrack;
762 
763  for ( btrack = best4DSegments.begin(); btrack != best4DSegments.end(); ++btrack ){
764 
765  if( (*btrack)->hasPhi() ) { // Phi component
766 
767  int wheel = (*btrack)->chamberId().wheel();
768  int station = (*btrack)->chamberId().station();
769  int sector = (*btrack)->chamberId().sector();
770  int scsector = 0;
771  float x_track, y_track, x_angle, y_angle;
772  trigGeomUtils->computeSCCoordinates((*btrack),scsector,x_track,x_angle,y_track,y_angle);
773  int nHitsPhi = (*btrack)->phiSegment()->degreesOfFreedom()+2;
774 
775  DTChamberId dtChId(wheel,station,sector); // get chamber for LUTs histograms (Sectors 1 to 14)
776  uint32_t indexCh = dtChId.rawId();
777  map<string, MonitorElement*> &innerMECh = digiHistos[indexCh];
778 
779  DTChamberId dtChIdSC = DTChamberId(wheel,station,scsector); // get chamber for histograms SC granularity (sectors 1 to 12)
780  indexCh = dtChIdSC.rawId();
781  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
782 
783  if (useDDU &&
784  dduphcode_best[wheel+3][station][scsector] > -1 &&
785  dduphcode_best[wheel+3][station][scsector] < 7 ) {
786 
787  // SM hits of the track vs quality of the trigger
788  innerME.find("DDU_HitstkvsQualtrig"+trigsrc)->second->Fill(dduphcode_best[wheel+3][station][scsector],nHitsPhi);
789 
790  }
791 
792  if (useTM &&
793  phcode_best[wheel+3][station][scsector] > -1 &&
794  phcode_best[wheel+3][station][scsector] < 7 ) {
795 
796  innerME.find("TM_HitstkvsQualtrig"+trigsrc)->second->Fill(phcode_best[wheel+3][station][scsector],nHitsPhi);
797 
798  if (phcode_best[wheel+3][station][scsector]>3 && nHitsPhi>=7){
799 
800  float x_trigger = trigGeomUtils->trigPos(iphbest[wheel+3][station][scsector]);
801  float angle_trigger = trigGeomUtils->trigDir(iphbest[wheel+3][station][scsector]);
802  trigGeomUtils->trigToSeg(station,x_trigger,x_angle);
803 
804  innerMECh.find("TM_PhitkvsPhitrig"+trigsrc)->second->Fill(x_trigger,x_track);
805  innerMECh.find("TM_PhibtkvsPhibtrig"+trigsrc)->second->Fill(angle_trigger,x_angle);
806  innerMECh.find("TM_PhiResidual"+trigsrc)->second->Fill(x_trigger-x_track);
807  innerMECh.find("TM_PhibResidual"+trigsrc)->second->Fill(angle_trigger-x_angle);
808  }
809  }
810 
811 
812  if (useTM) {
813 
814  // check for triggers elsewhere in the sector
815  bool trigFlagTM =false;
816  for (int ist=1; ist<5; ist++){
817  if (ist!=station &&
818  phcode_best[wheel+3][ist][scsector]>=2 &&
819  phcode_best[wheel+3][ist][scsector]<7 &&
820  track_ok[wheel+3][ist][scsector]==true){
821  trigFlagTM = true;
822  break;
823  }
824  }
825 
826  if (trigFlagTM && fabs(x_angle)<40. && nHitsPhi>=7){
827 
828  // position vs angle of track for reconstruced tracks (denom. for trigger efficiency)
829  innerME.find("TM_TrackPosvsAngle"+trigsrc)->second->Fill(x_angle,x_track);
830  if (phcode_best[wheel+3][station][scsector] >= 2 && phcode_best[wheel+3][station][scsector] < 7) {
831  innerME.find("TM_TrackPosvsAngleandTrig"+trigsrc)->second->Fill(x_angle,x_track);
832  if (phcode_best[wheel+3][station][scsector] > 4){ //HH & HL Triggers
833  innerME.find("TM_TrackPosvsAngleandTrigHHHL"+trigsrc)->second->Fill(x_angle,x_track);
834  }
835  }
836 
837  }
838 
839  if ((*btrack)->hasZed() && trigFlagTM && fabs(y_angle)<40. && (*btrack)->zSegment()->degreesOfFreedom()>=1){
840 
841  // position va angle of track for reconstruced tracks (denom. for trigger efficiency) along theta direction
842  innerME.find("TM_TrackThetaPosvsAngle"+trigsrc)->second->Fill(y_angle,y_track);
843  if (thcode_best[wheel+3][station][scsector] > 0) {
844  innerME.find("TM_TrackThetaPosvsAngleandTrig"+trigsrc)->second->Fill(y_angle,y_track);
845  if (thcode_best[wheel+3][station][scsector] == 2) {
846  innerME.find("TM_TrackThetaPosvsAngleandTrigH"+trigsrc)->second->Fill(y_angle,y_track);
847  }
848  }
849 
850  }
851  }
852 
853  if (useDDU) {
854 
855  // check for triggers elsewhere in the sector
856  bool trigFlagDDU =false;
857  for (int ist=1; ist<5; ist++){
858  if (ist!=station &&
859  dduphcode_best[wheel+3][ist][scsector]>=2 &&
860  dduphcode_best[wheel+3][ist][scsector]<7 &&
861  track_ok[wheel+3][ist][scsector]==true){
862  trigFlagDDU = true;
863  break;
864  }
865  }
866 
867  if (trigFlagDDU && fabs(x_angle)<40. && nHitsPhi>=7){
868 
869  // position vs angle of track for reconstruced tracks (denom. for trigger efficiency)
870  innerME.find("DDU_TrackPosvsAngle"+trigsrc)->second->Fill(x_angle,x_track);
871  if (dduphcode_best[wheel+3][station][scsector] >= 2 && dduphcode_best[wheel+3][station][scsector] < 7) {
872  innerME.find("DDU_TrackPosvsAngleandTrig"+trigsrc)->second->Fill(x_angle,x_track);
873  if (dduphcode_best[wheel+3][station][scsector] > 4){ //HH & HL Triggers
874  innerME.find("DDU_TrackPosvsAngleandTrigHHHL"+trigsrc)->second->Fill(x_angle,x_track);
875  }
876  }
877 
878  }
879 
880  if ((*btrack)->hasZed() && trigFlagDDU && fabs(y_angle)<40. && (*btrack)->zSegment()->degreesOfFreedom()>=1){
881 
882  // position va angle of track for reconstruced tracks (denom. for trigger efficiency) along theta direction
883  innerME.find("DDU_TrackThetaPosvsAngle"+trigsrc)->second->Fill(y_angle,y_track);
884  if (dduthcode_best[wheel+3][station][scsector] > 0) {
885  innerME.find("DDU_TrackThetaPosvsAngleandTrig"+trigsrc)->second->Fill(y_angle,y_track);
886  if (dduthcode_best[wheel+3][station][scsector] == 3) {
887  innerME.find("DDU_TrackThetaPosvsAngleandTrigH"+trigsrc)->second->Fill(y_angle,y_track);
888  }
889  }
890 
891  }
892  }
893  }
894  }
895 
896 }
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
identifier iterator
Definition: RangeMap.h:135
bool track_ok[6][5][15]
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
void trigToSeg(int st, float &x, float dir)
Compute Trigger x coordinate in chamber RF.
DTTrigGeomUtils * trigGeomUtils
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
void computeSCCoordinates(const DTRecSegment4D *track, int &scsec, float &x, float &xdir, float &y, float &ydir)
Compute track coordinates with SC sector numbering.
void DTLocalTriggerTask::runTMAnalysis ( std::vector< L1MuDTChambPhDigi > const *  phTrigs,
std::vector< L1MuDTChambThDigi > const *  thTrigs 
)
protected

Run analysis on TM data.

Definition at line 514 of file DTLocalTriggerTask.cc.

References angle(), detailedAnalysis, digiHistos, doTMTheta, MonitorElement::Fill(), mps_fire::i, triggerObjects_cff::id, iphbest, ithbest, gen::k, phcode_best, DetId::rawId(), SimDataFormats::CaloAnalysis::sc, thcode_best, tm_IDDataErrorPlot, tpMode, DTTrigGeomUtils::trigDir(), trigGeomUtils, DTTrigGeomUtils::trigPos(), trigsrc, wheelArrayShift, and x.

Referenced by analyze().

515  {
516 
517  //exit(0);
518 
519  string histoType ;
520  string histoTag ;
521 
522 
523  // define best quality trigger segment (phi and theta)
524  // in any station start from 1 and zero is kept empty
525  for (int i=0;i<5;++i){
526  for (int j=0;j<6;++j){
527  for (int k=0;k<13;++k){
528  phcode_best[j][i][k] = -1;
529  thcode_best[j][i][k] = -1;
530  }
531  }
532  }
533 
534  vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
535  vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
536  for(; iph !=iphe ; ++iph) {
537 
538  int phwheel = iph->whNum();
539  int phsec = iph->scNum() + 1; // SM The track finder goes from 0 to 11. I need them from 1 to 12 !!!!!
540  int phst = iph->stNum();
541  int phbx = iph->bxNum();
542  int phcode = iph->code();
543  int phi1st = iph->Ts2Tag();
544  int updown = iph->UpDownTag();
545 
546  // FIXME: workaround for TM data with station ID
547  if(phst == 0) {
548  tm_IDDataErrorPlot->Fill(phwheel);
549  continue;
550  }
551 
552  if(phcode>phcode_best[phwheel+3][phst][phsec] && phcode<7) {
553  phcode_best[phwheel+3][phst][phsec]=phcode;
554  iphbest[phwheel+3][phst][phsec] = &(*iph);
555  }
556 
557  DTChamberId dtChId(phwheel,phst,phsec);
558 
559  float x = trigGeomUtils->trigPos(&(*iph));
560  float angle = trigGeomUtils->trigDir(&(*iph));
561  uint32_t indexCh = dtChId.rawId();
562 
563  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
564 
565  if (tpMode) {
566  innerME.find("TM_BXvsQual"+trigsrc)->second->Fill(phcode,phbx-phi1st); // SM BX vs Qual Phi view (1st tracks)
567  innerME.find("TM_QualvsPhirad"+trigsrc)->second->Fill(x,phcode); // SM Qual vs radial angle Phi view
568  }
569  else {
570  innerME.find("TM_BXvsQual_In"+trigsrc)->second->Fill(phcode,phbx-phi1st); // SM BX vs Qual Phi view (1st tracks)
571  innerME.find("TM_Flag1stvsQual_In"+trigsrc)->second->Fill(phcode,phi1st); // SM Qual 1st/2nd track flag Phi view
572  innerME.find("TM_FlagUpDownvsQual_In"+trigsrc)->second->Fill(phcode,updown); // SM Qual Up/Down track flag Phi view
573  if (detailedAnalysis) {
574  innerME.find("TM_QualvsPhirad_In"+trigsrc)->second->Fill(x,phcode); // SM Qual vs radial angle Phi view
575  innerME.find("TM_QualvsPhibend_In"+trigsrc)->second->Fill(angle,phcode); // SM Qual vs bending Phi view
576  }
577  }
578 
579  }
580 
581  if (doTMTheta) {
582  int thcode[7];
583  vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
584  vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
585  for(; ith != ithe; ++ith) {
586  int thwheel = ith->whNum();
587  int thsec = ith->scNum() + 1; // SM The track finder goes from 0 to 11. I need them from 1 to 12 !!!!!
588  int thst = ith->stNum();
589  int thbx = ith->bxNum();
590 
591  for (int pos=0; pos<7; pos++) {
592  thcode[pos] = ith->code(pos);
593 
594  if(thcode[pos]>thcode_best[thwheel+3][thst][thsec] ) {
595  thcode_best[thwheel+3][thst][thsec]=thcode[pos];
596  ithbest[thwheel+3][thst][thsec] = &(*ith);
597  }
598  }
599 
600  DTChamberId dtChId(thwheel,thst,thsec);
601  uint32_t indexCh = dtChId.rawId();
602 
603  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
604 
605  for (int pos=0; pos<7; pos++) { //SM fill position for non zero position bit in theta view
606  if(thcode[pos]>0){ //Fired
607  innerME.find("TM_PositionvsBX"+trigsrc)->second->Fill(thbx,pos); // SM BX vs Position Theta view
608  innerME.find("TM_PositionvsQual"+trigsrc)->second->Fill(thcode[pos],pos); //code = pos + qual; so 0, 1, 2 for 0, L, H resp.
609  innerME.find("TM_ThetaBXvsQual"+trigsrc)->second->Fill(thcode[pos],thbx); //code = pos + qual; so 0, 1, 2 for 0, L, H resp.
610  }
611  }
612  }
613  }
614 
615 
616  // Fill Quality plots with best TM triggers in phi & theta
617  if (!tpMode) {
618  for (int st=1;st<5;++st){
619  for (int wh=-2;wh<3;++wh){
620  for (int sc=1;sc<13;++sc){
621  if (phcode_best[wh+wheelArrayShift][st][sc]>-1 && phcode_best[wh+wheelArrayShift][st][sc]<7){
622  DTChamberId id(wh,st,sc);
623  uint32_t indexCh = id.rawId();
624  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
625 
626  innerME.find("TM_BestQual_In"+trigsrc)->second->Fill(phcode_best[wh+wheelArrayShift][st][sc]); // Best Qual Trigger Phi view
627  }
628  if (thcode_best[wh+wheelArrayShift][st][sc]>0 && thcode_best[wh+wheelArrayShift][st][sc]<3){
629  DTChamberId id(wh,st,sc);
630  uint32_t indexCh = id.rawId();
631  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
632 
633  innerME.find("TM_ThetaBestQual"+trigsrc)->second->Fill(thcode_best[wh+wheelArrayShift][st][sc]); // Best Qual Trigger Theta view
634  }
635  }
636  }
637  }
638  }
639 }
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
MonitorElement * tm_IDDataErrorPlot
void Fill(long long x)
int k[5][pyjets_maxn]
DTTrigGeomUtils * trigGeomUtils
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
std::map< uint32_t, std::map< std::string, MonitorElement * > > digiHistos
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void DTLocalTriggerTask::setQLabels ( MonitorElement me,
short int  iaxis 
)
protected

Set Quality labels.

Definition at line 927 of file DTLocalTriggerTask.cc.

References MonitorElement::getTH1(), trackerHits::histo, mps_fire::i, and tablePrinter::labels.

Referenced by bookHistos().

927  {
928 
929  TH1* histo = me->getTH1();
930  if (!histo) return;
931 
932  TAxis* axis=nullptr;
933  if (iaxis==1) {
934  axis=histo->GetXaxis();
935  }
936  else if(iaxis==2) {
937  axis=histo->GetYaxis();
938  }
939  if (!axis) return;
940 
941  string labels[7] = {"LI","LO","HI","HO","LL","HL","HH"};
942  int istart = axis->GetXmin()<-1 ? 2 : 1;
943  for (int i=0;i<7;i++) {
944  axis->SetBinLabel(i+istart,labels[i].c_str());
945  }
946 
947 }
TH1 * getTH1() const
void DTLocalTriggerTask::setQLabelsTheta ( MonitorElement me,
short int  iaxis 
)
protected

Definition at line 949 of file DTLocalTriggerTask.cc.

References MonitorElement::getTH1(), trackerHits::histo, mps_fire::i, and tablePrinter::labels.

Referenced by bookHistos().

949  {
950 
951  TH1* histo = me->getTH1();
952  if (!histo) return;
953 
954  TAxis* axis=nullptr;
955  if (iaxis==1) {
956  axis=histo->GetXaxis();
957  }
958  else if(iaxis==2) {
959  axis=histo->GetYaxis();
960  }
961  if (!axis) return;
962 
963  string labels[2] = {"L","H"};
964  int istart = axis->GetXmin()<-1 ? 2 : 1;
965  for (int i=0;i<2;i++) {
966  axis->SetBinLabel(i+istart,labels[i].c_str());
967  }
968 
969 }
TH1 * getTH1() const
std::string& DTLocalTriggerTask::topFolder ( bool  isTM)
inlineprotected

Get the Top folder (different between Physics and TP and TM/DDU)

Definition at line 108 of file DTLocalTriggerTask.h.

References baseFolderDDU, and baseFolderTM.

Referenced by bookBarrelHistos(), bookHistos(), and bookWheelHistos().

108 { return isTM ? baseFolderTM : baseFolderDDU; }
void DTLocalTriggerTask::triggerSource ( const edm::Event e)
protected

Get the L1A source.

Definition at line 973 of file DTLocalTriggerTask.cc.

References edm::Event::getByToken(), mps_fire::i, isLocalRun, ltcDigiCollectionToken_, and trigsrc.

Referenced by analyze(), and endLuminosityBlock().

973  {
974 
975 
976  if (!isLocalRun){
977 
978  Handle<LTCDigiCollection> ltcdigis;
979  e.getByToken(ltcDigiCollectionToken_, ltcdigis);
980 
981  for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
982 
983  size_t otherTriggerSum=0;
984  for (size_t i = 1; i < 6; i++) {
985  otherTriggerSum += size_t((*ltc_it).HasTriggered(i));
986  }
987  if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
988  trigsrc = "_DTonly";
989  else if (!(*ltc_it).HasTriggered(0))
990  trigsrc = "_NoDT";
991  else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
992  trigsrc = "_DTalso";
993 
994  }
995  return;
996  }
997 
998  trigsrc = "";
999  return;
1000 
1001 }
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517

Friends And Related Function Documentation

friend class DTMonitorModule
friend

Definition at line 55 of file DTLocalTriggerTask.h.

Member Data Documentation

std::string DTLocalTriggerTask::baseFolderDDU
private

Definition at line 125 of file DTLocalTriggerTask.h.

Referenced by DTLocalTriggerTask(), and topFolder().

std::string DTLocalTriggerTask::baseFolderTM
private

Definition at line 124 of file DTLocalTriggerTask.h.

Referenced by DTLocalTriggerTask(), and topFolder().

DTArr3int DTLocalTriggerTask::dduphcode_best
private

Definition at line 131 of file DTLocalTriggerTask.h.

Referenced by runDDUAnalysis(), runDDUvsTMAnalysis(), and runSegmentAnalysis().

DTArr3int DTLocalTriggerTask::dduthcode_best
private

Definition at line 133 of file DTLocalTriggerTask.h.

Referenced by runDDUAnalysis(), and runSegmentAnalysis().

bool DTLocalTriggerTask::detailedAnalysis
private

Definition at line 127 of file DTLocalTriggerTask.h.

Referenced by bookHistograms(), DTLocalTriggerTask(), and runTMAnalysis().

std::map<uint32_t, std::map<std::string, MonitorElement*> > DTLocalTriggerTask::digiHistos
private
bool DTLocalTriggerTask::doTMTheta
private

Definition at line 126 of file DTLocalTriggerTask.h.

Referenced by bookHistograms(), DTLocalTriggerTask(), and runTMAnalysis().

DTArr3PhDigi DTLocalTriggerTask::iphbest
private

Definition at line 135 of file DTLocalTriggerTask.h.

Referenced by runDDUvsTMAnalysis(), runSegmentAnalysis(), and runTMAnalysis().

DTArr3LocalTrigger DTLocalTriggerTask::iphbestddu
private

Definition at line 136 of file DTLocalTriggerTask.h.

Referenced by runDDUAnalysis(), and runDDUvsTMAnalysis().

bool DTLocalTriggerTask::isLocalRun
private

Definition at line 148 of file DTLocalTriggerTask.h.

Referenced by DTLocalTriggerTask(), and triggerSource().

DTArr3ThDigi DTLocalTriggerTask::ithbest
private

Definition at line 137 of file DTLocalTriggerTask.h.

Referenced by runTMAnalysis().

edm::EDGetTokenT<LTCDigiCollection> DTLocalTriggerTask::ltcDigiCollectionToken_
private

Definition at line 118 of file DTLocalTriggerTask.h.

Referenced by DTLocalTriggerTask(), and triggerSource().

DTArr3mapInt DTLocalTriggerTask::mapDTTF
private

Definition at line 134 of file DTLocalTriggerTask.h.

edm::ESHandle<DTGeometry> DTLocalTriggerTask::muonGeom
private

Definition at line 141 of file DTLocalTriggerTask.h.

Referenced by dqmBeginRun().

int DTLocalTriggerTask::nevents
private

Definition at line 122 of file DTLocalTriggerTask.h.

Referenced by analyze(), dqmBeginRun(), and ~DTLocalTriggerTask().

edm::ParameterSet DTLocalTriggerTask::parameters
private
DTArr3int DTLocalTriggerTask::phcode_best
private

Definition at line 130 of file DTLocalTriggerTask.h.

Referenced by runDDUvsTMAnalysis(), runSegmentAnalysis(), and runTMAnalysis().

edm::EDGetTokenT<DTLocalTriggerCollection> DTLocalTriggerTask::ros_Token_
private

Definition at line 116 of file DTLocalTriggerTask.h.

Referenced by analyze(), and DTLocalTriggerTask().

edm::EDGetTokenT<DTRecSegment4DCollection> DTLocalTriggerTask::seg_Token_
private

Definition at line 117 of file DTLocalTriggerTask.h.

Referenced by analyze(), and DTLocalTriggerTask().

DTArr3int DTLocalTriggerTask::thcode_best
private

Definition at line 132 of file DTLocalTriggerTask.h.

Referenced by runSegmentAnalysis(), and runTMAnalysis().

MonitorElement* DTLocalTriggerTask::tm_IDDataErrorPlot
private

Definition at line 146 of file DTLocalTriggerTask.h.

Referenced by bookBarrelHistos(), and runTMAnalysis().

edm::EDGetTokenT<L1MuDTChambPhContainer> DTLocalTriggerTask::tm_Token_
private

Definition at line 114 of file DTLocalTriggerTask.h.

Referenced by analyze(), and DTLocalTriggerTask().

edm::EDGetTokenT<L1MuDTChambThContainer> DTLocalTriggerTask::tmTh_Token_
private

Definition at line 115 of file DTLocalTriggerTask.h.

Referenced by analyze(), and DTLocalTriggerTask().

bool DTLocalTriggerTask::tpMode
private
bool DTLocalTriggerTask::track_ok[6][5][15]
private

Definition at line 138 of file DTLocalTriggerTask.h.

Referenced by runSegmentAnalysis().

DTTrigGeomUtils* DTLocalTriggerTask::trigGeomUtils
private
std::string DTLocalTriggerTask::trigsrc
private
bool DTLocalTriggerTask::useDDU
private

Definition at line 120 of file DTLocalTriggerTask.h.

Referenced by analyze(), and runSegmentAnalysis().

bool DTLocalTriggerTask::useSEG
private

Definition at line 120 of file DTLocalTriggerTask.h.

Referenced by analyze().

bool DTLocalTriggerTask::useTM
private

Definition at line 120 of file DTLocalTriggerTask.h.

Referenced by analyze(), and runSegmentAnalysis().

const int DTLocalTriggerTask::wheelArrayShift = 3
protected

Definition at line 110 of file DTLocalTriggerTask.h.

Referenced by runDDUAnalysis(), runDDUvsTMAnalysis(), and runTMAnalysis().

std::map<int, std::map<std::string, MonitorElement*> > DTLocalTriggerTask::wheelHistos
private

Definition at line 144 of file DTLocalTriggerTask.h.

Referenced by bookWheelHistos(), and runDDUvsTMAnalysis().