CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGVHistoProducerAlgo Class Reference

#include <HGVHistoProducerAlgo.h>

Classes

struct  caloParticleOnLayer
 
struct  detIdInfoInCluster
 
struct  detIdInfoInTrackster
 

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
using Histograms = HGVHistoProducerAlgoHistograms
 
typedef dqm::legacy::MonitorElement MonitorElement
 
enum  validationType { Linking = 0, PatternRecognition, PatternRecognition_CP }
 

Public Member Functions

void bookCaloParticleHistos (DQMStore::IBooker &ibook, Histograms &histograms, int pdgid, unsigned int layers)
 
void bookClusterHistos_CellLevel (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
 
void bookClusterHistos_ClusterLevel (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses, std::string pathtomatbudfile)
 
void bookClusterHistos_LCtoCP_association (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
 
void bookInfo (DQMStore::IBooker &ibook, Histograms &histograms)
 
void bookSimClusterAssociationHistos (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
 
void bookSimClusterHistos (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
 
void bookTracksterHistos (DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
 
void bookTracksterSTSHistos (DQMStore::IBooker &ibook, Histograms &histograms, const validationType valType)
 
double distance (const double x1, const double y1, const double x2, const double y2) const
 
double distance2 (const double x1, const double y1, const double x2, const double y2) const
 
void fill_caloparticle_histos (const Histograms &histograms, int pdgid, const CaloParticle &caloparticle, std::vector< SimVertex > const &simVertices, unsigned int layers, std::unordered_map< DetId, const HGCRecHit *> const &) const
 
void fill_cluster_histos (const Histograms &histograms, const int count, const reco::CaloCluster &cluster) const
 
void fill_generic_cluster_histos (const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, std::map< double, double > cummatbudg, unsigned int layers, std::vector< int > thicknesses, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
 
void fill_info_histos (const Histograms &histograms, unsigned int layers) const
 
void fill_simCluster_histos (const Histograms &histograms, std::vector< SimCluster > const &simClusters, unsigned int layers, std::vector< int > thicknesses) const
 
void fill_simClusterAssociation_histos (const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< SimCluster >> simClusterHandle, std::vector< SimCluster > const &simClusters, std::vector< size_t > const &sCIndices, const std::vector< float > &mask, std::unordered_map< DetId, const HGCRecHit *> const &hitMap, unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters &recSimColl, const hgcal::SimToRecoCollectionWithSimClusters &simRecColl) const
 
void fill_trackster_histos (const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
 
DetId findmaxhit (const reco::CaloCluster &cluster, std::unordered_map< DetId, const HGCRecHit *> const &) const
 
 HGVHistoProducerAlgo (const edm::ParameterSet &pset)
 
void layerClusters_to_CaloParticles (const Histograms &histograms, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
 
void layerClusters_to_SimClusters (const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< SimCluster >> simClusterHandle, std::vector< SimCluster > const &simClusters, std::vector< size_t > const &sCIndices, const std::vector< float > &mask, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters &recSimColl, const hgcal::SimToRecoCollectionWithSimClusters &simRecColl) const
 
void setRecHitTools (std::shared_ptr< hgcal::RecHitTools > recHitTools)
 
void tracksters_to_SimTracksters (const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const validationType valType, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
 
 ~HGVHistoProducerAlgo ()
 

Private Member Functions

double getEta (double eta) const
 

Private Attributes

double maxCellsEneDensperthick_
 
double maxClEnepermultiplicity_
 
double maxClEneperthickperlayer_
 
double maxDisSeedToMaxperthickperlayer_
 
double maxDisToMaxperthickperlayer_
 
double maxDisToMaxperthickperlayerenewei_
 
double maxDisToSeedperthickperlayer_
 
double maxDisToSeedperthickperlayerenewei_
 
double maxEne_
 
double maxEneCl_
 
double maxEneClperlay_
 
double maxEta_
 
double maxLongDepBary_
 
double maxMixedHitsCluster_
 
double maxMixedHitsSimCluster_
 
double maxMplofLCs_
 
double maxPhi_
 
double maxPt_
 
double maxScore_
 
double maxSharedEneFrac_
 
double maxSizeCLsinTSTs_
 
double maxTotNcellsperthickperlayer_
 
double maxTotNClsinTSTs_
 
double maxTotNClsinTSTsperlayer_
 
double maxTotNClsperlay_
 
double maxTotNClsperthick_
 
double maxTotNsimClsperlay_
 
double maxTotNsimClsperthick_
 
double maxTotNTSTs_
 
double maxTSTSharedEneFrac_
 
double maxX_
 
double maxY_
 
double maxZ_
 
double maxZpos_
 
double minCellsEneDensperthick_
 
double minClEnepermultiplicity_
 
double minClEneperthickperlayer_
 
double minDisSeedToMaxperthickperlayer_
 
double minDisToMaxperthickperlayer_
 
double minDisToMaxperthickperlayerenewei_
 
double minDisToSeedperthickperlayer_
 
double minDisToSeedperthickperlayerenewei_
 
double minEne_
 
double minEneCl_
 
double minEneClperlay_
 
double minEta_
 
double minLongDepBary_
 
double minMixedHitsCluster_
 
double minMixedHitsSimCluster_
 
double minMplofLCs_
 
double minPhi_
 
double minPt_
 
double minScore_
 
double minSharedEneFrac_
 
double minSizeCLsinTSTs_
 
double minTotNcellsperthickperlayer_
 
double minTotNClsinTSTs_
 
double minTotNClsinTSTsperlayer_
 
double minTotNClsperlay_
 
double minTotNClsperthick_
 
double minTotNsimClsperlay_
 
double minTotNsimClsperthick_
 
double minTotNTSTs_
 
double minTSTSharedEneFrac_
 
double minTSTSharedEneFracEfficiency_
 
double minX_
 
double minY_
 
double minZ_
 
double minZpos_
 
int nintCellsEneDensperthick_
 
int nintClEnepermultiplicity_
 
int nintClEneperthickperlayer_
 
int nintDisSeedToMaxperthickperlayer_
 
int nintDisToMaxperthickperlayer_
 
int nintDisToMaxperthickperlayerenewei_
 
int nintDisToSeedperthickperlayer_
 
int nintDisToSeedperthickperlayerenewei_
 
int nintEne_
 
int nintEneCl_
 
int nintEneClperlay_
 
int nintEta_
 
int nintLongDepBary_
 
int nintMixedHitsCluster_
 
int nintMixedHitsSimCluster_
 
int nintMplofLCs_
 
int nintPhi_
 
int nintPt_
 
int nintScore_
 
int nintSharedEneFrac_
 
int nintSizeCLsinTSTs_
 
int nintTotNcellsperthickperlayer_
 
int nintTotNClsinTSTs_
 
int nintTotNClsinTSTsperlayer_
 
int nintTotNClsperlay_
 
int nintTotNClsperthick_
 
int nintTotNsimClsperlay_
 
int nintTotNsimClsperthick_
 
int nintTotNTSTs_
 
int nintTSTSharedEneFrac_
 
int nintX_
 
int nintY_
 
int nintZ_
 
int nintZpos_
 
std::shared_ptr< hgcal::RecHitToolsrecHitTools_
 
bool useFabsEta_
 

Detailed Description

Definition at line 225 of file HGVHistoProducerAlgo.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 227 of file HGVHistoProducerAlgo.h.

◆ Histograms

Definition at line 233 of file HGVHistoProducerAlgo.h.

◆ MonitorElement

Definition at line 228 of file HGVHistoProducerAlgo.h.

Member Enumeration Documentation

◆ validationType

Constructor & Destructor Documentation

◆ HGVHistoProducerAlgo()

HGVHistoProducerAlgo::HGVHistoProducerAlgo ( const edm::ParameterSet pset)

Definition at line 23 of file HGVHistoProducerAlgo.cc.

24  : //parameters for eta
25  minEta_(pset.getParameter<double>("minEta")),
26  maxEta_(pset.getParameter<double>("maxEta")),
27  nintEta_(pset.getParameter<int>("nintEta")),
28  useFabsEta_(pset.getParameter<bool>("useFabsEta")),
29 
30  //parameters for energy
31  minEne_(pset.getParameter<double>("minEne")),
32  maxEne_(pset.getParameter<double>("maxEne")),
33  nintEne_(pset.getParameter<int>("nintEne")),
34 
35  //parameters for pt
36  minPt_(pset.getParameter<double>("minPt")),
37  maxPt_(pset.getParameter<double>("maxPt")),
38  nintPt_(pset.getParameter<int>("nintPt")),
39 
40  //parameters for phi
41  minPhi_(pset.getParameter<double>("minPhi")),
42  maxPhi_(pset.getParameter<double>("maxPhi")),
43  nintPhi_(pset.getParameter<int>("nintPhi")),
44 
45  //parameters for counting mixed hits SimClusters
46  minMixedHitsSimCluster_(pset.getParameter<double>("minMixedHitsSimCluster")),
47  maxMixedHitsSimCluster_(pset.getParameter<double>("maxMixedHitsSimCluster")),
48  nintMixedHitsSimCluster_(pset.getParameter<int>("nintMixedHitsSimCluster")),
49 
50  //parameters for counting mixed hits clusters
51  minMixedHitsCluster_(pset.getParameter<double>("minMixedHitsCluster")),
52  maxMixedHitsCluster_(pset.getParameter<double>("maxMixedHitsCluster")),
53  nintMixedHitsCluster_(pset.getParameter<int>("nintMixedHitsCluster")),
54 
55  //parameters for the total amount of energy clustered by all layer clusters (fraction over CaloParticless)
56  minEneCl_(pset.getParameter<double>("minEneCl")),
57  maxEneCl_(pset.getParameter<double>("maxEneCl")),
58  nintEneCl_(pset.getParameter<int>("nintEneCl")),
59 
60  //parameters for the longitudinal depth barycenter.
61  minLongDepBary_(pset.getParameter<double>("minLongDepBary")),
62  maxLongDepBary_(pset.getParameter<double>("maxLongDepBary")),
63  nintLongDepBary_(pset.getParameter<int>("nintLongDepBary")),
64 
65  //parameters for z positionof vertex plots
66  minZpos_(pset.getParameter<double>("minZpos")),
67  maxZpos_(pset.getParameter<double>("maxZpos")),
68  nintZpos_(pset.getParameter<int>("nintZpos")),
69 
70  //Parameters for the total number of SimClusters per layer
71  minTotNsimClsperlay_(pset.getParameter<double>("minTotNsimClsperlay")),
72  maxTotNsimClsperlay_(pset.getParameter<double>("maxTotNsimClsperlay")),
73  nintTotNsimClsperlay_(pset.getParameter<int>("nintTotNsimClsperlay")),
74 
75  //Parameters for the total number of layer clusters per layer
76  minTotNClsperlay_(pset.getParameter<double>("minTotNClsperlay")),
77  maxTotNClsperlay_(pset.getParameter<double>("maxTotNClsperlay")),
78  nintTotNClsperlay_(pset.getParameter<int>("nintTotNClsperlay")),
79 
80  //Parameters for the energy clustered by layer clusters per layer (fraction over CaloParticless)
81  minEneClperlay_(pset.getParameter<double>("minEneClperlay")),
82  maxEneClperlay_(pset.getParameter<double>("maxEneClperlay")),
83  nintEneClperlay_(pset.getParameter<int>("nintEneClperlay")),
84 
85  //Parameters for the score both for:
86  //1. calo particle to layer clusters association per layer
87  //2. layer cluster to calo particles association per layer
88  minScore_(pset.getParameter<double>("minScore")),
89  maxScore_(pset.getParameter<double>("maxScore")),
90  nintScore_(pset.getParameter<int>("nintScore")),
91 
92  //Parameters for shared energy fraction. That is:
93  //1. Fraction of each of the layer clusters energy related to a
94  //calo particle over that calo particle's energy.
95  //2. Fraction of each of the calo particles energy
96  //related to a layer cluster over that layer cluster's energy.
97  minSharedEneFrac_(pset.getParameter<double>("minSharedEneFrac")),
98  maxSharedEneFrac_(pset.getParameter<double>("maxSharedEneFrac")),
99  nintSharedEneFrac_(pset.getParameter<int>("nintSharedEneFrac")),
100  minTSTSharedEneFracEfficiency_(pset.getParameter<double>("minTSTSharedEneFracEfficiency")),
101 
102  //Same as above for Tracksters
103  minTSTSharedEneFrac_(pset.getParameter<double>("minTSTSharedEneFrac")),
104  maxTSTSharedEneFrac_(pset.getParameter<double>("maxTSTSharedEneFrac")),
105  nintTSTSharedEneFrac_(pset.getParameter<int>("nintTSTSharedEneFrac")),
106 
107  //Parameters for the total number of SimClusters per thickness
108  minTotNsimClsperthick_(pset.getParameter<double>("minTotNsimClsperthick")),
109  maxTotNsimClsperthick_(pset.getParameter<double>("maxTotNsimClsperthick")),
110  nintTotNsimClsperthick_(pset.getParameter<int>("nintTotNsimClsperthick")),
111 
112  //Parameters for the total number of layer clusters per thickness
113  minTotNClsperthick_(pset.getParameter<double>("minTotNClsperthick")),
114  maxTotNClsperthick_(pset.getParameter<double>("maxTotNClsperthick")),
115  nintTotNClsperthick_(pset.getParameter<int>("nintTotNClsperthick")),
116 
117  //Parameters for the total number of cells per per thickness per layer
118  minTotNcellsperthickperlayer_(pset.getParameter<double>("minTotNcellsperthickperlayer")),
119  maxTotNcellsperthickperlayer_(pset.getParameter<double>("maxTotNcellsperthickperlayer")),
120  nintTotNcellsperthickperlayer_(pset.getParameter<int>("nintTotNcellsperthickperlayer")),
121 
122  //Parameters for the distance of cluster cells to seed cell per thickness per layer
123  minDisToSeedperthickperlayer_(pset.getParameter<double>("minDisToSeedperthickperlayer")),
124  maxDisToSeedperthickperlayer_(pset.getParameter<double>("maxDisToSeedperthickperlayer")),
125  nintDisToSeedperthickperlayer_(pset.getParameter<int>("nintDisToSeedperthickperlayer")),
126 
127  //Parameters for the energy weighted distance of cluster cells to seed cell per thickness per layer
128  minDisToSeedperthickperlayerenewei_(pset.getParameter<double>("minDisToSeedperthickperlayerenewei")),
129  maxDisToSeedperthickperlayerenewei_(pset.getParameter<double>("maxDisToSeedperthickperlayerenewei")),
130  nintDisToSeedperthickperlayerenewei_(pset.getParameter<int>("nintDisToSeedperthickperlayerenewei")),
131 
132  //Parameters for the distance of cluster cells to max cell per thickness per layer
133  minDisToMaxperthickperlayer_(pset.getParameter<double>("minDisToMaxperthickperlayer")),
134  maxDisToMaxperthickperlayer_(pset.getParameter<double>("maxDisToMaxperthickperlayer")),
135  nintDisToMaxperthickperlayer_(pset.getParameter<int>("nintDisToMaxperthickperlayer")),
136 
137  //Parameters for the energy weighted distance of cluster cells to max cell per thickness per layer
138  minDisToMaxperthickperlayerenewei_(pset.getParameter<double>("minDisToMaxperthickperlayerenewei")),
139  maxDisToMaxperthickperlayerenewei_(pset.getParameter<double>("maxDisToMaxperthickperlayerenewei")),
140  nintDisToMaxperthickperlayerenewei_(pset.getParameter<int>("nintDisToMaxperthickperlayerenewei")),
141 
142  //Parameters for the distance of seed cell to max cell per thickness per layer
143  minDisSeedToMaxperthickperlayer_(pset.getParameter<double>("minDisSeedToMaxperthickperlayer")),
144  maxDisSeedToMaxperthickperlayer_(pset.getParameter<double>("maxDisSeedToMaxperthickperlayer")),
145  nintDisSeedToMaxperthickperlayer_(pset.getParameter<int>("nintDisSeedToMaxperthickperlayer")),
146 
147  //Parameters for the energy of a cluster per thickness per layer
148  minClEneperthickperlayer_(pset.getParameter<double>("minClEneperthickperlayer")),
149  maxClEneperthickperlayer_(pset.getParameter<double>("maxClEneperthickperlayer")),
150  nintClEneperthickperlayer_(pset.getParameter<int>("nintClEneperthickperlayer")),
151 
152  //Parameters for the energy density of cluster cells per thickness
153  minCellsEneDensperthick_(pset.getParameter<double>("minCellsEneDensperthick")),
154  maxCellsEneDensperthick_(pset.getParameter<double>("maxCellsEneDensperthick")),
155  nintCellsEneDensperthick_(pset.getParameter<int>("nintCellsEneDensperthick")),
156 
157  //Parameters for the total number of Tracksters per event
158  // Always treat one event as two events, one in +z one in -z
159  minTotNTSTs_(pset.getParameter<double>("minTotNTSTs")),
160  maxTotNTSTs_(pset.getParameter<double>("maxTotNTSTs")),
161  nintTotNTSTs_(pset.getParameter<int>("nintTotNTSTs")),
162 
163  //Parameters for the total number of layer clusters in Trackster
164  minTotNClsinTSTs_(pset.getParameter<double>("minTotNClsinTSTs")),
165  maxTotNClsinTSTs_(pset.getParameter<double>("maxTotNClsinTSTs")),
166  nintTotNClsinTSTs_(pset.getParameter<int>("nintTotNClsinTSTs")),
167 
168  //Parameters for the total number of layer clusters in Trackster per layer
169  minTotNClsinTSTsperlayer_(pset.getParameter<double>("minTotNClsinTSTsperlayer")),
170  maxTotNClsinTSTsperlayer_(pset.getParameter<double>("maxTotNClsinTSTsperlayer")),
171  nintTotNClsinTSTsperlayer_(pset.getParameter<int>("nintTotNClsinTSTsperlayer")),
172 
173  //Parameters for the multiplicity of layer clusters in Trackster
174  minMplofLCs_(pset.getParameter<double>("minMplofLCs")),
175  maxMplofLCs_(pset.getParameter<double>("maxMplofLCs")),
176  nintMplofLCs_(pset.getParameter<int>("nintMplofLCs")),
177 
178  //Parameters for cluster size
179  minSizeCLsinTSTs_(pset.getParameter<double>("minSizeCLsinTSTs")),
180  maxSizeCLsinTSTs_(pset.getParameter<double>("maxSizeCLsinTSTs")),
181  nintSizeCLsinTSTs_(pset.getParameter<int>("nintSizeCLsinTSTs")),
182 
183  //Parameters for the energy of a cluster per thickness per layer
184  minClEnepermultiplicity_(pset.getParameter<double>("minClEnepermultiplicity")),
185  maxClEnepermultiplicity_(pset.getParameter<double>("maxClEnepermultiplicity")),
186  nintClEnepermultiplicity_(pset.getParameter<int>("nintClEnepermultiplicity")),
187 
188  //parameters for x
189  minX_(pset.getParameter<double>("minX")),
190  maxX_(pset.getParameter<double>("maxX")),
191  nintX_(pset.getParameter<int>("nintX")),
192 
193  //parameters for y
194  minY_(pset.getParameter<double>("minY")),
195  maxY_(pset.getParameter<double>("maxY")),
196  nintY_(pset.getParameter<int>("nintY")),
197 
198  //parameters for z
199  minZ_(pset.getParameter<double>("minZ")),
200  maxZ_(pset.getParameter<double>("maxZ")),
201  nintZ_(pset.getParameter<int>("nintZ")) {}

◆ ~HGVHistoProducerAlgo()

HGVHistoProducerAlgo::~HGVHistoProducerAlgo ( )

Definition at line 203 of file HGVHistoProducerAlgo.cc.

203 {}

Member Function Documentation

◆ bookCaloParticleHistos()

void HGVHistoProducerAlgo::bookCaloParticleHistos ( DQMStore::IBooker ibook,
Histograms histograms,
int  pdgid,
unsigned int  layers 
)

Definition at line 214 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), hgcalTBTopologyTester_cfi::layers, maxEne_, maxEta_, maxPhi_, maxPt_, maxZpos_, minEne_, minEta_, minPhi_, minPt_, minZpos_, nintEne_, nintEta_, nintPhi_, nintPt_, nintZpos_, and EgammaValidation_cff::pdgid.

217  {
218  histograms.h_caloparticle_eta[pdgid] =
219  ibook.book1D("N of caloparticle vs eta", "N of caloParticles vs eta", nintEta_, minEta_, maxEta_);
220  histograms.h_caloparticle_eta_Zorigin[pdgid] =
221  ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", nintEta_, minEta_, maxEta_, nintZpos_, minZpos_, maxZpos_);
222 
223  histograms.h_caloparticle_energy[pdgid] =
224  ibook.book1D("Energy", "Energy of CaloParticles; Energy [GeV]", nintEne_, minEne_, maxEne_);
225  histograms.h_caloparticle_pt[pdgid] = ibook.book1D("Pt", "Pt of CaloParticles", nintPt_, minPt_, maxPt_);
226  histograms.h_caloparticle_phi[pdgid] = ibook.book1D("Phi", "Phi of CaloParticles", nintPhi_, minPhi_, maxPhi_);
227  histograms.h_caloparticle_selfenergy[pdgid] =
228  ibook.book1D("SelfEnergy", "Total Energy of Hits in Sim Clusters (matched)", nintEne_, minEne_, maxEne_);
229  histograms.h_caloparticle_energyDifference[pdgid] =
230  ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300., -5., 1.);
231 
232  histograms.h_caloparticle_nSimClusters[pdgid] =
233  ibook.book1D("Num Sim Clusters", "Num Sim Clusters in CaloParticles", 100, 0., 100.);
234  histograms.h_caloparticle_nHitsInSimClusters[pdgid] =
235  ibook.book1D("Num Hits in Sim Clusters", "Num Hits in Sim Clusters in CaloParticles", 1000, 0., 1000.);
236  histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit[pdgid] = ibook.book1D(
237  "Num Rec-matched Hits in Sim Clusters", "Num Hits in Sim Clusters (matched) in CaloParticles", 1000, 0., 1000.);
238 
239  histograms.h_caloparticle_nHits_matched_energy[pdgid] =
240  ibook.book1D("Energy of Rec-matched Hits", "Energy of Hits in Sim Clusters (matched)", 100, 0., 10.);
241  histograms.h_caloparticle_nHits_matched_energy_layer[pdgid] =
242  ibook.book2D("Energy of Rec-matched Hits vs layer",
243  "Energy of Hits in Sim Clusters (matched) vs layer",
244  2 * layers,
245  0.,
246  (float)2 * layers,
247  100,
248  0.,
249  10.);
250  histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl[pdgid] =
251  ibook.book2D("Energy of Rec-matched Hits vs layer (1SC)",
252  "Energy of Hits only 1 Sim Clusters (matched) vs layer",
253  2 * layers,
254  0.,
255  (float)2 * layers,
256  100,
257  0.,
258  10.);
259  histograms.h_caloparticle_sum_energy_layer[pdgid] =
260  ibook.book2D("Rec-matched Hits Sum Energy vs layer",
261  "Rescaled Sum Energy of Hits in Sim Clusters (matched) vs layer",
262  2 * layers,
263  0.,
264  (float)2 * layers,
265  110,
266  0.,
267  110.);
268  histograms.h_caloparticle_fractions[pdgid] =
269  ibook.book2D("HitFractions", "Hit fractions;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
270  histograms.h_caloparticle_fractions_weight[pdgid] = ibook.book2D(
271  "HitFractions_weighted", "Hit fractions weighted;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
272 
273  histograms.h_caloparticle_firstlayer[pdgid] =
274  ibook.book1D("First Layer", "First layer of the CaloParticles", 2 * layers, 0., (float)2 * layers);
275  histograms.h_caloparticle_lastlayer[pdgid] =
276  ibook.book1D("Last Layer", "Last layer of the CaloParticles", 2 * layers, 0., (float)2 * layers);
277  histograms.h_caloparticle_layersnum[pdgid] =
278  ibook.book1D("Number of Layers", "Number of layers of the CaloParticles", 2 * layers, 0., (float)2 * layers);
279  histograms.h_caloparticle_firstlayer_matchedtoRecHit[pdgid] = ibook.book1D(
280  "First Layer (rec-matched hit)", "First layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers);
281  histograms.h_caloparticle_lastlayer_matchedtoRecHit[pdgid] = ibook.book1D(
282  "Last Layer (rec-matched hit)", "Last layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers);
283  histograms.h_caloparticle_layersnum_matchedtoRecHit[pdgid] =
284  ibook.book1D("Number of Layers (rec-matched hit)",
285  "Number of layers of the CaloParticles (matched)",
286  2 * layers,
287  0.,
288  (float)2 * layers);
289 }
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookClusterHistos_CellLevel()

void HGVHistoProducerAlgo::bookClusterHistos_CellLevel ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers,
std::vector< int >  thicknesses 
)

Definition at line 864 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, hgcalTBTopologyTester_cfi::layers, maxCellsEneDensperthick_, maxClEneperthickperlayer_, maxDisSeedToMaxperthickperlayer_, maxDisToMaxperthickperlayer_, maxDisToMaxperthickperlayerenewei_, maxDisToSeedperthickperlayer_, maxDisToSeedperthickperlayerenewei_, maxTotNcellsperthickperlayer_, minCellsEneDensperthick_, minClEneperthickperlayer_, minDisSeedToMaxperthickperlayer_, minDisToMaxperthickperlayer_, minDisToMaxperthickperlayerenewei_, minDisToSeedperthickperlayer_, minDisToSeedperthickperlayerenewei_, minTotNcellsperthickperlayer_, nintCellsEneDensperthick_, nintClEneperthickperlayer_, nintDisSeedToMaxperthickperlayer_, nintDisToMaxperthickperlayer_, nintDisToMaxperthickperlayerenewei_, nintDisToSeedperthickperlayer_, nintDisToSeedperthickperlayerenewei_, nintTotNcellsperthickperlayer_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

867  {
868  //----------------------------------------------------------------------------------------------------------------------------
869  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
870  auto istr1 = std::to_string(ilayer);
871  while (istr1.size() < 2) {
872  istr1.insert(0, "0");
873  }
874  // Make a mapping to the regural layer naming plus z- or z+ for convenience
875  std::string istr2 = "";
876  // first with the -z endcap
877  if (ilayer < layers) {
878  istr2 = std::to_string(ilayer + 1) + " in z-";
879  } else { // then for the +z
880  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
881  }
882  histograms.h_cellAssociation_perlayer[ilayer] =
883  ibook.book1D("cellAssociation_perlayer" + istr1, "Cell Association for layer " + istr2, 5, -4., 1.);
884  histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(2, "TN(purity)");
885  histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(3, "FN(ineff.)");
886  histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(4, "FP(fake)");
887  histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(5, "TP(eff.)");
888  }
889  //----------------------------------------------------------------------------------------------------------------------------
890  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
891  auto istr = std::to_string(*it);
892  histograms.h_cellsenedens_perthick[(*it)] = ibook.book1D("cellsenedens_thick_" + istr,
893  "energy density of cluster cells for thickness " + istr,
897  }
898  //----------------------------------------------------------------------------------------------------------------------------
899  //Not all combination exists but should keep them all for cross checking reason.
900  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
901  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
902  auto istr1 = std::to_string(*it);
903  auto istr2 = std::to_string(ilayer);
904  while (istr2.size() < 2)
905  istr2.insert(0, "0");
906  auto istr = istr1 + "_" + istr2;
907  // Make a mapping to the regural layer naming plus z- or z+ for convenience
908  std::string istr3 = "";
909  // first with the -z endcap
910  if (ilayer < layers) {
911  istr3 = std::to_string(ilayer + 1) + " in z- ";
912  } else { // then for the +z
913  istr3 = std::to_string(ilayer - (layers - 1)) + " in z+ ";
914  }
915  //---
916  histograms.h_cellsnum_perthickperlayer[istr] =
917  ibook.book1D("cellsnum_perthick_perlayer_" + istr,
918  "total number of cells for layer " + istr3 + " for thickness " + istr1,
922  //---
923  histograms.h_distancetoseedcell_perthickperlayer[istr] =
924  ibook.book1D("distancetoseedcell_perthickperlayer_" + istr,
925  "distance of cluster cells to seed cell for layer " + istr3 + " for thickness " + istr1,
929  //---
930  histograms.h_distancetoseedcell_perthickperlayer_eneweighted[istr] = ibook.book1D(
931  "distancetoseedcell_perthickperlayer_eneweighted_" + istr,
932  "energy weighted distance of cluster cells to seed cell for layer " + istr3 + " for thickness " + istr1,
936  //---
937  histograms.h_distancetomaxcell_perthickperlayer[istr] =
938  ibook.book1D("distancetomaxcell_perthickperlayer_" + istr,
939  "distance of cluster cells to max cell for layer " + istr3 + " for thickness " + istr1,
943  //---
944  histograms.h_distancetomaxcell_perthickperlayer_eneweighted[istr] = ibook.book1D(
945  "distancetomaxcell_perthickperlayer_eneweighted_" + istr,
946  "energy weighted distance of cluster cells to max cell for layer " + istr3 + " for thickness " + istr1,
950  //---
951  histograms.h_distancebetseedandmaxcell_perthickperlayer[istr] =
952  ibook.book1D("distancebetseedandmaxcell_perthickperlayer_" + istr,
953  "distance of seed cell to max cell for layer " + istr3 + " for thickness " + istr1,
957  //---
958  histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer[istr] = ibook.book2D(
959  "distancebetseedandmaxcellvsclusterenergy_perthickperlayer_" + istr,
960  "distance of seed cell to max cell vs cluster energy for layer " + istr3 + " for thickness " + istr1,
967  }
968  }
969 }
static std::string to_string(const XMLCh *ch)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookClusterHistos_ClusterLevel()

void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers,
std::vector< int >  thicknesses,
std::string  pathtomatbudfile 
)

Definition at line 600 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, hgcalTBTopologyTester_cfi::layers, maxEneCl_, maxEneClperlay_, maxEta_, maxLongDepBary_, maxMixedHitsCluster_, maxTotNClsperlay_, maxTotNClsperthick_, minEneCl_, minEneClperlay_, minEta_, minLongDepBary_, minMixedHitsCluster_, minTotNClsperlay_, minTotNClsperthick_, nintEneCl_, nintEneClperlay_, nintEta_, nintLongDepBary_, nintMixedHitsCluster_, nintTotNClsperlay_, nintTotNClsperthick_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

604  {
605  //---------------------------------------------------------------------------------------------------------------------------
606  histograms.h_cluster_eta.push_back(
607  ibook.book1D("num_reco_cluster_eta", "N of reco clusters vs eta", nintEta_, minEta_, maxEta_));
608 
609  //---------------------------------------------------------------------------------------------------------------------------
610  //z-
611  histograms.h_mixedhitscluster_zminus.push_back(
612  ibook.book1D("mixedhitscluster_zminus",
613  "N of reco clusters that contain hits of more than one kind in z-",
617  //z+
618  histograms.h_mixedhitscluster_zplus.push_back(
619  ibook.book1D("mixedhitscluster_zplus",
620  "N of reco clusters that contain hits of more than one kind in z+",
624 
625  //---------------------------------------------------------------------------------------------------------------------------
626  //z-
627  histograms.h_energyclustered_zminus.push_back(
628  ibook.book1D("energyclustered_zminus",
629  "percent of total energy clustered by all layer clusters over CaloParticless energy in z-",
630  nintEneCl_,
631  minEneCl_,
632  maxEneCl_));
633  //z+
634  histograms.h_energyclustered_zplus.push_back(
635  ibook.book1D("energyclustered_zplus",
636  "percent of total energy clustered by all layer clusters over CaloParticless energy in z+",
637  nintEneCl_,
638  minEneCl_,
639  maxEneCl_));
640 
641  //---------------------------------------------------------------------------------------------------------------------------
642  //z-
643  std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find("Validation"));
644  histograms.h_longdepthbarycentre_zminus.push_back(
645  ibook.book1D("longdepthbarycentre_zminus",
646  "The longitudinal depth barycentre in z- for " + subpathtomat,
649  maxLongDepBary_));
650  //z+
651  histograms.h_longdepthbarycentre_zplus.push_back(
652  ibook.book1D("longdepthbarycentre_zplus",
653  "The longitudinal depth barycentre in z+ for " + subpathtomat,
656  maxLongDepBary_));
657 
658  //---------------------------------------------------------------------------------------------------------------------------
659  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
660  auto istr1 = std::to_string(ilayer);
661  while (istr1.size() < 2) {
662  istr1.insert(0, "0");
663  }
664  // Make a mapping to the regural layer naming plus z- or z+ for convenience
665  std::string istr2 = "";
666  // first with the -z endcap
667  if (ilayer < layers) {
668  istr2 = std::to_string(ilayer + 1) + " in z-";
669  } else { // then for the +z
670  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
671  }
672  histograms.h_clusternum_perlayer[ilayer] = ibook.book1D("totclusternum_layer_" + istr1,
673  "total number of layer clusters for layer " + istr2,
677  histograms.h_energyclustered_perlayer[ilayer] = ibook.book1D(
678  "energyclustered_perlayer" + istr1,
679  "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2,
683  }
684 
685  //---------------------------------------------------------------------------------------------------------------------------
686  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
687  auto istr = std::to_string(*it);
688  histograms.h_clusternum_perthick[(*it)] = ibook.book1D("totclusternum_thick_" + istr,
689  "total number of layer clusters for thickness " + istr,
693  }
694  //---------------------------------------------------------------------------------------------------------------------------
695 }
static std::string to_string(const XMLCh *ch)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookClusterHistos_LCtoCP_association()

void HGVHistoProducerAlgo::bookClusterHistos_LCtoCP_association ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers 
)

Definition at line 697 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile(), hgcalTBTopologyTester_cfi::layers, maxEta_, maxPhi_, maxScore_, maxSharedEneFrac_, minEta_, minPhi_, minScore_, minSharedEneFrac_, nintEta_, nintPhi_, nintScore_, nintSharedEneFrac_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

699  {
700  //----------------------------------------------------------------------------------------------------------------------------
701  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
702  auto istr1 = std::to_string(ilayer);
703  while (istr1.size() < 2) {
704  istr1.insert(0, "0");
705  }
706  // Make a mapping to the regural layer naming plus z- or z+ for convenience
707  std::string istr2 = "";
708  // first with the -z endcap
709  if (ilayer < layers) {
710  istr2 = std::to_string(ilayer + 1) + " in z-";
711  } else { // then for the +z
712  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
713  }
714  histograms.h_score_layercl2caloparticle_perlayer[ilayer] =
715  ibook.book1D("Score_layercl2caloparticle_perlayer" + istr1,
716  "Score of Layer Cluster per CaloParticle for layer " + istr2,
717  nintScore_,
718  minScore_,
719  maxScore_);
720  histograms.h_score_caloparticle2layercl_perlayer[ilayer] =
721  ibook.book1D("Score_caloparticle2layercl_perlayer" + istr1,
722  "Score of CaloParticle per Layer Cluster for layer " + istr2,
723  nintScore_,
724  minScore_,
725  maxScore_);
726  histograms.h_energy_vs_score_caloparticle2layercl_perlayer[ilayer] =
727  ibook.book2D("Energy_vs_Score_caloparticle2layer_perlayer" + istr1,
728  "Energy vs Score of CaloParticle per Layer Cluster for layer " + istr2,
729  nintScore_,
730  minScore_,
731  maxScore_,
735  histograms.h_energy_vs_score_layercl2caloparticle_perlayer[ilayer] =
736  ibook.book2D("Energy_vs_Score_layer2caloparticle_perlayer" + istr1,
737  "Energy vs Score of Layer Cluster per CaloParticle Layer for layer " + istr2,
738  nintScore_,
739  minScore_,
740  maxScore_,
744  histograms.h_sharedenergy_caloparticle2layercl_perlayer[ilayer] =
745  ibook.book1D("SharedEnergy_caloparticle2layercl_perlayer" + istr1,
746  "Shared Energy of CaloParticle per Layer Cluster for layer " + istr2,
750  histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer[ilayer] =
751  ibook.bookProfile("SharedEnergy_caloparticle2layercl_vs_eta_perlayer" + istr1,
752  "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer " + istr2,
753  nintEta_,
754  minEta_,
755  maxEta_,
758  histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer[ilayer] =
759  ibook.bookProfile("SharedEnergy_caloparticle2layercl_vs_phi_perlayer" + istr1,
760  "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer " + istr2,
761  nintPhi_,
762  minPhi_,
763  maxPhi_,
766  histograms.h_sharedenergy_layercl2caloparticle_perlayer[ilayer] =
767  ibook.book1D("SharedEnergy_layercluster2caloparticle_perlayer" + istr1,
768  "Shared Energy of Layer Cluster per Layer Calo Particle for layer " + istr2,
772  histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer[ilayer] =
773  ibook.bookProfile("SharedEnergy_layercl2caloparticle_vs_eta_perlayer" + istr1,
774  "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer " + istr2,
775  nintEta_,
776  minEta_,
777  maxEta_,
780  histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer[ilayer] =
781  ibook.bookProfile("SharedEnergy_layercl2caloparticle_vs_phi_perlayer" + istr1,
782  "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer " + istr2,
783  nintPhi_,
784  minPhi_,
785  maxPhi_,
788  histograms.h_num_caloparticle_eta_perlayer[ilayer] =
789  ibook.book1D("Num_CaloParticle_Eta_perlayer" + istr1,
790  "Num CaloParticle Eta per Layer Cluster for layer " + istr2,
791  nintEta_,
792  minEta_,
793  maxEta_);
794  histograms.h_numDup_caloparticle_eta_perlayer[ilayer] =
795  ibook.book1D("NumDup_CaloParticle_Eta_perlayer" + istr1,
796  "Num Duplicate CaloParticle Eta per Layer Cluster for layer " + istr2,
797  nintEta_,
798  minEta_,
799  maxEta_);
800  histograms.h_denom_caloparticle_eta_perlayer[ilayer] =
801  ibook.book1D("Denom_CaloParticle_Eta_perlayer" + istr1,
802  "Denom CaloParticle Eta per Layer Cluster for layer " + istr2,
803  nintEta_,
804  minEta_,
805  maxEta_);
806  histograms.h_num_caloparticle_phi_perlayer[ilayer] =
807  ibook.book1D("Num_CaloParticle_Phi_perlayer" + istr1,
808  "Num CaloParticle Phi per Layer Cluster for layer " + istr2,
809  nintPhi_,
810  minPhi_,
811  maxPhi_);
812  histograms.h_numDup_caloparticle_phi_perlayer[ilayer] =
813  ibook.book1D("NumDup_CaloParticle_Phi_perlayer" + istr1,
814  "Num Duplicate CaloParticle Phi per Layer Cluster for layer " + istr2,
815  nintPhi_,
816  minPhi_,
817  maxPhi_);
818  histograms.h_denom_caloparticle_phi_perlayer[ilayer] =
819  ibook.book1D("Denom_CaloParticle_Phi_perlayer" + istr1,
820  "Denom CaloParticle Phi per Layer Cluster for layer " + istr2,
821  nintPhi_,
822  minPhi_,
823  maxPhi_);
824  histograms.h_num_layercl_eta_perlayer[ilayer] =
825  ibook.book1D("Num_LayerCluster_Eta_perlayer" + istr1,
826  "Num LayerCluster Eta per Layer Cluster for layer " + istr2,
827  nintEta_,
828  minEta_,
829  maxEta_);
830  histograms.h_numMerge_layercl_eta_perlayer[ilayer] =
831  ibook.book1D("NumMerge_LayerCluster_Eta_perlayer" + istr1,
832  "Num Merge LayerCluster Eta per Layer Cluster for layer " + istr2,
833  nintEta_,
834  minEta_,
835  maxEta_);
836  histograms.h_denom_layercl_eta_perlayer[ilayer] =
837  ibook.book1D("Denom_LayerCluster_Eta_perlayer" + istr1,
838  "Denom LayerCluster Eta per Layer Cluster for layer " + istr2,
839  nintEta_,
840  minEta_,
841  maxEta_);
842  histograms.h_num_layercl_phi_perlayer[ilayer] =
843  ibook.book1D("Num_LayerCluster_Phi_perlayer" + istr1,
844  "Num LayerCluster Phi per Layer Cluster for layer " + istr2,
845  nintPhi_,
846  minPhi_,
847  maxPhi_);
848  histograms.h_numMerge_layercl_phi_perlayer[ilayer] =
849  ibook.book1D("NumMerge_LayerCluster_Phi_perlayer" + istr1,
850  "Num Merge LayerCluster Phi per Layer Cluster for layer " + istr2,
851  nintPhi_,
852  minPhi_,
853  maxPhi_);
854  histograms.h_denom_layercl_phi_perlayer[ilayer] =
855  ibook.book1D("Denom_LayerCluster_Phi_perlayer" + istr1,
856  "Denom LayerCluster Phi per Layer Cluster for layer " + istr2,
857  nintPhi_,
858  minPhi_,
859  maxPhi_);
860  }
861  //---------------------------------------------------------------------------------------------------------------------------
862 }
static std::string to_string(const XMLCh *ch)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookInfo()

void HGVHistoProducerAlgo::bookInfo ( DQMStore::IBooker ibook,
Histograms histograms 
)

Definition at line 205 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::bookInt().

205  {
206  histograms.lastLayerEEzm = ibook.bookInt("lastLayerEEzm");
207  histograms.lastLayerFHzm = ibook.bookInt("lastLayerFHzm");
208  histograms.maxlayerzm = ibook.bookInt("maxlayerzm");
209  histograms.lastLayerEEzp = ibook.bookInt("lastLayerEEzp");
210  histograms.lastLayerFHzp = ibook.bookInt("lastLayerFHzp");
211  histograms.maxlayerzp = ibook.bookInt("maxlayerzp");
212 }
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73

◆ bookSimClusterAssociationHistos()

void HGVHistoProducerAlgo::bookSimClusterAssociationHistos ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers,
std::vector< int >  thicknesses 
)

Definition at line 343 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile(), hgcalTBTopologyTester_cfi::layers, maxEta_, maxPhi_, maxScore_, maxSharedEneFrac_, minEta_, minPhi_, minScore_, minSharedEneFrac_, eostools::move(), nintEta_, nintPhi_, nintScore_, nintSharedEneFrac_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

346  {
347  std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_eta_perlayer;
348  denom_layercl_in_simcl_eta_perlayer.clear();
349  std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_phi_perlayer;
350  denom_layercl_in_simcl_phi_perlayer.clear();
351  std::unordered_map<int, dqm::reco::MonitorElement*> score_layercl2simcluster_perlayer;
352  score_layercl2simcluster_perlayer.clear();
353  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_perlayer;
354  sharedenergy_layercl2simcluster_perlayer.clear();
355  std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_layercl2simcluster_perlayer;
356  energy_vs_score_layercl2simcluster_perlayer.clear();
357  std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_eta_perlayer;
358  num_layercl_in_simcl_eta_perlayer.clear();
359  std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_phi_perlayer;
360  num_layercl_in_simcl_phi_perlayer.clear();
361  std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_eta_perlayer;
362  numMerge_layercl_in_simcl_eta_perlayer.clear();
363  std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_phi_perlayer;
364  numMerge_layercl_in_simcl_phi_perlayer.clear();
365  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_eta_perlayer;
366  sharedenergy_layercl2simcluster_vs_eta_perlayer.clear();
367  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_phi_perlayer;
368  sharedenergy_layercl2simcluster_vs_phi_perlayer.clear();
369  std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_eta_perlayer;
370  denom_simcluster_eta_perlayer.clear();
371  std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_phi_perlayer;
372  denom_simcluster_phi_perlayer.clear();
373  std::unordered_map<int, dqm::reco::MonitorElement*> score_simcluster2layercl_perlayer;
374  score_simcluster2layercl_perlayer.clear();
375  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_perlayer;
376  sharedenergy_simcluster2layercl_perlayer.clear();
377  std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_simcluster2layercl_perlayer;
378  energy_vs_score_simcluster2layercl_perlayer.clear();
379  std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_eta_perlayer;
380  num_simcluster_eta_perlayer.clear();
381  std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_phi_perlayer;
382  num_simcluster_phi_perlayer.clear();
383  std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_eta_perlayer;
384  numDup_simcluster_eta_perlayer.clear();
385  std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_phi_perlayer;
386  numDup_simcluster_phi_perlayer.clear();
387  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_eta_perlayer;
388  sharedenergy_simcluster2layercl_vs_eta_perlayer.clear();
389  std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_phi_perlayer;
390  sharedenergy_simcluster2layercl_vs_phi_perlayer.clear();
391 
392  //---------------------------------------------------------------------------------------------------------------------------
393  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
394  auto istr1 = std::to_string(ilayer);
395  while (istr1.size() < 2) {
396  istr1.insert(0, "0");
397  }
398  // Make a mapping to the regural layer naming plus z- or z+ for convenience
399  std::string istr2 = "";
400  // first with the -z endcap
401  if (ilayer < layers) {
402  istr2 = std::to_string(ilayer + 1) + " in z-";
403  } else { // then for the +z
404  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
405  }
406  //-------------------------------------------------------------------------------------------------------------------------
407  denom_layercl_in_simcl_eta_perlayer[ilayer] =
408  ibook.book1D("Denom_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
409  "Denom LayerCluster in SimCluster Eta per Layer Cluster for layer " + istr2,
410  nintEta_,
411  minEta_,
412  maxEta_);
413  //-------------------------------------------------------------------------------------------------------------------------
414  denom_layercl_in_simcl_phi_perlayer[ilayer] =
415  ibook.book1D("Denom_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
416  "Denom LayerCluster in SimCluster Phi per Layer Cluster for layer " + istr2,
417  nintPhi_,
418  minPhi_,
419  maxPhi_);
420  //-------------------------------------------------------------------------------------------------------------------------
421  score_layercl2simcluster_perlayer[ilayer] = ibook.book1D("Score_layercl2simcluster_perlayer" + istr1,
422  "Score of Layer Cluster per SimCluster for layer " + istr2,
423  nintScore_,
424  minScore_,
425  maxScore_);
426  //-------------------------------------------------------------------------------------------------------------------------
427  score_simcluster2layercl_perlayer[ilayer] = ibook.book1D("Score_simcluster2layercl_perlayer" + istr1,
428  "Score of SimCluster per Layer Cluster for layer " + istr2,
429  nintScore_,
430  minScore_,
431  maxScore_);
432  //-------------------------------------------------------------------------------------------------------------------------
433  energy_vs_score_simcluster2layercl_perlayer[ilayer] =
434  ibook.book2D("Energy_vs_Score_simcluster2layer_perlayer" + istr1,
435  "Energy vs Score of SimCluster per Layer Cluster for layer " + istr2,
436  nintScore_,
437  minScore_,
438  maxScore_,
442  //-------------------------------------------------------------------------------------------------------------------------
443  energy_vs_score_layercl2simcluster_perlayer[ilayer] =
444  ibook.book2D("Energy_vs_Score_layer2simcluster_perlayer" + istr1,
445  "Energy vs Score of Layer Cluster per SimCluster for layer " + istr2,
446  nintScore_,
447  minScore_,
448  maxScore_,
452  //-------------------------------------------------------------------------------------------------------------------------
453  sharedenergy_simcluster2layercl_perlayer[ilayer] =
454  ibook.book1D("SharedEnergy_simcluster2layercl_perlayer" + istr1,
455  "Shared Energy of SimCluster per Layer Cluster for layer " + istr2,
459  //-------------------------------------------------------------------------------------------------------------------------
460  sharedenergy_simcluster2layercl_vs_eta_perlayer[ilayer] =
461  ibook.bookProfile("SharedEnergy_simcluster2layercl_vs_eta_perlayer" + istr1,
462  "Shared Energy of SimCluster vs #eta per best Layer Cluster for layer " + istr2,
463  nintEta_,
464  minEta_,
465  maxEta_,
468  //-------------------------------------------------------------------------------------------------------------------------
469  sharedenergy_simcluster2layercl_vs_phi_perlayer[ilayer] =
470  ibook.bookProfile("SharedEnergy_simcluster2layercl_vs_phi_perlayer" + istr1,
471  "Shared Energy of SimCluster vs #phi per best Layer Cluster for layer " + istr2,
472  nintPhi_,
473  minPhi_,
474  maxPhi_,
477  //-------------------------------------------------------------------------------------------------------------------------
478  sharedenergy_layercl2simcluster_perlayer[ilayer] =
479  ibook.book1D("SharedEnergy_layercluster2simcluster_perlayer" + istr1,
480  "Shared Energy of Layer Cluster per SimCluster for layer " + istr2,
484  //-------------------------------------------------------------------------------------------------------------------------
485  sharedenergy_layercl2simcluster_vs_eta_perlayer[ilayer] =
486  ibook.bookProfile("SharedEnergy_layercl2simcluster_vs_eta_perlayer" + istr1,
487  "Shared Energy of LayerCluster vs #eta per best SimCluster for layer " + istr2,
488  nintEta_,
489  minEta_,
490  maxEta_,
493  //-------------------------------------------------------------------------------------------------------------------------
494  sharedenergy_layercl2simcluster_vs_phi_perlayer[ilayer] =
495  ibook.bookProfile("SharedEnergy_layercl2simcluster_vs_phi_perlayer" + istr1,
496  "Shared Energy of LayerCluster vs #phi per best SimCluster for layer " + istr2,
497  nintPhi_,
498  minPhi_,
499  maxPhi_,
502  //-------------------------------------------------------------------------------------------------------------------------
503  num_simcluster_eta_perlayer[ilayer] = ibook.book1D("Num_SimCluster_Eta_perlayer" + istr1,
504  "Num SimCluster Eta per Layer Cluster for layer " + istr2,
505  nintEta_,
506  minEta_,
507  maxEta_);
508  //-------------------------------------------------------------------------------------------------------------------------
509  numDup_simcluster_eta_perlayer[ilayer] =
510  ibook.book1D("NumDup_SimCluster_Eta_perlayer" + istr1,
511  "Num Duplicate SimCluster Eta per Layer Cluster for layer " + istr2,
512  nintEta_,
513  minEta_,
514  maxEta_);
515  //-------------------------------------------------------------------------------------------------------------------------
516  denom_simcluster_eta_perlayer[ilayer] = ibook.book1D("Denom_SimCluster_Eta_perlayer" + istr1,
517  "Denom SimCluster Eta per Layer Cluster for layer " + istr2,
518  nintEta_,
519  minEta_,
520  maxEta_);
521  //-------------------------------------------------------------------------------------------------------------------------
522  num_simcluster_phi_perlayer[ilayer] = ibook.book1D("Num_SimCluster_Phi_perlayer" + istr1,
523  "Num SimCluster Phi per Layer Cluster for layer " + istr2,
524  nintPhi_,
525  minPhi_,
526  maxPhi_);
527  //-------------------------------------------------------------------------------------------------------------------------
528  numDup_simcluster_phi_perlayer[ilayer] =
529  ibook.book1D("NumDup_SimCluster_Phi_perlayer" + istr1,
530  "Num Duplicate SimCluster Phi per Layer Cluster for layer " + istr2,
531  nintPhi_,
532  minPhi_,
533  maxPhi_);
534  //-------------------------------------------------------------------------------------------------------------------------
535  denom_simcluster_phi_perlayer[ilayer] = ibook.book1D("Denom_SimCluster_Phi_perlayer" + istr1,
536  "Denom SimCluster Phi per Layer Cluster for layer " + istr2,
537  nintPhi_,
538  minPhi_,
539  maxPhi_);
540  //-------------------------------------------------------------------------------------------------------------------------
541  num_layercl_in_simcl_eta_perlayer[ilayer] =
542  ibook.book1D("Num_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
543  "Num LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
544  nintEta_,
545  minEta_,
546  maxEta_);
547  //-------------------------------------------------------------------------------------------------------------------------
548  numMerge_layercl_in_simcl_eta_perlayer[ilayer] =
549  ibook.book1D("NumMerge_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
550  "Num Merge LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
551  nintEta_,
552  minEta_,
553  maxEta_);
554  //-------------------------------------------------------------------------------------------------------------------------
555  num_layercl_in_simcl_phi_perlayer[ilayer] =
556  ibook.book1D("Num_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
557  "Num LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
558  nintPhi_,
559  minPhi_,
560  maxPhi_);
561  //-------------------------------------------------------------------------------------------------------------------------
562  numMerge_layercl_in_simcl_phi_perlayer[ilayer] =
563  ibook.book1D("NumMerge_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
564  "Num Merge LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
565  nintPhi_,
566  minPhi_,
567  maxPhi_);
568 
569  } //end of loop over layers
570 
571  histograms.h_denom_layercl_in_simcl_eta_perlayer.push_back(std::move(denom_layercl_in_simcl_eta_perlayer));
572  histograms.h_denom_layercl_in_simcl_phi_perlayer.push_back(std::move(denom_layercl_in_simcl_phi_perlayer));
573  histograms.h_score_layercl2simcluster_perlayer.push_back(std::move(score_layercl2simcluster_perlayer));
574  histograms.h_sharedenergy_layercl2simcluster_perlayer.push_back(std::move(sharedenergy_layercl2simcluster_perlayer));
575  histograms.h_energy_vs_score_layercl2simcluster_perlayer.push_back(
576  std::move(energy_vs_score_layercl2simcluster_perlayer));
577  histograms.h_num_layercl_in_simcl_eta_perlayer.push_back(std::move(num_layercl_in_simcl_eta_perlayer));
578  histograms.h_num_layercl_in_simcl_phi_perlayer.push_back(std::move(num_layercl_in_simcl_phi_perlayer));
579  histograms.h_numMerge_layercl_in_simcl_eta_perlayer.push_back(std::move(numMerge_layercl_in_simcl_eta_perlayer));
580  histograms.h_numMerge_layercl_in_simcl_phi_perlayer.push_back(std::move(numMerge_layercl_in_simcl_phi_perlayer));
581  histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer.push_back(
582  std::move(sharedenergy_layercl2simcluster_vs_eta_perlayer));
583  histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer.push_back(
584  std::move(sharedenergy_layercl2simcluster_vs_phi_perlayer));
585  histograms.h_denom_simcluster_eta_perlayer.push_back(std::move(denom_simcluster_eta_perlayer));
586  histograms.h_denom_simcluster_phi_perlayer.push_back(std::move(denom_simcluster_phi_perlayer));
587  histograms.h_score_simcluster2layercl_perlayer.push_back(std::move(score_simcluster2layercl_perlayer));
588  histograms.h_sharedenergy_simcluster2layercl_perlayer.push_back(std::move(sharedenergy_simcluster2layercl_perlayer));
589  histograms.h_energy_vs_score_simcluster2layercl_perlayer.push_back(
590  std::move(energy_vs_score_simcluster2layercl_perlayer));
591  histograms.h_num_simcluster_eta_perlayer.push_back(std::move(num_simcluster_eta_perlayer));
592  histograms.h_num_simcluster_phi_perlayer.push_back(std::move(num_simcluster_phi_perlayer));
593  histograms.h_numDup_simcluster_eta_perlayer.push_back(std::move(numDup_simcluster_eta_perlayer));
594  histograms.h_numDup_simcluster_phi_perlayer.push_back(std::move(numDup_simcluster_phi_perlayer));
595  histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer.push_back(
596  std::move(sharedenergy_simcluster2layercl_vs_eta_perlayer));
597  histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer.push_back(
598  std::move(sharedenergy_simcluster2layercl_vs_phi_perlayer));
599 }
static std::string to_string(const XMLCh *ch)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
def move(src, dest)
Definition: eostools.py:511

◆ bookSimClusterHistos()

void HGVHistoProducerAlgo::bookSimClusterHistos ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers,
std::vector< int >  thicknesses 
)

Definition at line 291 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, hgcalTBTopologyTester_cfi::layers, maxMixedHitsSimCluster_, maxTotNsimClsperlay_, maxTotNsimClsperthick_, minMixedHitsSimCluster_, minTotNsimClsperlay_, minTotNsimClsperthick_, nintMixedHitsSimCluster_, nintTotNsimClsperlay_, nintTotNsimClsperthick_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

294  {
295  //---------------------------------------------------------------------------------------------------------------------------
296  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
297  auto istr1 = std::to_string(ilayer);
298  while (istr1.size() < 2) {
299  istr1.insert(0, "0");
300  }
301  // Make a mapping to the regural layer naming plus z- or z+ for convenience
302  std::string istr2 = "";
303  // first with the -z endcap
304  if (ilayer < layers) {
305  istr2 = std::to_string(ilayer + 1) + " in z-";
306  } else { // then for the +z
307  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
308  }
309  histograms.h_simclusternum_perlayer[ilayer] = ibook.book1D("totsimclusternum_layer_" + istr1,
310  "total number of SimClusters for layer " + istr2,
314 
315  } //end of loop over layers
316  //---------------------------------------------------------------------------------------------------------------------------
317  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
318  auto istr = std::to_string(*it);
319  histograms.h_simclusternum_perthick[(*it)] = ibook.book1D("totsimclusternum_thick_" + istr,
320  "total number of simclusters for thickness " + istr,
324  } //end of loop over thicknesses
325 
326  //---------------------------------------------------------------------------------------------------------------------------
327  //z-
328  histograms.h_mixedhitssimcluster_zminus =
329  ibook.book1D("mixedhitssimcluster_zminus",
330  "N of simclusters that contain hits of more than one kind in z-",
334  //z+
335  histograms.h_mixedhitssimcluster_zplus =
336  ibook.book1D("mixedhitssimcluster_zplus",
337  "N of simclusters that contain hits of more than one kind in z+",
341 }
static std::string to_string(const XMLCh *ch)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookTracksterHistos()

void HGVHistoProducerAlgo::bookTracksterHistos ( DQMStore::IBooker ibook,
Histograms histograms,
unsigned int  layers 
)

Definition at line 972 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile(), hgcalTBTopologyTester_cfi::layers, maxClEnepermultiplicity_, maxEne_, maxEta_, maxMplofLCs_, maxPhi_, maxPt_, maxSizeCLsinTSTs_, maxTotNClsinTSTs_, maxTotNClsinTSTsperlayer_, maxTotNTSTs_, maxX_, maxY_, maxZ_, minClEnepermultiplicity_, minEne_, minEta_, minMplofLCs_, minPhi_, minPt_, minSizeCLsinTSTs_, minTotNClsinTSTs_, minTotNClsinTSTsperlayer_, minTotNTSTs_, minX_, minY_, minZ_, eostools::move(), nintClEnepermultiplicity_, nintEne_, nintEta_, nintMplofLCs_, nintPhi_, nintPt_, nintSizeCLsinTSTs_, nintTotNClsinTSTs_, nintTotNClsinTSTsperlayer_, nintTotNTSTs_, nintX_, nintY_, nintZ_, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

972  {
973  std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_trackster_perlayer;
974  clusternum_in_trackster_perlayer.clear();
975 
976  for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) {
977  auto istr1 = std::to_string(ilayer);
978  while (istr1.size() < 2) {
979  istr1.insert(0, "0");
980  }
981  // Make a mapping to the regural layer naming plus z- or z+ for convenience
982  std::string istr2 = "";
983  // first with the -z endcap
984  if (ilayer < layers) {
985  istr2 = std::to_string(ilayer + 1) + " in z-";
986  } else { // then for the +z
987  istr2 = std::to_string(ilayer - (layers - 1)) + " in z+";
988  }
989 
990  clusternum_in_trackster_perlayer[ilayer] = ibook.book1D("clusternum_in_trackster_perlayer" + istr1,
991  "Number of layer clusters in Trackster for layer " + istr2,
995  }
996 
997  histograms.h_clusternum_in_trackster_perlayer.push_back(std::move(clusternum_in_trackster_perlayer));
998 
999  histograms.h_tracksternum.push_back(ibook.book1D(
1000  "tottracksternum", "total number of Tracksters;# of Tracksters", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_));
1001 
1002  histograms.h_conttracksternum.push_back(ibook.book1D(
1003  "conttracksternum", "number of Tracksters with 3 contiguous layers", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_));
1004 
1005  histograms.h_nonconttracksternum.push_back(ibook.book1D("nonconttracksternum",
1006  "number of Tracksters without 3 contiguous layers",
1007  nintTotNTSTs_,
1008  minTotNTSTs_,
1009  maxTotNTSTs_));
1010 
1011  histograms.h_clusternum_in_trackster.push_back(
1012  ibook.book1D("clusternum_in_trackster",
1013  "total number of layer clusters in Trackster;# of LayerClusters",
1017 
1018  histograms.h_clusternum_in_trackster_vs_layer.push_back(ibook.bookProfile(
1019  "clusternum_in_trackster_vs_layer",
1020  "Profile of 2d layer clusters in Trackster vs layer number;layer number;<2D LayerClusters in Trackster>",
1021  2 * layers,
1022  0.,
1023  2. * layers,
1026 
1027  histograms.h_multiplicityOfLCinTST.push_back(
1028  ibook.book2D("multiplicityOfLCinTST",
1029  "Multiplicity vs Layer cluster size in Tracksters;LayerCluster multiplicity in Tracksters;Cluster "
1030  "size (n_{hits})",
1031  nintMplofLCs_,
1032  minMplofLCs_,
1033  maxMplofLCs_,
1037 
1038  histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.book1D("multiplicity_numberOfEventsHistogram",
1039  "multiplicity numberOfEventsHistogram",
1040  nintMplofLCs_,
1041  minMplofLCs_,
1042  maxMplofLCs_));
1043 
1044  histograms.h_multiplicity_zminus_numberOfEventsHistogram.push_back(
1045  ibook.book1D("multiplicity_zminus_numberOfEventsHistogram",
1046  "multiplicity numberOfEventsHistogram in z-",
1047  nintMplofLCs_,
1048  minMplofLCs_,
1049  maxMplofLCs_));
1050 
1051  histograms.h_multiplicity_zplus_numberOfEventsHistogram.push_back(
1052  ibook.book1D("multiplicity_zplus_numberOfEventsHistogram",
1053  "multiplicity numberOfEventsHistogram in z+",
1054  nintMplofLCs_,
1055  minMplofLCs_,
1056  maxMplofLCs_));
1057 
1058  histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus.push_back(
1059  ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zminus",
1060  "Multiplicity vs Layer number in z-;LayerCluster multiplicity in Tracksters;layer number",
1061  nintMplofLCs_,
1062  minMplofLCs_,
1063  maxMplofLCs_,
1064  layers,
1065  0.,
1066  (float)layers));
1067 
1068  histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus.push_back(
1069  ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zplus",
1070  "Multiplicity vs Layer number in z+;LayerCluster multiplicity in Tracksters;layer number",
1071  nintMplofLCs_,
1072  minMplofLCs_,
1073  maxMplofLCs_,
1074  layers,
1075  0.,
1076  (float)layers));
1077 
1078  histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy.push_back(
1079  ibook.book2D("multiplicityOfLCinTST_vs_layerclusterenergy",
1080  "Multiplicity vs Layer cluster energy;LayerCluster multiplicity in Tracksters;Cluster energy [GeV]",
1081  nintMplofLCs_,
1082  minMplofLCs_,
1083  maxMplofLCs_,
1087 
1088  histograms.h_trackster_pt.push_back(
1089  ibook.book1D("trackster_pt", "Pt of the Trackster;Trackster p_{T} [GeV]", nintPt_, minPt_, maxPt_));
1090  histograms.h_trackster_eta.push_back(
1091  ibook.book1D("trackster_eta", "Eta of the Trackster;Trackster #eta", nintEta_, minEta_, maxEta_));
1092  histograms.h_trackster_phi.push_back(
1093  ibook.book1D("trackster_phi", "Phi of the Trackster;Trackster #phi", nintPhi_, minPhi_, maxPhi_));
1094  histograms.h_trackster_energy.push_back(
1095  ibook.book1D("trackster_energy", "Energy of the Trackster;Trackster energy [GeV]", nintEne_, minEne_, maxEne_));
1096  histograms.h_trackster_x.push_back(
1097  ibook.book1D("trackster_x", "X position of the Trackster;Trackster x", nintX_, minX_, maxX_));
1098  histograms.h_trackster_y.push_back(
1099  ibook.book1D("trackster_y", "Y position of the Trackster;Trackster y", nintY_, minY_, maxY_));
1100  histograms.h_trackster_z.push_back(
1101  ibook.book1D("trackster_z", "Z position of the Trackster;Trackster z", nintZ_, minZ_, maxZ_));
1102  histograms.h_trackster_firstlayer.push_back(ibook.book1D(
1103  "trackster_firstlayer", "First layer of the Trackster;Trackster First Layer", 2 * layers, 0., (float)2 * layers));
1104  histograms.h_trackster_lastlayer.push_back(ibook.book1D(
1105  "trackster_lastlayer", "Last layer of the Trackster;Trackster Last Layer", 2 * layers, 0., (float)2 * layers));
1106  histograms.h_trackster_layersnum.push_back(
1107  ibook.book1D("trackster_layersnum",
1108  "Number of layers of the Trackster;Trackster Number of Layers",
1109  2 * layers,
1110  0.,
1111  (float)2 * layers));
1112 }
static std::string to_string(const XMLCh *ch)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
def move(src, dest)
Definition: eostools.py:511

◆ bookTracksterSTSHistos()

void HGVHistoProducerAlgo::bookTracksterSTSHistos ( DQMStore::IBooker ibook,
Histograms histograms,
const validationType  valType 
)

Definition at line 1114 of file HGVHistoProducerAlgo.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookProfile(), maxEne_, maxEta_, maxPhi_, maxPt_, maxScore_, maxTSTSharedEneFrac_, minEne_, minEta_, minPhi_, minPt_, minScore_, minTSTSharedEneFrac_, nintEne_, nintEta_, nintPhi_, nintPt_, nintScore_, nintSharedEneFrac_, and heppy_batch::val.

1116  {
1117  const string ref[] = {"caloparticle", "simtrackster", "simtrackster_fromCP"};
1118  const string refT[] = {"CaloParticle", "SimTrackster", "SimTrackster_fromCP"};
1119  // Must be in sync with labels in PostProcessorHGCAL_cfi.py
1120  const string val[] = {"_Link", "_PR"};
1121  //const string val[] = {"_CP", "_PR", "_Link"};
1122  const string rtos = ";score Reco-to-Sim";
1123  const string stor = ";score Sim-to-Reco";
1124  const string shREnFr = ";shared Reco energy fraction";
1125  const string shSEnFr = ";shared Sim energy fraction";
1126 
1127  histograms.h_score_trackster2caloparticle[valType].push_back(
1128  ibook.book1D("Score_trackster2" + ref[valType],
1129  "Score of Trackster per " + refT[valType] + rtos,
1130  nintScore_,
1131  minScore_,
1132  maxScore_));
1133  histograms.h_score_trackster2bestCaloparticle[valType].push_back(
1134  ibook.book1D("ScoreFake_trackster2" + ref[valType],
1135  "Score of Trackster per best " + refT[valType] + rtos,
1136  nintScore_,
1137  minScore_,
1138  maxScore_));
1139  histograms.h_score_trackster2bestCaloparticle2[valType].push_back(
1140  ibook.book1D("ScoreMerge_trackster2" + ref[valType],
1141  "Score of Trackster per 2^{nd} best " + refT[valType] + rtos,
1142  nintScore_,
1143  minScore_,
1144  maxScore_));
1145  histograms.h_score_caloparticle2trackster[valType].push_back(
1146  ibook.book1D("Score_" + ref[valType] + "2trackster",
1147  "Score of " + refT[valType] + " per Trackster" + stor,
1148  nintScore_,
1149  minScore_,
1150  maxScore_));
1151  histograms.h_scorePur_caloparticle2trackster[valType].push_back(
1152  ibook.book1D("ScorePur_" + ref[valType] + "2trackster",
1153  "Score of " + refT[valType] + " per best Trackster" + stor,
1154  nintScore_,
1155  minScore_,
1156  maxScore_));
1157  histograms.h_scoreDupl_caloparticle2trackster[valType].push_back(
1158  ibook.book1D("ScoreDupl_" + ref[valType] + "2trackster",
1159  "Score of " + refT[valType] + " per 2^{nd} best Trackster" + stor,
1160  nintScore_,
1161  minScore_,
1162  maxScore_));
1163  histograms.h_energy_vs_score_trackster2caloparticle[valType].push_back(
1164  ibook.book2D("Energy_vs_Score_trackster2" + refT[valType],
1165  "Energy vs Score of Trackster per " + refT[valType] + rtos + shREnFr,
1166  nintScore_,
1167  minScore_,
1168  maxScore_,
1172  histograms.h_energy_vs_score_trackster2bestCaloparticle[valType].push_back(
1173  ibook.book2D("Energy_vs_Score_trackster2best" + refT[valType],
1174  "Energy vs Score of Trackster per best " + refT[valType] + rtos + shREnFr,
1175  nintScore_,
1176  minScore_,
1177  maxScore_,
1181  histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType].push_back(
1182  ibook.book2D("Energy_vs_Score_trackster2secBest" + refT[valType],
1183  "Energy vs Score of Trackster per 2^{nd} best " + refT[valType] + rtos + shREnFr,
1184  nintScore_,
1185  minScore_,
1186  maxScore_,
1190  histograms.h_energy_vs_score_caloparticle2trackster[valType].push_back(
1191  ibook.book2D("Energy_vs_Score_" + ref[valType] + "2Trackster",
1192  "Energy vs Score of " + refT[valType] + " per Trackster" + stor + shSEnFr,
1193  nintScore_,
1194  minScore_,
1195  maxScore_,
1199  histograms.h_energy_vs_score_caloparticle2bestTrackster[valType].push_back(
1200  ibook.book2D("Energy_vs_Score_" + ref[valType] + "2bestTrackster",
1201  "Energy vs Score of " + refT[valType] + " per best Trackster" + stor + shSEnFr,
1202  nintScore_,
1203  minScore_,
1204  maxScore_,
1208  histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType].push_back(
1209  ibook.book2D("Energy_vs_Score_" + ref[valType] + "2secBestTrackster",
1210  "Energy vs Score of " + refT[valType] + " per 2^{nd} best Trackster" + stor + shSEnFr,
1211  nintScore_,
1212  minScore_,
1213  maxScore_,
1217 
1218  // Back to all Tracksters
1219  // eta
1220  histograms.h_num_trackster_eta[valType].push_back(ibook.book1D(
1221  "Num_Trackster_Eta" + val[valType], "Num Trackster Eta per Trackster;#eta", nintEta_, minEta_, maxEta_));
1222  histograms.h_numMerge_trackster_eta[valType].push_back(ibook.book1D("NumMerge_Trackster_Eta" + val[valType],
1223  "Num Merge Trackster Eta per Trackster;#eta",
1224  nintEta_,
1225  minEta_,
1226  maxEta_));
1227  histograms.h_denom_trackster_eta[valType].push_back(ibook.book1D(
1228  "Denom_Trackster_Eta" + val[valType], "Denom Trackster Eta per Trackster;#eta", nintEta_, minEta_, maxEta_));
1229  // phi
1230  histograms.h_num_trackster_phi[valType].push_back(ibook.book1D(
1231  "Num_Trackster_Phi" + val[valType], "Num Trackster Phi per Trackster;#phi", nintPhi_, minPhi_, maxPhi_));
1232  histograms.h_numMerge_trackster_phi[valType].push_back(ibook.book1D("NumMerge_Trackster_Phi" + val[valType],
1233  "Num Merge Trackster Phi per Trackster;#phi",
1234  nintPhi_,
1235  minPhi_,
1236  maxPhi_));
1237  histograms.h_denom_trackster_phi[valType].push_back(ibook.book1D(
1238  "Denom_Trackster_Phi" + val[valType], "Denom Trackster Phi per Trackster;#phi", nintPhi_, minPhi_, maxPhi_));
1239  // energy
1240  histograms.h_num_trackster_en[valType].push_back(ibook.book1D("Num_Trackster_Energy" + val[valType],
1241  "Num Trackster Energy per Trackster;energy [GeV]",
1242  nintEne_,
1243  minEne_,
1244  maxEne_));
1245  histograms.h_numMerge_trackster_en[valType].push_back(
1246  ibook.book1D("NumMerge_Trackster_Energy" + val[valType],
1247  "Num Merge Trackster Energy per Trackster;energy [GeV]",
1248  nintEne_,
1249  minEne_,
1250  maxEne_));
1251  histograms.h_denom_trackster_en[valType].push_back(ibook.book1D("Denom_Trackster_Energy" + val[valType],
1252  "Denom Trackster Energy per Trackster;energy [GeV]",
1253  nintEne_,
1254  minEne_,
1255  maxEne_));
1256  // pT
1257  histograms.h_num_trackster_pt[valType].push_back(ibook.book1D(
1258  "Num_Trackster_Pt" + val[valType], "Num Trackster p_{T} per Trackster;p_{T} [GeV]", nintPt_, minPt_, maxPt_));
1259  histograms.h_numMerge_trackster_pt[valType].push_back(
1260  ibook.book1D("NumMerge_Trackster_Pt" + val[valType],
1261  "Num Merge Trackster p_{T} per Trackster;p_{T} [GeV]",
1262  nintPt_,
1263  minPt_,
1264  maxPt_));
1265  histograms.h_denom_trackster_pt[valType].push_back(ibook.book1D(
1266  "Denom_Trackster_Pt" + val[valType], "Denom Trackster p_{T} per Trackster;p_{T} [GeV]", nintPt_, minPt_, maxPt_));
1267 
1268  histograms.h_sharedenergy_trackster2caloparticle[valType].push_back(
1269  ibook.book1D("SharedEnergy_trackster2" + ref[valType],
1270  "Shared Energy of Trackster per " + refT[valType] + shREnFr,
1274  histograms.h_sharedenergy_trackster2bestCaloparticle[valType].push_back(
1275  ibook.book1D("SharedEnergy_trackster2" + ref[valType] + "_assoc",
1276  "Shared Energy of Trackster per best " + refT[valType] + shREnFr,
1280  histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType].push_back(
1281  ibook.bookProfile("SharedEnergy_trackster2" + ref[valType] + "_assoc_vs_eta",
1282  "Shared Energy of Trackster vs #eta per best " + refT[valType] + ";Trackster #eta" + shREnFr,
1283  nintEta_,
1284  minEta_,
1285  maxEta_,
1288  histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType].push_back(
1289  ibook.bookProfile("SharedEnergy_trackster2" + ref[valType] + "_assoc_vs_phi",
1290  "Shared Energy of Trackster vs #phi per best " + refT[valType] + ";Trackster #phi" + shREnFr,
1291  nintPhi_,
1292  minPhi_,
1293  maxPhi_,
1296  histograms.h_sharedenergy_trackster2bestCaloparticle2[valType].push_back(
1297  ibook.book1D("SharedEnergy_trackster2" + ref[valType] + "_assoc2",
1298  "Shared Energy of Trackster per 2^{nd} best " + refT[valType] + shREnFr,
1302 
1303  histograms.h_sharedenergy_caloparticle2trackster[valType].push_back(
1304  ibook.book1D("SharedEnergy_" + ref[valType] + "2trackster",
1305  "Shared Energy of " + refT[valType] + " per Trackster" + shSEnFr,
1309  histograms.h_sharedenergy_caloparticle2trackster_assoc[valType].push_back(
1310  ibook.book1D("SharedEnergy_" + ref[valType] + "2trackster_assoc",
1311  "Shared Energy of " + refT[valType] + " per best Trackster" + shSEnFr,
1315  histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_eta[valType].push_back(ibook.bookProfile(
1316  "SharedEnergy_" + ref[valType] + "2trackster_assoc_vs_eta",
1317  "Shared Energy of " + refT[valType] + " vs #eta per best Trackster;" + refT[valType] + " #eta" + shSEnFr,
1318  nintEta_,
1319  minEta_,
1320  maxEta_,
1323  histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_phi[valType].push_back(ibook.bookProfile(
1324  "SharedEnergy_" + ref[valType] + "2trackster_assoc_vs_phi",
1325  "Shared Energy of " + refT[valType] + " vs #phi per best Trackster;" + refT[valType] + " #phi" + shSEnFr,
1326  nintPhi_,
1327  minPhi_,
1328  maxPhi_,
1331  histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType].push_back(
1332  ibook.book1D("SharedEnergy_" + ref[valType] + "2trackster_assoc2",
1333  "Shared Energy of " + refT[valType] + " per 2^{nd} best Trackster;" + shSEnFr,
1337 
1338  // eta
1339  histograms.h_numEff_caloparticle_eta[valType].push_back(
1340  ibook.book1D("NumEff_" + refT[valType] + "_Eta",
1341  "Num Efficiency " + refT[valType] + " Eta per Trackster;#eta",
1342  nintEta_,
1343  minEta_,
1344  maxEta_));
1345  histograms.h_num_caloparticle_eta[valType].push_back(
1346  ibook.book1D("Num_" + refT[valType] + "_Eta",
1347  "Num Purity " + refT[valType] + " Eta per Trackster;#eta",
1348  nintEta_,
1349  minEta_,
1350  maxEta_));
1351  histograms.h_numDup_trackster_eta[valType].push_back(ibook.book1D(
1352  "NumDup_Trackster_Eta" + val[valType], "Num Duplicate Trackster vs Eta;#eta", nintEta_, minEta_, maxEta_));
1353  histograms.h_denom_caloparticle_eta[valType].push_back(
1354  ibook.book1D("Denom_" + refT[valType] + "_Eta",
1355  "Denom " + refT[valType] + " Eta per Trackster;#eta",
1356  nintEta_,
1357  minEta_,
1358  maxEta_));
1359  // phi
1360  histograms.h_numEff_caloparticle_phi[valType].push_back(
1361  ibook.book1D("NumEff_" + refT[valType] + "_Phi",
1362  "Num Efficiency " + refT[valType] + " Phi per Trackster;#phi",
1363  nintPhi_,
1364  minPhi_,
1365  maxPhi_));
1366  histograms.h_num_caloparticle_phi[valType].push_back(
1367  ibook.book1D("Num_" + refT[valType] + "_Phi",
1368  "Num Purity " + refT[valType] + " Phi per Trackster;#phi",
1369  nintPhi_,
1370  minPhi_,
1371  maxPhi_));
1372  histograms.h_numDup_trackster_phi[valType].push_back(ibook.book1D(
1373  "NumDup_Trackster_Phi" + val[valType], "Num Duplicate Trackster vs Phi;#phi", nintPhi_, minPhi_, maxPhi_));
1374  histograms.h_denom_caloparticle_phi[valType].push_back(
1375  ibook.book1D("Denom_" + refT[valType] + "_Phi",
1376  "Denom " + refT[valType] + " Phi per Trackster;#phi",
1377  nintPhi_,
1378  minPhi_,
1379  maxPhi_));
1380  // energy
1381  histograms.h_numEff_caloparticle_en[valType].push_back(
1382  ibook.book1D("NumEff_" + refT[valType] + "_Energy",
1383  "Num Efficiency " + refT[valType] + " Energy per Trackster;energy [GeV]",
1384  nintEne_,
1385  minEne_,
1386  maxEne_));
1387  histograms.h_num_caloparticle_en[valType].push_back(
1388  ibook.book1D("Num_" + refT[valType] + "_Energy",
1389  "Num Purity " + refT[valType] + " Energy per Trackster;energy [GeV]",
1390  nintEne_,
1391  minEne_,
1392  maxEne_));
1393  histograms.h_numDup_trackster_en[valType].push_back(ibook.book1D("NumDup_Trackster_Energy" + val[valType],
1394  "Num Duplicate Trackster vs Energy;energy [GeV]",
1395  nintEne_,
1396  minEne_,
1397  maxEne_));
1398  histograms.h_denom_caloparticle_en[valType].push_back(
1399  ibook.book1D("Denom_" + refT[valType] + "_Energy",
1400  "Denom " + refT[valType] + " Energy per Trackster;energy [GeV]",
1401  nintEne_,
1402  minEne_,
1403  maxEne_));
1404  // pT
1405  histograms.h_numEff_caloparticle_pt[valType].push_back(
1406  ibook.book1D("NumEff_" + refT[valType] + "_Pt",
1407  "Num Efficiency " + refT[valType] + " p_{T} per Trackster;p_{T} [GeV]",
1408  nintPt_,
1409  minPt_,
1410  maxPt_));
1411  histograms.h_num_caloparticle_pt[valType].push_back(
1412  ibook.book1D("Num_" + refT[valType] + "_Pt",
1413  "Num Purity " + refT[valType] + " p_{T} per Trackster;p_{T} [GeV]",
1414  nintPt_,
1415  minPt_,
1416  maxPt_));
1417  histograms.h_numDup_trackster_pt[valType].push_back(ibook.book1D(
1418  "NumDup_Trackster_Pt" + val[valType], "Num Duplicate Trackster vs p_{T};p_{T} [GeV]", nintPt_, minPt_, maxPt_));
1419  histograms.h_denom_caloparticle_pt[valType].push_back(
1420  ibook.book1D("Denom_" + refT[valType] + "_Pt",
1421  "Denom " + refT[valType] + " p_{T} per Trackster;p_{T} [GeV]",
1422  nintPt_,
1423  minPt_,
1424  maxPt_));
1425 }
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:399
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ distance()

double HGVHistoProducerAlgo::distance ( const double  x1,
const double  y1,
const double  x2,
const double  y2 
) const

◆ distance2()

double HGVHistoProducerAlgo::distance2 ( const double  x1,
const double  y1,
const double  x2,
const double  y2 
) const

◆ fill_caloparticle_histos()

void HGVHistoProducerAlgo::fill_caloparticle_histos ( const Histograms histograms,
int  pdgid,
const CaloParticle caloparticle,
std::vector< SimVertex > const &  simVertices,
unsigned int  layers,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap 
) const

Definition at line 1440 of file HGVHistoProducerAlgo.cc.

References hcalRecHitTable_cff::energy, CaloParticle::energy(), PVValHelper::eta, CaloParticle::eta(), newFWLiteAna::found, CaloParticle::g4Tracks(), getEta(), mps_fire::i, hgcalTBTopologyTester_cfi::layers, LogDebug, SiStripPI::max, SiStripPI::min, EgammaValidation_cff::pdgid, CaloParticle::phi(), position, funct::pow(), CaloParticle::pt(), recHitTools_, CaloParticle::simClusters(), FastTrackerRecHitCombiner_cfi::simHits, HGCalValidator_cfi::simVertices, edm::RefVector< C, T, F >::size(), and findQualityFiles::v.

1445  {
1446  const auto eta = getEta(caloParticle.eta());
1447  if (histograms.h_caloparticle_eta.count(pdgid)) {
1448  histograms.h_caloparticle_eta.at(pdgid)->Fill(eta);
1449  }
1450  if (histograms.h_caloparticle_eta_Zorigin.count(pdgid)) {
1451  histograms.h_caloparticle_eta_Zorigin.at(pdgid)->Fill(
1452  simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), eta);
1453  }
1454 
1455  if (histograms.h_caloparticle_energy.count(pdgid)) {
1456  histograms.h_caloparticle_energy.at(pdgid)->Fill(caloParticle.energy());
1457  }
1458  if (histograms.h_caloparticle_pt.count(pdgid)) {
1459  histograms.h_caloparticle_pt.at(pdgid)->Fill(caloParticle.pt());
1460  }
1461  if (histograms.h_caloparticle_phi.count(pdgid)) {
1462  histograms.h_caloparticle_phi.at(pdgid)->Fill(caloParticle.phi());
1463  }
1464 
1465  if (histograms.h_caloparticle_nSimClusters.count(pdgid)) {
1466  histograms.h_caloparticle_nSimClusters.at(pdgid)->Fill(caloParticle.simClusters().size());
1467 
1468  int simHits = 0;
1469  int minLayerId = 999;
1470  int maxLayerId = 0;
1471 
1472  int simHits_matched = 0;
1473  int minLayerId_matched = 999;
1474  int maxLayerId_matched = 0;
1475 
1476  float energy = 0.;
1477  std::map<int, double> totenergy_layer;
1478 
1479  float hitEnergyWeight_invSum = 0;
1480  std::vector<std::pair<DetId, float>> haf_cp;
1481  for (const auto& sc : caloParticle.simClusters()) {
1482  LogDebug("HGCalValidator") << " This sim cluster has " << sc->hits_and_fractions().size() << " simHits and "
1483  << sc->energy() << " energy. " << std::endl;
1484  simHits += sc->hits_and_fractions().size();
1485  for (auto const& h_and_f : sc->hits_and_fractions()) {
1486  const auto hitDetId = h_and_f.first;
1487  const int layerId =
1488  recHitTools_->getLayerWithOffset(hitDetId) + layers * ((recHitTools_->zside(hitDetId) + 1) >> 1) - 1;
1489  // set to 0 if matched RecHit not found
1490  int layerId_matched_min = 999;
1491  int layerId_matched_max = 0;
1492  std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitDetId);
1493  if (itcheck != hitMap.end()) {
1494  layerId_matched_min = layerId;
1495  layerId_matched_max = layerId;
1496  simHits_matched++;
1497 
1498  const auto hitEn = itcheck->second->energy();
1499  hitEnergyWeight_invSum += pow(hitEn, 2);
1500  const auto hitFr = h_and_f.second;
1501  const auto hitEnFr = hitEn * hitFr;
1502  energy += hitEnFr;
1503  histograms.h_caloparticle_nHits_matched_energy.at(pdgid)->Fill(hitEnFr);
1504  histograms.h_caloparticle_nHits_matched_energy_layer.at(pdgid)->Fill(layerId, hitEnFr);
1505 
1506  if (totenergy_layer.find(layerId) != totenergy_layer.end()) {
1507  totenergy_layer[layerId] = totenergy_layer.at(layerId) + hitEn;
1508  } else {
1509  totenergy_layer.emplace(layerId, hitEn);
1510  }
1511  if (caloParticle.simClusters().size() == 1)
1512  histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(pdgid)->Fill(layerId, hitEnFr);
1513 
1514  auto found = std::find_if(std::begin(haf_cp),
1515  std::end(haf_cp),
1516  [&hitDetId](const std::pair<DetId, float>& v) { return v.first == hitDetId; });
1517  if (found != haf_cp.end())
1518  found->second += hitFr;
1519  else
1520  haf_cp.emplace_back(hitDetId, hitFr);
1521 
1522  } else {
1523  LogDebug("HGCalValidator") << " matched to RecHit NOT found !" << std::endl;
1524  }
1525 
1526  minLayerId = std::min(minLayerId, layerId);
1527  maxLayerId = std::max(maxLayerId, layerId);
1528  minLayerId_matched = std::min(minLayerId_matched, layerId_matched_min);
1529  maxLayerId_matched = std::max(maxLayerId_matched, layerId_matched_max);
1530  }
1531  LogDebug("HGCalValidator") << std::endl;
1532  } // End loop over SimClusters of CaloParticle
1533  if (hitEnergyWeight_invSum)
1534  hitEnergyWeight_invSum = 1 / hitEnergyWeight_invSum;
1535 
1536  histograms.h_caloparticle_firstlayer.at(pdgid)->Fill(minLayerId);
1537  histograms.h_caloparticle_lastlayer.at(pdgid)->Fill(maxLayerId);
1538  histograms.h_caloparticle_layersnum.at(pdgid)->Fill(int(maxLayerId - minLayerId));
1539 
1540  histograms.h_caloparticle_firstlayer_matchedtoRecHit.at(pdgid)->Fill(minLayerId_matched);
1541  histograms.h_caloparticle_lastlayer_matchedtoRecHit.at(pdgid)->Fill(maxLayerId_matched);
1542  histograms.h_caloparticle_layersnum_matchedtoRecHit.at(pdgid)->Fill(int(maxLayerId_matched - minLayerId_matched));
1543 
1544  histograms.h_caloparticle_nHitsInSimClusters.at(pdgid)->Fill((float)simHits);
1545  histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit.at(pdgid)->Fill((float)simHits_matched);
1546  histograms.h_caloparticle_selfenergy.at(pdgid)->Fill((float)energy);
1547  histograms.h_caloparticle_energyDifference.at(pdgid)->Fill((float)1. - energy / caloParticle.energy());
1548 
1549  //Calculate sum energy per-layer
1550  auto i = totenergy_layer.begin();
1551  double sum_energy = 0.0;
1552  while (i != totenergy_layer.end()) {
1553  sum_energy += i->second;
1554  histograms.h_caloparticle_sum_energy_layer.at(pdgid)->Fill(i->first, sum_energy / caloParticle.energy() * 100.);
1555  i++;
1556  }
1557 
1558  for (auto const& haf : haf_cp) {
1559  const auto hitEn = hitMap.find(haf.first)->second->energy();
1560  const auto weight = pow(hitEn, 2);
1561  histograms.h_caloparticle_fractions.at(pdgid)->Fill(haf.second, weight * hitEnergyWeight_invSum);
1562  histograms.h_caloparticle_fractions_weight.at(pdgid)->Fill(haf.second, weight * hitEnergyWeight_invSum, weight);
1563  }
1564  }
1565 }
Definition: weight.py:1
double getEta(double eta) const
std::shared_ptr< hgcal::RecHitTools > recHitTools_
static int position[264][3]
Definition: ReadPGInfo.cc:289
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
#define LogDebug(id)

◆ fill_cluster_histos()

void HGVHistoProducerAlgo::fill_cluster_histos ( const Histograms histograms,
const int  count,
const reco::CaloCluster cluster 
) const

Definition at line 1732 of file HGVHistoProducerAlgo.cc.

References submitPVResolutionJobs::count, PVValHelper::eta, reco::CaloCluster::eta(), and getEta().

1734  {
1735  const auto eta = getEta(cluster.eta());
1736  histograms.h_cluster_eta[count]->Fill(eta);
1737 }
double getEta(double eta) const
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:180

◆ fill_generic_cluster_histos()

void HGVHistoProducerAlgo::fill_generic_cluster_histos ( const Histograms histograms,
const int  count,
edm::Handle< reco::CaloClusterCollection clusterHandle,
const reco::CaloClusterCollection clusters,
edm::Handle< std::vector< CaloParticle >>  caloParticleHandle,
std::vector< CaloParticle > const &  cP,
std::vector< size_t > const &  cPIndices,
std::vector< size_t > const &  cPSelectedIndices,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap,
std::map< double, double >  cummatbudg,
unsigned int  layers,
std::vector< int >  thicknesses,
const hgcal::RecoToSimCollection recSimColl,
const hgcal::SimToRecoCollection simRecColl 
) const

Definition at line 2176 of file HGVHistoProducerAlgo.cc.

References bsc_activity_cfg::clusters, submitPVResolutionJobs::count, DetId::det(), distance(), HLT_2024v12_cff::distance, PVValHelper::eta, findmaxhit(), DetId::Forward, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, layerClusters_to_CaloParticles(), hgcalTBTopologyTester_cfi::layers, LogDebug, DetId::rawId(), recHitTools_, AlCaHLTBitMon_QueryRunRegistry::string, Calorimetry_cff::thickness, to_string(), trackerHitRTTI::vector, and ecaldqm::zside().

2189  {
2190  //Each event to be treated as two events: an event in +ve endcap,
2191  //plus another event in -ve endcap. In this spirit there will be
2192  //a layer variable (layerid) that maps the layers in :
2193  //-z: 0->51
2194  //+z: 52->103
2195 
2196  //To keep track of total num of layer clusters per layer
2197  //tnlcpl[layerid]
2198  std::vector<int> tnlcpl(1000, 0); //tnlcpl.clear(); tnlcpl.reserve(1000);
2199 
2200  //To keep track of the total num of clusters per thickness in plus and in minus endcaps
2201  std::map<std::string, int> tnlcpthplus;
2202  tnlcpthplus.clear();
2203  std::map<std::string, int> tnlcpthminus;
2204  tnlcpthminus.clear();
2205  //At the beginning of the event all layers should be initialized to zero total clusters per thickness
2206  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2207  tnlcpthplus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
2208  tnlcpthminus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
2209  }
2210  //To keep track of the total num of clusters with mixed thickness hits per event
2211  tnlcpthplus.insert(std::pair<std::string, int>("mixed", 0));
2212  tnlcpthminus.insert(std::pair<std::string, int>("mixed", 0));
2213 
2215  clusterHandle,
2216  clusters,
2217  caloParticleHandle,
2218  cP,
2219  cPIndices,
2220  cPSelectedIndices,
2221  hitMap,
2222  layers,
2223  cpsInLayerClusterMap,
2224  cPOnLayerMap);
2225 
2226  //To find out the total amount of energy clustered per layer
2227  //Initialize with zeros because I see clear gives weird numbers.
2228  std::vector<double> tecpl(1000, 0.0); //tecpl.clear(); tecpl.reserve(1000);
2229  //for the longitudinal depth barycenter
2230  std::vector<double> ldbar(1000, 0.0); //ldbar.clear(); ldbar.reserve(1000);
2231 
2232  // Need to compare with the total amount of energy coming from CaloParticles
2233  double caloparteneplus = 0.;
2234  double caloparteneminus = 0.;
2235  for (const auto& cpId : cPIndices) {
2236  if (cP[cpId].eta() >= 0.) {
2237  caloparteneplus = caloparteneplus + cP[cpId].energy();
2238  } else if (cP[cpId].eta() < 0.) {
2239  caloparteneminus = caloparteneminus + cP[cpId].energy();
2240  }
2241  }
2242 
2243  // loop through clusters of the event
2244  for (const auto& lcId : clusters) {
2245  const auto seedid = lcId.seed();
2246  const double seedx = recHitTools_->getPosition(seedid).x();
2247  const double seedy = recHitTools_->getPosition(seedid).y();
2248  DetId maxid = findmaxhit(lcId, hitMap);
2249 
2250  // const DetId maxid = lcId.max();
2251  double maxx = recHitTools_->getPosition(maxid).x();
2252  double maxy = recHitTools_->getPosition(maxid).y();
2253 
2254  //Auxillary variables to count the number of different kind of hits in each cluster
2255  int nthhits120p = 0;
2256  int nthhits200p = 0;
2257  int nthhits300p = 0;
2258  int nthhitsscintp = 0;
2259  int nthhits120m = 0;
2260  int nthhits200m = 0;
2261  int nthhits300m = 0;
2262  int nthhitsscintm = 0;
2263  //For the hits thickness of the layer cluster.
2264  double thickness = 0.;
2265  //The layer the cluster belongs to. As mentioned in the mapping above, it takes into account -z and +z.
2266  int layerid = 0;
2267  // Need another layer variable for the longitudinal material budget file reading.
2268  //In this case need no distinction between -z and +z.
2269  int lay = 0;
2270  // Need to save the combination thick_lay
2271  std::string istr = "";
2272  //boolean to check for the layer that the cluster belong to. Maybe later will check all the layer hits.
2273  bool cluslay = true;
2274  //zside that the current cluster belongs to.
2275  int zside = 0;
2276 
2277  const auto& hits_and_fractions = lcId.hitsAndFractions();
2278  for (std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
2279  it_haf != hits_and_fractions.end();
2280  ++it_haf) {
2281  const DetId rh_detid = it_haf->first;
2282  //The layer that the current hit belongs to
2283  layerid = recHitTools_->getLayerWithOffset(rh_detid) + layers * ((recHitTools_->zside(rh_detid) + 1) >> 1) - 1;
2284  lay = recHitTools_->getLayerWithOffset(rh_detid);
2285  zside = recHitTools_->zside(rh_detid);
2286  if (rh_detid.det() == DetId::Forward || rh_detid.det() == DetId::HGCalEE || rh_detid.det() == DetId::HGCalHSi) {
2287  thickness = recHitTools_->getSiThickness(rh_detid);
2288  } else if (rh_detid.det() == DetId::HGCalHSc) {
2289  thickness = -1;
2290  } else {
2291  LogDebug("HGCalValidator") << "These are HGCal layer clusters, you shouldn't be here !!! " << layerid << "\n";
2292  continue;
2293  }
2294 
2295  //Count here only once the layer cluster and save the combination thick_layerid
2296  std::string curistr = std::to_string((int)thickness);
2297  std::string lay_string = std::to_string(layerid);
2298  while (lay_string.size() < 2)
2299  lay_string.insert(0, "0");
2300  curistr += "_" + lay_string;
2301  if (cluslay) {
2302  tnlcpl[layerid]++;
2303  istr = curistr;
2304  cluslay = false;
2305  }
2306 
2307  if ((thickness == 120.) && (recHitTools_->zside(rh_detid) > 0.)) {
2308  nthhits120p++;
2309  } else if ((thickness == 120.) && (recHitTools_->zside(rh_detid) < 0.)) {
2310  nthhits120m++;
2311  } else if ((thickness == 200.) && (recHitTools_->zside(rh_detid) > 0.)) {
2312  nthhits200p++;
2313  } else if ((thickness == 200.) && (recHitTools_->zside(rh_detid) < 0.)) {
2314  nthhits200m++;
2315  } else if ((thickness == 300.) && (recHitTools_->zside(rh_detid) > 0.)) {
2316  nthhits300p++;
2317  } else if ((thickness == 300.) && (recHitTools_->zside(rh_detid) < 0.)) {
2318  nthhits300m++;
2319  } else if ((thickness == -1) && (recHitTools_->zside(rh_detid) > 0.)) {
2320  nthhitsscintp++;
2321  } else if ((thickness == -1) && (recHitTools_->zside(rh_detid) < 0.)) {
2322  nthhitsscintm++;
2323  } else { //assert(0);
2324  LogDebug("HGCalValidator")
2325  << " You are running a geometry that contains thicknesses different than the normal ones. "
2326  << "\n";
2327  }
2328 
2329  std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2330  if (itcheck == hitMap.end()) {
2331  std::ostringstream st1;
2332  if ((rh_detid.det() == DetId::HGCalEE) || (rh_detid.det() == DetId::HGCalHSi)) {
2333  st1 << HGCSiliconDetId(rh_detid);
2334  } else if (rh_detid.det() == DetId::HGCalHSc) {
2335  st1 << HGCScintillatorDetId(rh_detid);
2336  } else {
2337  st1 << HFNoseDetId(rh_detid);
2338  }
2339  LogDebug("HGCalValidator") << " You shouldn't be here - Unable to find a hit " << rh_detid.rawId() << " "
2340  << rh_detid.det() << " " << st1.str() << "\n";
2341  continue;
2342  }
2343 
2344  const HGCRecHit* hit = itcheck->second;
2345 
2346  //Here for the per cell plots
2347  //----
2348  const double hit_x = recHitTools_->getPosition(rh_detid).x();
2349  const double hit_y = recHitTools_->getPosition(rh_detid).y();
2350  double distancetoseed = distance(seedx, seedy, hit_x, hit_y);
2351  double distancetomax = distance(maxx, maxy, hit_x, hit_y);
2352  if (distancetoseed != 0. && histograms.h_distancetoseedcell_perthickperlayer.count(curistr)) {
2353  histograms.h_distancetoseedcell_perthickperlayer.at(curistr)->Fill(distancetoseed);
2354  }
2355  //----
2356  if (distancetoseed != 0. && histograms.h_distancetoseedcell_perthickperlayer_eneweighted.count(curistr)) {
2357  histograms.h_distancetoseedcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetoseed, hit->energy());
2358  }
2359  //----
2360  if (distancetomax != 0. && histograms.h_distancetomaxcell_perthickperlayer.count(curistr)) {
2361  histograms.h_distancetomaxcell_perthickperlayer.at(curistr)->Fill(distancetomax);
2362  }
2363  //----
2364  if (distancetomax != 0. && histograms.h_distancetomaxcell_perthickperlayer_eneweighted.count(curistr)) {
2365  histograms.h_distancetomaxcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetomax, hit->energy());
2366  }
2367 
2368  } // end of loop through hits and fractions
2369 
2370  //Check for simultaneously having hits of different kind. Checking at least two combinations is sufficient.
2371  if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
2372  (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
2373  (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
2374  tnlcpthplus["mixed"]++;
2375  } else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
2376  //This is a cluster with hits of one kind
2377  tnlcpthplus[std::to_string((int)thickness)]++;
2378  }
2379  if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
2380  (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
2381  (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
2382  tnlcpthminus["mixed"]++;
2383  } else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
2384  //This is a cluster with hits of one kind
2385  tnlcpthminus[std::to_string((int)thickness)]++;
2386  }
2387 
2388  //To find the thickness with the biggest amount of cells
2389  std::vector<int> bigamoth;
2390  bigamoth.clear();
2391  if (zside > 0) {
2392  bigamoth.push_back(nthhits120p);
2393  bigamoth.push_back(nthhits200p);
2394  bigamoth.push_back(nthhits300p);
2395  bigamoth.push_back(nthhitsscintp);
2396  } else if (zside < 0) {
2397  bigamoth.push_back(nthhits120m);
2398  bigamoth.push_back(nthhits200m);
2399  bigamoth.push_back(nthhits300m);
2400  bigamoth.push_back(nthhitsscintm);
2401  }
2402  auto bgth = std::max_element(bigamoth.begin(), bigamoth.end());
2403  istr = std::to_string(thicknesses[std::distance(bigamoth.begin(), bgth)]);
2404  std::string lay_string = std::to_string(layerid);
2405  while (lay_string.size() < 2)
2406  lay_string.insert(0, "0");
2407  istr += "_" + lay_string;
2408 
2409  //Here for the per cluster plots that need the thickness_layer info
2410  if (histograms.h_cellsnum_perthickperlayer.count(istr)) {
2411  histograms.h_cellsnum_perthickperlayer.at(istr)->Fill(hits_and_fractions.size());
2412  }
2413 
2414  //Now, with the distance between seed and max cell.
2415  double distancebetseedandmax = distance(seedx, seedy, maxx, maxy);
2416  //The thickness_layer combination in this case will use the thickness of the seed as a convention.
2417  std::string seedstr = std::to_string((int)recHitTools_->getSiThickness(seedid)) + "_" + std::to_string(layerid);
2418  seedstr += "_" + lay_string;
2419  if (histograms.h_distancebetseedandmaxcell_perthickperlayer.count(seedstr)) {
2420  histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax);
2421  }
2422  const auto lc_en = lcId.energy();
2423  if (histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) {
2424  histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax,
2425  lc_en);
2426  }
2427 
2428  //Energy clustered per layer
2429  tecpl[layerid] = tecpl[layerid] + lc_en;
2430  ldbar[layerid] = ldbar[layerid] + lc_en * cummatbudg[(double)lay];
2431 
2432  } //end of loop through clusters of the event
2433 
2434  // First a couple of variables to keep the sum of the energy of all clusters
2435  double sumeneallcluspl = 0.;
2436  double sumeneallclusmi = 0.;
2437  // and the longitudinal variable
2438  double sumldbarpl = 0.;
2439  double sumldbarmi = 0.;
2440  //Per layer : Loop 0->103
2441  for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) {
2442  if (histograms.h_clusternum_perlayer.count(ilayer)) {
2443  histograms.h_clusternum_perlayer.at(ilayer)->Fill(tnlcpl[ilayer]);
2444  }
2445  // Two times one for plus and one for minus
2446  //First with the -z endcap
2447  if (ilayer < layers) {
2448  if (histograms.h_energyclustered_perlayer.count(ilayer)) {
2449  if (caloparteneminus != 0.) {
2450  histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneminus);
2451  }
2452  }
2453  //Keep here the total energy for the event in -z
2454  sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
2455  //And for the longitudinal variable
2456  sumldbarmi = sumldbarmi + ldbar[ilayer];
2457  } else { //Then for the +z
2458  if (histograms.h_energyclustered_perlayer.count(ilayer)) {
2459  if (caloparteneplus != 0.) {
2460  histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneplus);
2461  }
2462  }
2463  //Keep here the total energy for the event in -z
2464  sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
2465  //And for the longitudinal variable
2466  sumldbarpl = sumldbarpl + ldbar[ilayer];
2467  } //end of +z loop
2468 
2469  } //end of loop over layers
2470 
2471  //Per thickness
2472  for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2473  if (histograms.h_clusternum_perthick.count(*it)) {
2474  histograms.h_clusternum_perthick.at(*it)->Fill(tnlcpthplus[std::to_string(*it)]);
2475  histograms.h_clusternum_perthick.at(*it)->Fill(tnlcpthminus[std::to_string(*it)]);
2476  }
2477  }
2478  //Mixed thickness clusters
2479  histograms.h_mixedhitscluster_zplus[count]->Fill(tnlcpthplus["mixed"]);
2480  histograms.h_mixedhitscluster_zminus[count]->Fill(tnlcpthminus["mixed"]);
2481 
2482  //Total energy clustered from all layer clusters (fraction)
2483  if (caloparteneplus != 0.) {
2484  histograms.h_energyclustered_zplus[count]->Fill(100. * sumeneallcluspl / caloparteneplus);
2485  }
2486  if (caloparteneminus != 0.) {
2487  histograms.h_energyclustered_zminus[count]->Fill(100. * sumeneallclusmi / caloparteneminus);
2488  }
2489 
2490  //For the longitudinal depth barycenter
2491  histograms.h_longdepthbarycentre_zplus[count]->Fill(sumldbarpl / sumeneallcluspl);
2492  histograms.h_longdepthbarycentre_zminus[count]->Fill(sumldbarmi / sumeneallclusmi);
2493 }
int zside(DetId const &)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
static std::string to_string(const XMLCh *ch)
DetId findmaxhit(const reco::CaloCluster &cluster, std::unordered_map< DetId, const HGCRecHit *> const &) const
Definition: DetId.h:17
std::shared_ptr< hgcal::RecHitTools > recHitTools_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void layerClusters_to_CaloParticles(const Histograms &histograms, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
double distance(const double x1, const double y1, const double x2, const double y2) const
#define LogDebug(id)

◆ fill_info_histos()

void HGVHistoProducerAlgo::fill_info_histos ( const Histograms histograms,
unsigned int  layers 
) const

Definition at line 1427 of file HGVHistoProducerAlgo.cc.

References hgcalTBTopologyTester_cfi::layers, and recHitTools_.

1427  {
1428  // Save some info straight from geometry to avoid mistakes from updates
1429  //----------- TODO ----------------------------------------------------------
1430  // For now values returned for 'lastLayerFHzp': '104', 'lastLayerFHzm': '52' are not the one expected.
1431  // Will come back to this when there will be info in CMSSW to put in DQM file.
1432  histograms.lastLayerEEzm->Fill(recHitTools_->lastLayerEE());
1433  histograms.lastLayerFHzm->Fill(recHitTools_->lastLayerFH());
1434  histograms.maxlayerzm->Fill(layers);
1435  histograms.lastLayerEEzp->Fill(recHitTools_->lastLayerEE() + layers);
1436  histograms.lastLayerFHzp->Fill(recHitTools_->lastLayerFH() + layers);
1437  histograms.maxlayerzp->Fill(layers + layers);
1438 }
std::shared_ptr< hgcal::RecHitTools > recHitTools_

◆ fill_simCluster_histos()

void HGVHistoProducerAlgo::fill_simCluster_histos ( const Histograms histograms,
std::vector< SimCluster > const &  simClusters,
unsigned int  layers,
std::vector< int >  thicknesses 
) const

◆ fill_simClusterAssociation_histos()

void HGVHistoProducerAlgo::fill_simClusterAssociation_histos ( const Histograms histograms,
const int  count,
edm::Handle< reco::CaloClusterCollection clusterHandle,
const reco::CaloClusterCollection clusters,
edm::Handle< std::vector< SimCluster >>  simClusterHandle,
std::vector< SimCluster > const &  simClusters,
std::vector< size_t > const &  sCIndices,
const std::vector< float > &  mask,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap,
unsigned int  layers,
const hgcal::RecoToSimCollectionWithSimClusters recSimColl,
const hgcal::SimToRecoCollectionWithSimClusters simRecColl 
) const

◆ fill_trackster_histos()

void HGVHistoProducerAlgo::fill_trackster_histos ( const Histograms histograms,
const int  count,
const ticl::TracksterCollection Tracksters,
const reco::CaloClusterCollection layerClusters,
const ticl::TracksterCollection simTS,
const ticl::TracksterCollection simTS_fromCP,
std::map< uint, std::vector< uint >> const &  simTrackstersMap,
std::vector< SimCluster > const &  sC,
const edm::ProductID cPHandle_id,
std::vector< CaloParticle > const &  cP,
std::vector< size_t > const &  cPIndices,
std::vector< size_t > const &  cPSelectedIndices,
std::unordered_map< DetId, const HGCRecHit *> const &  ,
unsigned int  layers 
) const

Definition at line 3309 of file HGVHistoProducerAlgo.cc.

References submitPVResolutionJobs::count, hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, hgcalTBTopologyTester_cfi::layers, Linking, recHitTools_, and tracksters_to_SimTracksters().

3323  {
3324  //Each event to be treated as two events:
3325  //an event in +ve endcap, plus another event in -ve endcap.
3326 
3327  //To keep track of total num of Tracksters
3328  int totNTstZm = 0; //-z
3329  int totNTstZp = 0; //+z
3330  //To count the number of Tracksters with 3 contiguous layers per event.
3331  int totNContTstZp = 0; //+z
3332  int totNContTstZm = 0; //-z
3333  //For the number of Tracksters without 3 contiguous layers per event.
3334  int totNNotContTstZp = 0; //+z
3335  int totNNotContTstZm = 0; //-z
3336  // Check below the score of cont and non cont Tracksters
3337  std::vector<bool> contTracksters;
3338  contTracksters.clear();
3339 
3340  //[tstId]-> vector of 2d layer clusters size
3341  std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity;
3342  //[tstId]-> [layer][cluster size]
3343  std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer;
3344  //We will need for the scale text option
3345  // unsigned int totalLcInTsts = 0;
3346  // for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3347  // totalLcInTsts = totalLcInTsts + tracksters[tstId].vertices().size();
3348  // }
3349 
3350  const auto nTracksters = tracksters.size();
3351  // loop through Tracksters
3352  for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3353  const auto& tst = tracksters[tstId];
3354  if (tst.vertices().empty())
3355  continue;
3356 
3357  if (tst.barycenter().z() < 0.)
3358  totNTstZm++;
3359  else if (tst.barycenter().z() > 0.)
3360  totNTstZp++;
3361 
3362  //Total number of layer clusters in Trackster
3363  int tnLcInTst = 0;
3364 
3365  //To keep track of total num of layer clusters per Trackster
3366  //tnLcInTstperlaypz[layerid], tnLcInTstperlaymz[layerid]
3367  std::vector<int> tnLcInTstperlay(1000, 0); //+z
3368 
3369  //For the layers the Trackster expands to. Will use a set because there would be many
3370  //duplicates and then go back to vector for random access, since they say it is faster.
3371  std::set<unsigned int> trackster_layers;
3372 
3373  bool tracksterInZplus = false;
3374  bool tracksterInZminus = false;
3375 
3376  //Loop through layer clusters
3377  for (const auto lcId : tst.vertices()) {
3378  //take the hits and their fraction of the specific layer cluster.
3379  const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions();
3380 
3381  //For the multiplicity of the 2d layer clusters in Tracksters
3382  multiplicity[tstId].emplace_back(hits_and_fractions.size());
3383 
3384  const auto firstHitDetId = hits_and_fractions[0].first;
3385  //The layer that the layer cluster belongs to
3386  const auto layerid = recHitTools_->getLayerWithOffset(firstHitDetId) +
3387  layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
3388  trackster_layers.insert(layerid);
3389  multiplicity_vs_layer[tstId].emplace_back(layerid);
3390 
3391  tnLcInTstperlay[layerid]++;
3392  tnLcInTst++;
3393 
3394  if (recHitTools_->zside(firstHitDetId) > 0.)
3395  tracksterInZplus = true;
3396  else if (recHitTools_->zside(firstHitDetId) < 0.)
3397  tracksterInZminus = true;
3398  } // end of loop through layerClusters
3399 
3400  // Per layer : Loop 0->99
3401  for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) {
3402  if (histograms.h_clusternum_in_trackster_perlayer[count].count(ilayer) && tnLcInTstperlay[ilayer] != 0) {
3403  histograms.h_clusternum_in_trackster_perlayer[count].at(ilayer)->Fill((float)tnLcInTstperlay[ilayer]);
3404  }
3405  // For the profile now of 2d layer cluster in Tracksters vs layer number.
3406  if (tnLcInTstperlay[ilayer] != 0) {
3407  histograms.h_clusternum_in_trackster_vs_layer[count]->Fill((float)ilayer, (float)tnLcInTstperlay[ilayer]);
3408  }
3409  } // end of loop over layers
3410 
3411  // Looking for Tracksters with 3 contiguous layers per event.
3412  std::vector<int> trackster_layers_vec(trackster_layers.begin(), trackster_layers.end());
3413  // Check also for non contiguous Tracksters
3414  bool contiTrackster = false;
3415  // Start from 1 and go up to size - 1 element.
3416  if (trackster_layers_vec.size() >= 3) {
3417  for (unsigned int iLayer = 1; iLayer < trackster_layers_vec.size() - 1; ++iLayer) {
3418  if ((trackster_layers_vec[iLayer - 1] + 1 == trackster_layers_vec[iLayer]) &&
3419  (trackster_layers_vec[iLayer + 1] - 1 == trackster_layers_vec[iLayer])) {
3420  // Trackster with 3 contiguous layers per event
3421  if (tracksterInZplus)
3422  totNContTstZp++;
3423  else if (tracksterInZminus)
3424  totNContTstZm++;
3425 
3426  contiTrackster = true;
3427  break;
3428  }
3429  }
3430  }
3431  // Count non contiguous Tracksters
3432  if (!contiTrackster) {
3433  if (tracksterInZplus)
3434  totNNotContTstZp++;
3435  else if (tracksterInZminus)
3436  totNNotContTstZm++;
3437  }
3438 
3439  // Save for the score
3440  contTracksters.push_back(contiTrackster);
3441 
3442  histograms.h_clusternum_in_trackster[count]->Fill(tnLcInTst);
3443 
3444  for (unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) {
3445  //multiplicity of the current LC
3446  float mlp = std::count(std::begin(multiplicity[tstId]), std::end(multiplicity[tstId]), multiplicity[tstId][lc]);
3447  //LogDebug("HGCalValidator") << "mlp %" << (100. * mlp)/ ((float) nLayerClusters) << std::endl;
3448  // histograms.h_multiplicityOfLCinTST[count]->Fill( mlp , multiplicity[tstId][lc] , 100. / (float) totalLcInTsts );
3449  histograms.h_multiplicityOfLCinTST[count]->Fill(mlp, multiplicity[tstId][lc]);
3450  //When plotting with the text option we want the entries to be the same
3451  //as the % of the current cell over the whole number of layerClusters. For this we need an extra histo.
3452  histograms.h_multiplicity_numberOfEventsHistogram[count]->Fill(mlp);
3453  //For the cluster multiplicity vs layer
3454  //First with the -z endcap (V10:0->49)
3455  if (multiplicity_vs_layer[tstId][lc] < layers) {
3456  histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus[count]->Fill(mlp, multiplicity_vs_layer[tstId][lc]);
3457  histograms.h_multiplicity_zminus_numberOfEventsHistogram[count]->Fill(mlp);
3458  } else { //Then for the +z (V10:50->99)
3459  histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus[count]->Fill(
3460  mlp, multiplicity_vs_layer[tstId][lc] - layers);
3461  histograms.h_multiplicity_zplus_numberOfEventsHistogram[count]->Fill(mlp);
3462  }
3463  //For the cluster multiplicity vs cluster energy
3464  histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[count]->Fill(mlp,
3465  layerClusters[tst.vertices(lc)].energy());
3466  }
3467 
3468  if (!trackster_layers.empty()) {
3469  histograms.h_trackster_x[count]->Fill(tst.barycenter().x());
3470  histograms.h_trackster_y[count]->Fill(tst.barycenter().y());
3471  histograms.h_trackster_z[count]->Fill(tst.barycenter().z());
3472  histograms.h_trackster_eta[count]->Fill(tst.barycenter().eta());
3473  histograms.h_trackster_phi[count]->Fill(tst.barycenter().phi());
3474 
3475  histograms.h_trackster_firstlayer[count]->Fill((float)*trackster_layers.begin());
3476  histograms.h_trackster_lastlayer[count]->Fill((float)*trackster_layers.rbegin());
3477  histograms.h_trackster_layersnum[count]->Fill((float)trackster_layers.size());
3478 
3479  histograms.h_trackster_pt[count]->Fill(tst.raw_pt());
3480  histograms.h_trackster_energy[count]->Fill(tst.raw_energy());
3481  }
3482 
3483  } //end of loop through Tracksters
3484 
3485  histograms.h_tracksternum[count]->Fill(totNTstZm + totNTstZp);
3486  histograms.h_conttracksternum[count]->Fill(totNContTstZp + totNContTstZm);
3487  histograms.h_nonconttracksternum[count]->Fill(totNNotContTstZp + totNNotContTstZm);
3488 
3489  // CaloParticle
3491  count,
3492  tracksters,
3493  layerClusters,
3494  simTSs_fromCP,
3495  Linking,
3496  simTSs_fromCP,
3497  cpToSc_SimTrackstersMap,
3498  sC,
3499  cPHandle_id,
3500  cP,
3501  cPIndices,
3502  cPSelectedIndices,
3503  hitMap,
3504  layers);
3505 
3506  // Pattern recognition
3508  count,
3509  tracksters,
3510  layerClusters,
3511  simTSs,
3513  simTSs_fromCP,
3514  cpToSc_SimTrackstersMap,
3515  sC,
3516  cPHandle_id,
3517  cP,
3518  cPIndices,
3519  cPSelectedIndices,
3520  hitMap,
3521  layers);
3522 }
std::shared_ptr< hgcal::RecHitTools > recHitTools_
void tracksters_to_SimTracksters(const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const validationType valType, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const

◆ findmaxhit()

DetId HGVHistoProducerAlgo::findmaxhit ( const reco::CaloCluster cluster,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap 
) const

Definition at line 3543 of file HGVHistoProducerAlgo.cc.

References reco::CaloCluster::hitsAndFractions(), and trackerHitRTTI::vector.

Referenced by fill_generic_cluster_histos().

3544  {
3545  const auto& hits_and_fractions = cluster.hitsAndFractions();
3546 
3547  DetId themaxid;
3548  double maxene = 0.;
3549  for (std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
3550  it_haf != hits_and_fractions.end();
3551  ++it_haf) {
3552  const DetId rh_detid = it_haf->first;
3553  const auto hitEn = hitMap.find(rh_detid)->second->energy();
3554 
3555  if (maxene < hitEn) {
3556  maxene = hitEn;
3557  themaxid = rh_detid;
3558  }
3559  }
3560 
3561  return themaxid;
3562 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:209
Definition: DetId.h:17

◆ getEta()

double HGVHistoProducerAlgo::getEta ( double  eta) const
private

Definition at line 3564 of file HGVHistoProducerAlgo.cc.

References PVValHelper::eta, and useFabsEta_.

Referenced by fill_caloparticle_histos(), and fill_cluster_histos().

3564  {
3565  if (useFabsEta_)
3566  return fabs(eta);
3567  else
3568  return eta;
3569 }

◆ layerClusters_to_CaloParticles()

void HGVHistoProducerAlgo::layerClusters_to_CaloParticles ( const Histograms histograms,
edm::Handle< reco::CaloClusterCollection clusterHandle,
const reco::CaloClusterCollection clusters,
edm::Handle< std::vector< CaloParticle >>  caloParticleHandle,
std::vector< CaloParticle > const &  cP,
std::vector< size_t > const &  cPIndices,
std::vector< size_t > const &  cPSelectedIndices,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap,
unsigned int  layers,
const hgcal::RecoToSimCollection recSimColl,
const hgcal::SimToRecoCollection simRecColl 
) const

Definition at line 1739 of file HGVHistoProducerAlgo.cc.

References trackingPlots::assoc, bsc_activity_cfg::clusters, edm::AssociationMap< Tag >::end(), mps_fire::end, PVValHelper::eta, spr::find(), edm::AssociationMap< Tag >::find(), dqmdumpme::first, h, hgcalTBTopologyTester_cfi::layers, LogDebug, getGTfromDQMFile::obj, AlCaHLTBitMon_ParallelJobs::p, phi, recHitTools_, ScoreCutCPtoLC_, and ScoreCutLCtoCP_.

Referenced by fill_generic_cluster_histos().

1749  {
1750  const auto nLayerClusters = clusters.size();
1751 
1752  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
1753  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map;
1754 
1755  // The association has to be done in an all-vs-all fashion.
1756  // For this reason use the full set of CaloParticles, with the only filter on bx
1757  for (const auto& cpId : cPIndices) {
1758  for (const auto& simCluster : cP[cpId].simClusters()) {
1759  for (const auto& it_haf : simCluster->hits_and_fractions()) {
1760  const DetId hitid = (it_haf.first);
1761  if (hitMap.find(hitid) != hitMap.end()) {
1762  if (detIdToCaloParticleId_Map.find(hitid) == detIdToCaloParticleId_Map.end()) {
1763  detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1764  detIdToCaloParticleId_Map[hitid].emplace_back(
1765  HGVHistoProducerAlgo::detIdInfoInCluster{cpId, it_haf.second});
1766  } else {
1767  auto findHitIt =
1768  std::find(detIdToCaloParticleId_Map[hitid].begin(),
1769  detIdToCaloParticleId_Map[hitid].end(),
1771  cpId, 0.f}); // only the first element is used for the matching (overloaded operator==)
1772  if (findHitIt != detIdToCaloParticleId_Map[hitid].end())
1773  findHitIt->fraction += it_haf.second;
1774  else
1775  detIdToCaloParticleId_Map[hitid].emplace_back(
1776  HGVHistoProducerAlgo::detIdInfoInCluster{cpId, it_haf.second});
1777  }
1778  }
1779  }
1780  }
1781  }
1782 
1783  for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1784  const auto& hits_and_fractions = clusters[lcId].hitsAndFractions();
1785  const auto numberOfHitsInLC = hits_and_fractions.size();
1786 
1787  // This vector will store, for each hit in the Layercluster, the index of
1788  // the CaloParticle that contributed the most, in terms of energy, to it.
1789  // Special values are:
1790  //
1791  // -2 --> the reconstruction fraction of the RecHit is 0 (used in the past to monitor Halo Hits)
1792  // -3 --> same as before with the added condition that no CaloParticle has been linked to this RecHit
1793  // -1 --> the reco fraction is >0, but no CaloParticle has been linked to it
1794  // >=0 --> index of the linked CaloParticle
1795  std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
1796  const auto firstHitDetId = hits_and_fractions[0].first;
1797  int lcLayerId =
1798  recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
1799 
1800  // This will store the fraction of the CaloParticle energy shared with the LayerCluster: e_shared/cp_energy
1801  std::unordered_map<unsigned, float> CPEnergyInLC;
1802 
1803  for (unsigned int iHit = 0; iHit < numberOfHitsInLC; iHit++) {
1804  const DetId rh_detid = hits_and_fractions[iHit].first;
1805  const auto rhFraction = hits_and_fractions[iHit].second;
1806 
1807  std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1808  const HGCRecHit* hit = itcheck->second;
1809 
1810  if (detIdToLayerClusterId_Map.find(rh_detid) == detIdToLayerClusterId_Map.end()) {
1811  detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1812  }
1813  detIdToLayerClusterId_Map[rh_detid].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{lcId, rhFraction});
1814 
1815  const auto& hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1816 
1817  // if the fraction is zero or the hit does not belong to any calo
1818  // particle, set the caloparticleId for the hit to -1 this will
1819  // contribute to the number of noise hits
1820 
1821  // MR Remove the case in which the fraction is 0, since this could be a
1822  // real hit that has been marked as halo.
1823  if (rhFraction == 0.) {
1824  hitsToCaloParticleId[iHit] = -2;
1825  }
1826  if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
1827  hitsToCaloParticleId[iHit] -= 1;
1828  } else {
1829  auto maxCPEnergyInLC = 0.f;
1830  auto maxCPId = -1;
1831  for (auto& h : hit_find_in_CP->second) {
1832  const auto iCP = h.clusterId;
1833  CPEnergyInLC[iCP] += h.fraction * hit->energy();
1834  // Keep track of which CaloParticle contributed the most, in terms
1835  // of energy, to this specific LayerCluster.
1836  if (CPEnergyInLC[iCP] > maxCPEnergyInLC) {
1837  maxCPEnergyInLC = CPEnergyInLC[iCP];
1838  maxCPId = iCP;
1839  }
1840  }
1841  hitsToCaloParticleId[iHit] = maxCPId;
1842  }
1843  histograms.h_cellAssociation_perlayer.at(lcLayerId)->Fill(
1844  hitsToCaloParticleId[iHit] > 0. ? 0. : hitsToCaloParticleId[iHit]);
1845  } // End loop over hits on a LayerCluster
1846 
1847  } // End of loop over LayerClusters
1848 
1849  // Fill the plots to compute the different metrics linked to
1850  // reco-level, namely fake-rate an merge-rate. In this loop should *not*
1851  // restrict only to the selected caloParaticles.
1852  for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1853  const auto firstHitDetId = (clusters[lcId].hitsAndFractions())[0].first;
1854  const int lcLayerId =
1855  recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
1856  histograms.h_denom_layercl_eta_perlayer.at(lcLayerId)->Fill(clusters[lcId].eta());
1857  histograms.h_denom_layercl_phi_perlayer.at(lcLayerId)->Fill(clusters[lcId].phi());
1858  //
1859  const edm::Ref<reco::CaloClusterCollection> lcRef(clusterHandle, lcId);
1860  const auto& cpsIt = cpsInLayerClusterMap.find(lcRef);
1861  if (cpsIt == cpsInLayerClusterMap.end())
1862  continue;
1863 
1864  const auto lc_en = clusters[lcId].energy();
1865  const auto& cps = cpsIt->val;
1866  if (lc_en == 0. && !cps.empty()) {
1867  for (const auto& cpPair : cps)
1868  histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1869  continue;
1870  }
1871  for (const auto& cpPair : cps) {
1872  LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId << "\t CP id: \t" << cpPair.first.index()
1873  << "\t score \t" << cpPair.second << std::endl;
1874  histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1875  auto const& cp_linked =
1876  std::find_if(std::begin(cPOnLayerMap[cpPair.first]),
1877  std::end(cPOnLayerMap[cpPair.first]),
1878  [&lcRef](const std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>& p) {
1879  return p.first == lcRef;
1880  });
1881  if (cp_linked ==
1882  cPOnLayerMap[cpPair.first].end()) // This should never happen by construction of the association maps
1883  continue;
1884  histograms.h_sharedenergy_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cp_linked->second.first / lc_en,
1885  lc_en);
1886  histograms.h_energy_vs_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second,
1887  cp_linked->second.first / lc_en);
1888  }
1889  const auto assoc =
1890  std::count_if(std::begin(cps), std::end(cps), [](const auto& obj) { return obj.second < ScoreCutLCtoCP_; });
1891  if (assoc) {
1892  histograms.h_num_layercl_eta_perlayer.at(lcLayerId)->Fill(clusters[lcId].eta());
1893  histograms.h_num_layercl_phi_perlayer.at(lcLayerId)->Fill(clusters[lcId].phi());
1894  if (assoc > 1) {
1895  histograms.h_numMerge_layercl_eta_perlayer.at(lcLayerId)->Fill(clusters[lcId].eta());
1896  histograms.h_numMerge_layercl_phi_perlayer.at(lcLayerId)->Fill(clusters[lcId].phi());
1897  }
1898  const auto& best = std::min_element(
1899  std::begin(cps), std::end(cps), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; });
1900  const auto& best_cp_linked =
1901  std::find_if(std::begin(cPOnLayerMap[best->first]),
1902  std::end(cPOnLayerMap[best->first]),
1903  [&lcRef](const std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>& p) {
1904  return p.first == lcRef;
1905  });
1906  if (best_cp_linked ==
1907  cPOnLayerMap[best->first].end()) // This should never happen by construction of the association maps
1908  continue;
1909  histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer.at(lcLayerId)->Fill(
1910  clusters[lcId].eta(), best_cp_linked->second.first / lc_en);
1911  histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer.at(lcLayerId)->Fill(
1912  clusters[lcId].phi(), best_cp_linked->second.first / lc_en);
1913  }
1914  } // End of loop over LayerClusters
1915 
1916  // Here Fill the plots to compute the different metrics linked to
1917  // gen-level, namely efficiency and duplicate. In this loop should restrict
1918  // only to the selected caloParaticles.
1919  for (const auto& cpId : cPSelectedIndices) {
1920  const edm::Ref<CaloParticleCollection> cpRef(caloParticleHandle, cpId);
1921  const auto& lcsIt = cPOnLayerMap.find(cpRef);
1922 
1923  std::map<unsigned int, float> cPEnergyOnLayer;
1924  for (unsigned int layerId = 0; layerId < layers * 2; ++layerId)
1925  cPEnergyOnLayer[layerId] = 0;
1926 
1927  for (const auto& simCluster : cP[cpId].simClusters()) {
1928  for (const auto& it_haf : simCluster->hits_and_fractions()) {
1929  const DetId hitid = (it_haf.first);
1930  const auto hitLayerId =
1931  recHitTools_->getLayerWithOffset(hitid) + layers * ((recHitTools_->zside(hitid) + 1) >> 1) - 1;
1932  std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1933  if (itcheck != hitMap.end()) {
1934  const HGCRecHit* hit = itcheck->second;
1935  cPEnergyOnLayer[hitLayerId] += it_haf.second * hit->energy();
1936  }
1937  }
1938  }
1939 
1940  for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) {
1941  if (!cPEnergyOnLayer[layerId])
1942  continue;
1943 
1944  histograms.h_denom_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().eta());
1945  histograms.h_denom_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().phi());
1946 
1947  if (lcsIt == cPOnLayerMap.end())
1948  continue;
1949  const auto& lcs = lcsIt->val;
1950 
1951  auto getLCLayerId = [&](const unsigned int lcId) {
1952  const auto firstHitDetId = (clusters[lcId].hitsAndFractions())[0].first;
1953  const auto lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) +
1954  layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
1955  return lcLayerId;
1956  };
1957 
1958  for (const auto& lcPair : lcs) {
1959  if (getLCLayerId(lcPair.first.index()) != layerId)
1960  continue;
1961  histograms.h_score_caloparticle2layercl_perlayer.at(layerId)->Fill(lcPair.second.second);
1962  histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId)->Fill(
1963  lcPair.second.first / cPEnergyOnLayer[layerId], cPEnergyOnLayer[layerId]);
1964  histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId)->Fill(
1965  lcPair.second.second, lcPair.second.first / cPEnergyOnLayer[layerId]);
1966  }
1967  const auto assoc = std::count_if(std::begin(lcs), std::end(lcs), [&](const auto& obj) {
1968  if (getLCLayerId(obj.first.index()) != layerId)
1969  return false;
1970  else
1971  return obj.second.second < ScoreCutCPtoLC_;
1972  });
1973  if (assoc) {
1974  histograms.h_num_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().eta());
1975  histograms.h_num_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().phi());
1976  if (assoc > 1) {
1977  histograms.h_numDup_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().eta());
1978  histograms.h_numDup_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().phi());
1979  }
1980  const auto best = std::min_element(std::begin(lcs), std::end(lcs), [&](const auto& obj1, const auto& obj2) {
1981  if (getLCLayerId(obj1.first.index()) != layerId)
1982  return false;
1983  else if (getLCLayerId(obj2.first.index()) == layerId)
1984  return obj1.second.second < obj2.second.second;
1985  else
1986  return true;
1987  });
1988  histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId)->Fill(
1989  cP[cpId].g4Tracks()[0].momentum().eta(), best->second.first / cPEnergyOnLayer[layerId]);
1990  histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId)->Fill(
1991  cP[cpId].g4Tracks()[0].momentum().phi(), best->second.first / cPEnergyOnLayer[layerId]);
1992  }
1993  }
1994  }
1995 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const double ScoreCutLCtoCP_
Definition: DetId.h:17
std::shared_ptr< hgcal::RecHitTools > recHitTools_
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
const double ScoreCutCPtoLC_
#define LogDebug(id)

◆ layerClusters_to_SimClusters()

void HGVHistoProducerAlgo::layerClusters_to_SimClusters ( const Histograms histograms,
const int  count,
edm::Handle< reco::CaloClusterCollection clusterHandle,
const reco::CaloClusterCollection clusters,
edm::Handle< std::vector< SimCluster >>  simClusterHandle,
std::vector< SimCluster > const &  simClusters,
std::vector< size_t > const &  sCIndices,
const std::vector< float > &  mask,
std::unordered_map< DetId, const HGCRecHit *> const &  hitMap,
unsigned int  layers,
const hgcal::RecoToSimCollectionWithSimClusters recSimColl,
const hgcal::SimToRecoCollectionWithSimClusters simRecColl 
) const

Definition at line 1997 of file HGVHistoProducerAlgo.cc.

References trackingPlots::assoc, bsc_activity_cfg::clusters, submitPVResolutionJobs::count, edm::AssociationMap< Tag >::end(), PVValHelper::eta, edm::AssociationMap< Tag >::find(), dqmdumpme::first, hgcalTBTopologyTester_cfi::layers, LogDebug, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, getGTfromDQMFile::obj, AlCaHLTBitMon_ParallelJobs::p, phi, recHitTools_, ScoreCutLCtoSC_, and ScoreCutSCtoLC_.

2009  {
2010  // Here fill the plots to compute the different metrics linked to
2011  // reco-level, namely fake-rate and merge-rate. In this loop should *not*
2012  // restrict only to the selected SimClusters.
2013  for (unsigned int lcId = 0; lcId < clusters.size(); ++lcId) {
2014  if (mask[lcId] != 0.) {
2015  LogDebug("HGCalValidator") << "Skipping layer cluster " << lcId << " not belonging to mask" << std::endl;
2016  continue;
2017  }
2018  const auto firstHitDetId = (clusters[lcId].hitsAndFractions())[0].first;
2019  const auto lcLayerId =
2020  recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
2021  //Although the ones below are already created in the LC to CP association, will
2022  //recreate them here since in the post processor it looks in a specific directory.
2023  histograms.h_denom_layercl_in_simcl_eta_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].eta());
2024  histograms.h_denom_layercl_in_simcl_phi_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].phi());
2025  //
2026  const edm::Ref<reco::CaloClusterCollection> lcRef(clusterHandle, lcId);
2027  const auto& scsIt = scsInLayerClusterMap.find(lcRef);
2028  if (scsIt == scsInLayerClusterMap.end())
2029  continue;
2030 
2031  const auto lc_en = clusters[lcId].energy();
2032  const auto& scs = scsIt->val;
2033  // If a reconstructed LayerCluster has energy 0 but is linked to at least a
2034  // SimCluster, then his score should be 1 as set in the associator
2035  if (lc_en == 0. && !scs.empty()) {
2036  for (const auto& scPair : scs) {
2037  histograms.h_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(scPair.second);
2038  }
2039  continue;
2040  }
2041  //Loop through all SimClusters linked to the layer cluster under study
2042  for (const auto& scPair : scs) {
2043  LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId << "\t SC id: \t" << scPair.first.index()
2044  << "\t score \t" << scPair.second << std::endl;
2045  //This should be filled #layerClusters in layer x #linked SimClusters
2046  histograms.h_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(scPair.second);
2047  auto const& sc_linked =
2048  std::find_if(std::begin(lcsInSimClusterMap[scPair.first]),
2049  std::end(lcsInSimClusterMap[scPair.first]),
2050  [&lcRef](const std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>& p) {
2051  return p.first == lcRef;
2052  });
2053  if (sc_linked ==
2054  lcsInSimClusterMap[scPair.first].end()) // This should never happen by construction of the association maps
2055  continue;
2056  histograms.h_sharedenergy_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(sc_linked->second.first / lc_en,
2057  lc_en);
2058  histograms.h_energy_vs_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(
2059  scPair.second, sc_linked->second.first / lc_en);
2060  }
2061  //Here he counts how many of the linked SimClusters of the layer cluster under study have a score above a certain value.
2062  const auto assoc =
2063  std::count_if(std::begin(scs), std::end(scs), [](const auto& obj) { return obj.second < ScoreCutLCtoSC_; });
2064  if (assoc) {
2065  histograms.h_num_layercl_in_simcl_eta_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].eta());
2066  histograms.h_num_layercl_in_simcl_phi_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].phi());
2067  if (assoc > 1) {
2068  histograms.h_numMerge_layercl_in_simcl_eta_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].eta());
2069  histograms.h_numMerge_layercl_in_simcl_phi_perlayer[count].at(lcLayerId)->Fill(clusters[lcId].phi());
2070  }
2071  const auto& best = std::min_element(
2072  std::begin(scs), std::end(scs), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; });
2073  //From all SimClusters he founds the one with the best (lowest) score and takes his scId
2074  const auto& best_sc_linked =
2075  std::find_if(std::begin(lcsInSimClusterMap[best->first]),
2076  std::end(lcsInSimClusterMap[best->first]),
2077  [&lcRef](const std::pair<edm::Ref<reco::CaloClusterCollection>, std::pair<float, float>>& p) {
2078  return p.first == lcRef;
2079  });
2080  if (best_sc_linked ==
2081  lcsInSimClusterMap[best->first].end()) // This should never happen by construction of the association maps
2082  continue;
2083  histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer[count].at(lcLayerId)->Fill(
2084  clusters[lcId].eta(), best_sc_linked->second.first / lc_en);
2085  histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer[count].at(lcLayerId)->Fill(
2086  clusters[lcId].phi(), best_sc_linked->second.first / lc_en);
2087  }
2088  } // End of loop over LayerClusters
2089 
2090  // Fill the plots to compute the different metrics linked to
2091  // gen-level, namely efficiency and duplicate. In this loop should restrict
2092  // only to the selected SimClusters.
2093  for (const auto& scId : sCIndices) {
2094  const edm::Ref<SimClusterCollection> scRef(simClusterHandle, scId);
2095  const auto& lcsIt = lcsInSimClusterMap.find(scRef);
2096 
2097  std::map<unsigned int, float> sCEnergyOnLayer;
2098  for (unsigned int layerId = 0; layerId < layers * 2; ++layerId)
2099  sCEnergyOnLayer[layerId] = 0;
2100 
2101  for (const auto& it_haf : sC[scId].hits_and_fractions()) {
2102  const DetId hitid = (it_haf.first);
2103  const auto scLayerId =
2104  recHitTools_->getLayerWithOffset(hitid) + layers * ((recHitTools_->zside(hitid) + 1) >> 1) - 1;
2105  std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
2106  if (itcheck != hitMap.end()) {
2107  const HGCRecHit* hit = itcheck->second;
2108  sCEnergyOnLayer[scLayerId] += it_haf.second * hit->energy();
2109  }
2110  }
2111 
2112  for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) {
2113  if (!sCEnergyOnLayer[layerId])
2114  continue;
2115 
2116  histograms.h_denom_simcluster_eta_perlayer[count].at(layerId)->Fill(sC[scId].eta());
2117  histograms.h_denom_simcluster_phi_perlayer[count].at(layerId)->Fill(sC[scId].phi());
2118 
2119  if (lcsIt == lcsInSimClusterMap.end())
2120  continue;
2121  const auto& lcs = lcsIt->val;
2122 
2123  auto getLCLayerId = [&](const unsigned int lcId) {
2124  const auto firstHitDetId = (clusters[lcId].hitsAndFractions())[0].first;
2125  const unsigned int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) +
2126  layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
2127  return lcLayerId;
2128  };
2129 
2130  //Loop through layer clusters linked to the SimCluster under study
2131  for (const auto& lcPair : lcs) {
2132  auto lcId = lcPair.first.index();
2133  if (mask[lcId] != 0.) {
2134  LogDebug("HGCalValidator") << "Skipping layer cluster " << lcId << " not belonging to mask" << std::endl;
2135  continue;
2136  }
2137 
2138  if (getLCLayerId(lcId) != layerId)
2139  continue;
2140  histograms.h_score_simcluster2layercl_perlayer[count].at(layerId)->Fill(lcPair.second.second);
2141  histograms.h_sharedenergy_simcluster2layercl_perlayer[count].at(layerId)->Fill(
2142  lcPair.second.first / sCEnergyOnLayer[layerId], sCEnergyOnLayer[layerId]);
2143  histograms.h_energy_vs_score_simcluster2layercl_perlayer[count].at(layerId)->Fill(
2144  lcPair.second.second, lcPair.second.first / sCEnergyOnLayer[layerId]);
2145  }
2146  const auto assoc = std::count_if(std::begin(lcs), std::end(lcs), [&](const auto& obj) {
2147  if (getLCLayerId(obj.first.index()) != layerId)
2148  return false;
2149  else
2150  return obj.second.second < ScoreCutSCtoLC_;
2151  });
2152  if (assoc) {
2153  histograms.h_num_simcluster_eta_perlayer[count].at(layerId)->Fill(sC[scId].eta());
2154  histograms.h_num_simcluster_phi_perlayer[count].at(layerId)->Fill(sC[scId].phi());
2155  if (assoc > 1) {
2156  histograms.h_numDup_simcluster_eta_perlayer[count].at(layerId)->Fill(sC[scId].eta());
2157  histograms.h_numDup_simcluster_phi_perlayer[count].at(layerId)->Fill(sC[scId].phi());
2158  }
2159  const auto best = std::min_element(std::begin(lcs), std::end(lcs), [&](const auto& obj1, const auto& obj2) {
2160  if (getLCLayerId(obj1.first.index()) != layerId)
2161  return false;
2162  else if (getLCLayerId(obj2.first.index()) == layerId)
2163  return obj1.second.second < obj2.second.second;
2164  else
2165  return true;
2166  });
2167  histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer[count].at(layerId)->Fill(
2168  sC[scId].eta(), best->second.first / sCEnergyOnLayer[layerId]);
2169  histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer[count].at(layerId)->Fill(
2170  sC[scId].phi(), best->second.first / sCEnergyOnLayer[layerId]);
2171  }
2172  }
2173  }
2174 }
const double ScoreCutSCtoLC_
const double ScoreCutLCtoSC_
Definition: DetId.h:17
std::shared_ptr< hgcal::RecHitTools > recHitTools_
#define LogDebug(id)

◆ setRecHitTools()

void HGVHistoProducerAlgo::setRecHitTools ( std::shared_ptr< hgcal::RecHitTools recHitTools)

Definition at line 3539 of file HGVHistoProducerAlgo.cc.

References recHitTools_.

3539  {
3540  recHitTools_ = recHitTools;
3541 }
std::shared_ptr< hgcal::RecHitTools > recHitTools_

◆ tracksters_to_SimTracksters()

void HGVHistoProducerAlgo::tracksters_to_SimTracksters ( const Histograms histograms,
const int  count,
const ticl::TracksterCollection Tracksters,
const reco::CaloClusterCollection layerClusters,
const ticl::TracksterCollection simTS,
const validationType  valType,
const ticl::TracksterCollection simTS_fromCP,
std::map< uint, std::vector< uint >> const &  simTrackstersMap,
std::vector< SimCluster > const &  sC,
const edm::ProductID cPHandle_id,
std::vector< CaloParticle > const &  cP,
std::vector< size_t > const &  cPIndices,
std::vector< size_t > const &  cPSelectedIndices,
std::unordered_map< DetId, const HGCRecHit *> const &  ,
unsigned int  layers 
) const

Definition at line 2495 of file HGVHistoProducerAlgo.cc.

References HltBtagPostValidation_cff::c, submitPVResolutionJobs::count, HLT_2024v12_cff::distance, relativeConstraints::empty, mps_fire::end, f, spr::find(), newFWLiteAna::found, HLT_2024v12_cff::fraction, h, heavyIonCSV_trainingSettings::idx, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::if(), dqmiolumiharvest::j, dqmdumpme::last, hltEgammaHGCALIDVarsL1Seeded_cfi::layerClusters, LogDebug, SiStripPI::min, minTSTSharedEneFracEfficiency_, GetRecoTauVFromDQM_MC_cff::next, getGTfromDQMFile::obj, funct::pow(), offlineSlimmedPrimaryVertices_cfi::score, ScoreCutSTStoTSPurDup_, ScoreCutTStoSTSFakeMerge_, ticl::Trackster::seedID(), ticl::Trackster::seedIndex(), ticl::Trackster::SIM, jetUpdater_cfi::sort, tier0::unique(), findQualityFiles::v, ticl::Trackster::vertex_multiplicity(), AlignmentTracksFromVertexSelector_cfi::vertices, and ticl::Trackster::vertices().

Referenced by fill_trackster_histos().

2510  {
2511  const auto nTracksters = tracksters.size();
2512  const auto nSimTracksters = simTSs.size();
2513 
2514  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdSimTSId_Map;
2515  std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>> detIdToTracksterId_Map;
2516  std::vector<int> tracksters_FakeMerge(nTracksters, 0);
2517  std::vector<int> tracksters_PurityDuplicate(nTracksters, 0);
2518 
2519  // This vector contains the ids of the SimTracksters contributing with at least one hit to the Trackster and the reconstruction error
2520  //stsInTrackster[trackster][STSids]
2521  //Connects a Trackster with all related SimTracksters.
2522  std::vector<std::vector<std::pair<unsigned int, float>>> stsInTrackster;
2523  stsInTrackster.resize(nTracksters);
2524 
2525  // cPOnLayer[caloparticle]:
2526  //1. the sum of all rechits energy times fraction of the relevant simhit related to that calo particle.
2527  //2. the hits and fractions of that calo particle.
2528  //3. the layer clusters with matched rechit id.
2529  std::unordered_map<int, caloParticleOnLayer> cPOnLayer;
2530  std::unordered_map<int, std::vector<caloParticleOnLayer>> sCOnLayer;
2531  //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution.
2532  for (const auto cpIndex : cPIndices) {
2533  cPOnLayer[cpIndex].caloParticleId = cpIndex;
2534  cPOnLayer[cpIndex].energy = 0.f;
2535  cPOnLayer[cpIndex].hits_and_fractions.clear();
2536  const auto nSC_inCP = sC.size();
2537  sCOnLayer[cpIndex].resize(nSC_inCP);
2538  for (unsigned int iSC = 0; iSC < nSC_inCP; iSC++) {
2539  sCOnLayer[cpIndex][iSC].caloParticleId = cpIndex;
2540  sCOnLayer[cpIndex][iSC].energy = 0.f;
2541  sCOnLayer[cpIndex][iSC].hits_and_fractions.clear();
2542  }
2543  }
2544 
2545  auto getCPId = [](const ticl::Trackster& simTS,
2546  const unsigned int iSTS,
2547  const edm::ProductID& cPHandle_id,
2548  const std::map<unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
2549  const ticl::TracksterCollection& simTSs_fromCP) {
2550  unsigned int cpId = -1;
2551 
2552  const auto productID = simTS.seedID();
2553  if (productID == cPHandle_id) {
2554  cpId = simTS.seedIndex();
2555  } else { // SimTrackster from SimCluster
2556  const auto findSimTSFromCP = std::find_if(
2557  std::begin(cpToSc_SimTrackstersMap),
2558  std::end(cpToSc_SimTrackstersMap),
2559  [&](const std::pair<unsigned int, std::vector<unsigned int>>& cpToScs) {
2560  return std::find(std::begin(cpToScs.second), std::end(cpToScs.second), iSTS) != std::end(cpToScs.second);
2561  });
2562  if (findSimTSFromCP != std::end(cpToSc_SimTrackstersMap)) {
2563  cpId = simTSs_fromCP[findSimTSFromCP->first].seedIndex();
2564  }
2565  }
2566 
2567  return cpId;
2568  };
2569 
2570  auto getLCId = [](const std::vector<unsigned int>& tst_vertices,
2572  const DetId& hitid) {
2573  unsigned int lcId = -1;
2574  std::for_each(std::begin(tst_vertices), std::end(tst_vertices), [&](unsigned int idx) {
2575  const auto& lc_haf = layerClusters[idx].hitsAndFractions();
2576  const auto& hitFound = std::find_if(std::begin(lc_haf),
2577  std::end(lc_haf),
2578  [&hitid](const std::pair<DetId, float>& v) { return v.first == hitid; });
2579  if (hitFound != lc_haf.end()) // not all hits may be clusterized
2580  lcId = idx;
2581  });
2582  return lcId;
2583  };
2584 
2585  for (unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
2586  const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2587  if (std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2588  continue;
2589 
2590  // Loop through SimClusters
2591  for (const auto& simCluster : cP[cpId].simClusters()) {
2592  auto iSim = simTSs[iSTS].seedIndex();
2593  if (simTSs[iSTS].seedID() != cPHandle_id) { // SimTrackster from SimCluster
2594  if (iSim != (&(*simCluster) - &(sC[0])))
2595  continue;
2596  } else
2597  iSim = 0;
2598 
2599  for (const auto& it_haf : simCluster->hits_and_fractions()) {
2600  const auto hitid = (it_haf.first);
2601  const auto lcId = getLCId(simTSs[iSTS].vertices(), layerClusters, hitid);
2602  //V9:maps the layers in -z: 0->51 and in +z: 52->103
2603  //V10:maps the layers in -z: 0->49 and in +z: 50->99
2604  const auto itcheck = hitMap.find(hitid);
2605  //Check whether the current hit belonging to sim cluster has a reconstructed hit
2606  if ((valType == 0 && itcheck != hitMap.end()) || (valType > 0 && int(lcId) >= 0)) {
2607  float lcFraction = 0;
2608  if (valType > 0) {
2609  const auto iLC = std::find(simTSs[iSTS].vertices().begin(), simTSs[iSTS].vertices().end(), lcId);
2610  lcFraction =
2611  1.f / simTSs[iSTS].vertex_multiplicity(std::distance(std::begin(simTSs[iSTS].vertices()), iLC));
2612  }
2613  const auto elemId = (valType == 0) ? hitid : lcId;
2614  const auto elemFr = (valType == 0) ? it_haf.second : lcFraction;
2615  //Since the current hit from SimCluster has a reconstructed hit {with the same detid, belonging to the corresponding SimTrackster},
2616  //make a map that will connect a {detid,lcID} with:
2617  //1. the SimTracksters that have a SimCluster with {sim hits in, LCs containing} that cell via SimTrackster id.
2618  //2. the sum of all {SimHits, LCs} fractions that contributes to that detid.
2619  //So, keep in mind that in case of multiple CaloParticles contributing in the same cell
2620  //the fraction is the sum over all calo particles. So, something like:
2621  //detid: (caloparticle 1, sum of hits fractions in that detid over all cp) , (caloparticle 2, sum of hits fractions in that detid over all cp), (caloparticle 3, sum of hits fractions in that detid over all cp) ...
2622  if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end()) {
2623  detIdSimTSId_Map[elemId] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
2624  detIdSimTSId_Map[elemId].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{iSTS, elemFr});
2625  } else {
2626  auto findSTSIt =
2627  std::find(detIdSimTSId_Map[elemId].begin(),
2628  detIdSimTSId_Map[elemId].end(),
2630  iSTS, 0}); // only the first element is used for the matching (overloaded operator==)
2631  if (findSTSIt != detIdSimTSId_Map[elemId].end()) {
2632  if (valType == 0)
2633  findSTSIt->fraction += elemFr;
2634  } else {
2635  detIdSimTSId_Map[elemId].emplace_back(HGVHistoProducerAlgo::detIdInfoInCluster{iSTS, elemFr});
2636  }
2637  }
2638  const auto hitEn = itcheck->second->energy();
2639  //Since the current hit from sim cluster has a reconstructed hit with the same detid,
2640  //fill the cPOnLayer[caloparticle][layer] object with energy (sum of all rechits energy times fraction
2641  //of the relevant simhit) and keep the hit (detid and fraction) that contributed.
2642  cPOnLayer[cpId].energy += it_haf.second * hitEn;
2643  sCOnLayer[cpId][iSim].energy += elemFr * hitEn;
2644  // Need to compress the hits and fractions in order to have a
2645  // reasonable score between CP and LC. Imagine, for example, that a
2646  // CP has detID X used by 2 SimClusters with different fractions. If
2647  // a single LC uses X with fraction 1 and is compared to the 2
2648  // contributions separately, it will be assigned a score != 0, which
2649  // is wrong.
2650  auto& haf = cPOnLayer[cpId].hits_and_fractions;
2651  auto found = std::find_if(
2652  std::begin(haf), std::end(haf), [&hitid](const std::pair<DetId, float>& v) { return v.first == hitid; });
2653  if (found != haf.end())
2654  found->second += it_haf.second;
2655  else
2656  haf.emplace_back(hitid, it_haf.second);
2657  // Same for sCOnLayer
2658  auto& haf_sc = sCOnLayer[cpId][iSim].hits_and_fractions;
2659  auto found_sc = std::find_if(std::begin(haf_sc),
2660  std::end(haf_sc),
2661  [&hitid](const std::pair<DetId, float>& v) { return v.first == hitid; });
2662  if (found_sc != haf_sc.end())
2663  found_sc->second += it_haf.second;
2664  else
2665  haf_sc.emplace_back(hitid, it_haf.second);
2666  }
2667  } // end of loop through SimHits
2668  } // end of loop through SimClusters
2669  } // end of loop through SimTracksters
2670 
2671  auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, const reco::CaloClusterCollection& layerClusters) {
2672  std::vector<std::pair<DetId, float>> hits_and_fractions_norm;
2673  int lcInTst = 0;
2674  std::for_each(std::begin(trackster.vertices()), std::end(trackster.vertices()), [&](unsigned int idx) {
2675  const auto fraction = 1.f / trackster.vertex_multiplicity(lcInTst++);
2676  for (const auto& cell : layerClusters[idx].hitsAndFractions()) {
2677  hits_and_fractions_norm.emplace_back(
2678  cell.first, cell.second * fraction); // cell.second is the hit fraction in the layerCluster
2679  }
2680  });
2681  return hits_and_fractions_norm;
2682  };
2683 
2684  auto ScoreCutSTStoTSPurDup = ScoreCutSTStoTSPurDup_[0];
2685  auto ScoreCutTStoSTSFakeMerge = ScoreCutTStoSTSFakeMerge_[0];
2686  // Loop through Tracksters
2687  for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2688  const auto& tst = tracksters[tstId];
2689  if (tstId == 0)
2690  if ((valType > 0) && (tst.ticlIteration() == ticl::Trackster::SIM)) {
2691  ScoreCutSTStoTSPurDup = ScoreCutSTStoTSPurDup_[valType];
2692  ScoreCutTStoSTSFakeMerge = ScoreCutTStoSTSFakeMerge_[valType];
2693  }
2694 
2695  if (tst.vertices().empty())
2696  continue;
2697 
2698  std::unordered_map<unsigned, float> CPEnergyInTS;
2699  int maxCPId_byNumberOfHits = -1;
2700  unsigned int maxCPNumberOfHitsInTS = 0;
2701  int maxCPId_byEnergy = -1;
2702  float maxEnergySharedTSandCP = 0.f;
2703  float energyFractionOfTSinCP = 0.f;
2704  float energyFractionOfCPinTS = 0.f;
2705 
2706  //In case of matched rechit-simhit, so matched
2707  //CaloParticle-LayerCluster-Trackster, he counts and saves the number of
2708  //rechits related to the maximum energy CaloParticle out of all
2709  //CaloParticles related to that layer cluster and Trackster.
2710 
2711  std::unordered_map<unsigned, unsigned> occurrencesCPinTS;
2712  unsigned int numberOfNoiseHitsInTS = 0;
2713 
2714  const auto tst_hitsAndFractions = apply_LCMultiplicity(tst, layerClusters);
2715  const auto numberOfHitsInTS = tst_hitsAndFractions.size();
2716 
2717  //hitsToCaloParticleId is a vector of ints, one for each rechit of the
2718  //layer cluster under study. If negative, there is no simhit from any CaloParticle related.
2719  //If positive, at least one CaloParticle has been found with matched simhit.
2720  //In more detail:
2721  // 1. hitsToCaloParticleId[iHit] = -3
2722  // TN: These represent Halo Cells(N) that have not been
2723  // assigned to any CaloParticle (hence the T).
2724  // 2. hitsToCaloParticleId[iHit] = -2
2725  // FN: There represent Halo Cells(N) that have been assigned
2726  // to a CaloParticle (hence the F, since those should have not been marked as halo)
2727  // 3. hitsToCaloParticleId[iHit] = -1
2728  // FP: These represent Real Cells(P) that have not been
2729  // assigned to any CaloParticle (hence the F, since these are fakes)
2730  // 4. hitsToCaloParticleId[iHit] >= 0
2731  // TP There represent Real Cells(P) that have been assigned
2732  // to a CaloParticle (hence the T)
2733  std::vector<int> hitsToCaloParticleId(numberOfHitsInTS);
2734 
2735  //Loop through the hits of the trackster under study
2736  for (unsigned int iHit = 0; iHit < numberOfHitsInTS; iHit++) {
2737  const auto rh_detid = tst_hitsAndFractions[iHit].first;
2738  const auto rhFraction = tst_hitsAndFractions[iHit].second;
2739 
2740  const auto lcId_r = getLCId(tst.vertices(), layerClusters, rh_detid);
2741  const auto iLC_r = std::find(tst.vertices().begin(), tst.vertices().end(), lcId_r);
2742  const auto lcFraction_r = 1.f / tst.vertex_multiplicity(std::distance(std::begin(tst.vertices()), iLC_r));
2743 
2744  //Make a map that will connect a detid (that belongs to a rechit of the layer cluster under study,
2745  //no need to save others) with:
2746  //1. the layer clusters that have rechits in that detid
2747  //2. the fraction of the rechit of each layer cluster that contributes to that detid.
2748  //So, something like:
2749  //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ...
2750  //here comparing with the calo particle map above the
2751  if (detIdToTracksterId_Map.find(rh_detid) == detIdToTracksterId_Map.end()) {
2752  detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>();
2753  detIdToTracksterId_Map[rh_detid].emplace_back(
2754  HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, lcId_r, rhFraction});
2755  } else {
2756  auto findTSIt =
2757  std::find(detIdToTracksterId_Map[rh_detid].begin(),
2758  detIdToTracksterId_Map[rh_detid].end(),
2760  tstId, 0, 0}); // only the first element is used for the matching (overloaded operator==)
2761  if (findTSIt != detIdToTracksterId_Map[rh_detid].end()) {
2762  if (valType == 0)
2763  findTSIt->fraction += rhFraction;
2764  } else {
2765  detIdToTracksterId_Map[rh_detid].emplace_back(
2766  HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, lcId_r, rhFraction});
2767  }
2768  }
2769 
2770  // if the fraction is zero or the hit does not belong to any calo
2771  // particle, set the caloparticleId for the hit to -1 this will
2772  // contribute to the number of noise hits
2773  // MR Remove the case in which the fraction is 0, since this could be a
2774  // real hit that has been marked as halo.
2775  if (rhFraction == 0.) {
2776  hitsToCaloParticleId[iHit] = -2;
2777  }
2778 
2779  // Check whether the RecHit of the trackster under study has a SimHit in the same cell
2780  const auto elemId = (valType == 0) ? rh_detid.rawId() : lcId_r;
2781  const auto recoFr = (valType == 0) ? rhFraction : lcFraction_r;
2782  const auto& hit_find_in_STS = detIdSimTSId_Map.find(elemId);
2783  if (hit_find_in_STS == detIdSimTSId_Map.end()) {
2784  hitsToCaloParticleId[iHit] -= 1;
2785  } else {
2786  // Since the hit is belonging to the layer cluster, it must be also in the rechits map
2787  const auto hitEn = hitMap.find(rh_detid)->second->energy();
2788  //const auto layerId =
2789  //recHitTools_->getLayerWithOffset(rh_detid) + layers * ((recHitTools_->zside(rh_detid) + 1) >> 1) - 1;
2790  //0;
2791 
2792  auto maxCPEnergyInTS = 0.f;
2793  auto maxCPId = -1;
2794  for (const auto& h : hit_find_in_STS->second) {
2795  const auto shared_fraction = std::min(recoFr, h.fraction);
2796  const auto iSTS = h.clusterId;
2797  const auto& simTS = simTSs[iSTS];
2798  auto iSim = simTS.seedIndex();
2799  if (simTSs[iSTS].seedID() == cPHandle_id) // SimTrackster from CaloParticle
2800  iSim = 0;
2801 
2802  // SimTrackster with simHits connected via detid with the rechit under study
2803  //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the
2804  //energy of that calo particle as the sum over all rechits of the rechits energy weighted
2805  //by the caloparticle's fraction related to that rechit.
2806  const auto cpId = getCPId(simTS, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2807  if (std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2808  continue;
2809 
2810  CPEnergyInTS[cpId] += shared_fraction * hitEn;
2811  //Here cPOnLayer[caloparticle][layer] describe above is set.
2812  //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved .
2813  cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2814  sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2815  cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2816  sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2817  //stsInTrackster[trackster][STSids]
2818  //Connects a Trackster with all related SimTracksters.
2819  stsInTrackster[tstId].emplace_back(iSTS, FLT_MAX);
2820  //From all CaloParticles related to a layer cluster, it saves id and energy of the calo particle
2821  //that after simhit-rechit matching in layer has the maximum energy.
2822  if (shared_fraction > maxCPEnergyInTS) {
2823  //energy is used only here. cpid is saved for Tracksters
2824  maxCPEnergyInTS = CPEnergyInTS[cpId];
2825  maxCPId = cpId;
2826  }
2827  }
2828  //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise.
2829  hitsToCaloParticleId[iHit] = maxCPId;
2830  }
2831 
2832  } //end of loop through rechits of the layer cluster.
2833 
2834  //Loop through all rechits to count how many of them are noise and how many are matched.
2835  //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle.
2836  for (auto c : hitsToCaloParticleId) {
2837  if (c < 0)
2838  numberOfNoiseHitsInTS++;
2839  else
2840  occurrencesCPinTS[c]++;
2841  }
2842 
2843  //Below from all maximum energy CaloParticles, he saves the one with the largest amount
2844  //of related rechits.
2845  for (auto& c : occurrencesCPinTS) {
2846  if (c.second > maxCPNumberOfHitsInTS) {
2847  maxCPId_byNumberOfHits = c.first;
2848  maxCPNumberOfHitsInTS = c.second;
2849  }
2850  }
2851 
2852  //Find the CaloParticle that has the maximum energy shared with the Trackster under study.
2853  for (auto& c : CPEnergyInTS) {
2854  if (c.second > maxEnergySharedTSandCP) {
2855  maxCPId_byEnergy = c.first;
2856  maxEnergySharedTSandCP = c.second;
2857  }
2858  }
2859  //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study.
2860  float totalCPEnergyFromLayerCP = 0.f;
2861  if (maxCPId_byEnergy >= 0) {
2862  totalCPEnergyFromLayerCP += cPOnLayer[maxCPId_byEnergy].energy;
2863  energyFractionOfCPinTS = maxEnergySharedTSandCP / totalCPEnergyFromLayerCP;
2864  if (tst.raw_energy() > 0.f) {
2865  energyFractionOfTSinCP = maxEnergySharedTSandCP / tst.raw_energy();
2866  }
2867  }
2868 
2869  LogDebug("HGCalValidator") << std::setw(12) << "Trackster\t" << std::setw(10) << "energy\t" << std::setw(5)
2870  << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22)
2871  << "maxCPId_byNumberOfHits\t" << std::setw(8) << "nhitsCP\t" << std::setw(16)
2872  << "maxCPId_byEnergy\t" << std::setw(23) << "maxEnergySharedTSandCP\t" << std::setw(22)
2873  << "totalCPEnergyFromAllLayerCP\t" << std::setw(22) << "energyFractionOfTSinCP\t"
2874  << std::setw(25) << "energyFractionOfCPinTS\t" << std::endl;
2875  LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator")
2876  << std::setw(10) << tst.raw_energy() << "\t" << std::setw(5) << numberOfHitsInTS << "\t"
2877  << std::setw(12) << numberOfNoiseHitsInTS << "\t" << std::setw(22)
2878  << maxCPId_byNumberOfHits << "\t" << std::setw(8) << maxCPNumberOfHitsInTS << "\t"
2879  << std::setw(16) << maxCPId_byEnergy << "\t" << std::setw(23) << maxEnergySharedTSandCP
2880  << "\t" << std::setw(22) << totalCPEnergyFromLayerCP << "\t" << std::setw(22)
2881  << energyFractionOfTSinCP << "\t" << std::setw(25) << energyFractionOfCPinTS
2882  << std::endl;
2883 
2884  } // end of loop through Tracksters
2885 
2886  // Loop through Tracksters
2887  for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2888  const auto& tst = tracksters[tstId];
2889  if (tst.vertices().empty())
2890  continue;
2891 
2892  // find the unique SimTrackster ids contributing to the Trackster
2893  //stsInTrackster[trackster][STSids]
2894  std::sort(stsInTrackster[tstId].begin(), stsInTrackster[tstId].end());
2895  const auto last = std::unique(stsInTrackster[tstId].begin(), stsInTrackster[tstId].end());
2896  stsInTrackster[tstId].erase(last, stsInTrackster[tstId].end());
2897 
2898  if (tst.raw_energy() == 0. && !stsInTrackster[tstId].empty()) {
2899  //Loop through all SimTracksters contributing to Trackster tstId
2900  for (auto& stsPair : stsInTrackster[tstId]) {
2901  // In case of a Trackster with zero energy but related SimTracksters the score is set to 1
2902  stsPair.second = 1.;
2903  LogDebug("HGCalValidator") << "Trackster Id:\t" << tstId << "\tSimTrackster id:\t" << stsPair.first
2904  << "\tscore\t" << stsPair.second << std::endl;
2905  histograms.h_score_trackster2caloparticle[valType][count]->Fill(stsPair.second);
2906  }
2907  continue;
2908  }
2909 
2910  const auto tst_hitsAndFractions = apply_LCMultiplicity(tst, layerClusters);
2911 
2912  // Compute the correct normalization
2913  float tracksterEnergy = 0.f, invTracksterEnergyWeight = 0.f;
2914  for (const auto& haf : tst_hitsAndFractions) {
2915  float hitFr = 0.f;
2916  if (valType == 0) {
2917  hitFr = haf.second;
2918  } else {
2919  const auto lcId = getLCId(tst.vertices(), layerClusters, haf.first);
2920  const auto iLC = std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2921  hitFr = 1.f / tst.vertex_multiplicity(std::distance(std::begin(tst.vertices()), iLC));
2922  }
2923  tracksterEnergy += hitFr * hitMap.at(haf.first)->energy();
2924  invTracksterEnergyWeight += pow(hitFr * hitMap.at(haf.first)->energy(), 2);
2925  }
2926  if (invTracksterEnergyWeight)
2927  invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight;
2928 
2929  for (const auto& haf : tst_hitsAndFractions) {
2930  const auto rh_detid = haf.first;
2931  unsigned int elemId = 0;
2932  float rhFraction = 0.f;
2933  if (valType == 0) {
2934  elemId = rh_detid.rawId();
2935  rhFraction = haf.second;
2936  } else {
2937  const auto lcId = getLCId(tst.vertices(), layerClusters, rh_detid);
2938  elemId = lcId;
2939  const auto iLC = std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2940  rhFraction = 1.f / tst.vertex_multiplicity(std::distance(std::begin(tst.vertices()), iLC));
2941  }
2942 
2943  bool hitWithNoSTS = false;
2944  if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end())
2945  hitWithNoSTS = true;
2946  const HGCRecHit* hit = hitMap.find(rh_detid)->second;
2947  const auto hitEnergyWeight = pow(hit->energy(), 2);
2948 
2949  for (auto& stsPair : stsInTrackster[tstId]) {
2950  float cpFraction = 0.f;
2951  if (!hitWithNoSTS) {
2952  const auto& findSTSIt = std::find(
2953  detIdSimTSId_Map[elemId].begin(),
2954  detIdSimTSId_Map[elemId].end(),
2956  stsPair.first, 0.f}); // only the first element is used for the matching (overloaded operator==)
2957  if (findSTSIt != detIdSimTSId_Map[elemId].end())
2958  cpFraction = findSTSIt->fraction;
2959  }
2960  if (stsPair.second == FLT_MAX) {
2961  stsPair.second = 0.f;
2962  }
2963  stsPair.second +=
2964  min(pow(rhFraction - cpFraction, 2), pow(rhFraction, 2)) * hitEnergyWeight * invTracksterEnergyWeight;
2965  }
2966  } // end of loop through trackster rechits
2967 
2968  //In case of a Trackster with some energy but none related CaloParticles print some info.
2969  if (stsInTrackster[tstId].empty())
2970  LogDebug("HGCalValidator") << "Trackster Id: " << tstId << "\tSimTrackster id: -1"
2971  << "\tscore: -1\n";
2972 
2973  tracksters_FakeMerge[tstId] =
2974  std::count_if(std::begin(stsInTrackster[tstId]),
2975  std::end(stsInTrackster[tstId]),
2976  [ScoreCutTStoSTSFakeMerge](const auto& obj) { return obj.second < ScoreCutTStoSTSFakeMerge; });
2977 
2978  const auto score = std::min_element(std::begin(stsInTrackster[tstId]),
2979  std::end(stsInTrackster[tstId]),
2980  [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; });
2981  float score2 = -1;
2982  float sharedEneFrac2 = 0;
2983  for (const auto& stsPair : stsInTrackster[tstId]) {
2984  const auto iSTS = stsPair.first;
2985  const auto iScore = stsPair.second;
2986  const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2987  auto iSim = simTSs[iSTS].seedIndex();
2988  if (simTSs[iSTS].seedID() == cPHandle_id) // SimTrackster from CaloParticle
2989  iSim = 0;
2990  const auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
2991 
2992  float sharedeneCPallLayers = 0.;
2993  sharedeneCPallLayers += simOnLayer.layerClusterIdToEnergyAndScore.count(tstId)
2994  ? simOnLayer.layerClusterIdToEnergyAndScore.at(tstId).first
2995  : 0;
2996  if (tracksterEnergy == 0)
2997  continue;
2998  const auto sharedEneFrac = sharedeneCPallLayers / tracksterEnergy;
2999  LogDebug("HGCalValidator") << "\nTrackster id: " << tstId << " (" << tst.vertices().size() << " vertices)"
3000  << "\tSimTrackster Id: " << iSTS << " (" << simTSs[iSTS].vertices().size()
3001  << " vertices)"
3002  << " (CP id: " << cpId << ")\tscore: " << iScore
3003  << "\tsharedeneCPallLayers: " << sharedeneCPallLayers << std::endl;
3004 
3005  histograms.h_score_trackster2caloparticle[valType][count]->Fill(iScore);
3006  histograms.h_sharedenergy_trackster2caloparticle[valType][count]->Fill(sharedEneFrac);
3007  histograms.h_energy_vs_score_trackster2caloparticle[valType][count]->Fill(iScore, sharedEneFrac);
3008  if (iSTS == score->first) {
3009  histograms.h_score_trackster2bestCaloparticle[valType][count]->Fill(iScore);
3010  histograms.h_sharedenergy_trackster2bestCaloparticle[valType][count]->Fill(sharedEneFrac);
3011  histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType][count]->Fill(tst.barycenter().eta(),
3012  sharedEneFrac);
3013  histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType][count]->Fill(tst.barycenter().phi(),
3014  sharedEneFrac);
3015  histograms.h_energy_vs_score_trackster2bestCaloparticle[valType][count]->Fill(iScore, sharedEneFrac);
3016  } else if (score2 < 0 || iScore < score2) {
3017  score2 = iScore;
3018  sharedEneFrac2 = sharedEneFrac;
3019  }
3020  } // end of loop through SimTracksters associated to Trackster
3021  if (score2 > -1) {
3022  histograms.h_score_trackster2bestCaloparticle2[valType][count]->Fill(score2);
3023  histograms.h_sharedenergy_trackster2bestCaloparticle2[valType][count]->Fill(sharedEneFrac2);
3024  histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType][count]->Fill(score2, sharedEneFrac2);
3025  }
3026  } // end of loop through Tracksters
3027 
3028  std::unordered_map<unsigned int, std::vector<float>> score3d;
3029  std::unordered_map<unsigned int, std::vector<float>> tstSharedEnergy;
3030 
3031  for (unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3032  score3d[iSTS].resize(nTracksters);
3033  tstSharedEnergy[iSTS].resize(nTracksters);
3034  for (unsigned int j = 0; j < nTracksters; ++j) {
3035  score3d[iSTS][j] = FLT_MAX;
3036  tstSharedEnergy[iSTS][j] = 0.f;
3037  }
3038  }
3039 
3040  // Fill the plots to compute the different metrics linked to
3041  // gen-level, namely efficiency, purity and duplicate. In this loop should restrict
3042  // only to the selected caloParaticles.
3043  for (unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3044  const auto& sts = simTSs[iSTS];
3045  const auto& cpId = getCPId(sts, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
3046  if (valType == 0 && std::find(cPSelectedIndices.begin(), cPSelectedIndices.end(), cpId) == cPSelectedIndices.end())
3047  continue;
3048 
3049  const auto& hafLC = apply_LCMultiplicity(sts, layerClusters);
3050  float SimEnergy_LC = 0.f;
3051  for (const auto& haf : hafLC) {
3052  const auto lcId = getLCId(sts.vertices(), layerClusters, haf.first);
3053  const auto iLC = std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3054  SimEnergy_LC +=
3055  hitMap.at(haf.first)->energy() / sts.vertex_multiplicity(std::distance(std::begin(sts.vertices()), iLC));
3056  }
3057 
3058  auto iSim = sts.seedIndex();
3059  if (sts.seedID() == cPHandle_id) // SimTrackster from CaloParticle
3060  iSim = 0;
3061  auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
3062 
3063  // Keep the Trackster ids that are related to
3064  // SimTrackster under study for the final filling of the score
3065  std::set<unsigned int> stsId_tstId_related;
3066  auto& score3d_iSTS = score3d[iSTS];
3067 
3068  float SimEnergy = 0.f;
3069  float SimEnergyWeight = 0.f, hitsEnergyWeight = 0.f;
3070  //for (unsigned int layerId = 0; layerId < 1/*layers * 2*/; ++layerId) {
3071  const auto SimNumberOfHits = simOnLayer.hits_and_fractions.size();
3072  if (SimNumberOfHits == 0)
3073  continue;
3074  SimEnergy += simOnLayer.energy;
3075  int tstWithMaxEnergyInCP = -1;
3076  //This is the maximum energy related to Trackster per layer.
3077  float maxEnergyTSperlayerinSim = 0.f;
3078  float SimEnergyFractionInTSperlayer = 0.f;
3079  //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the Trackster id.
3080  for (const auto& tst : simOnLayer.layerClusterIdToEnergyAndScore) {
3081  if (tst.second.first > maxEnergyTSperlayerinSim) {
3082  maxEnergyTSperlayerinSim = tst.second.first;
3083  tstWithMaxEnergyInCP = tst.first;
3084  }
3085  }
3086  if (SimEnergy > 0.f)
3087  SimEnergyFractionInTSperlayer = maxEnergyTSperlayerinSim / SimEnergy;
3088 
3089  LogDebug("HGCalValidator") << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t"
3090  << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) << "CPNhitsOnLayer\t"
3091  << std::setw(18) << "tstWithMaxEnergyInCP\t" << std::setw(15) << "maxEnergyTSinCP\t"
3092  << std::setw(20) << "CPEnergyFractionInTS"
3093  << "\n";
3094  LogDebug("HGCalValidator") << std::setw(12) << cpId << "\t" << std::setw(15) << sts.raw_energy() << "\t"
3095  << std::setw(15) << SimEnergy << "\t" << std::setw(14) << SimNumberOfHits << "\t"
3096  << std::setw(18) << tstWithMaxEnergyInCP << "\t" << std::setw(15)
3097  << maxEnergyTSperlayerinSim << "\t" << std::setw(20) << SimEnergyFractionInTSperlayer
3098  << "\n";
3099 
3100  for (const auto& haf : ((valType == 0) ? simOnLayer.hits_and_fractions : hafLC)) {
3101  const auto& hitDetId = haf.first;
3102  // Compute the correct normalization
3103  // Need to loop on the simOnLayer data structure since this is the
3104  // only one that has the compressed information for multiple usage
3105  // of the same DetId by different SimClusters by a single CaloParticle.
3106  SimEnergyWeight += pow(haf.second * hitMap.at(hitDetId)->energy(), 2);
3107 
3108  const auto lcId = getLCId(sts.vertices(), layerClusters, hitDetId);
3109  float cpFraction = 0.f;
3110  if (valType == 0) {
3111  cpFraction = haf.second;
3112  } else {
3113  const auto iLC = std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3114  cpFraction = 1.f / sts.vertex_multiplicity(std::distance(std::begin(sts.vertices()), iLC));
3115  }
3116  if (cpFraction == 0.f)
3117  continue; // hopefully this should never happen
3118 
3119  bool hitWithNoTS = false;
3120  if (detIdToTracksterId_Map.find(hitDetId) == detIdToTracksterId_Map.end())
3121  hitWithNoTS = true;
3122  const HGCRecHit* hit = hitMap.find(hitDetId)->second;
3123  const auto hitEnergyWeight = pow(hit->energy(), 2);
3124  hitsEnergyWeight += pow(cpFraction, 2) * hitEnergyWeight;
3125 
3126  for (auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3127  const auto tstId = tsPair.first;
3128  stsId_tstId_related.insert(tstId);
3129 
3130  float tstFraction = 0.f;
3131  if (!hitWithNoTS) {
3132  const auto findTSIt =
3133  std::find(detIdToTracksterId_Map[hitDetId].begin(),
3134  detIdToTracksterId_Map[hitDetId].end(),
3136  tstId, 0, 0.f}); // only the first element is used for the matching (overloaded operator==)
3137  if (findTSIt != detIdToTracksterId_Map[hitDetId].end()) {
3138  if (valType == 0) {
3139  tstFraction = findTSIt->fraction;
3140  } else {
3141  const auto iLC = std::find(
3142  tracksters[tstId].vertices().begin(), tracksters[tstId].vertices().end(), findTSIt->clusterId);
3143  if (iLC != tracksters[tstId].vertices().end()) {
3144  tstFraction = 1.f / tracksters[tstId].vertex_multiplicity(
3145  std::distance(std::begin(tracksters[tstId].vertices()), iLC));
3146  }
3147  }
3148  }
3149  }
3150  // Here do not divide as before by the trackster energy weight. Should sum first
3151  // over all layers and divide with the total CP energy over all layers.
3152  if (tsPair.second.second == FLT_MAX) {
3153  tsPair.second.second = 0.f;
3154  }
3155  tsPair.second.second += min(pow(tstFraction - cpFraction, 2), pow(cpFraction, 2)) * hitEnergyWeight;
3156 
3157  LogDebug("HGCalValidator") << "\nTracksterId:\t" << tstId << "\tSimTracksterId:\t" << iSTS << "\tcpId:\t"
3158  << cpId << "\ttstfraction, cpfraction:\t" << tstFraction << ", " << cpFraction
3159  << "\thitEnergyWeight:\t" << hitEnergyWeight << "\tadded delta:\t"
3160  << pow((tstFraction - cpFraction), 2) * hitEnergyWeight
3161  << "\tcurrent Sim-score numerator:\t" << tsPair.second.second
3162  << "\tshared Sim energy:\t" << tsPair.second.first << '\n';
3163  }
3164  } // end of loop through SimCluster SimHits on current layer
3165 
3166  if (simOnLayer.layerClusterIdToEnergyAndScore.empty())
3167  LogDebug("HGCalValidator") << "CP Id:\t" << cpId << "\tTS id:\t-1"
3168  << " Sub score in \t -1\n";
3169 
3170  for (const auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3171  const auto tstId = tsPair.first;
3172  // 3D score here without the denominator at this point
3173  if (score3d_iSTS[tstId] == FLT_MAX) {
3174  score3d_iSTS[tstId] = 0.f;
3175  }
3176  score3d_iSTS[tstId] += tsPair.second.second;
3177  tstSharedEnergy[iSTS][tstId] += tsPair.second.first;
3178  }
3179  //} // end of loop through layers
3180 
3181  const auto scoreDenom = (valType == 0) ? SimEnergyWeight : hitsEnergyWeight;
3182  const auto energyDenom = (valType == 0) ? SimEnergy : SimEnergy_LC;
3183 
3184  const auto sts_eta = sts.barycenter().eta();
3185  const auto sts_phi = sts.barycenter().phi();
3186  const auto sts_en = sts.raw_energy();
3187  const auto sts_pt = sts.raw_pt();
3188  histograms.h_denom_caloparticle_eta[valType][count]->Fill(sts_eta);
3189  histograms.h_denom_caloparticle_phi[valType][count]->Fill(sts_phi);
3190  histograms.h_denom_caloparticle_en[valType][count]->Fill(sts_en);
3191  histograms.h_denom_caloparticle_pt[valType][count]->Fill(sts_pt);
3192 
3193  //Loop through related Tracksters here
3194  // In case the threshold to associate a CaloParticle to a Trackster is
3195  // below 50%, there could be cases in which the CP is linked to more than
3196  // one tracksters, leading to efficiencies >1. This boolean is used to
3197  // avoid "over counting".
3198  bool sts_considered_efficient = false;
3199  bool sts_considered_pure = false;
3200  for (const auto tstId : stsId_tstId_related) {
3201  // Now time for the denominator
3202  score3d_iSTS[tstId] /= scoreDenom;
3203  const auto tstSharedEnergyFrac = tstSharedEnergy[iSTS][tstId] / energyDenom;
3204  LogDebug("HGCalValidator") << "STS id: " << iSTS << "\t(CP id: " << cpId << ")\tTS id: " << tstId
3205  << "\nSimEnergy: " << energyDenom << "\tSimEnergyWeight: " << SimEnergyWeight
3206  << "\tTrackste energy: " << tracksters[tstId].raw_energy()
3207  << "\nscore: " << score3d_iSTS[tstId]
3208  << "\tshared energy: " << tstSharedEnergy[iSTS][tstId]
3209  << "\tshared energy fraction: " << tstSharedEnergyFrac << "\n";
3210 
3211  histograms.h_score_caloparticle2trackster[valType][count]->Fill(score3d_iSTS[tstId]);
3212  histograms.h_sharedenergy_caloparticle2trackster[valType][count]->Fill(tstSharedEnergyFrac);
3213  histograms.h_energy_vs_score_caloparticle2trackster[valType][count]->Fill(score3d_iSTS[tstId],
3214  tstSharedEnergyFrac);
3215  // Fill the numerator for the efficiency calculation. The efficiency is computed by considering the energy shared between a Trackster and a _corresponding_ caloParticle. The threshold is configurable via python.
3216  if (!sts_considered_efficient && (tstSharedEnergyFrac >= minTSTSharedEneFracEfficiency_)) {
3217  sts_considered_efficient = true;
3218  histograms.h_numEff_caloparticle_eta[valType][count]->Fill(sts_eta);
3219  histograms.h_numEff_caloparticle_phi[valType][count]->Fill(sts_phi);
3220  histograms.h_numEff_caloparticle_en[valType][count]->Fill(sts_en);
3221  histograms.h_numEff_caloparticle_pt[valType][count]->Fill(sts_pt);
3222  }
3223 
3224  if (score3d_iSTS[tstId] < ScoreCutSTStoTSPurDup) {
3225  if (tracksters_PurityDuplicate[tstId] < 1)
3226  tracksters_PurityDuplicate[tstId]++; // for Purity
3227  if (sts_considered_pure)
3228  tracksters_PurityDuplicate[tstId]++; // for Duplicate
3229  sts_considered_pure = true;
3230  }
3231  } // end of loop through Tracksters related to SimTrackster
3232 
3233  const auto best = std::min_element(std::begin(score3d_iSTS), std::end(score3d_iSTS));
3234  if (best != score3d_iSTS.end()) {
3235  const auto bestTstId = std::distance(std::begin(score3d_iSTS), best);
3236  const auto bestTstSharedEnergyFrac = tstSharedEnergy[iSTS][bestTstId] / energyDenom;
3237  histograms.h_scorePur_caloparticle2trackster[valType][count]->Fill(*best);
3238  histograms.h_sharedenergy_caloparticle2trackster_assoc[valType][count]->Fill(bestTstSharedEnergyFrac);
3239  histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_eta[valType][count]->Fill(sts_eta,
3240  bestTstSharedEnergyFrac);
3241  histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_phi[valType][count]->Fill(sts_phi,
3242  bestTstSharedEnergyFrac);
3243  histograms.h_energy_vs_score_caloparticle2bestTrackster[valType][count]->Fill(*best, bestTstSharedEnergyFrac);
3244  LogDebug("HGCalValidator") << count << " " << sts_eta << " " << sts_phi << " "
3245  << tracksters[bestTstId].raw_energy() << " " << sts.raw_energy() << " "
3246  << bestTstSharedEnergyFrac << "\n";
3247 
3248  if (score3d_iSTS.size() > 1) {
3249  auto best2 = (best == score3d_iSTS.begin()) ? std::next(best, 1) : score3d_iSTS.begin();
3250  for (auto tstId = score3d_iSTS.begin(); tstId != score3d_iSTS.end() && tstId != best; tstId++)
3251  if (*tstId < *best2)
3252  best2 = tstId;
3253  const auto best2TstId = std::distance(std::begin(score3d_iSTS), best2);
3254  const auto best2TstSharedEnergyFrac = tstSharedEnergy[iSTS][best2TstId] / energyDenom;
3255  histograms.h_scoreDupl_caloparticle2trackster[valType][count]->Fill(*best2);
3256  histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType][count]->Fill(best2TstSharedEnergyFrac);
3257  histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType][count]->Fill(*best2,
3258  best2TstSharedEnergyFrac);
3259  }
3260  }
3261  } // end of loop through SimTracksters
3262 
3263  // Fill the plots to compute the different metrics linked to
3264  // reco-level, namely fake-rate an merge-rate. Should *not*
3265  // restrict only to the selected caloParaticles.
3266  for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3267  const auto& tst = tracksters[tstId];
3268  if (tst.vertices().empty())
3269  continue;
3270  const auto iTS_eta = tst.barycenter().eta();
3271  const auto iTS_phi = tst.barycenter().phi();
3272  const auto iTS_en = tst.raw_energy();
3273  const auto iTS_pt = tst.raw_pt();
3274  histograms.h_denom_trackster_eta[valType][count]->Fill(iTS_eta);
3275  histograms.h_denom_trackster_phi[valType][count]->Fill(iTS_phi);
3276  histograms.h_denom_trackster_en[valType][count]->Fill(iTS_en);
3277  histograms.h_denom_trackster_pt[valType][count]->Fill(iTS_pt);
3278 
3279  if (tracksters_PurityDuplicate[tstId] > 0) {
3280  histograms.h_num_caloparticle_eta[valType][count]->Fill(iTS_eta);
3281  histograms.h_num_caloparticle_phi[valType][count]->Fill(iTS_phi);
3282  histograms.h_num_caloparticle_en[valType][count]->Fill(iTS_en);
3283  histograms.h_num_caloparticle_pt[valType][count]->Fill(iTS_pt);
3284 
3285  if (tracksters_PurityDuplicate[tstId] > 1) {
3286  histograms.h_numDup_trackster_eta[valType][count]->Fill(iTS_eta);
3287  histograms.h_numDup_trackster_phi[valType][count]->Fill(iTS_phi);
3288  histograms.h_numDup_trackster_en[valType][count]->Fill(iTS_en);
3289  histograms.h_numDup_trackster_pt[valType][count]->Fill(iTS_pt);
3290  }
3291  }
3292 
3293  if (tracksters_FakeMerge[tstId] > 0) {
3294  histograms.h_num_trackster_eta[valType][count]->Fill(iTS_eta);
3295  histograms.h_num_trackster_phi[valType][count]->Fill(iTS_phi);
3296  histograms.h_num_trackster_en[valType][count]->Fill(iTS_en);
3297  histograms.h_num_trackster_pt[valType][count]->Fill(iTS_pt);
3298 
3299  if (tracksters_FakeMerge[tstId] > 1) {
3300  histograms.h_numMerge_trackster_eta[valType][count]->Fill(iTS_eta);
3301  histograms.h_numMerge_trackster_phi[valType][count]->Fill(iTS_phi);
3302  histograms.h_numMerge_trackster_en[valType][count]->Fill(iTS_en);
3303  histograms.h_numMerge_trackster_pt[valType][count]->Fill(iTS_pt);
3304  }
3305  }
3306  } // End loop over Tracksters
3307 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
def unique(seq, keepstr=True)
Definition: tier0.py:24
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
double f[11][100]
const double ScoreCutTStoSTSFakeMerge_[]
std::vector< unsigned int > & vertices()
Definition: Trackster.h:56
Definition: DetId.h:17
const edm::ProductID & seedID() const
Definition: Trackster.h:127
std::vector< float > & vertex_multiplicity()
Definition: Trackster.h:57
const double ScoreCutSTStoTSPurDup_[]
const int seedIndex() const
Definition: Trackster.h:128
std::vector< Trackster > TracksterCollection
Definition: Trackster.h:199
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
#define LogDebug(id)

Member Data Documentation

◆ maxCellsEneDensperthick_

double HGVHistoProducerAlgo::maxCellsEneDensperthick_
private

Definition at line 438 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxClEnepermultiplicity_

double HGVHistoProducerAlgo::maxClEnepermultiplicity_
private

Definition at line 450 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxClEneperthickperlayer_

double HGVHistoProducerAlgo::maxClEneperthickperlayer_
private

Definition at line 436 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxDisSeedToMaxperthickperlayer_

double HGVHistoProducerAlgo::maxDisSeedToMaxperthickperlayer_
private

Definition at line 434 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxDisToMaxperthickperlayer_

double HGVHistoProducerAlgo::maxDisToMaxperthickperlayer_
private

Definition at line 430 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxDisToMaxperthickperlayerenewei_

double HGVHistoProducerAlgo::maxDisToMaxperthickperlayerenewei_
private

Definition at line 432 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxDisToSeedperthickperlayer_

double HGVHistoProducerAlgo::maxDisToSeedperthickperlayer_
private

Definition at line 426 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxDisToSeedperthickperlayerenewei_

double HGVHistoProducerAlgo::maxDisToSeedperthickperlayerenewei_
private

Definition at line 428 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxEne_

double HGVHistoProducerAlgo::maxEne_
private

◆ maxEneCl_

double HGVHistoProducerAlgo::maxEneCl_
private

Definition at line 401 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxEneClperlay_

double HGVHistoProducerAlgo::maxEneClperlay_
private

Definition at line 411 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxEta_

double HGVHistoProducerAlgo::maxEta_
private

◆ maxLongDepBary_

double HGVHistoProducerAlgo::maxLongDepBary_
private

Definition at line 403 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxMixedHitsCluster_

double HGVHistoProducerAlgo::maxMixedHitsCluster_
private

Definition at line 399 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxMixedHitsSimCluster_

double HGVHistoProducerAlgo::maxMixedHitsSimCluster_
private

Definition at line 397 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ maxMplofLCs_

double HGVHistoProducerAlgo::maxMplofLCs_
private

Definition at line 446 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxPhi_

double HGVHistoProducerAlgo::maxPhi_
private

◆ maxPt_

double HGVHistoProducerAlgo::maxPt_
private

◆ maxScore_

double HGVHistoProducerAlgo::maxScore_
private

◆ maxSharedEneFrac_

double HGVHistoProducerAlgo::maxSharedEneFrac_
private

◆ maxSizeCLsinTSTs_

double HGVHistoProducerAlgo::maxSizeCLsinTSTs_
private

Definition at line 448 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxTotNcellsperthickperlayer_

double HGVHistoProducerAlgo::maxTotNcellsperthickperlayer_
private

Definition at line 424 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ maxTotNClsinTSTs_

double HGVHistoProducerAlgo::maxTotNClsinTSTs_
private

Definition at line 442 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxTotNClsinTSTsperlayer_

double HGVHistoProducerAlgo::maxTotNClsinTSTsperlayer_
private

Definition at line 444 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxTotNClsperlay_

double HGVHistoProducerAlgo::maxTotNClsperlay_
private

Definition at line 409 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxTotNClsperthick_

double HGVHistoProducerAlgo::maxTotNClsperthick_
private

Definition at line 422 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ maxTotNsimClsperlay_

double HGVHistoProducerAlgo::maxTotNsimClsperlay_
private

Definition at line 407 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ maxTotNsimClsperthick_

double HGVHistoProducerAlgo::maxTotNsimClsperthick_
private

Definition at line 420 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ maxTotNTSTs_

double HGVHistoProducerAlgo::maxTotNTSTs_
private

Definition at line 440 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxTSTSharedEneFrac_

double HGVHistoProducerAlgo::maxTSTSharedEneFrac_
private

Definition at line 418 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterSTSHistos().

◆ maxX_

double HGVHistoProducerAlgo::maxX_
private

Definition at line 452 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxY_

double HGVHistoProducerAlgo::maxY_
private

Definition at line 454 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxZ_

double HGVHistoProducerAlgo::maxZ_
private

Definition at line 456 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ maxZpos_

double HGVHistoProducerAlgo::maxZpos_
private

Definition at line 405 of file HGVHistoProducerAlgo.h.

Referenced by bookCaloParticleHistos().

◆ minCellsEneDensperthick_

double HGVHistoProducerAlgo::minCellsEneDensperthick_
private

Definition at line 438 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minClEnepermultiplicity_

double HGVHistoProducerAlgo::minClEnepermultiplicity_
private

Definition at line 450 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minClEneperthickperlayer_

double HGVHistoProducerAlgo::minClEneperthickperlayer_
private

Definition at line 436 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minDisSeedToMaxperthickperlayer_

double HGVHistoProducerAlgo::minDisSeedToMaxperthickperlayer_
private

Definition at line 434 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minDisToMaxperthickperlayer_

double HGVHistoProducerAlgo::minDisToMaxperthickperlayer_
private

Definition at line 430 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minDisToMaxperthickperlayerenewei_

double HGVHistoProducerAlgo::minDisToMaxperthickperlayerenewei_
private

Definition at line 432 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minDisToSeedperthickperlayer_

double HGVHistoProducerAlgo::minDisToSeedperthickperlayer_
private

Definition at line 426 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minDisToSeedperthickperlayerenewei_

double HGVHistoProducerAlgo::minDisToSeedperthickperlayerenewei_
private

Definition at line 428 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minEne_

double HGVHistoProducerAlgo::minEne_
private

◆ minEneCl_

double HGVHistoProducerAlgo::minEneCl_
private

Definition at line 401 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minEneClperlay_

double HGVHistoProducerAlgo::minEneClperlay_
private

Definition at line 411 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minEta_

double HGVHistoProducerAlgo::minEta_
private

◆ minLongDepBary_

double HGVHistoProducerAlgo::minLongDepBary_
private

Definition at line 403 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minMixedHitsCluster_

double HGVHistoProducerAlgo::minMixedHitsCluster_
private

Definition at line 399 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minMixedHitsSimCluster_

double HGVHistoProducerAlgo::minMixedHitsSimCluster_
private

Definition at line 397 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ minMplofLCs_

double HGVHistoProducerAlgo::minMplofLCs_
private

Definition at line 446 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minPhi_

double HGVHistoProducerAlgo::minPhi_
private

◆ minPt_

double HGVHistoProducerAlgo::minPt_
private

◆ minScore_

double HGVHistoProducerAlgo::minScore_
private

◆ minSharedEneFrac_

double HGVHistoProducerAlgo::minSharedEneFrac_
private

◆ minSizeCLsinTSTs_

double HGVHistoProducerAlgo::minSizeCLsinTSTs_
private

Definition at line 448 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minTotNcellsperthickperlayer_

double HGVHistoProducerAlgo::minTotNcellsperthickperlayer_
private

Definition at line 424 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ minTotNClsinTSTs_

double HGVHistoProducerAlgo::minTotNClsinTSTs_
private

Definition at line 442 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minTotNClsinTSTsperlayer_

double HGVHistoProducerAlgo::minTotNClsinTSTsperlayer_
private

Definition at line 444 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minTotNClsperlay_

double HGVHistoProducerAlgo::minTotNClsperlay_
private

Definition at line 409 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minTotNClsperthick_

double HGVHistoProducerAlgo::minTotNClsperthick_
private

Definition at line 422 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ minTotNsimClsperlay_

double HGVHistoProducerAlgo::minTotNsimClsperlay_
private

Definition at line 407 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ minTotNsimClsperthick_

double HGVHistoProducerAlgo::minTotNsimClsperthick_
private

Definition at line 420 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ minTotNTSTs_

double HGVHistoProducerAlgo::minTotNTSTs_
private

Definition at line 440 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minTSTSharedEneFrac_

double HGVHistoProducerAlgo::minTSTSharedEneFrac_
private

Definition at line 418 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterSTSHistos().

◆ minTSTSharedEneFracEfficiency_

double HGVHistoProducerAlgo::minTSTSharedEneFracEfficiency_
private

Definition at line 417 of file HGVHistoProducerAlgo.h.

Referenced by tracksters_to_SimTracksters().

◆ minX_

double HGVHistoProducerAlgo::minX_
private

Definition at line 452 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minY_

double HGVHistoProducerAlgo::minY_
private

Definition at line 454 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minZ_

double HGVHistoProducerAlgo::minZ_
private

Definition at line 456 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ minZpos_

double HGVHistoProducerAlgo::minZpos_
private

Definition at line 405 of file HGVHistoProducerAlgo.h.

Referenced by bookCaloParticleHistos().

◆ nintCellsEneDensperthick_

int HGVHistoProducerAlgo::nintCellsEneDensperthick_
private

Definition at line 439 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintClEnepermultiplicity_

int HGVHistoProducerAlgo::nintClEnepermultiplicity_
private

Definition at line 451 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintClEneperthickperlayer_

int HGVHistoProducerAlgo::nintClEneperthickperlayer_
private

Definition at line 437 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintDisSeedToMaxperthickperlayer_

int HGVHistoProducerAlgo::nintDisSeedToMaxperthickperlayer_
private

Definition at line 435 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintDisToMaxperthickperlayer_

int HGVHistoProducerAlgo::nintDisToMaxperthickperlayer_
private

Definition at line 431 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintDisToMaxperthickperlayerenewei_

int HGVHistoProducerAlgo::nintDisToMaxperthickperlayerenewei_
private

Definition at line 433 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintDisToSeedperthickperlayer_

int HGVHistoProducerAlgo::nintDisToSeedperthickperlayer_
private

Definition at line 427 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintDisToSeedperthickperlayerenewei_

int HGVHistoProducerAlgo::nintDisToSeedperthickperlayerenewei_
private

Definition at line 429 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintEne_

int HGVHistoProducerAlgo::nintEne_
private

◆ nintEneCl_

int HGVHistoProducerAlgo::nintEneCl_
private

Definition at line 402 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintEneClperlay_

int HGVHistoProducerAlgo::nintEneClperlay_
private

Definition at line 412 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintEta_

int HGVHistoProducerAlgo::nintEta_
private

◆ nintLongDepBary_

int HGVHistoProducerAlgo::nintLongDepBary_
private

Definition at line 404 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintMixedHitsCluster_

int HGVHistoProducerAlgo::nintMixedHitsCluster_
private

Definition at line 400 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintMixedHitsSimCluster_

int HGVHistoProducerAlgo::nintMixedHitsSimCluster_
private

Definition at line 398 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ nintMplofLCs_

int HGVHistoProducerAlgo::nintMplofLCs_
private

Definition at line 447 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintPhi_

int HGVHistoProducerAlgo::nintPhi_
private

◆ nintPt_

int HGVHistoProducerAlgo::nintPt_
private

◆ nintScore_

int HGVHistoProducerAlgo::nintScore_
private

◆ nintSharedEneFrac_

int HGVHistoProducerAlgo::nintSharedEneFrac_
private

◆ nintSizeCLsinTSTs_

int HGVHistoProducerAlgo::nintSizeCLsinTSTs_
private

Definition at line 449 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintTotNcellsperthickperlayer_

int HGVHistoProducerAlgo::nintTotNcellsperthickperlayer_
private

Definition at line 425 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_CellLevel().

◆ nintTotNClsinTSTs_

int HGVHistoProducerAlgo::nintTotNClsinTSTs_
private

Definition at line 443 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintTotNClsinTSTsperlayer_

int HGVHistoProducerAlgo::nintTotNClsinTSTsperlayer_
private

Definition at line 445 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintTotNClsperlay_

int HGVHistoProducerAlgo::nintTotNClsperlay_
private

Definition at line 410 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintTotNClsperthick_

int HGVHistoProducerAlgo::nintTotNClsperthick_
private

Definition at line 423 of file HGVHistoProducerAlgo.h.

Referenced by bookClusterHistos_ClusterLevel().

◆ nintTotNsimClsperlay_

int HGVHistoProducerAlgo::nintTotNsimClsperlay_
private

Definition at line 408 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ nintTotNsimClsperthick_

int HGVHistoProducerAlgo::nintTotNsimClsperthick_
private

Definition at line 421 of file HGVHistoProducerAlgo.h.

Referenced by bookSimClusterHistos().

◆ nintTotNTSTs_

int HGVHistoProducerAlgo::nintTotNTSTs_
private

Definition at line 441 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintTSTSharedEneFrac_

int HGVHistoProducerAlgo::nintTSTSharedEneFrac_
private

Definition at line 419 of file HGVHistoProducerAlgo.h.

◆ nintX_

int HGVHistoProducerAlgo::nintX_
private

Definition at line 453 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintY_

int HGVHistoProducerAlgo::nintY_
private

Definition at line 455 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintZ_

int HGVHistoProducerAlgo::nintZ_
private

Definition at line 457 of file HGVHistoProducerAlgo.h.

Referenced by bookTracksterHistos().

◆ nintZpos_

int HGVHistoProducerAlgo::nintZpos_
private

Definition at line 406 of file HGVHistoProducerAlgo.h.

Referenced by bookCaloParticleHistos().

◆ recHitTools_

std::shared_ptr<hgcal::RecHitTools> HGVHistoProducerAlgo::recHitTools_
private

◆ useFabsEta_

bool HGVHistoProducerAlgo::useFabsEta_
private

Definition at line 390 of file HGVHistoProducerAlgo.h.

Referenced by getEta().