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

#include <ShallowSimTracksProducer.h>

Inheritance diagram for ShallowSimTracksProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 ShallowSimTracksProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- 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

void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

const edm::ESInputTag associator_tag
 
const std::string Prefix
 
const std::string Suffix
 
const edm::InputTag trackingParticles_tag
 
const edm::InputTag tracks_tag
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
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 9 of file ShallowSimTracksProducer.h.

Constructor & Destructor Documentation

ShallowSimTracksProducer::ShallowSimTracksProducer ( const edm::ParameterSet conf)
explicit

Definition at line 13 of file ShallowSimTracksProducer.cc.

References Prefix, and Suffix.

14  : Prefix( conf.getParameter<std::string>("Prefix") ),
15  Suffix( conf.getParameter<std::string>("Suffix") ),
16  trackingParticles_tag( conf.getParameter<edm::InputTag>("TrackingParticles")),
17  associator_tag( conf.getParameter<edm::ESInputTag>("Associator")),
18  tracks_tag( conf.getParameter<edm::InputTag>("Tracks"))
19 {
20  produces <std::vector<unsigned> > ( Prefix + "multi" + Suffix );
21  produces <std::vector<int> > ( Prefix + "type" + Suffix );
22  produces <std::vector<float> > ( Prefix + "charge" + Suffix );
23  produces <std::vector<float> > ( Prefix + "momentum" + Suffix );
24  produces <std::vector<float> > ( Prefix + "pt" + Suffix );
25  produces <std::vector<double> > ( Prefix + "theta" + Suffix );
26  produces <std::vector<double> > ( Prefix + "phi" + Suffix );
27  produces <std::vector<double> > ( Prefix + "eta" + Suffix );
28  produces <std::vector<double> > ( Prefix + "qoverp" + Suffix );
29  produces <std::vector<double> > ( Prefix + "vx" + Suffix );
30  produces <std::vector<double> > ( Prefix + "vy" + Suffix );
31  produces <std::vector<double> > ( Prefix + "vz" + Suffix );
32 }
T getParameter(std::string const &) const
const edm::ESInputTag associator_tag
const edm::InputTag trackingParticles_tag

Member Function Documentation

void ShallowSimTracksProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 36 of file ShallowSimTracksProducer.cc.

