Changeset View
Changeset View
Standalone View
Standalone View
validation/genRootDecayChain.cc
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | genRootDecayChain::genRootDecayChain( const string& decayFileName, | ||||
const string& rootFileName, | const string& rootFileName, | ||||
const string& parentName, int nEvents, | const string& parentName, int nEvents, | ||||
bool storeMtmXYZ ) : | bool storeMtmXYZ ) : | ||||
_decayFileName( decayFileName ), | _decayFileName( decayFileName ), | ||||
_rootFileName( rootFileName ), | _rootFileName( rootFileName ), | ||||
_parentName( parentName ), | _parentName( parentName ), | ||||
_nEvents( nEvents ), | _nEvents( nEvents ), | ||||
_storeMtmXYZ( storeMtmXYZ ), | _storeMtmXYZ( storeMtmXYZ ), | ||||
_theFile( 0 ), | _theFile( nullptr ), | ||||
_theTree( 0 ), | _theTree( nullptr ), | ||||
_probHist( 0 ), | _probHist( nullptr ), | ||||
_theCanvas( 0 ) | _theCanvas( nullptr ) | ||||
{ | { | ||||
_theFile = new TFile( rootFileName.c_str(), "recreate" ); | _theFile = new TFile( rootFileName.c_str(), "recreate" ); | ||||
_theTree = new TTree( "Data", "Data" ); | _theTree = new TTree( "Data", "Data" ); | ||||
_theTree->SetDirectory( _theFile ); | _theTree->SetDirectory( _theFile ); | ||||
_probHist = new TH1D( "probHist", "probHist", 100, 0.0, 0.0 ); | _probHist = new TH1D( "probHist", "probHist", 100, 0.0, 0.0 ); | ||||
_probHist->SetXTitle( "Prob/MaxProb" ); | _probHist->SetXTitle( "Prob/MaxProb" ); | ||||
_probHist->SetDirectory( _theFile ); | _probHist->SetDirectory( _theFile ); | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
_theFile->cd(); | _theFile->cd(); | ||||
_theTree->Write(); | _theTree->Write(); | ||||
_probHist->Write(); | _probHist->Write(); | ||||
} | } | ||||
void genRootDecayChain::generateEvents() | void genRootDecayChain::generateEvents() | ||||
{ | { | ||||
EvtRandomEngine* randomEngine = 0; | EvtRandomEngine* randomEngine = nullptr; | ||||
EvtAbsRadCorr* radCorrEngine = 0; | EvtAbsRadCorr* radCorrEngine = nullptr; | ||||
std::list<EvtDecayBase*> extraModels; | std::list<EvtDecayBase*> extraModels; | ||||
// Define the random number generator | // Define the random number generator | ||||
#ifdef EVTGEN_CPP11 | #ifdef EVTGEN_CPP11 | ||||
// Use the Mersenne-Twister generator (C++11 only) | // Use the Mersenne-Twister generator (C++11 only) | ||||
randomEngine = new EvtMTRandomEngine(); | randomEngine = new EvtMTRandomEngine(); | ||||
#else | #else | ||||
randomEngine = new EvtSimpleRandomEngine(); | randomEngine = new EvtSimpleRandomEngine(); | ||||
Show All 11 Lines | |||||
#endif | #endif | ||||
int mixingType( 1 ); | int mixingType( 1 ); | ||||
bool useXml( false ); | bool useXml( false ); | ||||
EvtGen evtGen( _decayFileName.c_str(), "../evt.pdl", randomEngine, | EvtGen evtGen( _decayFileName.c_str(), "../evt.pdl", randomEngine, | ||||
radCorrEngine, &extraModels, mixingType, useXml ); | radCorrEngine, &extraModels, mixingType, useXml ); | ||||
EvtParticle* theParent( 0 ); | EvtParticle* theParent( nullptr ); | ||||
EvtId theId = EvtPDL::getId( _parentName ); | EvtId theId = EvtPDL::getId( _parentName ); | ||||
if ( theId.getId() == -1 && theId.getAlias() == -1 ) { | if ( theId.getId() == -1 && theId.getAlias() == -1 ) { | ||||
cout << "Error. Could not find valid EvtId for " << _parentName << endl; | cout << "Error. Could not find valid EvtId for " << _parentName << endl; | ||||
return; | return; | ||||
} | } | ||||
// Loop to create nEvents | // Loop to create nEvents | ||||
▲ Show 20 Lines • Show All 188 Lines • Show Last 20 Lines |