113 #include <TChainElement.h> 134 using std::ostringstream;
136 using namespace genie;
189 TObjString* brOrigFilename =
new TObjString;
190 Long64_t brOrigEvtNum;
191 ntpw.
EventTree()->Branch(
"orig_filename",
"TObjString", &brOrigFilename, 5000,0);
192 ntpw.
EventTree()->Branch(
"orig_evtnum", &brOrigEvtNum,
"brOrigEvtNum/L");
193 Long64_t iev_glob = 0;
201 TObjArray * file_array = gchain.GetListOfFiles();
202 int nfiles = file_array->GetEntries();
204 <<
"Processing " << nfiles
205 << (nfiles==1 ?
" file " :
" files ");
211 TIter next_file(file_array);
212 TChainElement *chEl=0;
214 while (( chEl=(TChainElement*)next_file() )) {
216 TFile
fin(chEl->GetTitle(),
"read");
218 dynamic_cast <TTree *> (
fin.Get(
"gtree") );
222 <<
"No GHEP tree found in " << chEl->GetTitle();
224 <<
"Skipping to next file...";
229 ghep_tree->SetBranchAddress(
"gmcrec", &mcrec);
231 LOG(
"gevpick",
pERROR) <<
"Null MC record";
234 Long64_t nmax = ghep_tree->GetEntries();
236 <<
"* Analyzing: " << nmax
237 <<
" events from GHEP tree in file: " << chEl->GetTitle();
242 <<
"Input tree header: " << *thdr;
248 for(Long64_t
iev = 0;
iev < nmax;
iev++) {
249 ghep_tree->GetEntry(
iev);
255 brOrigFilename->SetString(chEl->GetTitle());
279 int nupdg =
event.Probe()->Pdg();
305 TObjArrayIter piter(&event);
323 else if (pdgc ==
kPdgPiP ) NfPip++;
324 else if (pdgc ==
kPdgPiM ) NfPim++;
325 else if (pdgc ==
kPdgPi0 ) NfPi0++;
326 else if (pdgc ==
kPdgKP ) NfKp++;
327 else if (pdgc ==
kPdgKM ) NfKm++;
328 else if (pdgc ==
kPdgK0 ) NfK0++;
334 else if (pdgc ==
kPdgXi0 ) NfXi0++;
335 else if (pdgc ==
kPdgXiM ) NfXim++;
340 bool is1pipX = (NfPip==1 && NfPi0==0 && NfPim==0);
341 bool is1pi0X = (NfPip==0 && NfPi0==1 && NfPim==0);
342 bool is1pimX = (NfPip==0 && NfPi0==0 && NfPim==1);
343 bool has_hype = (NfSigmap+NfSigma0+NfSigmam+NfLambda0+NfXi0+NfXim+NfOmegam > 0);
346 if(isnumu && iscc && is1pipX)
return true;
350 if(isnumu && iscc && is1pi0X)
return true;
354 if(isnumu && iscc && is1pimX)
return true;
358 if(isnumu && isnc && is1pipX)
return true;
362 if(isnumu && isnc && is1pi0X)
return true;
366 if(isnumu && isnc && is1pimX)
return true;
370 if(isnumu && iscc && has_hype)
return true;
374 if(isnumubar && iscc && has_hype)
return true;
378 if(iscc && has_hype)
return true;
398 <<
"Unspecified input filename - Exiting";
421 LOG(
"gevpick",
pFATAL) <<
"Unknown topology (" << topo <<
")";
427 LOG(
"gevpick",
pFATAL) <<
"Unspecified event topology";
437 <<
"Unspecified output filename - Using default";
443 <<
"\n\n gevpick job info: " 446 <<
"\n - cherry-picked topology : " << topo
466 fnm <<
"gntp." << tp <<
".ghep.root";
473 string basedir =
string( gSystem->Getenv(
"GENIE") );
474 string thisfile = basedir +
string(
"/src/Apps/gEvPick.cxx");
475 string cmd =
"less " + thisfile;
477 gSystem->Exec(cmd.c_str());
static void SetPrintLevel(int print_level)
virtual GHepParticle * Particle(int position) const
void GetCommandLineArgs(int argc, char **argv)
bool IsWeakCC(void) const
NtpMCRecHeader hdr
record header
string ArgAsString(char opt)
THE MAIN GENIE PROJECT NAMESPACE
void CustomizeFilename(string filename)
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object. Ntuples of this type are intended for feeding GENIE events into other applications (for example the GEANT4 based MC generation framework of an experiment) if no direct interface exists.
void ReadFromCommandLine(int argc, char **argv)
enum EGPickTopo GPickTopo_t
GHepStatus_t Status(void) const
int FirstMother(void) const
Summary information for an interaction.
GPickTopo_t gPickedTopology
output file format id
bool IsWeakNC(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
string gOptOutFileName
output file name
void Save(void)
get the even tree
int main(int argc, char **argv)
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
bool AcceptEvent(const EventRecord &event)
void Initialize(void)
add event
static RunOpt * Instance(void)
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records...
void RunCherryPicker(void)
const int kPdgAntiNeutron
bool IsPseudoParticle(int pdgc)
string gOptInpFileNames
input file name
const ProcessInfo & ProcInfo(void) const
void MesgThresholds(string inpfile)
Command line argument parser.
void Clear(Option_t *opt="")
string DefaultOutputFile(void)
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
bool OptionExists(char opt)
was option set?