8 #include "QDetChannelCollectionHandle.hh"
12 using namespace Diana;
21 fEnergyLabel = GetString(
"EnergyLabel",
"ApplyCalibration@Energy");
23 vector<string> defaults;
24 fPSALabels = GetVectorString(
"PSALabels",defaults);
25 fCoincidenceDataOwner = GetString(
"CoincidenceDataOwner",
"Coincidence",
false);
27 fDaughterSelectionLabel = GetString(
"DaughterSelectionLabel",
Q_STRING_DEFAULT);
30 ev.RequireByLabel<
QBool>(fMotherSelectionLabel);
31 ev.RequireByLabel<
QBool>(fDaughterSelectionLabel);
32 if(!fPSALabels.empty()) {
33 for(
size_t p = 0; p < fPSALabels.size(); p++) {
34 ev.RequireByLabel<
QDouble>(fPSALabels[p]);
38 GetBool(
"SkipEvents",
false,
false);
46 if(!isMother && !isDaughter)
return;
51 const int run = hdr.
GetRun();
52 const int chan = pi.GetChannelId();
53 QDetChannelCollectionHandle dccHandle;
54 dccHandle.SetRun(run);
55 GlobalData().Get(
"",&dccHandle,
"");
56 int floor = dccHandle.Get().Get(chan).fTd.fTdFloor;
58 const double time = ev.
Get<
QDouble>(fCoincidenceDataOwner.c_str(),
"Time");
72 std::map<double,int>::reverse_iterator timeOrderedFloorIter = fTimeOrderedFloors.rbegin();
73 while(timeOrderedFloorIter != fTimeOrderedFloors.rend()) {
74 const int o_floor = timeOrderedFloorIter->second;
75 const double deltaT = timeOrderedFloorIter->first-time;
77 if(fabs(deltaT) < 2.) {
78 timeOrderedFloorIter++;
81 int deltaFloor = o_floor-floor;
86 int numMultChannels = multChannels.size();
87 int countMultChannels = numMultChannels;
88 while(
abs(deltaFloor) > 2 && countMultChannels>0) {
89 const QCoincidentChannel& multChannel = multChannels[numMultChannels-countMultChannels];
90 deltaFloor = o_floor-(floor+multChannel.
fDeltaFloor);
94 if(
abs(deltaFloor) <=2) {
103 timeOrderedFloorIter++;
110 const double total_energy = ev.
Get<
QDouble>(fCoincidenceDataOwner.c_str(),
"TotalEnergy");
113 backChannel.fDeltaT = time;
114 backChannel.fEnergy = total_energy;
115 for(
size_t p = 0; p < fPSALabels.size(); p++) {
118 backChannel.fDeltaFloor = -1;
119 backChannel.fDeltaPosition = -1;
121 fFloors[floor] = backChannel;
126 if(energy < energy2) {
127 fFloors[floor] = backChannel;
131 fTimeOrderedFloors.clear();
132 std::map<int,QCoincidentChannel>::const_iterator floorIter = fFloors.begin();
133 while(floorIter != fFloors.end()) {
134 const int backFloor = floorIter->first;
135 const double backTime = floorIter->second.fDeltaT;
136 fTimeOrderedFloors[backTime] = backFloor;
#define REGISTER_MODULE(clazz)
Diana::QVector abs(const Diana::QVector &v)
module to tag delayed coincidences.
void Do(Diana::QEvent &ev)
Do method.
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
bool wrapped into a QObject
int fFarthestCoincidentIndex
int fNearestCoincidentIndex
std::vector< QCoincidentChannel > fCoincidentChannels
data of coincident channel
const Q & GetByLabel(const QEventLabel &label) const
Get a QObject in read mode by label.
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
Raw event: bolometer channel, trigger positions and types.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...