CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Calibration/IsolatedParticles/plugins/IsolatedTracksCone.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #ifndef CalibrationIsolatedParticlesIsolatedTracksCone_h
00004 #define CalibrationIsolatedParticlesIsolatedTracksCone_h
00005 
00006 // system include files
00007 #include <memory>
00008 #include <cmath>
00009 #include <string>
00010 #include <map>
00011 #include <vector>
00012 
00013 // user include files
00014 #include <Math/GenVector/VectorUtil.h>
00015 
00016 #include "FWCore/Framework/interface/Frameworkfwd.h"
00017 #include "FWCore/Framework/interface/EDAnalyzer.h"
00018 #include "FWCore/Framework/interface/Event.h"
00019 #include "FWCore/Framework/interface/ESHandle.h"
00020 #include "FWCore/Framework/interface/EventSetup.h"
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 
00025 //TFile Service
00026 #include "FWCore/ServiceRegistry/interface/Service.h"
00027 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00028 
00029 #include "DataFormats/Common/interface/Ref.h"
00030 #include "DataFormats/Common/interface/Handle.h"
00031 #include "DataFormats/Candidate/interface/Candidate.h"
00032 #include "DataFormats/DetId/interface/DetId.h"
00033 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00034 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00035 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00036 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00037 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00038 // muons and tracks
00039 #include "DataFormats/TrackReco/interface/Track.h"
00040 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00041 #include "DataFormats/TrackReco/interface/HitPattern.h"
00042 // Vertices
00043 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00044 #include "DataFormats/VertexReco/interface/Vertex.h"
00045 //L1 objects
00046 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00047 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00048 // SimHit
00049 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
00050 //simtrack
00051 #include "SimDataFormats/Track/interface/SimTrack.h"
00052 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00053 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00054 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00055 
00056 // track associator
00057 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00058 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00059 #include "SimTracker/Records/interface/TrackAssociatorRecord.h"
00060 
00061 // ecal / hcal
00062 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00063 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00064 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00065 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00066 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00067 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00068 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00069 
00070 #include "Calibration/IsolatedParticles/interface/FindCaloHitCone.h"
00071 #include "Calibration/IsolatedParticles/interface/FindCaloHit.h"
00072 
00073 #include "Calibration/IsolatedParticles/interface/eECALMatrix.h"
00074 #include "Calibration/IsolatedParticles/interface/eHCALMatrix.h"
00075 #include "Calibration/IsolatedParticles/interface/eCone.h"
00076 #include "Calibration/IsolatedParticles/interface/MatchingSimTrack.h"
00077 #include "Calibration/IsolatedParticles/interface/CaloSimInfo.h"
00078 
00079 // root objects
00080 #include "TROOT.h"
00081 #include "TSystem.h"
00082 #include "TFile.h"
00083 #include "TH1F.h"
00084 #include "TH2F.h"
00085 #include "TProfile.h"
00086 #include "TDirectory.h"
00087 #include "TTree.h"
00088 
00089 #include <cmath>
00090 
00091 class IsolatedTracksCone : public edm::EDAnalyzer {
00092 public:
00093   explicit IsolatedTracksCone(const edm::ParameterSet&);
00094   ~IsolatedTracksCone();
00095   
00096   //  static const int NEtaBins = 4;
00097   static const int NEtaBins = 4;
00098   static const int NPTBins  = 21;
00099   static const int NPBins   = 21;
00100   
00101   double genPartPBins[22], genPartEtaBins[5];
00102   
00103 private:
00104   virtual void beginJob(const edm::EventSetup&) ;
00105   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00106   virtual void endJob() ;
00107 
00108   void printTrack(const reco::Track* pTrack);
00109 
00110   //   void BookHistograms();
00111   void BuildTree();
00112   void clearTrackVectors();
00113 
00114   double DeltaPhi(double v1, double v2);
00115   double DeltaR(double eta1, double phi1, double eta2, double phi2);
00116 
00117   int    debugTrks_;
00118   bool   printTrkHitPattern_;
00119   bool   doMC;
00120   int    myverbose_;
00121   bool   useJetTrigger_;
00122   double drLeadJetVeto_, ptMinLeadJet_;
00123   edm::InputTag _L1extraTauJetSource, _L1extraCenJetSource, _L1extraFwdJetSource;
00124 
00125   double minTrackP_, maxTrackEta_, maxNearTrackP_;
00126   
00127   int    debugEcalSimInfo_;
00128 
00129   bool   applyEcalIsolation_;
00130 
00131   // track associator to detector parameters 
00132   TrackAssociatorParameters parameters_;
00133   mutable TrackDetectorAssociator* trackAssociator_;
00134 
00135   TTree* ntp;
00136 
00137   TH1F* hRawPt ;
00138   TH1F* hRawP  ;
00139   TH1F* hRawEta;
00140   TH1F* hRawPhi;
00141 
00142   int nRawTRK            ;
00143   int nFailHighPurityQaul;
00144   int nFailPt            ;
00145   int nFailEta           ;
00146   int nMissEcal          ;
00147   int nMissHcal          ;
00148   int nEVT;
00149   int nEVT_failL1;
00150   int nTRK;
00151 //   double hbScale;
00152 //   double heScale;
00153   double leadL1JetPT;
00154   double leadL1JetEta;
00155   double leadL1JetPhi;
00156  
00157   std::vector<std::vector<int> >*    t_v_hnNearTRKs       ; 
00158   std::vector<std::vector<int> >*    t_v_hnLayers_maxNearP; 
00159   std::vector<std::vector<int> >*    t_v_htrkQual_maxNearP; 
00160   std::vector<std::vector<double> >* t_v_hmaxNearP_goodTrk;
00161   std::vector<std::vector<double> >* t_v_hmaxNearP        ;    
00162 
00163   std::vector<std::vector<int> >*    t_v_cone_hnNearTRKs       ; 
00164   std::vector<std::vector<int> >*    t_v_cone_hnLayers_maxNearP; 
00165   std::vector<std::vector<int> >*    t_v_cone_htrkQual_maxNearP; 
00166   std::vector<std::vector<double> >* t_v_cone_hmaxNearP_goodTrk;
00167   std::vector<std::vector<double> >* t_v_cone_hmaxNearP        ;    
00168 
00169   //  std::vector<double>* t_hScale           ;
00170   std::vector<double>* t_trkNOuterHits    ;
00171   std::vector<double>* t_trkNLayersCrossed;
00172   std::vector<double>* t_dtFromLeadJet    ;
00173   std::vector<double>* t_trkP             ;
00174   std::vector<double>* t_simP             ;
00175   std::vector<double>* t_trkPt            ;
00176   std::vector<double>* t_trkEta           ;
00177   std::vector<double>* t_trkPhi           ;
00178   std::vector<double>* t_e3x3             ;
00179 
00180   std::vector<std::vector<double> > *t_v_eDR;
00181   std::vector<std::vector<double> > *t_v_eMipDR;
00182 
00183   std::vector<double>* t_h3x3             ;
00184   std::vector<double>* t_h5x5             ;
00185   std::vector<double>* t_hsim3x3          ;
00186   std::vector<double>* t_hsim5x5          ;
00187 
00188   std::vector<double>* t_nRH_h3x3         ;
00189   std::vector<double>* t_nRH_h5x5         ;
00190   std::vector<double>* t_nRH_h3x3dR       ;
00191   std::vector<double>* t_nRH_h5x5dR       ;
00192   std::vector<double>* t_nRH_h7x7dR       ;
00193   std::vector<double>* t_nRH_h9x9dR       ;
00194   std::vector<double>* t_nRH_h40cm        ;
00195 
00196   std::vector<double>* t_nRH_hsim3x3dR    ;
00197   std::vector<double>* t_nRH_hsim5x5dR    ;
00198   std::vector<double>* t_nRH_hsim7x7dR    ;
00199   std::vector<double>* t_nRH_hsim9x9dR    ;
00200   std::vector<double>* t_nRH_hsim40cm     ;
00201 
00202   std::vector<double>* t_hsim3x3Matched   ;
00203   std::vector<double>* t_hsim5x5Matched   ;
00204   std::vector<double>* t_hsim3x3Rest      ;
00205   std::vector<double>* t_hsim5x5Rest      ;
00206   std::vector<double>* t_hsim3x3Photon    ;
00207   std::vector<double>* t_hsim5x5Photon    ;
00208   std::vector<double>* t_hsim3x3NeutHad   ;
00209   std::vector<double>* t_hsim5x5NeutHad   ;
00210   std::vector<double>* t_hsim3x3CharHad   ;
00211   std::vector<double>* t_hsim5x5CharHad   ;
00212   std::vector<double>* t_hsim3x3PdgMatched;
00213   std::vector<double>* t_hsim5x5PdgMatched;
00214   std::vector<double>* t_hsim3x3Total     ;
00215   std::vector<double>* t_hsim5x5Total     ;
00216 
00217   std::vector<int>* t_hsim3x3NMatched   ;
00218   std::vector<int>* t_hsim3x3NRest      ;
00219   std::vector<int>* t_hsim3x3NPhoton    ;
00220   std::vector<int>* t_hsim3x3NNeutHad   ;
00221   std::vector<int>* t_hsim3x3NCharHad   ;
00222   std::vector<int>* t_hsim3x3NTotal     ;
00223 
00224   std::vector<int>* t_hsim5x5NMatched   ;
00225   std::vector<int>* t_hsim5x5NRest      ;
00226   std::vector<int>* t_hsim5x5NPhoton    ;
00227   std::vector<int>* t_hsim5x5NNeutHad   ;
00228   std::vector<int>* t_hsim5x5NCharHad   ;
00229   std::vector<int>* t_hsim5x5NTotal     ;
00230 
00231   std::vector<double>* t_distFromHotCell_h3x3;
00232   std::vector<int>* t_ietaFromHotCell_h3x3;
00233   std::vector<int>* t_iphiFromHotCell_h3x3;
00234   std::vector<double>* t_distFromHotCell_h5x5;
00235   std::vector<int>* t_ietaFromHotCell_h5x5;
00236   std::vector<int>* t_iphiFromHotCell_h5x5;
00237 
00238   std::vector<double>* t_trkHcalEne       ;
00239   std::vector<double>* t_trkEcalEne       ;
00240   
00241   std::vector<std::vector<double> >* t_v_hsimInfoConeMatched   ;
00242   std::vector<std::vector<double> >* t_v_hsimInfoConeRest      ;
00243   std::vector<std::vector<double> >* t_v_hsimInfoConePhoton     ;
00244   std::vector<std::vector<double> >* t_v_hsimInfoConeNeutHad   ;
00245   std::vector<std::vector<double> >* t_v_hsimInfoConeCharHad   ;
00246   std::vector<std::vector<double> >* t_v_hsimInfoConePdgMatched;
00247   std::vector<std::vector<double> >* t_v_hsimInfoConeTotal     ;
00248 
00249   std::vector<std::vector<int> >* t_v_hsimInfoConeNMatched   ;
00250   std::vector<std::vector<int> >* t_v_hsimInfoConeNRest      ;
00251   std::vector<std::vector<int> >* t_v_hsimInfoConeNPhoton     ;
00252   std::vector<std::vector<int> >* t_v_hsimInfoConeNNeutHad   ;
00253   std::vector<std::vector<int> >* t_v_hsimInfoConeNCharHad   ;
00254   std::vector<std::vector<int> >* t_v_hsimInfoConeNTotal     ;
00255 
00256   std::vector<std::vector<double> >* t_v_hsimCone    ;
00257   std::vector<std::vector<double> >* t_v_hCone       ;
00258   std::vector<std::vector<int> >*    t_v_nRecHitsCone;
00259   std::vector<std::vector<int> >*    t_v_nSimHitsCone;
00260 
00261   std::vector<std::vector<double> >*    t_v_distFromHotCell;
00262   std::vector<std::vector<int> >*    t_v_ietaFromHotCell;
00263   std::vector<std::vector<int> >*    t_v_iphiFromHotCell;
00264 
00265 
00266   std::vector<std::vector<int> >*    t_v_hlTriggers;
00267   std::vector<int>* t_hltHB;
00268   std::vector<int>* t_hltHE;
00269   std::vector<int>* t_hltL1Jet15                        ;
00270   std::vector<int>* t_hltJet30                  ;
00271   std::vector<int>* t_hltJet50                  ;
00272   std::vector<int>* t_hltJet80                  ;
00273   std::vector<int>* t_hltJet110                 ;
00274   std::vector<int>* t_hltJet140                 ;
00275   std::vector<int>* t_hltJet180                 ;
00276   std::vector<int>* t_hltL1SingleEG5            ;
00277   std::vector<int>* t_hltZeroBias               ;
00278   std::vector<int>* t_hltMinBiasHcal            ;
00279   std::vector<int>* t_hltMinBiasEcal            ;
00280   std::vector<int>* t_hltMinBiasPixel           ;
00281   std::vector<int>* t_hltSingleIsoTau30_Trk5    ;
00282   std::vector<int>* t_hltDoubleLooseIsoTau15_Trk5;
00283   
00284 
00285   std::vector<std::vector<int> >*      t_v_RH_h3x3_ieta;
00286   std::vector<std::vector<int> >*      t_v_RH_h3x3_iphi;
00287   std::vector<std::vector<double> >*   t_v_RH_h3x3_ene ;
00288   std::vector<std::vector<int> >*      t_v_RH_h5x5_ieta;
00289   std::vector<std::vector<int> >*      t_v_RH_h5x5_iphi;
00290   std::vector<std::vector<double> >*   t_v_RH_h5x5_ene ;
00291   std::vector<std::vector<int> >*      t_v_RH_r26_ieta ;
00292   std::vector<std::vector<int> >*      t_v_RH_r26_iphi ;
00293   std::vector<std::vector<double> >*   t_v_RH_r26_ene  ;
00294   std::vector<std::vector<int> >*      t_v_RH_r44_ieta ;
00295   std::vector<std::vector<int> >*      t_v_RH_r44_iphi ;
00296   std::vector<std::vector<double> >*   t_v_RH_r44_ene  ;
00297 
00298   std::vector<unsigned int>* t_irun;
00299   std::vector<unsigned int>* t_ievt;
00300   std::vector<unsigned int>* t_ilum;
00301   
00302 
00303   edm::Service<TFileService> fs;
00304 
00305   
00306 
00307 };
00308 
00309 
00310 #endif