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