CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Calibration/IsolatedParticles/interface/CaloSimInfo.h

Go to the documentation of this file.
00001 // -*- C++ -*
00002 /* 
00003 Functions to give the details of parent track of SimHits.
00004 
00005 Authors:  Seema Sharma, Sunanda Banerjee
00006 Created: August 2009
00007 */
00008 
00009 #ifndef CalibrationIsolatedParticlesCaloSimInfo_h
00010 #define CalibrationIsolatedParticlesCaloSimInfo_h
00011 
00012 // system include files
00013 #include <memory>
00014 #include <map>
00015 #include <vector>
00016 #include <string>
00017 
00018 // user include files
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 
00021 #include "FWCore/Framework/interface/Event.h"
00022 
00023 #include "DataFormats/Common/interface/Handle.h"
00024 #include "DataFormats/TrackReco/interface/Track.h"
00025 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00026 #include "DataFormats/DetId/interface/DetId.h"
00027 #include "DataFormats/Candidate/interface/Candidate.h"
00028 
00029 #include "SimDataFormats/Track/interface/SimTrack.h"
00030 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00031 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00032 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00033 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
00034 
00035 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00036 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00037 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00038 #include "RecoCaloTools/Navigation/interface/CaloTowerNavigator.h"
00039 #include "Calibration/IsolatedParticles/interface/MatrixECALDetIds.h"
00040 
00041 namespace spr{
00042 
00043   struct caloSimInfo {
00044     caloSimInfo() {eMatched=eGamma=eNeutralHad=eChargedHad=eRest=eTotal=pdgMatched=0;}
00045     double pdgMatched;
00046     double eMatched;
00047     double eGamma;
00048     double eNeutralHad;
00049     double eChargedHad;
00050     double eRest;
00051     double eTotal;
00052   };
00053 
00054   // 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)
00055   template< typename T>
00056   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);
00057 
00058   template< typename T>
00059   std::map<std::string,double> 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, double timeCut=150, bool debug=false);
00060 
00061   // 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)
00062   template< typename T>
00063   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 ietaE, int ietaW, int iphiN, int iphiS, caloSimInfo& info, double timeCut=150, bool debug=false);
00064   
00065   // 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)
00066   template <typename T>
00067   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);
00068   template <typename T>
00069   void 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, caloSimInfo& info, double timeCut=150, bool includeHO=false, bool debug=false);
00070 
00071   //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)
00072   template <typename T>
00073   void 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 ietaE, int ietaW, int iphiN, int iphiS, caloSimInfo& info, double timeCut=150, bool includeHO=false, bool debug=false);
00074   
00075   // 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 
00076   template <typename T>
00077   std::map<std::string,double> eHCALSimInfo(const edm::Event& iEvent, 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, std::vector<int>& multiplicityVector, bool debug=false);
00078 
00079   // Actual function which does the matching of SimHits to SimTracks using geantTrackId
00080   template <typename T>
00081   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);
00082   template <typename T>
00083   void eCaloSimInfo(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, caloSimInfo& info, double timeCut=150, bool includeHO=false, bool debug=false);
00084   std::map<std::string,double> eCaloSimInfo (caloSimInfo& info);
00085 
00086   // Returns total energy of CaloSimHits which originate from the matching SimTrack
00087   template <typename T>
00088   double eCaloSimInfo(const edm::Event&, const CaloGeometry* geo, edm::Handle<T>& hits, edm::Handle<edm::SimTrackContainer>& SimTk, edm::Handle<edm::SimVertexContainer>& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, double timeCut=150, bool includeHO=false, bool debug=false);
00089 
00090   template <typename T>
00091   double eCaloSimInfo(const edm::Event&, const CaloGeometry* geo, edm::Handle<T>& hitsEB, edm::Handle<T>& hitsEE, edm::Handle<edm::SimTrackContainer>& SimTk, edm::Handle<edm::SimVertexContainer>& SimVtx, const reco::Track* pTrack, TrackerHitAssociator& associate, double timeCut=150, bool debug=false);
00092 
00093   template <typename T>
00094   std::map<std::string,double> eCaloSimInfo(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, std::vector<int>& multiplicityVector, bool debug=false);
00095 
00096   double timeOfFlight(DetId id, const CaloGeometry* geo, bool debug=false);
00097 }
00098 
00099 #include "Calibration/IsolatedParticles/interface/CaloSimInfo.icc"
00100 #endif