Skip to content
Snippets Groups Projects
Commit 6d5b820d authored by Andrii Verbytskyi's avatar Andrii Verbytskyi Committed by Walter Lampl
Browse files

Hepmc3 nightly fixes 02122020 part 5

parent b1bbd3f9
No related branches found
No related tags found
5 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3
...@@ -46,12 +46,20 @@ SimpleTruthParticleFilterTool::isAccepted (const HepMC::GenParticle* p) ...@@ -46,12 +46,20 @@ SimpleTruthParticleFilterTool::isAccepted (const HepMC::GenParticle* p)
bool last = std::abs(p->pdg_id())==15; bool last = std::abs(p->pdg_id())==15;
if ( abs(p->pdg_id())==15 && p->status()!=1 && p->end_vertex() ){ if ( abs(p->pdg_id())==15 && p->status()!=1 && p->end_vertex() ){
// Special handling for taus - take the ones that are last in the tau chain // Special handling for taus - take the ones that are last in the tau chain
#ifdef HEPMC3
for (auto pit: p->end_vertex()->particles_out()){
if (!pit || std::abs(pit->pdg_id())!=15) continue;
last=false;
break;
}
#else
for (HepMC::GenVertex::particles_out_const_iterator pit=p->end_vertex()->particles_out_const_begin(); pit!=p->end_vertex()->particles_out_const_end();++pit){ for (HepMC::GenVertex::particles_out_const_iterator pit=p->end_vertex()->particles_out_const_begin(); pit!=p->end_vertex()->particles_out_const_end();++pit){
if (!(*pit) || if (!(*pit) ||
abs((*pit)->pdg_id())!=15) continue; abs((*pit)->pdg_id())!=15) continue;
last=false; last=false;
break; break;
} }
#endif
if (!last) return false; if (!last) return false;
} }
......
...@@ -134,15 +134,18 @@ StatusCode Trk::TrueTracksNtupleTool::fillTrueTracksInfo(const TrackCollection& ...@@ -134,15 +134,18 @@ StatusCode Trk::TrueTracksNtupleTool::fillTrueTracksInfo(const TrackCollection&
if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << " truth is missing" << endmsg; if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << " truth is missing" << endmsg;
} else { } else {
TrackTruth trk_truth=found->second; TrackTruth trk_truth=found->second;
const HepMC::GenParticle * particle; auto particle = trk_truth.particleLink();
particle = trk_truth.particleLink(); auto prod_vtx = particle->production_vertex();
HepMC:: GenVertex* prod_vtx = particle->production_vertex();
//fill prod vertex //fill prod vertex
m_prod_x->push_back(prod_vtx->position().x()); m_prod_x->push_back(prod_vtx->position().x());
m_prod_y->push_back(prod_vtx->position().y()); m_prod_y->push_back(prod_vtx->position().y());
m_prod_z->push_back(prod_vtx->position().z()); m_prod_z->push_back(prod_vtx->position().z());
#ifdef HEPMC3
auto parent_iter = prod_vtx->particles_in().begin();
#else
HepMC::GenVertex::particle_iterator parent_iter = prod_vtx->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator parent_iter = prod_vtx->particles_begin(HepMC::parents);
#endif
m_parent_id->push_back((*parent_iter)->pdg_id()); m_parent_id->push_back((*parent_iter)->pdg_id());
m_particle_id->push_back(particle->pdg_id()); m_particle_id->push_back(particle->pdg_id());
} }
......
...@@ -71,18 +71,22 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec ...@@ -71,18 +71,22 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec
for(const auto it : *truthContainer) { //first loop in MMT_loader::load_event for(const auto it : *truthContainer) { //first loop in MMT_loader::load_event
const HepMC::GenEvent *subEvent = it; const HepMC::GenEvent *subEvent = it;
#ifdef HEPMC3
for(auto particle : subEvent->particles()) {
#else
HepMC::ConstGenEventParticleRange particle_range = subEvent->particle_range(); HepMC::ConstGenEventParticleRange particle_range = subEvent->particle_range();
for(const auto pit : particle_range) { for(const auto pit : particle_range) {
const HepMC::GenParticle *particle = pit; const HepMC::GenParticle *particle = pit;
const HepMC::FourVector& momentum = particle->momentum(); #endif
const HepMC::FourVector momentum = particle->momentum();
int k=trackRecordCollection->size(); //number of mu entries int k=trackRecordCollection->size(); //number of mu entries
if(particle->barcode() == 10001 && std::abs(particle->pdg_id())==13){ if(HepMC::barcode(particle) == 10001 && std::abs(particle->pdg_id())==13){
thePart.SetPtEtaPhiE(momentum.perp(),momentum.eta(),momentum.phi(),momentum.e()); thePart.SetPtEtaPhiE(momentum.perp(),momentum.eta(),momentum.phi(),momentum.e());
for(const auto & mit : *trackRecordCollection ) { for(const auto & mit : *trackRecordCollection ) {
if(k>0&&j<k){ if(k>0&&j<k){
const CLHEP::Hep3Vector mumomentum = mit.GetMomentum(); const CLHEP::Hep3Vector mumomentum = mit.GetMomentum();
const CLHEP::Hep3Vector muposition = mit.GetPosition(); const CLHEP::Hep3Vector muposition = mit.GetPosition();
pdg=particle->barcode(); pdg=HepMC::barcode(particle);
phiEntry = mumomentum.getPhi(); phiEntry = mumomentum.getPhi();
etaEntry = mumomentum.getEta(); etaEntry = mumomentum.getEta();
phiPosition = muposition.getPhi(); phiPosition = muposition.getPhi();
...@@ -90,10 +94,14 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec ...@@ -90,10 +94,14 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec
} }
}//muentry loop }//muentry loop
int l=0; int l=0;
#ifdef HEPMC3
for(auto vertex1 : subEvent->vertices()) {
#else
HepMC::ConstGenEventVertexRange vertex_range = subEvent->vertex_range(); HepMC::ConstGenEventVertexRange vertex_range = subEvent->vertex_range();
for(const auto vit : vertex_range) { for(const auto vit : vertex_range) {
if(l!=0){break;}//get first vertex of iteration, may want to change this if(l!=0){break;}//get first vertex of iteration, may want to change this
const HepMC::GenVertex *vertex1 = vit; const HepMC::GenVertex *vertex1 = vit;
#endif
const HepMC::FourVector& position = vertex1->position(); const HepMC::FourVector& position = vertex1->position();
vertex=TVector3(position.x(),position.y(),position.z()); vertex=TVector3(position.x(),position.y(),position.z());
l++; l++;
...@@ -160,11 +168,8 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec ...@@ -160,11 +168,8 @@ MMLoadVariables::MMLoadVariables(StoreGateSvc* evtStore, const MuonGM::MuonDetec
//match to truth particle //match to truth particle
TLorentzVector truthPart; TLorentzVector truthPart;
for(auto it1 : *truthContainer) { //Must be a more elegant way... should work for now though for(auto it1 : *truthContainer) { //Must be a more elegant way... should work for now though
const HepMC::GenEvent *subEvent1 = it1; for(auto particle1 : *it1) {
HepMC::ConstGenEventParticleRange particle_range1 = subEvent1->particle_range(); const HepMC::FourVector momentum1 = particle1->momentum();
for(auto pit1 : particle_range1) {
const HepMC::GenParticle *particle1 = pit1;
const HepMC::FourVector& momentum1 = particle1->momentum();
truthPart.SetPtEtaPhiE(momentum1.perp(),momentum1.eta(),momentum1.phi(),momentum1.e()); truthPart.SetPtEtaPhiE(momentum1.perp(),momentum1.eta(),momentum1.phi(),momentum1.e());
}//end particle loop }//end particle loop
}//end truth container loop (1 iteration) for matching }//end truth container loop (1 iteration) for matching
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment