CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1PhotonRecoTreeProducer Class Reference
Inheritance diagram for L1PhotonRecoTreeProducer:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 L1PhotonRecoTreeProducer (const edm::ParameterSet &)
 
 ~L1PhotonRecoTreeProducer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Public Attributes

L1Analysis::L1AnalysisRecoPhotonphoton
 
L1Analysis::L1AnalysisRecoPhotonDataFormatphoton_data
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob (void) override
 
void endJob () override
 

Private Attributes

edm::Service< TFileServicefs_
 
unsigned int maxPhoton_
 
bool photonsMissing_
 
edm::EDGetTokenT< reco::PhotonCollectionPhotonToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP80MapToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP90MapToken_
 
TTree * tree_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 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

Definition at line 43 of file L1PhotonRecoTreeProducer.cc.

Constructor & Destructor Documentation

◆ L1PhotonRecoTreeProducer()

L1PhotonRecoTreeProducer::L1PhotonRecoTreeProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 78 of file L1PhotonRecoTreeProducer.cc.

References fs_, L1Analysis::L1AnalysisRecoPhoton::getData(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::kSharedResource, TFileService::make(), maxPhoton_, photon, photon_data, PhotonToken_, PhotonWP80MapToken_, PhotonWP90MapToken_, and tree_.

78  : photonsMissing_(false) {
79  maxPhoton_ = iConfig.getParameter<unsigned int>("maxPhoton");
80  PhotonToken_ =
81  consumes<reco::PhotonCollection>(iConfig.getUntrackedParameter("PhotonToken", edm::InputTag("photons")));
82 
83  PhotonWP80MapToken_ = consumes<edm::ValueMap<bool> >(
84  iConfig.getUntrackedParameter("phoWP80MapToken", edm::InputTag("egmPhotonIDs:mvaPhoID-RunIIIWinter22-v1-wp80")));
85  PhotonWP90MapToken_ = consumes<edm::ValueMap<bool> >(
86  iConfig.getUntrackedParameter("phoWP90MapToken", edm::InputTag("egmPhotonIDs:mvaPhoID-RunIIIWinter22-v1-wp90")));
87 
90 
91  usesResource(TFileService::kSharedResource);
92  tree_ = fs_->make<TTree>("PhotonRecoTree", "PhotonRecoTree");
93  tree_->Branch("Photon", "L1Analysis::L1AnalysisRecoPhotonDataFormat", &photon_data, 32000, 3);
94 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::PhotonCollection > PhotonToken_
L1AnalysisRecoPhotonDataFormat * getData()
T getUntrackedParameter(std::string const &, T const &) const
edm::Service< TFileService > fs_
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP80MapToken_
L1Analysis::L1AnalysisRecoPhoton * photon
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP90MapToken_
L1Analysis::L1AnalysisRecoPhotonDataFormat * photon_data

◆ ~L1PhotonRecoTreeProducer()

L1PhotonRecoTreeProducer::~L1PhotonRecoTreeProducer ( )
override

Definition at line 96 of file L1PhotonRecoTreeProducer.cc.

96  {
97  // do anything here that needs to be done at desctruction time
98  // (e.g. close files, deallocate resources etc.)
99 }

Member Function Documentation

◆ analyze()

void L1PhotonRecoTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 106 of file L1PhotonRecoTreeProducer.cc.

References iEvent, edm::HandleBase::isValid(), maxPhoton_, photon, photonsMissing_, PhotonToken_, PhotonWP80MapToken_, PhotonWP90MapToken_, L1Analysis::L1AnalysisRecoPhoton::Reset(), L1Analysis::L1AnalysisRecoPhoton::SetPhoton(), and tree_.

106  {
107  photon->Reset();
109  iEvent.getByToken(PhotonToken_, recoPhotons);
110 
111  std::vector<edm::Handle<edm::ValueMap<bool> > > phoVIDDecisionHandles(2);
112 
113  iEvent.getByToken(PhotonWP80MapToken_, phoVIDDecisionHandles[0]);
114  iEvent.getByToken(PhotonWP90MapToken_, phoVIDDecisionHandles[1]);
115 
116  if (recoPhotons.isValid() && phoVIDDecisionHandles[0].isValid() && phoVIDDecisionHandles[1].isValid()) {
117  photon->SetPhoton(iEvent, iSetup, recoPhotons, phoVIDDecisionHandles, maxPhoton_);
118  } else {
119  if (!photonsMissing_) {
120  edm::LogWarning("MissingProduct") << "Photons or photon ID not found. Branch will not be filled" << std::endl;
121  }
122  photonsMissing_ = true;
123  }
124 
125  tree_->Fill();
126 }
void SetPhoton(const edm::Event &event, const edm::EventSetup &setup, const edm::Handle< reco::PhotonCollection > photons, const std::vector< edm::Handle< edm::ValueMap< bool > > > phoVIDDecisionHandles, const unsigned &maxPhoton)
edm::EDGetTokenT< reco::PhotonCollection > PhotonToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP80MapToken_
L1Analysis::L1AnalysisRecoPhoton * photon
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::ValueMap< bool > > PhotonWP90MapToken_
Log< level::Warning, false > LogWarning

◆ beginJob()

void L1PhotonRecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 129 of file L1PhotonRecoTreeProducer.cc.

129 {}

◆ endJob()

void L1PhotonRecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 132 of file L1PhotonRecoTreeProducer.cc.

132 {}

◆ fillDescriptions()

void L1PhotonRecoTreeProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 134 of file L1PhotonRecoTreeProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), and submitPVResolutionJobs::desc.

134  {
136  desc.add<unsigned int>("maxPhoton", 20);
137  descriptions.addWithDefaultLabel(desc);
138 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ fs_

edm::Service<TFileService> L1PhotonRecoTreeProducer::fs_
private

Definition at line 62 of file L1PhotonRecoTreeProducer.cc.

Referenced by L1PhotonRecoTreeProducer().

◆ maxPhoton_

unsigned int L1PhotonRecoTreeProducer::maxPhoton_
private

Definition at line 75 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().

◆ photon

L1Analysis::L1AnalysisRecoPhoton* L1PhotonRecoTreeProducer::photon

Definition at line 54 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().

◆ photon_data

L1Analysis::L1AnalysisRecoPhotonDataFormat* L1PhotonRecoTreeProducer::photon_data

Definition at line 56 of file L1PhotonRecoTreeProducer.cc.

Referenced by L1PhotonRecoTreeProducer().

◆ photonsMissing_

bool L1PhotonRecoTreeProducer::photonsMissing_
private

Definition at line 74 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze().

◆ PhotonToken_

edm::EDGetTokenT<reco::PhotonCollection> L1PhotonRecoTreeProducer::PhotonToken_
private

Definition at line 69 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().

◆ PhotonWP80MapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1PhotonRecoTreeProducer::PhotonWP80MapToken_
private

Definition at line 70 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().

◆ PhotonWP90MapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1PhotonRecoTreeProducer::PhotonWP90MapToken_
private

Definition at line 71 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().

◆ tree_

TTree* L1PhotonRecoTreeProducer::tree_
private

Definition at line 65 of file L1PhotonRecoTreeProducer.cc.

Referenced by analyze(), and L1PhotonRecoTreeProducer().