Time-based simulation

undefined
Time-based simulation
PANDA Computing Workshop - SUT
T
i
m
e
-
B
a
s
e
d
 
S
i
m
u
l
a
t
i
o
n
 
Single Event
T
i
m
e
-
B
a
s
e
d
 
S
i
m
u
l
a
t
i
o
n
 
20 MHz overlap
E
v
e
n
t
 
M
i
x
i
n
g
 
(
M
o
h
a
m
m
a
d
s
 
w
o
r
k
)
Back-
ground
Signal
1
Signal
2
MC Files:
Digiti
zation
MC file does not know
anything about time
structure
Time structure is
calculated in Digitization
stage
Many different signal files
can be added to one
background file
Where the data is coming
from is stored in
EventHeader
No overlap (pileup) of
events
FairMixedFileSource
does the job
Event 0:
 
from BG
 
with time 50.3
Event 1: 
 
from BG
 
with time 72.4
………………………………….
Event 102: 
 
from Signal 1
 
with time 10230.1
 
FairRoot/examples/simulation/Tutorial2/macros/create_digis_mixed.C
H
o
w
 
d
o
 
e
v
e
n
t
s
 
o
v
e
r
l
a
p
?
Problem: In the (usual) event-based simulation each event
can be treated completely independent of each other and
time between events does not play a role.
This is not the reality in experiments:
Sensor elements are still blocked from previous hits
Electronic is still busy
Hits too close in time cannot be distinguished
Special problem for PANDA:
Continuous beam with Poisson statistics 
 many events with
short time between them
No hardware trigger
E
v
e
n
t
 
S
t
r
u
c
t
u
r
e
 
a
n
d
 
D
e
t
e
c
t
o
r
 
R
e
s
p
o
n
s
e
SciTil
EMC
MVD
STT
.
.
.
time
ev 1
ev 2
ev 3
E
v
e
n
t
 
S
t
r
u
c
t
u
r
e
 
a
n
d
 
D
e
t
e
c
t
o
r
 
R
e
s
p
o
n
s
e
STT
.
.
.
time
ev 1
ev 2
ev 3
E
v
e
n
t
 
S
t
r
u
c
t
u
r
e
 
a
n
d
 
D
e
t
e
c
t
o
r
 
R
e
s
p
o
n
s
e
STT
.
.
.
time
ev 1
ev 2
ev 3
Event 1
Event 2
Event 3
Wanted data structure
Data structure in Tree
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
 
EventTime [ns]
EventTime
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
EventTime
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
EventTime
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Time Of Flight
EventTime
TimeOfFlight
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Electronics
U
U
thr
t
 
TimeStamp
EventTime
TimeOfFlight
TimeStamp
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Electronics
U
U
thr
t
TimeStamp is
charge dependent
EventTime
TimeOfFlight
TimeStamp
Signal with different charge
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Electronics
U
U
thr
t
EventTime
TimeOfFlight
TimeStamp
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Electronics
U
U
thr
t
2nd hit in same
detector elemet
EventTime
TimeOfFlight
TimeStamp
T
i
m
e
s
 
t
o
 
t
a
k
e
 
i
n
t
o
 
a
c
c
o
u
n
t
 
S
e
n
s
o
r
Electronics
U
U
thr
t
EventTime
TimeOfFlight
TimeStamp
Start/ActiveTime
Active Time
Start Time
D
e
a
d
 
T
i
m
e
Finite time required by a detector to process an event,
during which no additional signal can be registered
Two cases:
d
e
t
e
c
t
o
r
 
i
s
 
i
n
s
e
n
s
i
t
i
v
e
 
n
o
n
-
e
x
t
e
n
d
a
b
l
e
/
p
a
r
a
l
y
z
a
b
l
e
 
d
e
a
d
 
t
i
m
e
d
e
t
e
c
t
o
r
 
s
t
a
y
s
 
s
e
n
s
i
t
i
v
e
 
e
x
t
e
n
d
a
b
l
e
 
o
r
 
p
a
r
a
l
y
z
a
b
l
e
d
e
a
d
 
t
i
m
e
 
(
e
.
g
.
 
r
a
t
e
 
o
f
 
a
G
e
i
g
e
r
-
M
ü
l
l
e
r
 
c
o
u
n
t
e
r
 
d
r
o
p
s
 
a
t
a
t
 
v
e
r
y
 
h
i
g
h
 
d
o
s
i
s
)
N
e
c
e
s
s
a
r
y
 
