00001 #ifndef CalibrationIsolatedParticlesIsolatedTracksNxN_h
00002 #define CalibrationIsolatedParticlesIsolatedTracksNxN_h
00003
00004
00005 #include <memory>
00006 #include <cmath>
00007 #include <string>
00008 #include <map>
00009 #include <vector>
00010
00011
00012 #include <Math/GenVector/VectorUtil.h>
00013
00014 #include "FWCore/Framework/interface/Frameworkfwd.h"
00015 #include "FWCore/Framework/interface/EDAnalyzer.h"
00016 #include "FWCore/Framework/interface/Event.h"
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/Framework/interface/EventSetup.h"
00019 #include "FWCore/Framework/interface/MakerMacros.h"
00020
00021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00022
00023
00024 #include "FWCore/ServiceRegistry/interface/Service.h"
00025 #include "CommonTools/UtilAlgos/interface/TFileService.h"
00026
00027 #include "DataFormats/Common/interface/Ref.h"
00028 #include "DataFormats/Common/interface/Handle.h"
00029 #include "DataFormats/Math/interface/Point3D.h"
00030 #include "DataFormats/Candidate/interface/Candidate.h"
00031
00032
00033 #include "DataFormats/TrackReco/interface/Track.h"
00034 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00035 #include "DataFormats/TrackReco/interface/HitPattern.h"
00036
00037 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00038 #include "DataFormats/VertexReco/interface/Vertex.h"
00039 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00040
00041 #include "DataFormats/DetId/interface/DetId.h"
00042 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00043 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00044 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00045 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00046 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00047 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00048 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00049 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00050 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapRecord.h"
00051 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMapFwd.h"
00052 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
00053
00054
00055 #include "DataFormats/L1Trigger/interface/L1JetParticle.h"
00056 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
00057 #include "DataFormats/L1Trigger/interface/L1EmParticle.h"
00058 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
00059 #include "DataFormats/L1Trigger/interface/L1MuonParticle.h"
00060 #include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h"
00061
00062
00063 #include "DataFormats/JetReco/interface/CaloJet.h"
00064 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00065 #include "DataFormats/JetReco/interface/JetExtendedAssociation.h"
00066
00067
00068 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
00069
00070 #include "SimDataFormats/Track/interface/SimTrack.h"
00071 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00072 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00073 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
00074
00075
00076 #include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"
00077 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00078 #include "SimTracker/Records/interface/TrackAssociatorRecord.h"
00079
00080 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00081 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00082 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00083 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
00084 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00085 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00086
00087 #include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
00088
00089 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00090 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
00091 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00092 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00093 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00094
00095 #include "Calibration/IsolatedParticles/interface/FindCaloHit.h"
00096 #include "Calibration/IsolatedParticles/interface/eECALMatrix.h"
00097 #include "Calibration/IsolatedParticles/interface/eHCALMatrix.h"
00098 #include "Calibration/IsolatedParticles/interface/MatchingSimTrack.h"
00099 #include "Calibration/IsolatedParticles/interface/CaloSimInfo.h"
00100
00101
00102 #include "TROOT.h"
00103 #include "TSystem.h"
00104 #include "TFile.h"
00105 #include "TH1F.h"
00106 #include "TH2F.h"
00107 #include "TProfile.h"
00108 #include "TDirectory.h"
00109 #include "TTree.h"
00110
00111 class IsolatedTracksNxN : public edm::EDAnalyzer {
00112
00113 public:
00114 explicit IsolatedTracksNxN(const edm::ParameterSet&);
00115 ~IsolatedTracksNxN();
00116
00117 private:
00118
00119 void beginJob() ;
00120 void analyze(const edm::Event&, const edm::EventSetup&);
00121 void endJob() ;
00122
00123 void printTrack(const reco::Track* pTrack);
00124
00125 void BookHistograms();
00126
00127 double DeltaPhi(double v1, double v2);
00128 double DeltaR(double eta1, double phi1, double eta2, double phi2);
00129
00130
00131 void clearTreeVectors();
00132
00133 private:
00134
00135 bool initL1, doMC;
00136 static const size_t nL1BitsMax=128;
00137 std::string algoBitToName[nL1BitsMax];
00138 std::map <std::string,bool> l1TriggerMap;
00139 std::map<std::string,bool>::iterator trig_iter;
00140
00141 double pvTracksPtMin_;
00142 bool debugL1Info_;
00143 int debugTrks_;
00144 bool printTrkHitPattern_;
00145 int myverbose_;
00146 edm::InputTag L1extraTauJetSource_, L1extraCenJetSource_, L1extraFwdJetSource_;
00147 edm::InputTag L1extraMuonSource_, L1extraIsoEmSource_, L1extraNonIsoEmSource_;
00148 edm::InputTag L1GTReadoutRcdSource_, L1GTObjectMapRcdSource_;
00149 edm::InputTag JetExtender_, JetSrc_;
00150
00151 double minTrackP_, maxTrackEta_;
00152 double tMinE_, tMaxE_, tMinH_, tMaxH_;
00153
00154 int nEventProc;
00155
00156
00157
00158
00159
00160 const MagneticField *bField;
00161
00162 double genPartPBins[16], genPartEtaBins[4];
00163
00164 static const size_t NPBins = 15;
00165 static const size_t NEtaBins = 3;
00166
00167 TH1F *h_maxNearP15x15[NPBins][NEtaBins],
00168 *h_maxNearP21x21[NPBins][NEtaBins],
00169 *h_maxNearP25x25[NPBins][NEtaBins],
00170 *h_maxNearP31x31[NPBins][NEtaBins];
00171
00172 TH1I *h_L1AlgoNames;
00173 TH1F *h_PVTracksWt;
00174
00175 TH1F *h_nTracks;
00176
00177 TH1F *h_recPt_0, *h_recP_0, *h_recEta_0, *h_recPhi_0;
00178 TH2F *h_recEtaPt_0, *h_recEtaP_0;
00179
00180 TH1F *h_recPt_1, *h_recP_1, *h_recEta_1, *h_recPhi_1;
00181 TH2F *h_recEtaPt_1, *h_recEtaP_1;
00182
00183 TH1F *h_recPt_2, *h_recP_2, *h_recEta_2, *h_recPhi_2;
00184 TH2F *h_recEtaPt_2, *h_recEtaP_2;
00185
00186
00187
00188 TTree* tree;
00189
00190 int t_nTracks;
00191
00192 int t_RunNo, t_EvtNo, t_Lumi, t_Bunch;
00193 std::vector<double> *t_PVx,*t_PVy,*t_PVz, *t_PVisValid, *t_PVNTracks, *t_PVNTracksWt, *t_PVTracksSumPt, *t_PVTracksSumPtWt, *t_PVndof;
00194 std::vector<double> *t_PVNTracksHP, *t_PVNTracksHPWt, *t_PVTracksSumPtHP, *t_PVTracksSumPtHPWt ;
00195
00196 std::vector<int> *t_L1Decision;
00197 std::vector<double> *t_L1CenJetPt, *t_L1CenJetEta, *t_L1CenJetPhi;
00198 std::vector<double> *t_L1FwdJetPt, *t_L1FwdJetEta, *t_L1FwdJetPhi;
00199 std::vector<double> *t_L1TauJetPt, *t_L1TauJetEta, *t_L1TauJetPhi;
00200 std::vector<double> *t_L1MuonPt, *t_L1MuonEta, *t_L1MuonPhi;
00201 std::vector<double> *t_L1IsoEMPt, *t_L1IsoEMEta, *t_L1IsoEMPhi;
00202 std::vector<double> *t_L1NonIsoEMPt, *t_L1NonIsoEMEta, *t_L1NonIsoEMPhi;
00203 std::vector<double> *t_L1METPt, *t_L1METEta, *t_L1METPhi;
00204
00205 std::vector<double> *t_jetPt, *t_jetEta, *t_jetPhi;
00206 std::vector<double> *t_nTrksJetCalo, *t_nTrksJetVtx;
00207
00208 std::vector<double> *t_trackPAll, *t_trackEtaAll, *t_trackPhiAll, *t_trackPdgIdAll;
00209 std::vector<double> *t_trackPtAll;
00210 std::vector<double> *t_trackDxyAll, *t_trackDzAll, *t_trackDxyPVAll,*t_trackDzPVAll, *t_trackChiSqAll;
00211
00212 std::vector<double> *t_trackP, *t_trackPt, *t_trackEta, *t_trackPhi;
00213 std::vector<double> *t_trackEcalEta, *t_trackEcalPhi, *t_trackHcalEta, *t_trackHcalPhi;
00214 std::vector<double> *t_trackDxy, *t_trackDxyBS, *t_trackDz, *t_trackDzBS;
00215 std::vector<double> *t_trackDxyPV, *t_trackDzPV;
00216 std::vector<double> *t_trackChiSq;
00217 std::vector<int> *t_trackPVIdx;
00218
00219 std::vector<int> *t_NLayersCrossed,*t_trackNOuterHits;
00220 std::vector<int> *t_trackHitsTOB, *t_trackHitsTEC;
00221 std::vector<int> *t_trackHitInMissTOB, *t_trackHitInMissTEC, *t_trackHitInMissTIB, *t_trackHitInMissTID, *t_trackHitInMissTIBTID;
00222 std::vector<int> *t_trackHitOutMissTOB,*t_trackHitOutMissTEC, *t_trackHitOutMissTIB, *t_trackHitOutMissTID,*t_trackHitOutMissTOBTEC;
00223 std::vector<int> *t_trackHitInMeasTOB, *t_trackHitInMeasTEC, *t_trackHitInMeasTIB, *t_trackHitInMeasTID;
00224 std::vector<int> *t_trackHitOutMeasTOB,*t_trackHitOutMeasTEC, *t_trackHitOutMeasTIB, *t_trackHitOutMeasTID;
00225 std::vector<double> *t_trackOutPosOutHitDr, *t_trackL;
00226
00227 std::vector<double> *t_maxNearP31x31;
00228 std::vector<double> *t_maxNearP25x25;
00229 std::vector<double> *t_maxNearP21x21;
00230 std::vector<double> *t_maxNearP15x15;
00231 std::vector<double> *t_maxNearP13x13;
00232 std::vector<double> *t_maxNearP11x11;
00233 std::vector<double> *t_maxNearP9x9;
00234 std::vector<double> *t_maxNearP7x7;
00235
00236 std::vector<int> *t_ecalSpike11x11;
00237 std::vector<double> *t_e3x3, *t_e5x5, *t_e7x7, *t_e9x9, *t_e11x11;
00238 std::vector<double> *t_e13x13, *t_e15x15, *t_e21x21, *t_e25x25, *t_e31x31;
00239
00240
00241 std::vector<double> *t_e7x7_10Sig, *t_e9x9_10Sig, *t_e11x11_10Sig, *t_e15x15_10Sig;
00242 std::vector<double> *t_e7x7_15Sig, *t_e9x9_15Sig, *t_e11x11_15Sig, *t_e15x15_15Sig;
00243 std::vector<double> *t_e7x7_20Sig, *t_e9x9_20Sig, *t_e11x11_20Sig, *t_e15x15_20Sig;
00244 std::vector<double> *t_e7x7_25Sig, *t_e9x9_25Sig, *t_e11x11_25Sig, *t_e15x15_25Sig;
00245 std::vector<double> *t_e7x7_30Sig, *t_e9x9_30Sig, *t_e11x11_30Sig, *t_e15x15_30Sig;
00246
00247 std::vector<double> *t_esimPdgId, *t_simTrackP;
00248
00249 std::vector<double> *t_trkEcalEne;
00250
00251 std::vector<double> *t_esim3x3, *t_esim5x5, *t_esim7x7, *t_esim9x9, *t_esim11x11;
00252 std::vector<double> *t_esim13x13, *t_esim15x15, *t_esim21x21, *t_esim25x25, *t_esim31x31;
00253
00254 std::vector<double> *t_esim3x3Matched, *t_esim5x5Matched, *t_esim7x7Matched, *t_esim9x9Matched, *t_esim11x11Matched;
00255 std::vector<double> *t_esim13x13Matched, *t_esim15x15Matched, *t_esim21x21Matched, *t_esim25x25Matched, *t_esim31x31Matched;
00256
00257 std::vector<double> *t_esim3x3Rest, *t_esim5x5Rest, *t_esim7x7Rest, *t_esim9x9Rest, *t_esim11x11Rest;
00258 std::vector<double> *t_esim13x13Rest, *t_esim15x15Rest, *t_esim21x21Rest, *t_esim25x25Rest, *t_esim31x31Rest;
00259
00260 std::vector<double> *t_esim3x3Photon, *t_esim5x5Photon, *t_esim7x7Photon, *t_esim9x9Photon, *t_esim11x11Photon;
00261 std::vector<double> *t_esim13x13Photon, *t_esim15x15Photon, *t_esim21x21Photon, *t_esim25x25Photon, *t_esim31x31Photon;
00262
00263 std::vector<double> *t_esim3x3NeutHad, *t_esim5x5NeutHad, *t_esim7x7NeutHad, *t_esim9x9NeutHad, *t_esim11x11NeutHad;
00264 std::vector<double> *t_esim13x13NeutHad, *t_esim15x15NeutHad, *t_esim21x21NeutHad, *t_esim25x25NeutHad, *t_esim31x31NeutHad;
00265
00266 std::vector<double> *t_esim3x3CharHad, *t_esim5x5CharHad, *t_esim7x7CharHad, *t_esim9x9CharHad, *t_esim11x11CharHad;
00267 std::vector<double> *t_esim13x13CharHad, *t_esim15x15CharHad, *t_esim21x21CharHad, *t_esim25x25CharHad, *t_esim31x31CharHad;
00268
00269
00270 std::vector<double> *t_maxNearHcalP3x3, *t_maxNearHcalP5x5, *t_maxNearHcalP7x7;
00271 std::vector<double> *t_h3x3, *t_h5x5, *t_h7x7;
00272 std::vector<double> *t_h3x3Sig, *t_h5x5Sig, *t_h7x7Sig;
00273 std::vector<int> *t_infoHcal;
00274
00275 std::vector<double> *t_trkHcalEne;
00276 std::vector<double> *t_hsim3x3, *t_hsim5x5, *t_hsim7x7;
00277 std::vector<double> *t_hsim3x3Matched, *t_hsim5x5Matched, *t_hsim7x7Matched;
00278 std::vector<double> *t_hsim3x3Rest, *t_hsim5x5Rest, *t_hsim7x7Rest;
00279 std::vector<double> *t_hsim3x3Photon, *t_hsim5x5Photon, *t_hsim7x7Photon;
00280 std::vector<double> *t_hsim3x3NeutHad, *t_hsim5x5NeutHad, *t_hsim7x7NeutHad;
00281 std::vector<double> *t_hsim3x3CharHad, *t_hsim5x5CharHad, *t_hsim7x7CharHad;
00282
00283 edm::Service<TFileService> fs;
00284 };
00285
00286 #endif