CMS 3D CMS Logo

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