Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:06:06

0001 #ifndef Validation_EcalClusters_ContainmentCorrectionAnalyzer_h
0002 #define Validation_EcalClusters_ContainmentCorrectionAnalyzer_h
0003 
0004 // system include files
0005 #include <memory>
0006 
0007 // user include files
0008 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "FWCore/ServiceRegistry/interface/Service.h"
0016 #include "FWCore/Utilities/interface/Exception.h"
0017 //
0018 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0019 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0020 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0021 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
0022 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0023 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
0024 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
0025 #include "SimDataFormats/TrackingAnalysis/interface/TrackingParticleFwd.h"
0026 #include "SimDataFormats/TrackingAnalysis/interface/TrackingVertexContainer.h"
0027 #include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
0028 //
0029 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0030 #include "DataFormats/Common/interface/Handle.h"
0031 #include "DataFormats/Math/interface/LorentzVector.h"
0032 //
0033 #include "Validation/EcalClusters/interface/EcalSimPhotonMCTruth.h"
0034 //
0035 #include "CLHEP/Units/GlobalPhysicalConstants.h"
0036 #include "TF1.h"
0037 #include "TFile.h"
0038 #include "TH1.h"
0039 #include <algorithm>
0040 #include <iostream>
0041 #include <map>
0042 #include <string>
0043 #include <vector>
0044 class TFile;
0045 
0046 class EcalSimPhotonMCTruth;
0047 
0048 class ContainmentCorrectionAnalyzer : public edm::one::EDAnalyzer<> {
0049 public:
0050   explicit ContainmentCorrectionAnalyzer(const edm::ParameterSet &);
0051   ~ContainmentCorrectionAnalyzer() override;
0052 
0053   void analyze(const edm::Event &, const edm::EventSetup &) override;
0054   void beginJob() override;
0055   void endJob() override;
0056 
0057 private:
0058   float ecalEta(float EtaParticle, float Zvertex, float plane_Radius);
0059   std::vector<EcalSimPhotonMCTruth> findMcTruth(std::vector<SimTrack> &theSimTracks,
0060                                                 std::vector<SimVertex> &theSimVertices);
0061   void fillMcTruth(std::vector<SimTrack> &theSimTracks, std::vector<SimVertex> &theSimVertices);
0062 
0063   edm::EDGetTokenT<edm::SimTrackContainer> SimTrackCollection_;
0064   edm::EDGetTokenT<edm::SimVertexContainer> SimVertexCollection_;
0065   edm::EDGetTokenT<reco::SuperClusterCollection> BarrelSuperClusterCollection_;
0066   edm::EDGetTokenT<reco::SuperClusterCollection> EndcapSuperClusterCollection_;
0067   edm::EDGetTokenT<EcalRecHitCollection> reducedBarrelRecHitCollection_;
0068   edm::EDGetTokenT<EcalRecHitCollection> reducedEndcapRecHitCollection_;
0069   edm::ESGetToken<CaloTopology, CaloTopologyRecord> pTopologyToken;
0070 
0071   int nMCphotons;
0072   std::vector<float> mcEnergy, mcEta, mcPhi, mcPt;
0073   std::vector<int> isConverted;
0074   std::vector<float> x_vtx, y_vtx, z_vtx;
0075   int nRECOphotons;
0076   std::vector<float> superClusterEnergy, superClusterEta, superClusterPhi, superClusterEt;
0077   std::vector<float> e1, e9, e25;
0078   std::vector<int> seedXtal;
0079   std::vector<int> iMC;
0080 
0081   std::map<unsigned, unsigned> geantToIndex_;
0082 
0083   TH1F *h_EB_eRecoEtrueReference;
0084   TH1F *h_EB_e9EtrueReference;
0085   TH1F *h_EB_e25EtrueReference;
0086   TH1F *h_EE_eRecoEtrueReference;
0087   TH1F *h_EE_e9EtrueReference;
0088   TH1F *h_EE_e25EtrueReference;
0089   TH1F *h_EB_eTrue;
0090   TH1F *h_EE_eTrue;
0091   TH1F *h_EB_converted;
0092   TH1F *h_EE_converted;
0093 };
0094 #endif