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