Skip to content

Commit 36ce78e

Browse files
committed
Skeleton for O2RunAna
Skeleton for an Alice specific O2RunAna, which adapts FairRunAna to some O2 specific details; Notably * ability to load only required data from a tree * create some metadata to be passed along to processing units as input The class is not used at the moment, the idea being to use it for further prototyping / testing ideas.
1 parent f0d5f79 commit 36ce78e

8 files changed

Lines changed: 1192 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ add_subdirectory(Framework)
183183
add_subdirectory(Algorithm)
184184
add_subdirectory(macro)
185185
add_subdirectory(Utilities)
186+
add_subdirectory(Steer)
186187
add_subdirectory(doc)
187188
add_subdirectory(run)
188189
add_subdirectory(config)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file ProcessingEventInfo.h
12+
/// \brief Encapsulated meta information about current event being processed by FairRoot (analysis) tasks
13+
/// \author Sandro Wenzel
14+
15+
#ifndef ALICEO2_DATA_EVENTINFO_H_
16+
#define ALICEO2_DATA_EVENTINFO_H_
17+
18+
namespace o2 {
19+
20+
// A class encapsulating meta information about events being process
21+
// and the data being sent by run classes such as FairRunAna.
22+
// Can be send to processing tasks for usage so that they do no longer
23+
// need to access the FairRootManager directly.
24+
struct ProcessingEventInfo {
25+
double eventTime; //! time of the current event
26+
int eventNumber; //! the current entry
27+
int sourceNumber; //! the current source number
28+
bool numberSources; //! number of sources
29+
// can be extended further
30+
};
31+
32+
}
33+
34+
#endif

Steer/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
set(MODULE_NAME "Steer")
2+
3+
O2_SETUP(NAME ${MODULE_NAME})
4+
5+
set(SRCS
6+
src/O2RunAna.cxx
7+
)
8+
9+
set(HEADERS
10+
include/${MODULE_NAME}/O2RunAna.h
11+
)
12+
13+
set(LINKDEF src/SteerLinkDef.h)
14+
set(LIBRARY_NAME ${MODULE_NAME})
15+
set(BUCKET_NAME data_format_simulation_bucket)
16+
17+
O2_GENERATE_LIBRARY()

Steer/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This directory contains ALICE O2 specific customizations
2+
of steering classes from FairRoot
3+
4+
The purpose is either
5+
a) quick prototyping of ideas without having to require immediate changes in FairRoot
6+
but with the idea to give back the changes some day
7+
b) adaptations to classes because some things are done differently than in FairRoot
8+
(MC truth handling, parameter handling etc)

