Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:27

0001 //----------------------------------------------------------------------------
0002 //! \class NuclearTester
0003 //! \brief Class used to test if a track has interacted nuclearly
0004 //!
0005 //! \description Using the properties of all the compatible TMs of the TMs associated to a track, the method
0006 //! isNuclearInteraction return 1 in case the track has interacted nuclearly, 0 else.
0007 //-----------------------------------------------------------------------------
0008 #ifndef CD_NuclearTester_H_
0009 #define CD_NuclearTester_H_
0010 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0014 #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h"
0015 
0016 class NuclearTester {
0017 private:
0018   typedef TrajectoryMeasurement TM;
0019   typedef std::vector<TM> TMContainer;
0020   typedef TrajectoryMeasurement::ConstRecHitPointer ConstRecHitPointer;
0021   typedef std::pair<TrajectoryMeasurement, TMContainer> TMPair;
0022   typedef std::vector<TMPair> TMPairVector;
0023 
0024 public:
0025   NuclearTester(unsigned int max_hits, const MeasurementEstimator* est, const TrackerGeometry* track_geom);
0026 
0027   bool isNuclearInteraction();
0028 
0029   double meanHitDistance(const std::vector<TrajectoryMeasurement>& vecTM) const;
0030 
0031   std::vector<GlobalPoint> HitPositions(const std::vector<TrajectoryMeasurement>& vecTM) const;
0032 
0033   double fwdEstimate(const std::vector<TrajectoryMeasurement>& vecTM) const;
0034 
0035   std::vector<TM>::const_iterator lastValidTM(const std::vector<TM>& vecTM) const;
0036 
0037   void push_back(const TM& init_tm, const TMContainer& vecTM) {
0038     allTM.push_back(std::make_pair(init_tm, vecTM));
0039     compatible_hits.push_back(vecTM.size());
0040   }
0041 
0042   const TMContainer& back() const { return allTM.back().second; }
0043 
0044   double meanHitDistance() const { return meanHitDistance(back()); }
0045 
0046   double fwdEstimate() const { return fwdEstimate(back()); }
0047 
0048   void reset(unsigned int nMeasurements) {
0049     allTM.clear();
0050     compatible_hits.clear();
0051     maxHits = (nMeasurements < maxHits) ? nMeasurements : maxHits;
0052   }
0053 
0054   int nuclearIndex() const { return NuclearIndex; }
0055 
0056   const TMPair& goodTMPair() const { return *(allTM.begin() + nuclearIndex() - 1); }
0057 
0058   unsigned int nHitsChecked() const { return compatible_hits.size(); }
0059 
0060   std::vector<int> compatibleHits() const { return compatible_hits; }
0061 
0062 private:
0063   // data members
0064   TMPairVector allTM;
0065   std::vector<int> compatible_hits;
0066   int NuclearIndex;
0067 
0068   // input parameters
0069   unsigned int maxHits;
0070   const MeasurementEstimator* theEstimator;
0071   const TrackerGeometry* trackerGeom;
0072 
0073   bool checkWithMultiplicity();
0074 };
0075 #endif