7 #define CBMDIGITIZE_H 1
10 #include <RtypesCore.h>
13 #include <FairLogger.h>
43 typedef std::pair<std::unique_ptr<Digi>, std::unique_ptr<CbmMatch>>
Data;
65 if (
fDigis->empty())
return kTRUE;
66 Double_t prevTime =
fDigis->begin()->GetTime();
67 for (
auto it = (
fDigis->begin())++; it !=
fDigis->end(); it++) {
68 if (it->GetTime() < prevTime) {
69 LOG(error) << GetName()
70 <<
": CheckBuffer: Found digi at t = " << it->GetTime()
71 <<
" ns after digi at t = " << prevTime <<
" ns";
75 prevTime = it->GetTime();
137 std::stringstream ss;
178 FairRootManager* ioman = FairRootManager::Instance();
184 if (digiBranchName.IsNull()) {
185 TString digiClassName = Digi::GetClassName();
186 if (digiClassName.BeginsWith(
"Cbm"))
187 digiBranchName = digiClassName(3, digiClassName.Length());
192 fDigis =
new std::vector<Digi>();
194 digiBranchName.Data(),
fDigis, IsOutputBranchPersistent(digiBranchName));
195 LOG(info) << GetName() <<
": Registered branch " << digiBranchName;
199 TString matchBranchName = digiBranchName +
"Match";
200 fMatches =
new std::vector<CbmMatch>();
201 ioman->RegisterAny(matchBranchName.Data(),
203 IsOutputBranchPersistent(matchBranchName));
204 LOG(info) << GetName() <<
": Registered branch " << matchBranchName;
220 std::unique_ptr<Digi> tmpDigi(digi);
221 std::unique_ptr<CbmMatch> tmpMatch(match);
223 make_pair(digi->GetTime(),
224 std::make_pair(std::move(tmpDigi), std::move(tmpMatch))));
262 Bool_t checkMinTime = kTRUE;
263 Bool_t checkMaxTime = kTRUE;
265 if (checkLimit && fillTime < tMax) tMax = fillTime;
267 checkMinTime = kFALSE;
268 checkMaxTime = checkLimit;
271 LOG(fatal) << GetName() <<
": Unknown time-slice type!";
277 while (it !=
fDaqBuffer.end() && ((!checkMaxTime) || it->first < tMax)) {
282 if (timeSlice->
IsRegular() && it->first < 0.) {
289 assert((!checkMinTime) || it->first >= tMin);
295 assert(it->second.first);
296 fDigis->push_back(*(it->second.first));
299 assert(it->second.second);
300 fMatches->push_back(*(it->second.second));