CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: Pi0Disc analyzer using reco data

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

Definition at line 43 of file SimplePi0DiscAnalyzer.cc.

Constructor & Destructor Documentation

◆ SimplePi0DiscAnalyzer()

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

Definition at line 83 of file SimplePi0DiscAnalyzer.cc.

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

83  {
84  outputFile_ = conf.getParameter<std::string>("outputFile");
85  rootFile_ = new TFile(outputFile_.c_str(), "RECREATE");
86 
87  photonCollectionProducer_ = conf.getParameter<std::string>("phoProducer");
88  photonCollection_ = conf.getParameter<std::string>("photonCollection");
89 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303

◆ ~SimplePi0DiscAnalyzer()

SimplePi0DiscAnalyzer::~SimplePi0DiscAnalyzer ( )
override

Definition at line 91 of file SimplePi0DiscAnalyzer.cc.

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

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 154 of file SimplePi0DiscAnalyzer.cc.

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.

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

◆ beginJob()

void SimplePi0DiscAnalyzer::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 98 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

98  {
99  rootFile_->cd();
100  std::cout << "beginJob() -> Book the Histograms" << std::endl;
101 
102  hConv_ntracks_ = new TH1F("nConvTracks", "Number of tracks of converted Photons ", 10, 0., 10);
103  hAll_nnout_Assoc_ = new TH1F("All_nnout_Assoc", "NNout for All Photons(AssociationMap)", 100, 0., 1.);
105  new TH1F("All_nnout_NoConv_Assoc", "NNout for Unconverted Photons(AssociationMap)", 100, 0., 1.);
107  new TH1F("All_nnout_NoConv_Assoc_R9", "NNout for Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
108  hBarrel_nnout_Assoc_ = new TH1F("barrel_nnout_Assoc", "NNout for Barrel Photons(AssociationMap)", 100, 0., 1.);
110  new TH1F("barrel_nnout_NoConv_Assoc", "NNout for Barrel Unconverted Photons(AssociationMap)", 100, 0., 1.);
112  "barrel_nnout_NoConv_Assoc_R9", "NNout for Barrel Unconverted Photons with R9>0.93 (AssociationMap)", 100, 0., 1.);
114  new TH1F("endcNoPresh_nnout_Assoc", "NNout for Endcap NoPresh Photons(AssociationMap)", 100, 0., 1.);
116  "endcNoPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted NoPresh Photons(AssociationMap)", 100, 0., 1.);
118  new TH1F("endcNoPresh_nnout_NoConv_Assoc_R9",
119  "NNout for Endcap Unconverted NoPresh Photons with R9>0.93 (AssociationMap)",
120  100,
121  0.,
122  1.);
124  new TH1F("endcWithPresh_nnout_Assoc", "NNout for Endcap WithPresh Photons(AssociationMap)", 100, 0., 1.);
126  "endcWithPresh_nnout_NoConv_Assoc", "NNout for Endcap Unconverted WithPresh Photons(AssociationMap)", 100, 0., 1.);
128  new TH1F("endcWithPresh_nnout_NoConv_Assoc_R9",
129  "NNout for Endcap Unconverted WithPresh Photons with R9>0.93 (AssociationMap)",
130  100,
131  0.,
132  1.);
133 }

◆ endJob()

void SimplePi0DiscAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 135 of file SimplePi0DiscAnalyzer.cc.

References gather_cfg::cout.

135  {
136  rootFile_->cd();
137  std::cout << "endJob() -> Write the Histograms" << std::endl;
138  hConv_ntracks_->Write();
139 
140  hAll_nnout_Assoc_->Write();
141  hAll_nnout_NoConv_Assoc_->Write();
143  hBarrel_nnout_Assoc_->Write();
146  hEndcNoPresh_nnout_Assoc_->Write();
152 }

Member Data Documentation

◆ hAll_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_Assoc_
private

Definition at line 64 of file SimplePi0DiscAnalyzer.cc.

◆ hAll_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_
private

Definition at line 65 of file SimplePi0DiscAnalyzer.cc.

◆ hAll_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hAll_nnout_NoConv_Assoc_R9_
private

Definition at line 72 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_Assoc_
private

Definition at line 66 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_
private

Definition at line 67 of file SimplePi0DiscAnalyzer.cc.

◆ hBarrel_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hBarrel_nnout_NoConv_Assoc_R9_
private

Definition at line 73 of file SimplePi0DiscAnalyzer.cc.

◆ hConv_ntracks_

TH1F* SimplePi0DiscAnalyzer::hConv_ntracks_
private

Definition at line 62 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_Assoc_
private

Definition at line 68 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_
private

Definition at line 69 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcNoPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcNoPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 74 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_Assoc_
private

Definition at line 70 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_NoConv_Assoc_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_
private

Definition at line 71 of file SimplePi0DiscAnalyzer.cc.

◆ hEndcWithPresh_nnout_NoConv_Assoc_R9_

TH1F* SimplePi0DiscAnalyzer::hEndcWithPresh_nnout_NoConv_Assoc_R9_
private

Definition at line 75 of file SimplePi0DiscAnalyzer.cc.

◆ outputFile_

std::string SimplePi0DiscAnalyzer::outputFile_
private

Definition at line 59 of file SimplePi0DiscAnalyzer.cc.

◆ photonCollection_

std::string SimplePi0DiscAnalyzer::photonCollection_
private

Definition at line 57 of file SimplePi0DiscAnalyzer.cc.

◆ photonCollectionProducer_

std::string SimplePi0DiscAnalyzer::photonCollectionProducer_
private

Definition at line 56 of file SimplePi0DiscAnalyzer.cc.

◆ rootFile_

TFile* SimplePi0DiscAnalyzer::rootFile_
private

Definition at line 60 of file SimplePi0DiscAnalyzer.cc.