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
SimplePi0DiscAnalyzer Class Reference

#include <SimplePi0DiscAnalyzer.h>

Inheritance diagram for SimplePi0DiscAnalyzer:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &e, const edm::EventSetup &c)
 
virtual void beginJob ()
 
virtual void endJob ()
 
 SimplePi0DiscAnalyzer (const edm::ParameterSet &conf)
 
virtual ~SimplePi0DiscAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

TH1F * hAll_nnout_Assoc_
 
TH1F * hAll_nnout_NoConv_Assoc_
 
TH1F * hAll_nnout_NoConv_Assoc_R9_
 
TH1F * hBarrel_nnout_Assoc_
 
TH1F * hBarrel_nnout_NoConv_Assoc_
 
TH1F * hBarrel_nnout_NoConv_Assoc_R9_
 
TH1F * hConv_ntracks_
 
TH1F * hEndcNoPresh_nnout_Assoc_
 
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_
 
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_R9_
 
TH1F * hEndcWithPresh_nnout_Assoc_
 
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_
 
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_R9_
 
std::string outputFile_
 
std::string photonCollection_
 
std::string photonCollectionProducer_
 
TFile * rootFile_
 

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

Description: Pi0Disc analyzer using reco data

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file SimplePi0DiscAnalyzer.h.

Constructor & Destructor Documentation

SimplePi0DiscAnalyzer::SimplePi0DiscAnalyzer ( const edm::ParameterSet conf)
explicit

Definition at line 50 of file SimplePi0DiscAnalyzer.cc.

References edm::ParameterSet::getParameter().

51 {
52 
53  outputFile_ = conf.getParameter<std::string>("outputFile");
54  rootFile_ = new TFile(outputFile_.c_str(),"RECREATE");
55 
56 
57  photonCollectionProducer_ = conf.getParameter<std::string>("phoProducer");
58  photonCollection_ = conf.getParameter<std::string>("photonCollection");
59 
60 
61 
62 }
T getParameter(std::string const &) const
SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer ( )
virtual

Definition at line 64 of file SimplePi0DiscAnalyzer.cc.

65 {
66 
67  // do anything here that needs to be done at desctruction time
68  // (e.g. close files, deallocate resources etc.)
69  rootFile_->Write();
70  rootFile_->Close();
71 }

Member Function Documentation