T
i
m
e
s
4 times necessary:
Event Time
Assigned to Events in digitization if
fRun->SetEventMeanTime(Double_t) 
is set in the digi
macro
Value can be accessed in tasks via:
FairRootManager::Instance()->
GetEventTime()
N
e
c
e
s
s
a
r
y
 
T
i
m
e
s
4 times necessary:
Event Time
Time-of-Flight:
Automatically stored in the MC points of each detector
N
e
c
e
s
s
a
r
y
 
T
i
m
e
s
4 times necessary:
Event Time
Time-of-Flight
Time Stamp:
Time assigned to each detector hit (MANDATORY for
PANDA!)
Absolute time! (includes Event Time, ToF , Electornics)
Resolution and offset depends on individuall detector
N
e
c
e
s
s
a
r
y
 
T
i
m
e
s
4 times necessary:
Event Time
Time-of-Flight
Time Stamp
Start/Active Time:
Time window an event can influence any other event
happening in the same detector element
Strongly detector dependent
What happens if a second hit occurs during the active time of
a previous hit is strongly detector dependent (hit lost, new hit
modified, old hit modified, new hits created, …)
Absolute time!
F
a
i
r
W
r
i
t
e
o
u
t
B
u
f
f
e
r
Special buffer to store detector data between events
You give the data you want to store an absolute time
window this data is active in your detector and can
influence later events.
If the same detector element is hit a second time the data is
modified.
This is an abstract base class where you have to inherit
from
S
O
R
T
I
N
G
 
T
H
E
 
D
A
T
A
 
S
o
r
t
i
n
g
 
t
h
e
 
d
a
t
a
It is essential for the later extraction of the data that it is
sorted by its time stamp
A base class for the sorter (
FairRingSorter
) and a base
class for a sorter task (
FairRingSorterTask
) are
already implemented in the software
To use them you have to derive your own sorter classes
from them and overwrite some methods
T
e
c
h
n
i
c
a
l
 
i
m
p
l
e
m
e
n
t
a
t
i
o
n
 
 
R
i
n
g
 
S
o
r
t
e
r
0-Element Pointer
Number of storage cells given by
the spread of the time stamps
within the data stream
Width of one storage cell given by
time resolution of detector
Storage Pointer
position calculated
numerically from time stamp
If a storage position is calculated which would override old data, the
old data is saved to disk and the storage cell is freed
D
i
g
i
 
D
a
t
a
 
r
a
n
d
o
m
i
z
e
d
 
Digi Data Stream
Digi Index
Same color =
same event
D
i
g
i
 
D
a
t
a
 
r
a
n
d
o
m
i
z
e
d
 
TimeStamp of Digi vs Index
Digi Index
Time Stamp [ns]
D
i
g
i
 
D
a
t
a
 
S
o
r
t
e
d
 
Digi Data Stream
Digi Index
Same color =
same event
D
i
g
i
 
D
a
t
a
 
S
o
r
t
e
d
 
Digi Index
Time Stamp [ns]
TimeStamp of Digi vs Index after
sorting
R
E
A
D
I
N
G
 
B
A
C
K
 
T
H
E
 
D
A
T
A
 
R
e
a
d
i
n
g
 
b
a
c
k
 
d
a
t
a
Reading back data is done via the FairRootManager
Two different methods exists
FairRootManager::GetData(BranchName, Functor, Parameter);
FairRootManager::GetData(BranchName, StartFunctor, StartParam.,
     
StopFunctor, StopParam.);
GetData with one functor/parameter runs always forward in time
Data is only read once
GetData with two sets of functor/parameter is able to get data
within a time interval
Data can be extracted many times
Works only with special functors 
 next page
W
h
a
t
 
i
s
 
a
 
F
u
n
c
t
o
r
?
A (binary)functor is a class with an 
operator()
 which
takes two parameters as an input and has one output.
In our case the parameters are 
FairTimeStamp*,
double
 as input and 
bool
 as output.
The functor is true if it gets data which does not fit into the
selection criterion
In this way you can define your own data selectors
Existing examples:
StopTime
: Returns all data with a TimeStamp less than the
given parameter
TimeGap
: Returns all data before a time gap larger than the
given parameter
For the 
GetData
-Method with two functors the first has to
be the 
StopTime
 - functor
