CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SimplePi0DiscAnalyzer Class Reference
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
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 44 of file SimplePi0DiscAnalyzer.cc.

Constructor & Destructor Documentation

◆ SimplePi0DiscAnalyzer()

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

Definition at line 84 of file SimplePi0DiscAnalyzer.cc.

84  {
85  outputFile_ = conf.getParameter<std::string>("outputFile");
86  rootFile_ = new TFile(outputFile_.c_str(), "RECREATE");
87 
88  photonCollectionProducer_ = conf.getParameter<std::string>("phoProducer");
89  photonCollection_ = conf.getParameter<std::string>("photonCollection");
90 }

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

◆ ~SimplePi0DiscAnalyzer()

SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer ( )
override

Definition at line 92 of file SimplePi0DiscAnalyzer.cc.

92  {
93  // do anything here that needs to be done at desctruction time
94  // (e.g. close files, deallocate resources etc.)
95  rootFile_->Write();
96  rootFile_->Close();
97 }

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 155 of file SimplePi0DiscAnalyzer.cc.

155  {
156  std::cout << std::endl;
157  std::cout << " -------------- NEW EVENT : Run, Event = " << iEvent.id() << std::endl;
158 
160  iEvent.getByLabel(photonCollectionProducer_, photonCollection_, PhotonHandle);
161  const reco::PhotonCollection photons = *(PhotonHandle.product());
162 
163  std::cout << "----> Photons size: " << photons.size() << std::endl;
164 
166  iEvent.getByLabel("piZeroDiscriminators", "PhotonPi0DiscriminatorAssociationMap", map);
168 
169  // int PhoInd = 0;
170 
171  for (reco::PhotonCollection::const_iterator iPho = photons.begin(); iPho != photons.end();
172  iPho++) { // Loop over Photons
173 
174  reco::Photon localPho(*iPho);
175 
176  float Photon_et = localPho.et();
177  float Photon_eta = localPho.eta();
178  float Photon_phi = localPho.phi();
179  float Photon_r9 = localPho.r9();
180  bool isPhotConv = localPho.hasConversionTracks();
181  // std::cout << "Photon Id = " << PhoInd
182  std::cout << "Photon Id = " << iPho - photons.begin() << " with Et = " << Photon_et << " Eta = " << Photon_eta
183  << " Phi = " << Photon_phi << " R9 = " << Photon_r9 << " and conv_id = " << isPhotConv << std::endl;
184 
185  auto it_super = localPho.superCluster(); // get the SC related to the Photon candidate
186 
187  // hConv_ntracks_->Fill(Ntrk_conv);
188 
189  float nn = -10;
190  // mapIter = map->find(edm::Ref<reco::PhotonCollection>(PhotonHandle,PhoInd));
191  mapIter = map->find(edm::Ref<reco::PhotonCollection>(PhotonHandle, iPho - photons.begin()));
192  if (mapIter != map->end()) {
193  nn = mapIter->val;
194  }
195  if (fabs(it_super->eta()) <= 1.442) {
196  hBarrel_nnout_Assoc_->Fill(nn);
197  hAll_nnout_Assoc_->Fill(nn);
198  std::cout << "AssociationMap Barrel NN = " << nn << std::endl;
199  if (!isPhotConv) {
202  }
203  if (Photon_r9 > 0.93) {
206  }
207  } else if ((fabs(it_super->eta()) >= 1.556 && fabs(it_super->eta()) < 1.65) || fabs(it_super->eta()) > 2.5) {
209  hAll_nnout_Assoc_->Fill(nn);
210  std::cout << "AssociationMap EndcNoPresh NN = " << nn << std::endl;
211  if (!isPhotConv) {
214  }
215  if (Photon_r9 > 0.93) {
218  }
219  } else if (fabs(it_super->eta()) >= 1.65 && fabs(it_super->eta()) <= 2.5) {
221  hAll_nnout_Assoc_->Fill(nn);
222  std::cout << "AssociationMap EndcWithPresh NN = " << nn << std::endl;
223  if (!isPhotConv) {
226  }
227  if (Photon_r9 > 0.93) {
230  }
231  }
232 
233  // PhoInd++;
234  } // End Loop over Photons
235 }

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 99 of file SimplePi0DiscAnalyzer.cc.

99  {
100  rootFile_->cd();
101  std::cout << "beginJob() -> Book the Histograms" << std::endl;
102 
103  hConv_ntracks_ = new TH1F("nConvTracks", "Number of tracks of converted Photons ", 10, 0., 10);
104  hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc", "NNout for All Photons(AssociationMap)", 100, 0., 1.);
106  new TH1F("All_nnout_NoConv_Assoc", "NNout for Unconverted Photons(AssociationMap)", 100, 0., 1.);
108  new TH1F("All_nnout_NoConv_Assoc_R9", "NNout for Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
109  hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc", "NNout for Barrel Photons(AssociationMap)", 100, 0., 1.);
111  new TH1F("barrel_nnout_NoConv_Assoc", "NNout for Barrel Unconverted Photons(AssociationMap)", 100, 0., 1.);
113  "barrel_nnout_NoConv_Assoc_R9", "NNout for Barrel Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
115  new TH1F("endcNoPresh_nnout_Assoc", "NNout for Endcap NoPresh Photons(AssociationMap)", 100, 0., 1.);
117  "endcNoPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted NoPresh Photons(AssociationMap)", 100, 0., 1.);
119  new TH1F("endcNoPresh_nnout_NoConv_Assoc_R9",
120  "NNout for Endcap Unconverted NoPresh Photons with R9>0.93 (AssociationMap)",
121  100,
122  0.,
123  1.);
125  new TH1F("endcWithPresh_nnout_Assoc", "NNout for Endcap WithPresh Photons(AssociationMap)", 100, 0., 1.);
127  "endcWithPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted WithPresh Photons(AssociationMap)", 100, 0., 1.);
129  new TH1F("endcWithPresh_nnout_NoConv_Assoc_R9",
130  "NNout for Endcap Unconverted WithPresh Photons with R9>0.93 (AssociationMap)",
131  100,
132  0.,
133  1.);
134 }

References gather_cfg::cout.

◆ endJob()

void SimplePi0DiscAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 136 of file SimplePi0DiscAnalyzer.cc.

136  {
137  rootFile_->cd();
138  std::cout << "endJob() -> Write the Histograms" << std::endl;
139  hConv_ntracks_->Write();
140 
141  hAll_nnout_Assoc_->Write();
142  hAll_nnout_NoConv_Assoc_->Write();
144  hBarrel_nnout_Assoc_->Write();
147  hEndcNoPresh_nnout_Assoc_->Write();
153 }

References gather_cfg::cout.

Member Data Documentation

◆ hAll_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
private

Definition at line 65 of file SimplePi0DiscAnalyzer.cc.

◆ hAll_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
private

Definition at line 66 of file SimplePi0DiscAnalyzer.cc.

◆ hAll_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
private

Definition at line 73 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
private

Definition at line 67 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
private

Definition at line 68 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
private

Definition at line 74 of file SimplePi0DiscAnalyzer.cc.

◆ hConv_ntracks_

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_
private

Definition at line 63 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
private

Definition at line 69 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
private

Definition at line 70 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 75 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
private

Definition at line 71 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
private

Definition at line 72 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 76 of file SimplePi0DiscAnalyzer.cc.

◆ outputFile_

std::string SimplePi0DiscAnalyzer::outputFile_
private

Definition at line 60 of file SimplePi0DiscAnalyzer.cc.

◆ photonCollection_

std::string SimplePi0DiscAnalyzer::photonCollection_
private

Definition at line 58 of file SimplePi0DiscAnalyzer.cc.

◆ photonCollectionProducer_

std::string SimplePi0DiscAnalyzer::photonCollectionProducer_
private

Definition at line 57 of file SimplePi0DiscAnalyzer.cc.

◆ rootFile_

TFile* SimplePi0DiscAnalyzer::rootFile_
private

Definition at line 61 of file SimplePi0DiscAnalyzer.cc.

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.cc:61
SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
TH1F * hAll_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:66
SimplePi0DiscAnalyzer::photonCollection_
std::string photonCollection_
Definition: SimplePi0DiscAnalyzer.cc:58
edm::Handle< reco::PhotonCollection >
edm::Ref
Definition: AssociativeIterator.h:58
SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
TH1F * hEndcNoPresh_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:69
SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
TH1F * hBarrel_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:67
SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
TH1F * hBarrel_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:68
SimplePi0DiscAnalyzer::photonCollectionProducer_
std::string photonCollectionProducer_
Definition: SimplePi0DiscAnalyzer.cc:57
edm::helpers::KeyVal::val
V val
Definition: AssociationMapHelpers.h:33
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
TH1F * hEndcWithPresh_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:71
SimplePi0DiscAnalyzer::hConv_ntracks_
TH1F * hConv_ntracks_
Definition: SimplePi0DiscAnalyzer.cc:63
SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
TH1F * hEndcNoPresh_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:70
iEvent
int iEvent
Definition: GenABIO.cc:224
SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
TH1F * hAll_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.cc:73
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.cc:76
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
groupFilesInBlocks.nn
nn
Definition: groupFilesInBlocks.py:150
reco::Photon
Definition: Photon.h:22
SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
TH1F * hAll_nnout_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:65
SimplePi0DiscAnalyzer::outputFile_
std::string outputFile_
Definition: SimplePi0DiscAnalyzer.cc:60
SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
TH1F * hBarrel_nnout_NoConv_Assoc_R9_
Definition: SimplePi0DiscAnalyzer.cc:74
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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.cc:75
SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
TH1F * hEndcWithPresh_nnout_NoConv_Assoc_
Definition: SimplePi0DiscAnalyzer.cc:72
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76