CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ggPFPhotonAnalyzer Class Reference

#include <ggPFPhotonAnalyzer.h>

Inheritance diagram for ggPFPhotonAnalyzer:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &es)
 
virtual void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
virtual void endJob ()
 
 ggPFPhotonAnalyzer (const edm::ParameterSet &iConfig)
 
 ~ggPFPhotonAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

edm::InputTag beamSpotCollection_
 
edm::InputTag ebReducedRecHitCollection_
 
edm::InputTag eeReducedRecHitCollection_
 
edm::InputTag esRecHitCollection_
 
const CaloSubdetectorGeometrygeomBar_
 
const CaloSubdetectorGeometrygeomEnd_
 
int hasSLConv_
 
int isConv_
 
int isMatch_
 
float MustE_
 
float MustEOut_
 
TTree * pf
 
TTree * pfclus
 
float PFClusRMS_
 
float PFClusRMSMust_
 
float PFdEta_
 
float PFdPhi_
 
edm::InputTag PFElectronTag_
 
const GBRForestPFLCBarrel_
 
const GBRForestPFLCEndcap_
 
float PFLowCE_
 
edm::InputTag pfPartTag_
 
float PFPhoECorr_
 
edm::InputTag PFPhotonTag_
 
float PFPS1_
 
float PFPS2_
 
float recoPFEnergy_
 
edm::InputTag recoPhotonTag_
 
float SCRawE_
 
TFile * tf1
 
float VtxZ_
 
float VtxZErr_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 23 of file ggPFPhotonAnalyzer.h.

Constructor & Destructor Documentation

ggPFPhotonAnalyzer::ggPFPhotonAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 5 of file ggPFPhotonAnalyzer.cc.

References beamSpotCollection_, ebReducedRecHitCollection_, eeReducedRecHitCollection_, esRecHitCollection_, edm::ParameterSet::getParameter(), hasSLConv_, isConv_, isMatch_, MustE_, MustEOut_, pf, pfclus, PFClusRMS_, PFClusRMSMust_, PFdEta_, PFdPhi_, PFElectronTag_, PFLCBarrel_, PFLCEndcap_, PFLowCE_, pfPartTag_, PFPhoECorr_, PFPhotonTag_, PFPS1_, PFPS2_, recoPFEnergy_, recoPhotonTag_, SCRawE_, tf1, VtxZ_, and VtxZErr_.

