CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h

Go to the documentation of this file.
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 
00026 //--- for SimHit
00027 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00028 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00029 
00030 #include "DataFormats/Common/interface/DetSetVector.h"
00031 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
00032 #include "SimDataFormats/TrackerDigiSimLink/interface/PixelDigiSimLink.h"
00033 #include "SimDataFormats/TrackerDigiSimLink/interface/StripDigiSimLink.h"
00034 
00035 //--- for RecHit
00036 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00037 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00038 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
00039 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
00040 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.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   void associateHitId(const TrackingRecHit & thit,std::vector<SimHitIdpr> &simhitid);
00074   //  std::vector<SimHitIdpr> associateSimpleRecHit(const SiStripRecHit2D * simplerechit);
00075   void associateSimpleRecHit(const SiStripRecHit2D * simplerechit,std::vector<SimHitIdpr> & simhitid);
00076   void associateSiStripRecHit1D(const SiStripRecHit1D * simplerechit,std::vector<SimHitIdpr> & simhitid);
00077   void associateSimpleRecHitCluster(const SiStripCluster* clust,
00078                                     const uint32_t& detID,
00079                                     std::vector<SimHitIdpr>& theSimtrackid,
00080                                     std::vector<PSimHit>& simhit);
00081   void associateSimpleRecHitCluster(const SiStripCluster* clust,
00082                                     const uint32_t& detID,
00083                                     std::vector<PSimHit>& simhit);
00084   void associateSimpleRecHitCluster(const SiStripCluster* clust,
00085                                     const uint32_t& detID,
00086                                     std::vector<SimHitIdpr>& simtrackid);
00087 
00088   std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit);
00089   std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D * projectedrechit);
00090   //  std::vector<SimHitIdpr> associatePixelRecHit(const SiPixelRecHit * pixelrechit);
00091   void associatePixelRecHit(const SiPixelRecHit * pixelrechit, std::vector<SimHitIdpr> & simhitid);
00092   std::vector<SimHitIdpr> associateGSRecHit(const SiTrackerGSRecHit2D * gsrechit);
00093   std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit * multirechit);
00094   std::vector<PSimHit>    associateMultiRecHit(const SiTrackerMultiRecHit * multirechit);
00095   std::vector<SimHitIdpr> associateGSMatchedRecHit(const SiTrackerGSMatchedRecHit2D * gsmrechit);
00096   
00097   std::vector<PSimHit> theStripHits;
00098   typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map;
00099   typedef simhit_map::iterator simhit_map_iterator;
00100   simhit_map SimHitMap;
00101   std::vector<PSimHit> thePixelHits;
00102  
00103  private:
00104   const edm::Event& myEvent_;
00105   typedef std::vector<std::string> vstring;
00106   vstring trackerContainers;
00107 
00108   //ADDED NOW AS A PRIVATE MEMBER
00109   edm::Handle<CrossingFrame<PSimHit> > cf_simhit;
00110   std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec;
00111   MixCollection<PSimHit>  TrackerHits;
00112 
00113   edm::Handle< edm::DetSetVector<StripDigiSimLink> >  stripdigisimlink;
00114   edm::Handle< edm::DetSetVector<PixelDigiSimLink> >  pixeldigisimlink;
00115   //vector with the trackIds
00116   //  std::vector<unsigned int> simtrackid; 
00117   std::vector<SimHitIdpr> simtrackid; 
00118   //vector with the simhits
00119   std::vector<int> simhitCFPos;
00120   std::vector<PSimHit> simhitassoc;
00121   bool StripHits;
00122   
00123   bool doPixel_, doStrip_, doTrackAssoc_;
00124   
00125 };  
00126 
00127 
00128 #endif
00129