CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TRCT.cc
Go to the documentation of this file.
1 /*
2  * \file L1TRCT.cc
3  *
4  * $Date: 2009/07/22 19:40:29 $
5  * $Revision: 1.17 $
6  * \author P. Wittich
7  *
8  */
9 
11 
12 // GCT and RCT data formats
15 
16 
17 
18 
19 using namespace edm;
20 
21 const unsigned int PHIBINS = 18;
22 const float PHIMIN = -0.5;
23 const float PHIMAX = 17.5;
24 
25 // Ranks 6, 10 and 12 bits
26 const unsigned int R6BINS = 64;
27 const float R6MIN = -0.5;
28 const float R6MAX = 63.5;
29 const unsigned int R10BINS = 1024;
30 const float R10MIN = -0.5;
31 const float R10MAX = 1023.5;
32 const unsigned int R12BINS = 4096;
33 const float R12MIN = -0.5;
34 const float R12MAX = 4095.5;
35 
36 const unsigned int ETABINS = 22;
37 const float ETAMIN = -0.5;
38 const float ETAMAX = 21.5;
39 
40 
41 
43  rctSource_( ps.getParameter< InputTag >("rctSource") )
44 
45 {
46 
47  // verbosity switch
48  verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
49 
50  if (verbose_)
51  std::cout << "L1TRCT: constructor...." << std::endl;
52 
53 
54  dbe = NULL;
55  if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
57  dbe->setVerbose(0);
58  }
59 
60  outputFile_ =
61  ps.getUntrackedParameter < std::string > ("outputFile", "");
62  if (outputFile_.size() != 0) {
63  std::
64  cout << "L1T Monitoring histograms will be saved to " <<
65  outputFile_.c_str() << std::endl;
66  }
67 
68  bool disable =
69  ps.getUntrackedParameter < bool > ("disableROOToutput", false);
70  if (disable) {
71  outputFile_ = "";
72  }
73 
74 
75  if (dbe != NULL) {
76  dbe->setCurrentFolder("L1T/L1TRCT");
77  }
78 
79 
80 }
81 
83 {
84 }
85 
86 void L1TRCT::beginJob(void)
87 {
88 
89 
90  nev_ = 0;
91 
92  // get hold of back-end interface
93  DQMStore *dbe = 0;
94  dbe = Service < DQMStore > ().operator->();
95 
96  if (dbe) {
97  dbe->setCurrentFolder("L1T/L1TRCT");
98  dbe->rmdir("L1T/L1TRCT");
99  }
100 
101 
102  if (dbe) {
103  dbe->setCurrentFolder("L1T/L1TRCT");
104 
106  dbe->book2D("RctEmIsoEmEtEtaPhi", "ISO EM E_{T}", ETABINS, ETAMIN,
109  dbe->book2D("RctEmIsoEmOccEtaPhi", "ISO EM OCCUPANCY", ETABINS,
112  dbe->book2D("RctEmNonIsoEmEtEtaPhi", "NON-ISO EM E_{T}", ETABINS,
115  dbe->book2D("RctEmNonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY",
117 
118  // global regions
120  dbe->book2D("RctRegionsEtEtaPhi", "REGION E_{T}", ETABINS, ETAMIN,
123  dbe->book2D("RctRegionsOccEtaPhi", "REGION OCCUPANCY", ETABINS,
125 
127  dbe->book2D("RctBitOverFlowEtaPhi", "OVER FLOW OCCUPANCY", ETABINS,
129 
131  dbe->book2D("RctBitTauVetoEtaPhi", "TAU VETO OCCUPANCY", ETABINS,
133 
134  rctMipEtaPhi_ =
135  dbe->book2D("RctBitMipEtaPhi", "MIP OCCUPANCY", ETABINS,
137 
139  dbe->book2D("RctBitQuietEtaPhi", "QUIET OCCUPANCY", ETABINS,
141 
143  dbe->book2D("RctBitHfPlusTauEtaPhi", "HF plus Tau OCCUPANCY", ETABINS,
145 
146  // local regions
147 /*
148  const int nlocphibins = 2;
149  const float locphimin = -0.5;
150  const float locphimax = 1.5;
151  const int nlocetabins = 11;
152  const float locetamin = -0.5;
153  const float locetamax = 10.5;
154  rctRegionsLocalEtEtaPhi_ =
155  dbe->book2D("RctRegionsLocalEtEtaPhi", "REGION E_{T} (Local)",
156  nlocetabins, locetamin, locetamax,
157  nlocphibins, locphimin, locphimax);
158  rctRegionsLocalOccEtaPhi_ =
159  dbe->book2D("RctRegionsLocalOccEtaPhi", "REGION OCCUPANCY (Local)",
160  nlocetabins, locetamin, locetamax,
161  nlocphibins, locphimin, locphimax);
162  rctTauVetoLocalEtaPhi_ =
163  dbe->book2D("RctTauLocalVetoEtaPhi", "TAU VETO OCCUPANCY (Local)",
164  nlocetabins, locetamin, locetamax,
165  nlocphibins, locphimin, locphimax);
166 */
167  // rank histos
169  dbe->book1D("RctRegionRank", "REGION RANK", R10BINS, R10MIN,
170  R10MAX);
171  rctIsoEmRank_ =
172  dbe->book1D("RctEmIsoEmRank", "ISO EM RANK", R6BINS, R6MIN, R6MAX);
174  dbe->book1D("RctEmNonIsoEmRank", "NON-ISO EM RANK", R6BINS, R6MIN,
175  R6MAX);
176  // hw coordinates
177 // rctEmCardRegion_ = dbe->book1D("rctEmCardRegion", "Em Card * Region",
178 // 256, -127.5, 127.5);
179 
180  // bx histos
181  rctRegionBx_ = dbe->book1D("RctRegionBx", "Region BX", 256, -0.5, 4095.5);
182  rctEmBx_ = dbe->book1D("RctEmBx", "EM BX", 256, -0.5, 4095.5);
183 
184 
185 
186  }
187 }
188 
189 
190 void L1TRCT::endJob(void)
191 {
192  if (verbose_)
193  std::cout << "L1TRCT: end job...." << std::endl;
194  LogInfo("EndJob") << "analyzed " << nev_ << " events";
195 
196  if (outputFile_.size() != 0 && dbe)
197  dbe->save(outputFile_);
198 
199  return;
200 }
201 
202 void L1TRCT::analyze(const Event & e, const EventSetup & c)
203 {
204  nev_++;
205  if (verbose_) {
206  std::cout << "L1TRCT: analyze...." << std::endl;
207  }
208 
209  // Get the RCT digis
212 
213  // need to change to getByLabel
214  bool doEm = true;
215  bool doHd = true;
216 
217 
218  e.getByLabel(rctSource_,rgn);
219 
220  if (!rgn.isValid()) {
221  edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
222  << rctSource_.label() ;
223  doHd = false;
224  }
225 
226  if ( doHd ) {
227  // Fill the RCT histograms
228 
229  // Regions
230  for (L1CaloRegionCollection::const_iterator ireg = rgn->begin();
231  ireg != rgn->end(); ireg++) {
232  if(ireg->et()>0)
233  {
234  rctRegionRank_->Fill(ireg->et());
235  rctRegionsOccEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
236  rctRegionsEtEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(), ireg->et());
237 // rctTauVetoEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(),
238 // ireg->tauVeto());
239 
240  // now do local coordinate eta and phi
241 // rctRegionsLocalOccEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi());
242 // rctRegionsLocalEtEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi(),
243 // ireg->et());
244 // rctTauVetoLocalEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi(),
245 // ireg->tauVeto());
246  rctRegionBx_->Fill(ireg->bx());
247  }
248 
249  if(ireg->overFlow()) rctOverFlowEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
250  if(ireg->tauVeto()) rctTauVetoEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
251  if(ireg->mip()) rctMipEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
252  if(ireg->quiet()) rctQuietEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
253  if(ireg->fineGrain()) rctHfPlusTauEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
254 
255  }
256  }
257 
258 
259  e.getByLabel(rctSource_,em);
260 
261  if (!em.isValid()) {
262  edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
263  << rctSource_.label() ;
264  doEm = false;
265  }
266  if ( ! doEm ) return;
267  // Isolated and non-isolated EM
268  for (L1CaloEmCollection::const_iterator iem = em->begin();
269  iem != em->end(); iem++) {
270 
271  // rctEmCardRegion_->Fill((iem->rctRegion()==0?1:-1)*(iem->rctCard()));
272 
273  if (iem->isolated()) {
274  if(iem->rank()>0)
275  {
276  rctIsoEmRank_->Fill(iem->rank());
277  rctIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
278  iem->regionId().iphi(), iem->rank());
279  rctIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
280  iem->regionId().iphi());
281  rctEmBx_->Fill(iem->bx());
282  }
283  }
284  else {
285  if(iem->rank()>0)
286  {
287  rctNonIsoEmRank_->Fill(iem->rank());
288  rctNonIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
289  iem->regionId().iphi(), iem->rank());
290  rctNonIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
291  iem->regionId().iphi());
292  rctEmBx_->Fill(iem->bx());
293  }
294  }
295 
296  }
297 
298 }
MonitorElement * rctOverFlowEtaPhi_
Definition: L1TRCT.h:107
const unsigned int R6BINS
Definition: L1TCompare.cc:89
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * rctQuietEtaPhi_
Definition: L1TRCT.h:110
#define PHIMAX
const float R10MIN
Definition: L1TCompare.cc:93
L1TRCT(const edm::ParameterSet &ps)
Definition: L1TRCT.cc:42
MonitorElement * rctRegionsEtEtaPhi_
Definition: L1TRCT.h:95
const unsigned int R12BINS
Definition: L1TCompare.cc:95
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:519
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2296
MonitorElement * rctRegionsOccEtaPhi_
Definition: L1TRCT.h:96
const unsigned int R10BINS
Definition: L1TCompare.cc:92
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:1883
const float R10MAX
Definition: L1TCompare.cc:94
#define NULL
Definition: scimark2.h:8
const float R12MIN
Definition: L1TCompare.cc:96
void Fill(long long x)
#define ETAMAX
edm::InputTag rctSource_
Definition: L1TRCT.h:136
void endJob(void)
Definition: L1TRCT.cc:190
#define ETAMIN
const float R6MAX
Definition: L1TCompare.cc:91
MonitorElement * rctHfPlusTauEtaPhi_
Definition: L1TRCT.h:111
MonitorElement * rctIsoEmEtEtaPhi_
Definition: L1TRCT.h:122
MonitorElement * rctNonIsoEmEtEtaPhi_
Definition: L1TRCT.h:124
void setVerbose(unsigned level)
Definition: DQMStore.cc:201
bool isValid() const
Definition: HandleBase.h:76
#define PHIMIN
bool verbose_
Definition: L1TRCT.h:132
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
void beginJob(void)
Definition: L1TRCT.cc:86
MonitorElement * rctIsoEmOccEtaPhi_
Definition: L1TRCT.h:123
int nev_
Definition: L1TRCT.h:130
virtual ~L1TRCT()
Definition: L1TRCT.cc:82
MonitorElement * rctNonIsoEmRank_
Definition: L1TRCT.h:127
MonitorElement * rctTauVetoEtaPhi_
Definition: L1TRCT.h:108
const float R6MIN
Definition: L1TCompare.cc:90
MonitorElement * rctEmBx_
Definition: L1TRCT.h:115
DQMStore * dbe
Definition: L1TRCT.h:92
std::string outputFile_
Definition: L1TRCT.h:131
#define ETABINS
std::string const & label() const
Definition: InputTag.h:25
MonitorElement * rctRegionRank_
Definition: L1TRCT.h:104
MonitorElement * rctMipEtaPhi_
Definition: L1TRCT.h:109
#define PHIBINS
tuple cout
Definition: gather_cfg.py:41
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TRCT.cc:202
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:647
const float R12MAX
Definition: L1TCompare.cc:97
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
MonitorElement * rctRegionBx_
Definition: L1TRCT.h:114
MonitorElement * rctNonIsoEmOccEtaPhi_
Definition: L1TRCT.h:125
MonitorElement * rctIsoEmRank_
Definition: L1TRCT.h:126