CMS 3D CMS Logo

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

#include <SimplePi0DiscAnalyzer.h>

Inheritance diagram for SimplePi0DiscAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase 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::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: Pi0Disc analyzer using reco data

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

Definition at line 41 of file SimplePi0DiscAnalyzer.h.

Constructor & Destructor Documentation

◆ SimplePi0DiscAnalyzer()

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

Definition at line 49 of file SimplePi0DiscAnalyzer.cc.

49  {
50  outputFile_ = conf.getParameter<std::string>("outputFile");
51  rootFile_ = new TFile(outputFile_.c_str(), "RECREATE");
52 
53  photonCollectionProducer_ = conf.getParameter<std::string>("phoProducer");
54  photonCollection_ = conf.getParameter<std::string>("photonCollection");
55 }

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

◆ ~SimplePi0DiscAnalyzer()

SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer ( )
override

Definition at line 57 of file SimplePi0DiscAnalyzer.cc.

57  {
58  // do anything here that needs to be done at desctruction time
59  // (e.g. close files, deallocate resources etc.)
60  rootFile_->Write();
61  rootFile_->Close();
62 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 120 of file SimplePi0DiscAnalyzer.cc.

120  {
121  std::cout << std::endl;
122  std::cout << " -------------- NEW EVENT : Run, Event = " << iEvent.id() << std::endl;
123 
125  iEvent.getByLabel(photonCollectionProducer_, photonCollection_, PhotonHandle);
126  const reco::PhotonCollection photons = *(PhotonHandle.product());
127 
128  std::cout << "----> Photons size: " << photons.size() << std::endl;
129 
131  iEvent.getByLabel("piZeroDiscriminators", "PhotonPi0DiscriminatorAssociationMap", map);
133 
134  // int PhoInd = 0;
135 
136  for (reco::PhotonCollection::const_iterator iPho = photons.begin(); iPho != photons.end();
137  iPho++) { // Loop over Photons
138 
139  reco::Photon localPho(*iPho);
140 
141  float Photon_et = localPho.et();
142  float Photon_eta = localPho.eta();
143  float Photon_phi = localPho.phi();
144  float Photon_r9 = localPho.r9();
145  bool isPhotConv = localPho.hasConversionTracks();
146  // std::cout << "Photon Id = " << PhoInd
147  std::cout << "Photon Id = " << iPho - photons.begin() << " with Et = " << Photon_et << " Eta = " << Photon_eta
148  << " Phi = " << Photon_phi << " R9 = " << Photon_r9 << " and conv_id = " << isPhotConv << std::endl;
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) {
167  }
168  if (Photon_r9 > 0.93) {
171  }
172  } else if ((fabs(it_super->eta()) >= 1.556 && fabs(it_super->eta()) < 1.65) || fabs(it_super->eta()) > 2.5) {
174  hAll_nnout_Assoc_->Fill(nn);
175  std::cout << "AssociationMap EndcNoPresh NN = " << nn << std::endl;
176  if (!isPhotConv) {
179  }
180  if (Photon_r9 > 0.93) {
183  }
184  } else if (fabs(it_super->eta()) >= 1.65 && fabs(it_super->eta()) <= 2.5) {
186  hAll_nnout_Assoc_->Fill(nn);
187  std::cout << "AssociationMap EndcWithPresh NN = " << nn << std::endl;
188  if (!isPhotConv) {
191  }
192  if (Photon_r9 > 0.93) {
195  }
196  }
197 
198  // PhoInd++;
199  } // End Loop over Photons
200 }

References gather_cfg::cout, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), reco::Photon::hasConversionTracks(), iEvent, genParticles_cff::map, groupFilesInBlocks::nn, reco::LeafCandidate::phi(), BPHMonitor_cfi::photons, edm::Handle< T >::product(), reco::Photon::r9(), reco::Photon::superCluster(), and edm::helpers::KeyVal< K, V >::val.

◆ beginJob()

void SimplePi0DiscAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 64 of file SimplePi0DiscAnalyzer.cc.

64  {
65  rootFile_->cd();
66  std::cout << "beginJob() -> Book the Histograms" << std::endl;
67 
68  hConv_ntracks_ = new TH1F("nConvTracks", "Number of tracks of converted Photons ", 10, 0., 10);
69  hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc", "NNout for All Photons(AssociationMap)", 100, 0., 1.);
71  new TH1F("All_nnout_NoConv_Assoc", "NNout for Unconverted Photons(AssociationMap)", 100, 0., 1.);
73  new TH1F("All_nnout_NoConv_Assoc_R9", "NNout for Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
74  hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc", "NNout for Barrel Photons(AssociationMap)", 100, 0., 1.);
76  new TH1F("barrel_nnout_NoConv_Assoc", "NNout for Barrel Unconverted Photons(AssociationMap)", 100, 0., 1.);
78  "barrel_nnout_NoConv_Assoc_R9", "NNout for Barrel Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
80  new TH1F("endcNoPresh_nnout_Assoc", "NNout for Endcap NoPresh Photons(AssociationMap)", 100, 0., 1.);
82  "endcNoPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted NoPresh Photons(AssociationMap)", 100, 0., 1.);
84  new TH1F("endcNoPresh_nnout_NoConv_Assoc_R9",
85  "NNout for Endcap Unconverted NoPresh Photons with R9>0.93 (AssociationMap)",
86  100,
87  0.,
88  1.);
90  new TH1F("endcWithPresh_nnout_Assoc", "NNout for Endcap WithPresh Photons(AssociationMap)", 100, 0., 1.);
92  "endcWithPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted WithPresh Photons(AssociationMap)", 100, 0., 1.);
94  new TH1F("endcWithPresh_nnout_NoConv_Assoc_R9",
95  "NNout for Endcap Unconverted WithPresh Photons with R9>0.93 (AssociationMap)",
96  100,
97  0.,
98  1.);
99 }

