/* $Id: */ // ------------------------------------------------------------------------- // ----- FairEventBuffer source file ----- // ----- Created 23/09/2013 by R. Karabowicz ----- // ------------------------------------------------------------------------- /** FairEventBuffer *@author Radoslaw Karabowicz *@since 23.09.2013 *@version 1.0 ** ** FairRoot base task for the event buffers. ** The tasks may: ** 1. analyze data to reconstruct event times or other characteristics ** in the function TClonesArray* FindEvents(), that returns ** TClonesArray of FairRecoEvents ** 2. identify the data that could belong to event in the ** function and insert this identified data to the output TClonesArrays ** in the function StoreEventData(event) ** The implementations may be using any or both of the above functions. **/ #include "FairEventBuffer.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "TClonesArray.h" #include using std::cout; using std::cerr; using std::endl; using std::flush; using std::fixed; using std::right; using std::left; using std::setw; using std::setprecision; using std::set; using std::map; // ----- Default constructor ------------------------------------------ FairEventBuffer::FairEventBuffer() : FairWriteoutBuffer(), fExecTime (0.), fMaxAllowedEventCreationTime(0.) { } // ------------------------------------------------------------------------- // ----- Constructor with name ----------------------------------------- FairEventBuffer::FairEventBuffer(TString branchName, TString className, TString folderName, Bool_t persistance) : FairWriteoutBuffer(branchName,className,folderName,persistance), fExecTime (0.), fMaxAllowedEventCreationTime(0.) { } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- FairEventBuffer::~FairEventBuffer() { } // ------------------------------------------------------------------------- void FairEventBuffer::WriteOutAllDeadTimeData() { if ( fBranchName.Length() < 1 ) return; FairRootManager* ioman = FairRootManager::Instance(); std::vector data; if (fActivateBuffering) { if (fVerbose > 0) { std::cout << "-I- FairWriteoutBuffer::WriteOutAllDeadTimeData" << std::endl; } data = GetAllData(); if (fTreeSave && data.size() > 0) { TClonesArray* myArray = ioman->GetTClonesArray(fBranchName); if (!myArray) { std::cout << "-E- FairWriteoutBuffer::WriteOutData " << fBranchName << " array is not available!" << std::endl; } if (fVerbose > 0) { std::cout << "-I- FairWriteoutBuffer::WriteOutData size: " << data.size() << std::endl; } for (int i = 0; i < data.size(); i++) { AddNewDataToTClonesArray(data[i]); if (fVerbose > 1) { std::cout << i << " : "; data[i]->Print(); std::cout << std::endl; } delete data[i]; } } } else { ioman->GetTClonesArray(fBranchName); } } //_____________________________________________________________________________ ClassImp(FairEventBuffer)