18 int occurences2ch = 0;
20 int current_channel = 0;
27 cout <<
"\nSearching for fraction of events with " << (max ?
"max" :
"min") << (greater ?
" > " :
" < ") << threshold <<
" mV:" << endl;
29 for (
int j = 0; j <
nwf; j++) {
30 auto his = (TH1F*)(
Getwf(j))->Clone();
33 if (from >= 0 && to > 0) {
34 his->GetXaxis()->SetRange(his->GetXaxis()->FindBin(from), his->GetXaxis()->FindBin(to));
39 if ((max && greater && his->GetMaximum() > threshold) || (max && !greater && his->GetMaximum() < threshold) || (!max && greater && his->GetMinimum() > threshold) || (!max && !greater && his->GetMinimum() < threshold)) {
42 if (verbose) cout <<
"\nevent:\t" << currevent <<
"\tchannel:\t" <<
active_channels[current_channel];
47 if (lastevent != currevent) occurences += 1;
48 if (lastevent == currevent && o2ch != occurences) {
52 lastevent = currevent;
62 << 100. *
static_cast<float>(counter_abovethr[i]) /
static_cast<float>(
nevents) <<
"%\n";
65 cout <<
"Fraction of events w/ at least 2 channels above threshold: "
66 << 100. *
static_cast<float>(occurences2ch) /
static_cast<float>(
nevents) <<
"%\n"
67 <<
"For a total of " <<
nevents <<
" events" << endl;
static bool Contains(const vector< T > &vec, const T &val)
Returns true if vector vec contains value val.
static void PrintProgressBar(int, int)
Print progress bar for a loop in steps of 10 percent.
void FractionEventsAboveThreshold(float=4, bool=true, bool=true, double=0., double=0., bool=false)
Find events with max/min above/below a certain threshold.
TH1F * Getwf(int)
Helper that returns the waveform histogram for a certain waveform number number.
int nevents
Number of triggered events in data.
vector< int > active_channels
Stores the numbers of the active channels.
int nwf
Total number of waveforms read from data: number of active channels x number of events.
virtual int GetCurrentEvent(int)
Get the current event index for a certain waveform index.
vector< int > plot_active_channels
Stores the numbers of the active channels which should be plotted.
virtual int GetCurrentChannel(int)
Get the current channel index for a certain waveform index.
vector< unsigned int > eventnr_storage
Events will be stored here in the order they have been read.