CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SimplePi0DiscAnalyzer Class Reference

#include <SimplePi0DiscAnalyzer.h>

Inheritance diagram for SimplePi0DiscAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginJob () override
 
void endJob () override
 
 SimplePi0DiscAnalyzer (const edm::ParameterSet &conf)
 
 ~SimplePi0DiscAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Pi0Disc analyzer using reco data

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

Definition at line 42 of file SimplePi0DiscAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file SimplePi0DiscAnalyzer.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 63 of file SimplePi0DiscAnalyzer.cc.

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

Member Function Documentation

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

Definition at line 116 of file SimplePi0DiscAnalyzer.cc.

References edm::AssociationMap< edm::OneToValue< std::vector< reco::Photon >, float > >::const_iterator, gather_cfg::cout, DEFINE_FWK_MODULE, edm::AssociationMap< Tag >::end(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), edm::AssociationMap< Tag >::find(), edm::Event::getByLabel(), reco::Photon::hasConversionTracks(), edm::EventBase::id(), genParticles_cff::map, groupFilesInBlocks::nn, reco::LeafCandidate::phi(), muons_cff::photons, edm::Handle< T >::product(), reco::Photon::r9(), and reco::Photon::superCluster().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

94  {
95 
96  rootFile_->cd();
97  std::cout << "endJob() -> Write the Histograms" << std::endl;
98  hConv_ntracks_->Write();
99 
100  hAll_nnout_Assoc_->Write();
101  hAll_nnout_NoConv_Assoc_->Write();
103  hBarrel_nnout_Assoc_->Write();
106  hEndcNoPresh_nnout_Assoc_->Write();
112 
113 }

Member Data Documentation

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
private

Definition at line 66 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
private

Definition at line 67 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
private

Definition at line 74 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
private

Definition at line 68 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
private

Definition at line 69 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
private

Definition at line 75 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_
private

Definition at line 64 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
private

Definition at line 70 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
private

Definition at line 71 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 76 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
private

Definition at line 72 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
private

Definition at line 73 of file SimplePi0DiscAnalyzer.h.

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 77 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::outputFile_
private

Definition at line 61 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::photonCollection_
private

Definition at line 59 of file SimplePi0DiscAnalyzer.h.

std::string SimplePi0DiscAnalyzer::photonCollectionProducer_
private

Definition at line 58 of file SimplePi0DiscAnalyzer.h.

TFile* SimplePi0DiscAnalyzer::rootFile_
private

Definition at line 62 of file SimplePi0DiscAnalyzer.h.