FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEventBuilder.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 /* $Id: */
9 
10 // -------------------------------------------------------------------------
11 // ----- FairEventBuilder source file -----
12 // ----- Created 23/09/2013 by R. Karabowicz -----
13 // -------------------------------------------------------------------------
14 
31 #include "FairEventBuilder.h"
32 
33 #include "FairRootManager.h"
34 #include "FairTimeStamp.h"
35 
36 #include <TClonesArray.h>
37 #include <iostream>
38 
41  , fBuilderName("")
42  , fTimer()
43  , fExecTime(0.)
44  , fIdentifier(0)
45  , fMaxAllowedEventCreationTime(0.)
46 {}
47 
48 FairEventBuilder::FairEventBuilder(TString branchName, TString className, TString folderName, Bool_t persistance)
49  : FairWriteoutBuffer(branchName, className, folderName, persistance)
50  , fBuilderName("")
51  , fTimer()
52  , fExecTime(0.)
53  , fIdentifier(0)
54  , fMaxAllowedEventCreationTime(0.)
55 {}
56 
58 
60 {
61  if (fBranchName.Length() < 1) {
62  return;
63  }
64 
66  std::vector<FairTimeStamp*> data;
67  if (fActivateBuffering) {
68  if (fVerbose > 0) {
69  std::cout << "-I- FairEventBuilder::WriteOutAllDeadTimeData" << std::endl;
70  }
71  data = GetAllData();
72  if (fTreeSave && data.size() > 0) {
73  TClonesArray* myArray = ioman->GetTClonesArray(fBranchName);
74  if (!myArray) {
75  std::cout << "-E- FairEventBuilder::WriteOutData " << fBranchName << " array is not available!"
76  << std::endl;
77  }
78  if (fVerbose > 0) {
79  std::cout << "-I- FairEventBuilder::WriteOutData size: " << data.size() << std::endl;
80  }
81  for (unsigned int i = 0; i < data.size(); i++) {
82  AddNewDataToTClonesArray(data[i]);
83  if (fVerbose > 1) {
84  std::cout << i << " : ";
85  data[i]->Print();
86  std::cout << std::endl;
87  }
88  delete data[i];
89  }
90  }
91  } else {
93  }
94 }
95 
97 {
98  std::cout << "-------------------- " << GetBuilderName() << " : Summary -----------------------" << std::endl;
99  std::cout << " Should be implemented by the user" << std::endl;
100  std::cout << "---------------------------------------------------------------------" << std::endl;
101 }
102 
virtual void Finish()
TString GetBuilderName()
virtual void AddNewDataToTClonesArray(FairTimeStamp *data)=0
virtual std::vector< FairTimeStamp * > GetAllData()
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
TClonesArray * GetTClonesArray(TString branchName)
virtual void WriteOutAllDeadTimeData()
virtual ~FairEventBuilder()
A container class to store digi data during events.