150#include <TChainElement.h>
152#include "Framework/Conventions/GBuild.h"
171using std::ostringstream;
173using namespace genie;
221int main(
int argc,
char ** argv)
243 TObjString* brOrigFilename =
new TObjString;
244 Long64_t brOrigEvtNum;
245 ntpw.
EventTree()->Branch(
"orig_filename",
"TObjString", &brOrigFilename, 5000,0);
246 ntpw.
EventTree()->Branch(
"orig_evtnum", &brOrigEvtNum,
"brOrigEvtNum/L");
247 Long64_t iev_glob = 0;
255 TObjArray * file_array = gchain.GetListOfFiles();
256 int nfiles = file_array->GetEntries();
258 <<
"Processing " << nfiles
259 << (nfiles==1 ?
" file " :
" files ");
265 TIter next_file(file_array);
266 TChainElement *chEl=0;
268 unsigned int total_events = 0;
269 unsigned int picked_events = 0;
271 while (( chEl=(TChainElement*)next_file() )) {
273 TFile fin(chEl->GetTitle(),
"read");
275 dynamic_cast <TTree *
> ( fin.Get(
"gtree") );
279 <<
"No GHEP tree found in " << chEl->GetTitle();
281 <<
"Skipping to next file...";
286 ghep_tree->SetBranchAddress(
"gmcrec", &mcrec);
288 LOG(
"gevpick",
pERROR) <<
"Null MC record";
291 Long64_t nmax = ghep_tree->GetEntries();
293 <<
"* Analyzing: " << nmax
294 <<
" events from GHEP tree in file: " << chEl->GetTitle();
299 <<
"Input tree header: " << *thdr;
305 for(Long64_t iev = 0; iev < nmax; iev++) {
307 ghep_tree->GetEntry(iev);
314 brOrigFilename->SetString(chEl->GetTitle());
327 LOG(
"gevpick",
pNOTICE) <<
"Picked " << picked_events <<
" / " << total_events <<
" events of type " <<
gPickedTypeStr;
338 int nupdg =
event.Probe()->Pdg();
368 TObjArrayIter piter(&event);
386 else if (pdgc ==
kPdgPiP ) NfPip++;
387 else if (pdgc ==
kPdgPiM ) NfPim++;
388 else if (pdgc ==
kPdgPi0 ) NfPi0++;
389 else if (pdgc ==
kPdgKP ) NfKp++;
390 else if (pdgc ==
kPdgKM ) NfKm++;
391 else if (pdgc ==
kPdgK0 ) NfK0++;
397 else if (pdgc ==
kPdgXi0 ) NfXi0++;
398 else if (pdgc ==
kPdgXiM ) NfXim++;
403 bool is1pipX = (NfPip==1 && NfPi0==0 && NfPim==0);
404 bool is1pi0X = (NfPip==0 && NfPi0==1 && NfPim==0);
405 bool is1pimX = (NfPip==0 && NfPi0==0 && NfPim==1);
406 bool has_hype = (NfSigmap+NfSigma0+NfSigmam+NfLambda0+NfXi0+NfXim+NfOmegam > 0);
409 if(isnumu && iscc && is1pipX)
return true;
413 if(isnumu && iscc && is1pi0X)
return true;
417 if(isnumu && iscc && is1pimX)
return true;
421 if(isnumu && isnc && is1pipX)
return true;
425 if(isnumu && isnc && is1pi0X)
return true;
429 if(isnumu && isnc && is1pimX)
return true;
433 if(isnumu && iscc && has_hype)
return true;
437 if(isnumubar && iscc && has_hype)
return true;
441 if(iscc && has_hype)
return true;
445 if(isstr || ischm)
return false;
446 if(iscc && isqe)
return true;
450 if(isstr || ischm)
return false;
451 if(isnumu && iscc && isqe)
return true;
455 if(isstr || ischm)
return false;
456 if(iscc && ismec)
return true;
460 if(isstr || ischm)
return false;
461 if(isnumu && iscc && ismec)
return true;
465 if(isstr || ischm)
return false;
466 if(iscc && (isqe || ismec))
return true;
470 if(isstr || ischm)
return false;
471 if(isnumu && iscc && (isqe || ismec))
return true;
475 if(isstr || ischm)
return false;
476 if(!(iscc && (isqe || ismec)))
return true;
480 if(isstr || ischm)
return false;
481 if(!(isnumu && iscc && (isqe || ismec)))
return true;
485 if(isstr || ischm)
return false;
486 if(iscc && !(isqe || ismec))
return true;
490 if(isstr || ischm)
return false;
491 if(isnumu && !(iscc && (isqe || ismec)))
return true;
511 <<
"Unspecified input filename - Exiting";
547 LOG(
"gevpick",
pFATAL) <<
"Unknown event type (" << evtype <<
")";
554 LOG(
"gevpick",
pFATAL) <<
"Unspecified event type";
564 <<
"Unspecified output filename - Using default";
570 <<
"\n\n gevpick job info: "
573 <<
"\n - cherry-picked topology : " << evtype
605 fnm <<
"gntp." << tp <<
".ghep.root";
612 string basedir = string( gSystem->Getenv(
"GENIE") );
613 string thisfile = basedir + string(
"/src/Apps/gEvPick.cxx");
614 string cmd =
"less " + thisfile;
616 gSystem->Exec(cmd.c_str());
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
Command line argument parser.
string ArgAsString(char opt)
bool OptionExists(char opt)
was option set?
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
STDHEP-like event record entry that can fit a particle or a nucleus.
int FirstMother(void) const
GHepStatus_t Status(void) const
virtual GHepParticle * Particle(int position) const
static void SetPrintLevel(int print_level)
Summary information for an interaction.
const XclsTag & ExclTag(void) const
const ProcessInfo & ProcInfo(void) const
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object....
void Clear(Option_t *opt="")
NtpMCRecHeader hdr
record header
A utility class to facilitate creating the GENIE MC Ntuple from the output GENIE GHEP event records.
void CustomizeFilename(string filename)
void Initialize(void)
add event
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
bool IsWeakNC(void) const
bool IsWeakCC(void) const
bool IsQuasiElastic(void) const
void ReadFromCommandLine(int argc, char **argv)
static RunOpt * Instance(void)
bool IsStrangeEvent(void) const
bool IsCharmEvent(void) const
string gPickedTypeStr
output file name
string gOptInpFileNames
input file name
string DefaultOutputFile(void)
bool AcceptEvent(const EventRecord &event)
void GetCommandLineArgs(int argc, char **argv)
void RunCherryPicker(void)
enum EGPickType GPickType_t
@ kPtTopoNumubarCChyperon
@ kPtReacModeNotNumuCCQEMEC
@ kPtReacModeNumuNotCCQEMEC
GPickType_t gPickedType
output file format id
bool IsPseudoParticle(int pdgc)
void MesgThresholds(string inpfile)
THE MAIN GENIE PROJECT NAMESPACE
const int kPdgAntiNeutron