References associator_tag, edm::AssociationMap< Tag >::begin(), DeDxDiscriminatorTools::charge(), ParticleBase::charge(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >::const_iterator, edm::AssociationMap< Tag >::end(), eta(), ParticleBase::eta(), shallow::findTrackIndex(), edm::EventSetup::get(), edm::Ref< C, T, F >::get(), i, ParticleBase::p(), TrackingParticle::parentVertex(), TrackingParticle::pdgId(), phi, ParticleBase::phi(), TrackingVertex::position(), Prefix, ParticleBase::pt(), findQualityFiles::size, Suffix, theta(), ParticleBase::theta(), trackingParticlesFastSim_cfi::trackingParticles, trackingParticles_tag, testEve_cfg::tracks, and tracks_tag.

Referenced by python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

36  {
37 
38  edm::Handle<edm::View<reco::Track> > tracks ; event.getByLabel( tracks_tag, tracks);
40  edm::ESHandle<TrackAssociatorBase> associator ; setup.get<TrackAssociatorRecord>().get( associator_tag, associator);
41 
42  unsigned size = tracks->size();
43  std::auto_ptr<std::vector<unsigned> > multi ( new std::vector<unsigned>(size, 0));
44  std::auto_ptr<std::vector<int> > type ( new std::vector<int> (size, 0));
45  std::auto_ptr<std::vector<float> > charge ( new std::vector<float> (size, 0));
46  std::auto_ptr<std::vector<float> > momentum ( new std::vector<float> (size, -1));
47  std::auto_ptr<std::vector<float> > pt ( new std::vector<float> (size, -1));
48  std::auto_ptr<std::vector<double> > theta ( new std::vector<double> (size,-1000));
49  std::auto_ptr<std::vector<double> > phi ( new std::vector<double> (size,-1000));
50  std::auto_ptr<std::vector<double> > eta ( new std::vector<double> (size,-1000));
51  std::auto_ptr<std::vector<double> > dxy ( new std::vector<double> (size,-1000));
52  std::auto_ptr<std::vector<double> > dsz ( new std::vector<double> (size,-1000));
53  std::auto_ptr<std::vector<double> > qoverp ( new std::vector<double> (size,-1000));
54  std::auto_ptr<std::vector<double> > vx ( new std::vector<double> (size,-1000));
55  std::auto_ptr<std::vector<double> > vy ( new std::vector<double> (size,-1000));
56  std::auto_ptr<std::vector<double> > vz ( new std::vector<double> (size,-1000));
57 
58  reco::RecoToSimCollection associations = associator->associateRecoToSim( tracks, trackingParticles, &event );
59 
60  for( reco::RecoToSimCollection::const_iterator association = associations.begin();
61  association != associations.end(); association++) {
62 
63  const reco::Track* track = association->key.get();
64  const int matches = association->val.size();
65  if(matches>0) {
66  const TrackingParticle* tparticle = association->val[0].first.get();
67  unsigned i = shallow::findTrackIndex(tracks, track);
68 
69  multi->at(i) = matches;
70  type->at(i) = tparticle->pdgId();
71  charge->at(i)= tparticle->charge();
72  momentum->at(i)=tparticle->p() ;
73  pt->at(i) = tparticle->pt() ;
74  theta->at(i) = tparticle->theta() ;
75  phi->at(i) = tparticle->phi() ;
76  eta->at(i) = tparticle->eta() ;
77  qoverp->at(i)= tparticle->charge()/tparticle->p();
78 
79  const TrackingVertex* tvertex = tparticle->parentVertex().get();
80  vx->at(i) = tvertex->position().x();
81  vy->at(i) = tvertex->position().y();
82  vz->at(i) = tvertex->position().z();
83  }
84  }
85 
86  event.put( multi ,Prefix + "multi" + Suffix );
87  event.put( type ,Prefix + "type" + Suffix );
88  event.put( charge ,Prefix + "charge" + Suffix );
89  event.put( momentum ,Prefix + "momentum" + Suffix );
90  event.put( pt ,Prefix + "pt" + Suffix );
91  event.put( theta ,Prefix + "theta" + Suffix );
92  event.put( phi ,Prefix + "phi" + Suffix );
93  event.put( eta ,Prefix + "eta" + Suffix );
94  event.put( qoverp ,Prefix + "qoverp" + Suffix );
95  event.put( vx ,Prefix + "vx" + Suffix );
96  event.put( vy ,Prefix + "vy" + Suffix );
97  event.put( vz ,Prefix + "vz" + Suffix );
98 
99 }
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
const edm::ESInputTag associator_tag
int charge() const
electric charge
Definition: ParticleBase.h:55
const_iterator end() const
last iterator over the map (read only)
int findTrackIndex(const edm::Handle< edm::View< reco::Track > > &h, const reco::Track *t)
Definition: ShallowTools.cc:29
int pdgId() const
PDG id, signal source, crossing number.
Geom::Theta< T > theta() const
double pt() const
transverse momentum
Definition: ParticleBase.h:158
T eta() const
double charge(const std::vector< uint8_t > &Ampls)
double theta() const
momentum polar angle
Definition: ParticleBase.h:168
double phi() const
momentum azimuthal angle
Definition: ParticleBase.h:163
double p() const
magnitude of momentum vector
Definition: ParticleBase.h:100
const TrackingVertexRef & parentVertex() const
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
const edm::InputTag trackingParticles_tag
const_iterator begin() const
first iterator over the map (read only)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:241
tuple size
Write out results.
double eta() const
momentum pseudorapidity
Definition: ParticleBase.h:174
const LorentzVector & position() const
Definition: DDAxes.h:10

Member Data Documentation

const edm::ESInputTag ShallowSimTracksProducer::associator_tag
private

Definition at line 20 of file ShallowSimTracksProducer.h.

Referenced by produce().

const std::string ShallowSimTracksProducer::Prefix
private

Definition at line 17 of file ShallowSimTracksProducer.h.

Referenced by produce(), and ShallowSimTracksProducer().

const std::string ShallowSimTracksProducer::Suffix
private

Definition at line 18 of file ShallowSimTracksProducer.h.

Referenced by produce(), and ShallowSimTracksProducer().

const edm::InputTag ShallowSimTracksProducer::trackingParticles_tag
private

Definition at line 19 of file ShallowSimTracksProducer.h.

Referenced by produce().

const edm::InputTag ShallowSimTracksProducer::tracks_tag
private

Definition at line 21 of file ShallowSimTracksProducer.h.

Referenced by produce().