5  {
6  PFPhotonTag_=iConfig.getParameter<InputTag>("PFPhotons");
7  PFElectronTag_=iConfig.getParameter<InputTag>("PFElectrons");
8 
9  recoPhotonTag_=iConfig.getParameter<InputTag>("Photons");
10  ebReducedRecHitCollection_=iConfig.getParameter<InputTag>("ebReducedRecHitCollection");
11  eeReducedRecHitCollection_=iConfig.getParameter<InputTag>("eeReducedRecHitCollection");
12  esRecHitCollection_=iConfig.getParameter<InputTag>("esRecHitCollection");
13  beamSpotCollection_ =iConfig.getParameter<InputTag>("BeamSpotCollection");
14  pfPartTag_=iConfig.getParameter<InputTag>("PFParticles");
15  TFile *fgbr1 = new TFile("/afs/cern.ch/work/r/rpatel/public/TMVARegressionBarrelLC.root","READ");
16  TFile *fgbr2 = new TFile("/afs/cern.ch/work/r/rpatel/public/TMVARegressionEndCapLC.root","READ");
17  PFLCBarrel_=(const GBRForest*)fgbr1->Get("PFLCorrEB");
18  PFLCEndcap_=(const GBRForest*)fgbr2->Get("PFLCorrEE");
19  tf1=new TFile("PF_test.root", "RECREATE");
20  pf=new TTree("pf", "PFPhotons");
21  pfclus=new TTree("pflcus", "PFClusters");
22  pf->Branch("isConv", &isConv_, "isConv/I");
23  pf->Branch("hasSLConv", &hasSLConv_, "hasSLConv/I");
24  pf->Branch("isMatch", &isMatch_, "isMatch/I");
25  pf->Branch("PFPS1", &PFPS1_, "PFPS1/F");
26  pf->Branch("PFPS2", &PFPS2_, "PFPS2/F");
27  pf->Branch("MustE", &MustE_, "MustE/F");
28  pf->Branch("MustEOut", &MustEOut_, "MustEOut/F");
29  pf->Branch("PFLowCE", &PFLowCE_, "PFLowCE/F");
30  pf->Branch("PFdEta", &PFdEta_, "PFdEta/F");
31  pf->Branch("PFdPhi", &PFdPhi_, "PFdPhi/F");
32  pf->Branch("PFClusRMS", &PFClusRMS_, "PFClusRMS/F");
33  pf->Branch("PFClusRMSMust", &PFClusRMSMust_, "PFClusRMSMust/F");
34  pf->Branch("VtxZ", &VtxZ_, "VtxZ/F");
35  pf->Branch("VtxZErr", &VtxZErr_, "VtxZErr/F");
36  pf->Branch("PFPhoECorr", &PFPhoECorr_, "PFPhoECorr/F");
37  pf->Branch("recoPFEnergy", &recoPFEnergy_, "recoPFEnergy/F");
38  pf->Branch("SCRawE", &SCRawE_, "SCRawE");
39 }
T getParameter(std::string const &) const
edm::InputTag esRecHitCollection_
const GBRForest * PFLCEndcap_
edm::InputTag ebReducedRecHitCollection_
edm::InputTag beamSpotCollection_
edm::InputTag pfPartTag_
edm::InputTag PFElectronTag_
edm::InputTag recoPhotonTag_
edm::InputTag eeReducedRecHitCollection_
const GBRForest * PFLCBarrel_
edm::InputTag PFPhotonTag_
ggPFPhotonAnalyzer::~ggPFPhotonAnalyzer ( )

Definition at line 41 of file ggPFPhotonAnalyzer.cc.

41 {}

Member Function Documentation

void ggPFPhotonAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup es 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 48 of file ggPFPhotonAnalyzer.cc.

References beamSpotCollection_, ebReducedRecHitCollection_, DetId::Ecal, eeReducedRecHitCollection_, relval_parameters_module::energy, esRecHitCollection_, ggPFPhotons::fillPFClusters(), geomBar_, geomEnd_, edm::EventSetup::get(), edm::Event::getByLabel(), ggPFPhotons::getPFPhoECorr(), ggPFPhotons::hasSLConv(), hasSLConv_, i, ggPFPhotons::isConv(), isConv_, isMatch_, ggPFPhotons::MatchPFReco(), ggPFPhotons::MustE(), MustE_, ggPFPhotons::MustEOut(), MustEOut_, pf, PFClusRMS_, ggPFPhotons::PFClusRMSMust(), PFClusRMSMust_, ggPFPhotons::PFClusRMSTot(), ggPFPhotons::PFClusters(), ggPFPhotons::PFdEta(), PFdEta_, ggPFPhotons::PFdPhi(), PFdPhi_, PFElectronTag_, PFLCBarrel_, PFLCEndcap_, PFLowCE_, ggPFPhotons::PFLowE(), pfPartTag_, PFPhoECorr_, PFPhotonTag_, ggPFPhotons::PFPS1(), PFPS1_, ggPFPhotons::PFPS2(), PFPS2_, ggPFPhotons::PhotonPFCandMatch(), recoPFEnergy_, recoPhotonTag_, SCRawE_, ggPFPhotons::SLPoint(), VtxZ_, and VtxZErr_.

