-
Notifications
You must be signed in to change notification settings - Fork 1
/
HistWinDCUnassigned.cpp
66 lines (53 loc) · 2.82 KB
/
HistWinDCUnassigned.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Andrei Gaponenko, 2014
#include "HistWinDCUnassigned.h"
#include "TH1.h"
#include "HistogramFactory.h"
#include "ConfigFile.h"
#include "TimeWindow.h"
//================================================================
void HistWinDCUnassigned::init(const std::string& hdir,
HistogramFactory &hf,
const ConfigFile& conf)
{
hWinDCUnassignedAll_ = hf.DefineTH2D(hdir,
"unassignedAll",
"Num time windows vs per-stream unassigned DC hits",
201, -100.5, +100.5,
6, -0.5, 5.5
);
hWinDCUnassignedAll_->SetOption("colz");
hWinDCUnassignedAfterTrig_ = hf.DefineTH2D(hdir,
"unassignedAfterTrig",
"Num after-trig time windows vs per-stream unassigned DC after-trig hits",
201, -100.5, +100.5,
6, -0.5, 5.5
);
hWinDCUnassignedAfterTrig_->SetOption("colz");
hWinDCNumUnassignedAfterTrig_ = hf.DefineTH1D(hdir,
"numUnassignedAfterTrig",
"Num unassigned DC after-trig hits",
51, -0.5, +50.5);
}
//================================================================
void HistWinDCUnassigned::fill(const TimeWindowingResults& wres) {
int unassignedAllUp=0, unassignedAllDn=0;
for(unsigned i = 0; i < wres.unassignedDCHits.size(); ++i) {
++( (wres.unassignedDCHits[i]->plane() < 23 ) ? unassignedAllUp : unassignedAllDn);
}
if(unassignedAllUp) hWinDCUnassignedAll_->Fill(-unassignedAllUp, wres.windows.size());
if(unassignedAllDn) hWinDCUnassignedAll_->Fill(+unassignedAllDn, wres.windows.size());
if(wres.iTrigWin != -1) {
const double trigTime = wres.windows[wres.iTrigWin].tstart;
int unassignedAfterTrigUp=0, unassignedAfterTrigDn=0;
for(unsigned i = 0; i < wres.unassignedDCHits.size(); ++i) {
if(wres.unassignedDCHits[i]->time() > trigTime) {
++( (wres.unassignedDCHits[i]->plane() < 23 ) ? unassignedAfterTrigUp : unassignedAfterTrigDn);
}
}
const int numAfterTrigWindows = wres.windows.size() - wres.iTrigWin - 1;
if(unassignedAfterTrigUp) hWinDCUnassignedAfterTrig_->Fill(-unassignedAfterTrigUp, numAfterTrigWindows);
if(unassignedAfterTrigDn) hWinDCUnassignedAfterTrig_->Fill(+unassignedAfterTrigDn, numAfterTrigWindows);
hWinDCNumUnassignedAfterTrig_->Fill(unassignedAfterTrigDn + unassignedAfterTrigUp);
}
}
//================================================================