49int main(
int argc,
char ** argv)
59 tree =
dynamic_cast <TTree *
> ( file.Get(
"gtree") );
65 std::string filename = std::string(file.GetName());
66 std::string histofilename = filename.substr(0,filename.size()-5) +
68 TFile *histofile =
new TFile(histofilename.c_str(),
"RECREATE");
71 TH1D* dnPdgHisto =
new TH1D(
"DecayedNucleonPdg",
"DecayedNucleonPdg", 5000, -2500, 2500);
73 TH1D* dnPHisto =
new TH1D(
"DecayedNucleonMomentum",
"DecayedNucleonMomentum [GeV/c]", 100, 0., 0.5);
75 TH1D* dnRemovalEnergyHisto =
new TH1D(
"DecayedNucleonRemovalEnergy",
"DecayedNucleonRemovalEnergy [GeV]", 100, 0., 0.05);
78 TH1D* dndaughtersNHisto =
new TH1D(
"DecayedNucleonNDaughters",
"DecayedNucleonNDaughters", 6, 0, 6);
80 TH1D* dndaughter0PdgHisto =
new TH1D(
"DecayedNucleonDaughter0Pdg",
"DecayedNucleonDaughter0Pdg", 1000, -500, 500);
81 TH1D* dndaughter1PdgHisto =
new TH1D(
"DecayedNucleonDaughter1Pdg",
"DecayedNucleonDaughter1Pdg", 1000, -500, 500);
82 TH1D* dndaughter2PdgHisto =
new TH1D(
"DecayedNucleonDaughter2Pdg",
"DecayedNucleonDaughter2Pdg", 1000, -500, 500);
84 TH1D* dndaughter0PHisto =
new TH1D(
"DecayedNucleonDaughter0Momentum",
"DecayedNucleonDaughter0Momentum [GeV/c]", 100, 0., 1.);
85 TH1D* dndaughter1PHisto =
new TH1D(
"DecayedNucleonDaughter1Momentum",
"DecayedNucleonDaughter1Momentum [GeV/c]", 100, 0., 1.);
86 TH1D* dndaughter2PHisto =
new TH1D(
"DecayedNucleonDaughter2Momentum",
"DecayedNucleonDaughter2Momentum [GeV/c]", 100, 0., 1.);
89 TH1D* finalparticlesNHisto =
new TH1D(
"NFinalParticles",
"NFinalParticles", 20, 0, 20);
90 TH1D* finalparticlesPdgHisto =
new TH1D(
"FinalParticlesPdg",
"FinalParticlesPdg", 5000, -2500, 2500);
91 TH1D* finalparticlesPHisto =
new TH1D(
"FinalParticlesMomentum",
"FinalParticlesMomentum [GeV/c]", 100, 0., 1.);
96 tree->SetBranchAddress(
"gmcrec", &mcrec);
99 TMath::Min(
gOptNEvt, (
int)tree->GetEntries()) :
100 (int) tree->GetEntries();
107 TText decayName = TText();
108 decayName.SetName(
"DecayName");
109 TText targetName = TText();
110 targetName.SetName(
"TargetName");
118 for(
int i = 0; i < nev; i++) {
132 int npdg =
event.Summary()->InitStatePtr()->TgtPtr()->HitNucPdg();
134 decayName.SetTitle(decayNameString.c_str());
135 string targetNameString =
event.Summary()->InitStatePtr()->TgtPtr()->AsString();
136 targetName.SetTitle(targetNameString.c_str());
140 TIter event_iter(&event);
145 if (dnpart->
Status() != 3) {
146 LOG(
"testNucleonDecay",
pFATAL) <<
"Unexpected status code for candidate decayed nucleon: " << dnpart->
Status() <<
", exiting.";
151 LOG(
"testNucleonDecay",
pFATAL) <<
"Unexpected first mother index for candidate decayed nucleon: " << dnpart->
FirstMother() <<
", exiting.";
155 dnPdgHisto->Fill(dnpart->
Pdg());
156 dnPHisto->Fill(dnpart->
P4()->Vect().Mag());
162 while((p=
dynamic_cast<GHepParticle *
>(event_iter.Next())))
165 if (ndaughters == 0) {
166 dndaughter0PdgHisto->Fill(p->
Pdg());
167 dndaughter0PHisto->Fill(p->
P4()->Vect().Mag());
168 }
else if (ndaughters == 1) {
169 dndaughter1PdgHisto->Fill(p->
Pdg());
170 dndaughter1PHisto->Fill(p->
P4()->Vect().Mag());
171 }
else if (ndaughters == 2) {
172 dndaughter2PdgHisto->Fill(p->
Pdg());
173 dndaughter2PHisto->Fill(p->
P4()->Vect().Mag());
178 dndaughtersNHisto->Fill(ndaughters);
184 while((p=
dynamic_cast<GHepParticle *
>(event_iter.Next())))
187 finalparticlesPdgHisto->Fill(p->
Pdg());
188 finalparticlesPHisto->Fill(p->
P4()->Vect().Mag());
192 finalparticlesNHisto->Fill(nfinalparticles);
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
STDHEP-like event record entry that can fit a particle or a nucleus.
int FirstMother(void) const
const TLorentzVector * P4(void) const
double RemovalEnergy(void) const
Get removal energy.
GHepStatus_t Status(void) const