27 , fBranchName(branchName)
28 , fClassName(className)
30 , fActivateBuffering(kTRUE)
46 std::cout <<
"Before removing: ";
54 std::cout <<
"After removing: ";
62 std::cout <<
"DeadTime map after readout time: " << time << std::endl;
74 std::vector<FairTimeStamp*> data;
77 std::cout <<
"-I- FairWriteoutBuffer::WriteOutData for time: " << time << std::endl;
83 std::cout <<
"-E- FairWriteoutBuffer::WriteOutData " <<
fBranchName <<
" array is not available!"
87 std::cout <<
"-I- FairWriteoutBuffer::WriteOutData size: " << data.size() << std::endl;
89 for (
unsigned int i = 0; i < data.size(); i++) {
92 std::cout << i <<
" : ";
94 std::cout << std::endl;
106 double ultimateTime = 0;
119 if (ultimateTime > 0) {
126 typedef std::multimap<double, FairTimeStamp*>::iterator DTMapIter;
127 std::vector<FairTimeStamp*> result;
130 std::cout <<
"-I- GetRemoveOldData: DeadTime: " << it->first <<
" Data: " << it->second << std::endl;
132 result.push_back(it->second);
150 std::cout <<
"StartTime: " << startTime << std::endl;
152 std::pair<double, FairTimeStamp*> timeData(activeTime, dataClone);
153 fStartTime_map.insert(std::pair<
double, std::pair<double, FairTimeStamp*>>(startTime, timeData));
163 typedef std::multimap<double, FairTimeStamp*>::iterator DTMapIter;
170 if (timeOfOldData > -1) {
172 std::cout <<
" OldData found! " << timeOfOldData << std::endl;
175 std::cout <<
"New Data: " << activeTime <<
" : " << data << std::endl;
177 double currentdeadtime = timeOfOldData;
179 bool dataFound =
false;
182 for (DTMapIter it =
fDeadTime_map.lower_bound(currentdeadtime);
185 oldData = it->second;
187 std::cout <<
"Check Data: " << it->first <<
" : " << oldData << std::endl;
189 if (oldData->
equal(data)) {
191 std::cout <<
" oldData == data " << std::endl;
194 std::cout << it->first <<
" : " << it->second << std::endl;
203 if (dataFound ==
true) {
206 std::vector<std::pair<double, FairTimeStamp*>> modifiedData =
207 Modify(std::pair<double, FairTimeStamp*>(currentdeadtime, oldData),
208 std::pair<double, FairTimeStamp*>(activeTime, data));
209 for (
unsigned int i = 0; i < modifiedData.size(); i++) {
211 modifiedData[i].first,
215 std::cout << i <<
" :Modified Data: " << modifiedData[i].first <<
" : "
216 << modifiedData[i].second << std::endl;
222 std::pair<double, FairTimeStamp*>(activeTime, data));
226 std::cout <<
"-E- FairWriteoutBuffer::FillDataToDeadTimeMap: old data present in dataMap but not in "
233 std::cout <<
"-I- FairWriteoutBuffer::FillDataToDeadTimeMap Data Inserted: " << activeTime <<
" : ";
235 std::cout << std::endl;
237 fDeadTime_map.insert(std::pair<double, FairTimeStamp*>(activeTime, data));
248 typedef std::multimap<double, std::pair<double, FairTimeStamp*>>::iterator startTimeMapIter;
251 for (startTimeMapIter iter =
fStartTime_map.begin(); iter != stopTime; ++iter) {
252 std::pair<double, FairTimeStamp*> data = iter->second;
253 double startTime = iter->first;
261 typedef std::multimap<double, std::pair<double, FairTimeStamp*>>::iterator startTimeMapIter;
262 std::cout <<
"StartTimeMap: " << std::endl;
265 std::cout <<
" | " << iter->first <<
"/" << data->
GetTimeStamp();
267 std::cout <<
" |" << std::endl;
272 typedef std::multimap<double, FairTimeStamp*>::iterator DTMapIter;
273 std::cout <<
"DeadTimeMap: " << std::endl;
275 std::cout << it->first <<
" / ";
277 std::cout << std::endl;
279 std::cout << std::endl;
Bool_t fActivateBuffering
virtual void MoveDataFromStartTimeMapToDeadTimeMap(double time)
virtual void AddNewDataToTClonesArray(FairTimeStamp *data)=0
virtual void FillDataMap(FairTimeStamp *data, double activeTime)=0
add a new element in the search buffer
virtual void PrintData(FairTimeStamp *data)
virtual void FillNewData(FairTimeStamp *data, double startTime, double activeTime)
virtual std::vector< FairTimeStamp * > GetAllData()
static FairRootManager * Instance()
virtual std::vector< std::pair< double, FairTimeStamp * > > Modify(std::pair< double, FairTimeStamp * > oldData, std::pair< double, FairTimeStamp * >)
std::multimap< double, FairTimeStamp * > fDeadTime_map
ClassImp(FairEventBuilder)
virtual void WriteOutData(double time)
virtual std::vector< FairTimeStamp * > GetRemoveOldData(double time)
virtual double FindTimeForData(FairTimeStamp *data)=0
TClonesArray * GetTClonesArray(TString branchName)
virtual void EraseDataFromDataMap(FairTimeStamp *data)=0
delete the element from the search buffer (see PndSdsDigiPixelWriteoutBuffer)
virtual void PrintDeadTimeMap()
Method should be overwritten in derived classes to print the data of an object stored in the buffer...
Double_t GetTimeStamp() const
std::multimap< double, std::pair< double, FairTimeStamp * > > fStartTime_map
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
virtual void WriteOutDataDeadTimeMap(double time)
virtual void FillDataToDeadTimeMap(FairTimeStamp *data, double activeTime, double startTime)
virtual bool equal(FairTimeStamp *data)
A container class to store digi data during events.
virtual void PrintStartTimeMap()
virtual void WriteOutAllData()