CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TECALTPG.cc
Go to the documentation of this file.
1 /*
2  * \file L1TECALTPG.cc
3  *
4  * $Date: 2008/03/20 19:38:25 $
5  * $Revision: 1.13 $
6  * \author J. Berryhill
7  *
8  * - initial version stolen from GCTMonnitor (thanks!) (wittich 02/07)
9  *
10  * $Log: L1TECALTPG.cc,v $
11  * Revision 1.13 2008/03/20 19:38:25 berryhil
12  *
13  *
14  * organized message logger
15  *
16  * Revision 1.12 2008/03/18 20:31:20 berryhil
17  *
18  *
19  * update of ecal tpg dqm
20  *
21  * Revision 1.11 2008/03/14 20:35:46 berryhil
22  *
23  *
24  * stripped out obsolete parameter settings
25  *
26  * rpc tpg restored with correct dn access and dbe handling
27  *
28  * Revision 1.10 2008/03/12 17:24:24 berryhil
29  *
30  *
31  * eliminated log files, truncated HCALTPGXana histo output
32  *
33  * Revision 1.9 2008/03/01 00:40:00 lat
34  * DQM core migration.
35  *
36  * Revision 1.8 2007/12/21 17:41:20 berryhil
37  *
38  *
39  * try/catch removal
40  *
41  * Revision 1.7 2007/11/19 15:08:22 lorenzo
42  * changed top folder name
43  *
44  * Revision 1.6 2007/08/29 14:02:47 wittich
45  * split into barrel and endcap
46  *
47  * Revision 1.5 2007/05/25 15:45:48 berryhil
48  *
49  *
50  *
51  * added exception handling for each edm Handle
52  * updated cfg and cff to reflect recent usage at point 5
53  *
54  * Revision 1.4 2007/02/22 19:43:53 berryhil
55  *
56  *
57  *
58  * InputTag parameters added for all modules
59  *
60  * Revision 1.3 2007/02/20 22:49:00 wittich
61  * - change from getByType to getByLabel in ECAL TPG,
62  * and make it configurable.
63  * - fix problem in the GCT with incorrect labels. Not the ultimate
64  * solution - will probably have to go to many labels.
65  *
66  * Revision 1.2 2007/02/19 22:07:26 wittich
67  * - Added three monitorables to the ECAL TPG monitoring (from GCTMonitor)
68  * - other minor tweaks in GCT, etc
69  *
70  */
71 
73 
76 
77 // end of header files
78 using namespace edm;
79 
80 // Local definitions for the limits of the histograms
81 const unsigned int RTPBINS = 101;
82 const float RTPMIN = -0.5;
83 const float RTPMAX = 100.5;
84 
85 const unsigned int TPPHIBINS = 72;
86 const float TPPHIMIN = 0.5;
87 const float TPPHIMAX = 72.5;
88 
89 const unsigned int TPETABINS = 65;
90 const float TPETAMIN = -32.5;
91 const float TPETAMAX = 32.5;
92 
93 
95  ecaltpgSourceB_(ps.getParameter<edm::InputTag>("ecaltpgSourceB")),
96  ecaltpgSourceE_(ps.getParameter<edm::InputTag>("ecaltpgSourceE"))
97 {
98 
99  // verbosity switch
100  verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
101 
102  // ecal endcap switch
103  enableEE_ = ps.getUntrackedParameter < bool > ("enableEE", false);
104 
105  if (verbose_)
106  std::cout << "L1TECALTPG: constructor...." << std::endl;
107 
108 
109  dbe = NULL;
110  if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
112  dbe->setVerbose(0);
113  }
114 
115  outputFile_ =
116  ps.getUntrackedParameter < std::string > ("outputFile", "");
117  if (outputFile_.size() != 0) {
118  std::cout << "L1T Monitoring histograms will be saved to "
119  << outputFile_ << std::endl;
120  }
121 
122  bool disable =
123  ps.getUntrackedParameter < bool > ("disableROOToutput", false);
124  if (disable) {
125  outputFile_ = "";
126  }
127 
128 
129  if (dbe != NULL) {
130  dbe->setCurrentFolder("L1T/L1TECALTPG");
131  }
132 
133 
134 }
135 
137 {
138 }
139 
141 {
142 
143  nev_ = 0;
144 
145  // get hold of back-end interface
146  DQMStore *dbe = 0;
147  dbe = Service < DQMStore > ().operator->();
148 
149  if (dbe) {
150  dbe->setCurrentFolder("L1T/L1TECALTPG");
151  dbe->rmdir("L1T/L1TECALTPG");
152  }
153 
154 
155  if (dbe) {
156  dbe->setCurrentFolder("L1T/L1TECALTPG");
158  dbe->book2D("EcalTpEtEtaPhiB", "ECAL TP E_{T} Barrel", TPPHIBINS,
161  dbe->book2D("EcalTpOccEtaPhiB", "ECAL TP OCCUPANCY Barrel", TPPHIBINS,
163  ecalTpRankB_ =
164  dbe->book1D("EcalTpRankB", "ECAL TP RANK Barrel", RTPBINS, RTPMIN,
165  RTPMAX);
166 
168  dbe->book2D("EcalTpEtEtaPhiE", "ECAL TP E_{T} Endcap", TPPHIBINS,
171  dbe->book2D("EcalTpOccEtaPhiE", "ECAL TP OCCUPANCY Endcap", TPPHIBINS,
173  ecalTpRankE_ =
174  dbe->book1D("EcalTpRankE", "ECAL TP RANK Endcap", RTPBINS, RTPMIN,
175  RTPMAX);
176 
177  }
178 }
179 
180 
182 {
183  if (verbose_)
184  std::cout << "L1TECALTPG: end job...." << std::endl;
185  LogInfo("EndJob") << "analyzed " << nev_ << " events";
186 
187  if (outputFile_.size() != 0 && dbe)
188  dbe->save(outputFile_);
189 
190  return;
191 }
192 
193 void L1TECALTPG::analyze(const Event & e, const EventSetup & c)
194 {
195  nev_++;
196  if (verbose_) {
197  std::cout << "L1TECALTPG: analyze...." << std::endl;
198  }
199 
200  // Get the ECAL TPGs
203  // e.getByType(ebTP);
204  e.getByLabel(ecaltpgSourceB_,ebTP);
205  e.getByLabel(ecaltpgSourceE_,eeTP);
206 
207  if (!eeTP.isValid() && enableEE_)
208  {
209  edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
210  " endcap label " << ecaltpgSourceE_.label() ;
211  return;
212  }
213  if (!ebTP.isValid())
214  {
215  edm::LogInfo("DataNotFound") << "can't find EcalTrigPrimCollection with "
216  " barrel label " << ecaltpgSourceB_.label() ;
217  return;
218  }
219 
220  // Fill the ECAL TPG histograms
221  if ( verbose_ ) {
222  std::cout << "L1TECALTPG: barrel size is " << ebTP->size() << std::endl;
223  std::cout << "L1TECALTPG: endcap size is " << eeTP->size() << std::endl;
224  }
225 
226  for (EcalTrigPrimDigiCollection::const_iterator iebTP = ebTP->begin();
227  iebTP != ebTP->end(); iebTP++) {
228  if ( verbose_ ) {
229  std::cout << "barrel: " << iebTP->id().iphi() << ", "
230  << iebTP->id().ieta()
231  << std::endl;
232  }
233  ecalTpEtEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta(),
234  iebTP->compressedEt());
235  ecalTpOccEtaPhiB_->Fill(iebTP->id().iphi(), iebTP->id().ieta());
236  ecalTpRankB_->Fill(iebTP->compressedEt());
237 
238  }
239 
240  if (enableEE_){
241  // endcap
242  for (EcalTrigPrimDigiCollection::const_iterator ieeTP = eeTP->begin();
243  ieeTP != eeTP->end(); ieeTP++) {
244  if ( verbose_ ) {
245  std::cout << "endcap: " << ieeTP->id().iphi() << ", "
246  << ieeTP->id().ieta()
247  << std::endl;
248  }
249  ecalTpEtEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta(),
250  ieeTP->compressedEt());
251  ecalTpOccEtaPhiE_->Fill(ieeTP->id().iphi(), ieeTP->id().ieta());
252  ecalTpRankE_->Fill(ieeTP->compressedEt());
253 
254  }
255  }
256 
257 }
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TECALTPG.cc:193
MonitorElement * ecalTpEtEtaPhiB_
Definition: L1TECALTPG.h:94
const unsigned int RTPBINS
Definition: L1TECALTPG.cc:81
MonitorElement * ecalTpEtEtaPhiE_
Definition: L1TECALTPG.h:98
T getUntrackedParameter(std::string const &, T const &) const
const float TPETAMIN
Definition: L1TCompare.cc:111
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2311
L1TECALTPG(const edm::ParameterSet &ps)
Definition: L1TECALTPG.cc:94
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:1898
bool verbose_
Definition: L1TECALTPG.h:104
std::vector< T >::const_iterator const_iterator
const unsigned int TPPHIBINS
Definition: L1TCompare.cc:106
const float RTPMIN
Definition: L1TECALTPG.cc:82
#define NULL
Definition: scimark2.h:8
edm::InputTag ecaltpgSourceB_
Definition: L1TECALTPG.h:109
MonitorElement * ecalTpRankE_
Definition: L1TECALTPG.h:100
bool enableEE_
Definition: L1TECALTPG.h:105
void Fill(long long x)
const float TPETAMAX
Definition: L1TCompare.cc:112
const unsigned int TPETABINS
Definition: L1TCompare.cc:110
void beginJob(void)
Definition: L1TECALTPG.cc:140
void endJob(void)
Definition: L1TECALTPG.cc:181
const float RTPMAX
Definition: L1TECALTPG.cc:83
MonitorElement * ecalTpRankB_
Definition: L1TECALTPG.h:96
void setVerbose(unsigned level)
Definition: DQMStore.cc:196
MonitorElement * ecalTpOccEtaPhiB_
Definition: L1TECALTPG.h:95
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
const float TPPHIMIN
Definition: L1TCompare.cc:107
DQMStore * dbe
Definition: L1TECALTPG.h:91
const float TPPHIMAX
Definition: L1TCompare.cc:108
std::string outputFile_
Definition: L1TECALTPG.h:103
std::string const & label() const
Definition: InputTag.h:25
MonitorElement * ecalTpOccEtaPhiE_
Definition: L1TECALTPG.h:99
virtual ~L1TECALTPG()
Definition: L1TECALTPG.cc:136
tuple cout
Definition: gather_cfg.py:41
edm::InputTag ecaltpgSourceE_
Definition: L1TECALTPG.h:110
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:642
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232