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
PndMcCloner.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PndMcCloner.cxx
1
// -------------------------------------------------------------------------
2
// ----- PndMcCloner source file -----
3
// ----- Created 08/07/13 by S.Spataro -----
4
// -------------------------------------------------------------------------
5
6
#include "
PndMcCloner.h
"
7
8
#include "
PndMCTrack.h
"
9
10
#include "
FairRootManager.h
"
11
#include "
FairDetector.h
"
12
#include "
FairRun.h
"
13
#include "
FairRuntimeDb.h
"
14
15
#include "TClonesArray.h"
16
17
#include <iostream>
18
19
using
std::cout;
20
using
std::endl;
21
22
// ----- Default constructor -------------------------------------------
23
PndMcCloner::PndMcCloner
() :
FairTask
(
"Cloner of PndMCTrack"
) {}
24
// -------------------------------------------------------------------------
25
26
// ----- Destructor ----------------------------------------------------
27
PndMcCloner::~PndMcCloner
() { }
28
// -------------------------------------------------------------------------
29
30
// ----- Public method Init --------------------------------------------
31
InitStatus
PndMcCloner::Init
() {
32
33
cout <<
"-I- PndMcCloner::Init: "
34
<<
"INITIALIZATION *********************"
<< endl;
35
36
FairRun
* sim =
FairRun::Instance
();
37
FairRuntimeDb
* rtdb=sim->
GetRuntimeDb
();
38
39
// Get RootManager
40
FairRootManager
* ioman =
FairRootManager::Instance
();
41
if
( ! ioman ) {
42
cout <<
"-E- PndMcCloner::Init: "
43
<<
"RootManager not instantiated!"
<< endl;
44
return
kFATAL
;
45
}
46
47
// Get input array
48
fInputArray
= (TClonesArray*) ioman->
GetObject
(
"MCTrack"
);
49
if
( !
fInputArray
) {
50
cout <<
"-W- PndMcCloner::Init: "
51
<<
"No MCTrack array!"
<< endl;
52
return
kERROR
;
53
}
54
55
// Create and register output array
56
fOutputArray
=
new
TClonesArray(
"PndMCTrack"
);
57
58
ioman->
Register
(
"MCTrack"
,
"MC"
,
fOutputArray
,kTRUE);
59
60
cout <<
"-I- PndMcCloner: Intialization successfull"
<< endl;
61
62
return
kSUCCESS
;
63
64
}
65
// -------------------------------------------------------------------------
66
67
68
69
// ----- Public method Exec --------------------------------------------
70
void
PndMcCloner::Exec
(Option_t* opt) {
71
72
// Reset output array
73
if
( !
fOutputArray
) Fatal(
"Exec"
,
"No Output Array"
);
74
75
fOutputArray
->Clear();
76
77
Int_t nMcTracks =
fInputArray
->GetEntriesFast();
78
for
(Int_t iMc=0; iMc<nMcTracks; iMc++)
79
{
80
PndMCTrack
*mctrack = (
PndMCTrack
*)
fInputArray
->At(iMc);
81
TClonesArray& clref = *
fOutputArray
;
82
Int_t size = clref.GetEntriesFast();
83
new
(clref[size])
PndMCTrack
(*mctrack);
84
85
}
// Loop over MCTracks
86
87
}
88
// -------------------------------------------------------------------------
89
90
/*
91
// ----- Private method AddHit --------------------------------------------
92
PndHit* PndMcCloner::AddHit(Int_t detID, TVector3& pos, TVector3& dpos, Int_t index){
93
// It fills the PndHit category
94
95
TClonesArray& clref = *fHitArray;
96
Int_t size = clref.GetEntriesFast();
97
return new(clref[size]) PndHit(detID, pos, dpos, index);
98
}
99
// ----
100
101
*/
102
ClassImp
(
PndMcCloner
)
EicRoot
blob
master
PndTools
generalTools
PndMcCloner.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:37
using
1.8.2 with
EIC GitHub integration