Go to the documentation of this file.00001 #ifndef TrackingAnalysis_TrackingTruthProducer_h
00002 #define TrackingAnalysis_TrackingTruthProducer_h
00003
00004 #include <map>
00005
00006 #include "DataFormats/Common/interface/Handle.h"
00007
00008 #include "FWCore/Framework/interface/EDProducer.h"
00009 #include "FWCore/Framework/interface/Event.h"
00010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00011
00012 #include "CommonTools/RecoAlgos/interface/TrackingParticleSelector.h"
00013
00014 #include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
00015 #include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
00016 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00017 #include "SimDataFormats/Track/interface/SimTrack.h"
00018 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00019 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
00020 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h"
00021 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
00022
00023 #include "SimGeneral/TrackingAnalysis/interface/EncodedTruthId.h"
00024 #include "SimGeneral/TrackingAnalysis/interface/MuonPSimHitSelector.h"
00025 #include "SimGeneral/TrackingAnalysis/interface/PixelPSimHitSelector.h"
00026 #include "SimGeneral/TrackingAnalysis/interface/PSimHitSelector.h"
00027 #include "SimGeneral/TrackingAnalysis/interface/TrackerPSimHitSelector.h"
00028
00029 #include "Utilities/Timing/interface/TimingReport.h"
00030 #include "Utilities/Timing/interface/TimerStack.h"
00031
00032
00033
00034
00035 class TrackingTruthProducer : public edm::EDProducer
00036 {
00037
00038 public:
00039
00040 explicit TrackingTruthProducer( const edm::ParameterSet & );
00041
00042 private:
00043
00044 void produce( edm::Event &, const edm::EventSetup & );
00045
00046 int LayerFromDetid(const unsigned int&);
00047
00048 edm::ParameterSet conf_;
00049
00050 std::vector<std::string> dataLabels_;
00051 bool useMultipleHepMCLabels_;
00052 double distanceCut_;
00053 std::vector<std::string> hitLabelsVector_;
00054 double volumeRadius_;
00055 double volumeZ_;
00056 bool mergedBremsstrahlung_;
00057 bool removeDeadModules_;
00058 std::string simHitLabel_;
00059
00060 std::string MessageCategory_;
00061
00062
00063
00064 std::vector<edm::Handle<edm::HepMCProduct> > hepMCProducts_;
00065
00066 PSimHitSelector::PSimHitCollection pSimHits_;
00067
00068 PSimHitSelector pSimHitSelector_;
00069 PixelPSimHitSelector pixelPSimHitSelector_;
00070 TrackerPSimHitSelector trackerPSimHitSelector_;
00071 MuonPSimHitSelector muonPSimHitSelector_;
00072
00073 std::auto_ptr<MixCollection<SimTrack> > simTracks_;
00074 std::auto_ptr<MixCollection<SimVertex> > simVertexes_;
00075
00076 std::auto_ptr<TrackingParticleCollection> trackingParticles_;
00077 std::auto_ptr<TrackingVertexCollection> trackingVertexes_;
00078
00079 TrackingParticleRefProd refTrackingParticles_;
00080 TrackingVertexRefProd refTrackingVertexes_;
00081
00082 std::auto_ptr<TrackingParticleCollection> mergedTrackingParticles_;
00083 std::auto_ptr<TrackingVertexCollection> mergedTrackingVertexes_;
00084 TrackingParticleRefProd refMergedTrackingParticles_;
00085 TrackingVertexRefProd refMergedTrackingVertexes_;
00086
00087 typedef std::map<EncodedEventId, unsigned int> EncodedEventIdToIndex;
00088 typedef std::map<EncodedTruthId, unsigned int> EncodedTruthIdToIndex;
00089 typedef std::multimap<EncodedTruthId, unsigned int> EncodedTruthIdToIndexes;
00090
00091 EncodedEventIdToIndex eventIdCounter_;
00092 EncodedTruthIdToIndexes trackIdToHits_;
00093 EncodedTruthIdToIndex trackIdToIndex_;
00094 EncodedTruthIdToIndex vertexIdToIndex_;
00095
00096 bool selectorFlag_;
00097 TrackingParticleSelector selector_;
00098
00099 void associator(
00100 std::vector<PSimHit> const &,
00101 EncodedTruthIdToIndexes &
00102 );
00103
00104 void associator(
00105 std::auto_ptr<MixCollection<SimTrack> > const &,
00106 EncodedTruthIdToIndex &
00107 );
00108
00109 void associator(
00110 std::auto_ptr<MixCollection<SimVertex> > const &,
00111 EncodedTruthIdToIndex &
00112 );
00113
00114 void mergeBremsstrahlung();
00115
00116 bool isBremsstrahlungVertex(
00117 TrackingVertex const & vertex,
00118 std::auto_ptr<TrackingParticleCollection> & tPC
00119 );
00120
00121 void createTrackingTruth();
00122
00123 bool setTrackingParticle(
00124 SimTrack const &,
00125 TrackingParticle &
00126 );
00127
00128 int setTrackingVertex(
00129 SimVertex const &,
00130 TrackingVertex &
00131 );
00132
00133 void addCloseGenVertexes(TrackingVertex &);
00134 };
00135
00136
00137 #endif