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