1 #ifndef WCSimWCTrigger_h
2 #define WCSimWCTrigger_h 1
8 #include "G4VDigitizerModule.hh"
12 #include "Randomize.hh"
187 std::vector<float> index_info;
192 for (j = i; j > 0 &&
TriggerTimes[j-1] > index_time; j--) {
223 inline void*
operator new(size_t);
224 inline void operator delete(
void*);
232 inline void SetPe (G4int gate, G4double Q) {
pe.insert(std::pair<int,double>(gate,Q)); }
233 inline void SetTime (G4int gate, G4double T) {
time.insert(std::pair<int,double>(gate,T)); }
237 fDigiComp.insert(std::pair<
int, std::vector<int> >(gate, digi_comp));
246 std::vector<std::vector<int> > v;
247 std::multimap<int, std::vector<int> >::iterator it =
fDigiComp.begin();
249 if((it->first) == gate)
250 v.push_back(it->second);
265 std::multimap<int,double>
pe;
266 std::multimap<int,double>
time;
272 template <
typename T> std::vector<T>
FindInMultimap(
const int compare,
typename std::multimap<int,T> &map)
274 typename std::vector<T> v;
275 typename std::multimap<int,T>::iterator it = map.begin();
276 for (; it != map.end(); ++it) {
277 if((it->first) == compare)
278 v.push_back(it->second);
287 inline void* WCSimWCDigiTrigger::operator
new(size_t)
294 inline void WCSimWCDigiTrigger::operator
delete(
void* aDigi)
379 #endif //WCSimWCTrigger_h
std::vector< std::vector< Float_t > > TriggerInfos
Additional information associated with each trigger.
~WCSimWCTriggerNoTrigger()
int GetDefaultNDigitsPostTriggerWindow()
This is not an NDigits trigger.
void SetTubeID(G4int tube)
G4int saveFailuresPreTriggerWindow
The pretrigger window to save before an SaveFailures trigger.
std::multimap< int, double > time
Digit time.
void SetSaveFailuresPreTriggerWindow(G4int window)
Set the pretrigger window for the SaveFailures trigger (value will be forced negative) ...
virtual ~WCSimWCTriggerBase()
int operator==(const WCSimWCDigiTrigger &) const
enum ETriggerType TriggerType_t
std::vector< Double_t > TriggerTimes
The times of the triggers.
A simple NDigits trigger class.
void SaveOptionsToOutput(WCSimRootOptions *wcopt)
Save current values of options.
bool GetDefaultMultiDigitsPerTrigger()
SKI saves only earliest digit on a PMT in the trigger window.
Double_t GetTriggerTime(int i)
Get the time of the ith trigger.
G4String triggerClassName
Save the name of the trigger class.
std::vector< std::vector< int > > GetDigiCompositionInfo(int gate)
void SortTriggersByTime()
sort the Trigger vectors (Time, Type, Info) by Trigger Time
std::map< int, int > DigiHitMap
Keeps track of the PMTs that have been added to the output WCSimWCTriggeredDigitsCollection.
~WCSimWCTriggerNDigits2()
void AlgNoTrigger(WCSimWCDigitsCollection *WCDCPMT, bool remove_hits, bool test=false)
void DoTheWork(WCSimWCDigitsCollection *WCDCPMT)
This should call the trigger algorithms, and handle any temporary DigitsCollection's.
void SetNDigitsWindow(G4int window)
Set the time window for the NDigits trigger.
int GetDefaultNDigitsWindow()
This is not an NDigits trigger.
void SetTime(G4int gate, G4double T)
TriggerType_t GetTriggerType(int i)
Get the trigger type of the ith trigger.
int GetDefaultNDigitsPreTriggerWindow()
This is not an NDigits trigger.
virtual int GetDefaultNDigitsThreshold()
Set the default trigger class specific NDigits threshold (in ns) (overridden by .mac) ...
std::multimap< int, double > pe
Digit charge.
void AddDigiCompositionInfo(G4int gate, std::vector< int > &digi_comp)
Add a whole vector for one digit to fDigiComp. Clear input vector once added.
std::vector< T > FindInMultimap(const int compare, typename std::multimap< int, T > &map)
void DoTheWork(WCSimWCDigitsCollection *WCDCPMT)
Calls the workhorse of this class: AlgNDigits.
int NumberOfGatesInThisEvent()
Returns the number of trigger gates in the event (i.e. the number of triggers passed) ...
std::vector< G4double > GetTime(int gate)
int GetDefaultNDigitsWindow()
SK max light travel time ~200 ns.
int GetDefaultNDigitsPostTriggerWindow()
SK SLE trigger window ~+950.
virtual void DoTheWork(WCSimWCDigitsCollection *WCDCPMT)=0
This should call the trigger algorithms, and handle any temporary DigitsCollection's.
WCSimWCTriggerNoTrigger(G4String name, WCSimDetectorConstruction *, WCSimWCDAQMessenger *, G4String detectorElement)
Create WCSimWCTriggerNoTrigger instance with knowledge of the detector and DAQ options.
int GetDefaultNDigitsPreTriggerWindow()
SK SLE trigger window ~-400.
double PMTDarkRate
Dark noise rate of the PMTs.
int GetDefaultNDigitsWindow()
SK max light travel time ~200 ns.
void SetNDigitsThreshold(G4int threshold)
Set the threshold for the NDigits trigger.
void SetMultiDigitsPerTrigger(G4bool allow_multi)
Set whether to allow the number of digits per PMT per trigger to go > 1.
bool HasHitsInGate(int gate)
int GetDefaultNDigitsPostTriggerWindow()
SK SLE trigger window ~+950.
G4TDigiCollection< WCSimWCDigi > WCSimWCDigitsCollection
double GetPreTriggerWindow(TriggerType_t t)
Get the pretrigger window for a given trigger algorithm.
G4TDigiCollection< WCSimWCDigiTrigger > WCSimWCTriggeredDigitsCollection
bool GetDefaultMultiDigitsPerTrigger()
SKI saves only earliest digit on a PMT in the trigger window.
void SetNDigitsAdjustForNoise(G4bool adjust)
Automatically adjust the NDigits threshold based on the average noise occupancy?
G4int ndigitsPostTriggerWindow
The posttrigger window to save after an NDigits trigger.
G4bool multiDigitsPerTrigger
Allow the number of digits per PMT saved in each trigger window to go > 1?
int GetDefaultNDigitsPreTriggerWindow()
SK SLE trigger window ~-400.
void ReInitialize()
Clear the Trigger* vectors and DigiHitMap.
int GetDefaultNDigitsThreshold()
2 * SK NDigits threshold ~25
void SetSaveFailuresPostTriggerWindow(G4int window)
Set the posttrigger window for the SaveFailures trigger (value will be forced positive) ...
The base class for WCSim triggering algorithms.
G4bool ndigitsAdjustForNoise
Automatically adjust the NDigits trigger threshold based on the average dark noise rate...
std::vector< TriggerType_t > TriggerTypes
The type of the triggers.
G4int saveFailuresMode
The mode for saving events which don't pass triggers.
std::vector< G4double > GetPe(int gate)
void AlgNDigits(WCSimWCDigitsCollection *WCDCPMT, bool remove_hits, bool test=false)
An NDigits trigger algorithm.
void AdjustNDigitsThresholdForNoise()
modify the NDigits threshold based on the average dark noise rate
bool GetDefaultMultiDigitsPerTrigger()
We want to save everything.
WCSimWCTriggerNDigits(G4String name, WCSimDetectorConstruction *, WCSimWCDAQMessenger *, G4String detectorElement)
Create WCSimWCTriggerNDigits instance with knowledge of the detector and DAQ options.
G4int ndigitsThreshold
The threshold for the NDigits trigger.
G4String GetTriggerClassName()
Get the trigger class name.
virtual int GetDefaultNDigitsWindow()
Set the default trigger class specific NDigits window (in ns) (overridden by .mac) ...
G4int saveFailuresPostTriggerWindow
The posttrigger window to save after an SaveFailures trigger.
G4int ndigitsPreTriggerWindow
The pretrigger window to save before an NDigits trigger.
static const double LongTime
An arbitrary long time to use in loops (ns)
G4int tubeID
PMT id of the digit.
std::vector< Float_t > GetTriggerInfo(int i)
Get the additional trigger information associated with the ith trigger.
bool digitizeCalled
Has Digitize() been called yet?
G4int totalPe
Total charge on digit.
const WCSimWCDigiTrigger & operator=(const WCSimWCDigiTrigger &)
void SetDarkRate(double idarkrate)
Knowledge of the dark rate (use for automatically adjusting for noise)
G4int ndigitsWindow
The time window for the NDigits trigger.
void SetNDigitsPostTriggerWindow(G4int window)
Set the posttrigger window for the NDigits trigger (value will be forced positive) ...
WCSimDetectorConstruction * myDetector
Know about the detector, so can add appropriate PMT time smearing.
std::multimap< int, std::vector< int > > fDigiComp
Stores the unique IDs of each photon making up a digit.
virtual int GetDefaultNDigitsPostTriggerWindow()
Set the default trigger class specific NDigits posttrigger window (in ns) (overridden by ...
WCSimWCTriggerNDigits2(G4String name, WCSimDetectorConstruction *, WCSimWCDAQMessenger *, G4String detectorElement)
std::set< int > Gates
'Gates' specifies subevent
void SetPe(G4int gate, G4double Q)
int GetDefaultNDigitsThreshold()
This is not an NDigits trigger.
void SetSaveFailuresMode(G4int mode)
Set the mode for saving failed triggers (0:save only triggered events, 1:save both triggered events &...
WCSimWCTriggeredDigitsCollection * DigitsCollection
The main output of the class - collection of digits in the trigger window.
virtual int GetDefaultNDigitsPreTriggerWindow()
Set the default trigger class specific NDigits pretrigger window (in ns) (overridden by ...
G4Allocator< WCSimWCDigiTrigger > WCSimWCDigiTriggerAllocator
void DoTheWork(WCSimWCDigitsCollection *WCDCPMT)
Calls the workhorse of this class: AlgNoTrigger.
WCSimWCTriggerBase(G4String name, WCSimDetectorConstruction *, WCSimWCDAQMessenger *, G4String)
Create WCSimWCTriggerBase instance with knowledge of the detector and DAQ options.
G4bool GetMultiDigitsPerTrigger()
void FillDigitsCollection(WCSimWCDigitsCollection *WCDCPMT, bool remove_hits, TriggerType_t save_triggerType)
takes all trigger times, then loops over all Digits & fills the output DigitsCollection ...
int GetDefaultNDigitsThreshold()
SK NDigits threshold ~25.
static const double offset
Hit time offset (ns)
double GetPostTriggerWindow(TriggerType_t t)
Get the posttrigger window for a given trigger algorithm.
virtual bool GetDefaultMultiDigitsPerTrigger()
Set the default trigger class specific decision of whether to save multiple digits per PMT per trigge...
void GetVariables()
Get the default threshold, etc. from the derived class, and override with read from the ...
void SetSaveFailuresTime(G4double time)
Set the dummy trigger time for the failed triggers.
An (incomplete) example of running two trigger algorithms, one after the other.
void SetNDigitsPreTriggerWindow(G4int window)
Set the pretrigger window for the NDigits trigger (value will be forced negative) ...
WCSimWCDAQMessenger * DAQMessenger
Get the options from the .mac file.
void Digitize()
The main user-callable routine of the class. Gets the input & creates the output WCSimWCTriggeredDigi...
G4double saveFailuresTime
The dummy trigger time for failed events.