CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
L1ElectronRecoTreeProducer Class Reference
Inheritance diagram for L1ElectronRecoTreeProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1ElectronRecoTreeProducer (const edm::ParameterSet &)
 
 ~L1ElectronRecoTreeProducer () 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
 
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)
 

Public Attributes

L1Analysis::L1AnalysisRecoElectronelectron
 
L1Analysis::L1AnalysisRecoElectronDataFormatelectron_data
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
 
bool electronsMissing_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
 
edm::EDGetTokenT< reco::GsfElectronCollectionElectronToken_
 
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
 
edm::Service< TFileServicefs_
 
unsigned int maxElectron_
 
TTree * tree_
 

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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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)
 
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

Definition at line 43 of file L1ElectronRecoTreeProducer.cc.

Constructor & Destructor Documentation

◆ L1ElectronRecoTreeProducer()

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

Definition at line 79 of file L1ElectronRecoTreeProducer.cc.

References electron, electron_data, ElectronLooseIdMapToken_, ElectronMediumIdMapToken_, ElectronTightIdMapToken_, ElectronToken_, ElectronVetoIdMapToken_, fs_, L1Analysis::L1AnalysisRecoElectron::getData(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), TFileService::make(), maxElectron_, and tree_.

79  : electronsMissing_(false) {
80  maxElectron_ = iConfig.getParameter<unsigned int>("maxElectron");
81  //ElectronToken_ = mayConsume<edm::View<reco::GsfElectron> >(iConfig.getUntrackedParameter("ElectronToken",edm::InputTag("gedGsfElectrons")));
82  ElectronToken_ = consumes<reco::GsfElectronCollection>(
83  iConfig.getUntrackedParameter("ElectronToken", edm::InputTag("gedGsfElectrons")));
84 
85  /*RhoToken_ = consumes<double>(iConfig.getUntrackedParameter("RhoToken",edm::InputTag("fixedGridRhoFastjetAllCalo")));
86  vtxToken_ = mayConsume<reco::VertexCollection>(iConfig.getUntrackedParameter("vtxToken",edm::InputTag("offlinePrimaryVertices")));
87  conversionsToken_ = mayConsume< reco::ConversionCollection >(iConfig.getUntrackedParameter("conversionsToken",edm::InputTag("conversions")));
88  beamSpotToken_ = mayConsume< reco::BeamSpot>(iConfig.getUntrackedParameter("beamSpotToken",edm::InputTag("offlineBeamSpot")));*/
89 
90  ElectronVetoIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter(
91  "eleVetoIdMapToken", edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-veto")));
92  ElectronLooseIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter(
93  "eleLooseIdMapToken", edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-loose")));
94  ElectronMediumIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter(
95  "eleMediumIdMapToken", edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-medium")));
96  ElectronTightIdMapToken_ = consumes<edm::ValueMap<bool> >(iConfig.getUntrackedParameter(
97  "eleTightIdMapToken", edm::InputTag("egmGsfElectronIDs:cutBasedElectronID-Spring15-25ns-V1-standalone-tight")));
98 
101 
102  tree_ = fs_->make<TTree>("ElectronRecoTree", "ElectronRecoTree");
103  tree_->Branch("Electron", "L1Analysis::L1AnalysisRecoElectronDataFormat", &electron_data, 32000, 3);
104 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Service< TFileService > fs_
edm::EDGetTokenT< reco::GsfElectronCollection > ElectronToken_
L1Analysis::L1AnalysisRecoElectron * electron
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
T getUntrackedParameter(std::string const &, T const &) const
L1Analysis::L1AnalysisRecoElectronDataFormat * electron_data
L1AnalysisRecoElectronDataFormat * getData()
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64

◆ ~L1ElectronRecoTreeProducer()

L1ElectronRecoTreeProducer::~L1ElectronRecoTreeProducer ( )
override

Definition at line 106 of file L1ElectronRecoTreeProducer.cc.

106  {
107  // do anything here that needs to be done at desctruction time
108  // (e.g. close files, deallocate resources etc.)
109 }

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 116 of file L1ElectronRecoTreeProducer.cc.

References electron, ElectronLooseIdMapToken_, ElectronMediumIdMapToken_, electronsMissing_, ElectronTightIdMapToken_, ElectronToken_, ElectronVetoIdMapToken_, iEvent, edm::HandleBase::isValid(), maxElectron_, L1Analysis::L1AnalysisRecoElectron::Reset(), L1Analysis::L1AnalysisRecoElectron::SetElectron(), and tree_.

116  {
117  electron->Reset();
118  //edm::Handle<edm::View<reco::GsfElectron> > recoElectrons;
119  //iEvent.getByToken(ElectronToken_, recoElectrons);
121  iEvent.getByToken(ElectronToken_, recoElectrons);
122 
123  std::vector<edm::Handle<edm::ValueMap<bool> > > eleVIDDecisionHandles(4);
124 
125  iEvent.getByToken(ElectronVetoIdMapToken_, eleVIDDecisionHandles[0]);
126  iEvent.getByToken(ElectronLooseIdMapToken_, eleVIDDecisionHandles[1]);
127  iEvent.getByToken(ElectronMediumIdMapToken_, eleVIDDecisionHandles[2]);
128  iEvent.getByToken(ElectronTightIdMapToken_, eleVIDDecisionHandles[3]);
129 
130  if (recoElectrons.isValid() && eleVIDDecisionHandles[0].isValid() && eleVIDDecisionHandles[1].isValid() &&
131  eleVIDDecisionHandles[2].isValid() && eleVIDDecisionHandles[3].isValid()) {
132  electron->SetElectron(iEvent, iSetup, recoElectrons, eleVIDDecisionHandles, maxElectron_);
133  } else {
134  if (!electronsMissing_) {
135  edm::LogWarning("MissingProduct") << "CaloJets not found. Branch will not be filled" << std::endl;
136  }
137  electronsMissing_ = true;
138  }
139 
140  tree_->Fill();
141 }
edm::EDGetTokenT< reco::GsfElectronCollection > ElectronToken_
L1Analysis::L1AnalysisRecoElectron * electron
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronMediumIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronLooseIdMapToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronTightIdMapToken_
edm::EDGetTokenT< edm::ValueMap< bool > > ElectronVetoIdMapToken_
bool isValid() const
Definition: HandleBase.h:70
void SetElectron(const edm::Event &event, const edm::EventSetup &setup, const edm::Handle< reco::GsfElectronCollection > electrons, const std::vector< edm::Handle< edm::ValueMap< bool > > > eleVIDDecisionHandles, const unsigned &maxElectron)
Log< level::Warning, false > LogWarning

◆ beginJob()

void L1ElectronRecoTreeProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file L1ElectronRecoTreeProducer.cc.

144 {}

◆ endJob()

void L1ElectronRecoTreeProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file L1ElectronRecoTreeProducer.cc.

147 {}

Member Data Documentation

◆ electron

L1Analysis::L1AnalysisRecoElectron* L1ElectronRecoTreeProducer::electron

Definition at line 54 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ electron_data

L1Analysis::L1AnalysisRecoElectronDataFormat* L1ElectronRecoTreeProducer::electron_data

Definition at line 56 of file L1ElectronRecoTreeProducer.cc.

Referenced by L1ElectronRecoTreeProducer().

◆ ElectronLooseIdMapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronLooseIdMapToken_
private

Definition at line 70 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ ElectronMediumIdMapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronMediumIdMapToken_
private

Definition at line 71 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ electronsMissing_

bool L1ElectronRecoTreeProducer::electronsMissing_
private

Definition at line 75 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze().

◆ ElectronTightIdMapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronTightIdMapToken_
private

Definition at line 72 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ ElectronToken_

edm::EDGetTokenT<reco::GsfElectronCollection> L1ElectronRecoTreeProducer::ElectronToken_
private

Definition at line 68 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ ElectronVetoIdMapToken_

edm::EDGetTokenT<edm::ValueMap<bool> > L1ElectronRecoTreeProducer::ElectronVetoIdMapToken_
private

Definition at line 69 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ fs_

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

Definition at line 60 of file L1ElectronRecoTreeProducer.cc.

Referenced by L1ElectronRecoTreeProducer().

◆ maxElectron_

unsigned int L1ElectronRecoTreeProducer::maxElectron_
private

Definition at line 76 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().

◆ tree_

TTree* L1ElectronRecoTreeProducer::tree_
private

Definition at line 63 of file L1ElectronRecoTreeProducer.cc.

Referenced by analyze(), and L1ElectronRecoTreeProducer().