BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CbmStsHitProducerIdeal.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmStsHitProducerIdeal source file -----
3
// ----- Created 10/01/06 by V. Friese -----
4
// -------------------------------------------------------------------------
5
#include "
CbmStsHitProducerIdeal.h
"
6
7
#include "
CbmStsHit.h
"
8
#include "CbmStsPoint.h"
9
#include "FairRootManager.h"
10
#include "
TClonesArray.h
"
11
12
#include <iostream>
13
14
using
std::cout;
15
using
std::endl;
16
17
// ----- Default constructor -------------------------------------------
18
CbmStsHitProducerIdeal::CbmStsHitProducerIdeal
()
19
:
FairTask
(
"Ideal STS Hit Producer"
)
20
,
fPointArray
(NULL)
21
,
fHitArray
()
22
{}
23
// -------------------------------------------------------------------------
24
25
// ----- Destructor ----------------------------------------------------
26
CbmStsHitProducerIdeal::~CbmStsHitProducerIdeal
() {}
27
// -------------------------------------------------------------------------
28
29
// ----- Public method Init --------------------------------------------
30
InitStatus
CbmStsHitProducerIdeal::Init
()
31
{
32
33
// Get RootManager
34
FairRootManager* ioman = FairRootManager::Instance();
35
if
(!ioman) {
36
cout <<
"-E- CbmStsHitProducerIdeal::Init: "
37
<<
"RootManager not instantised!"
<< endl;
38
return
kFATAL;
39
}
40
41
// Get input array
42
fPointArray
= (
TClonesArray
*)ioman->GetObject(
"StsPoint"
);
43
if
(!
fPointArray
) {
44
// cout << "-W- CbmStsHitProducerIdeal::Init: "<< "No STSPoint array!" << endl;
45
return
kERROR;
46
}
47
48
// Create and register output array
49
fHitArray
=
new
TClonesArray
(
"CbmStsHit"
);
50
ioman->Register(
"StsHit"
,
"STS"
,
fHitArray
,
kTRUE
);
51
52
cout <<
"-I- CbmStsHitProducerIdeal: Intialisation successfull"
<< endl;
53
return
kSUCCESS;
54
}
55
// -------------------------------------------------------------------------
56
57
// ----- Public method Exec --------------------------------------------
58
void
CbmStsHitProducerIdeal::Exec
(
Option_t
* opt)
59
{
60
61
// Reset output array
62
if
(!
fHitArray
)
63
Fatal
(
"Exec"
,
"No StsHit array"
);
64
65
// fHitArray->Clear();
66
fHitArray
->Delete();
67
68
// Declare some variables
69
CbmStsPoint
* point = NULL;
70
Int_t
detID = 0;
// Detector ID
71
Int_t
trackID = 0;
// Track index
72
Double_t
x, y, z;
// Position
73
Double_t
dx = 0.0001;
// Position error
74
TVector3
pos, dpos;
// Position and error vectors
75
76
// Loop over StsPoints
77
Int_t
nPoints =
fPointArray
->GetEntriesFast();
78
for
(
Int_t
iPoint = 0; iPoint < nPoints; iPoint++) {
79
point = (
CbmStsPoint
*)
fPointArray
->At(iPoint);
80
if
(!point)
81
continue
;
82
83
// Detector ID
84
detID = point->GetDetectorID();
85
86
// MCTrack ID
87
trackID = point->GetTrackID();
88
89
// Determine hit position (centre plane of station)
90
x = 0.5 * (point->
GetXOut
() + point->
GetXIn
());
91
y = 0.5 * (point->
GetYOut
() + point->
GetYIn
());
92
z = 0.5 * (point->
GetZOut
() + point->
GetZIn
());
93
94
// Create new hit
95
pos.
SetXYZ
(x, y, z);
96
dpos.
SetXYZ
(dx, dx, 0.);
97
new
((*fHitArray)[iPoint])
CbmStsHit
(detID, pos, dpos, 0., iPoint, -1);
98
99
}
// Loop over MCPoints
100
101
// Event summary
102
cout <<
"-I- CbmStsHitProducerIdeal: "
<< nPoints <<
" StsPoints, "
<< nPoints <<
" Hits created."
<< endl;
103
}
104
// -------------------------------------------------------------------------
CbmStsHitProducerIdeal.h
Int_t
int Int_t
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
Option_t
const char Option_t
TClonesArray.h
Fatal
void Fatal(const char *location, const char *msgfmt,...)
CbmStsHitProducerIdeal::~CbmStsHitProducerIdeal
~CbmStsHitProducerIdeal()
Destructor.
Definition
CbmStsHitProducerIdeal.cxx:26
CbmStsHitProducerIdeal::fHitArray
TClonesArray * fHitArray
Output array of CbmStsHits.
Definition
CbmStsHitProducerIdeal.h:44
CbmStsHitProducerIdeal::fPointArray
TClonesArray * fPointArray
Input array of CbmStsPoints.
Definition
CbmStsHitProducerIdeal.h:41
CbmStsHitProducerIdeal::Init
virtual InitStatus Init()
Virtual method Init.
Definition
CbmStsHitProducerIdeal.cxx:30
CbmStsHitProducerIdeal::CbmStsHitProducerIdeal
CbmStsHitProducerIdeal()
Default constructor.
Definition
CbmStsHitProducerIdeal.cxx:18
CbmStsHitProducerIdeal::Exec
virtual void Exec(Option_t *opt)
Virtual method Exec.
Definition
CbmStsHitProducerIdeal.cxx:58
CbmStsHit
Definition
CbmStsHit.h:27
CbmStsPoint
Definition
CbmStsPoint.h:23
CbmStsPoint::GetXIn
Double_t GetXIn() const
Accessors.
Definition
CbmStsPoint.h:64
CbmStsPoint::GetZOut
Double_t GetZOut() const
Definition
CbmStsPoint.h:69
CbmStsPoint::GetYOut
Double_t GetYOut() const
Definition
CbmStsPoint.h:68
CbmStsPoint::GetZIn
Double_t GetZIn() const
Definition
CbmStsPoint.h:66
CbmStsPoint::GetYIn
Double_t GetYIn() const
Definition
CbmStsPoint.h:65
CbmStsPoint::GetXOut
Double_t GetXOut() const
Definition
CbmStsPoint.h:67
FairTask
TClonesArray
TVector3
TVector3::SetXYZ
void SetXYZ(Double_t x, Double_t y, Double_t z)
CbmStsHit.h
detectors
sts
CbmStsHitProducerIdeal.cxx
Generated on
for BmnRoot by
1.17.0