CbmRoot
Loading...
Searching...
No Matches
PairAnalysisMixedEvent.cxx
Go to the documentation of this file.
1
2
// //
3
// //
4
// Authors:
5
// * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
6
// Julian Book <Julian.Book@cern.ch>
7
/*
8
9
Small event keeping holding track arrays and the event data.
10
11
*/
12
// //
14
15
#include "
PairAnalysisMixedEvent.h
"
16
17
#include <TExMap.h>
18
#include <TObjArray.h>
19
#include <TProcessID.h>
20
21
#include "
PairAnalysisTrack.h
"
22
23
ClassImp
(
PairAnalysisMixedEvent
)
24
25
PairAnalysisMixedEvent::PairAnalysisMixedEvent
()
26
:
PairAnalysisMixedEvent
(
"mixedevent"
,
"mixed event"
)
27
{
28
//
29
// Default Constructor
30
//
31
}
32
33
//______________________________________________
34
PairAnalysisMixedEvent::PairAnalysisMixedEvent
(
const
char
* name,
const
char
* title)
35
: TNamed(name, title)
36
, fArrTrackP()
37
, fArrTrackN()
38
{
39
//
40
// Named Constructor
41
//
42
for
(Int_t i = 0; i <
PairAnalysisVarManager::kNMaxValuesMC
; ++i)
43
fEventData
[i] = 0.;
44
}
45
46
//______________________________________________
47
PairAnalysisMixedEvent::~PairAnalysisMixedEvent
()
48
{
49
//
50
// Default Destructor
51
//
52
fArrTrackP
.Delete();
53
fArrTrackN
.Delete();
54
}
55
56
//______________________________________________
57
void
PairAnalysisMixedEvent::SetTracks
(
const
TObjArray& arrP,
const
TObjArray& arrN)
58
{
59
//
60
// Setup PairAnalysisPairs
61
// assumes that the objects in arrP and arrN are
62
//
63
64
//Clear out old entries before filling new ones
65
Clear
();
// check if this can be improved, by calling clear instead of removeat
66
67
// we keep the tracks buffered to minimise new / delete operations
68
fNTracksN
= 0;
69
fNTracksP
= 0;
70
71
//check size of the arrays
72
if
(
fArrTrackP
.GetSize() < arrP.GetSize()) {
fArrTrackP
.Expand(arrP.GetSize()); }
73
if
(
fArrTrackN
.GetSize() < arrN.GetSize()) {
fArrTrackN
.Expand(arrN.GetSize()); }
74
75
TExMap mapStoredVertices;
76
fPIDIndex
= TProcessID::GetPIDs()->IndexOf(
fPID
);
77
// fill particles
78
Int_t
tracks
= 0;
79
for
(Int_t itrack = 0; itrack < arrP.GetEntriesFast(); ++itrack) {
80
PairAnalysisTrack
* track =
dynamic_cast<
PairAnalysisTrack
*
>
(arrP.At(itrack));
81
if
(!track)
continue
;
82
83
// buffer track
84
// PairAnalysisTrack *ctrack = new (fArrTrackP[tracks]) PairAnalysisTrack(*track);
85
new
(
fArrTrackP
[
tracks
])
PairAnalysisTrack
(*track);
86
87
++
tracks
;
88
}
89
fNTracksP
=
tracks
;
90
91
tracks
= 0;
92
for
(Int_t itrack = 0; itrack < arrN.GetEntriesFast(); ++itrack) {
93
PairAnalysisTrack
* track =
dynamic_cast<
PairAnalysisTrack
*
>
(arrN.At(itrack));
94
if
(!track)
continue
;
95
96
//buffer track
97
// PairAnalysisTrack *ctrack = new (fArrTrackN[tracks]) PairAnalysisTrack(*track);
98
new
(
fArrTrackN
[
tracks
])
PairAnalysisTrack
(*track);
99
100
++
tracks
;
101
}
102
fNTracksN
=
tracks
;
103
}
104
105
//______________________________________________
106
void
PairAnalysisMixedEvent::Clear
(Option_t* opt)
107
{
108
//
109
// clear arrays
110
//
111
fArrTrackP
.Clear(opt);
112
fArrTrackN
.Clear(opt);
113
}
114
115
//______________________________________________
116
void
PairAnalysisMixedEvent::Set
(Int_t
size
)
117
{
118
//
119
// set size of array
120
//
121
fArrTrackP
.SetClass(
"PairAnalysisTrack"
,
size
);
122
fArrTrackN
.SetClass(
"PairAnalysisTrack"
,
size
);
123
}
124
125
//______________________________________________
126
void
PairAnalysisMixedEvent::SetEventData
(
const
Double_t data[
PairAnalysisVarManager::kNMaxValuesMC
])
127
{
128
//
129
// copy only evnet variables
130
//
131
for
(Int_t i =
PairAnalysisVarManager::kPairMax
; i <
PairAnalysisVarManager::kNMaxValuesMC
; ++i)
132
fEventData
[i] = data[i];
133
}
134
135
//______________________________________________
136
void
PairAnalysisMixedEvent::AssignID
(TObject* obj)
137
{
138
//
139
// Custom function to assign a uid to an object with an own process id
140
// to avoid problems buffering the vertices
141
//
142
UInt_t uid = 1;
143
if
(
fPID
->GetObjects()) uid =
fPID
->GetObjects()->GetEntriesFast();
144
uid += (
fPIDIndex
<< 24);
145
obj->SetBit(kIsReferenced);
146
obj->SetUniqueID(uid);
147
fPID
->PutObjectWithID(obj);
148
}
tracks
TClonesArray * tracks
Definition
Analyze_matching.h:21
size
static constexpr size_t size()
Definition
KfSimdPseudo.h:2
ClassImp
ClassImp(PairAnalysisMixedEvent) PairAnalysisMixedEvent
Definition
PairAnalysisMixedEvent.cxx:23
PairAnalysisMixedEvent.h
PairAnalysisTrack.h
PairAnalysisMixedEvent
Definition
PairAnalysisMixedEvent.h:24
PairAnalysisMixedEvent::fNTracksN
Int_t fNTracksN
Definition
PairAnalysisMixedEvent.h:54
PairAnalysisMixedEvent::~PairAnalysisMixedEvent
virtual ~PairAnalysisMixedEvent()
Definition
PairAnalysisMixedEvent.cxx:47
PairAnalysisMixedEvent::Clear
virtual void Clear(Option_t *opt="C")
Definition
PairAnalysisMixedEvent.cxx:106
PairAnalysisMixedEvent::AssignID
void AssignID(TObject *obj)
Definition
PairAnalysisMixedEvent.cxx:136
PairAnalysisMixedEvent::PairAnalysisMixedEvent
PairAnalysisMixedEvent()
PairAnalysisMixedEvent::fNTracksP
Int_t fNTracksP
Definition
PairAnalysisMixedEvent.h:53
PairAnalysisMixedEvent::SetTracks
void SetTracks(const TObjArray &arrP, const TObjArray &arrN)
Definition
PairAnalysisMixedEvent.cxx:57
PairAnalysisMixedEvent::Set
void Set(Int_t size=100)
Definition
PairAnalysisMixedEvent.cxx:116
PairAnalysisMixedEvent::SetEventData
void SetEventData(const Double_t data[PairAnalysisVarManager::kNMaxValuesMC])
Definition
PairAnalysisMixedEvent.cxx:126
PairAnalysisMixedEvent::fPIDIndex
UInt_t fPIDIndex
internal PID for references to buffered objects
Definition
PairAnalysisMixedEvent.h:59
PairAnalysisMixedEvent::fEventData
Double_t fEventData[PairAnalysisVarManager::kNMaxValuesMC]
Definition
PairAnalysisMixedEvent.h:56
PairAnalysisMixedEvent::fArrTrackN
TClonesArray fArrTrackN
Definition
PairAnalysisMixedEvent.h:51
PairAnalysisMixedEvent::fArrTrackP
TClonesArray fArrTrackP
Definition
PairAnalysisMixedEvent.h:50
PairAnalysisMixedEvent::fPID
TProcessID * fPID
Definition
PairAnalysisMixedEvent.h:58
PairAnalysisTrack
Definition
PairAnalysisTrack.h:41
PairAnalysisVarManager::kPairMax
@ kPairMax
Definition
PairAnalysisVarManager.h:259
PairAnalysisVarManager::kNMaxValuesMC
@ kNMaxValuesMC
Definition
PairAnalysisVarManager.h:368
analysis
PWGDIL
dielectron
papaframework
PairAnalysisMixedEvent.cxx
Generated on Sun Dec 22 2024 23:04:06 for CbmRoot by
1.12.0