Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaTrackingDetector.cxx
Go to the documentation of this file.
1
//*-- Author : Ole Hansen 7-Sep-00
2
4
//
5
// THaTrackingDetector
6
//
7
// Abstract base class for a generic tracking detector.
8
//
9
// This is a special THaSpectrometerDetector that is capable of
10
// finding particle tracks. It does not need to find track vertices
11
// (target coordinates) - this is usually done by the enclosing apparatus.
12
//
13
// Note: The FPP is NOT a "tracking detector" in this scheme because,
14
// with the present FPP algorithms, it is not used for calculating the
15
// fp coordinates.
16
//
18
19
#include "
TClonesArray.h
"
20
#include "
THaTrackingDetector.h
"
21
#include "
THaPIDinfo.h
"
22
#include "
THaTrack.h
"
23
#include "
THaSpectrometer.h
"
24
#include "
TError.h
"
25
26
ClassImp
(
THaTrackingDetector
)
27
28
//_____________________________________________________________________________
29
THaTrackingDetector::THaTrackingDetector
(
const
char
* name,
30
const
char
* description,
31
THaApparatus
* apparatus )
32
:
THaSpectrometerDetector
(
name
,description,apparatus)
33
{
34
// Constructor
35
36
}
37
38
//_____________________________________________________________________________
39
THaTrackingDetector::THaTrackingDetector
( )
40
:
THaSpectrometerDetector
( )
41
{
42
// Constructor for ROOT I/O only
43
}
44
45
//_____________________________________________________________________________
46
THaTrackingDetector::~THaTrackingDetector
() =
default
;
47
48
//_____________________________________________________________________________
49
THaTrack
*
THaTrackingDetector::AddTrack
(
TClonesArray
& tracks,
50
Double_t
x,
Double_t
y,
51
Double_t
theta,
Double_t
phi,
52
THaTrackID
* ID )
53
{
54
// Add a track with the given parameters to the array of tracks
55
// Returns the index of the created track in the TClonesArray.
56
57
Int_t
i =
tracks
.GetLast()+1;
58
THaPIDinfo
* pid =
nullptr
;
59
auto
* spect =
static_cast<
THaSpectrometer
*
>
(
GetApparatus
() );
60
61
if
( spect ) {
62
if
( spect->IsPID() ) {
63
// Create new PIDinfo and vertex objects if necessary
64
65
UInt_t
ndet = spect->
GetNpidDetectors
();
66
UInt_t
npart = spect->GetNpidParticles();
67
TClonesArray
&
c
= *spect->GetTrackPID();
68
69
// caution: c[i] creates an empty object at i if slot i was empty,
70
// so use At(i) to check.
71
72
if
( i >
c
.GetLast() || !
c
.At(i) )
new
(
c
[i])
THaPIDinfo
(ndet, npart);
73
pid =
static_cast<
THaPIDinfo
*
>
(
c
.At(i) );
74
}
75
}
else
if
(
fDebug
>0 ) {
76
::Warning(
"THaTrackingDetector::AddTrack"
,
"No spectrometer defined for "
77
"detector %s. Track has no PID and vertex info."
,
GetName
());
78
}
79
80
// Create the track
81
82
return
new
(
tracks
[i] )
THaTrack
(
x
,
y
, theta, phi,
this
, ID, pid );
83
84
}
85
Int_t
int Int_t
UInt_t
unsigned int UInt_t
c
#define c(i)
Double_t
double Double_t
TClonesArray.h
TError.h
name
char name[80]
THaPIDinfo.h
THaSpectrometer.h
THaTrack.h
THaTrackingDetector.h
TClonesArray
THaAnalysisObject::fDebug
Int_t fDebug
Definition
THaAnalysisObject.h:114
THaApparatus
Definition
THaApparatus.h:16
THaDetector::GetApparatus
THaApparatus * GetApparatus() const
Definition
THaDetector.cxx:42
THaPIDinfo
Definition
THaPIDinfo.h:18
THaSpectrometerDetector
Definition
THaSpectrometerDetector.h:20
THaSpectrometer
Definition
THaSpectrometer.h:25
THaSpectrometer::GetNpidDetectors
Int_t GetNpidDetectors() const
Definition
THaSpectrometer.h:145
THaTrackID
Definition
THaTrackID.h:12
THaTrack
Definition
THaTrack.h:21
THaTrackingDetector
Definition
THaTrackingDetector.h:16
THaTrackingDetector::AddTrack
virtual THaTrack * AddTrack(TClonesArray &tracks, Double_t x, Double_t y, Double_t theta, Double_t phi, THaTrackID *ID=nullptr)
Definition
THaTrackingDetector.cxx:49
THaTrackingDetector::THaTrackingDetector
THaTrackingDetector()
Definition
THaTrackingDetector.cxx:39
THaTrackingDetector::~THaTrackingDetector
virtual ~THaTrackingDetector()
TNamed::GetName
const char * GetName() const override
y
Double_t y[n]
x
Double_t x[n]
ClassImp
ClassImp(TPyArg)
tracks
void tracks()
Podd
THaTrackingDetector.cxx
Generated by
1.9.8