CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 #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/SiStripRecHit1D.h"
00042 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h"
00043 #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h"
00044 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSRecHit2D.h"
00045 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerMultiRecHit.h"
00046 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerGSMatchedRecHit2D.h"
00047 
00048 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00049 
00050 #include <string>
00051 #include <vector>
00052 
00053 typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
00054 
00055 class TrackerHitAssociator {
00056   
00057  public:
00058   
00059   // Simple constructor
00060   TrackerHitAssociator(const edm::Event& e);
00061   // Constructor with configurables
00062   TrackerHitAssociator(const edm::Event& e, const edm::ParameterSet& conf);
00063   // Destructor
00064   virtual ~TrackerHitAssociator(){}
00065   
00066   std::vector<PSimHit> associateHit(const TrackingRecHit & thit);
00067   /*  std::vector<unsigned int> associateHitId(const TrackingRecHit & thit);
00068       std::vector<unsigned int> associateSimpleRecHit(const SiStripRecHit2D * simplerechit);
00069       std::vector<unsigned int> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit);
00070       std::vector<unsigned int> associatePixelRecHit(const SiPixelRecHit * pixelrechit);
00071   */
00072   //for PU events
00073   std::vector<SimHitIdpr> associateHitId(const TrackingRecHit & thit);
00074   void associateHitId(const TrackingRecHit & thit,std::vector<SimHitIdpr> &simhitid);
00075   //  std::vector<SimHitIdpr> associateSimpleRecHit(const SiStripRecHit2D * simplerechit);
00076   void associateSimpleRecHit(const SiStripRecHit2D * simplerechit,std::vector<SimHitIdpr> & simhitid);
00077   void associateSiStripRecHit1D(const SiStripRecHit1D * simplerechit,std::vector<SimHitIdpr> & simhitid);
00078   void associateSimpleRecHitCluster(const SiStripCluster* clust,
00079                                     std::vector<SimHitIdpr>& theSimtrackid,
00080                                     std::vector<PSimHit>& simhit);
00081   void associateSimpleRecHitCluster(const SiStripCluster* clust, std::vector<PSimHit>& simhit);
00082   void associateSimpleRecHitCluster(const SiStripCluster* clust, std::vector<SimHitIdpr>& simtrackid);
00083 
00084   std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit);
00085   std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D * projectedrechit);
00086   //  std::vector<SimHitIdpr> associatePixelRecHit(const SiPixelRecHit * pixelrechit);
00087   void associatePixelRecHit(const SiPixelRecHit * pixelrechit, std::vector<SimHitIdpr> & simhitid);
00088   std::vector<SimHitIdpr> associateGSRecHit(const SiTrackerGSRecHit2D * gsrechit);
00089   std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit * multirechit);
00090   std::vector<PSimHit>    associateMultiRecHit(const SiTrackerMultiRecHit * multirechit);
00091   std::vector<SimHitIdpr> associateGSMatchedRecHit(const SiTrackerGSMatchedRecHit2D * gsmrechit);
00092   
00093   std::vector<PSimHit> theStripHits;
00094   typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map;
00095   typedef simhit_map::iterator simhit_map_iterator;
00096   simhit_map SimHitMap;
00097   std::vector<PSimHit> thePixelHits;
00098  
00099  private:
00100   const edm::Event& myEvent_;
00101   typedef std::vector<std::string> vstring;
00102   vstring trackerContainers;
00103 
00104   //ADDED NOW AS A PRIVATE MEMBER
00105   edm::Handle<CrossingFrame<PSimHit> > cf_simhit;
00106   std::vector<const CrossingFrame<PSimHit> *> cf_simhitvec;
00107   MixCollection<PSimHit>  TrackerHits;
00108 
00109   edm::Handle< edm::DetSetVector<StripDigiSimLink> >  stripdigisimlink;
00110   edm::Handle< edm::DetSetVector<PixelDigiSimLink> >  pixeldigisimlink;
00111   //vector with the trackIds
00112   //  std::vector<unsigned int> simtrackid; 
00113   std::vector<SimHitIdpr> simtrackid; 
00114   //vector with the simhits
00115   std::vector<int> simhitCFPos;
00116   std::vector<PSimHit> simhitassoc;
00117   bool StripHits;
00118   
00119   bool doPixel_, doStrip_, doTrackAssoc_;
00120   
00121 };  
00122 
00123 
00124 #endif
00125