CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
gen::PhotosppInterface Class Reference

#include <PhotosppInterface.h>

Inheritance diagram for gen::PhotosppInterface:
gen::PhotosInterfaceBase

Public Member Functions

HepMC::GenEvent * apply (HepMC::GenEvent *)
 
void avoidTauLeptonicDecays ()
 
void configureOnlyFor (int)
 
void init ()
 
bool isTauLeptonicDecay (HepMC::GenVertex *)
 
 PhotosppInterface (const edm::ParameterSet &pset)
 
void setRandomEngine (CLHEP::HepRandomEngine *decayRandomEngine)
 
const std::vector< std::string > & specialSettings ()
 
void statistics ()
 
 ~PhotosppInterface ()
 
- Public Member Functions inherited from gen::PhotosInterfaceBase
 PhotosInterfaceBase ()
 
 PhotosInterfaceBase (const edm::ParameterSet &)
 
virtual void SetDecayRandomEngine (CLHEP::HepRandomEngine *decayRandomEngine)
 
virtual ~PhotosInterfaceBase ()
 

Static Public Member Functions

static double flat ()
 

Private Attributes

bool fAvoidTauLeptonicDecays
 
bool fIsInitialized
 
int fOnlyPDG
 
edm::ParameterSetfPSet
 

Static Private Attributes

static CLHEP::HepRandomEngine * fRandomEngine = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from gen::PhotosInterfaceBase
std::vector< std::string > fSpecialSettings
 

Detailed Description

Definition at line 21 of file PhotosppInterface.h.

Constructor & Destructor Documentation

PhotosppInterface::PhotosppInterface ( const edm::ParameterSet pset)

Definition at line 22 of file PhotosppInterface.cc.

References fPSet, and gen::PhotosInterfaceBase::fSpecialSettings.

23  : fOnlyPDG(-1),
25  fIsInitialized(false),
26  fPSet(0)
27 {
28  fSpecialSettings.push_back("QED-brem-off:all");
29  fPSet = new ParameterSet(pset);
30 }
edm::ParameterSet * fPSet
std::vector< std::string > fSpecialSettings
gen::PhotosppInterface::~PhotosppInterface ( )
inline

Definition at line 26 of file PhotosppInterface.h.

26 {}

Member Function Documentation

HepMC::GenEvent * PhotosppInterface::apply ( HepMC::GenEvent *  evt)
virtual

Reimplemented from gen::PhotosInterfaceBase.

Definition at line 169 of file PhotosppInterface.cc.

References fIsInitialized, flat(), configurableAnalysis::GenParticle, and p1.

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), jetTools.AddJetCollection::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), runType1CaloMEtUncertainties.RunType1CaloMEtUncertainties::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), runType1PFMEtUncertainties.RunType1PFMEtUncertainties::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

169  {
170  Photospp::Photos::setRandomGenerator(PhotosppInterface::flat);
171  if(!fIsInitialized) return evt;
172  int NPartBefore = evt->particles_size();
173  Photospp::PhotosHepMCEvent PhotosEvt(evt);
174  PhotosEvt.process();
175  //Fix the vertices and barcodes based on Julia Yarba's solution from TauolaInterface
176  for (HepMC::GenEvent::vertex_const_iterator vtx=evt->vertices_begin(); vtx!=evt->vertices_end(); vtx++ ){
177  std::vector<int> BCodes;
178  BCodes.clear();
179  if(*vtx){
180  for(HepMC::GenVertex::particle_iterator pitr=(*vtx)->particles_begin(HepMC::children);pitr!=(*vtx)->particles_end(HepMC::children);++pitr){
181  if((*pitr)->barcode()>10000){
182  BCodes.push_back((*pitr)->barcode());
183  }
184  }
185  }
186  if(BCodes.size() > 0){
187  for(size_t ibc=0; ibc<BCodes.size(); ibc++){
188  HepMC::GenParticle* p1 = evt->barcode_to_particle(BCodes[ibc]);
189  int nbc = p1->barcode() - 10000 + NPartBefore;
190  p1->suggest_barcode(nbc);
191  }
192  }
193  }
194  return evt;
195 }
double p1[4]
Definition: TauolaWrapper.h:89
void gen::PhotosppInterface::avoidTauLeptonicDecays ( )
inlinevirtual

Implements gen::PhotosInterfaceBase.

Definition at line 32 of file PhotosppInterface.h.

References fAvoidTauLeptonicDecays.

32 { fAvoidTauLeptonicDecays=true; return; }
void PhotosppInterface::configureOnlyFor ( int  ipdg)
virtual

Implements gen::PhotosInterfaceBase.

Definition at line 34 of file PhotosppInterface.cc.

References fOnlyPDG, and gen::PhotosInterfaceBase::fSpecialSettings.

34  {
35  fOnlyPDG = ipdg;
36  fSpecialSettings.clear();
37  return;
38 }
std::vector< std::string > fSpecialSettings
double PhotosppInterface::flat ( )
static

Definition at line 197 of file PhotosppInterface.cc.

