CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTLocalTriggerTask.cc
Go to the documentation of this file.
1 /*
2  * \file DTLocalTriggerTask.cc
3  *
4  * \author M. Zanetti - INFN Padova
5  *
6 */
7 
9 
10 // Framework
12 
13 // DT trigger
15 
16 // Geometry
22 
23 //Root
24 #include"TH1.h"
25 #include"TAxis.h"
26 
27 #include <sstream>
28 #include <iostream>
29 #include <fstream>
30 
31 
32 using namespace edm;
33 using namespace std;
34 
36  trigGeomUtils(0),
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  doDCCTheta = ps.getUntrackedParameter<bool>("enableDCCTheta", false);
49  dcc_Token_ = consumes<L1MuDTChambPhContainer>(
50  edm::InputTag(ps.getUntrackedParameter<string>("dcc_label", "dttpgprod")));
51  ros_Token_ = consumes<DTLocalTriggerCollection>(
52  edm::InputTag(ps.getUntrackedParameter<string>("ros_label", "dtunpacker")));
53  seg_Token_ = consumes<DTRecSegment4DCollection>(
54  edm::InputTag(ps.getUntrackedParameter<string>("seg_label", "dt4DSegments")));
55 
56  if (tpMode) {
57  baseFolderDCC = "DT/11-LocalTriggerTP-DCC/";
58  baseFolderDDU = "DT/12-LocalTriggerTP-DDU/";
59  }
60  else {
61  baseFolderDCC = "DT/03-LocalTrigger-DCC/";
62  baseFolderDDU = "DT/04-LocalTrigger-DDU/";
63  }
64 
65  parameters = ps;
66 
68 
69 }
70 
71 
73 
74  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: analyzed " << nevents << " events" << endl;
75  if (trigGeomUtils) { delete trigGeomUtils; }
76 
77 }
78 
79 
81 
82  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: BeginJob" << endl;
83 
84  nevents = 0;
85 
86 }
87 
89 
90  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: BeginRun" << endl;
91 
92  context.get<MuonGeometryRecord>().get(muonGeom);
94 
95  if(parameters.getUntrackedParameter<bool>("staticBooking", true)) { // Static histo booking
96 
97  vector<string> trigSources;
98  if(parameters.getUntrackedParameter<bool>("localrun", true)) {
99  trigSources.push_back("");
100  }
101  else {
102  trigSources.push_back("_DTonly");
103  trigSources.push_back("_NoDT");
104  trigSources.push_back("_DTalso");
105  }
106  vector<string>::const_iterator trigSrcIt = trigSources.begin();
107  vector<string>::const_iterator trigSrcEnd = trigSources.end();
108 
109  if(parameters.getUntrackedParameter<bool>("process_dcc", true)) {
110  bookBarrelHistos("DCC_ErrorsChamberID");
111  }
112 
113  if (tpMode) {
114  for (int stat=1;stat<5;++stat){
115  for (int wh=-2;wh<3;++wh){
116  for (int sect=1;sect<13;++sect){
117  DTChamberId dtChId(wh,stat,sect);
118 
119  if (parameters.getUntrackedParameter<bool>("process_dcc", true)){ // DCC data
120  bookHistos(dtChId,"LocalTriggerPhi","DCC_BXvsQual"+(*trigSrcIt));
121  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhirad"+(*trigSrcIt));
122  }
123 
124  if (parameters.getUntrackedParameter<bool>("process_ros", true)){ // DDU data
125  bookHistos(dtChId,"LocalTriggerPhi","DDU_BXvsQual"+(*trigSrcIt));
126  }
127 
128  }
129  }
130  } // end of loop
131  }
132  else {
133  for (;trigSrcIt!=trigSrcEnd;++trigSrcIt){
134  for (int wh=-2;wh<3;++wh){
135  if (parameters.getUntrackedParameter<bool>("process_dcc", true) &&
136  parameters.getUntrackedParameter<bool>("process_ros", true)){ // DCC+DDU data
137  bookWheelHistos(wh,"COM_BXDiff"+(*trigSrcIt));
138  }
139  for (int sect=1;sect<13;++sect){
140  for (int stat=1;stat<5;++stat){
141  DTChamberId dtChId(wh,stat,sect);
142  if (parameters.getUntrackedParameter<bool>("process_dcc", true)){ // DCC data
143 
144  bookHistos(dtChId,"LocalTriggerPhi","DCC_BXvsQual"+(*trigSrcIt));
145  if (detailedAnalysis) {
146  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhirad"+(*trigSrcIt));
147  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhibend"+(*trigSrcIt));
148  }
149  bookHistos(dtChId,"LocalTriggerPhi","DCC_Flag1stvsQual"+(*trigSrcIt));
150  bookHistos(dtChId,"LocalTriggerPhi","DCC_BestQual"+(*trigSrcIt));
151  if (stat!=4 && doDCCTheta){
152  bookHistos(dtChId,"LocalTriggerTheta","DCC_PositionvsBX"+(*trigSrcIt));
153 // bookHistos(dtChId,"LocalTriggerTheta","DCC_PositionvsQual"+(*trigSrcIt)); // DCC theta quality not available!
154 // bookHistos(dtChId,"LocalTriggerTheta","DCC_ThetaBXvsQual"+(*trigSrcIt));
155 // bookHistos(dtChId,"LocalTriggerTheta","DCC_ThetaBestQual"+(*trigSrcIt));
156  }
157 
158  if (parameters.getUntrackedParameter<bool>("process_seg", true)){ // DCC + Segemnt
159  bookHistos(dtChId,"Segment","DCC_PhitkvsPhitrig"+(*trigSrcIt));
160  bookHistos(dtChId,"Segment","DCC_PhibtkvsPhibtrig"+(*trigSrcIt));
161  bookHistos(dtChId,"Segment","DCC_PhiResidual"+(*trigSrcIt));
162  bookHistos(dtChId,"Segment","DCC_PhiResidualvsLUTPhi"+(*trigSrcIt));
163  bookHistos(dtChId,"Segment","DCC_PhibResidual"+(*trigSrcIt));
164  bookHistos(dtChId,"Segment","DCC_HitstkvsQualtrig"+(*trigSrcIt));
165  bookHistos(dtChId,"Segment","DCC_TrackPosvsAngle"+(*trigSrcIt));
166  bookHistos(dtChId,"Segment","DCC_TrackPosvsAngleandTrig"+(*trigSrcIt));
167  bookHistos(dtChId,"Segment","DCC_TrackPosvsAngleandTrigHHHL"+(*trigSrcIt));
168  if(stat!=4){
169  bookHistos(dtChId,"Segment","DCC_TrackThetaPosvsAngle"+(*trigSrcIt)); // theta view
170  bookHistos(dtChId,"Segment","DCC_TrackThetaPosvsAngleandTrig"+(*trigSrcIt));
171 // bookHistos(dtChId,"Segment","DCC_TrackThetaPosvsAngleandTrigH"+(*trigSrcIt)); // DCC theta quality not available!
172  }
173  }
174 
175  }
176 
177  if (parameters.getUntrackedParameter<bool>("process_ros", true)){ // DDU data
178 
179  bookHistos(dtChId,"LocalTriggerPhi","DDU_BXvsQual"+(*trigSrcIt));
180  bookHistos(dtChId,"LocalTriggerPhi","DDU_Flag1stvsQual"+(*trigSrcIt));
181  bookHistos(dtChId,"LocalTriggerPhi","DDU_BestQual"+(*trigSrcIt));
182  if(stat!=4){ // theta view
183  bookHistos(dtChId,"LocalTriggerTheta","DDU_ThetaBXvsQual"+(*trigSrcIt));
184  bookHistos(dtChId,"LocalTriggerTheta","DDU_ThetaBestQual"+(*trigSrcIt));
185  }
186 
187  if (parameters.getUntrackedParameter<bool>("process_seg", true)){ // DDU + Segment
188  bookHistos(dtChId,"Segment","DDU_HitstkvsQualtrig"+(*trigSrcIt));
189  bookHistos(dtChId,"Segment","DDU_TrackPosvsAngle"+(*trigSrcIt));
190  bookHistos(dtChId,"Segment","DDU_TrackPosvsAngleandTrig"+(*trigSrcIt));
191  bookHistos(dtChId,"Segment","DDU_TrackPosvsAngleandTrigHHHL"+(*trigSrcIt));
192  if(stat!=4){
193  bookHistos(dtChId,"Segment","DDU_TrackThetaPosvsAngle"+(*trigSrcIt)); // theta view
194  bookHistos(dtChId,"Segment","DDU_TrackThetaPosvsAngleandTrig"+(*trigSrcIt));
195  bookHistos(dtChId,"Segment","DDU_TrackThetaPosvsAngleandTrigH"+(*trigSrcIt));
196  }
197  }
198 
199  }
200 
201  if (parameters.getUntrackedParameter<bool>("process_dcc", true) &&
202  parameters.getUntrackedParameter<bool>("process_ros", true)){ // DCC+DDU data
203  bookHistos(dtChId,"LocalTriggerPhi","COM_QualDDUvsQualDCC"+(*trigSrcIt));
204  }
205 
206  }
207  }
208  for (int sect=13;sect<15;++sect){
209  DTChamberId dtChId(wh,4,sect);
210  if (parameters.getUntrackedParameter<bool>("process_dcc", true) &&
211  parameters.getUntrackedParameter<bool>("process_seg", true)){ // DCC+SEG LUTs data
212  bookHistos(dtChId,"Segment","DCC_PhitkvsPhitrig"+(*trigSrcIt));
213  bookHistos(dtChId,"Segment","DCC_PhibtkvsPhibtrig"+(*trigSrcIt));
214  bookHistos(dtChId,"Segment","DCC_PhiResidual"+(*trigSrcIt));
215  bookHistos(dtChId,"Segment","DCC_PhiResidualvsLUTPhi"+(*trigSrcIt));
216  bookHistos(dtChId,"Segment","DCC_PhibResidual"+(*trigSrcIt));
217  }
218  }
219  }
220  }// end of loop
221  }
222 
223  }
224 
225 }
226 
227 
229 
230  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: Begin of LS transition" << endl;
231 
232  if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) {
233  for(map<uint32_t, map<string, MonitorElement*> > ::const_iterator histo = digiHistos.begin();
234  histo != digiHistos.end();
235  histo++) {
236  for(map<string, MonitorElement*> ::const_iterator ht = (*histo).second.begin();
237  ht != (*histo).second.end();
238  ht++) {
239  (*ht).second->Reset();
240  }
241  }
242  }
243 
244 }
245 
246 
248 
249  LogVerbatim("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: analyzed " << nevents << " events" << endl;
250  if (parameters.getUntrackedParameter<bool>("process_dcc", true)) dbe->rmdir(topFolder(0)); //DDU folder
251  if (parameters.getUntrackedParameter<bool>("process_ros", true)) dbe->rmdir(topFolder(1)); //DCC folder
252 
253 }
254 
255 
257  if (!nevents){
258 
260  e.getByToken(dcc_Token_, l1DTTPGPh);
262  e.getByToken(dcc_Token_, l1DTTPGTh);
263  useDCC = (l1DTTPGPh.isValid() || l1DTTPGTh.isValid()) && parameters.getUntrackedParameter<bool>("process_dcc", true) ;
264 
266  e.getByToken(ros_Token_,l1DDUTrigs);
267  useDDU = l1DDUTrigs.isValid() && parameters.getUntrackedParameter<bool>("process_ros", true) ;
268 
269  Handle<DTRecSegment4DCollection> all4DSegments;
270  e.getByToken(seg_Token_, all4DSegments);
271  useSEG = all4DSegments.isValid() && parameters.getUntrackedParameter<bool>("process_seg", true) ;
272 
273  }
274 
275  nevents++;
276 
277  triggerSource(e);
278 
279  if ( useDCC ) {
281  e.getByToken(dcc_Token_, l1DTTPGPh);
282  vector<L1MuDTChambPhDigi> const* l1PhTrig = l1DTTPGPh->getContainer();
283 
285  e.getByToken(dcc_Token_, l1DTTPGTh);
286  vector<L1MuDTChambThDigi> const* l1ThTrig = l1DTTPGTh->getContainer();
287 
288  runDCCAnalysis(l1PhTrig, l1ThTrig);
289  }
290  if ( useDDU ) {
292  e.getByToken(ros_Token_, l1DDUTrigs);
293 
294  runDDUAnalysis(l1DDUTrigs);
295  }
296  if ( !tpMode && useSEG ) {
298  e.getByToken(seg_Token_, segments4D);
299 
300  runSegmentAnalysis(segments4D);
301  }
302  if ( !tpMode && useDCC && useDDU ) {
304  }
305 
306 }
307 
308 
310 
311  bool isDCC = histoTag.substr(0,3) == "DCC";
312  dbe->setCurrentFolder(topFolder(isDCC));
313  if (histoTag == "DCC_ErrorsChamberID") {
314  dcc_IDDataErrorPlot = dbe->book1D(histoTag.c_str(),"DCC Data ID Error",5,-2,3);
315  dcc_IDDataErrorPlot->setAxisTitle("wheel",1);
316  }
317 
318  return;
319 
320 }
321 
322 void DTLocalTriggerTask::bookHistos(const DTChamberId& dtCh, string folder, string histoTag) {
323 
324  int wh=dtCh.wheel();
325  int sc=dtCh.sector();
326  stringstream wheel; wheel << wh;
327  stringstream station; station << dtCh.station();
328  stringstream sector; sector << sc;
329 
330  double minBX=0;
331  double maxBX=0;
332  int rangeBX=0;
333 
334  string histoType = histoTag.substr(4,histoTag.find("_",4)-4);
335  bool isDCC = histoTag.substr(0,3) == "DCC";
336 
337  dbe->setCurrentFolder(topFolder(isDCC) + "Wheel" + wheel.str() +
338  "/Sector" + sector.str() +
339  "/Station" + station.str() + "/" + folder);
340 
341  string histoName = histoTag + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str();
342 
343  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: booking " << topFolder(isDCC) << "Wheel" << wheel.str()
344  << "/Sector" << sector.str()
345  << "/Station"<< station.str() << "/" << folder << "/" << histoName << endl;
346 
347  if (histoType.find("BX") != string::npos){
348  if (histoTag.substr(0,3) == "DCC"){
349  minBX= parameters.getUntrackedParameter<int>("minBXDCC",-2) - 0.5;
350  maxBX= parameters.getUntrackedParameter<int>("maxBXDCC",2) + 0.5;
351  }
352  else {
353  minBX= parameters.getUntrackedParameter<int>("minBXDDU",0) - 0.5;
354  maxBX= parameters.getUntrackedParameter<int>("maxBXDDU",20) + 0.5;
355  }
356  rangeBX = (int)(maxBX-minBX);
357  }
358 
359  if ( folder == "LocalTriggerPhi") {
360 
361  if( histoType == "BXvsQual" ){
362  (digiHistos[dtCh.rawId()])[histoTag] =
363  dbe->book2D(histoName,"BX vs trigger quality",7,-0.5,6.5,rangeBX,minBX,maxBX);
364  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
365  return ;
366  }
367  if( histoType == "BestQual" ){
368  (digiHistos[dtCh.rawId()])[histoTag] =
369  dbe->book1D(histoName,"Trigger quality of best primitives",7,-0.5,6.5);
370  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
371  return ;
372  }
373  if( histoType == "QualvsPhirad" ){
374  (digiHistos[dtCh.rawId()])[histoTag] =
375  dbe->book2D(histoName,"Trigger quality vs local position",100,-500.,500.,7,-0.5,6.5);
376  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
377  return ;
378  }
379  if( histoType == "QualvsPhibend" ) {
380  (digiHistos[dtCh.rawId()])[histoTag] =
381  dbe->book2D(histoName,"Trigger quality vs local direction",200,-40.,40.,7,-0.5,6.5);
382  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
383  return ;
384  }
385  if( histoType == "Flag1stvsQual" ) {
386  (digiHistos[dtCh.rawId()])[histoTag] =
387  dbe->book2D(histoName,"1st/2nd trig flag vs quality",7,-0.5,6.5,2,-0.5,1.5);
388  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
389  return ;
390  }
391  if( histoType == "QualDDUvsQualDCC" ){
392  (digiHistos[dtCh.rawId()])[histoTag] =
393  dbe->book2D(histoName,"DDU quality vs DCC quality",8,-1.5,6.5,8,-1.5,6.5);
394  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
395  setQLabels((digiHistos[dtCh.rawId()])[histoTag],2);
396  return ;
397  }
398 
399  }
400  else if ( folder == "LocalTriggerTheta") {
401 
402  if( histoType == "PositionvsBX" ) {
403  (digiHistos[dtCh.rawId()])[histoTag] =
404  dbe->book2D(histoName,"Theta trigger position vs BX",rangeBX,minBX,maxBX,7,-0.5,6.5);
405  return ;
406  }
407  if( histoType == "PositionvsQual" ) {
408  (digiHistos[dtCh.rawId()])[histoTag] =
409  dbe->book2D(histoName,"Theta trigger position vs quality",7,-0.5,6.5,7,-0.5,6.5);
410  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
411  return ;
412  }
413  if( histoType == "ThetaBXvsQual" ) {
414  (digiHistos[dtCh.rawId()])[histoTag] =
415  dbe->book2D(histoName,"BX vs trigger quality",7,-0.5,6.5,rangeBX,minBX,maxBX);
416  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
417  }
418  if( histoType == "ThetaBestQual" ){
419  (digiHistos[dtCh.rawId()])[histoTag] =
420  dbe->book1D(histoName,"Trigger quality of best primitives (theta)",7,-0.5,6.5);
421  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
422  return ;
423  }
424 
425  }
426  else if ( folder == "Segment") {
427 
428  if( histoType.find("TrackThetaPosvsAngle" ) == 0 ) {
429 
430  string histoLabel = "Position vs Angle (theta)";
431  if (histoType.find("andTrigH") != string::npos) histoLabel += " for H triggers";
432  else if (histoType.find("andTrig") != string::npos) histoLabel += " for triggers";
433 
434  float min,max;
435  int nbins;
436  trigGeomUtils->thetaRange(dtCh,min,max,nbins);
437  (digiHistos[dtCh.rawId()])[histoTag] =
438  dbe->book2D(histoName,histoLabel,16,-40.,40.,nbins,min,max);
439  return ;
440  }
441  if( histoType.find("TrackPosvsAngle") == 0 ){
442 
443  float min,max;
444  int nbins;
445  trigGeomUtils->phiRange(dtCh,min,max,nbins);
446 
447  string histoLabel = "Position vs Angle (phi)";
448  if (histoType.find("andTrigHHHL") != string::npos) histoLabel += " for HH/HL triggers";
449  else if (histoType.find("andTrig") != string::npos) histoLabel += " for triggers";
450 
451  (digiHistos[dtCh.rawId()])[histoTag] =
452  dbe->book2D(histoName,histoLabel,16,-40.,40.,nbins,min,max);
453  return ;
454  }
455  if( histoType == "PhitkvsPhitrig" ){
456  (digiHistos[dtCh.rawId()])[histoTag] =
457  dbe->book2D(histoName,"Local position: segment vs trigger",100,-500.,500.,100,-500.,500.);
458  return ;
459  }
460  if( histoType == "PhibtkvsPhibtrig" ){
461  (digiHistos[dtCh.rawId()])[histoTag] =
462  dbe->book2D(histoName,"Local direction : segment vs trigger",200,-40.,40.,200,-40.,40.);
463  return ;
464  }
465  if( histoType == "PhiResidual" ){
466  (digiHistos[dtCh.rawId()])[histoTag] =
467  dbe->book1D(histoName,"Trigger local position - Segment local position (correlated triggers)",400,-10.,10.);
468  return ;
469  }
470  if( histoType == "PhibResidual" ){
471  (digiHistos[dtCh.rawId()])[histoTag] =
472  dbe->book1D(histoName,"Trigger local direction - Segment local direction (correlated triggers)",500,-10.,10.);
473  return ;
474  }
475  if( histoType == "HitstkvsQualtrig" ){
476  (digiHistos[dtCh.rawId()])[histoTag] =
477  dbe->book2D(histoName,"Segment hits (phi) vs trigger quality",7,-0.5,6.5,10,0.5,10.5);
478  setQLabels((digiHistos[dtCh.rawId()])[histoTag],1);
479  return ;
480  }
481 
482  }
483 
484 }
485 
486 void DTLocalTriggerTask::bookWheelHistos(int wh, string histoTag) {
487 
488  stringstream wheel; wheel << wh;
489 
490  string histoType = histoTag.substr(4,histoTag.find("_",4)-4);
491  bool isDCC = histoTag.substr(0,3) == "DCC";
492 
493  dbe->setCurrentFolder(topFolder(isDCC) + "Wheel" + wheel.str() + "/");
494 
495  string histoName = histoTag + "_W" + wheel.str();
496 
497  LogTrace("DTDQM|DTMonitorModule|DTLocalTriggerTask") << "[DTLocalTriggerTask]: booking " << topFolder(isDCC)
498  << "Wheel" << wheel.str() << "/" << histoName << endl;
499 
500  if( histoType.find("BXDiff") != string::npos ){
501  MonitorElement *me = dbe->bookProfile2D(histoName,"DDU-DCC BX Difference",12,1,13,4,1,5,0.,20.);
502  me->setAxisTitle("Sector",1);
503  me->setAxisTitle("station",2);
504  (wheelHistos[wh])[histoTag] = me;
505  return ;
506  }
507 
508 }
509 
510 void DTLocalTriggerTask::runDCCAnalysis( std::vector<L1MuDTChambPhDigi> const* phTrigs,
511  std::vector<L1MuDTChambThDigi> const* thTrigs ) {
512 
513  string histoType ;
514  string histoTag ;
515 
516  // define best quality trigger segment (phi and theta)
517  // in any station start from 1 and zero is kept empty
518  for (int i=0;i<5;++i){
519  for (int j=0;j<6;++j){
520  for (int k=0;k<13;++k){
521  phcode_best[j][i][k] = -1;
522  thcode_best[j][i][k] = -1;
523  }
524  }
525  }
526 
527  vector<L1MuDTChambPhDigi>::const_iterator iph = phTrigs->begin();
528  vector<L1MuDTChambPhDigi>::const_iterator iphe = phTrigs->end();
529  for(; iph !=iphe ; ++iph) {
530 
531  int phwheel = iph->whNum();
532  int phsec = iph->scNum() + 1; // SM The track finder goes from 0 to 11. I need them from 1 to 12 !!!!!
533  int phst = iph->stNum();
534  int phbx = iph->bxNum();
535  int phcode = iph->code();
536  int phi1st = iph->Ts2Tag();
537 
538  // FIXME: workaround for DCC data with station ID
539  if(phst == 0) {
540  dcc_IDDataErrorPlot->Fill(phwheel);
541  continue;
542  }
543 
544  if(phcode>phcode_best[phwheel+3][phst][phsec] && phcode<7) {
545  phcode_best[phwheel+3][phst][phsec]=phcode;
546  iphbest[phwheel+3][phst][phsec] = &(*iph);
547  }
548 
549  DTChamberId dtChId(phwheel,phst,phsec);
550 
551  float x = trigGeomUtils->trigPos(&(*iph));
552  float angle = trigGeomUtils->trigDir(&(*iph));
553  uint32_t indexCh = dtChId.rawId();
554 
555  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
556  if (innerME.find("DCC_BXvsQual"+trigsrc) == innerME.end()){
557  if (tpMode) {
558  bookHistos(dtChId,"LocalTriggerPhi","DCC_BXvsQual"+trigsrc);
559  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhirad"+trigsrc);
560  }
561  else {
562  bookHistos(dtChId,"LocalTriggerPhi","DCC_BXvsQual"+trigsrc);
563  bookHistos(dtChId,"LocalTriggerPhi","DCC_Flag1stvsQual"+trigsrc);
564  if (detailedAnalysis) {
565  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhirad"+trigsrc);
566  bookHistos(dtChId,"LocalTriggerPhi","DCC_QualvsPhibend"+trigsrc);
567  }
568  }
569  }
570 
571  if (tpMode) {
572  innerME.find("DCC_BXvsQual"+trigsrc)->second->Fill(phcode,phbx-phi1st); // SM BX vs Qual Phi view (1st tracks)
573  innerME.find("DCC_QualvsPhirad"+trigsrc)->second->Fill(x,phcode); // SM Qual vs radial angle Phi view
574  }
575  else {
576  innerME.find("DCC_BXvsQual"+trigsrc)->second->Fill(phcode,phbx-phi1st); // SM BX vs Qual Phi view (1st tracks)
577  innerME.find("DCC_Flag1stvsQual"+trigsrc)->second->Fill(phcode,phi1st); // SM Qual 1st/2nd track flag Phi view
578  if (detailedAnalysis) {
579  innerME.find("DCC_QualvsPhirad"+trigsrc)->second->Fill(x,phcode); // SM Qual vs radial angle Phi view
580  innerME.find("DCC_QualvsPhibend"+trigsrc)->second->Fill(angle,phcode); // SM Qual vs bending Phi view
581  }
582  }
583 
584  }
585 
586  if (doDCCTheta) {
587  int thcode[7];
588  vector<L1MuDTChambThDigi>::const_iterator ith = thTrigs->begin();
589  vector<L1MuDTChambThDigi>::const_iterator ithe = thTrigs->end();
590  for(; ith != ithe; ++ith) {
591  int thwheel = ith->whNum();
592  int thsec = ith->scNum() + 1; // SM The track finder goes from 0 to 11. I need them from 1 to 12 !!!!!
593  int thst = ith->stNum();
594  int thbx = ith->bxNum();
595 
596  for (int pos=0; pos<7; pos++) {
597  thcode[pos] = ith->code(pos);
598 
599  if(thcode[pos]>thcode_best[thwheel+3][thst][thsec] ) {
600  thcode_best[thwheel+3][thst][thsec]=thcode[pos];
601  ithbest[thwheel+3][thst][thsec] = &(*ith);
602  }
603  }
604 
605  DTChamberId dtChId(thwheel,thst,thsec);
606  uint32_t indexCh = dtChId.rawId();
607 
608  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
609  if (innerME.find("DCC_PositionvsBX"+trigsrc) == innerME.end()){
610  bookHistos(dtChId,"LocalTriggerTheta","DCC_PositionvsBX"+trigsrc);
611 // if (detailedAnalysis) {
612 // bookHistos(dtChId,"LocalTriggerTheta","DCC_PositionvsBX"+trigsrc);
613 // bookHistos(dtChId,"LocalTriggerTheta","DCC_PositionvsQual"+trigsrc);
614 // }
615  }
616 
617  for (int pos=0; pos<7; pos++) { //SM fill position for non zero position bit in theta view
618  if(thcode[pos]>0){
619  innerME.find("DCC_PositionvsBX"+trigsrc)->second->Fill(thbx,pos); // SM BX vs Position Theta view
620 // if (detailedAnalysis) {
621 // int thqual = (thcode[pos]/2)*2+1;
622 // innerME.find("DCC_ThetaBXvsQual"+trigsrc)->second->Fill(thqual,thbx); // SM BX vs Code Theta view
623 // innerME.find("DCC_PositionvsQual"+trigsrc)->second->Fill(thqual,pos); // SM Code vs Position Theta view
624 // }
625  }
626  }
627  }
628  }
629 
630 
631  // Fill Quality plots with best DCC triggers in phi & theta
632  if (!tpMode) {
633  for (int st=1;st<5;++st){
634  for (int wh=-2;wh<3;++wh){
635  for (int sc=1;sc<13;++sc){
636  if (phcode_best[wh+3][st][sc]>-1 && phcode_best[wh+3][st][sc]<7){
637  DTChamberId id(wh,st,sc);
638  uint32_t indexCh = id.rawId();
639  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
640  if (innerME.find("DCC_BestQual"+trigsrc) == innerME.end())
641  bookHistos(id,"LocalTriggerPhi","DCC_BestQual"+trigsrc);
642  innerME.find("DCC_BestQual"+trigsrc)->second->Fill(phcode_best[wh+3][st][sc]); // Best Qual Trigger Phi view
643  }
644 // if (thcode_best[wh+3][st][sc]>0){
645 // DTChamberId id(wh,st,sc);
646 // uint32_t indexCh = id.rawId();
647 // map<string, MonitorElement*> &innerME = digiHistos[indexCh];
648 // if (innerME.find("DCC_ThetaBestQual"+trigsrc) == innerME.end())
649 // bookHistos(id,"LocalTriggerTheta","DCC_ThetaBestQual"+trigsrc);
650 // innerME.find("DCC_ThetaBestQual"+trigsrc)->second->Fill(thcode_best[wh+3][st][sc]); // Best Qual Trigger Theta view
651 // }
652  }
653  }
654  }
655  }
656 
657 }
658 
660 
662 
663  for (int i=0;i<5;++i){
664  for (int j=0;j<6;++j){
665  for (int k=0;k<13;++k){
666  dduphcode_best[j][i][k] = -1;
667  dduthcode_best[j][i][k] = -1;
668  }
669  }
670  }
671 
672  for (detUnitIt=trigsDDU->begin();
673  detUnitIt!=trigsDDU->end();
674  ++detUnitIt){
675 
676  const DTChamberId& id = (*detUnitIt).first;
677  const DTLocalTriggerCollection::Range& range = (*detUnitIt).second;
678  uint32_t indexCh = id.rawId();
679  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
680 
681  int wh = id.wheel();
682  int sec = id.sector();
683  int st = id.station();
684 
685  for (DTLocalTriggerCollection::const_iterator trigIt = range.first;
686  trigIt!=range.second;
687  ++trigIt){
688 
689  int bx = trigIt->bx();
690  int quality = trigIt->quality();
691  int thqual = trigIt->trTheta();
692  int flag1st = trigIt->secondTrack() ? 1 : 0;
693 
694  // check if SC data exist: fill for any trigger
695  if( quality>-1 && quality<7 ) { // it is a phi trigger
696 
697  if(quality>dduphcode_best[wh+3][st][sec]) {
698  dduphcode_best[wh+3][st][sec]=quality;
699  iphbestddu[wh+3][st][sec] = &(*trigIt);
700  }
701 
702  if (innerME.find("DDU_BXvsQual"+trigsrc) == innerME.end()){
703  bookHistos(id,"LocalTriggerPhi","DDU_BXvsQual"+trigsrc);
704  bookHistos(id,"LocalTriggerPhi","DDU_Flag1stvsQual"+trigsrc);
705  }
706 
707  if(tpMode) {
708  innerME.find("DDU_BXvsQual"+trigsrc)->second->Fill(quality,bx-flag1st); // SM BX vs Qual Phi view
709  }
710  else {
711  innerME.find("DDU_BXvsQual"+trigsrc)->second->Fill(quality,bx-flag1st); // SM BX vs Qual Phi view
712  innerME.find("DDU_Flag1stvsQual"+trigsrc)->second->Fill(quality,flag1st); // SM Quality vs 1st/2nd track flag Phi view
713  }
714  }
715  if( thqual>0 && !tpMode ) { // it is a theta trigger
716 
717  if(thqual>dduthcode_best[wh+3][st][sec] ) {
718  dduthcode_best[wh+3][st][sec]=thqual;
719  }
720  if (innerME.find("DDU_ThetaBXvsQual"+trigsrc) == innerME.end())
721  bookHistos(id,"LocalTriggerTheta","DDU_ThetaBXvsQual"+trigsrc);
722  innerME.find("DDU_ThetaBXvsQual"+trigsrc)->second->Fill(thqual,bx); // SM BX vs Qual Theta view
723 
724  }
725  }
726 
727  // Fill Quality plots with best ddu triggers in phi & theta
728  if (!tpMode) {
729  if (dduphcode_best[wh+3][st][sec]>-1 &&
730  dduphcode_best[wh+3][st][sec]<7){
731  if (innerME.find("DDU_BestQual"+trigsrc) == innerME.end())
732  bookHistos(id,"LocalTriggerPhi","DDU_BestQual"+trigsrc);
733  innerME.find("DDU_BestQual"+trigsrc)->second->Fill(dduphcode_best[wh+3][st][sec]); // Best Qual Trigger Phi view
734  }
735  if (dduthcode_best[wh+3][st][sec]>0){
736  if (innerME.find("DDU_ThetaBestQual"+trigsrc) == innerME.end())
737  bookHistos(id,"LocalTriggerTheta","DDU_ThetaBestQual"+trigsrc);
738  innerME.find("DDU_ThetaBestQual"+trigsrc)->second->Fill(dduthcode_best[wh+3][st][sec]); // Best Qual Trigger Theta view
739  }
740  }
741  }
742 
743 }
744 
745 
747 
749 
750  // Find best tracks & good tracks
751  memset(track_ok,false,450*sizeof(bool));
752 
753  DTRecSegment4DCollection::id_iterator chamberId;
754  vector<const DTRecSegment4D*> best4DSegments;
755 
756  // Preliminary loop finds best 4D Segment and high quality ones
757  for (chamberId = segments4D->id_begin(); chamberId != segments4D->id_end(); ++chamberId){
758 
759  DTRecSegment4DCollection::range range = segments4D->get(*chamberId);
760  const DTRecSegment4D* tmpBest=0;
761  int tmpdof = 0;
762  int dof = 0;
763 
764  for ( track = range.first; track != range.second; ++track){
765 
766  if( (*track).hasPhi() ) {
767 
768  dof = (*track).phiSegment()->degreesOfFreedom();
769  if ( dof>tmpdof ){
770  tmpBest = &(*track);
771  tmpdof = dof;
772 
773  int wheel = (*track).chamberId().wheel();
774  int sector = (*track).chamberId().sector();
775  int station = (*track).chamberId().station();
776  if (sector==13){
777  sector=4;
778  }
779  else if (sector==14){
780  sector=10;
781  }
782  track_ok[wheel+3][station][sector] = (!track_ok[wheel+3][station][sector] && dof>=2);
783  }
784 
785  }
786  }
787  if (tmpBest) best4DSegments.push_back(tmpBest);
788  }
789 
790  vector<const DTRecSegment4D*>::const_iterator btrack;
791 
792  for ( btrack = best4DSegments.begin(); btrack != best4DSegments.end(); ++btrack ){
793 
794  if( (*btrack)->hasPhi() ) { // Phi component
795 
796  int wheel = (*btrack)->chamberId().wheel();
797  int station = (*btrack)->chamberId().station();
798  int sector = (*btrack)->chamberId().sector();
799  int scsector = 0;
800  float x_track, y_track, x_angle, y_angle;
801  trigGeomUtils->computeSCCoordinates((*btrack),scsector,x_track,x_angle,y_track,y_angle);
802  int nHitsPhi = (*btrack)->phiSegment()->degreesOfFreedom()+2;
803 
804  DTChamberId dtChId(wheel,station,sector); // get chamber for LUTs histograms (Sectors 1 to 14)
805  uint32_t indexCh = dtChId.rawId();
806  map<string, MonitorElement*> &innerMECh = digiHistos[indexCh];
807 
808  DTChamberId dtChIdSC = DTChamberId(wheel,station,scsector); // get chamber for histograms SC granularity (sectors 1 to 12)
809  indexCh = dtChIdSC.rawId();
810  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
811 
812  if (useDDU &&
813  dduphcode_best[wheel+3][station][scsector] > -1 &&
814  dduphcode_best[wheel+3][station][scsector] < 7 ) {
815 
816  // SM hits of the track vs quality of the trigger
817  if (innerME.find("DDU_HitstkvsQualtrig"+trigsrc) == innerME.end())
818  bookHistos(dtChIdSC,"Segment","DDU_HitstkvsQualtrig"+trigsrc);
819  innerME.find("DDU_HitstkvsQualtrig"+trigsrc)->second->Fill(dduphcode_best[wheel+3][station][scsector],nHitsPhi);
820 
821  }
822 
823  if (useDCC &&
824  phcode_best[wheel+3][station][scsector] > -1 &&
825  phcode_best[wheel+3][station][scsector] < 7 ) {
826 
827  if (innerME.find("DCC_HitstkvsQualtrig"+trigsrc) == innerME.end()){
828  bookHistos(dtChIdSC,"Segment","DCC_HitstkvsQualtrig"+trigsrc);
829  }
830  innerME.find("DCC_HitstkvsQualtrig"+trigsrc)->second->Fill(phcode_best[wheel+3][station][scsector],nHitsPhi);
831 
832  if (phcode_best[wheel+3][station][scsector]>3 && nHitsPhi>=7){
833 
834  float x_trigger = trigGeomUtils->trigPos(iphbest[wheel+3][station][scsector]);
835  float angle_trigger = trigGeomUtils->trigDir(iphbest[wheel+3][station][scsector]);
836  trigGeomUtils->trigToSeg(station,x_trigger,x_angle);
837 
838  if (innerMECh.find("DCC_PhibResidual"+trigsrc) == innerMECh.end()){
839  bookHistos(dtChId,"Segment","DCC_PhiResidual"+trigsrc);
840  bookHistos(dtChId,"Segment","DCC_PhibResidual"+trigsrc);
841  bookHistos(dtChId,"Segment","DCC_PhitkvsPhitrig"+trigsrc);
842  bookHistos(dtChId,"Segment","DCC_PhibtkvsPhibtrig"+trigsrc);
843  bookHistos(dtChId,"Segment","DCC_HitstkvsQualtrig"+trigsrc);
844  }
845 
846  innerMECh.find("DCC_PhitkvsPhitrig"+trigsrc)->second->Fill(x_trigger,x_track);
847  innerMECh.find("DCC_PhibtkvsPhibtrig"+trigsrc)->second->Fill(angle_trigger,x_angle);
848  innerMECh.find("DCC_PhiResidual"+trigsrc)->second->Fill(x_trigger-x_track);
849  innerMECh.find("DCC_PhibResidual"+trigsrc)->second->Fill(angle_trigger-x_angle);
850  }
851 
852 
853 
854  }
855 
856 
857  if (useDCC) {
858 
859  // check for triggers elsewhere in the sector
860  bool trigFlagDCC =false;
861  for (int ist=1; ist<5; ist++){
862  if (ist!=station &&
863  phcode_best[wheel+3][ist][scsector]>=2 &&
864  phcode_best[wheel+3][ist][scsector]<7 &&
865  track_ok[wheel+3][ist][scsector]==true){
866  trigFlagDCC = true;
867  break;
868  }
869  }
870 
871  if (trigFlagDCC && fabs(x_angle)<40. && nHitsPhi>=7){
872 
873  if (innerME.find("DCC_TrackPosvsAngle"+trigsrc) == innerME.end()){
874  bookHistos(dtChIdSC,"Segment","DCC_TrackPosvsAngle"+trigsrc);
875  bookHistos(dtChIdSC,"Segment","DCC_TrackPosvsAngleandTrig"+trigsrc);
876  bookHistos(dtChIdSC,"Segment","DCC_TrackPosvsAngleandTrigHHHL"+trigsrc);
877  }
878 
879  // position vs angle of track for reconstruced tracks (denom. for trigger efficiency)
880  innerME.find("DCC_TrackPosvsAngle"+trigsrc)->second->Fill(x_angle,x_track);
881  if (phcode_best[wheel+3][station][scsector] >= 2 && phcode_best[wheel+3][station][scsector] < 7) {
882  innerME.find("DCC_TrackPosvsAngleandTrig"+trigsrc)->second->Fill(x_angle,x_track);
883  if (phcode_best[wheel+3][station][scsector] > 4){ //HH & HL Triggers
884  innerME.find("DCC_TrackPosvsAngleandTrigHHHL"+trigsrc)->second->Fill(x_angle,x_track);
885  }
886  }
887 
888  }
889 
890  if ((*btrack)->hasZed() && trigFlagDCC && fabs(y_angle)<40. && (*btrack)->zSegment()->degreesOfFreedom()>=1){
891 
892  if (innerME.find("DCC_TrackThetaPosvsAngle"+trigsrc) == innerME.end()){
893  bookHistos(dtChIdSC,"Segment","DCC_TrackThetaPosvsAngle"+trigsrc);
894  bookHistos(dtChIdSC,"Segment","DCC_TrackThetaPosvsAngleandTrig"+trigsrc);
895 // bookHistos(dtChIdSC,"Segment","DCC_TrackThetaPosvsAngleandTrigH"+trigsrc); no DCC theta qual info
896  }
897 
898  // position va angle of track for reconstruced tracks (denom. for trigger efficiency) along theta direction
899  innerME.find("DCC_TrackThetaPosvsAngle"+trigsrc)->second->Fill(y_angle,y_track);
900  if (thcode_best[wheel+3][station][scsector] > 0) {
901  innerME.find("DCC_TrackThetaPosvsAngleandTrig"+trigsrc)->second->Fill(y_angle,y_track);
902 // if (thcode_best[wheel+3][station][scsector] == 3) {
903 // innerME.find("DCC_TrackThetaPosvsAngleH"+trigsrc)->second->Fill(y_angle,y_track);
904 // }
905  }
906 
907  }
908  }
909 
910  if (useDDU) {
911 
912  // check for triggers elsewhere in the sector
913  bool trigFlagDDU =false;
914  for (int ist=1; ist<5; ist++){
915  if (ist!=station &&
916  dduphcode_best[wheel+3][ist][scsector]>=2 &&
917  dduphcode_best[wheel+3][ist][scsector]<7 &&
918  track_ok[wheel+3][ist][scsector]==true){
919  trigFlagDDU = true;
920  break;
921  }
922  }
923 
924  if (trigFlagDDU && fabs(x_angle)<40. && nHitsPhi>=7){
925 
926  if (innerME.find("DDU_TrackPosvsAngle"+trigsrc) == innerME.end()){
927  bookHistos(dtChIdSC,"Segment","DDU_TrackPosvsAngle"+trigsrc);
928  bookHistos(dtChIdSC,"Segment","DDU_TrackPosvsAngleandTrig"+trigsrc);
929  bookHistos(dtChIdSC,"Segment","DDU_TrackPosvsAngleandTrigHHHL"+trigsrc);
930  }
931 
932  // position vs angle of track for reconstruced tracks (denom. for trigger efficiency)
933  innerME.find("DDU_TrackPosvsAngle"+trigsrc)->second->Fill(x_angle,x_track);
934  if (dduphcode_best[wheel+3][station][scsector] >= 2 && dduphcode_best[wheel+3][station][scsector] < 7) {
935  innerME.find("DDU_TrackPosvsAngleandTrig"+trigsrc)->second->Fill(x_angle,x_track);
936  if (dduphcode_best[wheel+3][station][scsector] > 4){ //HH & HL Triggers
937  innerME.find("DDU_TrackPosvsAngleandTrigHHHL"+trigsrc)->second->Fill(x_angle,x_track);
938  }
939  }
940 
941  }
942 
943  if ((*btrack)->hasZed() && trigFlagDDU && fabs(y_angle)<40. && (*btrack)->zSegment()->degreesOfFreedom()>=1){
944 
945  if (innerME.find("DDU_TrackThetaPosvsAngle"+trigsrc) == innerME.end()){
946  bookHistos(dtChIdSC,"Segment","DDU_TrackThetaPosvsAngle"+trigsrc);
947  bookHistos(dtChIdSC,"Segment","DDU_TrackThetaPosvsAngleandTrig"+trigsrc);
948  bookHistos(dtChIdSC,"Segment","DDU_TrackThetaPosvsAngleandTrigH"+trigsrc);
949  }
950 
951  // position va angle of track for reconstruced tracks (denom. for trigger efficiency) along theta direction
952  innerME.find("DDU_TrackThetaPosvsAngle"+trigsrc)->second->Fill(y_angle,y_track);
953  if (dduthcode_best[wheel+3][station][scsector] > 0) {
954  innerME.find("DDU_TrackThetaPosvsAngleandTrig"+trigsrc)->second->Fill(y_angle,y_track);
955  if (dduthcode_best[wheel+3][station][scsector] == 3) {
956  innerME.find("DDU_TrackThetaPosvsAngleandTrigH"+trigsrc)->second->Fill(y_angle,y_track);
957  }
958  }
959 
960  }
961  }
962  }
963  }
964 
965 }
966 
967 
969 
970  string histoType ;
971  string histoTag ;
972 
973  for (int st=1;st<5;++st){
974  for (int wh=-2;wh<3;++wh){
975  for (int sc=1;sc<13;++sc){
976  if ( (phcode_best[wh+3][st][sc]>-1 && phcode_best[wh+3][st][sc]<7) ||
977  (dduphcode_best[wh+3][st][sc]>-1 && dduphcode_best[wh+3][st][sc]<7) ){
978  DTChamberId id(wh,st,sc);
979  uint32_t indexCh = id.rawId();
980  map<string, MonitorElement*> &innerME = digiHistos[indexCh];
981  if (innerME.find("COM_QualDDUvsQualDCC"+trigsrc) == innerME.end())
982  bookHistos(id,"LocalTriggerPhi","COM_QualDDUvsQualDCC"+trigsrc);
983  innerME.find("COM_QualDDUvsQualDCC"+trigsrc)->second->Fill(phcode_best[wh+3][st][sc],dduphcode_best[wh+3][st][sc]);
984  if ( (phcode_best[wh+3][st][sc]>-1 && phcode_best[wh+3][st][sc]<7) &&
985  (dduphcode_best[wh+3][st][sc]>-1 && dduphcode_best[wh+3][st][sc]<7) ){
986  int bxDDU = iphbestddu[wh+3][st][sc]->bx() - iphbestddu[wh+3][st][sc]->secondTrack();
987  int bxDCC = iphbest[wh+3][st][sc]->bxNum() - iphbest[wh+3][st][sc]->Ts2Tag();
988  (wheelHistos[wh]).find("COM_BXDiff"+trigsrc)->second->Fill(sc,st,bxDDU-bxDCC);
989  }
990  }
991  }
992  }
993  }
994 
995 }
996 
998 
999  TH1* histo = me->getTH1();
1000  if (!histo) return;
1001 
1002  TAxis* axis=0;
1003  if (iaxis==1) {
1004  axis=histo->GetXaxis();
1005  }
1006  else if(iaxis==2) {
1007  axis=histo->GetYaxis();
1008  }
1009  if (!axis) return;
1010 
1011  string labels[7] = {"LI","LO","HI","HO","LL","HL","HH"};
1012  int istart = axis->GetXmin()<-1 ? 2 : 1;
1013  for (int i=0;i<7;i++) {
1014  axis->SetBinLabel(i+istart,labels[i].c_str());
1015  }
1016 
1017 }
1018 
1020 
1021 
1022  if (!isLocalRun){
1023 
1024  Handle<LTCDigiCollection> ltcdigis;
1025  e.getByToken(ltcDigiCollectionToken_, ltcdigis);
1026 
1027  for (std::vector<LTCDigi>::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){
1028 
1029  size_t otherTriggerSum=0;
1030  for (size_t i = 1; i < 6; i++) {
1031  otherTriggerSum += size_t((*ltc_it).HasTriggered(i));
1032  }
1033  if ((*ltc_it).HasTriggered(0) && otherTriggerSum == 0)
1034  trigsrc = "_DTonly";
1035  else if (!(*ltc_it).HasTriggered(0))
1036  trigsrc = "_NoDT";
1037  else if ((*ltc_it).HasTriggered(0) && otherTriggerSum > 0)
1038  trigsrc = "_DTalso";
1039 
1040  }
1041  return;
1042  }
1043 
1044  trigsrc = "";
1045  return;
1046 
1047 }
1048 
1049 // Local Variables:
1050 // show-trailing-whitespace: t
1051 // truncate-lines: t
1052 // End:
LuminosityBlockID id() const
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void bookWheelHistos(int wh, std::string histoTag)
Book the histograms.
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
void thetaRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute theta range in local chamber coordinates.
int phcode_best[6][5][13]
virtual int degreesOfFreedom() const
return the DOF of the segment
std::map< int, std::map< std::string, MonitorElement * > > wheelHistos
edm::EDGetTokenT< LTCDigiCollection > ltcDigiCollectionToken_
int thcode_best[6][5][13]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
void runDCCAnalysis(std::vector< L1MuDTChambPhDigi > const *phTrigs, std::vector< L1MuDTChambThDigi > const *thTrigs)
Run analysis on DCC data.
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
float trigDir(const L1MuDTChambPhDigi *trig)
Return local direction (trigger RF) for a given trigger primitive.
edm::EDGetTokenT< L1MuDTChambPhContainer > dcc_Token_
int dduphcode_best[6][5][13]
void bookBarrelHistos(std::string histoTag)
Book the histograms.
void runDDUvsDCCAnalysis(std::string &trigsrc)
Run analysis on ROS data.
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool track_ok[6][5][15]
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
int dduthcode_best[6][5][13]
void runSegmentAnalysis(edm::Handle< DTRecSegment4DCollection > &segments4D)
Run analysis using DT 4D segments.
return((rh^lh)&mask)
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::EDGetTokenT< DTRecSegment4DCollection > seg_Token_
void bookHistos(const DTChamberId &dtCh, std::string folder, std::string histoTag)
Book the histograms.
void trigToSeg(int st, float &x, float dir)
Compute Trigger x coordinate in chamber RF.
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
T min(T a, T b)
Definition: MathUtil.h:58
DTLocalTriggerTask(const edm::ParameterSet &ps)
Constructor.
bool isValid() const
Definition: HandleBase.h:76
#define LogTrace(id)
edm::EDGetTokenT< DTLocalTriggerCollection > ros_Token_
edm::ESHandle< DTGeometry > muonGeom
void phiRange(const DTChamberId &id, float &min, float &max, int &nbins, float step=15)
Compute phi range in local chamber coordinates.
const DTLocalTrigger * iphbestddu[6][5][13]
const T & get() const
Definition: EventSetup.h:55
const L1MuDTChambThDigi * ithbest[6][5][13]
LuminosityBlockNumber_t luminosityBlock() const
void setQLabels(MonitorElement *me, short int iaxis)
Set Quality labels.
std::vector< DTLocalTrigger >::const_iterator const_iterator
void endJob(void)
EndJob.
edm::ParameterSet parameters
bool secondTrack() const
std::string & topFolder(bool isDCC)
Get the Top folder (different between Physics and TP and DCC/DDU)
DTTrigGeomUtils * trigGeomUtils
const L1MuDTChambPhDigi * iphbest[6][5][13]
int sector() const
Definition: DTChamberId.h:61
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
To reset the MEs.
virtual ~DTLocalTriggerTask()
Destructor.
void triggerSource(const edm::Event &e)
Get the L1A source.
std::pair< const_iterator, const_iterator > Range
Definition: DDAxes.h:10
float trigPos(const L1MuDTChambPhDigi *trig)
Return local position (trigger RF) for a given trigger primitive.
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
MonitorElement * dcc_IDDataErrorPlot
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
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 beginRun(const edm::Run &, const edm::EventSetup &)
Beginrun.
uint16_t bx() const
Definition: Run.h:41
void runDDUAnalysis(edm::Handle< DTLocalTriggerCollection > &trigsDDU)
Run analysis on ROS data.
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11