16 #include "art_root_io/TFileService.h" 21 #include "nug4/ParticleNavigation/ParticleList.h" 29 #include "TLorentzVector.h" 113 fPDGCodes = tfs->make<TH1D>(
"pdgcodes",
";PDG Code;", 5000, -2500, 2500);
114 fPi0Momentum = tfs->make<TH1D>(
"pi0mom",
";#pi^{0} Momentum (GeV);", 1000, 0., 1000.);
116 fTree = tfs->make<TTree>(
"MCTTree",
"MCTTree");
117 fnEnergy = tfs->make<TH1D>(
"nEnergy",
";n,#Lambda^{0},K^{0} Momentum (GeV);", 100, 0., 10.);
118 fnDist = tfs->make<TH1D>(
"nDistance",
";n,#Lambda^{0},K^{0} Distance (m);", 200, -30000.0, +30000.);
124 "Active channels;Active channels;# events",
126 fnumIDEs = tfs->make<TProfile>(
"fnumIDEs",
127 "Drift Electrons per channel;Channel;Drift electrons",
131 "Charge in event;Total charge per event;# events",
134 "Energy in event;Total energy per event;# events",
137 "Charge on channel;Channel;Total charge per channel",
141 "Energy on channel;Channel;Total energy per channel",
163 fTree->Branch(
"MCNumDs", &
fTNds,
"MCNumDs/I");
165 fTree->Branch(
"MCDID",
fTDID,
"MCDID[MCNumDs]/I");
166 fTree->Branch(
"MCDPdg",
fTDPdg,
"MCDPdg[MCNumDs]/I");
167 fTree->Branch(
"MCDWt",
fTDWt,
"MCDWt[MCNumDs]/I");
174 fTree->Branch(
"MCOrigin", fT4Origin,
"MCOrigin[4]/F");
188 const sim::ParticleList& plist = pi_serv->
ParticleList();
193 std::vector<const sim::SimChannel*> sccol;
196 double totalCharge=0.0;
197 double totalEnergy=0.0;
199 for(
size_t sc = 0; sc < sccol.size(); ++sc){
203 const auto & tdcidemap = sccol[sc]->TDCIDEMap();
204 for(
auto mapitr = tdcidemap.begin(); mapitr != tdcidemap.end(); mapitr++){
205 const std::vector<sim::IDE> idevec = (*mapitr).second;
206 numIDEs += idevec.size();
207 for(
size_t iv = 0; iv < idevec.size(); ++iv){
208 if(plist.find( idevec[iv].trackID ) == plist.end()
210 mf::LogWarning(
"LArG4Ana") << idevec[iv].trackID <<
" is not in particle list";
211 totalCharge +=idevec[iv].numElectrons;
212 scCharge += idevec[iv].numElectrons;
213 totalEnergy +=idevec[iv].energy;
214 scEnergy += idevec[iv].energy;
225 const sim::ParticleList& Particles = pi_serv->
ParticleList();
226 std::vector<const simb::MCParticle*> pvec;
227 pvec.reserve(Particles.size());
228 for (
const auto& PartPair: Particles) {
229 pvec.push_back(PartPair.second);
230 fPDGCodes->Fill(PartPair.second->PdgCode());
236 for(
unsigned int i = 0; i < pvec.size(); ++i){
237 if(pvec[i]->
PdgCode() == 111) pi0loc = i;
238 if(pvec[i]->Mother() == pi0loc+1 &&
240 pvec[i]->PdgCode() == 22){
241 mf::LogInfo(
"LArG4Ana") << pvec[i]->E() <<
" gamma energy ";
246 if (pvec[i]->
PdgCode() == 2112 ||
251 fnEnergy->Fill(pvec[i]->
E(),pvec[i]->Weight());
252 fnDist->Fill(pvec[i]->Vx(),pvec[i]->Weight());
255 fTPdg = pvec[i]->PdgCode();
256 fTID = pvec[i]->TrackId();
258 for (
unsigned int s = 0;
s < 35; ++
s){
269 for(
unsigned int s = 0;
s < pvec[i]->Process().length(); ++
s) *(
fTProcess+
s) = pvec[i]->Process()[
s];
271 TVector3 dum = pvec[i]->Position().Vect();
273 for (
unsigned int s = 0;
s < geom->
MaterialName(pvec[i]->Position().Vect()).length(); ++
s)
276 for (
unsigned int s = 0;
s < geom->
VolumeName(pvec[i]->Position().Vect()).length(); ++
s)
279 for (
unsigned int s = 0;
s < geom->
VolumeName(pvec[i]->EndPosition().Vect()).length(); ++
s)
290 daughter = pvec[i]->Daughter(
d);
295 for(
unsigned int jj = i; jj < pvec.size(); ++jj){
297 if (
fTDID[
d] == pvec[jj]->TrackId()){
298 fTDPdg[
d] = pvec[jj]->PdgCode();
299 fTDWt[
d] = pvec[jj]->Weight();
301 for (
unsigned int s = 0;
s < pvec[jj]->Process().length(); ++
s)
304 for (
unsigned int kk = 0; kk < 4; ++kk){
313 for (
unsigned int ii = 0; ii < 4; ++ii){
325 if(numpi0gamma == 2 && pi0loc > 0){
TProfile * fChannelCharge
Charge per channel.
void analyze(const art::Event &evt)
std::string fG4ModuleLabel
module label for the Geant
TH1D * fnumChannels
The number of channels recieving charge per event.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
EDAnalyzer(fhicl::ParameterSet const &pset)
TH1D * fEventEnergy
Energy collected per event.
art framework interface to geometry description
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
TProfile * fChannelEnergy
Energy per channel.
Char_t fTDProcess[200][35]
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
#define DEFINE_ART_MODULE(klass)
static const int NoParticleId
T get(std::string const &key) const
SubRunNumber_t subRun() const
TH1D * fEventCharge
Charge collected per event.
LArG4Ana(fhicl::ParameterSet const &pset)
Standard constructor and destructor for an FMWK module.
const sim::ParticleList & ParticleList() const
std::string fTruthModuleLabel
module label for the Geant
EventNumber_t event() const
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
std::string MaterialName(TVector3 const &point) const
Name of the deepest material containing the point xyz.
Tools and modules for checking out the basics of the Monte Carlo.
LArSoft geometry interface.
std::string VolumeName(geo::Point_t const &point) const
Returns the name of the deepest volume containing specified point.
TProfile * fnumIDEs
Number of drift electrons per channel.