CMS 3D CMS Logo

HGVHistoProducerAlgo.cc
Go to the documentation of this file.
1 #include <numeric>
2 #include <iomanip>
3 
7 #include "TMath.h"
8 #include "TLatex.h"
9 #include "TF1.h"
10 
11 using namespace std;
12 
13 //Parameters for the score cut. Later, this will become part of the
14 //configuration parameter for the HGCAL associator.
15 const double ScoreCutLCtoCP_ = 0.2;
16 const double ScoreCutCPtoLC_ = 0.2;
17 
19  //parameters for eta
20  minEta_(pset.getParameter<double>("minEta")),
21  maxEta_(pset.getParameter<double>("maxEta")),
22  nintEta_(pset.getParameter<int>("nintEta")),
23  useFabsEta_(pset.getParameter<bool>("useFabsEta")),
24 
25  //parameters for energy
26  minEne_(pset.getParameter<double>("minEne")),
27  maxEne_(pset.getParameter<double>("maxEne")),
28  nintEne_(pset.getParameter<int>("nintEne")),
29 
30  //parameters for pt
31  minPt_(pset.getParameter<double>("minPt")),
32  maxPt_(pset.getParameter<double>("maxPt")),
33  nintPt_(pset.getParameter<int>("nintPt")),
34 
35  //parameters for phi
36  minPhi_(pset.getParameter<double>("minPhi")),
37  maxPhi_(pset.getParameter<double>("maxPhi")),
38  nintPhi_(pset.getParameter<int>("nintPhi")),
39 
40  //parameters for counting mixed hits clusters
41  minMixedHitsCluster_(pset.getParameter<double>("minMixedHitsCluster")),
42  maxMixedHitsCluster_(pset.getParameter<double>("maxMixedHitsCluster")),
43  nintMixedHitsCluster_(pset.getParameter<int>("nintMixedHitsCluster")),
44 
45  //parameters for the total amount of energy clustered by all layer clusters (fraction over caloparticles)
46  minEneCl_(pset.getParameter<double>("minEneCl")),
47  maxEneCl_(pset.getParameter<double>("maxEneCl")),
48  nintEneCl_(pset.getParameter<int>("nintEneCl")),
49 
50  //parameters for the longitudinal depth barycenter.
51  minLongDepBary_(pset.getParameter<double>("minLongDepBary")),
52  maxLongDepBary_(pset.getParameter<double>("maxLongDepBary")),
53  nintLongDepBary_(pset.getParameter<int>("nintLongDepBary")),
54 
55  //parameters for z positionof vertex plots
56  minZpos_(pset.getParameter<double>("minZpos")),
57  maxZpos_(pset.getParameter<double>("maxZpos")),
58  nintZpos_(pset.getParameter<int>("nintZpos")),
59 
60  //Parameters for the total number of layer clusters per layer
61  minTotNClsperlay_(pset.getParameter<double>("minTotNClsperlay")),
62  maxTotNClsperlay_(pset.getParameter<double>("maxTotNClsperlay")),
63  nintTotNClsperlay_(pset.getParameter<int>("nintTotNClsperlay")),
64 
65  //Parameters for the energy clustered by layer clusters per layer (fraction over caloparticles)
66  minEneClperlay_(pset.getParameter<double>("minEneClperlay")),
67  maxEneClperlay_(pset.getParameter<double>("maxEneClperlay")),
68  nintEneClperlay_(pset.getParameter<int>("nintEneClperlay")),
69 
70  //Parameters for the score both for:
71  //1. calo particle to layer clusters association per layer
72  //2. layer cluster to calo particles association per layer
73  minScore_(pset.getParameter<double>("minScore")),
74  maxScore_(pset.getParameter<double>("maxScore")),
75  nintScore_(pset.getParameter<int>("nintScore")),
76 
77  //Parameters for shared energy fraction. That is:
78  //1. Fraction of each of the layer clusters energy related to a
79  //calo particle over that calo particle's energy.
80  //2. Fraction of each of the calo particles energy
81  //related to a layer cluster over that layer cluster's energy.
82  minSharedEneFrac_(pset.getParameter<double>("minSharedEneFrac")),
83  maxSharedEneFrac_(pset.getParameter<double>("maxSharedEneFrac")),
84  nintSharedEneFrac_(pset.getParameter<int>("nintSharedEneFrac")),
85 
86  //Parameters for the total number of layer clusters per thickness
87  minTotNClsperthick_(pset.getParameter<double>("minTotNClsperthick")),
88  maxTotNClsperthick_(pset.getParameter<double>("maxTotNClsperthick")),
89  nintTotNClsperthick_(pset.getParameter<int>("nintTotNClsperthick")),
90 
91  //Parameters for the total number of cells per per thickness per layer
92  minTotNcellsperthickperlayer_(pset.getParameter<double>("minTotNcellsperthickperlayer")),
93  maxTotNcellsperthickperlayer_(pset.getParameter<double>("maxTotNcellsperthickperlayer")),
94  nintTotNcellsperthickperlayer_(pset.getParameter<int>("nintTotNcellsperthickperlayer")),
95 
96  //Parameters for the distance of cluster cells to seed cell per thickness per layer
97  minDisToSeedperthickperlayer_(pset.getParameter<double>("minDisToSeedperthickperlayer")),
98  maxDisToSeedperthickperlayer_(pset.getParameter<double>("maxDisToSeedperthickperlayer")),
99  nintDisToSeedperthickperlayer_(pset.getParameter<int>("nintDisToSeedperthickperlayer")),
100 
101  //Parameters for the energy weighted distance of cluster cells to seed cell per thickness per layer
102  minDisToSeedperthickperlayerenewei_(pset.getParameter<double>("minDisToSeedperthickperlayerenewei")),
103  maxDisToSeedperthickperlayerenewei_(pset.getParameter<double>("maxDisToSeedperthickperlayerenewei")),
104  nintDisToSeedperthickperlayerenewei_(pset.getParameter<int>("nintDisToSeedperthickperlayerenewei")),
105 
106  //Parameters for the distance of cluster cells to max cell per thickness per layer
107  minDisToMaxperthickperlayer_(pset.getParameter<double>("minDisToMaxperthickperlayer")),
108  maxDisToMaxperthickperlayer_(pset.getParameter<double>("maxDisToMaxperthickperlayer")),
109  nintDisToMaxperthickperlayer_(pset.getParameter<int>("nintDisToMaxperthickperlayer")),
110 
111  //Parameters for the energy weighted distance of cluster cells to max cell per thickness per layer
112  minDisToMaxperthickperlayerenewei_(pset.getParameter<double>("minDisToMaxperthickperlayerenewei")),
113  maxDisToMaxperthickperlayerenewei_(pset.getParameter<double>("maxDisToMaxperthickperlayerenewei")),
114  nintDisToMaxperthickperlayerenewei_(pset.getParameter<int>("nintDisToMaxperthickperlayerenewei")),
115 
116  //Parameters for the distance of seed cell to max cell per thickness per layer
117  minDisSeedToMaxperthickperlayer_(pset.getParameter<double>("minDisSeedToMaxperthickperlayer")),
118  maxDisSeedToMaxperthickperlayer_(pset.getParameter<double>("maxDisSeedToMaxperthickperlayer")),
119  nintDisSeedToMaxperthickperlayer_(pset.getParameter<int>("nintDisSeedToMaxperthickperlayer")),
120 
121  //Parameters for the energy of a cluster per thickness per layer
122  minClEneperthickperlayer_(pset.getParameter<double>("minClEneperthickperlayer")),
123  maxClEneperthickperlayer_(pset.getParameter<double>("maxClEneperthickperlayer")),
124  nintClEneperthickperlayer_(pset.getParameter<int>("nintClEneperthickperlayer")),
125 
126  //Parameters for the energy density of cluster cells per thickness
127  minCellsEneDensperthick_(pset.getParameter<double>("minCellsEneDensperthick")),
128  maxCellsEneDensperthick_(pset.getParameter<double>("maxCellsEneDensperthick")),
129  nintCellsEneDensperthick_(pset.getParameter<int>("nintCellsEneDensperthick"))
130 
131 {}
132 
134 
136 
137  histograms.lastLayerEEzm = ibook.bookInt("lastLayerEEzm");
138  histograms.lastLayerFHzm = ibook.bookInt("lastLayerFHzm");
139  histograms.maxlayerzm = ibook.bookInt("maxlayerzm");
140  histograms.lastLayerEEzp = ibook.bookInt("lastLayerEEzp");
141  histograms.lastLayerFHzp = ibook.bookInt("lastLayerFHzp");
142  histograms.maxlayerzp = ibook.bookInt("maxlayerzp");
143 
144 }
145 
147 
148  histograms.h_caloparticle_eta[pdgid] = ibook.book1D("num_caloparticle_eta","N of caloparticle vs eta",nintEta_,minEta_,maxEta_);
149  histograms.h_caloparticle_eta_Zorigin[pdgid] = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", nintEta_, minEta_, maxEta_, nintZpos_, minZpos_, maxZpos_);
150 
151  histograms.h_caloparticle_energy[pdgid] = ibook.book1D("caloparticle_energy", "Energy of caloparticle", nintEne_,minEne_,maxEne_);
152  histograms.h_caloparticle_pt[pdgid] = ibook.book1D("caloparticle_pt", "Pt of caloparticle", nintPt_,minPt_,maxPt_);
153  histograms.h_caloparticle_phi[pdgid] = ibook.book1D("caloparticle_phi", "Phi of caloparticle", nintPhi_,minPhi_,maxPhi_);
154 
155 
156 }
157 
158 
159 void HGVHistoProducerAlgo::bookClusterHistos(DQMStore::ConcurrentBooker& ibook, Histograms& histograms, unsigned layers, std::vector<int> thicknesses, std::string pathtomatbudfile) {
160 
161  //---------------------------------------------------------------------------------------------------------------------------
162  histograms.h_cluster_eta.push_back( ibook.book1D("num_reco_cluster_eta","N of reco clusters vs eta",nintEta_,minEta_,maxEta_) );
163 
164  //---------------------------------------------------------------------------------------------------------------------------
165  //z-
166  histograms.h_mixedhitscluster_zminus.push_back( ibook.book1D("mixedhitscluster_zminus","N of reco clusters that contain hits of more than one kind in z-",nintMixedHitsCluster_,minMixedHitsCluster_,maxMixedHitsCluster_) );
167  //z+
168  histograms.h_mixedhitscluster_zplus.push_back( ibook.book1D("mixedhitscluster_zplus","N of reco clusters that contain hits of more than one kind in z+",nintMixedHitsCluster_,minMixedHitsCluster_,maxMixedHitsCluster_) );
169 
170  //---------------------------------------------------------------------------------------------------------------------------
171  //z-
172  histograms.h_energyclustered_zminus.push_back( ibook.book1D("energyclustered_zminus","percent of total energy clustered by all layer clusters over caloparticles energy in z-",nintEneCl_,minEneCl_,maxEneCl_) );
173  //z+
174  histograms.h_energyclustered_zplus.push_back( ibook.book1D("energyclustered_zplus","percent of total energy clustered by all layer clusters over caloparticles energy in z+",nintEneCl_,minEneCl_,maxEneCl_) );
175 
176  //---------------------------------------------------------------------------------------------------------------------------
177  //z-
178  std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find("Validation"));
179  histograms.h_longdepthbarycentre_zminus.push_back( ibook.book1D("longdepthbarycentre_zminus","The longitudinal depth barycentre in z- for "+subpathtomat,nintLongDepBary_,minLongDepBary_,maxLongDepBary_) );
180  //z+
181  histograms.h_longdepthbarycentre_zplus.push_back( ibook.book1D("longdepthbarycentre_zplus","The longitudinal depth barycentre in z+ for "+subpathtomat,nintLongDepBary_,minLongDepBary_,maxLongDepBary_) );
182 
183 
184  //---------------------------------------------------------------------------------------------------------------------------
185  for (unsigned ilayer = 0; ilayer < 2*layers; ++ilayer) {
186  auto istr1 = std::to_string(ilayer);
187  while(istr1.size() < 2) {istr1.insert(0, "0");}
188  //We will make a mapping to the regural layer naming plus z- or z+ for convenience
189  std::string istr2 = "";
190  //First with the -z endcap
191  if (ilayer < layers){
192  istr2 = std::to_string(ilayer + 1) + " in z-";
193  }else { //Then for the +z
194  istr2 = std::to_string(ilayer - 51) + " in z+";
195  }
196  histograms.h_clusternum_perlayer[ilayer] = ibook.book1D("totclusternum_layer_"+istr1,"total number of layer clusters for layer "+istr2,nintTotNClsperlay_,minTotNClsperlay_,maxTotNClsperlay_);
197  histograms.h_energyclustered_perlayer[ilayer] = ibook.book1D("energyclustered_perlayer"+istr1,"percent of total energy clustered by layer clusters over caloparticles energy for layer "+istr2,nintEneClperlay_,minEneClperlay_,maxEneClperlay_);
198  histograms.h_score_layercl2caloparticle_perlayer[ilayer] = ibook.book1D("Score_layercl2caloparticle_perlayer"+istr1, "Score of Layer Cluster per CaloParticle for layer "+istr2, nintScore_,minScore_,maxScore_);
199  histograms.h_score_caloparticle2layercl_perlayer[ilayer] = ibook.book1D("Score_caloparticle2layercl_perlayer"+istr1, "Score of CaloParticle per Layer Cluster for layer "+istr2, nintScore_,minScore_,maxScore_);
200  histograms.h_energy_vs_score_caloparticle2layercl_perlayer[ilayer] = ibook.book2D("Energy_vs_Score_caloparticle2layer_perlayer"+istr1, "Energy vs Score of CaloParticle per Layer Cluster for layer "+istr2, nintScore_,minScore_,maxScore_, nintSharedEneFrac_, minSharedEneFrac_, maxSharedEneFrac_);
201  histograms.h_energy_vs_score_layercl2caloparticle_perlayer[ilayer] = ibook.book2D("Energy_vs_Score_layer2caloparticle_perlayer"+istr1, "Energy vs Score of Layer Cluster per CaloParticle Layer for layer "+istr2, nintScore_,minScore_,maxScore_, nintSharedEneFrac_, minSharedEneFrac_, maxSharedEneFrac_);
202  histograms.h_sharedenergy_caloparticle2layercl_perlayer[ilayer] = ibook.book1D("SharedEnergy_caloparticle2layercl_perlayer"+istr1, "Shared Energy of CaloParticle per Layer Cluster for layer "+istr2, nintSharedEneFrac_, minSharedEneFrac_, maxSharedEneFrac_);
203  histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer[ilayer] = ibook.bookProfile("SharedEnergy_caloparticle2layercl_vs_eta_perlayer"+istr1, "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_, minSharedEneFrac_, maxSharedEneFrac_);
204  histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer[ilayer] = ibook.bookProfile("SharedEnergy_caloparticle2layercl_vs_phi_perlayer"+istr1, "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_, minSharedEneFrac_, maxSharedEneFrac_);
205  histograms.h_sharedenergy_layercl2caloparticle_perlayer[ilayer] = ibook.book1D("SharedEnergy_layercluster2caloparticle_perlayer"+istr1, "Shared Energy of Layer Cluster per Layer Calo Particle for layer "+istr2, nintSharedEneFrac_, minSharedEneFrac_, maxSharedEneFrac_);
206  histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer[ilayer] = ibook.bookProfile("SharedEnergy_layercl2caloparticle_vs_eta_perlayer"+istr1, "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer "+istr2, nintEta_, minEta_, maxEta_, minSharedEneFrac_, maxSharedEneFrac_);
207  histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer[ilayer] = ibook.bookProfile("SharedEnergy_layercl2caloparticle_vs_phi_perlayer"+istr1, "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer "+istr2, nintPhi_, minPhi_, maxPhi_, minSharedEneFrac_, maxSharedEneFrac_);
208  histograms.h_num_caloparticle_eta_perlayer[ilayer] = ibook.book1D("Num_CaloParticle_Eta_perlayer"+istr1, "Num CaloParticle Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
209  histograms.h_numDup_caloparticle_eta_perlayer[ilayer] = ibook.book1D("NumDup_CaloParticle_Eta_perlayer"+istr1, "Num Duplicate CaloParticle Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
210  histograms.h_denom_caloparticle_eta_perlayer[ilayer] = ibook.book1D("Denom_CaloParticle_Eta_perlayer"+istr1, "Denom CaloParticle Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
211  histograms.h_num_caloparticle_phi_perlayer[ilayer] = ibook.book1D("Num_CaloParticle_Phi_perlayer"+istr1, "Num CaloParticle Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
212  histograms.h_numDup_caloparticle_phi_perlayer[ilayer] = ibook.book1D("NumDup_CaloParticle_Phi_perlayer"+istr1, "Num Duplicate CaloParticle Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
213  histograms.h_denom_caloparticle_phi_perlayer[ilayer] = ibook.book1D("Denom_CaloParticle_Phi_perlayer"+istr1, "Denom CaloParticle Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
214  histograms.h_num_layercl_eta_perlayer[ilayer] = ibook.book1D("Num_LayerCluster_Eta_perlayer"+istr1, "Num LayerCluster Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
215  histograms.h_numMerge_layercl_eta_perlayer[ilayer] = ibook.book1D("NumMerge_LayerCluster_Eta_perlayer"+istr1, "Num Merge LayerCluster Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
216  histograms.h_denom_layercl_eta_perlayer[ilayer] = ibook.book1D("Denom_LayerCluster_Eta_perlayer"+istr1, "Denom LayerCluster Eta per Layer Cluster for layer "+istr2, nintEta_, minEta_, maxEta_);
217  histograms.h_num_layercl_phi_perlayer[ilayer] = ibook.book1D("Num_LayerCluster_Phi_perlayer"+istr1, "Num LayerCluster Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
218  histograms.h_numMerge_layercl_phi_perlayer[ilayer] = ibook.book1D("NumMerge_LayerCluster_Phi_perlayer"+istr1, "Num Merge LayerCluster Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
219  histograms.h_denom_layercl_phi_perlayer[ilayer] = ibook.book1D("Denom_LayerCluster_Phi_perlayer"+istr1, "Denom LayerCluster Phi per Layer Cluster for layer "+istr2, nintPhi_, minPhi_, maxPhi_);
220  histograms.h_cellAssociation_perlayer[ilayer] = ibook.book1D("cellAssociation_perlayer"+istr1, "Cell Association for layer "+istr2, 5, -4., 1.);
221  histograms.h_cellAssociation_perlayer[ilayer].setBinLabel(2, "TN(purity)");
222  histograms.h_cellAssociation_perlayer[ilayer].setBinLabel(3, "FN(ineff.)");
223  histograms.h_cellAssociation_perlayer[ilayer].setBinLabel(4, "FP(fake)");
224  histograms.h_cellAssociation_perlayer[ilayer].setBinLabel(5, "TP(eff.)");
225  }
226 
227  //---------------------------------------------------------------------------------------------------------------------------
228  for(std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
229  auto istr = std::to_string(*it);
230  histograms.h_clusternum_perthick[(*it)] = ibook.book1D("totclusternum_thick_"+istr,"total number of layer clusters for thickness "+istr,nintTotNClsperthick_,minTotNClsperthick_,maxTotNClsperthick_);
231  //---
232  histograms.h_cellsenedens_perthick[(*it)] = ibook.book1D("cellsenedens_thick_"+istr,"energy density of cluster cells for thickness "+istr,nintCellsEneDensperthick_,minCellsEneDensperthick_,maxCellsEneDensperthick_);
233  }
234 
235  //---------------------------------------------------------------------------------------------------------------------------
236  //Not all combination exists but we should keep them all for cross checking reason.
237  for(std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
238  for (unsigned ilayer = 0; ilayer < 2*layers; ++ilayer) {
239  auto istr1 = std::to_string(*it);
240  auto istr2 = std::to_string(ilayer);
241  while(istr2.size() < 2)
242  istr2.insert(0, "0");
243  auto istr = istr1 + "_" + istr2;
244  //We will make a mapping to the regural layer naming plus z- or z+ for convenience
245  std::string istr3 = "";
246  //First with the -z endcap
247  if (ilayer < layers){
248  istr3 = std::to_string(ilayer + 1) + " in z- ";
249  }else { //Then for the +z
250  istr3 = std::to_string(ilayer - 51) + " in z+ ";
251  }
252  //---
253  histograms.h_cellsnum_perthickperlayer[istr] = ibook.book1D("cellsnum_perthick_perlayer_"+istr,"total number of cells for layer "+ istr3+" for thickness "+istr1,nintTotNcellsperthickperlayer_,minTotNcellsperthickperlayer_,maxTotNcellsperthickperlayer_);
254  //---
255  histograms.h_distancetoseedcell_perthickperlayer[istr] = ibook.book1D("distancetoseedcell_perthickperlayer_"+istr,"distance of cluster cells to seed cell for layer "+ istr3+" for thickness "+istr1,nintDisToSeedperthickperlayer_,minDisToSeedperthickperlayer_,maxDisToSeedperthickperlayer_);
256  //---
257  histograms.h_distancetoseedcell_perthickperlayer_eneweighted[istr] = ibook.book1D("distancetoseedcell_perthickperlayer_eneweighted_"+istr,"energy weighted distance of cluster cells to seed cell for layer "+ istr3+" for thickness "+istr1,nintDisToSeedperthickperlayerenewei_,minDisToSeedperthickperlayerenewei_,maxDisToSeedperthickperlayerenewei_);
258  //---
259  histograms.h_distancetomaxcell_perthickperlayer[istr] = ibook.book1D("distancetomaxcell_perthickperlayer_"+istr,"distance of cluster cells to max cell for layer "+ istr3+" for thickness "+istr1,nintDisToMaxperthickperlayer_,minDisToMaxperthickperlayer_,maxDisToMaxperthickperlayer_);
260  //---
261  histograms.h_distancetomaxcell_perthickperlayer_eneweighted[istr] = ibook.book1D("distancetomaxcell_perthickperlayer_eneweighted_"+istr,"energy weighted distance of cluster cells to max cell for layer "+ istr3+" for thickness "+istr1,nintDisToMaxperthickperlayerenewei_,minDisToMaxperthickperlayerenewei_,maxDisToMaxperthickperlayerenewei_);
262  //---
263  histograms.h_distancebetseedandmaxcell_perthickperlayer[istr] = ibook.book1D("distancebetseedandmaxcell_perthickperlayer_"+istr,"distance of seed cell to max cell for layer "+ istr3+" for thickness "+istr1,nintDisSeedToMaxperthickperlayer_,minDisSeedToMaxperthickperlayer_,maxDisSeedToMaxperthickperlayer_);
264  //---
265  histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer[istr] = ibook.book2D("distancebetseedandmaxcellvsclusterenergy_perthickperlayer_"+istr,"distance of seed cell to max cell vs cluster energy for layer "+ istr3+" for thickness "+istr1,nintDisSeedToMaxperthickperlayer_,minDisSeedToMaxperthickperlayer_,maxDisSeedToMaxperthickperlayer_,nintClEneperthickperlayer_,minClEneperthickperlayer_,maxClEneperthickperlayer_);
266 
267  }
268  }
269  //---------------------------------------------------------------------------------------------------------------------------
270 
271 }
272 
274 
275  //We will save some info straight from geometry to avoid mistakes from updates
276  //----------- TODO ----------------------------------------------------------
277  //For now values returned for 'lastLayerFHzp': '104', 'lastLayerFHzm': '52' are not the one expected.
278  //Will come back to this when there will be info in CMSSW to put in DQM file.
279  histograms.lastLayerEEzm.fill( recHitTools_->lastLayerEE() );
280  histograms.lastLayerFHzm.fill( recHitTools_->lastLayerFH() );
281  histograms.maxlayerzm.fill( layers );
282  histograms.lastLayerEEzp.fill( recHitTools_->lastLayerEE() + layers );
283  histograms.lastLayerFHzp.fill( recHitTools_->lastLayerFH() + layers);
284  histograms.maxlayerzp.fill( layers + layers);
285 
286 }
287 
288 
290  int pdgid,
291  const CaloParticle & caloparticle,
292  std::vector<SimVertex> const & simVertices) const {
293 
294  const auto eta = getEta(caloparticle.eta());
295  if (histograms.h_caloparticle_eta.count(pdgid)){ histograms.h_caloparticle_eta.at(pdgid).fill(eta); }
296  if (histograms.h_caloparticle_eta_Zorigin.count(pdgid)){ histograms.h_caloparticle_eta_Zorigin.at(pdgid).fill( simVertices.at(caloparticle.g4Tracks()[0].vertIndex()).position().z(), eta ); }
297 
298  if (histograms.h_caloparticle_energy.count(pdgid)){ histograms.h_caloparticle_energy.at(pdgid).fill( caloparticle.energy() ); }
299  if (histograms.h_caloparticle_pt.count(pdgid)){ histograms.h_caloparticle_pt.at(pdgid).fill( caloparticle.pt() ); }
300  if (histograms.h_caloparticle_phi.count(pdgid)){ histograms.h_caloparticle_phi.at(pdgid).fill( caloparticle.phi() ); }
301 
302 
303 }
304 
306  int count,
307  const reco::CaloCluster & cluster) const {
308 
309  const auto eta = getEta(cluster.eta());
310  histograms.h_cluster_eta[count].fill(eta);
311 }
312 
315  std::vector<CaloParticle> const & cP,
316  std::map<DetId, const HGCRecHit *> const & hitMap,
317  unsigned layers) const
318 {
319 
320  auto nLayerClusters = clusters.size();
321  auto nCaloParticles = cP.size();
322 
323  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster> > detIdToCaloParticleId_Map;
324  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster> > detIdToLayerClusterId_Map;
325 
326  // this contains the ids of the caloparticles contributing with at least one hit to the layer cluster and the reconstruction error
327  std::vector<std::vector<std::pair<unsigned int, float> > > cpsInLayerCluster;
328  cpsInLayerCluster.resize(nLayerClusters);
329 
330 
331 
332  std::vector<std::vector<caloParticleOnLayer> > cPOnLayer;
333  cPOnLayer.resize(nCaloParticles);
334  for(unsigned int i = 0; i< nCaloParticles; ++i)
335  {
336  cPOnLayer[i].resize(layers*2);
337  for(unsigned int j = 0; j< layers*2; ++j)
338  {
339  cPOnLayer[i][j].caloParticleId = i;
340  cPOnLayer[i][j].energy = 0.f;
341  cPOnLayer[i][j].hits_and_fractions.clear();
342  }
343  }
344 
345  for(unsigned int cpId =0; cpId < nCaloParticles; ++cpId)
346  {
347  const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters();
348  for (const auto& it_sc : simClusterRefVector) {
349  const SimCluster& simCluster = (*(it_sc));
350  const auto& hits_and_fractions = simCluster.hits_and_fractions();
351  for (const auto& it_haf : hits_and_fractions) {
352  DetId hitid = (it_haf.first);
353  int cpLayerId = recHitTools_->getLayerWithOffset(hitid) + layers * ((recHitTools_->zside(hitid) + 1) >> 1) - 1;
354  std::map<DetId,const HGCRecHit *>::const_iterator itcheck= hitMap.find(hitid);
355  if(itcheck != hitMap.end())
356  {
357  const HGCRecHit *hit = itcheck->second;
358  auto hit_find_it = detIdToCaloParticleId_Map.find(hitid);
359  if (hit_find_it == detIdToCaloParticleId_Map.end())
360  {
361  detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster> ();
362  detIdToCaloParticleId_Map[hitid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{cpId,it_haf.second});
363  }
364  else
365  {
366  auto findHitIt = std::find(detIdToCaloParticleId_Map[hitid].begin(), detIdToCaloParticleId_Map[hitid].end(), HGVHistoProducerAlgo::detIdInfoInCluster{cpId,it_haf.second}) ;
367  if( findHitIt != detIdToCaloParticleId_Map[hitid].end() )
368  {
369  findHitIt->fraction +=it_haf.second;
370  }
371  else
372  {
373  detIdToCaloParticleId_Map[hitid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{cpId,it_haf.second});
374  }
375  }
376  cPOnLayer[cpId][cpLayerId].energy += it_haf.second*hit->energy();
377  cPOnLayer[cpId][cpLayerId].hits_and_fractions.emplace_back(hitid,it_haf.second);
378  }
379  }
380  }
381  }
382 
383 
384  for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId)
385  {
386  const std::vector<std::pair<DetId, float> >& hits_and_fractions = clusters[lcId].hitsAndFractions();
387  unsigned int numberOfHitsInLC = hits_and_fractions.size();
388 
389  std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
390  const auto firstHitDetId = hits_and_fractions[0].first;
391  int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
392 
393  int maxCPId_byNumberOfHits = -1;
394  unsigned int maxCPNumberOfHitsInLC = 0;
395  int maxCPId_byEnergy = -1;
396  float maxEnergySharedLCandCP = 0.f;
397  float energyFractionOfLCinCP = 0.f;
398  float energyFractionOfCPinLC = 0.f;
399  std::unordered_map<unsigned, unsigned> occurrencesCPinLC;
400  std::unordered_map<unsigned, float> CPEnergyInLC;
401  unsigned int numberOfNoiseHitsInLC = 0;
402  unsigned int numberOfHaloHitsInLC = 0;
403 
404  for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++)
405  {
406  DetId rh_detid = hits_and_fractions[hitId].first;
407  auto rhFraction = hits_and_fractions[hitId].second;
408 
409  std::map<DetId,const HGCRecHit *>::const_iterator itcheck= hitMap.find(rh_detid);
410  const HGCRecHit *hit = itcheck->second;
411 
412 
413  auto hit_find_in_LC = detIdToLayerClusterId_Map.find(rh_detid);
414  if (hit_find_in_LC == detIdToLayerClusterId_Map.end())
415  {
416  detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster> ();
417  }
418  detIdToLayerClusterId_Map[rh_detid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{lcId,rhFraction});
419 
420  auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
421 
422  // if the fraction is zero or the hit does not belong to any calo
423  // particle, set the caloparticleId for the hit to -1 this will
424  // contribute to the number of noise hits
425 
426  // MR Remove the case in which the fraction is 0, since this could be a
427  // real hit that has been marked as halo.
428  if (rhFraction == 0.) {
429  hitsToCaloParticleId[hitId] = -2;
430  numberOfHaloHitsInLC++;
431  }
432  if (hit_find_in_CP == detIdToCaloParticleId_Map.end())
433  {
434  hitsToCaloParticleId[hitId] -= 1;
435  }
436  else
437  {
438  auto maxCPEnergyInLC = 0.f;
439  auto maxCPId = -1;
440  for(auto& h: hit_find_in_CP->second)
441  {
442  CPEnergyInLC[h.clusterId] += h.fraction*hit->energy();
443  cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[lcId].first += h.fraction*hit->energy();
444  cpsInLayerCluster[lcId].emplace_back(std::make_pair<int, float>(h.clusterId, 0.f));
445  if(h.fraction >maxCPEnergyInLC)
446  {
447  maxCPEnergyInLC = CPEnergyInLC[h.clusterId];
448  maxCPId = h.clusterId;
449  }
450  }
451  hitsToCaloParticleId[hitId] = maxCPId;
452  }
453  histograms.h_cellAssociation_perlayer.at(lcLayerId%52+1).fill(hitsToCaloParticleId[hitId] > 0. ? 0. : hitsToCaloParticleId[hitId]);
454  }
455 
456  for(auto& c: hitsToCaloParticleId)
457  {
458  if(c < 0)
459  {
460  numberOfNoiseHitsInLC++;
461  }
462  else
463  {
464  occurrencesCPinLC[c]++;
465  }
466  }
467 
468  for(auto&c : occurrencesCPinLC)
469  {
470  if(c.second > maxCPNumberOfHitsInLC)
471  {
472  maxCPId_byNumberOfHits = c.first;
473  maxCPNumberOfHitsInLC = c.second;
474  }
475  }
476 
477  for(auto&c : CPEnergyInLC)
478  {
479  if(c.second > maxEnergySharedLCandCP)
480  {
481  maxCPId_byEnergy = c.first;
482  maxEnergySharedLCandCP = c.second;
483  }
484  }
485  float totalCPEnergyOnLayer = 0.f;
486  if(maxCPId_byEnergy >=0) {
487  totalCPEnergyOnLayer = cPOnLayer[maxCPId_byEnergy][lcLayerId].energy;
488  energyFractionOfCPinLC = maxEnergySharedLCandCP/totalCPEnergyOnLayer;
489  if(clusters[lcId].energy()>0.f)
490  {
491  energyFractionOfLCinCP = maxEnergySharedLCandCP/clusters[lcId].energy();
492  }
493  }
494  LogDebug("HGCalValidator") << std::setw(10) << "LayerId:"<< "\t"
495  << std::setw(12) << "layerCluster"<< "\t"
496  << std::setw(10) << "lc energy"<< "\t"
497  << std::setw(5) << "nhits" << "\t"
498  << std::setw(12) << "noise hits" << "\t"
499  << std::setw(22) << "maxCPId_byNumberOfHits" << "\t"
500  << std::setw(8) << "nhitsCP"<< "\t"
501  << std::setw(16) << "maxCPId_byEnergy" << "\t"
502  << std::setw(23) << "maxEnergySharedLCandCP" << "\t"
503  << std::setw(22) << "totalCPEnergyOnLayer" << "\t"
504  << std::setw(22) << "energyFractionOfLCinCP" << "\t"
505  << std::setw(25) << "energyFractionOfCPinLC" << "\t" << "\n";
506  LogDebug("HGCalValidator") << std::setw(10) << lcLayerId << "\t"
507  << std::setw(12) << lcId << "\t"
508  << std::setw(10) << clusters[lcId].energy()<< "\t"
509  << std::setw(5) << numberOfHitsInLC << "\t"
510  << std::setw(12) << numberOfNoiseHitsInLC << "\t"
511  << std::setw(22) << maxCPId_byNumberOfHits << "\t"
512  << std::setw(8) << maxCPNumberOfHitsInLC<< "\t"
513  << std::setw(16) << maxCPId_byEnergy << "\t"
514  << std::setw(23) << maxEnergySharedLCandCP << "\t"
515  << std::setw(22) << totalCPEnergyOnLayer << "\t"
516  << std::setw(22) << energyFractionOfLCinCP << "\t"
517  << std::setw(25) << energyFractionOfCPinLC << "\n";
518  }
519 
520  for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId)
521  {
522  // find the unique caloparticles id contributing to the layer clusters
523  std::sort(cpsInLayerCluster[lcId].begin(), cpsInLayerCluster[lcId].end());
524  auto last = std::unique(cpsInLayerCluster[lcId].begin(), cpsInLayerCluster[lcId].end());
525  cpsInLayerCluster[lcId].erase(last, cpsInLayerCluster[lcId].end());
526  const std::vector<std::pair<DetId, float> >& hits_and_fractions = clusters[lcId].hitsAndFractions();
527  unsigned int numberOfHitsInLC = hits_and_fractions.size();
528  auto firstHitDetId = hits_and_fractions[0].first;
529  int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
530  if (clusters[lcId].energy() == 0. && !cpsInLayerCluster[lcId].empty()) {
531  for(auto& cpPair : cpsInLayerCluster[lcId]) {
532  cpPair.second = 1.;
533  LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId
534  << "\t CP id: \t" << cpPair.first
535  << "\t score \t" << cpPair.second
536  << "\n";
537  histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId%52+1).fill(cpPair.second);
538  }
539  continue;
540  }
541  float invLayerClusterEnergyWeight = 1.f/(clusters[lcId].energy()*clusters[lcId].energy());
542  for(unsigned int i = 0; i < numberOfHitsInLC; ++i)
543  {
544  DetId rh_detid = hits_and_fractions[i].first;
545  float rhFraction = hits_and_fractions[i].second;
546  bool hitWithNoCP = false;
547 
548  auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
549  if(hit_find_in_CP == detIdToCaloParticleId_Map.end()) hitWithNoCP = true;
550  auto itcheck= hitMap.find(rh_detid);
551  const HGCRecHit *hit = itcheck->second;
552  float hitEnergyWeight = hit->energy()*hit->energy();
553 
554  for(auto& cpPair : cpsInLayerCluster[lcId])
555  {
556  float cpFraction = 0.f;
557  if(!hitWithNoCP)
558  {
559  auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), detIdToCaloParticleId_Map[rh_detid].end(), HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first,0.f});
560  if(findHitIt != detIdToCaloParticleId_Map[rh_detid].end())
561  cpFraction = findHitIt->fraction;
562  }
563  cpPair.second += (rhFraction - cpFraction)*(rhFraction - cpFraction)*hitEnergyWeight*invLayerClusterEnergyWeight;
564  }
565  }
566 
567  if(cpsInLayerCluster[lcId].empty()) LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " << "\t score \t-1" <<"\n";
568 
569  for(auto& cpPair : cpsInLayerCluster[lcId])
570  {
571  LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId
572  << "\t CP id: \t" << cpPair.first
573  << "\t score \t" << cpPair.second
574  << "\n";
575  histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId).fill(cpPair.second);
576  auto const & cp_linked = cPOnLayer[cpPair.first][lcLayerId].layerClusterIdToEnergyAndScore[lcId];
577  histograms.h_sharedenergy_layercl2caloparticle_perlayer.at(lcLayerId).fill(cp_linked.first/clusters[lcId].energy());
578  histograms.h_energy_vs_score_layercl2caloparticle_perlayer.at(lcLayerId).fill(cpPair.second > 1. ? 1. : cpPair.second, cp_linked.first/clusters[lcId].energy());
579  }
580 
581  auto assoc = std::count_if(
582  std::begin(cpsInLayerCluster[lcId]),
583  std::end(cpsInLayerCluster[lcId]),
584  [](const auto &obj){return obj.second < ScoreCutLCtoCP_;});
585  if (assoc) {
586  histograms.h_num_layercl_eta_perlayer.at(lcLayerId).fill(clusters[lcId].eta());
587  histograms.h_num_layercl_phi_perlayer.at(lcLayerId).fill(clusters[lcId].phi());
588  if (assoc > 1) {
589  histograms.h_numMerge_layercl_eta_perlayer.at(lcLayerId).fill(clusters[lcId].eta());
590  histograms.h_numMerge_layercl_phi_perlayer.at(lcLayerId).fill(clusters[lcId].phi());
591  }
592  auto best = std::min_element(
593  std::begin(cpsInLayerCluster[lcId]),
594  std::end(cpsInLayerCluster[lcId]),
595  [](const auto &obj1, const auto &obj2){return obj1.second < obj2.second;});
596  auto const & best_cp_linked = cPOnLayer[best->first][lcLayerId].layerClusterIdToEnergyAndScore[lcId];
597  histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer.at(lcLayerId).fill(clusters[lcId].eta(), best_cp_linked.first/clusters[lcId].energy());
598  histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer.at(lcLayerId).fill(clusters[lcId].phi(), best_cp_linked.first/clusters[lcId].energy());
599  }
600  histograms.h_denom_layercl_eta_perlayer.at(lcLayerId).fill(clusters[lcId].eta());
601  histograms.h_denom_layercl_phi_perlayer.at(lcLayerId).fill(clusters[lcId].phi());
602  }
603 
604 
605 
606  for(unsigned int cpId =0; cpId < nCaloParticles; ++cpId)
607  {
608 
609  for(unsigned int layerId = 0; layerId< layers*2; ++layerId)
610  {
611  unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size();
612  float CPenergy = cPOnLayer[cpId][layerId].energy;
613  if(CPNumberOfHits==0) continue;
614  int lcWithMaxEnergyInCP = -1;
615  float maxEnergyLCinCP = 0.f;
616  float CPEnergyFractionInLC = 0.f;
617  for(auto& lc : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore)
618  {
619  if(lc.second.first > maxEnergyLCinCP)
620  {
621  maxEnergyLCinCP = lc.second.first;
622  lcWithMaxEnergyInCP = lc.first;
623  }
624  }
625  if(CPenergy >0.f) CPEnergyFractionInLC = maxEnergyLCinCP/CPenergy;
626 
627  LogDebug("HGCalValidator") << std::setw(8) << "LayerId:\t"
628  << std::setw(12) << "caloparticle\t"
629  << std::setw(15) << "cp total energy\t"
630  << std::setw(15) << "cpEnergyOnLayer\t"
631  << std::setw(14) << "CPNhitsOnLayer\t"
632  << std::setw(18) << "lcWithMaxEnergyInCP\t"
633  << std::setw(15) << "maxEnergyLCinCP\t"
634  << std::setw(20) << "CPEnergyFractionInLC" << "\n";
635  LogDebug("HGCalValidator") << std::setw(8) << layerId << "\t"
636  << std::setw(12) << cpId << "\t"
637  << std::setw(15) << cP[cpId].energy() << "\t"
638  << std::setw(15) << CPenergy << "\t"
639  << std::setw(14) << CPNumberOfHits << "\t"
640  << std::setw(18) << lcWithMaxEnergyInCP << "\t"
641  << std::setw(15) << maxEnergyLCinCP << "\t"
642  << std::setw(20) << CPEnergyFractionInLC << "\n";
643 
644  for(unsigned int i=0; i< CPNumberOfHits; ++i)
645  {
646  auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first;
647  auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second;
648 
649 
650  bool hitWithNoLC = false;
651  if(cpFraction ==0.f) continue; //hopefully this should never happen
652  auto hit_find_in_LC = detIdToLayerClusterId_Map.find(cp_hitDetId);
653  if(hit_find_in_LC == detIdToLayerClusterId_Map.end()) hitWithNoLC = true;
654  auto itcheck= hitMap.find(cp_hitDetId);
655  const HGCRecHit *hit = itcheck->second;
656  float hitEnergyWeight = hit->energy()*hit->energy();
657  float invCPEnergyWeight = 1.f/(CPenergy*CPenergy);
658  for(auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore)
659  {
660  unsigned int layerClusterId = lcPair.first;
661  float lcFraction = 0.f;
662 
663  if(!hitWithNoLC)
664  {
665  auto findHitIt = std::find(
666  detIdToLayerClusterId_Map[cp_hitDetId].begin(),
667  detIdToLayerClusterId_Map[cp_hitDetId].end(),
668  HGVHistoProducerAlgo::detIdInfoInCluster{layerClusterId, 0.f}
669  );
670  if(findHitIt != detIdToLayerClusterId_Map[cp_hitDetId].end())
671  lcFraction = findHitIt->fraction;
672  }
673  if (lcFraction == 0.) {
674  lcFraction = -1.;
675  }
676  lcPair.second.second += (lcFraction - cpFraction)*(lcFraction - cpFraction)*hitEnergyWeight*invCPEnergyWeight;
677  LogDebug("HGCalValidator") << "layerClusterId:\t" << layerClusterId << "\t"
678  << "lcfraction,cpfraction:\t" << lcFraction << ", " << cpFraction << "\t"
679  << "hitEnergyWeight:\t" << hitEnergyWeight << "\t"
680  << "currect score:\t" << lcPair.second.second << "\t"
681  << "invCPEnergyWeight:\t" << invCPEnergyWeight << "\n";
682  }
683  }
684 
685 
686 
687  if(cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty())
688  LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\tLC id:\t-1 " << "\t score \t-1" <<"\n";
689 
690  for(auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore)
691  {
692  LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t LC id: \t"
693  << lcPair.first << "\t score \t"
694  << lcPair.second.second << "\t"
695  << "shared energy:\t" << lcPair.second.first << "\t"
696  << "shared energy fraction:\t" << (lcPair.second.first/CPenergy) << "\n";
697  histograms.h_score_caloparticle2layercl_perlayer.at(layerId).fill(lcPair.second.second > 1. ? 1. : lcPair.second.second);
698  histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId).fill(lcPair.second.first/CPenergy);
699  histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId).fill(lcPair.second.second > 1. ? 1. : lcPair.second.second, lcPair.second.first/CPenergy);
700  }
701  auto assoc = std::count_if(
702  std::begin(cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore),
703  std::end(cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore),
704  [](const auto &obj){return obj.second.second < ScoreCutCPtoLC_;});
705  if (assoc) {
706  histograms.h_num_caloparticle_eta_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().eta());
707  histograms.h_num_caloparticle_phi_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().phi());
708  if (assoc > 1) {
709  histograms.h_numDup_caloparticle_eta_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().eta());
710  histograms.h_numDup_caloparticle_phi_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().phi());
711  }
712  auto best = std::min_element(
713  std::begin(cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore),
714  std::end(cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore),
715  [](const auto &obj1, const auto &obj2){return obj1.second.second < obj2.second.second;});
716  histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().eta(), best->second.first/CPenergy);
717  histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().phi(), best->second.first/CPenergy);
718  }
719  histograms.h_denom_caloparticle_eta_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().eta());
720  histograms.h_denom_caloparticle_phi_perlayer.at(layerId).fill(cP[cpId].g4Tracks()[0].momentum().phi());
721  }
722  }
723 }
724 
726  int count,
728  const Density &densities,
729  std::vector<CaloParticle> const & cP,
730  std::map<DetId, const HGCRecHit*> const & hitMap,
731  std::map<double, double> cummatbudg,
732  unsigned layers,
733  std::vector<int> thicknesses) const {
734 
735  //Each event to be treated as two events: an event in +ve endcap,
736  //plus another event in -ve endcap. In this spirit there will be
737  //a layer variable (layerid) that maps the layers in :
738  //-z: 0->51
739  //+z: 52->103
740 
741  //To keep track of total num of layer clusters per layer
742  //tnlcpl[layerid]
743  std::vector<int> tnlcpl(1000, 0); //tnlcpl.clear(); tnlcpl.reserve(1000);
744 
745  //To keep track of the total num of clusters per thickness in plus and in minus endcaps
746  std::map<std::string, int> tnlcpthplus; tnlcpthplus.clear();
747  std::map<std::string, int> tnlcpthminus; tnlcpthminus.clear();
748  //At the beginning of the event all layers should be initialized to zero total clusters per thickness
749  for(std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
750  tnlcpthplus.insert( std::pair<std::string, int>(std::to_string(*it), 0) );
751  tnlcpthminus.insert( std::pair<std::string, int>(std::to_string(*it), 0) );
752  }
753  //To keep track of the total num of clusters with mixed thickness hits per event
754  tnlcpthplus.insert( std::pair<std::string, int>( "mixed", 0) );
755  tnlcpthminus.insert( std::pair<std::string, int>( "mixed", 0) );
756 
757  layerClusters_to_CaloParticles(histograms, clusters, cP, hitMap, layers);
758 
759  //To find out the total amount of energy clustered per layer
760  //Initialize with zeros because I see clear gives weird numbers.
761  std::vector<double> tecpl(1000, 0.0); //tecpl.clear(); tecpl.reserve(1000);
762  //for the longitudinal depth barycenter
763  std::vector<double> ldbar(1000, 0.0); //ldbar.clear(); ldbar.reserve(1000);
764 
765  //We need to compare with the total amount of energy coming from caloparticles
766  double caloparteneplus = 0.;
767  double caloparteneminus = 0.;
768  for (auto const caloParticle : cP) {
769  if (caloParticle.eta() >= 0. ) {caloparteneplus = caloparteneplus + caloParticle.energy();}
770  if (caloParticle.eta() < 0. ) {caloparteneminus = caloparteneminus + caloParticle.energy();}
771  }
772 
773  //loop through clusters of the event
774  for (unsigned int layerclusterIndex = 0; layerclusterIndex < clusters.size(); layerclusterIndex++) {
775 
776  const std::vector<std::pair<DetId, float> > hits_and_fractions = clusters[layerclusterIndex].hitsAndFractions();
777 
778  const DetId seedid = clusters[layerclusterIndex].seed();
779  const double seedx = recHitTools_->getPosition(seedid).x();
780  const double seedy = recHitTools_->getPosition(seedid).y();
781  DetId maxid = findmaxhit( clusters[layerclusterIndex], hitMap );
782 
783  // const DetId maxid = clusters[layerclusterIndex].max();
784  double maxx = recHitTools_->getPosition(maxid).x();
785  double maxy = recHitTools_->getPosition(maxid).y();
786 
787  //Auxillary variables to count the number of different kind of hits in each cluster
788  int nthhits120p = 0; int nthhits200p = 0;int nthhits300p = 0;int nthhitsscintp = 0;
789  int nthhits120m = 0; int nthhits200m = 0;int nthhits300m = 0;int nthhitsscintm = 0;
790  //For the hits thickness of the layer cluster.
791  double thickness = 0.;
792  //The layer the cluster belongs to. As mentioned in the mapping above, it takes into account -z and +z.
793  int layerid = 0;
794  //We will need another layer variable for the longitudinal material budget file reading.
795  //In this case we need no distinction between -z and +z.
796  int lay = 0;
797  //We will need here to save the combination thick_lay
798  std::string istr = "";
799  //boolean to check for the layer that the cluster belong to. Maybe later will check all the layer hits.
800  bool cluslay = true;
801  //zside that the current cluster belongs to.
802  int zside = 0;
803 
804  for (std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin(); it_haf != hits_and_fractions.end(); ++it_haf) {
805  const DetId rh_detid = it_haf->first;
806  //The layer that the current hit belongs to
807  layerid = recHitTools_->getLayerWithOffset(rh_detid) + layers * ((recHitTools_->zside(rh_detid) + 1) >> 1) - 1;
808  lay = recHitTools_->getLayerWithOffset(rh_detid);
809  zside = recHitTools_->zside(rh_detid);
810  if (rh_detid.det() == DetId::Forward || rh_detid.det() == DetId::HGCalEE || rh_detid.det() == DetId::HGCalHSi){
811  thickness = recHitTools_->getSiThickness(rh_detid);
812  } else if (rh_detid.det() == DetId::HGCalHSc){
813  thickness = -1;
814  } else {
815  LogDebug("HGCalValidator") << "These are HGCal layer clusters, you shouldn't be here !!! " << layerid << "\n";
816  continue;
817  }
818 
819  //Count here only once the layer cluster and save the combination thick_layerid
820  std::string curistr = std::to_string( (int) thickness );
821  std::string lay_string = std::to_string(layerid);
822  while(lay_string.size() < 2)
823  lay_string.insert(0, "0");
824  curistr += "_" + lay_string;
825  if (cluslay){ tnlcpl[layerid]++; istr = curistr; cluslay = false; }
826 
827  if ( (thickness == 120.) && (recHitTools_->zside(rh_detid) > 0. ) ) {nthhits120p++;}
828  else if ( (thickness == 120.) && (recHitTools_->zside(rh_detid) < 0. ) ) {nthhits120m++;}
829  else if ( (thickness == 200.) && (recHitTools_->zside(rh_detid) > 0. ) ) {nthhits200p++;}
830  else if ( (thickness == 200.) && (recHitTools_->zside(rh_detid) < 0. ) ) {nthhits200m++;}
831  else if ( (thickness == 300.) && (recHitTools_->zside(rh_detid) > 0. ) ) {nthhits300p++;}
832  else if ( (thickness == 300.) && (recHitTools_->zside(rh_detid) < 0. ) ) {nthhits300m++;}
833  else if ( (thickness == -1) && (recHitTools_->zside(rh_detid) > 0. ) ) {nthhitsscintp++;}
834  else if ( (thickness == -1) && (recHitTools_->zside(rh_detid) < 0. ) ) {nthhitsscintm++;}
835  else { //assert(0);
836  LogDebug("HGCalValidator") << " You are running a geometry that contains thicknesses different than the normal ones. " << "\n";
837  }
838 
839  std::map<DetId,const HGCRecHit *>::const_iterator itcheck= hitMap.find(rh_detid);
840  if (itcheck == hitMap.end()) {
841  LogDebug("HGCalValidator") << " You shouldn't be here - Unable to find a hit " << rh_detid.rawId() << " " << rh_detid.det() << " " << HGCalDetId(rh_detid) << "\n";
842  continue;
843  }
844 
845  const HGCRecHit *hit = itcheck->second;
846 
847  //Here for the per cell plots
848  //----
849  const double hit_x = recHitTools_->getPosition(rh_detid).x();
850  const double hit_y = recHitTools_->getPosition(rh_detid).y();
851  double distancetoseed = distance(seedx, seedy, hit_x, hit_y);
852  double distancetomax = distance(maxx, maxy, hit_x, hit_y);
853  if ( distancetoseed != 0. && histograms.h_distancetoseedcell_perthickperlayer.count(curistr)){
854  histograms.h_distancetoseedcell_perthickperlayer.at(curistr).fill( distancetoseed );
855  }
856  //----
857  if ( distancetoseed != 0. && histograms.h_distancetoseedcell_perthickperlayer_eneweighted.count(curistr)){
858  histograms.h_distancetoseedcell_perthickperlayer_eneweighted.at(curistr).fill( distancetoseed , hit->energy() ); }
859  //----
860  if ( distancetomax != 0. && histograms.h_distancetomaxcell_perthickperlayer.count(curistr)){
861  histograms.h_distancetomaxcell_perthickperlayer.at(curistr).fill( distancetomax ); }
862  //----
863  if ( distancetomax != 0. && histograms.h_distancetomaxcell_perthickperlayer_eneweighted.count(curistr)){
864  histograms.h_distancetomaxcell_perthickperlayer_eneweighted.at(curistr).fill( distancetomax , hit->energy() ); }
865 
866  //Let's check the density
867  std::map< DetId, float >::const_iterator dit = densities.find( rh_detid );
868  if ( dit == densities.end() ){
869  LogDebug("HGCalValidator") << " You shouldn't be here - Unable to find a density " << rh_detid.rawId() << " " << rh_detid.det() << " " << HGCalDetId(rh_detid) << "\n";
870  continue;
871  }
872 
873  if ( histograms.h_cellsenedens_perthick.count( (int) thickness ) ){
874  histograms.h_cellsenedens_perthick.at( (int) thickness ).fill( dit->second );
875  }
876 
877  } // end of loop through hits and fractions
878 
879  //Check for simultaneously having hits of different kind. Checking at least two combinations is sufficient.
880  if ( (nthhits120p != 0 && nthhits200p != 0 ) || (nthhits120p != 0 && nthhits300p != 0 ) || (nthhits120p != 0 && nthhitsscintp != 0 ) ||
881  (nthhits200p != 0 && nthhits300p != 0 ) || (nthhits200p != 0 && nthhitsscintp != 0 ) || (nthhits300p != 0 && nthhitsscintp != 0 ) ){
882  tnlcpthplus["mixed"]++;
883  } else if ( (nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0) ) {
884  //This is a cluster with hits of one kind
885  tnlcpthplus[std::to_string((int) thickness)]++;
886  }
887  if ( (nthhits120m != 0 && nthhits200m != 0 ) || (nthhits120m != 0 && nthhits300m != 0 ) || (nthhits120m != 0 && nthhitsscintm != 0 ) ||
888  (nthhits200m != 0 && nthhits300m != 0 ) || (nthhits200m != 0 && nthhitsscintm != 0 ) || (nthhits300m != 0 && nthhitsscintm != 0 ) ){
889  tnlcpthminus["mixed"]++;
890  } else if ( (nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0) ) {
891  //This is a cluster with hits of one kind
892  tnlcpthminus[std::to_string((int) thickness)]++;
893  }
894 
895  //To find the thickness with the biggest amount of cells
896  std::vector<int> bigamoth; bigamoth.clear();
897  if (zside > 0 ){
898  bigamoth.push_back(nthhits120p);bigamoth.push_back(nthhits200p);bigamoth.push_back(nthhits300p);bigamoth.push_back(nthhitsscintp);
899  }
900  if (zside < 0 ){
901  bigamoth.push_back(nthhits120m);bigamoth.push_back(nthhits200m);bigamoth.push_back(nthhits300m);bigamoth.push_back(nthhitsscintm);
902  }
903  auto bgth = std::max_element(bigamoth.begin(),bigamoth.end());
904  istr = std::to_string(thicknesses[ std::distance(bigamoth.begin(), bgth) ]);
905  std::string lay_string = std::to_string(layerid);
906  while(lay_string.size() < 2)
907  lay_string.insert(0, "0");
908  istr += "_" + lay_string;
909 
910  //Here for the per cluster plots that need the thickness_layer info
911  if (histograms.h_cellsnum_perthickperlayer.count(istr)){ histograms.h_cellsnum_perthickperlayer.at(istr).fill( hits_and_fractions.size() ); }
912 
913  //Now, with the distance between seed and max cell.
914  double distancebetseedandmax = distance(seedx, seedy, maxx, maxy);
915  //The thickness_layer combination in this case will use the thickness of the seed as a convention.
916  std::string seedstr = std::to_string( (int) recHitTools_->getSiThickness(seedid) )+ "_" + std::to_string(layerid);
917  seedstr += "_" + lay_string;
918  if (histograms.h_distancebetseedandmaxcell_perthickperlayer.count(seedstr)){
919  histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr).fill( distancebetseedandmax );
920  }
921  if (histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)){
922  histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr).fill( distancebetseedandmax , clusters[layerclusterIndex].energy() );
923  }
924 
925  //Energy clustered per layer
926  tecpl[layerid] = tecpl[layerid] + clusters[layerclusterIndex].energy();
927  ldbar[layerid] = ldbar[layerid] + clusters[layerclusterIndex].energy() * cummatbudg[(double) lay];
928 
929  }//end of loop through clusters of the event
930 
931  //After the end of the event we can now fill with the results.
932  //First a couple of variables to keep the sum of the energy of all clusters
933  double sumeneallcluspl = 0.; double sumeneallclusmi = 0.;
934  //And the longitudinal variable
935  double sumldbarpl = 0.; double sumldbarmi = 0.;
936  //Per layer : Loop 0->103
937  for (unsigned ilayer = 0; ilayer < layers*2; ++ilayer) {
938  if (histograms.h_clusternum_perlayer.count(ilayer)){
939  histograms.h_clusternum_perlayer.at(ilayer).fill( tnlcpl[ilayer] );
940  }
941  // Two times one for plus and one for minus
942  //First with the -z endcap
943  if (ilayer < layers){
944  if (histograms.h_energyclustered_perlayer.count(ilayer)){
945  if ( caloparteneminus != 0.) {
946  histograms.h_energyclustered_perlayer.at(ilayer).fill( 100. * tecpl[ilayer]/caloparteneminus );
947  }
948  }
949  //Keep here the total energy for the event in -z
950  sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
951  //And for the longitudinal variable
952  sumldbarmi = sumldbarmi + ldbar[ilayer];
953  } else { //Then for the +z
954  if (histograms.h_energyclustered_perlayer.count(ilayer)){
955  if ( caloparteneplus != 0.) {
956  histograms.h_energyclustered_perlayer.at(ilayer).fill( 100. * tecpl[ilayer]/caloparteneplus );
957  }
958  }
959  //Keep here the total energy for the event in -z
960  sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
961  //And for the longitudinal variable
962  sumldbarpl = sumldbarpl + ldbar[ilayer];
963  } //end of +z loop
964 
965  }//end of loop over layers
966 
967  //Per thickness
968  for(std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
969  if ( histograms.h_clusternum_perthick.count(*it) ){
970  histograms.h_clusternum_perthick.at(*it).fill( tnlcpthplus[std::to_string(*it)] );
971  histograms.h_clusternum_perthick.at(*it).fill( tnlcpthminus[std::to_string(*it)] );
972  }
973  }
974  //Mixed thickness clusters
975  histograms.h_mixedhitscluster_zplus[count].fill( tnlcpthplus["mixed"] );
976  histograms.h_mixedhitscluster_zminus[count].fill( tnlcpthminus["mixed"] );
977 
978  //Total energy clustered from all layer clusters (fraction)
979  if ( caloparteneplus != 0.) {histograms.h_energyclustered_zplus[count].fill( 100. * sumeneallcluspl /caloparteneplus ); }
980  if ( caloparteneminus != 0.) {histograms.h_energyclustered_zminus[count].fill( 100. * sumeneallclusmi /caloparteneminus ); }
981 
982  //For the longitudinal depth barycenter
983  histograms.h_longdepthbarycentre_zplus[count].fill( sumldbarpl / sumeneallcluspl );
984  histograms.h_longdepthbarycentre_zminus[count].fill( sumldbarmi / sumeneallclusmi );
985 
986 }
987 
988 double HGVHistoProducerAlgo::distance2(const double x1, const double y1, const double x2, const double y2) const { //distance squared
989  const double dx = x1 - x2;
990  const double dy = y1 - y2;
991  return (dx*dx + dy*dy);
992 } //distance squaredq
993 double HGVHistoProducerAlgo::distance(const double x1, const double y1, const double x2, const double y2) const{ //2-d distance on the layer (x-y)
994  return std::sqrt(distance2(x1,y1,x2,y2) );
995 }
996 
997 void HGVHistoProducerAlgo::setRecHitTools(std::shared_ptr<hgcal::RecHitTools> recHitTools) {
998  recHitTools_ = recHitTools;
999 }
1000 
1002  std::map<DetId, const HGCRecHit*> const & hitMap) const {
1003 
1004  DetId themaxid;
1005  const std::vector<std::pair<DetId, float> >& hits_and_fractions = cluster.hitsAndFractions();
1006 
1007  double maxene = 0.;
1008  for (std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin(); it_haf != hits_and_fractions.end(); ++it_haf) {
1009  DetId rh_detid = it_haf->first;
1010 
1011  std::map<DetId,const HGCRecHit *>::const_iterator itcheck= hitMap.find(rh_detid);
1012  const HGCRecHit *hit = itcheck->second;
1013 
1014  if ( maxene < hit->energy() ){
1015  maxene = hit->energy();
1016  themaxid = rh_detid;
1017  }
1018 
1019  }
1020 
1021  return themaxid;
1022 }
1023 
1024 
1025 double HGVHistoProducerAlgo::getEta(double eta) const {
1026  if (useFabsEta_) return fabs(eta);
1027  else return eta;
1028 }
1029 
#define LogDebug(id)
constexpr float energy() const
Definition: CaloRecHit.h:31
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancebetseedandmaxcell_perthickperlayer
ConcurrentMonitorElement bookProfile(Args &&...args)
Definition: DQMStore.h:167
std::unordered_map< int, ConcurrentMonitorElement > h_denom_caloparticle_eta_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_eta_Zorigin
std::vector< ConcurrentMonitorElement > h_cluster_eta
std::unordered_map< int, ConcurrentMonitorElement > h_clusternum_perthick
std::unordered_map< int, ConcurrentMonitorElement > h_denom_caloparticle_phi_perlayer
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
ConcurrentMonitorElement lastLayerFHzm
std::vector< ConcurrentMonitorElement > h_energyclustered_zminus
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
ConcurrentMonitorElement maxlayerzp
std::vector< ConcurrentMonitorElement > h_energyclustered_zplus
std::unordered_map< int, ConcurrentMonitorElement > h_energy_vs_score_layercl2caloparticle_perlayer
std::unordered_map< std::string, ConcurrentMonitorElement > h_cellsnum_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_clusternum_perlayer
void setRecHitTools(std::shared_ptr< hgcal::RecHitTools > recHitTools)
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_eta
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetomaxcell_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numDup_caloparticle_eta_perlayer
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:197
std::unordered_map< int, ConcurrentMonitorElement > h_denom_layercl_eta_perlayer
void layerClusters_to_CaloParticles(const Histograms &histograms, const reco::CaloClusterCollection &clusters, std::vector< CaloParticle > const &cP, std::map< DetId, const HGCRecHit * > const &, unsigned layers) const
int zside(DetId const &)
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_denom_layercl_phi_perlayer
const std::vector< SimTrack > & g4Tracks() const
Definition: CaloParticle.h:74
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
Definition: CaloParticle.h:142
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
void fill_info_histos(const Histograms &histograms, unsigned layers) const
std::vector< ConcurrentMonitorElement > h_longdepthbarycentre_zminus
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_energy
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
ConcurrentMonitorElement bookInt(Args &&...args)
Definition: DQMStore.h:158
std::unordered_map< int, ConcurrentMonitorElement > h_num_caloparticle_phi_perlayer
double distance(const double x1, const double y1, const double x2, const double y2) const
std::unordered_map< int, ConcurrentMonitorElement > h_energy_vs_score_caloparticle2layercl_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_pt
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_vs_eta_perlayer
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetomaxcell_perthickperlayer_eneweighted
hgcal_clustering::Density Density
Definition: HGCalCLUEAlgo.h:29
std::vector< ConcurrentMonitorElement > h_mixedhitscluster_zminus
void fill_caloparticle_histos(const Histograms &histograms, int pdgid, const CaloParticle &caloparticle, std::vector< SimVertex > const &simVertices) const
std::unordered_map< int, ConcurrentMonitorElement > h_score_layercl2caloparticle_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numMerge_layercl_phi_perlayer
void bookClusterHistos(DQMStore::ConcurrentBooker &ibook, Histograms &histograms, unsigned layers, std::vector< int > thicknesses, std::string pathtomatbudfile)
Monte Carlo truth information used for tracking validation.
Definition: SimCluster.h:29
ConcurrentMonitorElement book2D(Args &&...args)
Definition: DQMStore.h:163
T sqrt(T t)
Definition: SSEVec.h:18
std::unordered_map< int, ConcurrentMonitorElement > h_num_layercl_phi_perlayer
def unique(seq, keepstr=True)
Definition: tier0.py:25
float energy() const
Energy. Note this is taken from the first SimTrack only.
Definition: CaloParticle.h:98
ConcurrentMonitorElement lastLayerEEzp
ConcurrentMonitorElement book1D(Args &&...args)
Definition: DQMStore.h:160
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
double f[11][100]
ConcurrentMonitorElement lastLayerFHzp
double getEta(double eta) const
#define end
Definition: vmac.h:39
std::vector< ConcurrentMonitorElement > h_mixedhitscluster_zplus
std::unordered_map< int, ConcurrentMonitorElement > h_num_caloparticle_eta_perlayer
void fill_generic_cluster_histos(const Histograms &histograms, int count, const reco::CaloClusterCollection &clusters, const Density &densities, std::vector< CaloParticle > const &cP, std::map< DetId, const HGCRecHit * > const &, std::map< double, double > cummatbudg, unsigned layers, std::vector< int > thicknesses) const
const double ScoreCutLCtoCP_
DetId findmaxhit(const reco::CaloCluster &cluster, std::map< DetId, const HGCRecHit * > const &) const
std::unordered_map< int, ConcurrentMonitorElement > h_cellAssociation_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_score_caloparticle2layercl_perlayer
ConcurrentMonitorElement lastLayerEEzm
double distance2(const double x1, const double y1, const double x2, const double y2) const
Definition: DetId.h:18
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_phi
std::unordered_map< int, ConcurrentMonitorElement > h_num_layercl_eta_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_vs_eta_perlayer
std::shared_ptr< hgcal::RecHitTools > recHitTools_
std::vector< ConcurrentMonitorElement > h_longdepthbarycentre_zplus
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numDup_caloparticle_phi_perlayer
void bookInfo(DQMStore::ConcurrentBooker &ibook, Histograms &histograms)
void fill_cluster_histos(const Histograms &histograms, int count, const reco::CaloCluster &cluster) const
float pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
Definition: CaloParticle.h:130
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer_eneweighted
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
Definition: CaloParticle.h:134
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_perlayer
#define begin
Definition: vmac.h:32
void fill(Args &&...args) const
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_vs_phi_perlayer
static int position[264][3]
Definition: ReadPGInfo.cc:509
ConcurrentMonitorElement maxlayerzm
std::unordered_map< int, ConcurrentMonitorElement > h_energyclustered_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_vs_phi_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numMerge_layercl_eta_perlayer
const double ScoreCutCPtoLC_
std::unordered_map< int, ConcurrentMonitorElement > h_cellsenedens_perthick
HGVHistoProducerAlgo(const edm::ParameterSet &pset)
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
Definition: SimCluster.h:181
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
void bookCaloParticleHistos(DQMStore::ConcurrentBooker &ibook, Histograms &histograms, int pdgid)