D
a
t
a
 
p
a
c
k
a
g
i
n
g
Select data packages according to time gaps between digi clusters
Works very well for detectors with precise time measurement
Example: GEM Digis
MC Truth
Packages
R. Karabowicz
G
E
M
 
T
r
a
c
k
i
n
g
 
E
f
f
i
c
i
e
n
c
y
87% for primaries with |p|>1GeV/c,
compared to ~95% in event-based reconstruction
R. Karabowitcz
G
E
M
 
E
v
e
n
t
 
B
u
i
l
d
i
n
g
Use the tracks’ start-time
• Tracks with start-time closer than 3 ns end up in one event
(3ns come from the tracks start-times correlation), with event
time set to a mean of 
constituent tracks’ start times
• Even one track can form an event
• Compare reconstructed event times with MC event times, if
the difference is smaller than 5 ns the MC event is
considered to be reconstructed
R. Karabowicz
E
v
e
n
t
 
B
u
i
l
d
e
r
 
 
 
 
R. Karabowicz
E
v
e
n
t
 
B
u
i
l
d
e
r
 
 
 
 
R. Karabowicz
E
v
e
n
t
 
B
u
i
l
d
e
r
 
 
 
 
R. Karabowicz
E
v
e
n
t
 
B
u
i
l
d
e
r
 
 
 
R. Karabowicz
G
E
M
 
E
v
e
n
t
 
R
e
c
o
n
s
t
r
u
c
t
i
o
n
10000 DPM events
simulated
• 8165 events with
reconstructable track
in GEM tracker
• 7536 events
Reconstructed
(92.3%)
• 139 ghost events
(1.8%)
R. Karabowicz
E
v
e
n
t
 
D
i
s
p
l
a
y
Event selected by MVD
via time gap
STT hits matching to MVD time
E
v
e
n
t
 
B
u
i
l
d
i
n
g
H
O
W
 
T
O
 
I
M
P
L
E
M
E
N
T
 
I
T
 
S
T
O
R
I
N
G
 
T
H
E
 
D
A
T
A
 
S
T
E
P
 
1
Check the data object you want to store:
Does it derive form 
FairTimeStamp
 ?
Does it have an 
operator<< 
?
Does it have an 
bool operator< (const yourClass&
name) const
 ?
Does it have an 
equal(FairTimeStamp*) 
method
?
The equal method should return true if two identical
detector elements are compared (e.g. the same pixel, pad,
strip, straw, …)
It should not check if the data in the element is identical as
well
An example can be found in PndSdsDigiPixel
S
T
E
P
 
