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

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

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

Public Member Functions

 ElectronSeedTrackRefUpdaterAndMerger (const edm::ParameterSet &)
 
 ~ElectronSeedTrackRefUpdaterAndMerger ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 _inPreId1
 
edm::InputTag _inPreId2
 
edm::InputTag _inSeeds1
 
edm::InputTag _inSeeds2
 
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 ElectronSeedTrackRefUpdaterAndMerger.cc.

Constructor & Destructor Documentation

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

Definition at line 80 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

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

80  :
81  _inSeeds1(iConfig.getParameter< edm::InputTag > ("inSeeds1")),
82  _inPreId1(iConfig.getParameter< edm::InputTag > ("inPreId1")),
83  _inSeeds2(iConfig.getParameter< edm::InputTag > ("inSeeds2")),
84  _inPreId2(iConfig.getParameter< edm::InputTag > ("inPreId2")),
85  _targetTracks(iConfig.getParameter< edm::InputTag > ("targetTracks"))
86 {
87  preidgsf_ = iConfig.getParameter<std::string>("PreGsfLabel");
88  preidname_= iConfig.getParameter<std::string>("PreIdLabel");
89 
90  produces<ElectronSeedCollection>(preidgsf_);
91  produces<PreIdCollection>(preidname_);
92  //produces<edm::ValueMap<reco::PreIdRef> >(preidname_);
93 
94 }
T getParameter(std::string const &) const
ElectronSeedTrackRefUpdaterAndMerger::~ElectronSeedTrackRefUpdaterAndMerger ( )

Definition at line 97 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

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

Member Function Documentation

void ElectronSeedTrackRefUpdaterAndMerger::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 221 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

222 {
223 }
void ElectronSeedTrackRefUpdaterAndMerger::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 227 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

227  {
228 }
void ElectronSeedTrackRefUpdaterAndMerger::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 112 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

References _inPreId1, _inPreId2, _inSeeds1, _inSeeds2, _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().

113 {
114  using namespace edm;
115  using namespace std;
116  using namespace reco;
117 
118  auto_ptr<ElectronSeedCollection> output_preid(new ElectronSeedCollection);
119  auto_ptr<PreIdCollection> output_preidinfo(new PreIdCollection);
120 
122  iEvent.getByLabel( _targetTracks, hTargetTracks);
123 
125  iEvent.getByLabel( _inSeeds1, hSeeds1 );
127  iEvent.getByLabel( _inSeeds2, hSeeds2 );
128 
129  std::vector< edm::Handle< ElectronSeedCollection > > colsSeed;
130  colsSeed.push_back(hSeeds1);
131  colsSeed.push_back(hSeeds2);
132 
133 
135  iEvent.getByLabel( _inPreId1, hPreId1);
137  iEvent.getByLabel( _inPreId2, hPreId2);
138 
139  std::vector< edm::Handle< PreIdCollection > > colsPreId;
140  colsPreId.push_back(hPreId1);
141  colsPreId.push_back(hPreId2);
142 
143 
144  for ( std::vector< edm::Handle< PreIdCollection > >::iterator itCols=colsPreId.begin();
145  itCols!=colsPreId.end();
146  ++itCols )
147  {
148  for (PreIdCollection::const_iterator it = (*itCols)->begin(); it!=(*itCols)->end(); ++ it){
149  PreId newPreId(*it);
150  TrackRef currentTrRef = it->trackRef();
151  if ( currentTrRef.isNull() || !currentTrRef.isAvailable() ) {
152  std::cout << "XXXX whoops! Org track ref empty!!" << std::endl;
153  // keep things as they are;
154  output_preidinfo->push_back(newPreId);
155  continue;
156  }
157  size_t newIndex = -1;
158  bool found = false;
159  for (size_t i=0; i<hTargetTracks->size();++i){
160 
161  if ( deltaR( currentTrRef->momentum(), hTargetTracks->at(i).momentum()) < 0.001){
162  newIndex = i;
163  found = true;
164  break;
165  }
166  }
167  if (found) {
168  TrackRef trackRef(hTargetTracks, newIndex);
169  newPreId.setTrack(trackRef);
170  } else {
171  std::cout << "XXXX whoops! Cannot set track ref!!" << std::endl;
172  }
173  output_preidinfo->push_back(newPreId);
174  }
175  }
176 
177 
178  for ( std::vector< edm::Handle< ElectronSeedCollection > >::iterator itCols=colsSeed.begin();
179  itCols!=colsSeed.end();
180  ++itCols )
181  {
182  for (ElectronSeedCollection::const_iterator it = (*itCols)->begin(); it!=(*itCols)->end(); ++ it){
183  ElectronSeed newSeed(*it);
184  TrackRef currentTrRef = it->ctfTrack ();
185  if ( currentTrRef.isNull() || !currentTrRef.isAvailable() ) {
186  std::cout << "XXXX whoops! Org track ref empty!!" << std::endl;
187  // keep things as they are;
188  output_preid->push_back(newSeed);
189  continue;
190  }
191  size_t newIndex = -1;
192  bool found = false;
193  for (size_t i=0; i<hTargetTracks->size();++i){
194 
195  if ( deltaR( currentTrRef->momentum(), hTargetTracks->at(i).momentum()) < 0.001){
196  newIndex = i;
197  found = true;
198  break;
199  }
200  }
201  if (found) {
202  TrackRef trackRef(hTargetTracks, newIndex);
203  newSeed.setCtfTrack(trackRef);
204  } else {
205  std::cout << "XXXX whoops! Cannot set track ref!!" << std::endl;
206  }
207  output_preid->push_back(newSeed);
208  }
209  }
210 
211 
212  iEvent.put(output_preid,preidgsf_);
213  iEvent.put(output_preidinfo,preidname_);
214 
215  //iEvent.put(newCol);
216 
217 }
bool isAvailable() const
Definition: Ref.h:614
int i
Definition: DBlmapReader.cc:9
std::vector< reco::PreId > PreIdCollection
Definition: PreIdFwd.h:6
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
bool isNull() const
Checks for null.
Definition: Ref.h:247
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 ElectronSeedTrackRefUpdaterAndMerger::_inPreId1
private

Definition at line 57 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdaterAndMerger::_inPreId2
private

Definition at line 59 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdaterAndMerger::_inSeeds1
private

Definition at line 56 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdaterAndMerger::_inSeeds2
private

Definition at line 58 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

Referenced by produce().

edm::InputTag ElectronSeedTrackRefUpdaterAndMerger::_targetTracks
private

Definition at line 61 of file ElectronSeedTrackRefUpdaterAndMerger.cc.

Referenced by produce().

std::string ElectronSeedTrackRefUpdaterAndMerger::preidgsf_
private
std::string ElectronSeedTrackRefUpdaterAndMerger::preidname_
private