Steer/include/Steer/O2RunAna.h

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
// This file is an adaption of FairRoot::FairRunAna commit a6c5cfbe143d3391e (dev branch)
12+
// created 28.9.20017
13+
14+
#ifndef O2_O2RUNANA_H
15+
#define O2_O2RUNANA_H
16+
17+
#include "FairRun.h" // for FairRun
18+
#include "FairRootManager.h" // for FairRootManager
19+
#include "FairRunInfo.h" // for FairRunInfo
20+
#include "Rtypes.h" // for Bool_t, Double_t, UInt_t, etc
21+
#include "TString.h" // for TString
22+
23+
#include "SimulationDataFormat/ProcessingEventInfo.h"
24+
25+
class FairField;
26+
class TF1;
27+
class TFile;
28+
29+
class FairFileSource;
30+
class FairMixedSource;
31+
32+
namespace o2 {
33+
namespace steer {
34+
35+
/// O2 specific run class; steering analysis runs
36+
/// such as digitization, clusterization, reco
37+
/// that typically follow a simulation
38+
/// This class analyses the consumer tasks for their
39+
/// input requests and reads this input from the input
40+
/// file (for asked events)
41+
class O2RunAna : public FairRun
42+
{
43+
public:
44+
/// get access to singleton instance
45+
static O2RunAna* Instance();
46+
~O2RunAna() override;
47+
48+
// -------- interface functions from FairRun -----------
49+
50+
/**initialize the run manager*/
51+
void Init() override;
52+
/**Run from event number NStart to event number NStop */
53+
void Run(Int_t NStart=0 ,Int_t NStop=0) override;
54+
/** Get the magnetic field **/
55+
FairField* GetField() override {
56+
return mField;
57+
}
58+
59+
// ------ other functions ------------------------------
60+
61+
62+
/**Run over the whole input file with timpe window delta_t as unit (entry)*/
63+
void Run(Double_t delta_t);
64+
/**Run for the given single entry*/
65+
void Run(Long64_t entry);
66+
67+
/**Run event reconstruction from event number NStart to event number NStop */
68+
void RunEventReco(Int_t NStart ,Int_t NStop);
69+
/**Run over all TSBuffers until the data is processed*/
70+
void RunTSBuffers();
71+
/** the dummy run does not check the evt header or the parameters!! */
72+
void DummyRun(Int_t NStart ,Int_t NStop);
73+
74+
/** This methode is only needed and used with ZeroMQ
75+
* it read a certain event and call the task exec, but no output is written
76+
* @param entry : entry number in the tree
77+
*/
78+
void RunMQ(Long64_t entry);
79+
80+
/** finish tasks, write output*/
81+
void TerminateRun();
82+
83+
84+
/**Set the input signal file
85+
*@param name : signal file name
86+
*@param identifier : Unsigned integer which identify the signal file
87+
*/
88+
void SetSource(FairSource* tempSource) { fRootManager->SetSource(tempSource); }
89+
90+
// ********************************************************* //
91+
// THE BELOW FUNCTIONS SHOULD BE MOVED TO FairFileSource
92+
/**Set the input file by name*/
93+
void SetInputFile(TString fname);
94+
/**Add a file to input chain */
95+
void AddFile(TString name);
96+
/** Add a friend file (input) by name)*/
97+
void AddFriend(TString fName);
98+
99+
// ********************************************************* //
100+
// THE BELOW FUNCTIONS SHOULD BE MOVED TO FairMixedSource
101+
void SetSignalFile(TString name, UInt_t identifier );
102+
103+
/**Add signal file to input
104+
*@param name : signal file name
105+
*@param identifier : Unsigned integer which identify the signal file to which this signal should be added
106+
*/
107+
void AddSignalFile(TString name, UInt_t identifier );
108+
109+
/**Set the input background file by name*/
110+
void SetBackgroundFile(TString name);
111+
112+
/**Add input background file by name*/
113+
void AddBackgroundFile(TString name);
114+
115+
/**Set the signal to background ratio in event units
116+
*@param background : Number of background Events for one signal
117+
*@param Signalid : Signal file Id, used when adding (setting) the signal file
118+
* here we just forward the call to the FairRootManager
119+
*/
120+
void BGWindowWidthNo(UInt_t background, UInt_t Signalid);
121+
122+
/**Set the signal to background rate in time units
123+
*@param background : Time of background Events before one signal
124+
*@param Signalid : Signal file Id, used when adding (setting) the signal file
125+
* here we just forward the call to the FairRootManager
126+
*/
127+
void BGWindowWidthTime(Double_t background, UInt_t Signalid);
128+
129+
/**
130+
* This method will simply forward the call to the FairRootManager,
131+
* if true all inputs are mixed, i.e: each read event will take one entry from each input and put
132+
* them in one big event and send it to the next step
133+
*/
134+
// void SetMixAllInputs(Bool_t Status);
135+
// ********************************************************* //
136+
// THE BELOW FUNCTIONS SHOULD BE MOVED TO FairFileSource and FairMixedSource
137+
/** Set the min and max limit for event time in ns */
138+
void SetEventTimeInterval(Double_t min, Double_t max);
139+
/** Set the mean time for the event in ns */
140+
void SetEventMeanTime(Double_t mean);
141+
/** Set the time intervall the beam is interacting and the gap in ns */
142+
void SetBeamTime(Double_t beamTime, Double_t gapTime);
143+
// ********************************************************* //
144+
145+
/** Switch On/Off the storing of FairEventHeader in output file*/
146+
void SetEventHeaderPersistence(Bool_t flag){
147+
mStoreEventHeader=flag;
148+
}
149+
150+
void Reinit(UInt_t runId);
151+
UInt_t getRunId() {
152+
return fRunId;
153+
}
154+
155+
/** Set the magnetic Field */
156+
void SetField (FairField* ffield ) {
157+
mField=ffield ;
158+
}
159+
/** Set external geometry file */
160+
void SetGeomFile(const char* GeoFileName);
161+
/** Return a pointer to the geometry file */
162+
TFile* GetGeoFile() {
163+
return mInputGeoFile;
164+
}
165+
/** Initialization of parameter container is set to static, i.e: the run id is
166+
* is not checked anymore after initialization
167+
*/
168+
169+
void SetContainerStatic(Bool_t tempBool=kTRUE);
170+
Bool_t GetContainerStatic() { return mStatic; };
171+
172+
private:
173+
O2RunAna();
174+
O2RunAna(const O2RunAna& M) = delete;
175+
O2RunAna& operator= (const O2RunAna&) = delete;
176+
177+
void Fill();
178+
179+
FairRunInfo mRunInfo; //!
180+
/** This variable became true after Init is called*/
181+
Bool_t mIsInitialized;
182+
TFile* mInputGeoFile;
183+
Bool_t mLoadGeo;
184+
/** true for static initialisation of parameters */
185+
Bool_t mStatic;//!
186+
FairField* mField;
187+
Bool_t mTimeStamps;
188+
Bool_t mInFileIsOpen;//!
189+
/** min time for one event (ns) */
190+
Double_t mEventTimeMin; //!
191+
/** max time for one Event (ns) */
192+
Double_t mEventTimeMax; //!
193+
/** Time of event since th start (ns) */
194+
Double_t mEventTime; //!
195+
/** EventMean time used (P(t)=1/fEventMeanTime*Exp(-t/fEventMeanTime) */
196+
Double_t mEventMeanTime; //!
197+
/** used to generate random numbers for event time; */
198+
TF1* mTimeProb; //!
199+
200+
/** Temporary member to preserve old functionality without setting source in macro */
201+
FairFileSource* mFileSource; //!
202+
/** Temporary member to preserve old functionality without setting source in macro */
203+
FairMixedSource* mMixedSource; //!
204+
/** Flag for Event Header Persistency */
205+
Bool_t mStoreEventHeader; //!
206+
207+
// branches to read from File
208+
std::vector<std::string> mRequestedBranches;
209+
210+
// storage for event info passed along to tasks
211+
o2::ProcessingEventInfo* mEventInfo;
212+
213+
ClassDefOverride(O2RunAna, 0)
214+
};
215+
216+
}
217+
}
218+
219+
#endif //O2_O2RUNANA_H

0 commit comments

Comments
 (0)