2
Derive your own buffer class from FairWriteoutBuffer
In the class header you have to add:
std::map<yourDataClass, double> fData_map;
yourWriteoutBuffer::yourWriteoutBuffer(TString branchName, TString folderName, Bool_t
persistance): FairWriteoutBuffer(branchName, “yourDataClass", folderName, persistance)
Implement the pure virtual methods:
void AddNewDataToTClonesArray(FairTimeStamp* data)
{
 
FairRootManager* ioman = FairRootManager::Instance();
 
TClonesArray* myArray = ioman-> GetTClonesArray(fBranchName);
 
new ((*myArray)[myArray->GetEntries()]) yourclass(*(yourclass*)(data));
}
Double FindTimeForData(FairTimeStamp* data)
{
 
std::map<yourclass, double>::itertor it;
 
yourclass myData = *(yourclass)data;
 
it = fData_map.find(myData);
 
if (it == fData_map.end())
  
return -1;
 
else return it->second;
}
S
T
E
P
 
2
b
Implement the pure virtual methods:
void FillDataMap(FairTimeStamp* data, double activeTime)
{
 
yourclass myData = *(yourclass*)data;
 
fData_Map[myData] = activeTime;
}
void EraseDataFromDataMap(FairTimeStamp* data)
{
 
yourclass myData = *(yourclass*)data;
 
if (fData_map.find(myData) != fData_map.end())
  
fData_map.erase(fData_map.find(myData));
}
M
o
d
i
f
y
Overwrite 
Modify(…) 
if you want to have a different
PileUp behavior (optional)
Modify(…)
is called if data should be written into the buffer
of an element which already exists in the buffer (e.g. same
pixel hit a second time)
The standard behavior is that the new data is just ignored
Input is the old data already in the buffer and the new data
which goes into the buffer
Output is a vector of data which will be stored in the buffer
plus the new active time of the data
S
T
E
P
 
3
Open your digi task:
Add to the header file:
YourWriteoutBuffer
* 
yourBufferName;
void RunTimeBased(){fTimeOrderedDigi = kTRUE;}
Bool_t fTimeOrderedDigi;
Replace in Init() the creation of the TClonesArray for your data
class by::
S
T
E
P
 
3
Replace in Exec() the filling of the TClonesArray of your
data object by:
The writeout buffer replaces the usual TClonesArray used
to store the data
If the variable fTimeOrderedDigi is set to kFALSE the
behaviour of the buffer is identical to the standard
TClonesArray storage of data
yourBufferName
->FillNewData(
yourData
, theAbsoluteStartTimeOfTheData,
theAbsoluteActiveTimeOfTheData
);
S
T
E
P
 
4
Add to your CMakeLists.txt and …LinkDef.h file the new classes
Make sure that you store a TimeStamp including error with your
data!
Now add in your digi macro the line
fRun->SetEventMeanTime(yourValue);
to assign a time to the events.
To use now the buffer you just need to set in your digi macro
yourTask->RunTimeBased();
This data has to go to a root file before you can continue
analysing the digitized data!
That’s it.
S
T
E
P
 
5
Compile it, run it, test it
If you look at the output data you should see that the digis
are not any longer stored in the same entry of the branch as
the MC data but at later entries.
You should have one entry more in the digi file as in the MC
file
S
T
E
P
 
6
For the FairRingSorter only the method
CreateElement()
 has to be overwritten
This method creates a new element of the object which was
passed by a FairTimeStamp pointer to the method
Here is an example:
FairTimeStamp*
PndSdsDigiPixelRingSorter::CreateElement(FairTimeStamp* data) {
 
return new PndSdsDigiPixel(*(PndSdsDigiPixel*)data);
}
S
T
E
P
 
7
For the FairRingSorterTask two methods have to be
overwritten: 
InitSorter
 and 
AddNewDataToTClonesArray
Here is an example of InitSorter:
And for AddNewDataToTClonesArray:
FairRingSorter* PndSdsDigiPixelSorterTask::InitSorter
 
(Int_t numberOfCells, Double_t widthOfCells)
{
   return new PndSdsDigiPixelRingSorter(numberOfCells, widthOfCells);
}
void PndSdsDigiPixelSorterTask::AddNewDataToTClonesArray
 
(FairTimeStamp* data)
{
 FairRootManager* ioman = FairRootManager::Instance();
 TClonesArray* myArray = ioman->GetTClonesArray (fOutputBranch);
 new ((*myArray)[myArray->GetEntries()])PndSdsDigiPixel
 
(*(PndSdsDigiPixel*)(data));
}
T
e
s
t
 
i
t
Compile it.
Add to your digi task the new sorter task after your
digitization task.
Run your digi macro.
Compare the sorted digis with the unsorted digis. In which
entry of the Tree are they stored?
What happens if you change the size of the RingSorter?
S
T
E
P
 
8
Add in your reco task header:
#include 
FairTSBufferFunctional.h“ 
and
BinaryFunctor* fFunctor; //!
In 
Init() 
of  your task cxx file add:
 
fFunctor = 
new
 StopTime();
In
 Exec() 
of Task:
S
T
E
P
 
8
At the end of 
Exec() 
add:
fHitarray->Sort();
fDigiArray->Delete();
S
T
E
P
 
9
To activate the reading back of the data via the functors you
have to add 
fRun->RunWithTimeStamps()
 in your reco
macro.
If you leave 
RunWithTimeStamps()
 away 
GetData(…)
returns the data as it is stored in the entries of your digi
branch
Run your macro.
What happens if you set RunWithTimeStamps or leave it
away?
What happens if you modify the functor parameters?
Test the other functor.
M
V
D
 
E
x
a
m
p
l
e
s
Examples of the time ordered simulation can be found in
/macro/mvd/TimeOrderedSim
To check that everything is working you should start a
TreeViewer and scan the TimeStamp variable of your data.
If it is randomized before your RingSorter and it is sorted
afterwards it works.
Slide Note
Embed
Share

Join the Helmholtz-Gemeinschaft for an immersive workshop on time-based simulation using PANDA Computing. Dive deep into computational techniques and applications to enhance your skills and expertise in the field. Explore the latest advancements and tools in simulation technology, and network with experts and peers. Don't miss this opportunity to expand your knowledge and stay ahead in the ever-evolving world of computing.

  • Simulation
  • Workshop
  • Computing
  • Technology
  • Helmholtz

Uploaded on Feb 22, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Mitglied der Helmholtz-Gemeinschaft Time-based simulation PANDA Computing Workshop - SUT 22. Februar 2025

  2. Time-Based Simulation Single Event 22. Februar 2025 Folie 2 Tobias Stockmanns

  3. Time-Based Simulation 20 MHz overlap 22. Februar 2025 Folie 3 Tobias Stockmanns

  4. Event Mixing (Mohammads work) MC Files: MC file does not know anything about time structure Back- ground Time structure is calculated in Digitization stage Digiti zation Many different signal files can be added to one background file Signal 1 Where the data is coming from is stored in EventHeader Event 0: from BG with time 50.3 from BG with time 72.4 Event 1: No overlap (pileup) of events . Event 102: from Signal 1 with time 10230.1 Signal 2 FairMixedFileSource does the job FairRoot/examples/simulation/Tutorial2/macros/create_digis_mixed.C 22. Februar 2025 Folie 4 Tobias Stockmanns

  5. How do events overlap? Problem: In the (usual) event-based simulation each event can be treated completely independent of each other and time between events does not play a role. This is not the reality in experiments: Sensor elements are still blocked from previous hits Electronic is still busy Hits too close in time cannot be distinguished Special problem for PANDA: Continuous beam with Poisson statistics many events with short time between them No hardware trigger 22. Februar 2025 Folie 5 Tobias Stockmanns

  6. Event Structure and Detector Response ev 1 ev 2 ev 3 time SciTil EMC MVD STT . . . = detector hits from different events 22. Februar 2025 Folie 6 Tobias Stockmanns

  7. Event Structure and Detector Response ev 1 ev 2 ev 3 time STT . . . = detector hits from different events 22. Februar 2025 Folie 7 Tobias Stockmanns

  8. Event Structure and Detector Response ev 1 ev 2 ev 3 time Wanted data structure STT Data structure in Tree Event 1 Event 2 Event 3 . . . = detector hits from different events 22. Februar 2025 Folie 8 Tobias Stockmanns

  9. Times to take into account EventTime EventTime [ns] 22. Februar 2025 Folie 9 Tobias Stockmanns

  10. Times to take into account EventTime 22. Februar 2025 Folie 10 Tobias Stockmanns

  11. Times to take into account EventTime S e n s o r 22. Februar 2025 Folie 11 Tobias Stockmanns

  12. Times to take into account EventTime TimeOfFlight S e n s o r 22. Februar 2025 Folie 12 Tobias Stockmanns

  13. Times to take into account EventTime U TimeOfFlight TimeStamp Uthr t TimeStamp S e n s o r Electronics 22. Februar 2025 Folie 13 Tobias Stockmanns

  14. Times to take into account EventTime Signal with different charge U TimeOfFlight TimeStamp Uthr t TimeStamp is charge dependent S e n s o r Electronics 22. Februar 2025 Folie 14 Tobias Stockmanns

  15. Times to take into account EventTime U TimeOfFlight TimeStamp Uthr t S e n s o r Electronics 22. Februar 2025 Folie 15 Tobias Stockmanns

  16. Times to take into account 2nd hit in same detector elemet EventTime U TimeOfFlight TimeStamp Uthr t S e n s o r Electronics 22. Februar 2025 Folie 16 Tobias Stockmanns

  17. Times to take into account EventTime Start Time U Active Time TimeOfFlight TimeStamp Uthr Start/ActiveTime t S e n s o r Electronics 22. Februar 2025 Folie 17 Tobias Stockmanns

  18. Dead Time Finite time required by a detector to process an event, during which no additional signal can be registered Two cases: detector is insensitive non-extendable/paralyzable detector stays sensitive extendable or paralyzable dead time (e.g. rate of a Geiger-M ller counter drops at at very high dosis) dead time 22. Februar 2025 Folie 18 Tobias Stockmanns

  19. Necessary Times 4 times necessary: Event Time Assigned to Events in digitization if fRun->SetEventMeanTime(Double_t) is set in the digi macro Value can be accessed in tasks via: FairRootManager::Instance()-> GetEventTime() 22. Februar 2025 Folie 19 Tobias Stockmanns

  20. Necessary Times 4 times necessary: Event Time Time-of-Flight: Automatically stored in the MC points of each detector 22. Februar 2025 Folie 20 Tobias Stockmanns

  21. Necessary Times 4 times necessary: Event Time Time-of-Flight Time Stamp: Time assigned to each detector hit (MANDATORY for PANDA!) Absolute time! (includes Event Time, ToF , Electornics) Resolution and offset depends on individuall detector 22. Februar 2025 Folie 21 Tobias Stockmanns

  22. Necessary Times 4 times necessary: Event Time Time-of-Flight Time Stamp Start/Active Time: Time window an event can influence any other event happening in the same detector element Strongly detector dependent What happens if a second hit occurs during the active time of a previous hit is strongly detector dependent (hit lost, new hit modified, old hit modified, new hits created, ) Absolute time! 22. Februar 2025 Folie 22 Tobias Stockmanns

  23. FairWriteoutBuffer Special buffer to store detector data between events You give the data you want to store an absolute time window this data is active in your detector and can influence later events. If the same detector element is hit a second time the data is modified. This is an abstract base class where you have to inherit from 22. Februar 2025 Folie 23 Tobias Stockmanns

  24. SORTING THE DATA 22. Februar 2025 Folie 24 Tobias Stockmanns

  25. Sorting the data It is essential for the later extraction of the data that it is sorted by its time stamp A base class for the sorter (FairRingSorter) and a base class for a sorter task (FairRingSorterTask) are already implemented in the software To use them you have to derive your own sorter classes from them and overwrite some methods 22. Februar 2025 Folie 25 Tobias Stockmanns

  26. Technical implementation Ring Sorter Number of storage cells given by the spread of the time stamps within the data stream Width of one storage cell given by time resolution of detector Storage Pointer position calculated numerically from time stamp 0-Element Pointer If a storage position is calculated which would override old data, the old data is saved to disk and the storage cell is freed 22. Februar 2025 Folie 26 Tobias Stockmanns

  27. Digi Data randomized Digi Data Stream Same color = same event Digi Index 22. Februar 2025 Folie 27 Tobias Stockmanns

  28. Digi Data randomized TimeStamp of Digi vs Index Time Stamp [ns] Digi Index 22. Februar 2025 Folie 28 Tobias Stockmanns

  29. Digi Data Sorted Digi Data Stream Same color = same event Digi Index 22. Februar 2025 Folie 29 Tobias Stockmanns

  30. Digi Data Sorted TimeStamp of Digi vs Index after sorting Time Stamp [ns] Digi Index 22. Februar 2025 Folie 30 Tobias Stockmanns

  31. READING BACK THE DATA 22. Februar 2025 Folie 31 Tobias Stockmanns

  32. Reading back data Reading back data is done via the FairRootManager Two different methods exists FairRootManager::GetData(BranchName, Functor, Parameter); FairRootManager::GetData(BranchName, StartFunctor, StartParam., StopFunctor, StopParam.); GetData with one functor/parameter runs always forward in time Data is only read once GetData with two sets of functor/parameter is able to get data within a time interval Data can be extracted many times Works only with special functors next page 22. Februar 2025 Folie 32 Tobias Stockmanns

  33. What is a Functor? A (binary)functor is a class with an operator() which takes two parameters as an input and has one output. In our case the parameters are FairTimeStamp*, double as input and bool as output. The functor is true if it gets data which does not fit into the selection criterion In this way you can define your own data selectors Existing examples: StopTime: Returns all data with a TimeStamp less than the given parameter TimeGap: Returns all data before a time gap larger than the given parameter For the GetData-Method with two functors the first has to be the StopTime - functor 22. Februar 2025 Folie 33 Tobias Stockmanns

  34. Data packaging Select data packages according to time gaps between digi clusters Works very well for detectors with precise time measurement Example: GEM Digis MC Truth Packages R. Karabowicz 22. Februar 2025 Folie 34 Tobias Stockmanns

  35. GEM Tracking Efficiency 87% for primaries with |p|>1GeV/c, compared to ~95% in event-based reconstruction R. Karabowitcz 22. Februar 2025 Folie 35 Tobias Stockmanns

  36. GEM Event Building Use the tracks start-time Tracks with start-time closer than 3 ns end up in one event (3ns come from the tracks start-times correlation), with event time set to a mean of constituent tracks start times Even one track can form an event Compare reconstructed event times with MC event times, if the difference is smaller than 5 ns the MC event is considered to be reconstructed R. Karabowicz 22. Februar 2025 Folie 36 Tobias Stockmanns

  37. Event Builder R. Karabowicz 22. Februar 2025 Folie 37 Tobias Stockmanns

  38. Event Builder R. Karabowicz 22. Februar 2025 Folie 38 Tobias Stockmanns

  39. Event Builder R. Karabowicz 22. Februar 2025 Folie 39 Tobias Stockmanns

  40. Event Builder R. Karabowicz 22. Februar 2025 Folie 40 Tobias Stockmanns

  41. GEM Event Reconstruction 10000 DPM events simulated 8165 events with reconstructable track in GEM tracker 7536 events Reconstructed (92.3%) 139 ghost events (1.8%) R. Karabowicz 22. Februar 2025 Folie 41 Tobias Stockmanns

  42. Event Display Event selected by MVD via time gap STT hits matching to MVD time 22. Februar 2025 Folie 42 Tobias Stockmanns

  43. Event Building 22. Februar 2025 Folie 43 Tobias Stockmanns

  44. HOW TO IMPLEMENT IT 22. Februar 2025 Folie 44 Tobias Stockmanns

  45. STORING THE DATA 22. Februar 2025 Folie 45 Tobias Stockmanns

  46. STEP 1 Check the data object you want to store: Does it derive form FairTimeStamp ? Does it have an operator<< ? Does it have an bool operator< (const yourClass& name) const ? Does it have an equal(FairTimeStamp*) method? The equal method should return true if two identical detector elements are compared (e.g. the same pixel, pad, strip, straw, ) It should not check if the data in the element is identical as well An example can be found in PndSdsDigiPixel 22. Februar 2025 Folie 46 Tobias Stockmanns

  47. STEP 2 Derive your own buffer class from FairWriteoutBuffer In the class header you have to add: std::map<yourDataClass, double> fData_map; yourWriteoutBuffer::yourWriteoutBuffer(TString branchName, TString folderName, Bool_t persistance): FairWriteoutBuffer(branchName, yourDataClass", folderName, persistance) Implement the pure virtual methods: void AddNewDataToTClonesArray(FairTimeStamp* data) { FairRootManager* ioman = FairRootManager::Instance(); TClonesArray* myArray = ioman-> GetTClonesArray(fBranchName); new ((*myArray)[myArray->GetEntries()]) yourclass(*(yourclass*)(data)); } Double FindTimeForData(FairTimeStamp* data) { std::map<yourclass, double>::itertor it; yourclass myData = *(yourclass)data; it = fData_map.find(myData); if (it == fData_map.end()) return -1; else return it->second; } 22. Februar 2025 Folie 47 Tobias Stockmanns

  48. STEP 2b Implement the pure virtual methods: void FillDataMap(FairTimeStamp* data, double activeTime) { yourclass myData = *(yourclass*)data; fData_Map[myData] = activeTime; } void EraseDataFromDataMap(FairTimeStamp* data) { yourclass myData = *(yourclass*)data; if (fData_map.find(myData) != fData_map.end()) fData_map.erase(fData_map.find(myData)); } 22. Februar 2025 Folie 48 Tobias Stockmanns

  49. Modify Overwrite Modify( ) if you want to have a different PileUp behavior (optional) Modify( )is called if data should be written into the buffer of an element which already exists in the buffer (e.g. same pixel hit a second time) The standard behavior is that the new data is just ignored Input is the old data already in the buffer and the new data which goes into the buffer Output is a vector of data which will be stored in the buffer plus the new active time of the data 22. Februar 2025 Folie 49 Tobias Stockmanns

  50. STEP 3 Open your digi task: Add to the header file: YourWriteoutBuffer* yourBufferName; void RunTimeBased(){fTimeOrderedDigi = kTRUE;} Bool_t fTimeOrderedDigi; Replace in Init() the creation of the TClonesArray for your data class by:: yourBufferName = new YourWriteoutBuffer(OutputBranchName, FolderName, Persistance); yourBufferName = (YourWriteoutBuffer*)ioman-> RegisterWriteoutBuffer(OutputBranchName, youBufferName); yourBufferName->ActivateBuffering(fTimeOrderedDigi); 22. Februar 2025 Folie 50 Tobias Stockmanns

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#