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  histFolder_ (ps.getUntrackedParameter<std::string>("HistFolder", "L1T/L1TRCT")),
39  rctSource_L1CRCollection_( consumes<L1CaloRegionCollection>(ps.getParameter< InputTag >("rctSource") )),
40  rctSource_L1CEMCollection_( consumes<L1CaloEmCollection>(ps.getParameter< InputTag >("rctSource") )),
41  filterTriggerType_ (ps.getParameter< int >("filterTriggerType")),
42  selectBX_ (ps.getUntrackedParameter< int >("selectBX",2))
43 {
44 
45  // verbosity switch
46  verbose_ = ps.getUntrackedParameter < bool > ("verbose", false);
47 
48  if (verbose_)
49  std::cout << "L1TRCT: constructor...." << std::endl;
50 
51  outputFile_ =
52  ps.getUntrackedParameter < std::string > ("outputFile", "");
53  if (outputFile_.size() != 0) {
54  std::
55  cout << "L1T Monitoring histograms will be saved to " <<
56  outputFile_.c_str() << std::endl;
57  }
58 
59  bool disable =
60  ps.getUntrackedParameter < bool > ("disableROOToutput", false);
61  if (disable) {
62  outputFile_ = "";
63  }
64 }
65 
67 {
68 }
69 
70 
71 
73  //runId_->Fill(r.id().run());
74  //
75 }
76 
78  //
79  //lumisecId_->Fill(l.id().luminosityBlock());
80 }
81 
82 
84 {
85  nev_ = 0;
86 
88 
89  runId_=ibooker.bookInt("iRun");
90  runId_->Fill(-1);
91  lumisecId_=ibooker.bookInt("lumiSection");
92  lumisecId_->Fill(-1);
93 
94 
95  triggerType_ = ibooker.book1D("TriggerType", "TriggerType", 17, -0.5, 16.5);
96 
97  // RCT UNPACKER
98 
99  // electrons
100  rctIsoEmEtEtaPhi_ = ibooker.book2D("RctEmIsoEmEtEtaPhi", "ISO EM E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
101  rctIsoEmOccEtaPhi_ = ibooker.book2D("RctEmIsoEmOccEtaPhi", "ISO EM OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
102  rctNonIsoEmEtEtaPhi_ = ibooker.book2D("RctEmNonIsoEmEtEtaPhi", "NON-ISO EM E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
103  rctNonIsoEmOccEtaPhi_ = ibooker.book2D("RctEmNonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY",ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
104 
105  // global regions
106  rctRegionsEtEtaPhi_ = ibooker.book2D("RctRegionsEtEtaPhi", "REGION E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
107  rctRegionsOccEtaPhi_ = ibooker.book2D("RctRegionsOccEtaPhi", "REGION OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
108 
109  // bits
110  rctOverFlowEtaPhi_ = ibooker.book2D("RctBitOverFlowEtaPhi", "OVER FLOW OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
111  rctTauVetoEtaPhi_ = ibooker.book2D("RctBitTauVetoEtaPhi", "TAU VETO OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
112  rctMipEtaPhi_ = ibooker.book2D("RctBitMipEtaPhi", "MIP OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
113  rctQuietEtaPhi_ = ibooker.book2D("RctBitQuietEtaPhi", "QUIET OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
114  rctHfPlusTauEtaPhi_ = ibooker.book2D("RctBitHfPlusTauEtaPhi", "HF plus Tau OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
115 
116  // rank histos
117  rctRegionRank_ = ibooker.book1D("RctRegionRank", "REGION RANK", R10BINS, R10MIN, R10MAX);
118  rctIsoEmRank_ = ibooker.book1D("RctEmIsoEmRank", "ISO EM RANK", R6BINS, R6MIN, R6MAX);
119  rctNonIsoEmRank_ = ibooker.book1D("RctEmNonIsoEmRank", "NON-ISO EM RANK", R6BINS, R6MIN, R6MAX);
120 
121  // bx histos
122  rctRegionBx_ = ibooker.book1D("RctRegionBx", "Region BX", 10, -2.5, 7.5);
123  rctEmBx_ = ibooker.book1D("RctEmBx", "EM BX", 10, -2.5, 7.5);
124 
125  // NOT CENTRAL BXs
126  rctNotCentralRegionsEtEtaPhi_ = ibooker.book2D("rctNotCentralRegionsEtEtaPhi", "REGION E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
127  rctNotCentralRegionsOccEtaPhi_ = ibooker.book2D("rctNotCentralRegionsOccEtaPhi", "REGION OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
128  rctNotCentralIsoEmEtEtaPhi_ = ibooker.book2D("rctNotCentralEmIsoEmEtEtaPhi", "ISO EM E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
129  rctNotCentralIsoEmOccEtaPhi_ = ibooker.book2D("rctNotCentralEmIsoEmOccEtaPhi", "ISO EM OCCUPANCY", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
130  rctNotCentralNonIsoEmEtEtaPhi_ = ibooker.book2D("rctNotCentralEmNonIsoEmEtEtaPhi", "NON-ISO EM E_{T}", ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
131  rctNotCentralNonIsoEmOccEtaPhi_ = ibooker.book2D("rctNotCentralEmNonIsoEmOccEtaPhi", "NON-ISO EM OCCUPANCY",ETABINS, ETAMIN, ETAMAX, PHIBINS, PHIMIN, PHIMAX);
132 
133 }
134 
135 void L1TRCT::analyze(const Event & e, const EventSetup & c)
136 {
137  nev_++;
138  if (verbose_) {
139  std::cout << "L1TRCT: analyze...." << std::endl;
140  }
141 
142  // filter according trigger type
143  // enum ExperimentType {
144  // Undefined = 0,
145  // PhysicsTrigger = 1,
146  // CalibrationTrigger = 2,
147  // RandomTrigger = 3,
148  // Reserved = 4,
149  // TracedEvent = 5,
150  // TestTrigger = 6,
151  // ErrorTrigger = 15
152 
153  // fill a histogram with the trigger type, for normalization fill also last bin
154  // ErrorTrigger + 1
155  double triggerType = static_cast<double> (e.experimentType()) + 0.001;
156  double triggerTypeLast = static_cast<double> (edm::EventAuxiliary::ExperimentType::ErrorTrigger)
157  + 0.001;
158  triggerType_->Fill(triggerType);
159  triggerType_->Fill(triggerTypeLast + 1);
160 
161  // filter only if trigger type is greater than 0, negative values disable filtering
162  if (filterTriggerType_ >= 0) {
163 
164  // now filter, for real data only
165  if (e.isRealData()) {
166  if (!(e.experimentType() == filterTriggerType_)) {
167 
168  edm::LogInfo("L1TRCT") << "\n Event of TriggerType "
169  << e.experimentType() << " rejected" << std::endl;
170  return;
171 
172  }
173  }
174 
175  }
176 
177  // Get the RCT digis
180 
181  bool doEm = true;
182  bool doHd = true;
183 
186 
187  if (!rgn.isValid()) {
188  edm::LogInfo("DataNotFound") << "can't find L1CaloRegionCollection - RCT";
189  doHd = false;
190  }
191 
192  if (!em.isValid()) {
193  edm::LogInfo("DataNotFound") << "can't find L1CaloEmCollection - Layer2 ";
194  doEm = false;
195  }
196 
197 
198  if ( doHd ) {
199  // Fill the RCT histograms
200 
201  for (L1CaloRegionCollection::const_iterator ireg = rgn->begin();
202  ireg != rgn->end(); ireg++) {
203 
204  if(ireg->et()>0)
205  {
206  rctRegionBx_->Fill(ireg->bx());
207  }
208 
209  if(selectBX_==-1 || selectBX_==ireg->bx()) {
210 
211  if(ireg->et()>0){
212 
213  rctRegionRank_->Fill(ireg->et());
214  if(ireg->et()>5){
215  rctRegionsOccEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
216  }
217  rctRegionsEtEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(), ireg->et());
218  }
219 
220  if(ireg->overFlow()) rctOverFlowEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
221  if(ireg->tauVeto()) rctTauVetoEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
222  if(ireg->mip()) rctMipEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
223  if(ireg->quiet()) rctQuietEtaPhi_ ->Fill(ireg->gctEta(), ireg->gctPhi());
224  if(ireg->fineGrain()) rctHfPlusTauEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
225 
226  }
227  else if (selectBX_!=-1 && selectBX_!=ireg->bx()){
228  if(ireg->et()>5) rctNotCentralRegionsOccEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi());
229  rctNotCentralRegionsEtEtaPhi_->Fill(ireg->gctEta(), ireg->gctPhi(), ireg->et());
230  }
231 
232 
233  }
234 
235  }
236 
237  if (doEm){
238  // Isolated and non-isolated EM
239  for (L1CaloEmCollection::const_iterator iem = em->begin();
240  iem != em->end(); iem++) {
241 
242  if(iem->rank()==0) continue;
243  rctEmBx_->Fill(iem->bx());
244  if(selectBX_==-1 || selectBX_==iem->bx()) {
245 
246  if (iem->isolated()) {
247  rctIsoEmRank_->Fill(iem->rank());
248  rctIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
249  iem->regionId().iphi(), iem->rank());
250  if(iem->rank()>10){
251  rctIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
252  iem->regionId().iphi());
253  }
254  }
255  else {
256  rctNonIsoEmRank_->Fill(iem->rank());
257  rctNonIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
258  iem->regionId().iphi(), iem->rank());
259  if(iem->rank()>10){
260  rctNonIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
261  iem->regionId().iphi());
262  }
263  }
264  }
265  else if (selectBX_!=-1 && selectBX_!=iem->bx()) {
266  if (iem->isolated()) {
267  rctNotCentralIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
268  iem->regionId().iphi(), iem->rank());
269  if(iem->rank()>10){
270  rctNotCentralIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
271  iem->regionId().iphi());
272  }
273  }
274  else {
275  rctNotCentralNonIsoEmEtEtaPhi_->Fill(iem->regionId().ieta(),
276  iem->regionId().iphi(), iem->rank());
277  if(iem->rank()>10){
278  rctNotCentralNonIsoEmOccEtaPhi_->Fill(iem->regionId().ieta(),
279  iem->regionId().iphi());
280  }
281  }
282  }
283  }
284 
285 }
286 
287 }
MonitorElement * rctOverFlowEtaPhi_
Definition: L1TRCT.h:69
const unsigned int R6BINS
Definition: L1TCompare.cc:71
virtual void bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &, edm::EventSetup const &) override
Definition: L1TRCT.cc:83
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * rctQuietEtaPhi_
Definition: L1TRCT.h:72
std::vector< L1CaloEmCand > L1CaloEmCollection
edm::EDGetTokenT< L1CaloRegionCollection > rctSource_L1CRCollection_
Definition: L1TRCT.h:130
L1TRCT(const edm::ParameterSet &ps)
Definition: L1TRCT.cc:37
MonitorElement * rctRegionsEtEtaPhi_
Definition: L1TRCT.h:66
const float ETAMAX
Definition: L1TCompare.cc:79
const unsigned int ETABINS
Definition: L1TCompare.cc:77
const unsigned int R10BINS
Definition: L1TRCT.cc:27
MonitorElement * rctRegionsOccEtaPhi_
Definition: L1TRCT.h:67
const float ETAMIN
Definition: L1TCompare.cc:78
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
const float R10MIN
Definition: L1TRCT.cc:28
MonitorElement * triggerType_
Definition: L1TRCT.h:62
MonitorElement * bookInt(Args &&...args)
Definition: DQMStore.h:103
std::string histFolder_
Definition: L1TRCT.h:124
const float PHIMAX
Definition: L1TCompare.cc:68
MonitorElement * runId_
Definition: L1TRCT.h:119
bool isRealData() const
Definition: EventBase.h:62
const unsigned int PHIBINS
Definition: L1TCompare.cc:66
void Fill(long long x)
int filterTriggerType_
filter TriggerType
Definition: L1TRCT.h:136
const float R6MAX
Definition: L1TCompare.cc:73
MonitorElement * lumisecId_
Definition: L1TRCT.h:120
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * rctHfPlusTauEtaPhi_
Definition: L1TRCT.h:73
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
const float PHIMIN
Definition: L1TCompare.cc:67
MonitorElement * rctIsoEmEtEtaPhi_
Definition: L1TRCT.h:80
MonitorElement * rctNonIsoEmEtEtaPhi_
Definition: L1TRCT.h:82
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
Definition: L1TRCT.cc:77
MonitorElement * rctNotCentralIsoEmEtEtaPhi_
Definition: L1TRCT.h:89
bool isValid() const
Definition: HandleBase.h:75
bool verbose_
Definition: L1TRCT.h:126
MonitorElement * rctIsoEmOccEtaPhi_
Definition: L1TRCT.h:81
int nev_
Definition: L1TRCT.h:123
virtual ~L1TRCT()
Definition: L1TRCT.cc:66
MonitorElement * rctNotCentralRegionsOccEtaPhi_
Definition: L1TRCT.h:88
MonitorElement * rctNonIsoEmRank_
Definition: L1TRCT.h:85
MonitorElement * rctTauVetoEtaPhi_
Definition: L1TRCT.h:70
edm::EDGetTokenT< L1CaloEmCollection > rctSource_L1CEMCollection_
Definition: L1TRCT.h:131
const float R6MIN
Definition: L1TCompare.cc:72
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * rctNotCentralNonIsoEmOccEtaPhi_
Definition: L1TRCT.h:92
MonitorElement * rctEmBx_
Definition: L1TRCT.h:77
MonitorElement * rctNotCentralRegionsEtEtaPhi_
Definition: L1TRCT.h:87
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string outputFile_
Definition: L1TRCT.h:125
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TRCT.cc:72
MonitorElement * rctNotCentralNonIsoEmEtEtaPhi_
Definition: L1TRCT.h:91
MonitorElement * rctRegionRank_
Definition: L1TRCT.h:68
MonitorElement * rctMipEtaPhi_
Definition: L1TRCT.h:71
edm::EventAuxiliary::ExperimentType experimentType() const
Definition: EventBase.h:63
tuple cout
Definition: gather_cfg.py:145
std::vector< L1CaloRegion > L1CaloRegionCollection
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TRCT.cc:135
const float R10MAX
Definition: L1TRCT.cc:29
MonitorElement * rctRegionBx_
Definition: L1TRCT.h:76
Definition: Run.h:42
int selectBX_
Definition: L1TRCT.h:137
MonitorElement * rctNonIsoEmOccEtaPhi_
Definition: L1TRCT.h:83
MonitorElement * rctNotCentralIsoEmOccEtaPhi_
Definition: L1TRCT.h:90
MonitorElement * rctIsoEmRank_
Definition: L1TRCT.h:84