Verified Commit ab683633 authored by Tadej Novak's avatar Tadej Novak
Browse files

MCTC: add ability to run on TRUTH3

parent ffd00b3b
Pipeline #2965193 passed with stage
in 0 seconds
......@@ -10,8 +10,8 @@ PACKAGE: atlasoff/PhysicsAnalysis/MCTruthClassifier
AUTHORS: O. Fedin
CREATED: Sep 2007
MODIFIED: 02/07/2020
AUTHOR: Sukanya Sinha (sukanya.sinha@cern.ch)
MODIFIED: 02/07/2020
AUTHOR: Sukanya Sinha (sukanya.sinha@cern.ch)
PURPOSE: to classify truth particles according to their origin. Based on
the truth particle classification the tool provide classification of
......@@ -175,19 +175,19 @@ const xAOD::TruthParticle* MCTruthClassifier::getParentHadron(const xAOD::TruthP
return std::get<1>(defOrigOfParticle(thePart));
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
int MCTruthClassifier::getParentHadronID(const xAOD::TruthParticle* thePart) {
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
const xAOD::TruthParticle* parentHadron = getParentHadron(thePart);
return parentHadron ? parentHadron->pdgId() : 0;
return parentHadron ? parentHadron->pdgId() : 0;
}
//---------------------------------------------------------------------------------------
unsigned int MCTruthClassifier::classify(const xAOD::TruthParticle *thePart){
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
ATH_MSG_DEBUG( "Executing classify" );
......@@ -847,12 +847,12 @@ const xAOD::TruthParticle* MCTruthClassifier::getGenPart(const xAOD::TrackPartic
return(theGenParticle);
}
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
std::tuple<unsigned int, const xAOD::TruthParticle*> MCTruthClassifier::defOrigOfParticle(const xAOD::TruthParticle *thePart){
//-------------------------------------------------------------------------------
//-------------------------------------------------------------------------------
ATH_MSG_DEBUG( "Executing DefOrigOfParticle " );
ATH_MSG_DEBUG( "Executing DefOrigOfParticle " );
m_MotherPDG = 0;
m_MotherStatus = 0;
......@@ -866,58 +866,58 @@ std::tuple<unsigned int, const xAOD::TruthParticle*> MCTruthClassifier::defOrigO
unsigned int outputvalue;
bool isStable=0; bool fromhad = 0; bool uncat = 0; bool isHadTau=0; bool mybeam=0; bool fromTau=0; bool fromBSM=0; bool isGeant=0; bool isBSM=0;
if(iParticleStat == 1 || iParticleStat == 2){
if(iParticleStat == 1 || iParticleStat == 2){
isStable = 1;
}
if(isStable == 1){
const xAOD::TruthVertex* partOriVert=thePart->hasProdVtx() ? thePart->prodVtx():0;
if( partOriVert!=0 ) {
for (unsigned int ipIn=0; ipIn<partOriVert->nIncomingParticles(); ++ipIn) {
const xAOD::TruthParticle* theMother=partOriVert->incomingParticle(ipIn);
if( thePart->nParents() > 0 ) {
for (size_t ipIn=0; ipIn<thePart->nParents(); ++ipIn) {
const xAOD::TruthParticle* theMother=thePart->parent(ipIn);
if(!theMother) continue;
if(std::abs(thePart->barcode()) >= m_barcodeG4Shift){
isGeant = 1; break;
}
if(MC::PID::isBSM(iParticlePDG) && abs(iParticleStat) == 1){
isBSM=1;
}
while (mybeam==0){
const xAOD::TruthVertex* partOriVert=thePart->hasProdVtx() ? thePart->prodVtx():0;
if( partOriVert!=0 ) {
const xAOD::TruthParticle* theMother=partOriVert->incomingParticle(0);
if(!theMother) continue;
if(std::abs(theMother->pdgId()) == 2212){
mybeam = 1; break;
}
if(MC::PID::isTau(theMother->pdgId()) && theMother->status() == 2 ){
fromTau = 1; isHadTau =0;
}
if(isHadron(theMother) == true && theMother->status() == 2 ) {
fromhad = 1;
parent_hadron_pointer = theMother;
if(fromTau == 1){
isHadTau = 1;
}
}
if(MC::PID::isBSM(theMother->pdgId())){
fromBSM = 1;
}
thePart = theMother;
}
else{break;}
}
isGeant = 1; break;
}
if(MC::PID::isBSM(iParticlePDG) && abs(iParticleStat) == 1){
isBSM=1;
}
while (mybeam==0){
if( thePart->nParents() > 0 ) {
const xAOD::TruthParticle* theMother=thePart->parent(0);
if(!theMother) continue;
if(std::abs(theMother->pdgId()) == 2212){
mybeam = 1; break;
}
if(MC::PID::isTau(theMother->pdgId()) && theMother->status() == 2 ){
fromTau = 1; isHadTau =0;
}
if(isHadron(theMother) == true && theMother->status() == 2 ) {
fromhad = 1;
parent_hadron_pointer = theMother;
if(fromTau == 1){
isHadTau = 1;
}
}
if(MC::PID::isBSM(theMother->pdgId())){
fromBSM = 1;
}
thePart = theMother;
} else {
break;
}
}
}
}
else{
ATH_MSG_DEBUG( "No parent information ");
uncat=1;
}
std::bitset<MCTC_bits::totalBits> status;
status[MCTC_bits::stable] = isStable;
......@@ -934,7 +934,7 @@ std::tuple<unsigned int, const xAOD::TruthParticle*> MCTruthClassifier::defOrigO
else {
std::bitset<MCTC_bits::totalBits> unclass;
unclass[MCTC_bits::stable] = isStable;
outputvalue = static_cast<unsigned int>(unclass.to_ulong());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment