CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoTracker/DebugTools/interface/TestTrackHits.h

Go to the documentation of this file.
00001 #ifndef TESTTRACKHITS_H
00002 #define TESTTRACKHITS_H
00003 // -*- C++ -*-
00004 //
00005 // Package:    TestTrackHits
00006 // Class:      TestTrackHits
00007 // 
00015 //
00016 // Original Author:  Giuseppe Cerati
00017 //         Created:  Tue Feb 13 17:29:10 CET 2007
00018 // $Id: TestTrackHits.h,v 1.8 2010/02/11 00:14:37 wmtan Exp $
00019 //
00020 //
00021 
00022 
00023 #include <memory>
00024 #include <vector>
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027 #include "FWCore/Framework/interface/Event.h"
00028 #include "FWCore/Framework/interface/MakerMacros.h"
00029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00030 #include "FWCore/Utilities/interface/InputTag.h"
00031 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00032 #include "MagneticField/Engine/interface/MagneticField.h"
00033 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
00034 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
00035 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
00036 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00037 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00038 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" 
00039 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" 
00040 #include "TrackingTools/Records/interface/TransientRecHitRecord.h" 
00041 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
00042 #include "SimTracker/TrackAssociation/interface/TrackAssociatorByHits.h"
00043 #include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
00044 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00045 #include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
00046 #include <TFile.h>
00047 #include <TH1F.h>
00048 #include <TH2F.h>
00049 #include "DataFormats/TrackReco/interface/Track.h"
00050 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00051 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h"
00052 //#include "PhysicsTools/RecoAlgos/interface/RecoTrackSelector.h"
00053 #include <sstream>
00054 
00055 class TestTrackHits : public edm::EDAnalyzer {
00056 public:
00057   explicit TestTrackHits(const edm::ParameterSet&);
00058   ~TestTrackHits();
00059 
00060 private:
00061   virtual void beginRun(edm::Run & run, const edm::EventSetup&) ;
00062   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00063   virtual void endJob() ;
00064 
00065   std::pair<LocalPoint,LocalVector> projectHit(const PSimHit&, const StripGeomDetUnit*, const BoundPlane&);
00066 
00067   template<unsigned int D>
00068     double computeChi2Increment(MeasurementExtractor, TransientTrackingRecHit::ConstRecHitPointer);
00069   double computeChi2Increment(MeasurementExtractor me, TransientTrackingRecHit::ConstRecHitPointer hit) {
00070     switch (hit->dimension()) {
00071     case 1: return computeChi2Increment<1>(me,hit);
00072     case 2: return computeChi2Increment<2>(me,hit);
00073     case 3: return computeChi2Increment<3>(me,hit);
00074     case 4: return computeChi2Increment<4>(me,hit);
00075     case 5: return computeChi2Increment<5>(me,hit);
00076     }
00077     throw cms::Exception("CkfDebugger error: rechit of dimension not 1,2,3,4,5");
00078   }
00079 
00080   const edm::ParameterSet conf_;
00081   TrackerHitAssociator * hitAssociator;
00082 
00083   std::string propagatorName;
00084   std::string builderName;
00085   std::string srcName;
00086   std::string tpName;
00087   std::string updatorName;
00088   std::string out;
00089   edm::ESHandle<TrackerGeometry> theG;
00090   edm::ESHandle<MagneticField> theMF;
00091   edm::ESHandle<Propagator> thePropagator;
00092   edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder;
00093   edm::ESHandle<TrajectoryStateUpdator> theUpdator;
00094   edm::ESHandle<TrackAssociatorBase> trackAssociator;
00095   edm::Handle<std::vector<Trajectory> > trajCollectionHandle;
00096   edm::Handle<edm::View<reco::Track> > trackCollectionHandle;
00097   edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationCollectionHandle;
00098   edm::Handle<TrackingParticleCollection> trackingParticleCollectionHandle;
00099   //RecoTrackSelector selectRecoTracks;
00100 
00101   TFile* file;
00102   std::stringstream title;
00103   std::map<std::string,TH1F*> hPullGP_X_ts;
00104   std::map<std::string,TH1F*> hPullGP_Y_ts;
00105   std::map<std::string,TH1F*> hPullGP_Z_ts;
00106   std::map<std::string,TH1F*> hPullGM_X_ts;
00107   std::map<std::string,TH1F*> hPullGM_Y_ts;
00108   std::map<std::string,TH1F*> hPullGM_Z_ts;
00109   std::map<std::string,TH1F*> hPullGP_X_rs;
00110   std::map<std::string,TH1F*> hPullGP_Y_rs;
00111   std::map<std::string,TH1F*> hPullGP_Z_rs;
00112   std::map<std::string,TH1F*> hPullGP_X_tr;
00113   std::map<std::string,TH1F*> hPullGP_Y_tr;
00114   std::map<std::string,TH1F*> hPullGP_Z_tr;
00115   std::map<std::string,TH1F*> hChi2Increment;  
00116   std::map<std::string,TH1F*> hChi2Increment_mono;
00117   std::map<std::string,TH1F*> hChi2Increment_stereo;
00118   std::map<std::string,TH2F*> hChi2IncrementVsEta;  
00119   std::map<std::string,TH1F*> hChi2GoodHit;  
00120   std::map<std::string,TH1F*> hChi2BadHit;
00121   std::map<std::string,TH1F*> hChi2DeltaHit;
00122   std::map<std::string,TH1F*> hChi2NSharedHit;
00123   std::map<std::string,TH1F*> hChi2SharedHit;
00124   TH1F *hTotChi2Increment, *hTotChi2GoodHit, *hTotChi2BadHit, *hTotChi2DeltaHit, *hTotChi2NSharedHit, *hTotChi2SharedHit;
00125   TH2F *hProcess_vs_Chi2, *hClsize_vs_Chi2, *hGoodHit_vs_Chi2;
00126   TH2F *hPixClsize_vs_Chi2, *hPrjClsize_vs_Chi2, *hSt1Clsize_vs_Chi2, *hSt2Clsize_vs_Chi2;
00127   TH1F *hClusterSize, *hPixClusterSize, *hPrjClusterSize, *hSt1ClusterSize, *hSt2ClusterSize;
00128   TH1F *hSimHitVecSize, *hPixSimHitVecSize, *hPrjSimHitVecSize, *hSt1SimHitVecSize, *hSt2SimHitVecSize;
00129   TH1F *goodbadmerged,*energyLossRatio, *mergedPull;
00130   TH1F *probXgood,*probXbad,*probXdelta,*probXshared,*probXnoshare;
00131   TH1F *probYgood,*probYbad,*probYdelta,*probYshared,*probYnoshare;
00132 
00133   std::map<std::string,TH1F*> hPullGP_X_ts_mono;
00134   std::map<std::string,TH1F*> hPullGP_Y_ts_mono;
00135   std::map<std::string,TH1F*> hPullGP_Z_ts_mono;
00136   std::map<std::string,TH1F*> hPullGM_X_ts_mono;
00137   std::map<std::string,TH1F*> hPullGM_Y_ts_mono;
00138   std::map<std::string,TH1F*> hPullGM_Z_ts_mono;
00139   std::map<std::string,TH1F*> hPullGP_X_rs_mono;
00140   std::map<std::string,TH1F*> hPullGP_Y_rs_mono;
00141   std::map<std::string,TH1F*> hPullGP_Z_rs_mono;
00142   std::map<std::string,TH1F*> hPullGP_X_tr_mono;
00143   std::map<std::string,TH1F*> hPullGP_Y_tr_mono;
00144   std::map<std::string,TH1F*> hPullGP_Z_tr_mono;
00145 
00146   std::map<std::string,TH1F*> hPullGP_X_ts_stereo;
00147   std::map<std::string,TH1F*> hPullGP_Y_ts_stereo;
00148   std::map<std::string,TH1F*> hPullGP_Z_ts_stereo;
00149   std::map<std::string,TH1F*> hPullGM_X_ts_stereo;
00150   std::map<std::string,TH1F*> hPullGM_Y_ts_stereo;
00151   std::map<std::string,TH1F*> hPullGM_Z_ts_stereo;
00152   std::map<std::string,TH1F*> hPullGP_X_rs_stereo;
00153   std::map<std::string,TH1F*> hPullGP_Y_rs_stereo;
00154   std::map<std::string,TH1F*> hPullGP_Z_rs_stereo;
00155   std::map<std::string,TH1F*> hPullGP_X_tr_stereo;
00156   std::map<std::string,TH1F*> hPullGP_Y_tr_stereo;
00157   std::map<std::string,TH1F*> hPullGP_Z_tr_stereo;
00158 };
00159 
00160 #endif