prepare PID LQ ref maker for production
[u/mrichter/AliRoot.git] / PWG1 / TRD / info / AliTRDpidInfo.cxx
1 #include "AliTRDpidInfo.h"
2 #include "AliTRDgeometry.h"
3
4 #include "string.h"
5
6 ClassImp(AliTRDpidInfo)
7 ClassImp(AliTRDpidInfo::AliTRDpidData)
8
9 //________________________________________________________________________
10 AliTRDpidInfo::AliTRDpidData::AliTRDpidData() : fPLbin(0xff) 
11 {
12   memset(fdEdx, 0, 8*sizeof(Float_t));
13 }
14
15 //________________________________________________________________________
16 AliTRDpidInfo::AliTRDpidInfo() : 
17   TObject()
18   , fNtracklets(0)
19   ,fData(0x0)
20 {
21   // Constructor of data array
22   fData = new AliTRDpidData[AliTRDgeometry::kNlayer];
23 }
24
25 //________________________________________________________________________
26 AliTRDpidInfo::~AliTRDpidInfo()
27 {
28   // Destructor
29   delete [] fData;
30 }
31
32 //________________________________________________________________________
33 void AliTRDpidInfo::PushBack(Int_t ly, Int_t p, Float_t *dedx)
34 {
35 // Add PID data to the end of the array 
36   fData[fNtracklets].fPLbin= (ly<<4) | (p&0xf);
37   memcpy(fData[fNtracklets].fdEdx, dedx, 8*sizeof(Float_t));
38   fNtracklets++;
39 }
40
41 //________________________________________________________________________
42 void AliTRDpidInfo::Reset()
43 {
44 // Reset content
45
46   if(!fNtracklets) return;
47   while(fNtracklets--){
48     fData[fNtracklets].fPLbin = 0xff;
49     memset(fData[fNtracklets].fdEdx, 0, 8*sizeof(Float_t));
50   }
51   fNtracklets=0;
52 }
53