Skip to content

Commit

Permalink
move ParticleDataTable uses to new ParticleDataList
Browse files Browse the repository at this point in the history
  • Loading branch information
rlcee committed Dec 22, 2021
1 parent 7cc7f0e commit 3ebb0ef
Show file tree
Hide file tree
Showing 143 changed files with 367 additions and 5,253 deletions.
8 changes: 4 additions & 4 deletions Analyses/src/CORSIKAGenPlots_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/PhysicsParams.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/MCDataProducts/inc/GenParticle.hh"
#include "Offline/Mu2eUtilities/inc/TwoLinePCA.hh"

Expand Down Expand Up @@ -93,7 +93,7 @@ class mu2e::CORSIKAGenPlots : public art::EDAnalyzer {
PDGCode::type _pdgId;

void bookHists(art::ServiceHandle<art::TFileService> &);
GlobalConstantsHandle<ParticleDataTable> pdt;
GlobalConstantsHandle<ParticleDataList> pdt;
};

mu2e::CORSIKAGenPlots::CORSIKAGenPlots(fhicl::ParameterSet const &p)
Expand Down Expand Up @@ -176,8 +176,8 @@ void mu2e::CORSIKAGenPlots::analyze(art::Event const & e)
_hXZ->Fill(p.position().x(), p.position().z());
_hY->Fill(p.position().y());

const HepPDT::ParticleData& p_data = pdt->particle(p.pdgId()).ref();
double mass = p_data.mass().value(); // in MeV
const ParticleData& p_data = pdt->particle(p.pdgId());
double mass = p_data.mass(); // in MeV

HepLorentzVector mom4 = p.momentum();
Hep3Vector mom3(mom4.px(), mom4.py(), mom4.pz());
Expand Down
8 changes: 4 additions & 4 deletions Analyses/src/CRYGenPlots_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/PhysicsParams.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/MCDataProducts/inc/GenParticle.hh"

#include "TH1F.h"
Expand Down Expand Up @@ -90,7 +90,7 @@ class mu2e::CRYGenPlots : public art::EDAnalyzer {
int _pdgId;

void bookHists(art::ServiceHandle<art::TFileService> &);
GlobalConstantsHandle<ParticleDataTable> pdt;
GlobalConstantsHandle<ParticleDataList> pdt;
};


Expand Down Expand Up @@ -143,8 +143,8 @@ void mu2e::CRYGenPlots::analyze(art::Event const & e)
_hXZ->Fill(p.position().x(), p.position().z());
_hY->Fill(p.position().y());

const HepPDT::ParticleData& p_data = pdt->particle(p.pdgId()).ref();
double mass = p_data.mass().value(); // in MeV
const ParticleData& p_data = pdt->particle(p.pdgId());
double mass = p_data.mass(); // in MeV

HepLorentzVector mom4 = p.momentum();
Hep3Vector mom3(mom4.px(), mom4.py(), mom4.pz());
Expand Down
1 change: 0 additions & 1 deletion Analyses/src/CaloCalib_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "CLHEP/Units/SystemOfUnits.h"
#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/unknownPDGIdName.hh"

#include "Offline/CalorimeterGeom/inc/Calorimeter.hh"
Expand Down
1 change: 0 additions & 1 deletion Analyses/src/CaloTrackMatchExample_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "CLHEP/Units/SystemOfUnits.h"
#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/unknownPDGIdName.hh"

#include "Offline/CalorimeterGeom/inc/Calorimeter.hh"
Expand Down
16 changes: 4 additions & 12 deletions Analyses/src/EMFCSimpleDumper_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Offline/DataProducts/inc/VirtualDetectorId.hh"

#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"

#include "Offline/GeometryService/inc/GeomHandle.hh"
#include "Offline/ProtonBeamDumpGeom/inc/ProtonBeamDump.hh"
Expand Down Expand Up @@ -60,21 +60,13 @@ namespace mu2e {
// unlike generic conditions, MC particle data
// should not change run-to-run, so static is safe
// use static for efficiency
static GlobalConstantsHandle<ParticleDataTable> pdt;
static GlobalConstantsHandle<ParticleDataList> pdt;

ParticleDataTable::maybe_ref info = pdt->particle(pdgId);
ParticleData info = pdt->particle(pdgId);

// Negatives will be rejected by the analysis
// Use an impossible number which is in the range of the "charge" histogram to signal "uninitialized"
double charge(-0.2);

if(!info.isValid()) {
std::cout<<"AG: warning: no valid PDG info for pdgId = "<<pdgId<<" using charge = "<<charge<<std::endl;
}
else {
charge = info.ref().charge();
}

double charge = info.charge();
return charge;
}

Expand Down
6 changes: 3 additions & 3 deletions Analyses/src/KineticFracAnalysis_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "CLHEP/Units/SystemOfUnits.h"

#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/GlobalConstantsService/inc/unknownPDGIdName.hh"
#include "art/Framework/Core/EDAnalyzer.h"

Expand Down Expand Up @@ -733,8 +733,8 @@ namespace mu2e {

//
// handle to PDG
// GlobalConstantsHandle<ParticleDataTable> pdt;
//ParticleDataTable const & pdt_ = *pdt;
// GlobalConstantsHandle<ParticleDataList> pdt;
//ParticleDataList const & pdt_ = *pdt;


// const double CrDensity = 4.9*(CLHEP::g/CLHEP::cm3);
Expand Down
43 changes: 8 additions & 35 deletions Analyses/src/Mu2eG4StudyCalo01ReadBack_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Offline/ConditionsService/inc/ConditionsHandle.hh"
#include "Offline/GeometryService/inc/GeomHandle.hh"
#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/MCDataProducts/inc/GenParticle.hh"
#include "Offline/MCDataProducts/inc/SimParticle.hh"
#include "Offline/MCDataProducts/inc/StepPointMC.hh"
Expand Down Expand Up @@ -271,8 +271,8 @@ namespace mu2e {

++_nAnalyzed;

GlobalConstantsHandle<ParticleDataTable> pdt;
ParticleDataTable const & pdt_ = *pdt;
GlobalConstantsHandle<ParticleDataList> pdt;
ParticleDataList const & pdt_ = *pdt;

// print the pdt content

Expand All @@ -285,32 +285,7 @@ namespace mu2e {
art::ServiceHandle<GeometryService> geom;
SimpleConfig const& config = geom->config();
if (config.getBool("mu2e.printParticleDataTable",false)) {

cout << __func__
<< " pdt size : "
<< pdt_.size()
<< endl;

for ( ParticleDataTable::const_iterator pdti=pdt_.begin(), e=pdt_.end();
pdti!=e; ++pdti ) {

cout << __func__
<< " pdt particle : "
<< pdti->first.pid()
<< ", name: "
<< pdt_.particle(pdti->first.pid()).ref().name()
<< ", PDTname: "
<< pdt_.particle(pdti->first.pid()).ref().PDTname()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().mass()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().totalWidth()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().lifetime()
<< endl;

}

pdt_.printTable();
}

} // end of oneTime
Expand Down Expand Up @@ -348,7 +323,7 @@ namespace mu2e {
} else {
SimParticle const& sim = simParticles->at(trackId);
pdgId = sim.pdgId();
mass = pdt_.particle(pdgId).ref().mass();
mass = pdt_.particle(pdgId).mass();
}
}

Expand Down Expand Up @@ -380,8 +355,7 @@ namespace mu2e {
<< point.volumeId() << " | "
<< point.trackId().asInt() << " | "
<< pdgId << " , name: "
<< pdt_.particle(pdgId).ref().name() << " , PDTname: "
<< pdt_.particle(pdgId).ref().PDTname() << " | "
<< pdt_.particle(pdgId).name() << " | "
<< point.time() << " "
<< pos << " "
<< mom.mag() << " | "
Expand Down Expand Up @@ -444,7 +418,7 @@ namespace mu2e {
} else {
SimParticle const& sim = simParticles->at(trackId);
pdgId = sim.pdgId();
mass = pdt_.particle(pdgId).ref().mass();
mass = pdt_.particle(pdgId).mass();
}
}

Expand Down Expand Up @@ -476,8 +450,7 @@ namespace mu2e {
<< hit.volumeId() << " | "
<< hit.trackId().asInt() << " | "
<< pdgId << " , name: "
<< pdt_.particle(pdgId).ref().name() << " , PDTname: "
<< pdt_.particle(pdgId).ref().PDTname() << " | "
<< pdt_.particle(pdgId).name() << " | "
<< hit.time() << " "
<< pos << " "
<< mom.mag() << " | "
Expand Down
43 changes: 8 additions & 35 deletions Analyses/src/Mu2eG4StudyReadBack_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "Offline/ConditionsService/inc/ConditionsHandle.hh"
#include "Offline/GeometryService/inc/GeomHandle.hh"
#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/MCDataProducts/inc/GenParticle.hh"
#include "Offline/MCDataProducts/inc/PhysicalVolumeInfoMultiCollection.hh"
#include "Offline/MCDataProducts/inc/SimParticle.hh"
Expand Down Expand Up @@ -252,8 +252,8 @@ namespace mu2e {

++_nAnalyzed;

GlobalConstantsHandle<ParticleDataTable> pdt;
ParticleDataTable const & pdt_ = *pdt;
GlobalConstantsHandle<ParticleDataList> pdt;
ParticleDataList const & pdt_ = *pdt;

// print the pdt content

Expand All @@ -266,32 +266,7 @@ namespace mu2e {
art::ServiceHandle<GeometryService> geom;
SimpleConfig const& config = geom->config();
if (config.getBool("mu2e.printParticleDataTable",false)) {

cout << __func__
<< " pdt size : "
<< pdt_.size()
<< endl;

for ( ParticleDataTable::const_iterator pdti=pdt_.begin(), e=pdt_.end();
pdti!=e; ++pdti ) {

cout << __func__
<< " pdt particle : "
<< pdti->first.pid()
<< ", name: "
<< pdt_.particle(pdti->first.pid()).ref().name()
<< ", PDTname: "
<< pdt_.particle(pdti->first.pid()).ref().PDTname()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().mass()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().totalWidth()
<< ", "
<< pdt_.particle(pdti->first.pid()).ref().lifetime()
<< endl;

}

pdt_.printTable();
}

} // end of oneTime
Expand Down Expand Up @@ -329,7 +304,7 @@ namespace mu2e {
} else {
SimParticle const& sim = simParticles->at(trackId);
pdgId = sim.pdgId();
mass = pdt_.particle(pdgId).ref().mass();
mass = pdt_.particle(pdgId).mass();
}
}

Expand Down Expand Up @@ -359,8 +334,7 @@ namespace mu2e {
<< point.volumeId() << " | "
<< point.trackId().asInt() << " | "
<< pdgId << " , name: "
<< pdt_.particle(pdgId).ref().name() << " , PDTname: "
<< pdt_.particle(pdgId).ref().PDTname() << " | "
<< pdt_.particle(pdgId).name() << " | "
<< point.time() << " "
<< pos << " "
<< mom.mag()
Expand Down Expand Up @@ -397,7 +371,7 @@ namespace mu2e {
} else {
SimParticle const& sim = simParticles->at(trackId);
pdgId = sim.pdgId();
mass = pdt_.particle(pdgId).ref().mass();
mass = pdt_.particle(pdgId).mass();
}
}

Expand Down Expand Up @@ -427,8 +401,7 @@ namespace mu2e {
<< hit.volumeId() << " | "
<< hit.trackId().asInt() << " | "
<< pdgId << " , name: "
<< pdt_.particle(pdgId).ref().name() << " , PDTname: "
<< pdt_.particle(pdgId).ref().PDTname() << " | "
<< pdt_.particle(pdgId).name() << " | "
<< hit.time() << " "
<< pos << " "
<< mom.mag()
Expand Down
1 change: 0 additions & 1 deletion Analyses/src/PbarAnalysis2_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "CLHEP/Units/SystemOfUnits.h"

#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/unknownPDGIdName.hh"
#include "Offline/ConditionsService/inc/AcceleratorParams.hh"
#include "Offline/ConditionsService/inc/ConditionsHandle.hh"
Expand Down
8 changes: 4 additions & 4 deletions Analyses/src/PionMomentumAnalyzer_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "Offline/MCDataProducts/inc/SimParticle.hh"
#include "Offline/GlobalConstantsService/inc/GlobalConstantsHandle.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataTable.hh"
#include "Offline/GlobalConstantsService/inc/ParticleDataList.hh"
#include "Offline/Mu2eUtilities/inc/SimParticleCollectionPrinter.hh"

#include "TH1.h"
Expand Down Expand Up @@ -56,7 +56,7 @@ namespace mu2e {
TH2* h_p_by_parent_;
TH2* h_p_by_process_;

const ParticleDataTable *particleTable_;
const ParticleDataList *particleTable_;

static bool is_muon_daughter(const SimParticle& p);
};
Expand All @@ -81,7 +81,7 @@ namespace mu2e {

//================================================================
void PionMomentumAnalyzer::beginJob() {
GlobalConstantsHandle<ParticleDataTable> ph;
GlobalConstantsHandle<ParticleDataList> ph;
particleTable_ = &(*ph);
}

Expand All @@ -98,7 +98,7 @@ namespace mu2e {

const SimParticle& parent{*p.parent()};

const auto pref = particleTable_->particle(parent.pdgId()).ref();
const auto pref = particleTable_->particle(parent.pdgId());
std::string parentName = pref.name();
h_p_by_parent_->Fill(parentName.c_str(), momentum, 1.0);

Expand Down
Loading

0 comments on commit 3ebb0ef

Please # to comment.