48  {
53  PhotonCollection::const_iterator iPfPho;
54  PhotonCollection::const_iterator iPho;
55  iEvent.getByLabel(PFPhotonTag_, PFPhotons);
56  iEvent.getByLabel(recoPhotonTag_, recoPhotons);
57  iEvent.getByLabel(PFElectronTag_,PFElectrons);
58  iEvent.getByLabel(pfPartTag_,PFParticles);
59  //for PFPhoton Constructor:
61  es.get<CaloGeometryRecord>().get(pG);
62  geomBar_=pG->getSubdetectorGeometry(DetId::Ecal,1);
63  geomEnd_=pG->getSubdetectorGeometry(DetId::Ecal,2);
64  edm::Handle<BeamSpot> beamSpotHandle;
65  edm::Handle<EcalRecHitCollection> EBReducedRecHits;
66  edm::Handle<EcalRecHitCollection> EEReducedRecHits;
68  iEvent.getByLabel(beamSpotCollection_ , beamSpotHandle);
69  iEvent.getByLabel(ebReducedRecHitCollection_, EBReducedRecHits);
70  iEvent.getByLabel(eeReducedRecHitCollection_, EEReducedRecHits);
71  iEvent.getByLabel(esRecHitCollection_ , ESRecHits);
72  iEvent.getByLabel(beamSpotCollection_,beamSpotHandle);
74  for(reco::PhotonCollection::const_iterator iPho = recoPhotons->begin(); iPho!=recoPhotons->end(); ++iPho) {
75  recoPFEnergy_=0;
76 
77  ggPFPhotons ggPFPhoton(*iPho, PFPhotons,
78  PFElectrons,
79  PFParticles,
80  EBReducedRecHits,
81  EEReducedRecHits,
82  ESRecHits,
83  geomBar_,
84  geomEnd_,
85  beamSpotHandle
86  );
87  if(ggPFPhoton.MatchPFReco()){
88  isMatch_=1;
89 
90  std::pair<float, float>VertexZ=ggPFPhoton.SLPoint();
91  VtxZ_=VertexZ.first;
92  VtxZErr_=VertexZ.second;
93 
94  if(ggPFPhoton.isConv()){
95  isConv_=1;
96  }
97  else isConv_=0;
98  if(ggPFPhoton.hasSLConv()){
99  hasSLConv_=1;
100  }
101  else hasSLConv_=0;
102 
103  ggPFPhoton.fillPFClusters();
104  PFPS1_=ggPFPhoton.PFPS1();
105  PFPS2_=ggPFPhoton.PFPS2();
106  MustE_=ggPFPhoton.MustE();
107  MustEOut_=ggPFPhoton.MustEOut();
108  PFLowCE_=ggPFPhoton.PFLowE();
109  PFdEta_=ggPFPhoton.PFdEta();
110  PFdPhi_=ggPFPhoton.PFdPhi();
111  PFClusRMS_=ggPFPhoton.PFClusRMSTot();
112  PFClusRMSMust_=ggPFPhoton.PFClusRMSMust();
113  std::vector<reco::CaloCluster>PFC=ggPFPhoton.PFClusters();
114  PFPhoECorr_=ggPFPhoton.getPFPhoECorr(PFC, PFLCBarrel_, PFLCEndcap_);
115  }
116  else{
117  isMatch_=0;
118  std::vector<reco::CaloCluster>PFC;
119  std::vector<reco::PFCandidatePtr>insideBox;
120  std::vector<DetId>MatchedRH;
121  ggPFPhoton.PhotonPFCandMatch(*(iPho->superCluster()), insideBox,PFParticles,PFC, MatchedRH);
122  recoPFEnergy_=0;
123  //cout<<"Inside Box "<<insideBox.size()<<endl;
124  for(unsigned int i=0; i<PFC.size(); ++i)recoPFEnergy_=recoPFEnergy_+PFC[i].energy();
125  SCRawE_=iPho->superCluster()->rawEnergy();
126  //cout<<"PF reconstructed E "<<recoPFEnergy_<<"SC Raw E "<<(*iPho).superCluster()->rawEnergy()<<endl;
127  PFPS1_=ggPFPhoton.PFPS1();
128  PFPS2_=ggPFPhoton.PFPS2();
129  MustE_=ggPFPhoton.MustE();
130  MustEOut_=ggPFPhoton.MustEOut();
131  PFLowCE_=ggPFPhoton.PFLowE();
132  PFdEta_=ggPFPhoton.PFdEta();
133  PFdPhi_=ggPFPhoton.PFdPhi();
134  PFClusRMS_=ggPFPhoton.PFClusRMSTot();
135  PFClusRMSMust_=ggPFPhoton.PFClusRMSMust();
136  }
137  pf->Fill();
138  }
139 
140 }
int i
Definition: DBlmapReader.cc:9
edm::InputTag esRecHitCollection_
const GBRForest * PFLCEndcap_
edm::InputTag ebReducedRecHitCollection_
edm::InputTag beamSpotCollection_
edm::InputTag pfPartTag_
const CaloSubdetectorGeometry * geomEnd_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::InputTag PFElectronTag_
edm::InputTag recoPhotonTag_
edm::InputTag eeReducedRecHitCollection_
const T & get() const
Definition: EventSetup.h:55
const CaloSubdetectorGeometry * geomBar_
const GBRForest * PFLCBarrel_
edm::InputTag PFPhotonTag_
void ggPFPhotonAnalyzer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 43 of file ggPFPhotonAnalyzer.cc.

