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