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 Attributes
TauGenJetProducer Class Reference

builds a GenJet from the visible daughters of each status 2 tau in the event. More...

#include <TauGenJetProducer.h>

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

Public Member Functions

virtual void beginJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 TauGenJetProducer (const edm::ParameterSet &)
 
 ~TauGenJetProducer ()
 
- 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 Attributes

bool includeNeutrinos_
 if yes, neutrinos will be included, for debug purposes More...
 
edm::InputTag inputTagGenParticles_
 Input PFCandidates. More...
 
bool verbose_
 verbose ? More...
 

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

builds a GenJet from the visible daughters of each status 2 tau in the event.

Author
Colin Bernet
Date
february 2008

Definition at line 23 of file TauGenJetProducer.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file TauGenJetProducer.cc.

References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

21 {
23  = iConfig.getParameter<InputTag>("GenParticles");
24 
26  = iConfig.getParameter<bool>("includeNeutrinos");
27 
28  verbose_ =
29  iConfig.getUntrackedParameter<bool>("verbose",false);
30 
31  produces<GenJetCollection>();
32 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool verbose_
verbose ?
bool includeNeutrinos_
if yes, neutrinos will be included, for debug purposes
edm::InputTag inputTagGenParticles_
Input PFCandidates.
TauGenJetProducer::~TauGenJetProducer ( )

Definition at line 34 of file TauGenJetProducer.cc.

34 { }

Member Function Documentation

void TauGenJetProducer::beginJob ( void  )
virtual

Reimplemented from edm::EDProducer.

Definition at line 36 of file TauGenJetProducer.cc.

36 { }
void TauGenJetProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 38 of file TauGenJetProducer.cc.

References abs, edm::RefVector< C, T, F >::begin(), DeDxDiscriminatorTools::charge(), gather_cfg::cout, edm::RefVector< C, T, F >::end(), edm::hlt::Exception, GenParticlesHelper::findDescendents(), GenParticlesHelper::findParticles(), newFWLiteAna::found, genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), metsig::jet, edm::Event::put(), edm::refToPtr(), reco::LeafCandidate::setCharge(), and edm::RefVector< C, T, F >::size().

39  {
40 
42 
43  bool found = iEvent.getByLabel( inputTagGenParticles_, genParticles);
44 
45  if ( !found ) {
46  std::ostringstream err;
47  err<<" cannot get collection: "
48  <<inputTagGenParticles_<<std::endl;
49  edm::LogError("TauGenJetProducer")<<err.str();
50  throw cms::Exception( "MissingProduct", err.str());
51  }
52 
53  std::auto_ptr<GenJetCollection>
54  pOutVisTaus(new GenJetCollection());
55 
56  using namespace GenParticlesHelper;
57 
58  GenParticleRefVector allStatus2Taus;
59  findParticles( *genParticles,
60  allStatus2Taus, 15, 2);
61 
62  for ( IGR iTau=allStatus2Taus.begin(); iTau!=allStatus2Taus.end(); ++iTau ) {
63 
64  // look for all status 1 (stable) descendents
65  GenParticleRefVector descendents;
66  findDescendents( *iTau, descendents, 1);
67 
68  // CV: skip status 2 taus that radiate-off a photon
69  // --> have a status 2 tau lepton in the list of descendents
70  GenParticleRefVector status2TauDaughters;
71  findDescendents( *iTau, status2TauDaughters, 2, 15 );
72  if ( status2TauDaughters.size() > 0 ) continue;
73 
74  // loop on descendents, and take all except neutrinos
75  math::XYZTLorentzVector sumVisMom;
77  Jet::Constituents constituents;
78 
79  if(verbose_)
80  cout<<"tau "<<(*iTau)<<endl;
81 
82  for(IGR igr = descendents.begin();
83  igr!= descendents.end(); ++igr ) {
84 
85  int absPdgId = abs((*igr)->pdgId());
86 
87  // neutrinos
88  if(!includeNeutrinos_ ) {
89  if( absPdgId == 12 ||
90  absPdgId == 14 ||
91  absPdgId == 16 )
92  continue;
93  }
94 
95  if(verbose_)
96  cout<<"\t"<<(*igr)<<endl;
97 
98  charge += (*igr)->charge();
99  sumVisMom += (*igr)->p4();
100 
101  // need to convert the vector of reference to the constituents
102  // to a vector of pointers to build the genjet
103  constituents.push_back( refToPtr( *igr) );
104  }
105 
106  math::XYZPoint vertex;
107  GenJet::Specific specific;
108 
109  GenJet jet( sumVisMom, vertex, specific, constituents);
110 
111  if (charge != (*iTau)->charge() )
112  std::cout<<" charge of Tau: " << (*iTau) << " not equal to charge of sum of charge of all descendents. " << std::cout;
113 
114  jet.setCharge(charge);
115  pOutVisTaus->push_back( jet );
116 
117  }
118  iEvent.put( pOutVisTaus );
119 }
bool verbose_
verbose ?
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
void findParticles(const reco::GenParticleCollection &sourceParticles, reco::GenParticleRefVector &particleRefs, int pdgId, int status)
find all particles of a given pdgId and status
std::vector< GenJet > GenJetCollection
collection of GenJet objects
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< Constituent > Constituents
Definition: Jet.h:24
int Charge
electric charge type
Definition: Particle.h:24
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:243
double charge(const std::vector< uint8_t > &Ampls)
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:238
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
Jets made from MC generator particles.
Definition: GenJet.h:25
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
bool includeNeutrinos_
if yes, neutrinos will be included, for debug purposes
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
edm::InputTag inputTagGenParticles_
Input PFCandidates.
size_type size() const
Size of the RefVector.
Definition: RefVector.h:84
tuple cout
Definition: gather_cfg.py:41
void findDescendents(const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
find all descendents of a given status and pdgId (recursive)

Member Data Documentation

bool TauGenJetProducer::includeNeutrinos_
private

if yes, neutrinos will be included, for debug purposes

Definition at line 40 of file TauGenJetProducer.h.

edm::InputTag TauGenJetProducer::inputTagGenParticles_
private

Input PFCandidates.

Definition at line 37 of file TauGenJetProducer.h.

bool TauGenJetProducer::verbose_
private

verbose ?

Definition at line 43 of file TauGenJetProducer.h.