Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-13 23:21:00

0001 #ifndef TESTSMOOTHHITS_H
0002 #define TESTSMOOTHHITS_H
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    TestSmoothHits
0007 // Class:      TestSmoothHits
0008 //
0009 /**\class TestSmoothHits TestSmoothHits.cc RecoTracker/DebugTools/src/TestSmoothHits.cc
0010 
0011  Description: <one line class summary>
0012 
0013  Implementation:
0014      <Notes on implementation>
0015 */
0016 //
0017 // Original Author:  Giuseppe Cerati
0018 //         Created:  Tue Feb 13 17:29:10 CET 2007
0019 //
0020 //
0021 #include <memory>
0022 #include <vector>
0023 #include <string>
0024 #include "FWCore/Framework/interface/Frameworkfwd.h"
0025 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "FWCore/Utilities/interface/InputTag.h"
0029 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0030 #include "MagneticField/Engine/interface/MagneticField.h"
0031 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0032 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0033 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0034 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0035 #include "TrackingTools/Records/interface/TrackingComponentsRecord.h"
0036 #include "TrackingTools/Records/interface/TransientRecHitRecord.h"
0037 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0038 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
0039 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0040 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
0041 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0042 #include "TrackingTools/PatternTools/interface/MeasurementExtractor.h"
0043 #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
0044 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
0045 #include <sstream>
0046 #include <TFile.h>
0047 #include <TH1F.h>
0048 #include <TH2F.h>
0049 
0050 class TestSmoothHits : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0051 public:
0052   explicit TestSmoothHits(const edm::ParameterSet&);
0053   ~TestSmoothHits() override;
0054 
0055 private:
0056   void beginRun(edm::Run const& run, const edm::EventSetup&) override;
0057   void analyze(const edm::Event&, const edm::EventSetup&) override;
0058   void endRun(edm::Run const& run, const edm::EventSetup&) override {}
0059   void endJob() override;
0060 
0061   std::pair<LocalPoint, LocalVector> projectHit(const PSimHit&, const StripGeomDetUnit*, const BoundPlane&);
0062 
0063   TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0064 
0065   double mineta, maxeta;
0066 
0067   std::string propagatorName;
0068   std::string builderName;
0069   std::string srcName;
0070   std::string fname;
0071   std::string sname;
0072 
0073   edm::ESHandle<TrackerGeometry> theG;
0074   edm::ESHandle<MagneticField> theMF;
0075   edm::ESHandle<Propagator> thePropagator;
0076   edm::ESHandle<TransientTrackingRecHitBuilder> theBuilder;
0077   edm::Handle<TrackCandidateCollection> theTCCollection;
0078   edm::ESHandle<TrajectoryFitter> fit;
0079   edm::ESHandle<TrajectorySmoother> smooth;
0080 
0081   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> theGToken;
0082   edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMFToken;
0083   edm::ESGetToken<Propagator, TrackingComponentsRecord> thePropagatorToken;
0084   edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> theBuilderToken;
0085   edm::EDGetTokenT<TrackCandidateCollection> theTCCollectionToken;
0086   edm::ESGetToken<TrajectoryFitter, TrajectoryFitter::Record> fitToken;
0087   edm::ESGetToken<TrajectorySmoother, TrajectoryFitter::Record> smoothToken;
0088   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> tTopoToken;
0089 
0090   TFile* file;
0091   std::stringstream title;
0092   std::map<std::string, TH1F*> hPullGP_X_ts;
0093   std::map<std::string, TH1F*> hPullGP_Y_ts;
0094   std::map<std::string, TH1F*> hPullGP_Z_ts;
0095   std::map<std::string, TH1F*> hPullGM_X_ts;
0096   std::map<std::string, TH1F*> hPullGM_Y_ts;
0097   std::map<std::string, TH1F*> hPullGM_Z_ts;
0098   std::map<std::string, TH1F*> hPullGP_X_rs;
0099   std::map<std::string, TH1F*> hPullGP_Y_rs;
0100   std::map<std::string, TH1F*> hPullGP_Z_rs;
0101   std::map<std::string, TH1F*> hPullGP_X_tr;
0102   std::map<std::string, TH1F*> hPullGP_Y_tr;
0103   std::map<std::string, TH1F*> hPullGP_Z_tr;
0104   std::map<std::string, TH1F*> hChi2Increment;
0105   TH1F* hTotChi2Increment;
0106   TH2F *hChi2_vs_Process, *hChi2_vs_clsize;
0107 
0108   std::map<std::string, TH1F*> hPullGP_X_ts_mono;
0109   std::map<std::string, TH1F*> hPullGP_Y_ts_mono;
0110   std::map<std::string, TH1F*> hPullGP_Z_ts_mono;
0111   std::map<std::string, TH1F*> hPullGM_X_ts_mono;
0112   std::map<std::string, TH1F*> hPullGM_Y_ts_mono;
0113   std::map<std::string, TH1F*> hPullGM_Z_ts_mono;
0114   std::map<std::string, TH1F*> hPullGP_X_rs_mono;
0115   std::map<std::string, TH1F*> hPullGP_Y_rs_mono;
0116   std::map<std::string, TH1F*> hPullGP_Z_rs_mono;
0117   std::map<std::string, TH1F*> hPullGP_X_tr_mono;
0118   std::map<std::string, TH1F*> hPullGP_Y_tr_mono;
0119   std::map<std::string, TH1F*> hPullGP_Z_tr_mono;
0120 
0121   std::map<std::string, TH1F*> hPullGP_X_ts_stereo;
0122   std::map<std::string, TH1F*> hPullGP_Y_ts_stereo;
0123   std::map<std::string, TH1F*> hPullGP_Z_ts_stereo;
0124   std::map<std::string, TH1F*> hPullGM_X_ts_stereo;
0125   std::map<std::string, TH1F*> hPullGM_Y_ts_stereo;
0126   std::map<std::string, TH1F*> hPullGM_Z_ts_stereo;
0127   std::map<std::string, TH1F*> hPullGP_X_rs_stereo;
0128   std::map<std::string, TH1F*> hPullGP_Y_rs_stereo;
0129   std::map<std::string, TH1F*> hPullGP_Z_rs_stereo;
0130   std::map<std::string, TH1F*> hPullGP_X_tr_stereo;
0131   std::map<std::string, TH1F*> hPullGP_Y_tr_stereo;
0132   std::map<std::string, TH1F*> hPullGP_Z_tr_stereo;
0133 };
0134 
0135 #endif