]>
Commit | Line | Data |
---|---|---|
61f6b45e | 1 | //////////////////////////////////////////////////////////////////////////// |
2 | // // | |
3 | // TRD PID/Track summary info for performance // | |
4 | // // | |
5 | // Authors: // | |
6 | // Alexandru Bercuci <A.Bercuci@gsi.de> // | |
7 | // // | |
8 | //////////////////////////////////////////////////////////////////////////// | |
9 | ||
b91fdd71 | 10 | #include "AliTRDpidInfo.h" |
11 | #include "AliTRDgeometry.h" | |
12 | ||
13 | #include "string.h" | |
14 | ||
15 | ClassImp(AliTRDpidInfo) | |
16 | ClassImp(AliTRDpidInfo::AliTRDpidData) | |
17 | ||
18 | //________________________________________________________________________ | |
19 | AliTRDpidInfo::AliTRDpidData::AliTRDpidData() : fPLbin(0xff) | |
20 | { | |
21 | memset(fdEdx, 0, 8*sizeof(Float_t)); | |
22 | } | |
23 | ||
24 | //________________________________________________________________________ | |
4826d5b1 | 25 | AliTRDpidInfo::AliTRDpidInfo() |
26 | :TObject() | |
27 | ,fPID(-1) | |
28 | ,fNtracklets(0) | |
b91fdd71 | 29 | ,fData(0x0) |
30 | { | |
31 | // Constructor of data array | |
32 | fData = new AliTRDpidData[AliTRDgeometry::kNlayer]; | |
33 | } | |
34 | ||
a5a3321d | 35 | //________________________________________________________________________ |
36 | AliTRDpidInfo::AliTRDpidInfo(Int_t idx) | |
37 | :TObject() | |
38 | ,fPID(idx) | |
39 | ,fNtracklets(0) | |
40 | ,fData(0x0) | |
41 | { | |
42 | // Constructor of data array | |
43 | fData = new AliTRDpidData[AliTRDgeometry::kNlayer]; | |
44 | } | |
45 | ||
b91fdd71 | 46 | //________________________________________________________________________ |
47 | AliTRDpidInfo::~AliTRDpidInfo() | |
48 | { | |
49 | // Destructor | |
4826d5b1 | 50 | if(fData) delete [] fData; |
51 | } | |
52 | ||
53 | //________________________________________________________________________ | |
54 | AliTRDpidInfo::AliTRDpidData const* AliTRDpidInfo::GetDataInLayer(Int_t ily) const | |
55 | { | |
61f6b45e | 56 | // Extract PID raw signals for layer "ily" |
4826d5b1 | 57 | if(!fData) return NULL; |
58 | if(ily<0 || ily>=AliTRDgeometry::kNlayer) return NULL; | |
59 | ||
60 | AliTRDpidData *data(NULL); | |
61 | for(Int_t itrklt=fNtracklets; itrklt--;){ | |
62 | if(!(data=&fData[itrklt])) return NULL; | |
63 | if(data->Layer()==ily) return data; | |
64 | } | |
65 | return NULL; | |
b91fdd71 | 66 | } |
67 | ||
68 | //________________________________________________________________________ | |
a5a3321d | 69 | void AliTRDpidInfo::PushBack(Int_t ly, Int_t p, const Float_t *dedx) |
b91fdd71 | 70 | { |
71 | // Add PID data to the end of the array | |
72 | fData[fNtracklets].fPLbin= (ly<<4) | (p&0xf); | |
73 | memcpy(fData[fNtracklets].fdEdx, dedx, 8*sizeof(Float_t)); | |
74 | fNtracklets++; | |
75 | } | |
76 | ||
77 | //________________________________________________________________________ | |
78 | void AliTRDpidInfo::Reset() | |
79 | { | |
80 | // Reset content | |
81 | ||
82 | if(!fNtracklets) return; | |
83 | while(fNtracklets--){ | |
84 | fData[fNtracklets].fPLbin = 0xff; | |
85 | memset(fData[fNtracklets].fdEdx, 0, 8*sizeof(Float_t)); | |
86 | } | |
87 | fNtracklets=0; | |
4826d5b1 | 88 | fPID=-1; |
b91fdd71 | 89 | } |
90 |