References gather_cfg::cout.

◆ endJob()

void SimplePi0DiscAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 101 of file SimplePi0DiscAnalyzer.cc.

101  {
102  rootFile_->cd();
103  std::cout << "endJob() -> Write the Histograms" << std::endl;
104  hConv_ntracks_->Write();
105 
106  hAll_nnout_Assoc_->Write();
107  hAll_nnout_NoConv_Assoc_->Write();
109  hBarrel_nnout_Assoc_->Write();
112  hEndcNoPresh_nnout_Assoc_->Write();
118 }

References gather_cfg::cout.

Member Data Documentation

◆ hAll_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
private

Definition at line 62 of file SimplePi0DiscAnalyzer.h.

◆ hAll_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
private

Definition at line 63 of file SimplePi0DiscAnalyzer.h.

◆ hAll_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
private

Definition at line 70 of file SimplePi0DiscAnalyzer.h.

◆ hBarrel_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
private

Definition at line 64 of file SimplePi0DiscAnalyzer.h.

◆ hBarrel_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
private

Definition at line 65 of file SimplePi0DiscAnalyzer.h.

◆ hBarrel_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
private

Definition at line 71 of file SimplePi0DiscAnalyzer.h.

◆ hConv_ntracks_

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_
private

Definition at line 60 of file SimplePi0DiscAnalyzer.h.

◆ hEndcNoPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
private

Definition at line 66 of file SimplePi0DiscAnalyzer.h.

◆ hEndcNoPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
private

Definition at line 67 of file SimplePi0DiscAnalyzer.h.

◆ hEndcNoPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 72 of file SimplePi0DiscAnalyzer.h.

◆ hEndcWithPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
private

Definition at line 68 of file SimplePi0DiscAnalyzer.h.

◆ hEndcWithPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
private

Definition at line 69 of file SimplePi0DiscAnalyzer.h.

◆ hEndcWithPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 73 of file SimplePi0DiscAnalyzer.h.

◆ outputFile_

std::string SimplePi0DiscAnalyzer::outputFile_
private

Definition at line 57 of file SimplePi0DiscAnalyzer.h.

◆ photonCollection_

std::string SimplePi0DiscAnalyzer::photonCollection_
private

Definition at line 55 of file SimplePi0DiscAnalyzer.h.

◆ photonCollectionProducer_

std::string SimplePi0DiscAnalyzer::photonCollectionProducer_
private

Definition at line 54 of file SimplePi0DiscAnalyzer.h.

◆ rootFile_

TFile* SimplePi0DiscAnalyzer::rootFile_
private

Definition at line 58 of file SimplePi0DiscAnalyzer.h.

edm::Handle::product
T const * product() const
Definition: Handle.h:70
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SimplePi0DiscAnalyzer::rootFile_
TFile * rootFile_
Definition: SimplePi0DiscAnalyzer.h:58
SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
TH1F * hAll_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.h:63
SimplePi0DiscAnalyzer::photonCollection_
std::string photonCollection_
Definition: SimplePi0DiscAnalyzer.h:55
edm::Handle< reco::PhotonCollection >
edm::Ref< SuperClusterCollection >
SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
TH1F * hEndcNoPresh_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.h:66
SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
TH1F * hBarrel_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.h:64
SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
TH1F * hBarrel_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.h:65
SimplePi0DiscAnalyzer::photonCollectionProducer_
std::string photonCollectionProducer_
Definition: SimplePi0DiscAnalyzer.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::helpers::KeyVal::val
V val
Definition: AssociationMapHelpers.h:33
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
TH1F * hEndcWithPresh_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.h:68
SimplePi0DiscAnalyzer::hConv_ntracks_
TH1F * hConv_ntracks_
Definition: SimplePi0DiscAnalyzer.h:60
SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.h:67
iEvent
int iEvent
Definition: GenABIO.cc:224
SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
TH1F * hAll_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.h:70
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.h:73
groupFilesInBlocks.nn
nn
Definition: groupFilesInBlocks.py:150
reco::Photon
Definition: Photon.h:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
TH1F * hAll_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.h:62
SimplePi0DiscAnalyzer::outputFile_
std::string outputFile_
Definition: SimplePi0DiscAnalyzer.h:57
SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
TH1F * hBarrel_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.h:71
reco::PhotonCollection
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
genParticles_cff.map
map
Definition: genParticles_cff.py:11
SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.h:72
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.h:69
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76