Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:05

0001 /*
0002  *  TrackQuality.h
0003  *
0004  *  Created by Christophe Saout on 9/25/08.
0005  *  2007 __MyCompanyName__.
0006  *
0007  */
0008 
0009 #ifndef TrackQuality_h
0010 #define TrackQuality_h
0011 
0012 #include <memory>
0013 #include <vector>
0014 
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 
0017 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h"
0018 
0019 #include "DataFormats/Common/interface/DetSetVector.h"
0020 #include "DataFormats/Common/interface/Handle.h"
0021 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0022 
0023 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0024 
0025 class TrackerTopology;
0026 
0027 //! This class analyses the reconstruction quality for a given track
0028 class TrackQuality {
0029 public:
0030   typedef std::vector<TrackingParticleRef> SimParticleTrail;
0031 
0032   struct Layer {
0033     enum SubDet {
0034       Invalid = 0,
0035       PixelBarrel,
0036       PixelForward,
0037       StripTIB,
0038       StripTID,
0039       StripTOB,
0040       StripTEC,
0041       MuonDT,
0042       MuonCSC,
0043       MuonRPCBarrel,
0044       MuonRPCEndcap
0045     };
0046 
0047     enum State { Unknown = 0, Good, Missed, Noise, Bad, Dead, Shared, Misassoc };
0048 
0049     struct Hit {
0050       short int recHitId;
0051       State state;
0052     };
0053 
0054     SubDet subDet;
0055     short int layer;
0056     std::vector<Hit> hits;
0057   };
0058 
0059 public:
0060   //! Constructor by pset.
0061   /* Creates a TrackQuality object from a pset.
0062 
0063      /param[in] pset with the configuration values
0064   */
0065   TrackQuality(const edm::ParameterSet &, edm::ConsumesCollector &iC);
0066 
0067   //! Pre-process event information (for accessing reconstruction information)
0068   void newEvent(const edm::Event &, const edm::EventSetup &);
0069 
0070   //! Compute information about the track reconstruction quality
0071   void evaluate(SimParticleTrail const &, reco::TrackBaseRef const &, const TrackerTopology *tTopo);
0072 
0073   //! Return the number of layers with simulated and/or reconstructed hits
0074   unsigned int numberOfLayers() const { return layers_.size(); }
0075 
0076   //! Return information about the given layer by index
0077   const Layer &layer(unsigned int index) const { return layers_[index]; }
0078 
0079 private:
0080   TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0081   std::unique_ptr<TrackerHitAssociator> associator_;
0082 
0083   std::vector<Layer> layers_;
0084 };
0085 
0086 #endif