CMS 3D CMS Logo

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::GenEventapply (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 = 0
 

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, gen::PhotosInterfaceBase::fSpecialSettings, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

23  : fOnlyPDG(-1),
25  fIsInitialized(false),
26  fPSet(0)
27 {
28  // add ability to keep brem from hadronizer and only modify specific channels 10/27/2014
29  bool UseHadronizerQEDBrem=false;
30  fPSet = new ParameterSet(pset);
31  std::vector<std::string> par = fPSet->getParameter< std::vector<std::string> >("parameterSets");
32  for (unsigned int ip=0; ip<par.size(); ++ip ){
33  std::string curSet = par[ip];
34  // Physics settings
35  if(curSet=="UseHadronizerQEDBrem") UseHadronizerQEDBrem=true;
36  }
37  if(!UseHadronizerQEDBrem)fSpecialSettings.push_back("QED-brem-off:all");
38 }
T getParameter(std::string const &) const
edm::ParameterSet * fPSet
std::vector< std::string > fSpecialSettings
gen::PhotosppInterface::~PhotosppInterface ( )
inline

Definition at line 26 of file PhotosppInterface.h.

References init.

26 {}

Member Function Documentation

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

Reimplemented from gen::PhotosInterfaceBase.

Definition at line 182 of file PhotosppInterface.cc.

References class-composition::children, fIsInitialized, flat(), GenParticle::GenParticle, p1, and badGlobalMuonTaggersAOD_cff::vtx.

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__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

182  {
183  Photospp::Photos::setRandomGenerator(PhotosppInterface::flat);
184  if(!fIsInitialized) return evt;
185  int NPartBefore = evt->particles_size();
186  Photospp::PhotosHepMCEvent PhotosEvt(evt);
187  PhotosEvt.process();
188  //Fix the vertices and barcodes based on Julia Yarba's solution from TauolaInterface
189  for (HepMC::GenEvent::vertex_const_iterator vtx=evt->vertices_begin(); vtx!=evt->vertices_end(); vtx++ ){
190  std::vector<int> BCodes;
191  BCodes.clear();
192  if(*vtx){
193  for(HepMC::GenVertex::particle_iterator pitr=(*vtx)->particles_begin(HepMC::children);pitr!=(*vtx)->particles_end(HepMC::children);++pitr){
194  if((*pitr)->barcode()>10000){
195  BCodes.push_back((*pitr)->barcode());
196  }
197  }
198  }
199  if(BCodes.size() > 0){
200  for(size_t ibc=0; ibc<BCodes.size(); ibc++){
201  HepMC::GenParticle* p1 = evt->barcode_to_particle(BCodes[ibc]);
202  int nbc = p1->barcode() - 10000 + NPartBefore;
203  p1->suggest_barcode(nbc);
204  }
205  }
206  }
207  return evt;
208 }
double p1[4]
Definition: TauolaWrapper.h:89
void gen::PhotosppInterface::avoidTauLeptonicDecays ( )
inlinevirtual

Implements gen::PhotosInterfaceBase.

Definition at line 32 of file PhotosppInterface.h.

References decayRandomEngine, and myMessageLogger_cff::statistics.

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

Implements gen::PhotosInterfaceBase.

Definition at line 42 of file PhotosppInterface.cc.

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

42  {
43  fOnlyPDG = ipdg;
44  fSpecialSettings.clear();
45  return;
46 }
std::vector< std::string > fSpecialSettings
double PhotosppInterface::flat ( )
static

Definition at line 210 of file PhotosppInterface.cc.

References Exception, and fRandomEngine.

Referenced by apply().

210  {
211  if ( !fRandomEngine ) {
212  throw cms::Exception("LogicError")
213  << "PhotosppInterface::flat: Attempt to generate random number when engine pointer is null\n"
214  << "This might mean that the code was modified to generate a random number outside the\n"
215  << "event and beginLuminosityBlock methods, which is not allowed.\n";
216  }
217  return fRandomEngine->flat();
218 }
static CLHEP::HepRandomEngine * fRandomEngine
void PhotosppInterface::init ( void  )
virtual

Implements gen::PhotosInterfaceBase.

Definition at line 48 of file PhotosppInterface.cc.

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

48  {
49  if ( fIsInitialized ) return; // do init only once
51  Photospp::Photos::createHistoryEntries(true, 746); // P-H-O
52  std::vector<std::string> par = fPSet->getParameter< std::vector<std::string> >("parameterSets");
53  for (unsigned int ip=0; ip<par.size(); ++ip ){
54  std::string curSet = par[ip];
55 
56  // Physics settings
57  if(curSet=="maxWtInterference") Photospp::Photos::maxWtInterference(fPSet->getParameter<double>(curSet));
58  if(curSet=="setInfraredCutOff") Photospp::Photos::setInfraredCutOff(fPSet->getParameter<double>(curSet));
59  if(curSet=="setAlphaQED") Photospp::Photos::setAlphaQED(fPSet->getParameter<double>(curSet));
60  if(curSet=="setInterference") Photospp::Photos::setInterference(fPSet->getParameter<bool>(curSet));
61  if(curSet=="setDoubleBrem") Photospp::Photos::setDoubleBrem(fPSet->getParameter<bool>(curSet));
62  if(curSet=="setQuatroBrem") Photospp::Photos::setQuatroBrem(fPSet->getParameter<bool>(curSet));
63  if(curSet=="setExponentiation") Photospp::Photos::setExponentiation(fPSet->getParameter<bool>(curSet));
64  if(curSet=="setCorrectionWtForW") Photospp::Photos::setCorrectionWtForW(fPSet->getParameter<bool>(curSet));
65  if(curSet=="setMeCorrectionWtForScalar") Photospp::Photos::setMeCorrectionWtForScalar(fPSet->getParameter<bool>(curSet));
66  if(curSet=="setMeCorrectionWtForW") Photospp::Photos::setMeCorrectionWtForW(fPSet->getParameter<bool>(curSet));
67  if(curSet=="setMeCorrectionWtForZ") Photospp::Photos::setMeCorrectionWtForZ(fPSet->getParameter<bool>(curSet));
68  if(curSet=="initializeKinematicCorrections") Photospp::Photos::initializeKinematicCorrections(fPSet->getParameter<int>(curSet));
69  if(curSet=="forceMassFrom4Vector") Photospp::Photos::forceMassFrom4Vector(fPSet->getParameter<bool>(curSet));
70  if(curSet=="forceMassFromEventRecord") Photospp::Photos::forceMassFromEventRecord(fPSet->getParameter<int>(curSet));
71  if(curSet=="ignoreParticlesOfStatus") Photospp::Photos::ignoreParticlesOfStatus(fPSet->getParameter<int>(curSet));
72  if(curSet=="deIgnoreParticlesOfStatus") Photospp::Photos::deIgnoreParticlesOfStatus(fPSet->getParameter<int>(curSet));
73  if(curSet=="setMomentumConservationThreshold") Photospp::Photos::setMomentumConservationThreshold(fPSet->getParameter<double>(curSet));
74  if(curSet=="suppressAll") if(fPSet->getParameter<bool>(curSet)==true)Photospp::Photos::suppressAll();
75  if(curSet=="setPairEmission") Photospp::Photos::setPairEmission(fPSet->getParameter<bool>(curSet));
76  if(curSet=="setPhotonEmission") Photospp::Photos::setPhotonEmission(fPSet->getParameter<bool>(curSet));
77  if(curSet=="setStopAtCriticalError") Photospp::Photos::setStopAtCriticalError(fPSet->getParameter<bool>(curSet));
78  if (curSet == "createHistoryEntries") Photospp::Photos::createHistoryEntries(fPSet->getParameter<bool>(curSet), 746);
79 
80  // Now setup more complicated radiation/mass supression and forcing.
81  if(curSet=="suppressBremForBranch"){
83  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
84  for(unsigned int i=0;i<v.size();i++){
85  std::string vs = v[i];
86  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
87  if(vpar.size()==1) Photospp::Photos::suppressBremForBranch(0,vpar[0]);
88  if(vpar.size()==2) Photospp::Photos::suppressBremForBranch(0/*vpar[0]*/,vpar[1]);
89  if(vpar.size()==3) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2]);
90  if(vpar.size()==4) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
91  if(vpar.size()==5) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
92  if(vpar.size()==6) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
93  if(vpar.size()==7) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
94  if(vpar.size()==8) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
95  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]);
96  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]);
97  }
98  }
99  if(curSet=="suppressBremForDecay"){
101  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
102  for(unsigned int i=0;i<v.size();i++){
103  std::string vs = v[i];
104  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
105  if(vpar.size()==1) Photospp::Photos::suppressBremForDecay(0,vpar[0]);
106  if(vpar.size()==2) Photospp::Photos::suppressBremForDecay(0/*vpar[0]*/,vpar[1]);
107  if(vpar.size()==3) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2]);
108  if(vpar.size()==4) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
109  if(vpar.size()==5) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
110  if(vpar.size()==6) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
111  if(vpar.size()==7) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
112  if(vpar.size()==8) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
113  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]);
114  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]);
115  }
116  }
117 
118  if(curSet=="forceBremForBranch"){
120  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
121  for(unsigned int i=0;i<v.size();i++){
122  std::string vs = v[i];
123  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
124  if(vpar.size()==1) Photospp::Photos::forceBremForBranch(0,vpar[0]);
125  if(vpar.size()==2) Photospp::Photos::forceBremForBranch(0/*vpar[0]*/,vpar[1]);
126  if(vpar.size()==3) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2]);
127  if(vpar.size()==4) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
128  if(vpar.size()==5) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
129  if(vpar.size()==6) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
130  if(vpar.size()==7) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
131  if(vpar.size()==8) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
132  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]);
133  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]);
134  }
135  }
136  if(curSet=="forceBremForDecay"){
138  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
139  for(unsigned int i=0;i<v.size();i++){
140  std::string vs = v[i];
141  std::vector<int> vpar = cfg.getParameter<std::vector<int> >(vs);
142  if(vpar.size()==1) Photospp::Photos::forceBremForDecay(0,vpar[0]);
143  if(vpar.size()==2) Photospp::Photos::forceBremForDecay(0/*vpar[0]*/,vpar[1]);
144  if(vpar.size()==3) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2]);
145  if(vpar.size()==4) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
146  if(vpar.size()==5) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
147  if(vpar.size()==6) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
148  if(vpar.size()==7) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
149  if(vpar.size()==8) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
150  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]);
151  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]);
152  }
153  }
154 
155  if(curSet=="forceMass"){
157  std::vector<std::string> v = cfg.getParameter<std::vector<std::string> >("parameterSets");
158  for(unsigned int i=0;i<v.size();i++){
159  std::string vs = v[i];
160  std::vector<double> vpar = cfg.getParameter<std::vector<double> >(vs);
161  if(vpar.size()==2) Photospp::Photos::forceMass((int)vpar[0], vpar[1]);
162  }
163  }
164  }
165  // implement options set via c++
166  if(fOnlyPDG>=0){
167  Photospp::Photos::suppressAll();
168  Photospp::Photos::forceBremForBranch(0,fOnlyPDG);
169  Photospp::Photos::forceBremForBranch(0,-1*fOnlyPDG);
170  }
172  Photospp::Photos::suppressBremForDecay(3, 15, 16, 11, -12);
173  Photospp::Photos::suppressBremForDecay(3, -15, -16, -11, 12);
174  Photospp::Photos::suppressBremForDecay(3, 15, 16, 13, -14);
175  Photospp::Photos::suppressBremForDecay(3, -15, -16, -13, -14);
176  }
177  Photospp::Photos::iniInfo();
178  fIsInitialized = true;
179  return;
180 }
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
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 40 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 apply().

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

Reimplemented from gen::PhotosInterfaceBase.

Definition at line 220 of file PhotosppInterface.cc.

References DEFINE_EDM_PLUGIN.

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

Member Data Documentation

bool gen::PhotosppInterface::fAvoidTauLeptonicDecays
private

Definition at line 40 of file PhotosppInterface.h.

Referenced by 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 = 0
staticprivate

Definition at line 44 of file PhotosppInterface.h.

Referenced by flat(), and setRandomEngine().