CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/PhysicsTools/RecoUtils/interface/CheckHitPattern.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_RecoUtils_CheckHitPattern_H
00002 #define PhysicsTools_RecoUtils_CheckHitPattern_H
00003 
00004 /*
00005  * Determine if a track has hits in front of its assumed production point.
00006  * Also determine if it misses hits between its assumed production point and its innermost hit.
00007  */
00008 
00009 // standard EDAnalyser include files
00010 #include <memory>
00011 #include "FWCore/Framework/interface/Frameworkfwd.h"
00012 #include "FWCore/Framework/interface/EDAnalyzer.h"
00013 #include "FWCore/Framework/interface/Event.h"
00014 #include "FWCore/Framework/interface/MakerMacros.h"
00015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00016 #include "FWCore/Framework/interface/ESHandle.h"
00017 
00018 #include "FWCore/Framework/interface/EventSetup.h"
00019 #include "DataFormats/TrackReco/interface/Track.h"
00020 #include "RecoVertex/VertexPrimitives/interface/VertexState.h"
00021 #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
00022 
00023 #include <utility>
00024 #include <map>
00025 
00026 class DetId;
00027 
00028 class CheckHitPattern {
00029 
00030 public:
00031 
00032   struct Result {
00033     // Number of hits track has in front of the vertex.
00034     unsigned int hitsInFrontOfVert;
00035     // Number of missing hits between the vertex position and the innermost valid hit on the track.
00036     unsigned int missHitsAfterVert;
00037   };
00038 
00039   CheckHitPattern() : geomInitDone_(false) {}
00040   
00041   ~CheckHitPattern() {}
00042 
00043   // Check if hit pattern of this track is consistent with it being produced
00044   // at given vertex. See comments above for "Result" struct for details of returned information.
00045   // N.B. If FixHitPattern = true, then Result.missHitsAfterVert will be calculated after rederiving
00046   // the missing hit pattern. This rederivation is sometimes a good idea, since otherwise the
00047   // number of missing hits can be substantially underestimated. See comments in FixTrackHitPattern.h
00048   // for details.
00049   Result analyze(const edm::EventSetup& iSetup, 
00050                  const reco::Track& track, const VertexState& vert, bool fixHitPattern=true);
00051 
00052   // Print hit pattern on track
00053   void print(const reco::Track& track) const;
00054 
00055 private:
00056   // Create map indicating r/z values of all layers/disks.
00057   void init (const edm::EventSetup& iSetup);
00058 
00059   // Return a pair<uint32, uint32> consisting of the numbers used by HitPattern to 
00060   // identify subdetector and layer number respectively.
00061   typedef std::pair<uint32_t, uint32_t> DetInfo;
00062   static DetInfo interpretDetId(DetId detId);
00063 
00064   // Return a bool indicating if a given subdetector is in the barrel.
00065   static bool barrel(uint32_t subDet);
00066 
00067   void print(const reco::HitPattern& hp) const;
00068 
00069 private:
00070   // Note if geometry info is already initialized.
00071   bool geomInitDone_;
00072 
00073   // For a given subdetector & layer number, this stores the minimum and maximum
00074   // r (or z) values if it is barrel (or endcap) respectively.
00075   typedef std::map< DetInfo, std::pair< double, double> > RZrangeMap;
00076   static RZrangeMap rangeRorZ_;
00077 
00078  // Makes TransientTracks needed for vertex fitting.
00079   edm::ESHandle<TransientTrackBuilder> trkTool_;
00080 };
00081 
00082 #endif