void SimplePi0DiscAnalyzer::analyze ( const edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 117 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::Event::getByLabel(), reco::Photon::hasConversionTracks(), edm::EventBase::id(), Association::map, reco::LeafCandidate::phi(), interactiveExample::photons, edm::Handle< T >::product(), reco::Photon::r9(), reco::Photon::superCluster(), and edm::helpers::KeyVal< K, V >::val.

118 {
119  std::cout << std::endl;
120  std::cout << " -------------- NEW EVENT : Run, Event = " << iEvent.id() << std::endl;
121 
123  iEvent.getByLabel(photonCollectionProducer_, photonCollection_ , PhotonHandle);
124  const reco::PhotonCollection photons = *(PhotonHandle.product());
125 
126  std::cout <<"----> Photons size: "<< photons.size()<<std::endl;
127 
129  iEvent.getByLabel("piZeroDiscriminators","PhotonPi0DiscriminatorAssociationMap", map);
131 
132 // int PhoInd = 0;
133 
134  for( reco::PhotonCollection::const_iterator iPho = photons.begin(); iPho != photons.end(); iPho++) { // Loop over Photons
135 
136  reco::Photon localPho(*iPho);
137 
138  float Photon_et = localPho.et(); float Photon_eta = localPho.eta();
139  float Photon_phi = localPho.phi(); float Photon_r9 = localPho.r9();
140  bool isPhotConv = localPho.hasConversionTracks();
141 // std::cout << "Photon Id = " << PhoInd
142  std::cout << "Photon Id = " << iPho - photons.begin()
143  << " with Et = " << Photon_et
144  << " Eta = " << Photon_eta
145  << " Phi = " << Photon_phi
146  << " R9 = " << Photon_r9
147  << " and conv_id = " << isPhotConv << std::endl;
148 
149 
150  SuperClusterRef it_super = localPho.superCluster(); // get the SC related to the Photon candidate
151 
152 // hConv_ntracks_->Fill(Ntrk_conv);
153 
154  float nn = -10;
155 // mapIter = map->find(edm::Ref<reco::PhotonCollection>(PhotonHandle,PhoInd));
156  mapIter = map->find(edm::Ref<reco::PhotonCollection>(PhotonHandle,iPho - photons.begin()));
157  if(mapIter!=map->end()) {
158  nn = mapIter->val;
159  }
160  if(fabs(it_super->eta()) <= 1.442) {
161  hBarrel_nnout_Assoc_->Fill(nn);
162  hAll_nnout_Assoc_->Fill(nn);
163  std::cout << "AssociationMap Barrel NN = " << nn << std::endl;
164  if(!isPhotConv) {
165  hBarrel_nnout_NoConv_Assoc_->Fill(nn);
166  hAll_nnout_NoConv_Assoc_->Fill(nn);
167  }
168  if(Photon_r9>0.93) {
170  hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
171  }
172  } else if( (fabs(it_super->eta()) >= 1.556 && fabs(it_super->eta()) < 1.65) || fabs(it_super->eta()) > 2.5) {
173  hEndcNoPresh_nnout_Assoc_->Fill(nn);
174  hAll_nnout_Assoc_->Fill(nn);
175  std::cout << "AssociationMap EndcNoPresh NN = " << nn << std::endl;
176  if(!isPhotConv) {
178  hAll_nnout_NoConv_Assoc_->Fill(nn);
179  }
180  if(Photon_r9>0.93) {
182  hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
183  }
184  } else if(fabs(it_super->eta()) >= 1.65 && fabs(it_super->eta()) <= 2.5 ) {
185  hEndcWithPresh_nnout_Assoc_->Fill(nn);
186  hAll_nnout_Assoc_->Fill(nn);
187  std::cout << "AssociationMap EndcWithPresh NN = " << nn << std::endl;
188  if(!isPhotConv) {
190  hAll_nnout_NoConv_Assoc_->Fill(nn);
191  }
192  if(Photon_r9>0.93) {
194  hAll_nnout_NoConv_Assoc_R9_->Fill(nn);
195  }
196  }
197 
198 
199 // PhoInd++;
200  } // End Loop over Photons
201 
202 }
dictionary map
Definition: Association.py:205
int iEvent
Definition: GenABIO.cc:243
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
T const * product() const
Definition: Handle.h:74
tuple cout
Definition: gather_cfg.py:121
void SimplePi0DiscAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

73  {
74 
75  rootFile_->cd();
76  std::cout << "beginJob() -> Book the Histograms" << std::endl;
77 
78  hConv_ntracks_ = new TH1F("nConvTracks","Number of tracks of converted Photons ",10,0.,10);
79  hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc","NNout for All Photons(AssociationMap)",100,0.,1.);
80  hAll_nnout_NoConv_Assoc_ = new TH1F("All_nnout_NoConv_Assoc","NNout for Unconverted Photons(AssociationMap)",100,0.,1.);
81  hAll_nnout_NoConv_Assoc_R9_ = new TH1F("All_nnout_NoConv_Assoc_R9","NNout for Unconverted Photons with R9>0.93 (AssociationMap)",100,0.,1.);
82  hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc","NNout for Barrel Photons(AssociationMap)",100,0.,1.);
83  hBarrel_nnout_NoConv_Assoc_ = new TH1F("barrel_nnout_NoConv_Assoc","NNout for Barrel Unconverted Photons(AssociationMap)",100,0.,1.);
84  hBarrel_nnout_NoConv_Assoc_R9_ = new TH1F("barrel_nnout_NoConv_Assoc_R9","NNout for Barrel Unconverted Photons with R9>0.93 (AssociationMap)",100,0.,1.);
85  hEndcNoPresh_nnout_Assoc_ = new TH1F("endcNoPresh_nnout_Assoc","NNout for Endcap NoPresh Photons(AssociationMap)",100,0.,1.);
86  hEndcNoPresh_nnout_NoConv_Assoc_ = new TH1F("endcNoPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted NoPresh Photons(AssociationMap)",100,0.,1.);
87  hEndcNoPresh_nnout_NoConv_Assoc_R9_ = new TH1F("endcNoPresh_nnout_NoConv_Assoc_R9","NNout for Endcap Unconverted NoPresh Photons with R9>0.93 (AssociationMap)",100,0.,1.);
88  hEndcWithPresh_nnout_Assoc_ = new TH1F("endcWithPresh_nnout_Assoc","NNout for Endcap WithPresh Photons(AssociationMap)",100,0.,1.);
89  hEndcWithPresh_nnout_NoConv_Assoc_ = new TH1F("endcWithPresh_nnout_NoConv_Assoc","NNout for Endcap Unconverted WithPresh Photons(AssociationMap)",100,0.,1.);
90  hEndcWithPresh_nnout_NoConv_Assoc_R9_ = new TH1F("endcWithPresh_nnout_NoConv_Assoc_R9","NNout for Endcap Unconverted WithPresh Photons with R9>0.93 (AssociationMap)",100,0.,1.);
91 
92 }
tuple cout
Definition: gather_cfg.py:121
void SimplePi0DiscAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 95 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

95  {
96 
97  rootFile_->cd();
98  std::cout << "endJob() -> Write the Histograms" << std::endl;
99  hConv_ntracks_->Write();
100 
101  hAll_nnout_Assoc_->Write();
102  hAll_nnout_NoConv_Assoc_->Write();
104  hBarrel_nnout_Assoc_->Write();
107  hEndcNoPresh_nnout_Assoc_->Write();
113 
114 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
private

Definition at line 67 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
private

Definition at line 68 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
private

Definition at line 75 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
private

Definition at line 69 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
private

Definition at line 70 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
private

Definition at line 76 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_
private

Definition at line 65 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
private

Definition at line 71 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
private

Definition at line 72 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 77 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
private

Definition at line 73 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
private

Definition at line 74 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 78 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::outputFile_
private

Definition at line 62 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::photonCollection_
private

Definition at line 60 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::photonCollectionProducer_
private

Definition at line 59 of file SimplePi0DiscAnalyzer.h.

TFile* SimplePi0DiscAnalyzer::rootFile_
private

Definition at line 63 of file SimplePi0DiscAnalyzer.h.