Skip to content

Commit

Permalink
Merge pull request cms-sw#657 from inugent/PatchForNameSpaceBug
Browse files Browse the repository at this point in the history
Patch for name space bug
  • Loading branch information
ktf committed Aug 29, 2013
2 parents e6d7e27 + 1240218 commit 8e4c77f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
3 changes: 1 addition & 2 deletions GeneratorInterface/ExternalDecays/interface/TauSpinnerCMS.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "TauSpinner/SimpleParticle.h"

using namespace edm;
using namespace std;
using namespace TauSpinner;

class TauSpinnerCMS : public edm::EDProducer
Expand All @@ -55,7 +54,7 @@ class TauSpinnerCMS : public edm::EDProducer
bool isReco_;
bool isTauolaConfigured_;
bool isLHPDFConfigured_;
string LHAPDFname_;
std::string LHAPDFname_;
double CMSEnergy_;
edm::InputTag gensrc_;
int MotherPDGID_,Ipol_,nonSM2_,nonSMN_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "TauSpinner/SimpleParticle.h"
#include <vector>
using namespace std;
using namespace TauSpinner;

/** Read HepMC::GenEvent.
Expand All @@ -29,12 +28,12 @@ using namespace TauSpinner;
0 - event processed correctly
1 - empty event or no decay found in the event
*/
int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, SimpleParticle &tau, SimpleParticle &tau2, vector<SimpleParticle> &tau_daughters, vector<SimpleParticle> &tau2_daughters);
int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, SimpleParticle &tau, SimpleParticle &tau2, std::vector<SimpleParticle> &tau_daughters, std::vector<SimpleParticle> &tau2_daughters);

/** Get daughters of HepMC::GenParticle
Recursively searches for final-state daughters of 'x' */
vector<SimpleParticle> *getDaughters(HepMC::GenParticle *x);
std::vector<SimpleParticle> *getDaughters(HepMC::GenParticle *x);

/** Find last self
Expand Down
2 changes: 1 addition & 1 deletion GeneratorInterface/ExternalDecays/plugins/TauSpinnerCMS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void TauSpinnerCMS::produce( edm::Event& e, const edm::EventSetup& iSetup){
double WTFlip=1.0;
double polSM=-999; //range [-1,1]
SimpleParticle X, tau, tau2;
vector<SimpleParticle> tau_daughters, tau_daughters2;
std::vector<SimpleParticle> tau_daughters, tau_daughters2;
int stat(0);
if(isReco_){
stat=readParticlesfromReco(e,X,tau,tau2,tau_daughters,tau_daughters2);
Expand Down
21 changes: 13 additions & 8 deletions GeneratorInterface/ExternalDecays/src/read_particles_from_HepMC.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#include "GeneratorInterface/ExternalDecays/interface/read_particles_from_HepMC.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

/*******************************************************************************
Get daughters of HepMC::GenParticle
Recursively searches for final-state daughters of 'x'
*******************************************************************************/
inline vector<SimpleParticle> *getDaughters(HepMC::GenParticle *x)
inline std::vector<SimpleParticle> *getDaughters(HepMC::GenParticle *x)
{
vector<SimpleParticle> *daughters = new vector<SimpleParticle>();
std::vector<SimpleParticle> *daughters = new std::vector<SimpleParticle>();
if(!x->end_vertex()) return daughters;

// Check decay products of 'x'
Expand All @@ -20,7 +21,7 @@ inline vector<SimpleParticle> *getDaughters(HepMC::GenParticle *x)
// all of its daughters.
if( pp->end_vertex() && pp->pdg_id()!=111)
{
vector<SimpleParticle> *sub_daughters = getDaughters(pp);
std::vector<SimpleParticle> *sub_daughters = getDaughters(pp);
daughters->insert(daughters->end(),sub_daughters->begin(),sub_daughters->end());

delete sub_daughters;
Expand Down Expand Up @@ -84,7 +85,7 @@ inline bool isFirst(HepMC::GenParticle *x){
Event will continue to be processed
with next function call.
*******************************************************************************/
int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, SimpleParticle &tau, SimpleParticle &tau2, vector<SimpleParticle> &tau_daughters, vector<SimpleParticle> &tau2_daughters)
int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, SimpleParticle &tau, SimpleParticle &tau2, std::vector<SimpleParticle> &tau_daughters, std::vector<SimpleParticle> &tau2_daughters)
{
if(event==NULL) return 1;

Expand Down Expand Up @@ -118,7 +119,8 @@ int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, Simp
else if(!hTau2) hTau2 = *it2;
else
{
cout<<"TauSpiner: three taus in one decay"<<endl;
edm::LogInfo("TauSpinnerCMSSW::read_particles_from_HepMC") << "TauSpiner: three taus in one decay" << std::endl;
//std::cout<<"TauSpiner: three taus in one decay"<<std::endl;
return 1;
}
}
Expand All @@ -127,7 +129,9 @@ int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, Simp
if(!hTau2) hTau2 = *it2;
else
{
cout<<"TauSpiner: two neutrinos or two taus and neutrino in one decay"<<endl;
edm::LogInfo("TauSpinnerCMSSW::read_particles_from_HepMC") << "TauSpiner: two neutrinos or two taus and neutrino in one decay"
<< std::endl;
//std::cout<<"TauSpiner: two neutrinos or two taus and neutrino in one decay"<<std::endl;
return 1;
}
}
Expand All @@ -141,7 +145,8 @@ int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, Simp

if(!hTau || !hTau2)
{
//cout<<"TauSpiner: boson found but no proper tau pair or tau + neutrino found."<<endl;
//edm::LogInfo("TauSpinnerCMSSW::read_particles_from_HepMC") << "TauSpiner: boson found but no proper tau pair or tau + neutrino found."<<std::endl;
//std::cout<<"TauSpiner: boson found but no proper tau pair or tau + neutrino found."<<std::endl;
return 1;
}

Expand Down Expand Up @@ -169,7 +174,7 @@ int readParticlesFromHepMC(const HepMC::GenEvent *event, SimpleParticle &X, Simp
tau2.setPdgid(hTau2->pdg_id());

// Create list of tau daughters
vector<SimpleParticle> *buf = getDaughters(hTau);
std::vector<SimpleParticle> *buf = getDaughters(hTau);
tau_daughters.clear();
tau_daughters.insert(tau_daughters.end(),buf->begin(),buf->end());

Expand Down

0 comments on commit 8e4c77f

Please sign in to comment.