CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Alignment/OfflineValidation/plugins/MuonAlignmentAnalyzer.h

Go to the documentation of this file.
00001 #ifndef Alignment_OfflineValidation_MuonAlignmentAnalyzer_H
00002 #define Alignment_OfflineValidation_MuonAlignmentAnalyzer_H
00003 
00015 // Base Class Headers
00016 #include "FWCore/Framework/interface/EDAnalyzer.h"
00017 #include "FWCore/ServiceRegistry/interface/Service.h"
00018 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00019 #include "FWCore/Framework/interface/ESHandle.h"
00020 #include "FWCore/Utilities/interface/InputTag.h"
00021 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00022 #include "DataFormats/TrackReco/interface/Track.h"
00023 #include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
00024 #include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
00025 #include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h"
00026 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
00027 #include <vector>
00028 
00029 namespace edm {
00030     class ParameterSet;
00031     class EventSetup;
00032 }
00033 
00034 class TH1F;
00035 class TH2F;
00036 
00037 typedef std::vector< std::vector<int> > intDVector;
00038 typedef std::vector<TrackingRecHit *> RecHitVector;
00039 
00040 class MuonAlignmentAnalyzer: public edm::EDAnalyzer {
00041 public:
00043     MuonAlignmentAnalyzer(const edm::ParameterSet& pset);
00044 
00046     virtual ~MuonAlignmentAnalyzer();
00047 
00048     // Operations
00049 
00050     void analyze(const edm::Event & event, const edm::EventSetup& eventSetup);
00051 
00052     virtual void beginJob() ;
00053     virtual void endJob() ;
00054 protected:
00055 
00056 private:
00057 
00058     RecHitVector doMatching(const reco::Track &, edm::Handle<DTRecSegment4DCollection> &, edm::Handle<CSCSegmentCollection> &, intDVector *, intDVector *, edm::ESHandle<GlobalTrackingGeometry> &); 
00059 
00060     edm::Service<TFileService> fs;
00061 
00062 // InputTags
00063     edm::InputTag theGLBMuonTag; 
00064     edm::InputTag theSTAMuonTag; 
00065 
00066 // Collections needed
00067     edm::InputTag theRecHits4DTagDT;
00068     edm::InputTag theRecHits4DTagCSC;
00069 
00070 // To switch between real data and MC
00071     std::string theDataType;
00072 
00073     bool doSAplots,doGBplots,doResplots;
00074 
00075     // Histograms
00076 
00077     //# muons per event
00078     TH1F        *hGBNmuons;
00079     TH1F        *hSANmuons;
00080     TH1F        *hSimNmuons;
00081     TH1F        *hGBNmuons_Barrel;
00082     TH1F        *hSANmuons_Barrel;
00083     TH1F        *hSimNmuons_Barrel;
00084     TH1F        *hGBNmuons_Endcap;
00085     TH1F        *hSANmuons_Endcap;
00086     TH1F        *hSimNmuons_Endcap;
00087 
00088     // # hits per track
00089     TH1F  *hGBNhits;
00090     TH1F  *hGBNhits_Barrel;
00091     TH1F  *hGBNhits_Endcap;
00092     TH1F  *hSANhits;
00093     TH1F  *hSANhits_Barrel;
00094     TH1F  *hSANhits_Endcap;
00095 
00096     // Chi2 of Track
00097     TH1F *hGBChi2;
00098     TH1F *hSAChi2;
00099     TH1F *hGBChi2_Barrel;
00100     TH1F *hSAChi2_Barrel;
00101     TH1F *hGBChi2_Endcap;
00102     TH1F *hSAChi2_Endcap;
00103 
00104     // Invariant mass for dimuons
00105     TH1F *hGBInvM;
00106     TH1F *hSAInvM;
00107     TH1F *hSimInvM;
00108     // Invariant Mass distributions in Barrel (eta<1.04) region
00109     TH1F *hGBInvM_Barrel;
00110     TH1F *hSAInvM_Barrel;
00111     TH1F *hSimInvM_Barrel;
00112     // Invariant Mass distributions in Endcap (eta>=1.04) region
00113     TH1F *hGBInvM_Endcap;
00114     TH1F *hSAInvM_Endcap;
00115     TH1F *hSimInvM_Endcap;
00116     // Invariant Mass distributions in Barrel-Endcap overlap region 
00117     // 1 muon barrel & 1 muon endcap
00118     TH1F *hGBInvM_Overlap;
00119     TH1F *hSAInvM_Overlap;
00120     TH1F *hSimInvM_Overlap;
00121 
00122     // pT 
00123     TH1F *hSAPTRec;
00124     TH1F *hGBPTRec;
00125     TH1F *hSimPT; 
00126     TH1F *hSAPTRec_Barrel;
00127     TH1F *hGBPTRec_Barrel;
00128     TH1F *hSimPT_Barrel; 
00129     TH1F *hSAPTRec_Endcap;
00130     TH1F *hGBPTRec_Endcap;
00131     TH1F *hSimPT_Endcap; 
00132     TH2F *hGBPTvsEta;
00133     TH2F *hGBPTvsPhi;
00134     TH2F *hSAPTvsEta;
00135     TH2F *hSAPTvsPhi;
00136     TH2F *hSimPTvsEta;
00137     TH2F *hSimPTvsPhi;
00138 
00139     // For reco efficiency calculations
00140     TH2F *hSimPhivsEta;
00141     TH2F *hSAPhivsEta;
00142     TH2F *hGBPhivsEta;
00143 
00144     // pT resolution
00145     TH1F *hSAPTres;
00146     TH1F *hSAinvPTres;
00147     TH1F *hGBPTres;
00148     TH1F *hGBinvPTres;
00149     TH1F *hSAPTres_Barrel;
00150     TH1F *hSAPTres_Endcap;
00151     TH1F *hGBPTres_Barrel;
00152     TH1F *hGBPTres_Endcap;
00153     //pT rec - pT gen
00154     TH1F *hSAPTDiff;
00155     TH1F *hGBPTDiff;
00156     TH2F *hSAPTDiffvsEta;
00157     TH2F *hSAPTDiffvsPhi;
00158     TH2F *hGBPTDiffvsEta;
00159     TH2F *hGBPTDiffvsPhi;
00160     TH2F *hGBinvPTvsEta;
00161     TH2F *hGBinvPTvsPhi;
00162     TH2F *hSAinvPTvsEta;
00163     TH2F *hSAinvPTvsPhi;
00164     TH2F *hSAinvPTvsNhits;
00165     TH2F *hGBinvPTvsNhits;
00166 
00167     // Vector of chambers Residuals
00168     std::vector<TH1F *> unitsLocalX;
00169     std::vector<TH1F *> unitsLocalPhi;
00170     std::vector<TH1F *> unitsLocalTheta;
00171     std::vector<TH1F *> unitsLocalY;
00172     std::vector<TH1F *> unitsGlobalRPhi;
00173     std::vector<TH1F *> unitsGlobalPhi;
00174     std::vector<TH1F *> unitsGlobalTheta;
00175     std::vector<TH1F *> unitsGlobalRZ;
00176 
00177     // DT & CSC Residuals
00178     TH1F *hResidualLocalXDT; 
00179     TH1F *hResidualLocalPhiDT; 
00180     TH1F *hResidualLocalThetaDT; 
00181     TH1F *hResidualLocalYDT; 
00182     TH1F *hResidualLocalXCSC; 
00183     TH1F *hResidualLocalPhiCSC; 
00184     TH1F *hResidualLocalThetaCSC; 
00185     TH1F *hResidualLocalYCSC; 
00186     std::vector<TH1F*> hResidualLocalXDT_W;
00187     std::vector<TH1F*> hResidualLocalPhiDT_W;
00188     std::vector<TH1F*> hResidualLocalThetaDT_W;
00189     std::vector<TH1F*> hResidualLocalYDT_W;     
00190     std::vector<TH1F*> hResidualLocalXCSC_ME;
00191     std::vector<TH1F*> hResidualLocalPhiCSC_ME;
00192     std::vector<TH1F*> hResidualLocalThetaCSC_ME;
00193     std::vector<TH1F*> hResidualLocalYCSC_ME;
00194     std::vector<TH1F*> hResidualLocalXDT_MB;
00195     std::vector<TH1F*> hResidualLocalPhiDT_MB;
00196     std::vector<TH1F*> hResidualLocalThetaDT_MB;
00197     std::vector<TH1F*> hResidualLocalYDT_MB;
00198     TH1F *hResidualGlobalRPhiDT; 
00199     TH1F *hResidualGlobalPhiDT; 
00200     TH1F *hResidualGlobalThetaDT; 
00201     TH1F *hResidualGlobalZDT; 
00202     TH1F *hResidualGlobalRPhiCSC; 
00203     TH1F *hResidualGlobalPhiCSC; 
00204     TH1F *hResidualGlobalThetaCSC; 
00205     TH1F *hResidualGlobalRCSC; 
00206     std::vector<TH1F*> hResidualGlobalRPhiDT_W;
00207     std::vector<TH1F*> hResidualGlobalPhiDT_W;
00208     std::vector<TH1F*> hResidualGlobalThetaDT_W;
00209     std::vector<TH1F*> hResidualGlobalZDT_W;    
00210     std::vector<TH1F*> hResidualGlobalRPhiCSC_ME;
00211     std::vector<TH1F*> hResidualGlobalPhiCSC_ME;
00212     std::vector<TH1F*> hResidualGlobalThetaCSC_ME;
00213     std::vector<TH1F*> hResidualGlobalRCSC_ME;
00214     std::vector<TH1F*> hResidualGlobalRPhiDT_MB;
00215     std::vector<TH1F*> hResidualGlobalPhiDT_MB;
00216     std::vector<TH1F*> hResidualGlobalThetaDT_MB;
00217     std::vector<TH1F*> hResidualGlobalZDT_MB;
00218 
00219     // Mean and RMS of residuals for DQM
00220     TH2F *hprofLocalPositionCSC;
00221     TH2F *hprofLocalAngleCSC;
00222     TH2F *hprofLocalPositionRmsCSC;
00223     TH2F *hprofLocalAngleRmsCSC;
00224     TH2F *hprofGlobalPositionCSC;
00225     TH2F *hprofGlobalAngleCSC;
00226     TH2F *hprofGlobalPositionRmsCSC;
00227     TH2F *hprofGlobalAngleRmsCSC;
00228     TH2F *hprofLocalPositionDT;
00229     TH2F *hprofLocalAngleDT;
00230     TH2F *hprofLocalPositionRmsDT;
00231     TH2F *hprofLocalAngleRmsDT;
00232     TH2F *hprofGlobalPositionDT;
00233     TH2F *hprofGlobalAngleDT;
00234     TH2F *hprofGlobalPositionRmsDT;
00235     TH2F *hprofGlobalAngleRmsDT;
00236   
00237     TH1F *hprofLocalXDT;
00238     TH1F *hprofLocalPhiDT;
00239     TH1F *hprofLocalThetaDT;
00240     TH1F *hprofLocalYDT;
00241     TH1F *hprofLocalXCSC;
00242     TH1F *hprofLocalPhiCSC;
00243     TH1F *hprofLocalThetaCSC;
00244     TH1F *hprofLocalYCSC;
00245     TH1F *hprofGlobalRPhiDT;
00246     TH1F *hprofGlobalPhiDT;
00247     TH1F *hprofGlobalThetaDT;
00248     TH1F *hprofGlobalZDT;
00249     TH1F *hprofGlobalRPhiCSC;
00250     TH1F *hprofGlobalPhiCSC;
00251     TH1F *hprofGlobalThetaCSC;
00252     TH1F *hprofGlobalRCSC;
00253 
00254     std::vector<long> detectorCollection;  
00255 
00256 //  ESHandle<MagneticField> theMGField;
00257 
00258     Propagator * thePropagator;
00259 
00260     // Counters
00261     int numberOfSimTracks;
00262     int numberOfGBRecTracks;
00263     int numberOfSARecTracks;
00264     int numberOfHits;
00265 
00266     // hist kinematic range
00267     double ptRangeMin,ptRangeMax,invMassRangeMin,invMassRangeMax;
00268     // hist residual range
00269     double resLocalXRangeStation1,resLocalXRangeStation2,resLocalXRangeStation3,resLocalXRangeStation4;
00270     double resLocalYRangeStation1,resLocalYRangeStation2,resLocalYRangeStation3,resLocalYRangeStation4;
00271     double resPhiRange,resThetaRange;
00272     unsigned int nbins,min1DTrackRecHitSize,min4DTrackSegmentSize;
00273 };
00274 #endif
00275