20#include "FairRootManager.h"
41 fQa->ResetPerTsStorage();
47 std::vector<CbmMatch> eventMatches;
51 double TSList_starttime =
fTimeSlice->GetStartTime();
54 for (uint32_t i = 0; i <
fEventList->GetNofEvents(); i++) {
59 const double seedTime =
fEventList->GetEventTimeByIndex(i);
60 double shiftedSeedTime =
61 seedTime - TSList_starttime;
67 const uint32_t eventId =
fEventList->GetEventIdByIndex(i);
68 const uint32_t fileId =
fEventList->GetFileIdByIndex(i);
70 eventMatch.
AddLink(1.0, 0, eventId, fileId);
71 eventMatches.push_back(eventMatch);
75 for (uint32_t i = 0; i <
fvSeedTimes->size(); i++) {
83 const int32_t nDigisTot = vIn->size();
84 int32_t nDigisWin = 0;
85 int32_t winStartN = 0;
86 double winStartT = -1111;
90 for (int32_t i = 0; i < nDigisTot; i++) {
91 const double currentT =
GetTime(vIn, i);
95 if (winStartT == -1111) {
100 for (j = winStartN; j < i; j++) {
111 winStartT = currentT;
117 const double seedTime =
118 fdOffset + (currentT + winStartT) / 2.;
121 if (vDigiMatch &&
fQa) {
122 fQa->FillQaSeedInfo(winStartN, i, vDigiMatch, seedTime);
126 for (j = i + 1; j < nDigisTot; j++) {
127 const double newStartT =
GetTime(vIn, j);
128 if (newStartT - currentT >
fdDeadT)
break;
130 if (j == nDigisTot) {
151 const std::vector<CbmMatch>*);
164 std::cout <<
"CbmSeedFinderSlidingWindow: Error, called algo without digi input, but ideal mode is not set."
171template<
class inType>
174 const inType* digi = &(vIn->at(i));
175 if (digi ==
nullptr) {
176 std::cout <<
"CbmSeedFinderSlidingWindow: Error, non-allocated digi in input vector at position: " << i
179 return digi->GetTime();
191 if (
fQa ==
nullptr) {
196 if (
fQa !=
nullptr) {
209 if (!FairRootManager::Instance() || !FairRootManager::Instance()->GetObject(
"MCEventList.")) {
210 LOG(error) <<
"No MC event list found";
Class for sliding window seed finder.
Class for sliding window seed finder.
Container class for MC events with number, file and start time.
void AddLink(const CbmLink &newLink)
void OutputQa()
Output QA Information.
double fdOffset
Global time offset which is applied to each trigger time.
int32_t fminDigis
Minimum number of digis which must be found in the seed window.
CbmSeedFinderQa * fQa
Processes QA info.
void SetQa(bool doQA=true)
Enable or disable the generation of QA information.
int32_t fIdealModeFileId
If only a single file is to be used in `‘ideal mode’' (-1 = all files).
std::vector< double > * fvSeedTimes
Output of the algorithm. Stores seed times for current time slice.
void Init()
Initializes QA object if set.
double fdDeadT
`‘Dead time’' i.e. time interval which is discarded after a seed is found.
void FillSeedTimes()
Function which builds event seeds without digi input. Can only be used in ideal mode.
double GetTime(const std::vector< inType > *vIn, int32_t i)
Fetches time at position i of either a digi vector or vector of times.
double fdWindDur
Size of sliding window.
CbmMCEventList * fEventList
To access MC truth in `‘ideal mode’'.
CbmTimeSlice * fTimeSlice
~CbmSeedFinderSlidingWindow()
Destructor.
bool fbIdealMode
`‘ideal mode’' uses MC truth as trigger times.
Bookkeeping of time-slice content.