CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TCSCTPG.cc
Go to the documentation of this file.
1 /*
2  * \file L1TCSCTPG.cc
3  *
4  * \author J. Berryhill
5  *
6  */
7 
9 
10 using namespace std;
11 using namespace edm;
12 
14  : csctpgSource_( ps.getParameter< InputTag >("csctpgSource") ),
15  csctpgSource_token_( consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter< InputTag >("csctpgSource") ))
16 {
17 
18  // verbosity switch
19  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
20 
21  if(verbose_) cout << "L1TCSCTPG: constructor...." << endl;
22 
23 
24  dbe = NULL;
25  if ( ps.getUntrackedParameter<bool>("DQMStore", false) )
26  {
28  dbe->setVerbose(0);
29  }
30 
31  outputFile_ = ps.getUntrackedParameter<string>("outputFile", "");
32  if ( outputFile_.size() != 0 ) {
33  cout << "L1T Monitoring histograms will be saved to " << outputFile_.c_str() << endl;
34  }
35 
36  bool disable = ps.getUntrackedParameter<bool>("disableROOToutput", false);
37  if(disable){
38  outputFile_="";
39  }
40 
41 
42  if ( dbe !=NULL ) {
43  dbe->setCurrentFolder("L1T/L1TCSCTPG");
44  }
45 
46 
47 }
48 
50 {
51 }
52 
54 {
55  nev_ = 0;
56 }
57 
58 void L1TCSCTPG::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup)
59 {
60  if ( dbe ) {
61  dbe->setCurrentFolder("L1T/L1TCSCTPG");
62  dbe->rmdir("L1T/L1TCSCTPG");
63  }
64 
65 
66  if ( dbe )
67  {
68  dbe->setCurrentFolder("L1T/L1TCSCTPG");
69 
70  csctpgpattern = dbe->book1D("CSC TPG hit pattern",
71  "CSC TPG hit pattern", 8, -0.5, 7.5 ) ;
72  csctpgquality = dbe->book1D("CSC TPG quality",
73  "CSC TPG quality", 16, 0.5, 16.5 ) ;
74  csctpgwg = dbe->book1D("CSC TPG wire group",
75  "CSC TPG wire group", 116, -0.5, 115.5 ) ;
76  csctpgstrip = dbe->book1D("CSC TPG strip",
77  "CSC TPG strip", 160, -0.5, 159.5 ) ;
78  csctpgstriptype = dbe->book1D("CSC TPG strip type",
79  "CSC TPG strip type", 2, 0.5, 1.5 ) ;
80  csctpgbend = dbe->book1D("CSC TPG bend",
81  "CSC TPG bend", 3, 0.5, 2.5 ) ;
82  csctpgbx = dbe->book1D("CSC TPG bx",
83  "CSC TPG bx", 20, -0.5, 19.5 ) ;
84 
85 
86  }
87 }
88 
89 
90 
91 
93 {
94  if(verbose_) cout << "L1TCSCTPG: end job...." << endl;
95  LogInfo("EndJob") << "analyzed " << nev_ << " events";
96 
97  if ( outputFile_.size() != 0 && dbe ) dbe->save(outputFile_);
98 
99  return;
100 }
101 
102 void L1TCSCTPG::analyze(const Event& e, const EventSetup& c)
103 {
104  nev_++;
105  if(verbose_) cout << "L1TCSCTPG: analyze...." << endl;
106 
107 
109  e.getByToken(csctpgSource_token_,pCSCTPGcorrlcts);
110 
111  if (!pCSCTPGcorrlcts.isValid()) {
112  edm::LogInfo("DataNotFound") << "can't find CSCCorrelatedLCTDigiCollection with label "
113  << csctpgSource_.label() ;
114  return;
115  }
116 
117 
118  for (CSCCorrelatedLCTDigiCollection::DigiRangeIterator cscItr1 = pCSCTPGcorrlcts->begin();
119  cscItr1 != pCSCTPGcorrlcts->end();
120  cscItr1++)
121  {
122  CSCCorrelatedLCTDigiCollection::Range range1 = pCSCTPGcorrlcts->get((*cscItr1).first);
123  for (CSCCorrelatedLCTDigiCollection::const_iterator lctItr1 = range1.first;
124  lctItr1 != range1.second;
125  lctItr1++)
126  {
127 
128 
129  csctpgpattern->Fill(lctItr1->getCLCTPattern());
130  if (verbose_)
131  {
132  std::cout << "CSC TPG CLCT pattern " << lctItr1->getCLCTPattern()
133  << std::endl;
134  }
135 
136  csctpgquality->Fill(lctItr1->getQuality());
137  if (verbose_)
138  {
139  std::cout << "CSC LCT quality " << lctItr1->getQuality()
140  << std::endl;
141  }
142 
143  csctpgwg->Fill(lctItr1->getKeyWG());
144  if (verbose_)
145  {
146  std::cout << "CSC LCT wire group " << lctItr1->getKeyWG()
147  << std::endl;
148  }
149 
150  csctpgstrip->Fill(lctItr1->getStrip());
151  if (verbose_)
152  {
153  std::cout << "CSC LCT strip " << lctItr1->getStrip()
154  << std::endl;
155  }
156 
157  csctpgstriptype->Fill(lctItr1->getStripType());
158  if (verbose_)
159  {
160  std::cout << "CSC LCT strip type" << lctItr1->getStripType()
161  << std::endl;
162  }
163 
164  csctpgbend->Fill(lctItr1->getBend());
165  if (verbose_)
166  {
167  std::cout << "CSC LCT bend " << lctItr1->getBend()
168  << std::endl;
169  }
170 
171  csctpgbx->Fill(lctItr1->getBX());
172  if (verbose_)
173  {
174  std::cout << "CSC LCT bx " << lctItr1->getBX()
175  << std::endl;
176  }
177 
178  }
179  }
180 
181 
182 
183 }
184 
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * csctpgwg
Definition: L1TCSCTPG.h:70
L1TCSCTPG(const edm::ParameterSet &ps)
Definition: L1TCSCTPG.cc:13
void beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup)
Definition: L1TCSCTPG.cc:58
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3101
MonitorElement * csctpgstrip
Definition: L1TCSCTPG.h:71
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
#define NULL
Definition: scimark2.h:8
void endJob(void)
Definition: L1TCSCTPG.cc:92
void Fill(long long x)
edm::InputTag csctpgSource_
Definition: L1TCSCTPG.h:81
MonitorElement * csctpgbend
Definition: L1TCSCTPG.h:73
void setVerbose(unsigned level)
Definition: DQMStore.cc:631
bool isValid() const
Definition: HandleBase.h:76
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TCSCTPG.cc:102
MonitorElement * csctpgbx
Definition: L1TCSCTPG.h:74
int nev_
Definition: L1TCSCTPG.h:76
virtual ~L1TCSCTPG()
Definition: L1TCSCTPG.cc:49
DQMStore * dbe
Definition: L1TCSCTPG.h:66
MonitorElement * csctpgquality
Definition: L1TCSCTPG.h:69
std::vector< CSCCorrelatedLCTDigi >::const_iterator const_iterator
std::string const & label() const
Definition: InputTag.h:42
void beginJob(void)
Definition: L1TCSCTPG.cc:53
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2540
bool verbose_
Definition: L1TCSCTPG.h:78
std::pair< const_iterator, const_iterator > Range
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > csctpgSource_token_
Definition: L1TCSCTPG.h:82
MonitorElement * csctpgstriptype
Definition: L1TCSCTPG.h:72
std::string outputFile_
Definition: L1TCSCTPG.h:77
MonitorElement * csctpgpattern
Definition: L1TCSCTPG.h:68
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
Definition: Run.h:41