00001 #ifndef TrackerHitAssociator_h 00002 #define TrackerHitAssociator_h 00003 00004 /* \class TrackerHitAssociator 00005 * 00006 ** Associates SimHits and RecHits based on information produced during 00007 * digitisation (StripDigiSimLinks). 00008 * The association works in both ways: from a SimHit to RecHits and 00009 * from a RecHit to SimHits. 00010 * 00011 * \author Patrizia Azzi (INFN PD), Vincenzo Chiochia (Uni Zuerich) 00012 * 00013 * \version 1st version: April 2006. Add configurable switch: August 2006 00014 * 00015 * 00016 ************************************************************/ 00017 00018 //#include <vector> 00019 #include "FWCore/Framework/interface/EDAnalyzer.h" 00020 #include "FWCore/Framework/interface/Event.h" 00021 #include "FWCore/Framework/interface/EventSetup.h" 00022 #include "DataFormats/Common/interface/Handle.h" 00023 #include "FWCore/Framework/interface/ESHandle.h" 00024 #include "FWCore/Framework/interface/MakerMacros.h" 00025 #include "DataFormats/Common/interface/EDProduct.h" 00026 00027 //--- for SimHit 00028 #include "SimDataFormats/TrackingHit/interface/PSimHit.h" 00029 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" 00030 00031 #include "DataFormats/Common/interface/DetSetVector.h" 00032 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" 00033 #include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h" 00034 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h" 00035 00036 //--- for RecHit 00037 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h" 00038 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h" 00039 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h" 00040 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h" 00041 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" 00042 #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" 00043 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSRecHit2D.h" 00044 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerMultiRecHit.h" 00045 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSMatchedRecHit2D.h" 00046 00047 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h" 00048 00049 #include <string> 00050 #include <vector> 00051 00052 typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr; 00053 00054 class TrackerHitAssociator { 00055 00056 public: 00057 00058 // Simple constructor 00059 TrackerHitAssociator(const edm::Event& e); 00060 // Constructor with configurables 00061 TrackerHitAssociator(const edm::Event& e, const edm::ParameterSet& conf); 00062 // Destructor 00063 virtual ~TrackerHitAssociator(){} 00064 00065 std::vector<PSimHit> associateHit(const TrackingRecHit & thit); 00066 /* std::vector<unsigned int> associateHitId(const TrackingRecHit & thit); 00067 std::vector<unsigned int> associateSimpleRecHit(const SiStripRecHit2D * simplerechit); 00068 std::vector<unsigned int> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit); 00069 std::vector<unsigned int> associatePixelRecHit(const SiPixelRecHit * pixelrechit); 00070 */ 00071 //for PU events 00072 std::vector<SimHitIdpr> associateHitId(const TrackingRecHit & thit); 00073 std::vector<SimHitIdpr> associateSimpleRecHit(const SiStripRecHit2D * simplerechit); 00074 std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit); 00075 std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D * projectedrechit); 00076 std::vector<SimHitIdpr> associatePixelRecHit(const SiPixelRecHit * pixelrechit); 00077 std::vector<SimHitIdpr> associateGSRecHit(const SiTrackerGSRecHit2D * gsrechit); 00078 std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit * multirechit); 00079 std::vector<PSimHit> associateMultiRecHit(const SiTrackerMultiRecHit * multirechit); 00080 std::vector<SimHitIdpr> associateGSMatchedRecHit(const SiTrackerGSMatchedRecHit2D * gsmrechit); 00081 00082 std::vector<PSimHit> theStripHits; 00083 typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map; 00084 typedef simhit_map::iterator simhit_map_iterator; 00085 simhit_map SimHitMap; 00086 std::vector<PSimHit> thePixelHits; 00087 00088 private: 00089 const edm::Event& myEvent_; 00090 typedef std::vector<std::string> vstring; 00091 vstring trackerContainers; 00092 00093 //ADDED NOW AS A PRIVATE MEMBER 00094 edm::Handle<CrossingFrame<PSimHit> > cf_simhit; 00095 std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec; 00096 MixCollection<PSimHit> TrackerHits; 00097 00098 edm::Handle< edm::DetSetVector<StripDigiSimLink> > stripdigisimlink; 00099 edm::Handle< edm::DetSetVector<PixelDigiSimLink> > pixeldigisimlink; 00100 //vector with the trackIds 00101 // std::vector<unsigned int> simtrackid; 00102 std::vector<SimHitIdpr> simtrackid; 00103 //vector with the simhits 00104 std::vector<int> simhitCFPos; 00105 std::vector<PSimHit> simhitassoc; 00106 bool StripHits; 00107 00108 bool doPixel_, doStrip_, doTrackAssoc_; 00109 00110 }; 00111 00112 00113 #endif 00114