150 #include <TChainElement.h> 152 #include "Framework/Conventions/GBuild.h" 171 using std::ostringstream;
173 using namespace genie;
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());
GPickType_t gPickedType
output file format id
static void SetPrintLevel(int print_level)
string gPickedTypeStr
output file name
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)
bool IsQuasiElastic(void) const
bool IsStrangeEvent(void) const
GHepStatus_t Status(void) const
bool IsCharmEvent(void) const
int FirstMother(void) const
Summary information for an interaction.
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
enum EGPickType GPickType_t
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)
const XclsTag & ExclTag(void) const
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?
Event finding and building.