43 #ifndef PndFilteredPrimaryGenerator_H
44 #define PndFilteredPrimaryGenerator_H
46 #include "FairPrimaryGenerator.h"
48 #include "FairRunSim.h"
54 #include "TLorentzVector.h"
61 #include <unordered_set>
65 class FairGenericStack;
117 std::cout <<
"\n\n\n -WARNING from PndFilteredPrimaryGenerator: maxTries must be a positive number! Check your SetFilterMaxTries call!\n\n\n";
154 std::cout <<
"Random events were accepted to avoid infinite loops. \n";
155 std::cout <<
"Try increasing the max. number of tries or change your filter (maybe the generators do not produce such events as you want).\n\n";
157 if(outputFile==NULL) outputFile = FairRunSim::Instance()->GetOutputFile();
159 outputFile->mkdir(
"FairEvtFilter");
160 outputFile->cd(
"FairEvtFilter");
173 std::cout <<
"PndFilteredPrimaryGenerator: fVerbose is now set to " <<
verbose <<
"\n";
177 std::cout <<
"\n\n\n -WARNING from PndFilteredPrimaryGenerator: verbose must be a positive number! Check your SetVerbose call!\n\n\n";
std::vector< PndSmpCand > PndSmpCandList
void WriteEvtFilterStatsToRootFile(TFile *outputFile=NULL)
Writes all relevant event filter information to the output root file.
StrVec SplitString(TString s, TString delim=" ")
Splits a TString to substrings.
std::unordered_set< int > fSetFsPdg
set to identify particles from MC truth list which can be combined
Int_t GetNumberOfFilterMaxTries()
returns the maximum number of times that this object should try to find an event which suits all even...
Simple container for filter definition (criteria) for PndFilteredPrimaryGenerator.
PndFilteredPrimaryGenerator()
Default constructor.
void SetEventPrintFrequency(int freq)
Sets the frequency (accepted events) for printout (verbose>0) of accepted and generated events...
std::map< TString, int > fNameCodeMap
mapes names to (pdg) codes
bool CheckKinematic(const PndSmpFilt &f, const TLorentzVector &p4)
Checks whether P4 kinematics match the criteria of a PndSmpFilt.
Int_t fEventNrFiltered
Event number (Set by the filtered primary generator.
virtual Bool_t Init()
Initialize the event generator(s) and the event (veto) filter(s).
std::map< int, TString > fCodeNameMap
mapes (pdg) codes to names
TDatabasePDG * fdbPdg
Shortcut to TDatabasePDG.
ClassDef(PndFilteredPrimaryGenerator, 1)
std::vector< TString > fPartNames
particle names for particles to count (with and w/o charged specification, also simply tracks and neu...
Primary generator with added event filtering capabilities.
Int_t GetNumberOfGeneratedEvents()
returns the total (accepted + rejected) number of events generated by the event generators. If no event filters are used this number is equal to the number of simulated events.
PndFilteredPrimaryGenerator & operator=(const PndFilteredPrimaryGenerator &)
vector< PndSmpFilt > PndSmpFilterSet
virtual ~PndFilteredPrimaryGenerator()
Destructor.
Int_t GetNumberOfFilterFailedEvents()
Returns the number of cases in which no matching event was found within the set max. tries.
Int_t fFailedFilterEvents
FairEvtFilterParams fEvtFilterStat
Contains the statistics of the event filtering process.
virtual Bool_t GenerateEvent(FairGenericStack *pStack)
Calls event generators and the event filters.
void AddFilter(TString filterStr)
Registers a filter as a string to be parsed Each filter set consist of one filter definition or a num...
std::vector< PndSmpFilterSet > fFilterSets
Contains the filter-sets. Each filter set consist of one filter definition or a number of filters con...
Int_t fEventPrintFreq
Print frequency for filtered events.
void PrintSmpCandList(PndSmpCandList l, TString name="")
Prints a candidate lits.
void SetVerbose(Int_t verbose=12)
Set the level of commenting output.
void GetRangeInt(TString s, int &a, int &b, TString delim="..")
Turns a string of the form <int><delim><int> (e.g. "3..8") to a range a,b.
PndSmpCandList CombineList(int pdg, PndSmpCandList *l0, PndSmpCandList *l1, PndSmpCandList *l2=0, PndSmpCandList *l3=0, PndSmpCandList *l4=0)
Combines upt to five particle lists of PndSmpCand with overlap and double counting prevention...
Int_t fVerbose
Level of commenting output, 0 means no output, higher gives more output.
std::vector< int > fNamePdg
particle codes for particles to count (with and w/o charged specification, also simply tracks and neu...
void SetFilterMaxTries(Int_t maxTries=99999)
Define the maximum number of times that this object should try to find an event which suits all event...
int AntiPdgCode(int pdg)
Gets anti-pdg code, if exists. If not returns the code itself (particle is its anti-particle) ...
std::vector< int > fCombFsPdg
particle codes for the lists used for combinatorics; !!! the codes are not selected from MC truth...
void GetRangeDouble(TString s, double &a, double &b, TString delim=",", bool forceset=false)
Turns a string of the form <float><delim><float> (e.g. "124.2,178.3") to a range a,b.