References edm::hlt::Exception, and fRandomEngine.

Referenced by apply().

197  {
198  if ( !fRandomEngine ) {
199  throw cms::Exception("LogicError")
200  << "PhotosppInterface::flat: Attempt to generate random number when engine pointer is null\n"
201  << "This might mean that the code was modified to generate a random number outside the\n"
202  << "event and beginLuminosityBlock methods, which is not allowed.\n";
203  }
204  return fRandomEngine->flat();
205 }
static CLHEP::HepRandomEngine * fRandomEngine
void PhotosppInterface::init ( void  )
virtual

Implements gen::PhotosInterfaceBase.

Definition at line 40 of file PhotosppInterface.cc.

References fAvoidTauLeptonicDecays, fIsInitialized, fOnlyPDG, fPSet, edm::ParameterSet::getParameter(), i, initialize(), AlCaHLTBitMon_QueryRunRegistry::string, and gen::v.

40  {
41  if ( fIsInitialized ) return; // do init only once
43  std::vector<std::string> par = fPSet->getParameter< std::vector<std::string> >("parameterSets");
44  for (unsigned int ip=0; ip<par.size(); ++ip ){
45  std::string curSet = par[ip];
46 
47  // Physics settings
48  if(curSet=="maxWtInterference") Photospp::Photos::maxWtInterference(fPSet->getParameter<double>(curSet));
49  if(curSet=="setInfraredCutOff") Photospp::Photos::setInfraredCutOff(fPSet->getParameter<double>(curSet));
50  if(curSet=="setAlphaQED") Photospp::Photos::setAlphaQED(fPSet->getParameter<double>(curSet));
51  if(curSet=="setInterference") Photospp::Photos::setInterference(fPSet->getParameter<bool>(curSet));
52  if(curSet=="setDoubleBrem") Photospp::Photos::setDoubleBrem(fPSet->getParameter<bool>(curSet));
53  if(curSet=="setQuatroBrem") Photospp::Photos::setQuatroBrem(fPSet->getParameter<bool>(curSet));
54  if(curSet=="setExponentiation") Photospp::Photos::setExponentiation(fPSet->getParameter<bool>(curSet));
55  if(curSet=="setCorrectionWtForW") Photospp::Photos::setCorrectionWtForW(fPSet->getParameter<bool>(curSet));
56  if(curSet=="setMeCorrectionWtForScalar") Photospp::Photos::setMeCorrectionWtForScalar(fPSet->getParameter<bool>(curSet));
57  if(curSet=="setMeCorrectionWtForW") Photospp::Photos::setMeCorrectionWtForW(fPSet->getParameter<bool>(curSet));
58  if(curSet=="setMeCorrectionWtForZ") Photospp::Photos::setMeCorrectionWtForZ(fPSet->getParameter<bool>(curSet));
59  if(curSet=="initializeKinematicCorrections") Photospp::Photos::initializeKinematicCorrections(fPSet->getParameter<int>(curSet));
60  if(curSet=="forceMassFrom4Vector") Photospp::Photos::forceMassFrom4Vector(fPSet->getParameter<bool>(curSet));
61  if(curSet=="forceMassFromEventRecord") Photospp::Photos::forceMassFromEventRecord(fPSet->getParameter<int>(curSet));
62  if(curSet=="ignoreParticlesOfStatus") Photospp::Photos::ignoreParticlesOfStatus(fPSet->getParameter<int>(curSet));
63  if(curSet=="deIgnoreParticlesOfStatus") Photospp::Photos::deIgnoreParticlesOfStatus(fPSet->getParameter<int>(curSet));
64  if(curSet=="setMomentumConservationThreshold") Photospp::Photos::setMomentumConservationThreshold(fPSet->getParameter<double>(curSet));
65  if(curSet=="suppressAll") if(fPSet->getParameter<bool>(curSet)==true)Photospp::Photos::suppressAll();
66 
67  // Now setup more complicated radiation/mass supression and forcing.
68  if(curSet=="suppressBremForBranch"){
70  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
71  for(unsigned int i=0;i<v.size();i++){
72  std::string vs = v[i];
73  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
74  if(vpar.size()==1) Photospp::Photos::suppressBremForBranch(0,vpar[0]);
75  if(vpar.size()==2) Photospp::Photos::suppressBremForBranch(0/*vpar[0]*/,vpar[1]);
76  if(vpar.size()==3) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2]);
77  if(vpar.size()==4) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
78  if(vpar.size()==5) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
79  if(vpar.size()==6) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
80  if(vpar.size()==7) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
81  if(vpar.size()==8) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
82  if(vpar.size()==9) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
83  if(vpar.size()==10) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
84  }
85  }
86  if(curSet=="suppressBremForDecay"){
88  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
89  for(unsigned int i=0;i<v.size();i++){
90  std::string vs = v[i];
91  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
92  if(vpar.size()==1) Photospp::Photos::suppressBremForDecay(0,vpar[0]);
93  if(vpar.size()==2) Photospp::Photos::suppressBremForDecay(0/*vpar[0]*/,vpar[1]);
94  if(vpar.size()==3) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2]);
95  if(vpar.size()==4) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
96  if(vpar.size()==5) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
97  if(vpar.size()==6) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
98  if(vpar.size()==7) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
99  if(vpar.size()==8) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
100  if(vpar.size()==9) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
101  if(vpar.size()==10) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
102  }
103  }
104 
105  if(curSet=="forceBremForBranch"){
107  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
108  for(unsigned int i=0;i<v.size();i++){
109  std::string vs = v[i];
110  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
111  if(vpar.size()==1) Photospp::Photos::forceBremForBranch(0,vpar[0]);
112  if(vpar.size()==2) Photospp::Photos::forceBremForBranch(0/*vpar[0]*/,vpar[1]);
113  if(vpar.size()==3) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2]);
114  if(vpar.size()==4) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
115  if(vpar.size()==5) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
116  if(vpar.size()==6) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
117  if(vpar.size()==7) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
118  if(vpar.size()==8) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
119  if(vpar.size()==9) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
120  if(vpar.size()==10) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
121  }
122  }
123  if(curSet=="forceBremForDecay"){
125  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
126  for(unsigned int i=0;i<v.size();i++){
127  std::string vs = v[i];
128  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
129  if(vpar.size()==1) Photospp::Photos::forceBremForDecay(0,vpar[0]);
130  if(vpar.size()==2) Photospp::Photos::forceBremForDecay(0/*vpar[0]*/,vpar[1]);
131  if(vpar.size()==3) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2]);
132  if(vpar.size()==4) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
133  if(vpar.size()==5) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
134  if(vpar.size()==6) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
135  if(vpar.size()==7) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
136  if(vpar.size()==8) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
137  if(vpar.size()==9) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
138  if(vpar.size()==10) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
139  }
140  }
141 
142  if(curSet=="forceMass"){
144  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
145  for(unsigned int i=0;i<v.size();i++){
146  std::string vs = v[i];
147  std::vector<double> vpar = cfg.getParameter<std::vector<double> >(vs);
148  if(vpar.size()==2) Photospp::Photos::forceMass((int)vpar[0], vpar[1]);
149  }
150  }
151  }
152  // implement options set via c++
153  if(fOnlyPDG>=0){
154  Photospp::Photos::suppressAll();
155  Photospp::Photos::forceBremForBranch(0,fOnlyPDG);
156  Photospp::Photos::forceBremForBranch(0,-1*fOnlyPDG);
157  }
159  Photospp::Photos::suppressBremForDecay(3, 15, 16, 11, -12);
160  Photospp::Photos::suppressBremForDecay(3, -15, -16, -11, 12);
161  Photospp::Photos::suppressBremForDecay(3, 15, 16, 13, -14);
162  Photospp::Photos::suppressBremForDecay(3, -15, -16, -13, -14);
163  }
164  Photospp::Photos::iniInfo();
165  fIsInitialized = true;
166  return;
167 }
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
int i
Definition: DBlmapReader.cc:9
edm::ParameterSet * fPSet
double v[5][pyjets_maxn]
bool gen::PhotosppInterface::isTauLeptonicDecay ( HepMC::GenVertex *  )
void PhotosppInterface::setRandomEngine ( CLHEP::HepRandomEngine *  decayRandomEngine)
virtual

