Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-29 23:32:30

0001 #ifndef CD_NuclearTrackCorrector_H_
0002 #define CD_NuclearTrackCorrector_H_
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    NuclearTrackCorrector
0007 // Class:      NuclearTrackCorrector
0008 //
0009 /**\class NuclearTrackCorrector NuclearTrackCorrector.h RecoTracker/NuclearSeedGenerator/interface/NuclearTrackCorrector.h
0010 
0011  Description: <one line class summary>
0012 
0013  Implementation:
0014      <Notes on implementation>
0015 */
0016 //
0017 // Original Author:  Loic QUERTENMONT, Vincent ROBERFROID
0018 //         Created:  Tue Sep 18 14:22:48 CEST 2007
0019 //
0020 //
0021 
0022 // system include files
0023 #include <memory>
0024 #include <string>
0025 #include <cstdio>
0026 
0027 // user include files
0028 
0029 #include "FWCore/Framework/interface/ESHandle.h"
0030 
0031 #include "FWCore/Framework/interface/Frameworkfwd.h"
0032 #include "FWCore/Framework/interface/stream/EDProducer.h"
0033 
0034 #include "FWCore/Framework/interface/Event.h"
0035 #include "FWCore/Framework/interface/MakerMacros.h"
0036 
0037 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0038 
0039 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0040 #include "DataFormats/TrackCandidate/interface/TrackCandidate.h"
0041 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0042 #include "DataFormats/VertexReco/interface/NuclearInteraction.h"
0043 #include "DataFormats/VertexReco/interface/NuclearInteractionFwd.h"
0044 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0045 #include "DataFormats/TrackReco/interface/Track.h"
0046 #include "DataFormats/TrackReco/interface/TrackBase.h"
0047 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0048 #include "RecoTracker/NuclearSeedGenerator/interface/TrajectoryToSeedMap.h"
0049 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
0050 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0051 #include "RecoTracker/NuclearSeedGenerator/interface/TrackCandidateToTrajectoryMap.h"
0052 #include "RecoTracker/TrackProducer/interface/TrackProducerBase.h"
0053 #include "FWCore/Framework/interface/EventSetup.h"
0054 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0055 #include "RecoTracker/CkfPattern/interface/TransientInitialStateEstimator.h"
0056 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0057 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0058 
0059 #include "RecoTracker/TrackProducer/interface/TrackProducerAlgorithm.h"
0060 
0061 class TransientInitialStateEstimator;
0062 
0063 //
0064 // class decleration
0065 //
0066 
0067 class NuclearTrackCorrector : public edm::stream::EDProducer<> {
0068 public:
0069   typedef edm::RefVector<TrajectorySeedCollection> TrajectorySeedRefVector;
0070   typedef edm::Ref<TrajectoryCollection> TrajectoryRef;
0071   typedef edm::Ref<TrackCandidateCollection> TrackCandidateRef;
0072   typedef TransientTrackingRecHit::ConstRecHitContainer ConstRecHitContainer;
0073 
0074   using AlgoProductCollection = TrackProducerAlgorithm<reco::Track>::AlgoProductCollection;
0075 
0076 public:
0077   explicit NuclearTrackCorrector(const edm::ParameterSet&);
0078   ~NuclearTrackCorrector() override;
0079 
0080 private:
0081   void produce(edm::Event&, const edm::EventSetup&) override;
0082 
0083   /// check if the trajectory has to be refitted and get the new trajectory
0084   bool newTrajNeeded(Trajectory& newtrajectory, const TrajectoryRef& trajRef, const reco::NuclearInteraction& ni);
0085 
0086   /// get a new TrackExtra from an AlgoProductCollection
0087   reco::TrackExtra getNewTrackExtra(const AlgoProductCollection& algoresults);
0088 
0089   /// Get the refitted track from the Trajectory
0090   bool getTrackFromTrajectory(const Trajectory& newTraj,
0091                               const TrajectoryRef& initialTrajRef,
0092                               AlgoProductCollection& algoResults);
0093 
0094   /// Calculate the inital state to be used to buil the track
0095   TrajectoryStateOnSurface getInitialState(const reco::Track* theT,
0096                                            TransientTrackingRecHit::RecHitContainer& hits,
0097                                            const TrackingGeometry* theG,
0098                                            const MagneticField* theMF);
0099 
0100   void swap_map(const edm::Handle<TrajectoryCollection>& trajColl,
0101                 std::map<reco::TrackRef, edm::Ref<TrajectoryCollection> >& result);
0102 
0103   // ----------member data ---------------------------
0104 
0105   std::string str_Input_Trajectory;
0106   std::string str_Input_NuclearInteraction;
0107   int int_Input_Hit_Distance;
0108 
0109   int verbosity;
0110   int KeepOnlyCorrectedTracks;
0111 
0112   std::vector<std::pair<unsigned int, unsigned int> > Indice_Map;
0113 
0114   edm::ESHandle<TrackerGeometry> theG;
0115   edm::ESHandle<MagneticField> theMF;
0116   edm::ESHandle<TrajectoryFitter> theFitter;
0117   edm::ESHandle<Propagator> thePropagator;
0118   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theGToken;
0119   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMFToken;
0120   edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> theFitterToken;
0121   edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropagatorToken;
0122   TransientInitialStateEstimator* theInitialState;
0123 
0124   TrackProducerAlgorithm<reco::Track>* theAlgo;
0125   const TrajTrackAssociationCollection* m_TrajToTrackCollection;
0126 };
0127 
0128 #endif