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: 2012/04/04 09:56:36 $
5  * $Revision: 1.22 $
6  * \author P. Wittich
7  *
8  */
9 
12 
13 // GCT and RCT data formats
16 
17 
18 
19 
20 using namespace edm;
21 
22 const unsigned int PHIBINS = 18;
23 const float PHIMIN = -0.5;
24 const float PHIMAX = 17.5;
25 
26 // Ranks 6, 10 and 12 bits
27 const unsigned int R6BINS = 64;
28 const float R6MIN = -0.5;
29 const float R6MAX = 63.5;
30 const unsigned int R10BINS = 1024;
31 const float R10MIN = -0.5;
32 const float R10MAX = 1023.5;
33 const unsigned int R12BINS = 4096;
34 const float R12MIN = -0.5;
35 const float R12MAX = 4095.5;
36 
37 const unsigned int ETABINS = 22;
38 const float ETAMIN = -0.5;
39 const float ETAMAX = 21.5;
40 
41 
42 
44  rctSource_( ps.getParameter< InputTag >("rctSource") ),
45  filterTriggerType_ (ps.getParameter< int >("filterTriggerType"))
46 {
47 
48  // verbosity switch
49  verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
50 
51  if (verbose_)
52  std::cout << "L1TRCT: constructor...." << std::endl;
53 
54 
55  dbe = NULL;
56  if (ps.getUntrackedParameter < bool > ("DQMStore", false)) {
58  dbe->setVerbose(0);
59  }
60 
61  outputFile_ =
62  ps.getUntrackedParameter < std::string > ("outputFile", "");
63  if (outputFile_.size() != 0) {
64  std::
65  cout << "L1T Monitoring histograms will be saved to " <<
66  outputFile_.c_str() << std::endl;
67  }
68 
69  bool disable =
70  ps.getUntrackedParameter < bool > ("disableROOToutput", false);
71  if (disable) {
72  outputFile_ = "";
73  }
74 
75 
76  if (dbe != NULL) {
77  dbe->setCurrentFolder("L1T/L1TRCT");
78  }
79 
80 
81 }
82 
84 {
85 }
86 
87 void L1TRCT::beginJob(void)
88 {
89 
90 
91  nev_ = 0;
92 
93  // get hold of back-end interface
94  DQMStore *dbe = 0;
95  dbe = Service < DQMStore > ().operator->();
96 
97  if (dbe) {
98  dbe->setCurrentFolder("L1T/L1TRCT");
99  dbe->rmdir("L1T/L1TRCT");
100  }
101 
102 
103  if (dbe) {
104  dbe->setCurrentFolder("L1T/L1TRCT");
105 
106  triggerType_ =
107  dbe->book1D("TriggerType", "TriggerType", 17, -0.5, 16.5);
108 
110  dbe->book2D("RctEmIsoEmEtEtaPhi", "ISO EM E_{T}", ETABINS, ETAMIN,
113  dbe->book2D("RctEmIsoEmOccEtaPhi", "ISO EM OCCUPANCY", ETABINS,
116  dbe->book2D("RctEmNonIsoEmEtEtaPhi", "NON-ISO EM E_{T}", ETABINS,
119  dbe->book2D("RctEmNonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY",
121 
122  // global regions
124  dbe->book2D("RctRegionsEtEtaPhi", "REGION E_{T}", ETABINS, ETAMIN,
127  dbe->book2D("RctRegionsOccEtaPhi", "REGION OCCUPANCY", ETABINS,
129 
131  dbe->book2D("RctBitOverFlowEtaPhi", "OVER FLOW OCCUPANCY", ETABINS,
133 
135  dbe->book2D("RctBitTauVetoEtaPhi", "TAU VETO OCCUPANCY", ETABINS,
137 
138  rctMipEtaPhi_ =
139  dbe->book2D("RctBitMipEtaPhi", "MIP OCCUPANCY", ETABINS,
141 
143  dbe->book2D("RctBitQuietEtaPhi", "QUIET OCCUPANCY", ETABINS,
145 
147  dbe->book2D("RctBitHfPlusTauEtaPhi", "HF plus Tau OCCUPANCY", ETABINS,
149 
150  // local regions
151 /*
152  const int nlocphibins = 2;
153  const float locphimin = -0.5;
154  const float locphimax = 1.5;
155  const int nlocetabins = 11;
156  const float locetamin = -0.5;
157  const float locetamax = 10.5;
158  rctRegionsLocalEtEtaPhi_ =
159  dbe->book2D("RctRegionsLocalEtEtaPhi", "REGION E_{T} (Local)",
160  nlocetabins, locetamin, locetamax,
161  nlocphibins, locphimin, locphimax);
162  rctRegionsLocalOccEtaPhi_ =
163  dbe->book2D("RctRegionsLocalOccEtaPhi", "REGION OCCUPANCY (Local)",
164  nlocetabins, locetamin, locetamax,
165  nlocphibins, locphimin, locphimax);
166  rctTauVetoLocalEtaPhi_ =
167  dbe->book2D("RctTauLocalVetoEtaPhi", "TAU VETO OCCUPANCY (Local)",
168  nlocetabins, locetamin, locetamax,
169  nlocphibins, locphimin, locphimax);
170 */
171  // rank histos
173  dbe->book1D("RctRegionRank", "REGION RANK", R10BINS, R10MIN,
174  R10MAX);
175  rctIsoEmRank_ =
176  dbe->book1D("RctEmIsoEmRank", "ISO EM RANK", R6BINS, R6MIN, R6MAX);
178  dbe->book1D("RctEmNonIsoEmRank", "NON-ISO EM RANK", R6BINS, R6MIN,
179  R6MAX);
180  // hw coordinates
181 // rctEmCardRegion_ = dbe->book1D("rctEmCardRegion", "Em Card * Region",
182 // 256, -127.5, 127.5);
183 
184  // bx histos
185  rctRegionBx_ = dbe->book1D("RctRegionBx", "Region BX", 256, -0.5, 4095.5);
186  rctEmBx_ = dbe->book1D("RctEmBx", "EM BX", 256, -0.5, 4095.5);
187 
188 
189 
190  }
191 }
192 
193 
194 void L1TRCT::endJob(void)
195 {
196  if (verbose_)
197  std::cout << "L1TRCT: end job...." << std::endl;
198  LogInfo("EndJob") << "analyzed " << nev_ << " events";
199 
200  if (outputFile_.size() != 0 && dbe)
201  dbe->save(outputFile_);
202 
203  return;
204 }
205 
206 void L1TRCT::analyze(const Event & e, const EventSetup & c)
207 {
208  nev_++;
209  if (verbose_) {
210  std::cout << "L1TRCT: analyze...." << std::endl;
211  }
212 
213  // filter according trigger type
214  // enum ExperimentType {
215  // Undefined = 0,
216  // PhysicsTrigger = 1,
217  // CalibrationTrigger = 2,
218  // RandomTrigger = 3,
219  // Reserved = 4,
220  // TracedEvent = 5,
221  // TestTrigger = 6,
222  // ErrorTrigger = 15
223 
224  // fill a histogram with the trigger type, for normalization fill also last bin
225  // ErrorTrigger + 1
226  double triggerType = static_cast<double> (e.experimentType()) + 0.001;
227  double triggerTypeLast = static_cast<double> (edm::EventAuxiliary::ExperimentType::ErrorTrigger)
228  + 0.001;
229  triggerType_->Fill(triggerType);
230  triggerType_->Fill(triggerTypeLast + 1);
231 
232  // filter only if trigger type is greater than 0, negative values disable filtering
233  if (filterTriggerType_ >= 0) {
234 
235  // now filter, for real data only
236  if (e.isRealData()) {
237  if (!(e.experimentType() == filterTriggerType_)) {
238 
239  edm::LogInfo("L1TRCT") << "\n Event of TriggerType "
240  << e.experimentType() << " rejected" << std::endl;
241  return;
242 
243  }
244  }
245 
246  }
247 
248  // Get the RCT digis
251 
252  bool doEm = true;
253  bool doHd = true;
254 
255  e.getByLabel(rctSource_,rgn);
256 
257  if (!rgn.isValid()) {
258  edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection with label "
259  << rctSource_.label() ;
260  doHd = false;
261  }
262 
263  if ( doHd ) {
264  // Fill the RCT histograms
265 
266  // Regions
267  for (L1CaloRegionCollection::const_iterator ireg = rgn->begin();
268  ireg != rgn->end(); ireg++) {
269  if(ireg->et()>0)
270  {
271  rctRegionRank_->Fill(ireg->et());
272  if(ireg->et()>5){
273  rctRegionsOccEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
274  }
275  rctRegionsEtEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(), ireg->et());
276 // rctTauVetoEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(),
277 // ireg->tauVeto());
278 
279  // now do local coordinate eta and phi
280 // rctRegionsLocalOccEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi());
281 // rctRegionsLocalEtEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi(),
282 // ireg->et());
283 // rctTauVetoLocalEtaPhi_->Fill(ireg->rctEta(), ireg->rctPhi(),
284 // ireg->tauVeto());
285  rctRegionBx_->Fill(ireg->bx());
286  }
287 
288  if(ireg->overFlow()) rctOverFlowEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
289  if(ireg->tauVeto()) rctTauVetoEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
290  if(ireg->mip()) rctMipEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
291  if(ireg->quiet()) rctQuietEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
292  if(ireg->fineGrain()) rctHfPlusTauEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
293 
294  }
295  }
296 
297 
298  e.getByLabel(rctSource_,em);
299 
300  if (!em.isValid()) {
301  edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection with label "
302  << rctSource_.label() ;
303  doEm = false;
304  }
305  if ( ! doEm ) return;
306  // Isolated and non-isolated EM
307  for (L1CaloEmCollection::const_iterator iem = em->begin();
308  iem != em->end(); iem++) {
309 
310  // rctEmCardRegion_->Fill((iem->rctRegion()==0?1:-1)*(iem->rctCard()));
311 
312  if (iem->isolated()) {
313  if(iem->rank()>0)
314  {
315  rctIsoEmRank_->Fill(iem->rank());
316  rctIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
317  iem->regionId().iphi(), iem->rank());
318  if(iem->rank()>10){
319  rctIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
320  iem->regionId().iphi());
321  }
322  rctEmBx_->Fill(iem->bx());
323  }
324  }
325  else {
326  if(iem->rank()>0)
327  {
328  rctNonIsoEmRank_->Fill(iem->rank());
329  rctNonIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
330  iem->regionId().iphi(), iem->rank());
331  if(iem->rank()>10){
332  rctNonIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
333  iem->regionId().iphi());
334  }
335  rctEmBx_->Fill(iem->bx());
336  }
337  }
338 
339  }
340 
341 }
MonitorElement * rctOverFlowEtaPhi_
Definition: L1TRCT.h:119
const unsigned int R6BINS
Definition: L1TCompare.cc:92
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * rctQuietEtaPhi_
Definition: L1TRCT.h:122
#define PHIMAX
const float R10MIN
Definition: L1TCompare.cc:96
L1TRCT(const edm::ParameterSet &ps)
Definition: L1TRCT.cc:43
MonitorElement * rctRegionsEtEtaPhi_
Definition: L1TRCT.h:107
const unsigned int R12BINS
Definition: L1TCompare.cc:98
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 * rctRegionsOccEtaPhi_
Definition: L1TRCT.h:108
const unsigned int R10BINS
Definition: L1TCompare.cc:95
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
const float R10MAX
Definition: L1TCompare.cc:97
MonitorElement * triggerType_
Definition: L1TRCT.h:104
#define NULL
Definition: scimark2.h:8
const float R12MIN
Definition: L1TCompare.cc:99
bool isRealData() const
Definition: EventBase.h:60
void Fill(long long x)
#define ETAMAX
int filterTriggerType_
filter TriggerType
Definition: L1TRCT.h:151
edm::InputTag rctSource_
Definition: L1TRCT.h:148
void endJob(void)
Definition: L1TRCT.cc:194
#define ETAMIN
const float R6MAX
Definition: L1TCompare.cc:94
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * rctHfPlusTauEtaPhi_
Definition: L1TRCT.h:123
MonitorElement * rctIsoEmEtEtaPhi_
Definition: L1TRCT.h:134
MonitorElement * rctNonIsoEmEtEtaPhi_
Definition: L1TRCT.h:136
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
bool isValid() const
Definition: HandleBase.h:76
#define PHIMIN
bool verbose_
Definition: L1TRCT.h:144
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void beginJob(void)
Definition: L1TRCT.cc:87
MonitorElement * rctIsoEmOccEtaPhi_
Definition: L1TRCT.h:135
int nev_
Definition: L1TRCT.h:142
virtual ~L1TRCT()
Definition: L1TRCT.cc:83
MonitorElement * rctNonIsoEmRank_
Definition: L1TRCT.h:139
MonitorElement * rctTauVetoEtaPhi_
Definition: L1TRCT.h:120
const float R6MIN
Definition: L1TCompare.cc:93
MonitorElement * rctEmBx_
Definition: L1TRCT.h:127
DQMStore * dbe
Definition: L1TRCT.h:101
std::string outputFile_
Definition: L1TRCT.h:143
#define ETABINS
std::string const & label() const
Definition: InputTag.h:25
MonitorElement * rctRegionRank_
Definition: L1TRCT.h:116
MonitorElement * rctMipEtaPhi_
Definition: L1TRCT.h:121
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:61
#define PHIBINS
tuple cout
Definition: gather_cfg.py:121
void analyze(const edm::Event &e, const edm::EventSetup &c)
Definition: L1TRCT.cc:206
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
const float R12MAX
Definition: L1TCompare.cc:100
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
MonitorElement * rctRegionBx_
Definition: L1TRCT.h:126
MonitorElement * rctNonIsoEmOccEtaPhi_
Definition: L1TRCT.h:137
MonitorElement * rctIsoEmRank_
Definition: L1TRCT.h:138