EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CbmMCObject.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file CbmMCObject.cxx
1
/*
2
* CbmMCObject.cpp
3
*
4
* Created on: Dec 1, 2009
5
* Author: stockman
6
*/
7
8
#include "
CbmMCObject.h
"
9
10
ClassImp
(
CbmMCObject
);
11
12
CbmMCObject::CbmMCObject
()
13
:
TObject
(),
14
fStage(),
15
fStageId()
16
{
17
//std::cout << "-I- CbmMCObject::CbmMCObject : Use of default constructor" << std::endl;
18
}
19
20
CbmMCObject::~CbmMCObject
() {
21
// TODO Auto-generated destructor stub
22
}
23
24
25
void
CbmMCObject::SetEntry
(
CbmMCEntry
entry){
26
if
(entry.
GetPos
() < 0){
27
std::cout <<
"-E- CbmMCObject::SetEntry(CbmMCEntry): pos "
<< entry.
GetPos
() << std::endl;
28
return
;
29
}
30
AdoptSize
(entry.
GetPos
());
31
fStage
[entry.
GetPos
()] = entry;
32
}
33
34
void
CbmMCObject::SetEntry
(std::vector<Int_t> type, std::vector<Int_t> link,
int
index){
35
CbmMCEntry
myEntry;
36
myEntry.
SetPos
(index);
37
for
(
int
i = 0; i < type.size(); i++){
38
myEntry.
AddLink
(
FairLink
(type[i],link[i]));
39
}
40
SetEntry
(myEntry);
41
}
42
43
void
CbmMCObject::SetEntry
(
FairMultiLinkedData
*
data
,
int
index)
44
{
45
AdoptSize
(index);
46
fStage
[index].SetLinks(data->
GetLinks
());
47
}
48
49
void
CbmMCObject::SetLink
(
FairLink
link,
int
index)
50
{
51
if
(index <
fStage
.size()){
52
fStage
[index].Reset();
53
}
54
AddLink
(link, index);
55
}
56
57
58
void
CbmMCObject::AddLink
(
FairLink
link,
int
index)
59
{
60
AdoptSize
(index);
61
fStage
[index].AddLink(link);
62
//std::cout << "AddLink " << index << ": "<< fStageDet[index][fStageDet[index].size()-1] << " " << fStageHit[index][fStageHit[index].size()-1] << std::endl;
63
}
64
65
void
CbmMCObject::AdoptSize
(
int
index){
66
int
start
=
fStage
.size();
67
while
(
fStage
.size() < index+1){
68
CbmMCEntry
myVec;
69
myVec.
SetPos
(
fStage
.size());
70
myVec.
SetSource
(
GetStageId
());
71
//std::pair<int,int> myPair(fStageId, start);
72
//myVec.AddLink(myPair);
73
fStage
.push_back(myVec);
74
start++;
75
}
76
}
77
78
FairMultiLinkedData
CbmMCObject::PosInList
(
FairLink
link){
79
FairMultiLinkedData
result;
80
for
(
int
i = 0; i <
fStage
.size(); i++){
81
if
(
fStage
[i].IsLinkInList(link.
GetType
(), link.
GetIndex
()))
82
result.
AddLink
(
FairLink
(
GetStageId
(), i));
83
}
84
return
result;
85
}
EicRoot
blob
master
cbmbase
CbmMCObject.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:33
using
1.8.2 with
EIC GitHub integration