Changeset View
Changeset View
Standalone View
Standalone View
validation/testCPVDecays.cc
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | int main( int argc, char** argv ) | ||||||||
} | } | ||||||||
cout << "Number of events is " << nEvents << endl; | cout << "Number of events is " << nEvents << endl; | ||||||||
cout << "sin2Beta = " << sin2Beta | cout << "sin2Beta = " << sin2Beta | ||||||||
<< " (used to draw oscillation maxima lines)" << endl; | << " (used to draw oscillation maxima lines)" << endl; | ||||||||
// Define the random number generator | // Define the random number generator | ||||||||
EvtRandomEngine* myRandomEngine = 0; | EvtRandomEngine* myRandomEngine = nullptr; | ||||||||
#ifdef EVTGEN_CPP11 | #ifdef EVTGEN_CPP11 | ||||||||
// Use the Mersenne-Twister generator (C++11 only) | // Use the Mersenne-Twister generator (C++11 only) | ||||||||
myRandomEngine = new EvtMTRandomEngine(); | myRandomEngine = new EvtMTRandomEngine(); | ||||||||
#else | #else | ||||||||
myRandomEngine = new EvtSimpleRandomEngine(); | myRandomEngine = new EvtSimpleRandomEngine(); | ||||||||
#endif | #endif | ||||||||
EvtAbsRadCorr* radCorrEngine = 0; | EvtAbsRadCorr* radCorrEngine = nullptr; | ||||||||
std::list<EvtDecayBase*> extraModels; | std::list<EvtDecayBase*> extraModels; | ||||||||
#ifdef EVTGEN_EXTERNAL | #ifdef EVTGEN_EXTERNAL | ||||||||
bool convertPythiaCodes( false ); | bool convertPythiaCodes( false ); | ||||||||
bool useEvtGenRandom( true ); | bool useEvtGenRandom( true ); | ||||||||
EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom ); | EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom ); | ||||||||
radCorrEngine = genList.getPhotosModel(); | radCorrEngine = genList.getPhotosModel(); | ||||||||
extraModels = genList.getListOfModels(); | extraModels = genList.getListOfModels(); | ||||||||
Show All 10 Lines | #endif | ||||||||
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 -1; | return -1; | ||||||||
} | } | ||||||||
// Start all initial (parent) decays at the origin | // Start all initial (parent) decays at the origin | ||||||||
EvtVector4R origin( 0.0, 0.0, 0.0, 0.0 ); | EvtVector4R origin( 0.0, 0.0, 0.0, 0.0 ); | ||||||||
EvtSpinDensity* spinDensity = 0; | EvtSpinDensity* spinDensity = nullptr; | ||||||||
EvtSpinType::spintype baseSpin = EvtPDL::getSpinType( theId ); | EvtSpinType::spintype baseSpin = EvtPDL::getSpinType( theId ); | ||||||||
if ( baseSpin == EvtSpinType::VECTOR ) { | if ( baseSpin == EvtSpinType::VECTOR ) { | ||||||||
cout << "Setting spin density for vector particle " << parentName << endl; | cout << "Setting spin density for vector particle " << parentName << endl; | ||||||||
spinDensity = new EvtSpinDensity(); | spinDensity = new EvtSpinDensity(); | ||||||||
spinDensity->setDiag( EvtSpinType::getSpinStates( EvtSpinType::VECTOR ) ); | spinDensity->setDiag( EvtSpinType::getSpinStates( EvtSpinType::VECTOR ) ); | ||||||||
spinDensity->set( 1, 1, EvtComplex( 0.0, 0.0 ) ); | spinDensity->set( 1, 1, EvtComplex( 0.0, 0.0 ) ); | ||||||||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Lines | |||||||||
} | } | ||||||||
#ifdef EVTGEN_HEPMC3 | #ifdef EVTGEN_HEPMC3 | ||||||||
void storeBFlightTimes( GenEvent* theEvent ) | void storeBFlightTimes( GenEvent* theEvent ) | ||||||||
{ | { | ||||||||
std::list<GenVertexPtr> allVertices; | std::list<GenVertexPtr> allVertices; | ||||||||
// Loop over vertices in the event | // Loop over vertices in the event | ||||||||
for ( auto theVertex : theEvent->vertices() ) { | for ( auto theVertex : theEvent->vertices() ) { | ||||||||
if ( theVertex == 0 ) { | if ( theVertex == nullptr ) { | ||||||||
tlathamUnsubmitted Not Done Inline Actions
tlatham: | |||||||||
continue; | continue; | ||||||||
} | } | ||||||||
// Check to see if the incoming particle is a B candidate. | // Check to see if the incoming particle is a B candidate. | ||||||||
// If so, also look at the outgoing particles to see if we have a signal decay. | // If so, also look at the outgoing particles to see if we have a signal decay. | ||||||||
// For these, get the B decay vertex position and the B 4-momentum to calculate | // For these, get the B decay vertex position and the B 4-momentum to calculate | ||||||||
// the B lifetime. | // the B lifetime. | ||||||||
bool gotB0( false ), gotB0bar( false ); | bool gotB0( false ), gotB0bar( false ); | ||||||||
FourVector B4mtm; | FourVector B4mtm; | ||||||||
for ( auto inParticle : theVertex->particles_in() ) { | for ( auto inParticle : theVertex->particles_in() ) { | ||||||||
if ( inParticle == 0 ) { | if ( inParticle == nullptr ) { | ||||||||
Not Done Inline Actions
tlatham: | |||||||||
continue; | continue; | ||||||||
} | } | ||||||||
int inPDGId = inParticle->pdg_id(); | int inPDGId = inParticle->pdg_id(); | ||||||||
if ( inPDGId == B0Id ) { | if ( inPDGId == B0Id ) { | ||||||||
gotB0 = true; | gotB0 = true; | ||||||||
} else if ( inPDGId == B0barId ) { | } else if ( inPDGId == B0barId ) { | ||||||||
gotB0bar = true; | gotB0bar = true; | ||||||||
} | } | ||||||||
if ( gotB0 == true || gotB0bar == true ) { | if ( gotB0 == true || gotB0bar == true ) { | ||||||||
B4mtm = inParticle->momentum(); | B4mtm = inParticle->momentum(); | ||||||||
} | } | ||||||||
} // Loop over ingoing vertex particles | } // Loop over ingoing vertex particles | ||||||||
if ( gotB0 == true || gotB0bar == true ) { | if ( gotB0 == true || gotB0bar == true ) { | ||||||||
// Check outgoing particles | // Check outgoing particles | ||||||||
std::vector<int> daugIdVect; | std::vector<int> daugIdVect; | ||||||||
for ( auto outParticle : theVertex->particles_out() ) { | for ( auto outParticle : theVertex->particles_out() ) { | ||||||||
if ( outParticle != 0 ) { | if ( outParticle != nullptr ) { | ||||||||
Not Done Inline Actions
tlatham: | |||||||||
int outPDGId = outParticle->pdg_id(); | int outPDGId = outParticle->pdg_id(); | ||||||||
daugIdVect.push_back( outPDGId ); | daugIdVect.push_back( outPDGId ); | ||||||||
} | } | ||||||||
} // Loop over outgoing vertex particles | } // Loop over outgoing vertex particles | ||||||||
// Check if we have the signal decay | // Check if we have the signal decay | ||||||||
bool gotSignal = checkSignal( daugIdVect ); | bool gotSignal = checkSignal( daugIdVect ); | ||||||||
Show All 27 Lines | void storeBFlightTimes( GenEvent* theEvent ) | ||||||||
HepMC::GenEvent::vertex_iterator vertexIter; | HepMC::GenEvent::vertex_iterator vertexIter; | ||||||||
// Loop over vertices in the event | // Loop over vertices in the event | ||||||||
for ( vertexIter = theEvent->vertices_begin(); | for ( vertexIter = theEvent->vertices_begin(); | ||||||||
vertexIter != theEvent->vertices_end(); ++vertexIter ) { | vertexIter != theEvent->vertices_end(); ++vertexIter ) { | ||||||||
// Get the vertex | // Get the vertex | ||||||||
HepMC::GenVertex* theVertex = *vertexIter; | HepMC::GenVertex* theVertex = *vertexIter; | ||||||||
if ( theVertex == 0 ) { | if ( theVertex == nullptr ) { | ||||||||
continue; | continue; | ||||||||
} | } | ||||||||
// Check to see if the incoming particle is a B candidate. | // Check to see if the incoming particle is a B candidate. | ||||||||
// If so, also look at the outgoing particles to see if we have a signal decay. | // If so, also look at the outgoing particles to see if we have a signal decay. | ||||||||
// For these, get the B decay vertex position and the B 4-momentum to calculate | // For these, get the B decay vertex position and the B 4-momentum to calculate | ||||||||
// the B lifetime. | // the B lifetime. | ||||||||
bool gotB0( false ), gotB0bar( false ); | bool gotB0( false ), gotB0bar( false ); | ||||||||
FourVector B4mtm; | FourVector B4mtm; | ||||||||
HepMC::GenVertex::particles_in_const_iterator inIter; | HepMC::GenVertex::particles_in_const_iterator inIter; | ||||||||
for ( inIter = theVertex->particles_in_const_begin(); | for ( inIter = theVertex->particles_in_const_begin(); | ||||||||
inIter != theVertex->particles_in_const_end(); ++inIter ) { | inIter != theVertex->particles_in_const_end(); ++inIter ) { | ||||||||
HepMC::GenParticle* inParticle = *inIter; | HepMC::GenParticle* inParticle = *inIter; | ||||||||
if ( inParticle == 0 ) { | if ( inParticle == nullptr ) { | ||||||||
continue; | continue; | ||||||||
} | } | ||||||||
int inPDGId = inParticle->pdg_id(); | int inPDGId = inParticle->pdg_id(); | ||||||||
if ( inPDGId == B0Id ) { | if ( inPDGId == B0Id ) { | ||||||||
gotB0 = true; | gotB0 = true; | ||||||||
} else if ( inPDGId == B0barId ) { | } else if ( inPDGId == B0barId ) { | ||||||||
gotB0bar = true; | gotB0bar = true; | ||||||||
} | } | ||||||||
if ( gotB0 == true || gotB0bar == true ) { | if ( gotB0 == true || gotB0bar == true ) { | ||||||||
B4mtm = inParticle->momentum(); | B4mtm = inParticle->momentum(); | ||||||||
} | } | ||||||||
} // Loop over ingoing vertex particles | } // Loop over ingoing vertex particles | ||||||||
if ( gotB0 == true || gotB0bar == true ) { | if ( gotB0 == true || gotB0bar == true ) { | ||||||||
// Check outgoing particles | // Check outgoing particles | ||||||||
std::vector<int> daugIdVect; | std::vector<int> daugIdVect; | ||||||||
HepMC::GenVertex::particles_out_const_iterator outIter; | HepMC::GenVertex::particles_out_const_iterator outIter; | ||||||||
for ( outIter = theVertex->particles_out_const_begin(); | for ( outIter = theVertex->particles_out_const_begin(); | ||||||||
outIter != theVertex->particles_out_const_end(); ++outIter ) { | outIter != theVertex->particles_out_const_end(); ++outIter ) { | ||||||||
HepMC::GenParticle* outParticle = *outIter; | HepMC::GenParticle* outParticle = *outIter; | ||||||||
if ( outParticle != 0 ) { | if ( outParticle != nullptr ) { | ||||||||
int outPDGId = outParticle->pdg_id(); | int outPDGId = outParticle->pdg_id(); | ||||||||
daugIdVect.push_back( outPDGId ); | daugIdVect.push_back( outPDGId ); | ||||||||
} | } | ||||||||
} // Loop over outgoing vertex particles | } // Loop over outgoing vertex particles | ||||||||
// Check if we have the signal decay | // Check if we have the signal decay | ||||||||
bool gotSignal = checkSignal( daugIdVect ); | bool gotSignal = checkSignal( daugIdVect ); | ||||||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |