CMS 3D CMS Logo

CaloSimInfo.h
Go to the documentation of this file.
1 /*
2 Functions to give the details of parent track of SimHits.
3 
4 Authors: Seema Sharma, Sunanda Banerjee
5 Created: August 2009
6 */
7 
8 #ifndef CalibrationIsolatedParticlesCaloSimInfo_h
9 #define CalibrationIsolatedParticlesCaloSimInfo_h
10 
11 // system include files
12 #include <memory>
13 #include <map>
14 #include <vector>
15 #include <string>
16 
17 // user include files
20 
26 
32 
38 
39 namespace spr {
40 
41  struct caloSimInfo {
43  double pdgMatched;
44  double eMatched;
45  double eGamma;
46  double eNeutralHad;
47  double eChargedHad;
48  double eRest;
49  double eTotal;
50  };
51 
52  struct energyMap {
53  energyMap() { pdgId = 0; }
54  int pdgId;
55  std::vector<std::pair<DetId, double> > matched;
56  std::vector<std::pair<DetId, double> > gamma;
57  std::vector<std::pair<DetId, double> > charged;
58  std::vector<std::pair<DetId, double> > neutral;
59  std::vector<std::pair<DetId, double> > rest;
60  std::vector<std::pair<DetId, double> > all;
61  };
62 
63  // takes the EcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in a symmetric matrix (2*ieta+1)*(2*iphi+1)
64  template <typename T>
65  void eECALSimInfo(const edm::Event&,
66  const DetId& det,
67  const CaloGeometry* geo,
68  const CaloTopology* caloTopology,
69  edm::Handle<T>& hitsEB,
70  edm::Handle<T>& hitsEE,
73  const reco::Track* pTrack,
74  TrackerHitAssociator& associate,
75  int ieta,
76  int iphi,
78  double timeCut = 150,
79  bool debug = false);
80 
81  template <typename T>
82  std::map<std::string, double> eECALSimInfo(const edm::Event&,
83  const DetId& det,
84  const CaloGeometry* geo,
85  const CaloTopology* caloTopology,
86  edm::Handle<T>& hitsEB,
87  edm::Handle<T>& hitsEE,
90  const reco::Track* pTrack,
91  TrackerHitAssociator& associate,
92  int ieta,
93  int iphi,
94  double timeCut = 150,
95  bool debug = false);
96 
97  // takes the EcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in an symmetric matrix (ietaE+ietaW+1)*(iphiN+iphiS+1)
98  template <typename T>
99  void eECALSimInfo(const edm::Event&,
100  const DetId& det,
101  const CaloGeometry* geo,
102  const CaloTopology* caloTopology,
103  edm::Handle<T>& hitsEB,
104  edm::Handle<T>& hitsEE,
107  const reco::Track* pTrack,
108  TrackerHitAssociator& associate,
109  int ietaE,
110  int ietaW,
111  int iphiN,
112  int iphiS,
113  caloSimInfo& info,
114  double timeCut = 150,
115  bool debug = false);
116 
117  // takes the HcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in a symmetric matrix (2*ieta+1)*(2*iphi+1)
118  template <typename T>
119  std::map<std::string, double> eHCALSimInfo(const edm::Event&,
120  const HcalTopology* topology,
121  const DetId& det,
122  const CaloGeometry* geo,
126  const reco::Track* pTrack,
127  TrackerHitAssociator& associate,
128  int ieta,
129  int iphi,
130  double timeCut = 150,
131  bool includeHO = false,
132  bool debug = false);
133  template <typename T>
134  void eHCALSimInfo(const edm::Event&,
135  const HcalTopology* topology,
136  const DetId& det,
137  const CaloGeometry* geo,
141  const reco::Track* pTrack,
142  TrackerHitAssociator& associate,
143  int ieta,
144  int iphi,
145  caloSimInfo& info,
146  double timeCut = 150,
147  bool includeHO = false,
148  bool debug = false);
149 
150  //takes the HcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in an symmetric matrix (ietaE+ietaW+1)*(iphiN+iphiS+1)
151  template <typename T>
152  void eHCALSimInfo(const edm::Event&,
153  const HcalTopology* topology,
154  const DetId& det,
155  const CaloGeometry* geo,
159  const reco::Track* pTrack,
160  TrackerHitAssociator& associate,
161  int ietaE,
162  int ietaW,
163  int iphiN,
164  int iphiS,
165  caloSimInfo& info,
166  double timeCut = 150,
167  bool includeHO = false,
168  bool debug = false);
169 
170  // takes the HcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc. in a symmetric matrix (2*ieta+1)*(2*iphi+1) and also a multiplicity vector
171  template <typename T>
172  std::map<std::string, double> eHCALSimInfo(const edm::Event& iEvent,
173  const HcalTopology* topology,
174  const DetId& det,
178  const reco::Track* pTrack,
179  TrackerHitAssociator& associate,
180  int ieta,
181  int iphi,
182  std::vector<int>& multiplicityVector,
183  bool debug = false);
184 
185  // Actual function which does the matching of SimHits to SimTracks using geantTrackId
186  template <typename T>
187  void eCaloSimInfo(std::vector<DetId> vdets,
188  const CaloGeometry* geo,
189  edm::Handle<T>& hitsEB,
190  edm::Handle<T>& hitsEE,
193  edm::SimTrackContainer::const_iterator trkInfo,
194  caloSimInfo& info,
195  double timeCut = 150,
196  bool debug = false);
197  template <typename T>
198  void eCaloSimInfo(const CaloGeometry* geo,
202  std::vector<typename T::const_iterator> hit,
203  edm::SimTrackContainer::const_iterator trkInfo,
204  caloSimInfo& info,
205  double timeCut = 150,
206  bool includeHO = false,
207  bool debug = false);
208  std::map<std::string, double> eCaloSimInfo(caloSimInfo& info);
209 
210  // Returns total energy of CaloSimHits which originate from the matching SimTrack
211  template <typename T>
212  double eCaloSimInfo(const edm::Event&,
213  const CaloGeometry* geo,
217  const reco::Track* pTrack,
218  TrackerHitAssociator& associate,
219  double timeCut = 150,
220  bool includeHO = false,
221  bool debug = false);
222 
223  template <typename T>
224  double eCaloSimInfo(const edm::Event&,
225  const CaloGeometry* geo,
226  edm::Handle<T>& hitsEB,
227  edm::Handle<T>& hitsEE,
230  const reco::Track* pTrack,
231  TrackerHitAssociator& associate,
232  double timeCut = 150,
233  bool debug = false);
234 
235  template <typename T>
236  std::map<std::string, double> eCaloSimInfo(edm::Handle<T>& hits,
239  std::vector<typename T::const_iterator> hit,
240  edm::SimTrackContainer::const_iterator trkInfo,
241  std::vector<int>& multiplicityVector,
242  bool debug = false);
243 
244  double timeOfFlight(DetId id, const CaloGeometry* geo, bool debug = false);
245 
246  // takes the EcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc.
247  template <typename T>
248  std::map<std::string, double> eECALSimInfo(const edm::Event&,
250  const CaloGeometry* geo,
254  const reco::Track* pTrack,
255  TrackerHitAssociator& associate,
256  int ieta,
257  int iphi,
258  double timeCut = 150,
259  bool debug = false);
260 
261  template <typename T>
262  std::map<std::string, double> eECALSimInfoTotal(const edm::Event&,
263  const DetId& det,
264  const CaloGeometry* geo,
265  const CaloTopology* caloTopology,
266  edm::Handle<T>& hitsEB,
267  edm::Handle<T>& hitsEE,
270  const reco::Track* pTrack,
271  TrackerHitAssociator& associate,
272  int ieta,
273  int iphi,
274  int itry = -1,
275  double timeCut = 150,
276  bool debug = false);
277 
278  template <typename T>
280  const DetId& det,
281  const CaloGeometry* geo,
282  const CaloTopology* caloTopology,
283  edm::Handle<T>& hitsEB,
284  edm::Handle<T>& hitsEE,
287  const reco::Track* pTrack,
288  TrackerHitAssociator& associate,
289  int ieta,
290  int iphi,
291  double timeCut = 150,
292  bool debug = false);
293 
294  // takes the HcalSimHits and returns a map energy matched to SimTrack, photons, neutral hadrons etc.
295  template <typename T>
296  std::map<std::string, double> eHCALSimInfoTotal(const edm::Event&,
297  const HcalTopology* topology,
298  const DetId& det,
299  const CaloGeometry* geo,
303  const reco::Track* pTrack,
304  TrackerHitAssociator& associate,
305  int ieta,
306  int iphi,
307  int itry = -1,
308  double timeCut = 150,
309  bool includeHO = false,
310  bool debug = false);
311 
312  template <typename T>
314  const HcalTopology* topology,
315  const DetId& det,
316  const CaloGeometry* geo,
320  const reco::Track* pTrack,
321  TrackerHitAssociator& associate,
322  int ieta,
323  int iphi,
324  double timeCut = 150,
325  bool includeHO = false,
326  bool debug = false);
327 
328  // Actual function which does the matching of SimHits to SimTracks using geantTrackId
329  template <typename T>
334  std::vector<typename T::const_iterator> hit,
335  edm::SimTrackContainer::const_iterator trkInfo,
336  double timeCut = 150,
337  bool includeHO = false,
338  bool debug = false);
339 
340  // Functions to study the Hits for which history cannot be traced back
341  template <typename T>
342  std::vector<typename T::const_iterator> missedECALHits(const edm::Event&,
347  const reco::Track* pTrack,
348  TrackerHitAssociator& associate,
349  int ieta,
350  int iphi,
351  bool flag,
352  bool debug = false);
353 
354  template <typename T>
355  std::vector<typename T::const_iterator> missedHCALHits(const edm::Event&,
356  const HcalTopology* topology,
357  const DetId& det,
361  const reco::Track* pTrack,
362  TrackerHitAssociator& associate,
363  int ieta,
364  int iphi,
365  bool flag,
366  bool includeHO = false,
367  bool debug = false);
368 
369  template <typename T>
370  std::vector<typename T::const_iterator> missedCaloHits(edm::Handle<T>& hits,
371  std::vector<int> matchedId,
372  std::vector<typename T::const_iterator> caloHits,
373  bool flag,
374  bool includeHO = false,
375  bool debug = false);
376 } // namespace spr
377 
378 #include "Calibration/IsolatedParticles/interface/CaloSimInfo.icc"
379 #endif
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< std::pair< DetId, double > > charged
Definition: CaloSimInfo.h:57
void eCaloSimInfo(std::vector< DetId > vdets, const CaloGeometry *geo, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, edm::SimTrackContainer::const_iterator trkInfo, caloSimInfo &info, double timeCut=150, bool debug=false)
std::vector< std::pair< DetId, double > > gamma
Definition: CaloSimInfo.h:56
std::vector< std::pair< DetId, double > > neutral
Definition: CaloSimInfo.h:58
energyMap caloSimInfoMatrix(const CaloGeometry *geo, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, std::vector< typename T::const_iterator > hit, edm::SimTrackContainer::const_iterator trkInfo, double timeCut=150, bool includeHO=false, bool debug=false)
std::vector< std::pair< DetId, double > > matched
Definition: CaloSimInfo.h:55
std::vector< std::pair< DetId, double > > rest
Definition: CaloSimInfo.h:59
energyMap eECALSimInfoMatrix(const edm::Event &, const DetId &det, const CaloGeometry *geo, const CaloTopology *caloTopology, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, double timeCut=150, bool debug=false)
std::map< std::string, double > eECALSimInfoTotal(const edm::Event &, const DetId &det, const CaloGeometry *geo, const CaloTopology *caloTopology, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, int itry=-1, double timeCut=150, bool debug=false)
std::vector< std::pair< DetId, double > > all
Definition: CaloSimInfo.h:60
std::map< std::string, double > eHCALSimInfoTotal(const edm::Event &, const HcalTopology *topology, const DetId &det, const CaloGeometry *geo, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, int itry=-1, double timeCut=150, bool includeHO=false, bool debug=false)
double eNeutralHad
Definition: CaloSimInfo.h:46
double eChargedHad
Definition: CaloSimInfo.h:47
std::vector< typename T::const_iterator > missedHCALHits(const edm::Event &, const HcalTopology *topology, const DetId &det, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, bool flag, bool includeHO=false, bool debug=false)
int iEvent
Definition: GenABIO.cc:224
std::map< std::string, double > eHCALSimInfo(const edm::Event &, const HcalTopology *topology, const DetId &det, const CaloGeometry *geo, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, double timeCut=150, bool includeHO=false, bool debug=false)
Definition: DetId.h:17
#define debug
Definition: HDRShower.cc:19
void eECALSimInfo(const edm::Event &, const DetId &det, const CaloGeometry *geo, const CaloTopology *caloTopology, edm::Handle< T > &hitsEB, edm::Handle< T > &hitsEE, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, caloSimInfo &info, double timeCut=150, bool debug=false)
std::vector< typename T::const_iterator > missedCaloHits(edm::Handle< T > &hits, std::vector< int > matchedId, std::vector< typename T::const_iterator > caloHits, bool flag, bool includeHO=false, bool debug=false)
energyMap eHCALSimInfoMatrix(const edm::Event &, const HcalTopology *topology, const DetId &det, const CaloGeometry *geo, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, double timeCut=150, bool includeHO=false, bool debug=false)
double timeOfFlight(DetId id, const CaloGeometry *geo, bool debug=false)
Definition: CaloSimInfo.cc:15
std::vector< typename T::const_iterator > missedECALHits(const edm::Event &, CaloNavigator< DetId > &navigator, edm::Handle< T > &hits, edm::Handle< edm::SimTrackContainer > &SimTk, edm::Handle< edm::SimVertexContainer > &SimVtx, const reco::Track *pTrack, TrackerHitAssociator &associate, int ieta, int iphi, bool flag, bool debug=false)