CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TDTTPG.cc
Go to the documentation of this file.
1 /*
2  * \file L1TDTTPG.cc
3  *
4  * \author J. Berryhill
5  *
6  *
7  *
8  * organized message logger
9  *
10  * Revision 1.19 2008/03/14 20:35:46 berryhil
11  *
12  *
13  * stripped out obsolete parameter settings
14  *
15  * rpc tpg restored with correct dn access and dbe handling
16  *
17  * Revision 1.18 2008/03/12 17:24:24 berryhil
18  *
19  *
20  * eliminated log files, truncated HCALTPGXana histo output
21  *
22  * Revision 1.17 2008/03/10 09:29:52 lorenzo
23  * added MEs
24  *
25  * Revision 1.16 2008/03/01 00:40:00 lat
26  * DQM core migration.
27  *
28  *
29  *
30  * organized message logger
31  *
32  * Revision 1.19 2008/03/14 20:35:46 berryhil
33  *
34  *
35  * stripped out obsolete parameter settings
36  *
37  * rpc tpg restored with correct dn access and dbe handling
38  *
39  * Revision 1.18 2008/03/12 17:24:24 berryhil
40  *
41  *
42  * eliminated log files, truncated HCALTPGXana histo output
43  *
44  * Revision 1.17 2008/03/10 09:29:52 lorenzo
45  * added MEs
46  *
47  * Revision 1.15 2008/01/22 18:56:01 muzaffar
48  * include cleanup. Only for cc/cpp files
49  *
50  * Revision 1.14 2007/12/21 17:41:20 berryhil
51  *
52  *
53  * try/catch removal
54  *
55  * Revision 1.13 2007/11/19 15:08:22 lorenzo
56  * changed top folder name
57  *
58  * Revision 1.12 2007/08/15 18:56:25 berryhil
59  *
60  *
61  * split histograms by bx; add Maiken's bx classifier plots
62  *
63  * Revision 1.11 2007/07/26 09:37:09 berryhil
64  *
65  *
66  * set verbose false for all modules
67  * set verbose fix for DTTPG tracks
68  *
69  * Revision 1.10 2007/07/25 09:03:58 berryhil
70  *
71  *
72  * conform to DTTFFEDReader input tag.... for now
73  *
74  * Revision 1.9 2007/07/12 16:06:18 wittich
75  * add simple phi output track histograms.
76  * note that the label of this class is different than others
77  * from the DTFFReader creates.
78  *
79  */
80 #include <iostream>
81 #include <sstream>
82 #include <fstream>
83 #include <vector>
84 
87 
89 
90 using namespace std;
91 using namespace edm;
92 
94  : dttpgSourcePhContainer_token_( consumes<L1MuDTChambPhContainer>(ps.getParameter< InputTag >("dttpgSource") )),
95  dttpgSourceThContainer_token_( consumes<L1MuDTChambThContainer>(ps.getParameter< InputTag >("dttpgSource") )),
96  dttpgSource_( ps.getParameter< InputTag >("dttpgSource") )
97 {
98  trstring_ = dttpgSource_.label()+":"+"DATA"+":"+dttpgSource_.process();
99  trToken_ = consumes<L1MuDTTrackContainer>(trstring_);
100 
101  // verbosity switch
102  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
103 
104  if(verbose_) cout << "L1TDTTPG: constructor...." << endl;
105 
106 
107  dbe = NULL;
108  if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
109  {
111  dbe->setVerbose(0);
112  }
113 
114  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
115  if ( outputFile_.size() != 0 ) {
116  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
117  }
118 
119  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
120  if(disable){
121  outputFile_="";
122  }
123 
124 
125  if ( dbe !=NULL ) {
126  dbe->setCurrentFolder("L1T/L1TDTTPG");
127  }
128 
129 
130 }
131 
133 {
134 }
135 
137 {
138  nev_ = 0;
139 }
140 
141 
143 {
144  if(verbose_) cout << "L1TDTTPG: end job...." << endl;
145  LogInfo("EndJob") << "analyzed " << nev_ << " events";
146 
147  if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
148 
149  return;
150 }
151 
152 void L1TDTTPG::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup)
153 {
154  if ( dbe ) {
155  dbe->setCurrentFolder("L1T/L1TDTTPG");
156  dbe->rmdir("L1T/L1TDTTPG");
157  }
158 
159 
160  if ( dbe )
161  {
162  dbe->setCurrentFolder("L1T/L1TDTTPG");
163 
164 
165  //hist1[0]
166  dttpgphbx[0] = dbe->book1D("BxEncoding_PHI",
167  "Bunch encoding DTTF Phi",11,0,11);
168  //hist1[1]
169  dttpgphbx[1] = dbe->book1D("BxEncoding_OUT",
170  "Bunch encoding DTTF Output",11,0,11);
171 
172  //hist1[2]
173  dttpgphbx[2] = dbe->book1D("NumberOfSegmentsPHI_BunchNeg1",
174  "Number of segments for bunch -1 Dttf Phi",
175  20,0,20);
176  //hist1[3]
177  dttpgphbx[3] = dbe->book1D("NumberOfSegmentsPHI_Bunch0",
178  "Number of segments for bunch 0 Dttf Phi",
179  20,0,20);
180  //hist1[4]
181  dttpgphbx[4] = dbe->book1D("NumberOfSegmentsPHI_Bunch1",
182  "Number of segments for bunch 1 Dttf Phi",
183  20,0,20);
184 
185  //hist1[5]
186  dttpgphbx[5] = dbe->book1D("NumberOfSegmentsOUT_BunchNeg1",
187  "Number of segments for bunch -1 Dttf Output",
188  20,0,20);
189  //hist1[6]
190  dttpgphbx[6] = dbe->book1D("NumberOfSegmentsOUT_Bunch0",
191  "Number of segments for bunch 0 Dttf Output",
192  20,0,20);
193  //hist1[7]
194  dttpgphbx[7] = dbe->book1D("NumberOfSegmentsOUT_Bunch1",
195  "Number of segments for bunch 1 Dttf Output",
196  20,0,20);
197 
198  for(int i=0;i<2;i++){
199  dttpgphbx[i]->setBinLabel(1,"None");
200  dttpgphbx[i]->setBinLabel(3,"Only bx=-1");
201  dttpgphbx[i]->setBinLabel(4,"Only bx= 0");
202  dttpgphbx[i]->setBinLabel(5,"Only bx=+1");
203  dttpgphbx[i]->setBinLabel(7,"Bx=-1,0");
204  dttpgphbx[i]->setBinLabel(8,"Bx=-1,1");
205  dttpgphbx[i]->setBinLabel(9,"Bx= 0,1");
206  dttpgphbx[i]->setBinLabel(11,"All bx");
207  }
208 
209  dttpgphbxcomp = dbe->book2D("BxEncoding_PHI_OUT",
210  "Bunch encoding: DTTF Phi vs. Output",
211  11,0,11,11,0,11);
212  dttpgphbxcomp->setAxisTitle("DTTF (output)",1);
213  dttpgphbxcomp->setAxisTitle("PHI-TF",2);
214  for(int i=1;i<=2;i++){
215  dttpgphbxcomp->setBinLabel(1,"None",i);
216  dttpgphbxcomp->setBinLabel(3,"Only bx=-1",i);
217  dttpgphbxcomp->setBinLabel(4,"Only bx= 0",i);
218  dttpgphbxcomp->setBinLabel(5,"Only bx=+1",i);
219  dttpgphbxcomp->setBinLabel(7,"Bx=-1,0",i);
220  dttpgphbxcomp->setBinLabel(8,"Bx=-1,1",i);
221  dttpgphbxcomp->setBinLabel(9,"Bx= 0,1",i);
222  dttpgphbxcomp->setBinLabel(11,"All bx",i);
223  }
224 
225  dttpgphntrack = dbe->book1D("DT_TPG_phi_ntrack",
226  "DT TPG phi ntrack", 20, -0.5, 19.5 ) ;
227  dttpgthntrack = dbe->book1D("DT_TPG_theta_ntrack",
228  "DT TPG theta ntrack", 20, -0.5, 19.5 ) ;
229 
230  for (int ibx=0 ; ibx<=2; ibx++) {
231 
232  ostringstream bxnum;
233  bxnum << ibx-1;
234  string bxn;
235  if (ibx<2)
236  bxn = bxnum.str();
237  else
238  bxn = "+" + bxnum.str();
239 
240  // Phi
241  dttpgphwheel[ibx] = dbe->book1D("DT_TPG_phi_wheel_number_"+bxn,
242  "DT TPG phi wheel number "+bxn, 5, -2.5, 2.5 ) ;
243  dttpgphsector[ibx] = dbe->book1D("DT_TPG_phi_sector_number_"+bxn,
244  "DT TPG phi sector number "+bxn, 12, -0.5, 11.5 );
245  dttpgphstation[ibx] = dbe->book1D("DT_TPG_phi_station_number_"+bxn,
246  "DT TPG phi station number "+bxn, 5, 0.5, 4.5 ) ;
247 // dttpgphphi[ibx] = dbe->book1D("DT_TPG_phi_"+bxn,
248 // "DT TPG phi "+bxn, 100, -2100., 2100. ) ;
249 // dttpgphphiB[ibx] = dbe->book1D("DT_TPG_phiB_"+bxn,
250 // "DT TPG phiB "+bxn, 100, -550., 550. ) ;
251  dttpgphquality[ibx] = dbe->book1D("DT_TPG_phi_quality_"+bxn,
252  "DT TPG phi quality "+bxn, 8, -0.5, 7.5 ) ;
253  dttpgphts2tag[ibx] = dbe->book1D("DT_TPG_phi_Ts2Tag_"+bxn,
254  "DT TPG phi Ts2Tag "+bxn, 2, -0.5, 1.5 ) ;
255 // dttpgphbxcnt[ibx] = dbe->book1D("DT_TPG_phi_BxCnt_"+bxn,
256 // "DT TPG phi BxCnt "+bxn, 10, -0.5, 9.5 ) ;
257  dttpgphmapbx[ibx] = dbe->book2D("DT_TPG_phi_map_bx"+bxn,
258  "Map of triggers per station (BX="+bxn+")",20,1,21,12,0,12);
260 
261  //Theta
262  dttpgthbx[ibx] = dbe->book1D("DT_TPG_theta_bx_"+bxn,
263  "DT TPG theta bx "+bxn, 50, -24.5, 24.5 ) ;
264  dttpgthwheel[ibx] = dbe->book1D("DT_TPG_theta_wheel_number_"+bxn,
265  "DT TPG theta wheel number "+bxn, 5, -2.5, 2.5 ) ;
266  dttpgthsector[ibx] = dbe->book1D("DT_TPG_theta_sector_number_"+bxn,
267  "DT TPG theta sector number "+bxn, 12, -0.5, 11.5 ) ;
268  dttpgthstation[ibx] = dbe->book1D("DT_TPG_theta_station_number_"+bxn,
269  "DT TPG theta station number "+bxn, 5, -0.5, 4.5 ) ;
270  dttpgththeta[ibx] = dbe->book1D("DT_TPG_theta_"+bxn,
271  "DT TPG theta "+bxn, 20, -0.5, 19.5 ) ;
272  dttpgthquality[ibx] = dbe->book1D("DT_TPG_theta_quality_"+bxn,
273  "DT TPG theta quality "+bxn, 8, -0.5, 7.5 ) ;
274  dttpgthmapbx[ibx] = dbe->book2D("DT_TPG_theta_map_bx_"+bxn,
275  "Map of triggers per station (BX="+bxn+")",15,1,16,12,0,12);
277 
278  // Phi output
279  dttf_p_phi[ibx] = dbe->book1D("dttf_p_phi_"+bxn, "dttf phi output #phi "+bxn, 256,
280  -0.5, 255.5);
281  dttf_p_qual[ibx] = dbe->book1D("dttf_p_qual_"+bxn, "dttf phi output qual "+bxn, 8, -0.5, 7.5);
282  dttf_p_q[ibx] = dbe->book1D("dttf_p_q_"+bxn, "dttf phi output q "+bxn, 2, -0.5, 1.5);
283  dttf_p_pt[ibx] = dbe->book1D("dttf_p_pt_"+bxn, "dttf phi output p_{t} "+bxn, 32, -0.5, 31.5);
284 
285  }
286 
287  dttpgphmap = dbe->book2D("DT_TPG_phi_map",
288  "Map of triggers per station",20,1,21,12,0,12);
289  dttpgphmapcorr = dbe->book2D("DT_TPG_phi_map_corr",
290  "Map of correlated triggers per station",20,1,21,12,0,12);
291  dttpgphmap2nd = dbe->book2D("DT_TPG_phi_map_2nd",
292  "Map of second tracks per station",20,1,21,12,0,12);
293  dttpgphbestmap = dbe->book2D("DT_TPG_phi_best_map",
294  "Map of best triggers per station",20,1,21,12,0,12);
295  dttpgphbestmapcorr = dbe->book2D("DT_TPG_phi_best_map_corr",
296  "Map of correlated best triggers per station",20,1,21,12,0,12);
302 
303 
304 
305  dttpgthmap = dbe->book2D("DT_TPG_theta_map",
306  "Map of triggers per station",15,1,16,12,0,12);
307  dttpgthmaph = dbe->book2D("DT_TPG_theta_map_h",
308  "Map of H quality triggers per station",15,1,16,12,0,12);
309  dttpgthbestmap = dbe->book2D("DT_TPG_theta_best_map",
310  "Map of besttriggers per station",15,1,16,12,0,12);
311  dttpgthbestmaph = dbe->book2D("DT_TPG_theta_best_map_h",
312  "Map of H quality best triggers per station",15,1,16,12,0,12);
317 
318 
319  }
320 
321 }
322 
323 void L1TDTTPG::analyze(const Event& e, const EventSetup& c)
324 {
325 
326  nev_++;
327  if(verbose_) cout << "L1TDTTPG: analyze...." << endl;
328 
329  edm::Handle<L1MuDTChambPhContainer > myL1MuDTChambPhContainer;
330  e.getByToken(dttpgSourcePhContainer_token_,myL1MuDTChambPhContainer);
331 
332  if (!myL1MuDTChambPhContainer.isValid()) {
333  edm::LogInfo("DataNotFound") << "can't find L1MuDTChambPhContainer with label "
334  << dttpgSource_.label() ;
335  return;
336  }
337  L1MuDTChambPhContainer::Phi_Container const *myPhContainer =
338  myL1MuDTChambPhContainer->getContainer();
339 
340  edm::Handle<L1MuDTChambThContainer > myL1MuDTChambThContainer;
341  e.getByToken(dttpgSourceThContainer_token_,myL1MuDTChambThContainer);
342 
343  if (!myL1MuDTChambThContainer.isValid()) {
344  edm::LogInfo("DataNotFound") << "can't find L1MuDTChambThContainer with label "
345  << dttpgSource_.label() ;
346  edm::LogInfo("DataNotFound") << "if this fails try to add DATA to the process name." ;
347 
348  return;
349  }
350  L1MuDTChambThContainer::The_Container const* myThContainer =
351  myL1MuDTChambThContainer->getContainer();
352 
353  int ndttpgphtrack = 0;
354  int ndttpgthtrack = 0;
355  int NumberOfSegmentsPhi[3]={0,0,0};
356 
357  for( L1MuDTChambPhContainer::Phi_Container::const_iterator
358  DTPhDigiItr = myPhContainer->begin() ;
359  DTPhDigiItr != myPhContainer->end() ;
360  ++DTPhDigiItr )
361  {
362  int bx = DTPhDigiItr->bxNum() - DTPhDigiItr->Ts2Tag();
363  if(bx == -1)
364  NumberOfSegmentsPhi[0]++;
365  if(bx == 0)
366  NumberOfSegmentsPhi[1]++;
367  if(bx == 1)
368  NumberOfSegmentsPhi[2]++;
369  }
370  /*Fill Histos for Segment counter for each bx separately */
371 
372  for(int k=0;k<3;k++){
373  dttpgphbx[k+2]->Fill(NumberOfSegmentsPhi[k]);
374  }
375  int bxCounterDttfPhi=0; // = no. of BX's with non-zero data
376  for (int k=0;k<3;k++){
377  if (NumberOfSegmentsPhi[k]>0)
378  bxCounterDttfPhi++;
379  }
380 
381  /* the BX "code" */
382 
383  int bxCodePhi=0;
384  if(bxCounterDttfPhi==0){
385  bxCodePhi=0;
386  }else if(bxCounterDttfPhi==1){
387  for(int k=0;k<3;k++){
388  if(NumberOfSegmentsPhi[k]>0)
389  bxCodePhi=k+2;
390  }
391  }else if(bxCounterDttfPhi==2){
392  for(int k=0;k<3;k++){
393  if(NumberOfSegmentsPhi[k]==0)
394  bxCodePhi=8-k;
395  }
396  }else if(bxCounterDttfPhi==3){
397  bxCodePhi=10;
398  }
399 
400  //The bx analyzer histo
401  dttpgphbx[0]->Fill(bxCodePhi);
402 
403 
404  const L1MuDTChambPhDigi* bestPhQualMap[5][12][4];
405  memset(bestPhQualMap,0,240*sizeof(L1MuDTChambPhDigi*));
406 
407  for( L1MuDTChambPhContainer::Phi_Container::const_iterator
408  DTPhDigiItr = myPhContainer->begin() ;
409  DTPhDigiItr != myPhContainer->end() ;
410  ++DTPhDigiItr )
411  {
412 
413  ndttpgphtrack++;
414 
415  int bxindex = DTPhDigiItr->bxNum() - DTPhDigiItr->Ts2Tag() + 1;
416 
417  dttpgphwheel[bxindex]->Fill(DTPhDigiItr->whNum());
418  if (verbose_)
419  {
420  cout << "DTTPG phi wheel number " << DTPhDigiItr->whNum() << endl;
421  }
422  dttpgphstation[bxindex]->Fill(DTPhDigiItr->stNum());
423  if (verbose_)
424  {
425  cout << "DTTPG phi station number " << DTPhDigiItr->stNum() << endl;
426  }
427  dttpgphsector[bxindex]->Fill(DTPhDigiItr->scNum());
428  if (verbose_)
429  {
430  cout << "DTTPG phi sector number " << DTPhDigiItr->scNum() << endl;
431  }
432 // dttpgphphi[bxindex]->Fill(DTPhDigiItr->phi());
433 // if (verbose_)
434 // {
435 // cout << "DTTPG phi phi " << DTPhDigiItr->phi() << endl;
436 // }
437 // dttpgphphiB[bxindex]->Fill(DTPhDigiItr->phiB());
438 // if (verbose_)
439 // {
440 // cout << "DTTPG phi phiB " << DTPhDigiItr->phiB() << endl;
441 // }
442  dttpgphquality[bxindex]->Fill(DTPhDigiItr->code());
443  if (verbose_)
444  {
445  cout << "DTTPG phi quality " << DTPhDigiItr->code() << endl;
446  }
447  dttpgphts2tag[bxindex]->Fill(DTPhDigiItr->Ts2Tag());
448  if (verbose_)
449  {
450  cout << "DTTPG phi ts2tag " << DTPhDigiItr->Ts2Tag() << endl;
451  }
452 // dttpgphbxcnt[bxindex]->Fill(DTPhDigiItr->BxCnt());
453 // if (verbose_)
454 // {
455 // cout << "DTTPG phi bxcnt " << DTPhDigiItr->BxCnt() << endl;
456 // }
457 
458  int ypos = DTPhDigiItr->scNum();
459  int xpos = DTPhDigiItr->stNum()+4*(DTPhDigiItr->whNum()+2);
460  dttpgphmap->Fill(xpos,ypos);
461  if (DTPhDigiItr->Ts2Tag())
462  dttpgphmap2nd->Fill(xpos,ypos);
463  dttpgphmapbx[bxindex]->Fill(xpos,ypos);
464  if (DTPhDigiItr->code()>3)
465  dttpgphmapcorr->Fill(xpos,ypos);
466 
467  if (bestPhQualMap[DTPhDigiItr->whNum()+2][ DTPhDigiItr->scNum()][DTPhDigiItr->stNum()-1]==0 ||
468  bestPhQualMap[DTPhDigiItr->whNum()+2][ DTPhDigiItr->scNum()][DTPhDigiItr->stNum()-1]->code()<DTPhDigiItr->code())
469  {
470  bestPhQualMap[DTPhDigiItr->whNum()+2][ DTPhDigiItr->scNum()][DTPhDigiItr->stNum()-1]=&(*DTPhDigiItr);
471  }
472 
473  }
474 
475  for (int iwh=0; iwh<5; iwh++){
476  for (int isec=0; isec<12; isec++){
477  for (int ist=0; ist<4; ist++){
478  if (bestPhQualMap[iwh][isec][ist]){
479  int xpos = iwh*4+ist+1;
480  dttpgphbestmap->Fill(xpos,isec);
481  if(bestPhQualMap[iwh][isec][ist]->code()>3)
482  dttpgphbestmapcorr->Fill(xpos,isec);
483  }
484  }
485  }
486  }
487 
488 
489  int bestThQualMap[5][12][3];
490  memset(bestThQualMap,0,180*sizeof(int));
491  //for( vector<L1MuDTChambThDigi>::const_iterator
492  for( L1MuDTChambThContainer::The_Container::const_iterator
493  DTThDigiItr = myThContainer->begin() ;
494  DTThDigiItr != myThContainer->end() ;
495  ++DTThDigiItr )
496  {
497  ndttpgthtrack++;
498 
499  int bxindex = DTThDigiItr->bxNum() + 1;
500 
501  dttpgthwheel[bxindex]->Fill(DTThDigiItr->whNum());
502  if (verbose_)
503  {
504  cout << "DTTPG theta wheel number " << DTThDigiItr->whNum() << endl;
505  }
506  dttpgthstation[bxindex]->Fill(DTThDigiItr->stNum());
507  if (verbose_)
508  {
509  cout << "DTTPG theta station number " << DTThDigiItr->stNum() << endl;
510  }
511  dttpgthsector[bxindex]->Fill(DTThDigiItr->scNum());
512  if (verbose_)
513  {
514  cout << "DTTPG theta sector number " << DTThDigiItr->scNum() << endl;
515  }
516  dttpgthbx[bxindex]->Fill(DTThDigiItr->bxNum());
517  if (verbose_)
518  {
519  cout << "DTTPG theta bx number " << DTThDigiItr->bxNum() << endl;
520  }
521  int thcode[7]= {0,0,0,0,0,0,0};
522  for (int j = 0; j < 7; j++)
523  {
524  dttpgththeta[bxindex]->Fill(DTThDigiItr->position(j));
525  if (verbose_)
526  {
527  cout << "DTTPG theta position " << DTThDigiItr->position(j) << endl;
528  }
529  thcode[j]=DTThDigiItr->code(j);
530  dttpgthquality[bxindex]->Fill(thcode[j]);
531  if (verbose_)
532  {
533  cout << "DTTPG theta quality " << DTThDigiItr->code(j) << endl;
534  }
535  }
536 
537  int ypos = DTThDigiItr->scNum();
538  int xpos = DTThDigiItr->stNum()+4*(DTThDigiItr->whNum()+2);
539  int bestqual=0;
540  dttpgthmap->Fill(xpos,ypos);
541  dttpgthmapbx[bxindex]->Fill(xpos,ypos);
542  for (int pos = 0; pos < 7; pos++){
543  if (thcode[pos]>bestqual)
544  bestqual=thcode[pos];
545  if(thcode[pos]==2)
546  dttpgthmaph->Fill(xpos,ypos);
547  }
548 
549  if (bestThQualMap[DTThDigiItr->whNum()+2][ DTThDigiItr->scNum()][DTThDigiItr->stNum()-1] < bestqual)
550  {
551  bestThQualMap[DTThDigiItr->whNum()+2][ DTThDigiItr->scNum()][DTThDigiItr->stNum()-1]=bestqual;
552  }
553  }
554 
555  for (int iwh=0; iwh<5; iwh++){
556  for (int isec=0; isec<12; isec++){
557  for (int ist=0; ist<3; ist++){
558  if (bestThQualMap[iwh][isec][ist]){
559  int xpos = iwh*4+ist+1;
560  dttpgthbestmap->Fill(xpos,isec);
561  if(bestThQualMap[iwh][isec][ist]==2)
562  dttpgthbestmaph->Fill(xpos,isec);
563  }
564  }
565  }
566  }
567 
568 
569  dttpgphntrack->Fill(ndttpgphtrack);
570  if (verbose_)
571  {
572  cout << "DTTPG phi ntrack " << ndttpgphtrack << endl;
573  }
574  dttpgthntrack->Fill(ndttpgthtrack);
575  if (verbose_) {
576  cout << "DTTPG theta ntrack " << ndttpgthtrack << endl;
577  }
578 
579  edm::Handle<L1MuDTTrackContainer > myL1MuDTTrackContainer;
580  e.getByToken(trToken_,myL1MuDTTrackContainer);
581 
582  if (!myL1MuDTTrackContainer.isValid()) {
583  edm::LogInfo("DataNotFound") << "can't find L1MuDTTrackContainer with label "
584  << dttpgSource_.label() ;
585  return;
586  }
587 
588  L1MuDTTrackContainer::TrackContainer const * t = myL1MuDTTrackContainer->getContainer();
589 
590 
591 
592  int NumberOfSegmentsOut[3]={0,0,0};
593  for ( L1MuDTTrackContainer::TrackContainer::const_iterator i
594  = t->begin(); i != t->end(); ++i ) {
595  if(i->bx() ==-1)
596  NumberOfSegmentsOut[0]++;
597  if(i->bx() ==0)
598  NumberOfSegmentsOut[1]++;
599  if(i->bx() ==1)
600  NumberOfSegmentsOut[2]++;
601  }
602 
603 
604  /*Fill Histos for Segment counter*/
605  for(int k=0;k<3;k++){
606  dttpgphbx[k+5]->Fill(NumberOfSegmentsOut[k]);
607  }
608 
609  /*Bunch assigments*/
610 
611  int bxCounterDttfOut=0;
612  for (int k=0;k<3;k++){
613  if (NumberOfSegmentsOut[k]>0)
614  bxCounterDttfOut++;
615  }
616 
617  int bxCodeOut=0;
618  if(bxCounterDttfOut==0){
619  bxCodeOut=0;
620  }else if(bxCounterDttfOut==1){
621  for(int k=0;k<3;k++){
622  if(NumberOfSegmentsOut[k]>0)
623  bxCodeOut=k+2;
624  }
625  }else if(bxCounterDttfOut==2){
626  for(int k=0;k<3;k++){
627  if(NumberOfSegmentsOut[k]==0)
628  bxCodeOut=8-k;
629  }
630  }else if(bxCounterDttfOut==3){
631  bxCodeOut=10;
632  }
633 
634  //The bx analyzer histo
635  dttpgphbx[1]->Fill(bxCodeOut);
636 
637  /*End Dttf Output Bunch analysis*/
638 
639  // the 2-DIM histo with phi.input vs. output
640  dttpgphbxcomp->Fill(bxCodePhi,bxCodeOut);
641 
642 
643  for ( L1MuDTTrackContainer::TrackContainer::const_iterator i
644  = t->begin(); i != t->end(); ++i ) {
645  if ( verbose_ ) {
646  std::cout << "bx = " << i->bx()
647  << std::endl;
648  std::cout << "quality (packed) = " << i->quality_packed()
649  << std::endl;
650  std::cout << "pt (packed) = " << i->pt_packed()
651  << std::endl;
652  std::cout << "phi (packed) = " << i->phi_packed()
653  << std::endl;
654  std::cout << "charge (packed) = " << i->charge_packed()
655  << std::endl;
656  }
657 
658 
659  int bxindex = i->bx() + 1;
660  dttf_p_phi[bxindex]->Fill(i->phi_packed());
661  dttf_p_qual[bxindex]->Fill(i->quality_packed());
662  dttf_p_pt[bxindex]->Fill(i->pt_packed());
663  dttf_p_q[bxindex]->Fill(i->charge_packed());
664  }
665 
666 }
667 
669 {
670 
671  me->setAxisTitle("DTTF Sector",2);
672  for(int i=0;i<5;i++){
673  ostringstream wheel;
674  wheel << i-2;
675  me->setBinLabel(1+i*4,"Wheel "+ wheel.str(),1);
676  }
677 
678 }
679 
681 {
682 
683  me->setAxisTitle("DTTF Sector",2);
684  for(int i=0;i<5;i++){
685  ostringstream wheel;
686  wheel << i-2;
687  me->setBinLabel(1+i*3,"Wheel "+ wheel.str(),1);
688  }
689 
690 }
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TDTTPG.cc:323
void beginJob(void)
Definition: L1TDTTPG.cc:136
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * dttpgthbestmaph
Definition: L1TDTTPG.h:99
MonitorElement * dttf_p_phi[3]
Definition: L1TDTTPG.h:101
L1TDTTPG(const edm::ParameterSet &ps)
Definition: L1TDTTPG.cc:93
MonitorElement * dttpgphmap
Definition: L1TDTTPG.h:80
MonitorElement * dttpgphbestmapcorr
Definition: L1TDTTPG.h:85
MonitorElement * dttpgphmapcorr
Definition: L1TDTTPG.h:83
void setMapPhLabel(MonitorElement *me)
Definition: L1TDTTPG.cc:668
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
MonitorElement * dttpgphbx[8]
Definition: L1TDTTPG.h:69
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
int nev_
Definition: L1TDTTPG.h:106
edm::EDGetTokenT< L1MuDTChambThContainer > dttpgSourceThContainer_token_
Definition: L1TDTTPG.h:112
MonitorElement * dttpgththeta[3]
Definition: L1TDTTPG.h:92
DQMStore * dbe
Definition: L1TDTTPG.h:67
MonitorElement * dttpgphwheel[3]
Definition: L1TDTTPG.h:71
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
virtual ~L1TDTTPG()
Definition: L1TDTTPG.cc:132
#define NULL
Definition: scimark2.h:8
MonitorElement * dttpgthbestmap
Definition: L1TDTTPG.h:98
MonitorElement * dttpgphbxcomp
Definition: L1TDTTPG.h:70
edm::EDGetTokenT< L1MuDTTrackContainer > trToken_
Definition: L1TDTTPG.h:116
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup)
Definition: L1TDTTPG.cc:152
MonitorElement * dttpgthmaph
Definition: L1TDTTPG.h:97
void Fill(long long x)
MonitorElement * dttpgthsector[3]
Definition: L1TDTTPG.h:90
MonitorElement * dttpgthmapbx[3]
Definition: L1TDTTPG.h:96
MonitorElement * dttpgthwheel[3]
Definition: L1TDTTPG.h:89
std::string outputFile_
Definition: L1TDTTPG.h:107
MonitorElement * dttpgthmap
Definition: L1TDTTPG.h:95
void endJob(void)
Definition: L1TDTTPG.cc:142
std::vector< L1MuDTTrackCand > TrackContainer
MonitorElement * dttf_p_qual[3]
Definition: L1TDTTPG.h:104
int j
Definition: DBlmapReader.cc:9
MonitorElement * dttpgthbx[3]
Definition: L1TDTTPG.h:88
MonitorElement * dttpgthquality[3]
Definition: L1TDTTPG.h:93
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
std::vector< L1MuDTChambPhDigi > Phi_Container
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
MonitorElement * dttf_p_pt[3]
Definition: L1TDTTPG.h:102
std::vector< L1MuDTChambThDigi > The_Container
bool isValid() const
Definition: HandleBase.h:76
int k[5][pyjets_maxn]
MonitorElement * dttpgphbestmap
Definition: L1TDTTPG.h:84
MonitorElement * dttpgthntrack
Definition: L1TDTTPG.h:94
edm::InputTag dttpgSource_
Definition: L1TDTTPG.h:113
MonitorElement * dttpgphts2tag[3]
Definition: L1TDTTPG.h:77
MonitorElement * dttpgphntrack
Definition: L1TDTTPG.h:79
edm::EDGetTokenT< L1MuDTChambPhContainer > dttpgSourcePhContainer_token_
Definition: L1TDTTPG.h:111
MonitorElement * dttf_p_q[3]
Definition: L1TDTTPG.h:103
void setMapThLabel(MonitorElement *me)
Definition: L1TDTTPG.cc:680
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
std::string trstring_
Definition: L1TDTTPG.h:115
MonitorElement * dttpgphmapbx[3]
Definition: L1TDTTPG.h:81
tuple cout
Definition: gather_cfg.py:121
bool verbose_
Definition: L1TDTTPG.h:108
MonitorElement * dttpgthstation[3]
Definition: L1TDTTPG.h:91
MonitorElement * dttpgphsector[3]
Definition: L1TDTTPG.h:72
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * dttpgphquality[3]
Definition: L1TDTTPG.h:76
MonitorElement * dttpgphmap2nd
Definition: L1TDTTPG.h:82
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
MonitorElement * dttpgphstation[3]
Definition: L1TDTTPG.h:73