Implements gen::PhotosInterfaceBase.

Definition at line 32 of file PhotosppInterface.cc.

References decayRandomEngine, and fRandomEngine.

static CLHEP::HepRandomEngine * fRandomEngine
CLHEP::HepRandomEngine * decayRandomEngine
const std::vector<std::string>& gen::PhotosppInterface::specialSettings ( )
inlinevirtual

Reimplemented from gen::PhotosInterfaceBase.

Definition at line 29 of file PhotosppInterface.h.

References gen::PhotosInterfaceBase::fSpecialSettings.

29 { return fSpecialSettings; }
std::vector< std::string > fSpecialSettings
void PhotosppInterface::statistics ( )
virtual

Reimplemented from gen::PhotosInterfaceBase.

Definition at line 207 of file PhotosppInterface.cc.

207 {Photospp::Photos::iniInfo();}

Member Data Documentation

bool gen::PhotosppInterface::fAvoidTauLeptonicDecays
private

Definition at line 40 of file PhotosppInterface.h.

Referenced by avoidTauLeptonicDecays(), and init().

bool gen::PhotosppInterface::fIsInitialized
private

Definition at line 41 of file PhotosppInterface.h.

Referenced by apply(), and init().

int gen::PhotosppInterface::fOnlyPDG
private

Definition at line 39 of file PhotosppInterface.h.

Referenced by configureOnlyFor(), and init().

edm::ParameterSet* gen::PhotosppInterface::fPSet
private

Definition at line 42 of file PhotosppInterface.h.

Referenced by init(), and PhotosppInterface().

CLHEP::HepRandomEngine * PhotosppInterface::fRandomEngine = nullptr
staticprivate

Definition at line 44 of file PhotosppInterface.h.

Referenced by flat(), and setRandomEngine().