Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-16 23:02:14

0001 
0002 #ifndef VertexClassifier_h
0003 #define VertexClassifier_h
0004 
0005 #include "FWCore/Framework/interface/ConsumesCollector.h"
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "FWCore/Utilities/interface/InputTag.h"
0008 
0009 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0010 
0011 #include "SimGeneral/HepPDTRecord/interface/ParticleDataTable.h"
0012 
0013 #include "SimTracker/TrackHistory/interface/CMSProcessTypes.h"
0014 #include "SimTracker/TrackHistory/interface/VertexCategories.h"
0015 #include "SimTracker/TrackHistory/interface/VertexHistory.h"
0016 
0017 //! Get track history and classify it in function of their .
0018 class VertexClassifier : public VertexCategories {
0019 public:
0020   //! Type to the associate category
0021   typedef VertexCategories Categories;
0022 
0023   //! Constructor by ParameterSet
0024   VertexClassifier(edm::ParameterSet const &pset, edm::ConsumesCollector);
0025 
0026   virtual ~VertexClassifier() {}
0027 
0028   //! Pre-process event information (for accessing reconstraction information)
0029   virtual void newEvent(edm::Event const &, edm::EventSetup const &);
0030 
0031   //! Classify the RecoVertex in categories.
0032   VertexClassifier const &evaluate(reco::VertexBaseRef const &);
0033 
0034   //! Classify the TrackingVertex in categories.
0035   VertexClassifier const &evaluate(TrackingVertexRef const &);
0036 
0037   //! Classify the RecoVertex in categories.
0038   VertexClassifier const &evaluate(reco::VertexRef const &vertex) { return evaluate(reco::VertexBaseRef(vertex)); }
0039 
0040   //! Returns a reference to the vertex history used in the classification.
0041   VertexHistory const &history() const { return tracer_; }
0042 
0043 private:
0044   VertexHistory tracer_;
0045 
0046   const G4toCMSLegacyProcTypeMap g4toCMSProcMap_;
0047 
0048   const edm::InputTag hepMCLabel_;
0049 
0050   double longLivedDecayLength_;
0051   double vertexClusteringDistance_;
0052 
0053   edm::Handle<edm::HepMCProduct> mcInformation_;
0054 
0055   edm::ESHandle<ParticleDataTable> particleDataTable_;
0056   edm::ESGetToken<ParticleDataTable, edm::DefaultRecord> particleDataTableToken_;
0057 
0058   //! Get reconstruction information
0059   void reconstructionInformation(reco::TrackBaseRef const &);
0060 
0061   //! Get all the information related to the simulation details
0062   void simulationInformation();
0063 
0064   //! Get all the information related to decay process
0065   void processesAtGenerator();
0066 
0067   //! Get information about conversion and other interactions
0068   void processesAtSimulation();
0069 
0070   //! Get geometrical information about the vertices
0071   void vertexInformation();
0072 
0073   //! Auxiliary class holding simulated primary vertices
0074   struct GeneratedPrimaryVertex {
0075     GeneratedPrimaryVertex(double x1, double y1, double z1) : x(x1), y(y1), z(z1), ptsq(0), nGenTrk(0) {}
0076 
0077     bool operator<(GeneratedPrimaryVertex const &reference) const { return ptsq < reference.ptsq; }
0078 
0079     double x, y, z;
0080     double ptsq;
0081     int nGenTrk;
0082 
0083     HepMC::FourVector ptot;
0084 
0085     std::vector<int> finalstateParticles;
0086     std::vector<int> simTrackIndex;
0087     std::vector<int> genVertex;
0088   };
0089 
0090   std::vector<GeneratedPrimaryVertex> genpvs_;
0091 
0092   // Auxiliary function to get the generated primary vertex
0093   bool isFinalstateParticle(const HepMC::GenParticle *);
0094   bool isCharged(const HepMC::GenParticle *);
0095   void genPrimaryVertices();
0096 };
0097 
0098 #endif