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
ElectronSeedTrackRefUpdater Class Reference

#include <TauAnalysis/ElectronSeedTrackRefUpdater/src/ElectronSeedTrackRefUpdater.cc>

Inheritance diagram for ElectronSeedTrackRefUpdater:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronSeedTrackRefUpdater (const edm::ParameterSet &)
 
 ~ElectronSeedTrackRefUpdater ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::InputTag _inPreId
 
edm::InputTag _inSeeds
 
edm::InputTag _targetTracks
 
std::string preidgsf_
 
std::string preidname_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: <one line="" class="" summary>="">

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

Definition at line 47 of file ElectronSeedTrackRefUpdater.cc.

Constructor & Destructor Documentation

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

Definition at line 77 of file ElectronSeedTrackRefUpdater.cc.

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

77  :
78  _inSeeds(iConfig.getParameter< edm::InputTag > ("inSeeds")),
79  _inPreId(iConfig.getParameter< edm::InputTag > ("inPreId")),
80  _targetTracks(iConfig.getParameter< edm::InputTag > ("targetTracks"))
81 {
82  preidgsf_ = iConfig.getParameter<std::string>("PreGsfLabel");
83  preidname_= iConfig.getParameter<std::string>("PreIdLabel");
84 
85  produces<ElectronSeedCollection>(preidgsf_);
86  produces<PreIdCollection>(preidname_);
87  //produces<edm::ValueMap<reco::PreIdRef> >(preidname_);
88 
89 }
T getParameter(std::string const &) const
ElectronSeedTrackRefUpdater::~ElectronSeedTrackRefUpdater ( )

Definition at line 92 of file ElectronSeedTrackRefUpdater.cc.

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

Member Function Documentation

void ElectronSeedTrackRefUpdater::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 195 of file ElectronSeedTrackRefUpdater.cc.

196 {
197 }
void ElectronSeedTrackRefUpdater::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 201 of file ElectronSeedTrackRefUpdater.cc.

201  {
202 }
void ElectronSeedTrackRefUpdater::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 107 of file ElectronSeedTrackRefUpdater.cc.

References _inPreId, _inSeeds, _targetTracks, gather_cfg::cout, deltaR(), newFWLiteAna::found, edm::Event::getByLabel(), i, edm::Ref< C, T, F >::isAvailable(), edm::Ref< C, T, F >::isNull(), preidgsf_, preidname_, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, reco::ElectronSeed::setCtfTrack(), and reco::PreId::setTrack().

108 {
109  using namespace edm;
110  using namespace std;
111  using namespace reco;
112 
113  auto_ptr<ElectronSeedCollection> output_preid(new ElectronSeedCollection);
114  auto_ptr<PreIdCollection> output_preidinfo(new PreIdCollection);
115 
117  iEvent.getByLabel( _targetTracks, hTargetTracks);
118 
120  iEvent.getByLabel( _inSeeds, hElectronSeeds);
121 
123  iEvent.getByLabel( _inPreId, hPreId);
124 
125  for (PreIdCollection::const_iterator it = hPreId->begin(); it!=hPreId->end(); ++ it){
126  PreId newPreId(*it);
127  TrackRef currentTrRef = it->trackRef();
128  if ( currentTrRef.isNull() || !currentTrRef.isAvailable() ) {
129  std::cout << "XXXX whoops! Org track ref empty!!" << std::endl;
130  // keep things as they are;
131  output_preidinfo->push_back(newPreId);
132  continue;
133  }
134  size_t newIndex = -1;
135  bool found = false;
136  for (size_t i=0; i<hTargetTracks->size();++i){
137 
138  if ( deltaR( currentTrRef->momentum(), hTargetTracks->at(i).momentum()) < 0.001){
139  newIndex = i;
140  found = true;
141  break;
142  }
143  }
144  if (found) {
145  TrackRef trackRef(hTargetTracks, newIndex);
146  newPreId.setTrack(trackRef);
147  output_preidinfo->push_back(newPreId); // temp hack for mumu filtering
148  } else {
149  std::cout << "XXXX whoops! Cannot set track ref!!" << std::endl;
150  }
151  }
152 
153 
154 
155  for (ElectronSeedCollection::const_iterator it = hElectronSeeds->begin(); it!=hElectronSeeds->end(); ++ it){
156  ElectronSeed newSeed(*it);
157  TrackRef currentTrRef = it->ctfTrack ();
158  if ( currentTrRef.isNull() || !currentTrRef.isAvailable() ) {
159  std::cout << "XXXX whoops! Org track ref empty!!" << std::endl;
160  // keep things as they are;
161  output_preid->push_back(newSeed);
162  continue;
163  }
164  size_t newIndex = -1;
165  bool found = false;
166  for (size_t i=0; i<hTargetTracks->size();++i){
167 
168  if ( deltaR( currentTrRef->momentum(), hTargetTracks->at(i).momentum()) < 0.001){
169  newIndex = i;
170  found = true;
171  break;
172  }
173  }
174  if (found) {
175  TrackRef trackRef(hTargetTracks, newIndex);
176  newSeed.setCtfTrack(trackRef);
177  output_preid->push_back(newSeed); // temporary hack for Zmumu filtering
178  } else {
179  std::cout << "XXXX whoops! Cannot set track ref!!" << std::endl;
180  }
181  }
182 
183 
184 
185 
186  iEvent.put(output_preid,preidgsf_);
187  iEvent.put(output_preidinfo,preidname_);
188 
189  //iEvent.put(newCol);
190 
191 }
int i
Definition: DBlmapReader.cc:9
std::vector< reco::PreId > PreIdCollection
Definition: PreIdFwd.h:6
bool isAvailable() const
Definition: Ref.h:276
bool isNull() const
Checks for null.
Definition: Ref.h:247
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

edm::InputTag ElectronSeedTrackRefUpdater::_inPreId
private

Definition at line 57 of file ElectronSeedTrackRefUpdater.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdater::_inSeeds
private

Definition at line 56 of file ElectronSeedTrackRefUpdater.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdater::_targetTracks
private

Definition at line 58 of file ElectronSeedTrackRefUpdater.cc.

Referenced by produce().

std::string ElectronSeedTrackRefUpdater::preidgsf_
private

Definition at line 60 of file ElectronSeedTrackRefUpdater.cc.

Referenced by ElectronSeedTrackRefUpdater(), and produce().

std::string ElectronSeedTrackRefUpdater::preidname_
private

Definition at line 61 of file ElectronSeedTrackRefUpdater.cc.

Referenced by ElectronSeedTrackRefUpdater(), and produce().