Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-09-27 04:04:13

0001 #ifndef CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngle_h
0002 #define CalibTracker_SiPixelLorentzAngle_SiPixelLorentzAngle_h
0003 
0004 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0005 #include "FWCore/Framework/interface/Event.h"
0006 #include "DataFormats/Common/interface/Handle.h"
0007 #include "FWCore/Framework/interface/EventSetup.h"
0008 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0011 #include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h"
0012 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0013 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0014 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0015 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
0016 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
0017 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
0018 #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
0019 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
0020 #include "RecoTracker/TransientTrackingRecHit/interface/TkTransientTrackingRecHitBuilder.h"
0021 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 // #include "CalibTracker/SiPixelLorentzAngle/interface/TrackLocalAngle.h"
0024 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0025 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0026 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
0027 #include <Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h>
0028 #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h"
0029 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
0030 #include <TROOT.h>
0031 #include <TTree.h>
0032 #include <TFile.h>
0033 #include <TH1F.h>
0034 #include <TH2F.h>
0035 #include <TF1.h>
0036 #include "TROOT.h"
0037 
0038 /**
0039 * 
0040 * Class to determine the lorentz angle in the barrel pixel detector 
0041 * returns a txt file with the fit for every of the 8 rings in the 3 layers
0042 * 
0043 */
0044 
0045 // ggiurgiu@fnal.gov : remove namespace 12/27/09
0046 //namespace
0047 //{
0048 static const int maxpix = 1000;
0049 struct Pixinfo {
0050   int npix;
0051   float row[maxpix];
0052   float col[maxpix];
0053   float adc[maxpix];
0054   float x[maxpix];
0055   float y[maxpix];
0056 };
0057 struct Hit {
0058   float x;
0059   float y;
0060   double alpha;
0061   double beta;
0062   double gamma;
0063 };
0064 struct Clust {
0065   float x;
0066   float y;
0067   float charge;
0068   int size_x;
0069   int size_y;
0070   int maxPixelCol;
0071   int maxPixelRow;
0072   int minPixelCol;
0073   int minPixelRow;
0074 };
0075 struct Rechit {
0076   float x;
0077   float y;
0078 };
0079 //}
0080 
0081 //SiPixelLorentzAngle is already the name of a data product
0082 namespace analyzer {
0083   class SiPixelLorentzAngle : public edm::one::EDAnalyzer<> {
0084   public:
0085     explicit SiPixelLorentzAngle(const edm::ParameterSet &conf);
0086 
0087     ~SiPixelLorentzAngle() override;
0088     void beginJob() override;
0089     void endJob() override;
0090     void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0091 
0092   private:
0093     void fillPix(const SiPixelCluster &LocPix, const PixelTopology *topol, Pixinfo &pixinfo);
0094 
0095     void findMean(int i, int i_ring);
0096 
0097     TFile *hFile_;
0098     TTree *SiPixelLorentzAngleTree_;
0099     TTree *SiPixelLorentzAngleTreeForward_;
0100 
0101     // tree branches barrel
0102     int run_;
0103     int event_;
0104     int module_;
0105     int ladder_;
0106     int layer_;
0107     int isflipped_;
0108     float pt_;
0109     float eta_;
0110     float phi_;
0111     double chi2_;
0112     double ndof_;
0113     Pixinfo pixinfo_;
0114     Hit simhit_, trackhit_;
0115     Clust clust_;
0116     Rechit rechit_;
0117 
0118     // tree branches forward
0119     int runF_;
0120     int eventF_;
0121     int sideF_;
0122     int diskF_;
0123     int bladeF_;
0124     int panelF_;
0125     int moduleF_;
0126     float ptF_;
0127     float etaF_;
0128     float phiF_;
0129     double chi2F_;
0130     double ndofF_;
0131     Pixinfo pixinfoF_;
0132     Hit simhitF_, trackhitF_;
0133     Clust clustF_;
0134     Rechit rechitF_;
0135 
0136     // parameters from config file
0137     std::string filename_;
0138     std::string filenameFit_;
0139     double ptmin_;
0140     bool simData_;
0141     double normChi2Max_;
0142     int clustSizeYMin_;
0143     double residualMax_;
0144     double clustChargeMax_;
0145     int hist_depth_;
0146     int hist_drift_;
0147 
0148     // for the TrackerHitAssociator
0149     TrackerHitAssociator::Config trackerHitAssociatorConfig_;
0150 
0151     // histogram etc
0152     int hist_x_;
0153     int hist_y_;
0154     double min_x_;
0155     double max_x_;
0156     double min_y_;
0157     double max_y_;
0158     double width_;
0159     double min_depth_;
0160     double max_depth_;
0161     double min_drift_;
0162     double max_drift_;
0163 
0164     std::map<int, TH2F *> _h_drift_depth_adc_;
0165     std::map<int, TH2F *> _h_drift_depth_adc2_;
0166     std::map<int, TH2F *> _h_drift_depth_noadc_;
0167     std::map<int, TH2F *> _h_drift_depth_;
0168     TH1F *h_drift_depth_adc_slice_;
0169     std::map<int, TH1F *> _h_mean_;
0170     TH2F *h_cluster_shape_adc_;
0171     TH2F *h_cluster_shape_noadc_;
0172     TH2F *h_cluster_shape_;
0173     TH2F *h_cluster_shape_adc_rot_;
0174     TH2F *h_cluster_shape_noadc_rot_;
0175     TH2F *h_cluster_shape_rot_;
0176     TH1F *h_tracks_;
0177 
0178     int event_counter_, trackEventsCounter_, pixelTracksCounter_, hitCounter_, usedHitCounter_;
0179 
0180     // CMSSW classes needed
0181     PropagatorWithMaterial *thePropagator;
0182     PropagatorWithMaterial *thePropagatorOp;
0183     KFUpdator *theUpdator;
0184     Chi2MeasurementEstimator *theEstimator;
0185     const TransientTrackingRecHitBuilder *RHBuilder;
0186     const KFTrajectorySmoother *theSmoother;
0187     const KFTrajectoryFitter *theFitter;
0188     TrajectoryStateTransform tsTransform;
0189     edm::EDGetTokenT<TrajTrackAssociationCollection> t_trajTrack;
0190     edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoToken_;
0191     edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeomToken_;
0192   };
0193 }  // namespace analyzer
0194 
0195 #endif