CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TLTC.cc
Go to the documentation of this file.
1 /*
2  * \file L1TLTC.cc
3  *
4  * $Date: 2009/11/19 14:39:37 $
5  * $Revision: 1.10 $
6  * \author J. Berryhill
7  *
8  */
9 
12 
13 using namespace std;
14 using namespace edm;
15 
17  {
18 
19  // verbosity switch
20  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
21 
22  if(verbose_) cout << "L1TLTC: constructor...." << endl;
23 
24 
25  dbe = NULL;
26  if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
27  {
28  dbe = Service<DQMStore>().operator->();
29  dbe->setVerbose(0);
30  }
31 
32  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
33  if ( outputFile_.size() != 0 ) {
34  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
35  }
36 
37  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
38  if(disable){
39  outputFile_="";
40  }
41 
42 
43  if ( dbe !=NULL ) {
44  dbe->setCurrentFolder("L1T/L1TLTC");
45  }
46 
47 
48 }
49 
51 {
52 }
53 
54 void L1TLTC::beginJob(void)
55 {
56 
57  nev_ = 0;
58 
59  // get hold of back-end interface
60  DQMStore* dbe = 0;
61  dbe = Service<DQMStore>().operator->();
62 
63  if ( dbe ) {
64  dbe->setCurrentFolder("L1T/L1TLTC");
65  dbe->rmdir("L1T/L1TLTC");
66  }
67 
68 
69  if ( dbe )
70  {
71  dbe->setCurrentFolder("L1T/L1TLTC");
72  h1 = dbe->book1D("Bunch", "Bunch Number", 100, -0.5, 5000.) ;
73  h2 = dbe->book1D("Orbit", "Orbit Number", 100, -0.5, 100000. ) ;
74  h3 = dbe->book1D("Triggers", "Triggers", 8, -0.5, 7.5 ) ;
75 
76  overlaps = dbe->book2D("olaps", "Trigger Overlaps", 8, -0.5, 7.5 ,
77  8, -0.5, 7.5);
78 
79  n_inhibit = dbe->bookInt("n_inhibit");
80  run = dbe->bookInt("run");
81  event = dbe->bookInt("event");
82  gps_time = dbe->bookInt("gps_time");
83  }
84 }
85 
86 
87 void L1TLTC::endJob(void)
88 {
89  if(verbose_) cout << "L1TLTC: end job...." << endl;
90  LogInfo("EndJob") << "analyzed " << nev_ << " events";
91 
92  if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
93 
94  return;
95 }
96 
97 void L1TLTC::analyze(const Event& e, const EventSetup& c)
98 {
99  nev_++;
100  if(verbose_) cout << "L1TLTC: analyze...." << endl;
102  e.getByType(digis);
103 
104  if (!digis.isValid()) {
105  edm::LogInfo("DataNotFound") << "can't find LTCDigiCollection ";
106  return;
107  }
108 
109  for( LTCDigiCollection::const_iterator digiItr = digis->begin() ;
110  digiItr != digis->end() ;
111  ++digiItr )
112  {
113  h1->Fill( digiItr->bunchNumber() ) ;
114  h2->Fill( digiItr->orbitNumber() ) ;
115 
116  for( int i = 0 ; i < 6 ; ++i ) {
117  h3->Fill( i, ( digiItr->HasTriggered( i ) ? 1 : 0 ) ) ;
118  }
119 
120  h3->Fill( 6, digiItr->ramTrigger() ) ;
121  h3->Fill( 7, digiItr->vmeTrigger() ) ;
122  // overlaps
123  unsigned int setbits = digiItr->externTriggerMask();
124  // mock up the VME and RAM triggers
125  if ( digiItr->ramTrigger() ) {
126  setbits |= (0x1UL<<7);
127  }
128  if ( digiItr->vmeTrigger() ) {
129  setbits |= (0x1UL<<8);
130  }
131  for ( int i = 0; i < 8; ++i ) {
132  if ( setbits & (0x1UL<<i) ) {
133  for ( int j = i; j < 8; ++j ) {
134  if ( setbits & (0x1UL<<j) ) {
135  overlaps->Fill(i,j); // do both....
136  overlaps->Fill(j,i);
137  }
138  }
139  }
140  }
141  // fill floats and ints
142  n_inhibit->Fill(digiItr->triggerInhibitNumber());
143  run ->Fill(digiItr->runNumber());
144  event ->Fill(digiItr->eventNumber());
145  gps_time ->Fill(digiItr->bstGpsTime());
146  }
147 
148 }
149 
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
#define NULL
Definition: scimark2.h:8
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TLTC.cc:97
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
L1TLTC(const edm::ParameterSet &ps)
Definition: L1TLTC.cc:16
void beginJob(void)
Definition: L1TLTC.cc:54
int j
Definition: DBlmapReader.cc:9
bool isValid() const
Definition: HandleBase.h:76
tuple cout
Definition: gather_cfg.py:121
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
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:845
void endJob(void)
Definition: L1TLTC.cc:87
virtual ~L1TLTC()
Definition: L1TLTC.cc:50
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429