CMS 3D CMS Logo

HGVHistoProducerAlgo.h
Go to the documentation of this file.
1 #ifndef Validation_HGCalValidation_HGVHistoProducerAlgo_h
2 #define Validation_HGCalValidation_HGVHistoProducerAlgo_h
3 
4 /* \author HGCal
5  */
6 
7 #include <iostream>
8 #include <fstream>
9 #include <vector>
10 #include <unordered_map>
11 
15 
20 
25 
28 
30  //Info
31  //To be able to spot any issues both in -z and +z a layer id was introduced
32  //that spans from 0 to 103 for hgcal_v9 geometry. The mapping for hgcal_v9 is:
33  //-z: 0->51
34  //+z: 52->103
35  //We will pick the numbers below from RecHitTools just to avoid future problems
36  ConcurrentMonitorElement lastLayerEEzm; // last layer of EE -z
37  ConcurrentMonitorElement lastLayerFHzm; // last layer of FH -z
38  ConcurrentMonitorElement maxlayerzm; // last layer of BH -z
39  ConcurrentMonitorElement lastLayerEEzp; // last layer of EE +z
40  ConcurrentMonitorElement lastLayerFHzp; // last layer of FH +z
41  ConcurrentMonitorElement maxlayerzp; // last layer of BH +z
42 
43  //1D
44  std::vector<ConcurrentMonitorElement> h_cluster_eta;
45  std::vector<ConcurrentMonitorElement> h_mixedhitscluster_zminus;
46  std::vector<ConcurrentMonitorElement> h_mixedhitscluster_zplus;
47  std::vector<ConcurrentMonitorElement> h_energyclustered_zminus;
48  std::vector<ConcurrentMonitorElement> h_energyclustered_zplus;
49  std::vector<ConcurrentMonitorElement> h_longdepthbarycentre_zminus;
50  std::vector<ConcurrentMonitorElement> h_longdepthbarycentre_zplus;
51 
52  std::unordered_map<int, ConcurrentMonitorElement > h_clusternum_perlayer;
53  std::unordered_map<int, ConcurrentMonitorElement > h_energyclustered_perlayer;
54  std::unordered_map<int, ConcurrentMonitorElement > h_score_layercl2caloparticle_perlayer;
55  std::unordered_map<int, ConcurrentMonitorElement > h_score_caloparticle2layercl_perlayer;
56  std::unordered_map<int, ConcurrentMonitorElement > h_energy_vs_score_caloparticle2layercl_perlayer;
57  std::unordered_map<int, ConcurrentMonitorElement > h_energy_vs_score_layercl2caloparticle_perlayer;
58  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_perlayer;
59  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_vs_eta_perlayer;
60  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_vs_phi_perlayer;
61  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_perlayer;
62  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_vs_eta_perlayer;
63  std::unordered_map<int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_vs_phi_perlayer;
64  std::unordered_map<int, ConcurrentMonitorElement > h_num_caloparticle_eta_perlayer;
65  std::unordered_map<int, ConcurrentMonitorElement > h_numDup_caloparticle_eta_perlayer;
66  std::unordered_map<int, ConcurrentMonitorElement > h_denom_caloparticle_eta_perlayer;
67  std::unordered_map<int, ConcurrentMonitorElement > h_num_caloparticle_phi_perlayer;
68  std::unordered_map<int, ConcurrentMonitorElement > h_numDup_caloparticle_phi_perlayer;
69  std::unordered_map<int, ConcurrentMonitorElement > h_denom_caloparticle_phi_perlayer;
70  std::unordered_map<int, ConcurrentMonitorElement > h_num_layercl_eta_perlayer;
71  std::unordered_map<int, ConcurrentMonitorElement > h_numMerge_layercl_eta_perlayer;
72  std::unordered_map<int, ConcurrentMonitorElement > h_denom_layercl_eta_perlayer;
73  std::unordered_map<int, ConcurrentMonitorElement > h_num_layercl_phi_perlayer;
74  std::unordered_map<int, ConcurrentMonitorElement > h_numMerge_layercl_phi_perlayer;
75  std::unordered_map<int, ConcurrentMonitorElement > h_denom_layercl_phi_perlayer;
76  std::unordered_map<int, ConcurrentMonitorElement > h_cellAssociation_perlayer;
77  std::unordered_map<int, ConcurrentMonitorElement > h_clusternum_perthick;
78  std::unordered_map<int, ConcurrentMonitorElement > h_cellsenedens_perthick;
79 
80  std::unordered_map< std::string, ConcurrentMonitorElement > h_cellsnum_perthickperlayer;
81  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer;
82  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer_eneweighted;
83  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetomaxcell_perthickperlayer;
84  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetomaxcell_perthickperlayer_eneweighted;
85  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancebetseedandmaxcell_perthickperlayer;
86  std::unordered_map< std::string, ConcurrentMonitorElement > h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer;
87 
88  std::unordered_map<int, ConcurrentMonitorElement > h_caloparticle_eta;
89  std::unordered_map<int, ConcurrentMonitorElement > h_caloparticle_eta_Zorigin;
90  std::unordered_map<int, ConcurrentMonitorElement > h_caloparticle_energy;
91  std::unordered_map<int, ConcurrentMonitorElement > h_caloparticle_pt;
92  std::unordered_map<int, ConcurrentMonitorElement > h_caloparticle_phi;
93 
94 };
95 
97 
99  public:
102 
104 
105  void bookInfo(DQMStore::ConcurrentBooker& ibook, Histograms& histograms);
106  void bookCaloParticleHistos(DQMStore::ConcurrentBooker& ibook, Histograms& histograms,int pdgid);
107 
108  void bookClusterHistos(DQMStore::ConcurrentBooker& ibook, Histograms& histograms,unsigned layers,
109  std::vector<int> thicknesses, std::string pathtomatbudfile);
110  void layerClusters_to_CaloParticles(const Histograms& histograms,
112  std::vector<CaloParticle> const & cP,
113  std::map<DetId, const HGCRecHit*> const &,
114  unsigned layers) const ;
115  void fill_info_histos(const Histograms& histograms, unsigned layers) const;
116  void fill_caloparticle_histos(const Histograms& histograms,
117  int pdgid,
118  const CaloParticle & caloparticle,
119  std::vector<SimVertex> const & simVertices) const ;
120 
121  void fill_cluster_histos(const Histograms& histograms,
122  int count,
123  const reco::CaloCluster & cluster) const;
124 
125  void fill_generic_cluster_histos(const Histograms& histograms,
126  int count,
128  const Density &densities,
129  std::vector<CaloParticle> const & cP,
130  std::map<DetId, const HGCRecHit*> const &,
131  std::map<double, double> cummatbudg,
132  unsigned layers,
133  std::vector<int> thicknesses) const ;
134 
135  double distance2(const double x1, const double y1, const double x2, const double y2) const;
136  double distance(const double x1, const double y1, const double x2, const double y2) const;
137 
138  void setRecHitTools(std::shared_ptr<hgcal::RecHitTools> recHitTools );
139 
140  DetId findmaxhit(const reco::CaloCluster & cluster,
141  std::map<DetId, const HGCRecHit*> const &) const;
142 
144  {
145  bool operator==(const detIdInfoInCluster& o) const { return clusterId == o.clusterId;};
146  unsigned int clusterId;
147  float fraction;
148  };
149 
151  {
152  unsigned int caloParticleId;
153  float energy=0;
154  std::vector<std::pair<DetId, float> > hits_and_fractions;
155  std::unordered_map<int, std::pair<float,float>> layerClusterIdToEnergyAndScore;
156  };
157  private:
158 
159  double getEta(double eta) const;
160 
161  std::shared_ptr<hgcal::RecHitTools> recHitTools_;
162 
163  //private data members
164  double minEta_, maxEta_; int nintEta_; bool useFabsEta_;
165  double minEne_, maxEne_; int nintEne_;
166  double minPt_, maxPt_; int nintPt_;
167  double minPhi_, maxPhi_; int nintPhi_;
168  double minMixedHitsCluster_, maxMixedHitsCluster_; int nintMixedHitsCluster_;
169  double minEneCl_, maxEneCl_; int nintEneCl_;
170  double minLongDepBary_, maxLongDepBary_; int nintLongDepBary_;
171  double minZpos_, maxZpos_; int nintZpos_;
172  double minTotNClsperlay_, maxTotNClsperlay_; int nintTotNClsperlay_;
173  double minEneClperlay_, maxEneClperlay_; int nintEneClperlay_;
174  double minScore_, maxScore_; int nintScore_;
175  double minSharedEneFrac_,maxSharedEneFrac_; int nintSharedEneFrac_;
176  double minTotNClsperthick_, maxTotNClsperthick_; int nintTotNClsperthick_;
177  double minTotNcellsperthickperlayer_, maxTotNcellsperthickperlayer_; int nintTotNcellsperthickperlayer_;
178  double minDisToSeedperthickperlayer_, maxDisToSeedperthickperlayer_; int nintDisToSeedperthickperlayer_;
179  double minDisToSeedperthickperlayerenewei_, maxDisToSeedperthickperlayerenewei_; int nintDisToSeedperthickperlayerenewei_;
180  double minDisToMaxperthickperlayer_, maxDisToMaxperthickperlayer_; int nintDisToMaxperthickperlayer_;
181  double minDisToMaxperthickperlayerenewei_, maxDisToMaxperthickperlayerenewei_; int nintDisToMaxperthickperlayerenewei_;
182  double minDisSeedToMaxperthickperlayer_, maxDisSeedToMaxperthickperlayer_; int nintDisSeedToMaxperthickperlayer_;
183  double minClEneperthickperlayer_, maxClEneperthickperlayer_; int nintClEneperthickperlayer_;
184  double minCellsEneDensperthick_, maxCellsEneDensperthick_; int nintCellsEneDensperthick_;
185 
186 };
187 
188 #endif
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancebetseedandmaxcell_perthickperlayer
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
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::map< DetId, float > Density
std::unordered_map< int, ConcurrentMonitorElement > h_clusternum_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_eta
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetomaxcell_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numDup_caloparticle_eta_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_denom_layercl_eta_perlayer
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer
std::unordered_map< int, ConcurrentMonitorElement > h_denom_layercl_phi_perlayer
std::vector< ConcurrentMonitorElement > h_longdepthbarycentre_zminus
std::unordered_map< int, ConcurrentMonitorElement > h_caloparticle_energy
std::unordered_map< int, ConcurrentMonitorElement > h_num_caloparticle_phi_perlayer
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
std::unordered_map< int, ConcurrentMonitorElement > h_score_layercl2caloparticle_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_numMerge_layercl_phi_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_num_layercl_phi_perlayer
ConcurrentMonitorElement lastLayerEEzp
std::vector< std::pair< DetId, float > > hits_and_fractions
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
ConcurrentMonitorElement lastLayerFHzp
std::vector< ConcurrentMonitorElement > h_mixedhitscluster_zplus
std::unordered_map< int, ConcurrentMonitorElement > h_num_caloparticle_eta_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_cellAssociation_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_score_caloparticle2layercl_perlayer
ConcurrentMonitorElement lastLayerEEzm
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
bool operator==(const detIdInfoInCluster &o) const
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
std::unordered_map< std::string, ConcurrentMonitorElement > h_distancetoseedcell_perthickperlayer_eneweighted
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_caloparticle2layercl_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_sharedenergy_layercl2caloparticle_vs_phi_perlayer
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, std::pair< float, float > > layerClusterIdToEnergyAndScore
std::unordered_map< int, ConcurrentMonitorElement > h_numMerge_layercl_eta_perlayer
std::unordered_map< int, ConcurrentMonitorElement > h_cellsenedens_perthick