CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
aod2patFilterZee Class Reference
Inheritance diagram for aod2patFilterZee:
edm::EDFilter edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 aod2patFilterZee (const edm::ParameterSet &)
 
 ~aod2patFilterZee ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

virtual void beginJob ()
 
virtual void endJob ()
 
virtual bool filter (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::InputTag electronCollectionTag_
 
edm::InputTag metCollectionTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 57 of file aod2patFilterZee.cc.

Constructor & Destructor Documentation

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

Definition at line 89 of file aod2patFilterZee.cc.

References electronCollectionTag_, edm::ParameterSet::getUntrackedParameter(), and metCollectionTag_.

90 {
91 
93  ("electronCollectionTag");
95  ("metCollectionTag");
96 
97 
98  produces< pat::ElectronCollection >
99  ("patElectrons").setBranchAlias("patElectrons");
100 
101  produces< pat::METCollection>("patCaloMets").setBranchAlias("patCaloMets");
102  //produces< pat::METCollection>("patPfMets").setBranchAlias("patPfMets");
103  //produces< pat::METCollection>("patTcMets").setBranchAlias("patTcMets");
104  //produces< pat::METCollection>("patT1cMets").setBranchAlias("patT1cMets");
105 
106 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag metCollectionTag_
edm::InputTag electronCollectionTag_
aod2patFilterZee::~aod2patFilterZee ( )

Definition at line 108 of file aod2patFilterZee.cc.

109 {
110 
111  // do anything here that needs to be done at desctruction time
112  // (e.g. close files, deallocate resources etc.)
113 
114 }

Member Function Documentation

void aod2patFilterZee::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 178 of file aod2patFilterZee.cc.

178  {
179 }
void aod2patFilterZee::endJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 183 of file aod2patFilterZee.cc.

183  {
184 }
bool aod2patFilterZee::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDFilter.

Definition at line 118 of file aod2patFilterZee.cc.

References gather_cfg::cout, electronCollectionTag_, edm::Event::getByLabel(), gsfElectrons_cfi::gsfElectrons, CaloMET_cfi::met, metCollectionTag_, electronProducer_cfi::patElectrons, edm::Event::put(), pat::Lepton< LeptonType >::setEcalIso(), pat::Lepton< LeptonType >::setHcalIso(), and pat::Lepton< LeptonType >::setTrackIso().

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

119 {
120  using namespace edm;
121  using namespace std;
122  using namespace pat;
123  // *************************************************************************
124  // ELECTRONS
125  // *************************************************************************
128  if (!gsfElectrons.isValid()) {
129  std::cout <<"aod2patFilterZee: Could not get electron collection with label: "
130  <<electronCollectionTag_ << std::endl;
131  return false;
132  }
133  const reco::GsfElectronCollection *pElecs = gsfElectrons.product();
134  // calculate your electrons
135  auto_ptr<pat::ElectronCollection> patElectrons(new pat::ElectronCollection);
136  for (reco::GsfElectronCollection::const_iterator elec = pElecs->begin();
137  elec != pElecs->end(); ++elec) {
138  reco::GsfElectron mygsfelec = *elec;
139  pat::Electron myElectron(mygsfelec);
140  // now set the isolations from the Gsf electron
141  myElectron.setTrackIso(elec->dr03TkSumPt());
142  myElectron.setEcalIso(elec->dr04EcalRecHitSumEt());
143  myElectron.setHcalIso(elec->dr04HcalTowerSumEt());
144 
145  patElectrons->push_back(myElectron);
146  }
147  // *************************************************************************
148  // METs
149  // *************************************************************************
151  iEvent.getByLabel(metCollectionTag_, calomets);
152  if (! calomets.isValid()) {
153  std::cout << "aod2patFilterZee: Could not get met collection with label: "
154  << metCollectionTag_ << std::endl;
155  return false;
156  }
157  const reco::CaloMETCollection *mycalomets = calomets.product();
158  auto_ptr<pat::METCollection> patCaloMets(new pat::METCollection);
159  for (reco::CaloMETCollection::const_iterator met = mycalomets->begin();
160  met != mycalomets->end(); ++ met ) {
161  pat::MET mymet(*met);
162  patCaloMets->push_back(mymet);
163  }
164 
165  //
166  // put everything in the event
167  //
168  iEvent.put( patElectrons, "patElectrons");
169  iEvent.put( patCaloMets, "patCaloMets");
170  //
171 
172  return true;
173 
174 }
Analysis-level MET class.
Definition: MET.h:42
edm::InputTag metCollectionTag_
std::vector< MET > METCollection
Definition: MET.h:31
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< Electron > ElectronCollection
Definition: Electron.h:37
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
edm::InputTag electronCollectionTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
Analysis-level electron class.
Definition: Electron.h:52
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::InputTag aod2patFilterZee::electronCollectionTag_
private

Definition at line 76 of file aod2patFilterZee.cc.

Referenced by aod2patFilterZee(), and filter().

edm::InputTag aod2patFilterZee::metCollectionTag_
private

Definition at line 77 of file aod2patFilterZee.cc.

Referenced by aod2patFilterZee(), and filter().