CMS 3D CMS Logo

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