43  {
44 
45 
46 }
void ggPFPhotonAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 143 of file ggPFPhotonAnalyzer.cc.

References pf, and tf1.

143  {
144  tf1->cd();
145  pf->Write();
146  tf1->Write();
147  tf1->Close();
148 
149 }

Member Data Documentation

edm::InputTag ggPFPhotonAnalyzer::beamSpotCollection_
private

Definition at line 43 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::ebReducedRecHitCollection_
private

Definition at line 40 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::eeReducedRecHitCollection_
private

Definition at line 41 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::esRecHitCollection_
private

Definition at line 42 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

const CaloSubdetectorGeometry* ggPFPhotonAnalyzer::geomBar_
private

Definition at line 44 of file ggPFPhotonAnalyzer.h.

Referenced by analyze().

const CaloSubdetectorGeometry* ggPFPhotonAnalyzer::geomEnd_
private

Definition at line 45 of file ggPFPhotonAnalyzer.h.

Referenced by analyze().

int ggPFPhotonAnalyzer::hasSLConv_
private

Definition at line 52 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

int ggPFPhotonAnalyzer::isConv_
private

Definition at line 51 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

int ggPFPhotonAnalyzer::isMatch_
private

Definition at line 53 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::MustE_
private

Definition at line 56 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::MustEOut_
private

Definition at line 57 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

TTree* ggPFPhotonAnalyzer::pf
private

Definition at line 49 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), endJob(), and ggPFPhotonAnalyzer().

TTree* ggPFPhotonAnalyzer::pfclus
private

Definition at line 50 of file ggPFPhotonAnalyzer.h.

Referenced by ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFClusRMS_
private

Definition at line 61 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFClusRMSMust_
private

Definition at line 62 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFdEta_
private

Definition at line 59 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFdPhi_
private

Definition at line 60 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::PFElectronTag_
private

Definition at line 38 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

const GBRForest* ggPFPhotonAnalyzer::PFLCBarrel_
private

Definition at line 46 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

const GBRForest* ggPFPhotonAnalyzer::PFLCEndcap_
private

Definition at line 47 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFLowCE_
private

Definition at line 58 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::pfPartTag_
private

Definition at line 39 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFPhoECorr_
private

Definition at line 65 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::PFPhotonTag_
private

Definition at line 36 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFPS1_
private

Definition at line 54 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::PFPS2_
private

Definition at line 55 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::recoPFEnergy_
private

Definition at line 66 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

edm::InputTag ggPFPhotonAnalyzer::recoPhotonTag_
private

Definition at line 37 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::SCRawE_
private

Definition at line 67 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

TFile* ggPFPhotonAnalyzer::tf1
private

Definition at line 48 of file ggPFPhotonAnalyzer.h.

Referenced by endJob(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::VtxZ_
private

Definition at line 63 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().

float ggPFPhotonAnalyzer::VtxZErr_
private

Definition at line 64 of file ggPFPhotonAnalyzer.h.

Referenced by analyze(), and ggPFPhotonAnalyzer().