CMS 3D CMS Logo

HGCalTriggerValidator.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <iostream>
4 #include <string>
5 #include <vector>
6 
7 // user include files
10 
18 
22 
28 
30 
32 
33 //
34 // class declaration
35 //
36 
38 
39  public:
41  ~HGCalTriggerValidator() override;
42 
43  void analyze(const edm::Event&, const edm::EventSetup&) override;
44 
45  protected:
46  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
47 
48  private:
49 // ----------member data ---------------------------
50  //histogram tc related
61 
62  //histogram cl related
71 
72  //histogram multicl related
79  // cluster shower shapes
95 
96  //histogram tower related
106 
107 
112 
113  std::unique_ptr<HGCalTriggerClusterIdentificationBase> id_;
114 
116 };
117 
119 
120  trigger_cells_token_ = consumes<l1t::HGCalTriggerCellBxCollection>(iConfig.getParameter<edm::InputTag>("TriggerCells"));
121  clusters_token_ = consumes<l1t::HGCalClusterBxCollection>(iConfig.getParameter<edm::InputTag>("Clusters"));
122  multiclusters_token_ = consumes<l1t::HGCalMulticlusterBxCollection>(iConfig.getParameter<edm::InputTag>("Multiclusters"));
123  towers_token_ = consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("Towers"));
124 
125  id_.reset( HGCalTriggerClusterIdentificationFactory::get()->create("HGCalTriggerClusterIdentificationBDT") );
126  id_->initialize(iConfig.getParameter<edm::ParameterSet>("EGIdentification"));
127 
128 }
129 
131 }
132 
134 
135  iBooker.setCurrentFolder("HGCALTPG");
136 
137  //initiating histograms
138  // trigger cells
139  h_tc_n_ = iBooker.book1D("tc_n","trigger cell number; number", 400, 0, 400);
140  h_tc_mipPt_ = iBooker.book1D("tc_mipPt","trigger cell mipPt; mipPt", 400, 0, 400);
141  h_tc_pt_ = iBooker.book1D("tc_pt","trigger cell pt; pt [GeV]", 15, 0, 15);
142  h_tc_energy_ = iBooker.book1D("tc_energy","trigger cell energy; energy [GeV]", 70, 0, 70);
143  h_tc_eta_ = iBooker.book1D("tc_eta","trigger cell eta; eta", 60, -3.14, 3.14);
144  h_tc_phi_ = iBooker.book1D("tc_phi","trigger cell phi; phi", 60, -3.14, 3.14);
145  h_tc_x_ = iBooker.book1D("tc_x","trigger cell x; x [cm]", 500, -250, 250);
146  h_tc_y_ = iBooker.book1D("tc_y","trigger cell y; y [cm]", 500, -250, 250);
147  h_tc_z_ = iBooker.book1D("tc_z","trigger cell z; z [cm]", 1100, -550, 550);
148  h_tc_layer_ = iBooker.book1D("tc_layer","trigger cell layer; layer", 50, 0, 50);
149 
150  // cluster 2D histograms
151  h_cl_n_ = iBooker.book1D("cl_n","cluster2D number; number",80, 0, 80);
152  h_cl_mipPt_ = iBooker.book1D("cl_mipPt","cluster2D mipPt; mipPt",600, 0, 600);
153  h_cl_pt_ = iBooker.book1D("cl_pt","cluster2D pt; pt [GeV]",20, 0, 20);
154  h_cl_energy_= iBooker.book1D("cl_energy","cluster2D energy; energy [GeV]", 80, 0, 80);
155  h_cl_eta_ = iBooker.book1D("cl_eta","cluster2D eta; eta", 60, -3.14, 3.14);
156  h_cl_phi_ = iBooker.book1D("cl_phi","cluster2D phi; phi", 60, -3.14, 3.14);
157  h_cl_cells_n_ = iBooker.book1D("cl_cells_n","cluster2D cells_n; cells_n", 16, 0, 16);
158  h_cl_layer_ = iBooker.book1D("cl_layer","cluster2D layer; layer", 50, 0, 50);
159 
160  // multiclusters
161  h_cl3d_n_ = iBooker.book1D("cl3d_n","cl3duster3D number; number", 12, 0, 12);
162  h_cl3d_pt_ = iBooker.book1D("cl3d_pt","cl3duster3D pt; pt [GeV]", 50, 0, 50);
163  h_cl3d_energy_ = iBooker.book1D("cl3d_energy","cl3duster3D energy; energy [GeV]", 80, 0, 80);
164  h_cl3d_eta_ = iBooker.book1D("cl3d_eta","cl3duster3D eta; eta", 60, -3.14, 3.14);
165  h_cl3d_phi_ = iBooker.book1D("cl3d_phi","cl3duster3D phi; phi", 60, -3.14, 3.14);
166  h_cl3d_clusters_n_ = iBooker.book1D("cl3d_clusters_n","cl3duster3D clusters_n; clusters_n", 30, 0, 30);
167  // cluster shower shapes
168  h_cl3d_showerlength_ = iBooker.book1D("cl3d_showerlength","cl3duster3D showerlength; showerlength", 50, 0, 50);
169  h_cl3d_coreshowerlength_ = iBooker.book1D("cl3d_coreshowerlength","cl3duster3D coreshowerlength; coreshowerlength", 16, 0, 16);
170  h_cl3d_firstlayer_ = iBooker.book1D("cl3d_firstlayer","cl3duster3D firstlayer; firstlayer", 50, 0, 50);
171  h_cl3d_maxlayer_ = iBooker.book1D("cl3d_maxlayer","cl3duster3D maxlayer; maxlayer", 50, 0, 50);
172  h_cl3d_seetot_ = iBooker.book1D("cl3d_seetot","cl3duster3D seetot; seetot", 50, 0, 0.05);
173  h_cl3d_seemax_ = iBooker.book1D("cl3d_seemax","cl3duster3D seemax; seemax", 40, 0, 0.04);
174  h_cl3d_spptot_ = iBooker.book1D("cl3d_spptot","cl3duster3D spptot; spptot", 800, 0, 0.08);
175  h_cl3d_sppmax_ = iBooker.book1D("cl3d_sppmax","cl3duster3D sppmax; sppmax", 800, 0, 0.08);
176  h_cl3d_szz_ = iBooker.book1D("cl3d_szz","cl3duster3D szz; szz", 50, 0, 50);
177  h_cl3d_srrtot_ = iBooker.book1D("cl3d_srrtot","cl3duster3D srrtot; srrtot", 800, 0, 0.008);
178  h_cl3d_srrmax_ = iBooker.book1D("cl3d_srrmax","cl3duster3D srrmax; srrmax", 900, 0, 0.009);
179  h_cl3d_srrmean_ = iBooker.book1D("cl3d_srrmean","cl3duster3D srrmean; srrmean", 800, 0, 0.008);
180  h_cl3d_emaxe_ = iBooker.book1D("cl3d_emaxe","cl3duster3D emaxe; emaxe", 15, 0, 1.5);
181  h_cl3d_bdteg_ = iBooker.book1D("cl3d_bdteg","cl3duster3D bdteg; bdteg", 30, -0.7, 0.4);
182  h_cl3d_quality_ = iBooker.book1D("cl3d_quality","cl3duster3D quality; quality", 20, 0, 2);
183 
184  // towers
185  h_tower_n_ = iBooker.book1D("tower_n","tower n; number", 400, 1200, 1600);
186  h_tower_pt_ = iBooker.book1D("tower_pt","tower pt; pt [GeV]", 50, 0, 50);
187  h_tower_energy_ = iBooker.book1D("tower_energy","tower energy; energy [GeV]", 200, 0, 200);
188  h_tower_eta_ = iBooker.book1D("tower_eta","tower eta; eta", 60, -3.14, 3.14);
189  h_tower_phi_ = iBooker.book1D("tower_phi","tower phi; phi", 60, -3.14, 3.14);
190  h_tower_etEm_ = iBooker.book1D("tower_etEm","tower etEm; etEm", 50, 0, 50);
191  h_tower_etHad_ = iBooker.book1D("tower_etHad","tower etHad; etHad", 30, 0, 0.3);
192  h_tower_iEta_ = iBooker.book1D("tower_iEta","tower iEta; iEta", 20, 0, 20);
193  h_tower_iPhi_ = iBooker.book1D("tower_iPhi","tower iPhi; iPhi", 80, 0, 80);
194 }
195 
197 
198  int tc_n = 0;
199  int cl_n = 0;
200  int cl3d_n = 0;
201  int tower_n = 0;
202 
203  triggerTools_.eventSetup(iSetup);
204 
205  // retrieve trigger cells
207  iEvent.getByToken(trigger_cells_token_, trigger_cells_h);
208  const l1t::HGCalTriggerCellBxCollection& trigger_cells = *trigger_cells_h;
209 
210  if (trigger_cells_h.isValid()){
211  for(auto tc_itr=trigger_cells.begin(0); tc_itr!=trigger_cells.end(0); tc_itr++)
212  {
213  tc_n++;
214  HGCalDetId id(tc_itr->detId());
215  h_tc_pt_->Fill(tc_itr->pt());
216  h_tc_mipPt_->Fill(tc_itr->mipPt());
217  h_tc_energy_->Fill(tc_itr->energy());
218  h_tc_eta_->Fill(tc_itr->eta());
219  h_tc_phi_->Fill(tc_itr->phi());
220  h_tc_x_->Fill(tc_itr->position().x());
221  h_tc_y_->Fill(tc_itr->position().y());
222  h_tc_z_->Fill(tc_itr->position().z());
224  }
225  }
226  h_tc_n_->Fill(tc_n);
227 
228  // retrieve clusters
230  iEvent.getByToken(clusters_token_, clusters_h);
231  const l1t::HGCalClusterBxCollection& clusters = *clusters_h;
232 
233  if (clusters_h.isValid()){
234  for(auto cl_itr=clusters.begin(0); cl_itr!=clusters.end(0); cl_itr++){
235  cl_n++;
236  h_cl_mipPt_->Fill(cl_itr->mipPt());
237  h_cl_pt_->Fill(cl_itr->pt());
238  h_cl_energy_->Fill(cl_itr->energy());
239  h_cl_eta_->Fill(cl_itr->eta());
240  h_cl_phi_->Fill(cl_itr->phi());
241  h_cl_layer_->Fill(triggerTools_.layerWithOffset(cl_itr->detId()));
242  h_cl_cells_n_->Fill(cl_itr->constituents().size());
243  }
244  }
245  h_cl_n_->Fill(cl_n);
246 
247  // retrieve clusters 3D
249  iEvent.getByToken(multiclusters_token_, multiclusters_h);
250  const l1t::HGCalMulticlusterBxCollection& multiclusters = *multiclusters_h;
251 
252  if (multiclusters_h.isValid()){
253 
254  for(auto cl3d_itr=multiclusters.begin(0); cl3d_itr!=multiclusters.end(0); cl3d_itr++){
255 
256  cl3d_n++;
257  h_cl3d_pt_->Fill(cl3d_itr->pt());
258  h_cl3d_energy_->Fill(cl3d_itr->energy());
259  h_cl3d_eta_->Fill(cl3d_itr->eta());
260  h_cl3d_phi_->Fill(cl3d_itr->phi());
261  h_cl3d_clusters_n_->Fill(cl3d_itr->constituents().size());
262  // cluster shower shapes
263  h_cl3d_showerlength_->Fill(cl3d_itr->showerLength());
264  h_cl3d_coreshowerlength_->Fill(cl3d_itr->coreShowerLength());
265  h_cl3d_firstlayer_->Fill(cl3d_itr->firstLayer());
266  h_cl3d_maxlayer_->Fill(cl3d_itr->maxLayer());
267  h_cl3d_seetot_->Fill(cl3d_itr->sigmaEtaEtaTot());
268  h_cl3d_seemax_->Fill(cl3d_itr->sigmaEtaEtaMax());
269  h_cl3d_spptot_->Fill(cl3d_itr->sigmaPhiPhiTot());
270  h_cl3d_sppmax_->Fill(cl3d_itr->sigmaPhiPhiMax());
271  h_cl3d_szz_->Fill(cl3d_itr->sigmaZZ());
272  h_cl3d_srrtot_->Fill(cl3d_itr->sigmaRRTot());
273  h_cl3d_srrmax_->Fill(cl3d_itr->sigmaRRMax());
274  h_cl3d_srrmean_->Fill(cl3d_itr->sigmaRRMean());
275  h_cl3d_emaxe_->Fill(cl3d_itr->eMax()/cl3d_itr->energy());
276  h_cl3d_bdteg_->Fill(id_->value(*cl3d_itr));
277  h_cl3d_quality_->Fill(cl3d_itr->hwQual());
278  }
279  }
280  h_cl3d_n_->Fill(cl3d_n);
281 
282  // retrieve towers
284  iEvent.getByToken(towers_token_, towers_h);
285  const l1t::HGCalTowerBxCollection& towers = *towers_h;
286 
287  if (towers_h.isValid()){
288  for(auto tower_itr=towers.begin(0); tower_itr!=towers.end(0); tower_itr++){
289  tower_n++;
290  h_tower_pt_->Fill(tower_itr->pt());
291  h_tower_energy_->Fill(tower_itr->energy());
292  h_tower_eta_->Fill(tower_itr->eta());
293  h_tower_phi_->Fill(tower_itr->phi());
294  h_tower_etEm_->Fill(tower_itr->etEm());
295  h_tower_etHad_->Fill(tower_itr->etHad());
296  h_tower_iEta_->Fill(tower_itr->id().iEta());
297  h_tower_iPhi_->Fill(tower_itr->id().iPhi());
298  }
299  }
300  h_tower_n_->Fill(tower_n);
301 
302 }
303 
305 
306 //define this as a plug-in
MonitorElement * h_cl3d_sppmax_
const_iterator end(int bx) const
T getParameter(std::string const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
void eventSetup(const edm::EventSetup &)
def create(alignables, pedeDump, additionalData, outputFile, config)
MonitorElement * h_cl3d_spptot_
MonitorElement * h_cl3d_clusters_n_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_cl3d_showerlength_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * h_cl3d_srrmax_
HGCalTriggerValidator(const edm::ParameterSet &)
MonitorElement * h_cl3d_seemax_
unsigned layerWithOffset(const DetId &) const
edm::EDGetToken multiclusters_token_
MonitorElement * h_cl3d_bdteg_
void Fill(long long x)
std::unique_ptr< HGCalTriggerClusterIdentificationBase > id_
MonitorElement * h_cl3d_maxlayer_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HGCalTriggerTools triggerTools_
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * h_tower_energy_
MonitorElement * h_cl3d_coreshowerlength_
MonitorElement * h_cl3d_firstlayer_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
bool isValid() const
Definition: HandleBase.h:74
MonitorElement * h_cl3d_emaxe_
edm::EDGetToken trigger_cells_token_
MonitorElement * h_cl3d_quality_
MonitorElement * h_cl3d_srrmean_
MonitorElement * h_cl3d_energy_
MonitorElement * h_cl3d_seetot_
MonitorElement * h_cl3d_srrtot_
const_iterator begin(int bx) const
MonitorElement * h_cl_cells_n_
T get(const Candidate &c)
Definition: component.h:55
Definition: Run.h:45