FairRoot/PandaRoot
|
Primary generator with added event filtering capabilities. More...
#include <FairFilteredPrimaryGenerator.h>
Public Member Functions | |
FairFilteredPrimaryGenerator () | |
Default constructor. More... | |
FairFilteredPrimaryGenerator (const char *name, const char *title="Filtered Generator") | |
Constructor with name and title. More... | |
virtual | ~FairFilteredPrimaryGenerator () |
Destructor. More... | |
virtual Bool_t | Init () |
Initialize the event generator(s) and the event (veto) filter(s). More... | |
void | AndFilter (FairEvtFilter *filter) |
Register a non-veto event filter using a logical AND to connect with previously defined non-veto event filters. More... | |
void | AndNotFilter (FairEvtFilter *filter) |
Register a non-veto event filter using a logical AND NOT to connect with previously defined non-veto event filters. More... | |
void | OrFilter (FairEvtFilter *filter) |
Register a non-veto event filter using a logical OR to connect with previously defined non-veto event filters. More... | |
void | OrNotFilter (FairEvtFilter *filter) |
Register a non-veto event filter using a logical OR NOT to connect with previously defined non-veto event filters. More... | |
void | AddVetoFilter (FairEvtFilter *filter) |
Register an event veto filter. Veto filters have higher priority than regular event filters. If the event matches any veto filter, it will be skipped. More... | |
virtual Bool_t | GenerateEvent (FairGenericStack *pStack) |
Calls event generators and the event filters. More... | |
TObjArray * | GetListOfFilters () |
TObjArray * | GetListOfVetoFilters () |
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 filters. More... | |
Int_t | GetNumberOfFilterMaxTries () |
returns the maximum number of times that this object should try to find an event which suits all event filters. More... | |
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. More... | |
void | SetEventPrintFrequency (int freq) |
Sets the frequency (accepted events) for printout (verbose>0) of accepted and generated events. More... | |
Int_t | GetNumberOfFilterFailedEvents () |
Returns the number of cases in which no matching event was found within the set max. tries. More... | |
void | WriteEvtFilterStatsToRootFile (TFile *outputFile=NULL) |
Writes all relevant event filter information to the output root file. More... | |
void | SetVerbose (Int_t verbose=12) |
Set the level of commenting output. More... | |
Protected Member Functions | |
void | AddFilter (FairEvtFilter *filter, FairEvtFilter::LogicOp op, Bool_t negateFilter) |
Registers a regular (non-veto) filter. This method is not supposed to be directly used by the user. See public methods for user interfaces to this method. More... | |
Protected Attributes | |
TObjArray * | fVetoFilterList |
List of registered veto filters. More... | |
TIterator * | fVetoFilterIter |
Iterator over veto filter list. More... | |
TObjArray * | fFilterList |
List of registered filters. More... | |
TIterator * | fFilterIter |
Iterator over filter list. More... | |
FairEvtFilterParams | fEvtFilterStat |
Contains the statistics of the event filtering process. More... | |
Int_t | fVerbose |
Level of commenting output, 0 means no output, higher gives more output. More... | |
Bool_t | fEventVetoFilterActive |
returns kTRUE if any event veto filter is registered. More... | |
Bool_t | fEventFilterActive |
returns kTRUE if any non-veto event filter is registerd. More... | |
std::vector< Bool_t > | filterAcceptEvent |
Vector containing the results of the EventMatches methods for every registered non-veto event filter in the corresponding order. More... | |
std::vector< UInt_t > | fLogicalFilterOperation |
vector containing the logical operations with which the outputs of the non-veto event filters should be combined. More... | |
std::vector< Bool_t > | fFilterNegation |
vector determining whether the output of a non-veto event filter should be negated or not. More... | |
Int_t | fEventNrFiltered |
Event number (Set by the filtered primary generator. More... | |
Int_t | fEventPrintFreq |
Print frequency for filtered events. More... | |
Private Member Functions | |
FairFilteredPrimaryGenerator (const FairFilteredPrimaryGenerator &) | |
FairFilteredPrimaryGenerator & | operator= (const FairFilteredPrimaryGenerator &) |
ClassDef (FairFilteredPrimaryGenerator, 2) | |
Primary generator with added event filtering capabilities.
This class adds event filtering capabilities to FairPrimaryGenerator which is used internally for handling the event generators and so on. The event filtering is performed after the event generation and before the particle transport through the detector model.
From the description of FairPrimaryGenerator:
The FairFilteredPrimaryGenerator is responsible for the handling of the MC input. Several input generators can be registered to it; these have to be derived from the FairGenerator class. The FairFilteredPrimaryGenerator defines position and (optionally) smearing of the primary vertex. This class should be instantiated only once.
Definition at line 52 of file FairFilteredPrimaryGenerator.h.
FairFilteredPrimaryGenerator::FairFilteredPrimaryGenerator | ( | ) |
Default constructor.
Definition at line 28 of file FairFilteredPrimaryGenerator.cxx.
FairFilteredPrimaryGenerator::FairFilteredPrimaryGenerator | ( | const char * | name, |
const char * | title = "Filtered Generator" |
||
) |
Constructor with name and title.
Definition at line 49 of file FairFilteredPrimaryGenerator.cxx.
|
virtual |
Destructor.
Definition at line 85 of file FairFilteredPrimaryGenerator.cxx.
References fFilterIter, fFilterList, fVetoFilterIter, and fVetoFilterList.
|
private |
|
inlineprotected |
Registers a regular (non-veto) filter. This method is not supposed to be directly used by the user. See public methods for user interfaces to this method.
Definition at line 233 of file FairFilteredPrimaryGenerator.h.
References fEventFilterActive, fFilterList, fFilterNegation, and fLogicalFilterOperation.
Referenced by AndFilter(), AndNotFilter(), OrFilter(), and OrNotFilter().
|
inline |
Register an event veto filter. Veto filters have higher priority than regular event filters. If the event matches any veto filter, it will be skipped.
Definition at line 92 of file FairFilteredPrimaryGenerator.h.
References fEventVetoFilterActive, and fVetoFilterList.
Referenced by sim_filter_ex1().
|
inline |
Register a non-veto event filter using a logical AND to connect with previously defined non-veto event filters.
Definition at line 72 of file FairFilteredPrimaryGenerator.h.
References AddFilter(), and FairEvtFilter::kAnd.
Referenced by prod_fsim(), quickfsimana(), sim_filter_ex1(), sim_filter_ex2(), and sim_filter_inv_mass().
|
inline |
Register a non-veto event filter using a logical AND NOT to connect with previously defined non-veto event filters.
Definition at line 77 of file FairFilteredPrimaryGenerator.h.
References AddFilter(), and FairEvtFilter::kAnd.
Referenced by sim_filter_ex1().
|
private |
|
virtual |
Calls event generators and the event filters.
To be called at the beginning of each event from FairMCApplication. Generates an event vertex and calls the ReadEvent methods from the registered generators. Calls defined event (veto) filters to decide whether to process the event or to call the event generators again.
pStack | The particle stack |
Definition at line 102 of file FairFilteredPrimaryGenerator.cxx.
References Bool_t, FairEvtFilter::EventMatches(), fEventFilterActive, fEventNrFiltered, fEventPrintFreq, fEventVetoFilterActive, fEvtFilterStat, FairEvtFilterParams::fFailedFilterEvents, fFilterIter, fFilterList, FairEvtFilterParams::fFilterMaxTries, fFilterNegation, FairEvtFilterParams::fGeneratedEvents, filterAcceptEvent, FairEvtFilter::FilterActive(), fLogicalFilterOperation, fVerbose, fVetoFilterIter, RhoFactory::Instance(), FairEvtFilter::kAnd, FairEvtFilter::kOr, RhoFactory::Reset(), and FairEvtFilter::SetListOfParticles().
|
inline |
Definition at line 115 of file FairFilteredPrimaryGenerator.h.
References fFilterList.
|
inline |
Definition at line 117 of file FairFilteredPrimaryGenerator.h.
References fVetoFilterList.
|
inline |
Returns the number of cases in which no matching event was found within the set max. tries.
This method returns 0 if everything works fine. If it returns a value >0 it means that you should set a higher limit in SetFilterMaxTries. If it returns a value which is equal to the number of events that you requested, it means that either the max. number of tries is set way too low or that the generator does not create such events that you are interested in or that your event filters cannot be satisfied at all (logical error).
Definition at line 154 of file FairFilteredPrimaryGenerator.h.
References fEvtFilterStat, and FairEvtFilterParams::fFailedFilterEvents.
Referenced by WriteEvtFilterStatsToRootFile().
|
inline |
returns the maximum number of times that this object should try to find an event which suits all event filters.
Definition at line 131 of file FairFilteredPrimaryGenerator.h.
References fEvtFilterStat, and FairEvtFilterParams::fFilterMaxTries.
|
inline |
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.
Definition at line 136 of file FairFilteredPrimaryGenerator.h.
References fEvtFilterStat, and FairEvtFilterParams::fGeneratedEvents.
Referenced by prod_fsim(), and WriteEvtFilterStatsToRootFile().
|
virtual |
Initialize the event generator(s) and the event (veto) filter(s).
Definition at line 67 of file FairFilteredPrimaryGenerator.cxx.
References fFilterList, fVetoFilterList, FairEvtFilter::Init(), and Init().
|
private |
|
inline |
Register a non-veto event filter using a logical OR to connect with previously defined non-veto event filters.
Definition at line 82 of file FairFilteredPrimaryGenerator.h.
References AddFilter(), and FairEvtFilter::kOr.
|
inline |
Register a non-veto event filter using a logical OR NOT to connect with previously defined non-veto event filters.
Definition at line 87 of file FairFilteredPrimaryGenerator.h.
References AddFilter(), and FairEvtFilter::kOr.
|
inline |
Sets the frequency (accepted events) for printout (verbose>0) of accepted and generated events.
Definition at line 141 of file FairFilteredPrimaryGenerator.h.
References fEventPrintFreq.
|
inline |
Define the maximum number of times that this object should try to find an event which suits all event filters.
Definition at line 120 of file FairFilteredPrimaryGenerator.h.
References fEvtFilterStat, and FairEvtFilterParams::fFilterMaxTries.
Referenced by prod_fsim(), quickfsimana(), sim_filter_ex1(), and sim_filter_ex2().
|
inline |
Set the level of commenting output.
verbose | Level of commenting output, 0 means no output, higher gives more output. |
Definition at line 177 of file FairFilteredPrimaryGenerator.h.
References fVerbose, and verbose.
Referenced by prod_fsim(), quickfsimana(), sim_complete(), sim_complete_newSTT(), sim_day1(), sim_filter_ex1(), sim_filter_ex2(), sim_radlength_complete(), and tut_sim().
|
inline |
Writes all relevant event filter information to the output root file.
Definition at line 159 of file FairFilteredPrimaryGenerator.h.
References fEvtFilterStat, GetNumberOfFilterFailedEvents(), and GetNumberOfGeneratedEvents().
Referenced by prod_fsim(), quickfsimana(), sim_filter_ex1(), sim_filter_ex2(), and sim_filter_inv_mass().
|
protected |
returns kTRUE if any non-veto event filter is registerd.
Definition at line 205 of file FairFilteredPrimaryGenerator.h.
Referenced by AddFilter(), and GenerateEvent().
|
protected |
Event number (Set by the filtered primary generator.
Definition at line 226 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent().
|
protected |
Print frequency for filtered events.
Definition at line 229 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent(), and SetEventPrintFrequency().
|
protected |
returns kTRUE if any event veto filter is registered.
Definition at line 203 of file FairFilteredPrimaryGenerator.h.
Referenced by AddVetoFilter(), and GenerateEvent().
|
protected |
Contains the statistics of the event filtering process.
Definition at line 199 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent(), GetNumberOfFilterFailedEvents(), GetNumberOfFilterMaxTries(), GetNumberOfGeneratedEvents(), SetFilterMaxTries(), and WriteEvtFilterStatsToRootFile().
|
protected |
Iterator over filter list.
Definition at line 196 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent(), and ~FairFilteredPrimaryGenerator().
|
protected |
List of registered filters.
Definition at line 194 of file FairFilteredPrimaryGenerator.h.
Referenced by AddFilter(), GenerateEvent(), GetListOfFilters(), Init(), and ~FairFilteredPrimaryGenerator().
|
protected |
vector determining whether the output of a non-veto event filter should be negated or not.
The vector grows automatically with every added non-veto event filter. A kTRUE entry at position i in the vector negates the i. filter's output, kFALSE entries do not negate.
Definition at line 222 of file FairFilteredPrimaryGenerator.h.
Referenced by AddFilter(), and GenerateEvent().
|
protected |
Vector containing the results of the EventMatches methods for every registered non-veto event filter in the corresponding order.
The content of the vector is overwritten for each generated event.
Definition at line 209 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent().
|
protected |
vector containing the logical operations with which the outputs of the non-veto event filters should be combined.
The vector grows automatically with every added non-veto event filter. It is used to combine multiple filters via && or ||. The expression is evaluated sequentally from the first registered filter to the last one disregarding operator priorities.
Definition at line 216 of file FairFilteredPrimaryGenerator.h.
Referenced by AddFilter(), and GenerateEvent().
|
protected |
Level of commenting output, 0 means no output, higher gives more output.
Definition at line 201 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent(), and SetVerbose().
|
protected |
Iterator over veto filter list.
Definition at line 192 of file FairFilteredPrimaryGenerator.h.
Referenced by GenerateEvent(), and ~FairFilteredPrimaryGenerator().
|
protected |
List of registered veto filters.
Definition at line 190 of file FairFilteredPrimaryGenerator.h.
Referenced by AddVetoFilter(), GetListOfVetoFilters(), Init(), and ~FairFilteredPrimaryGenerator().