]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliAltroData.cxx
This is the gain detector algorithm that will calibrate the FMD.
[u/mrichter/AliRoot.git] / RAW / AliAltroData.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Author:  Per Thomas Hille  <perthi@fys.uio.no>                 *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          * 
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 #include "AliAltroData.h"
17 #include "AliAltroBunch.h"
18
19 ClassImp(AliAltroData)
20
21 AliAltroData::AliAltroData(): fData(0),
22                                     fBunchData(0),
23                                     fDataSize(0),
24                                     fWc(0),
25                                     fHadd(-1),
26                                     fPrevHadd(-1),
27                                     fBunchCounter(0),
28                                     fIsComplete(0)
29 {
30
31
32 }
33
34
35
36 AliAltroData::~AliAltroData()
37 {
38
39
40 }
41
42
43 /*
44 bool
45 //AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
46 AliAltroData::NextBunch(AliAltroBunch *altroBunch)
47 {
48   //comment
49   if(fIsComplete == true)
50     {
51
52       if(fBunchCounter == 0)
53         {
54           fBunchData = &fData[fDataSize - 1];
55           altroBunch->fData = &fData[fDataSize - 1];
56           
57         }
58
59       if(fWc < fDataSize)
60         {
61           fWc += *fBunchData;
62           altroBunch->fBunchSize = *fBunchData;
63           altroBunch->fBunchDataSize = altroBunch->fBunchSize  -2;
64
65           fBunchData --;
66           altroBunch->fEndTimeBin = *fBunchData;
67           fBunchData ++;
68
69           fBunchData = fBunchData  -  (altroBunch->fBunchSize);
70           altroBunch->fData = altroBunch->fData -  (altroBunch->fBunchSize);
71           fBunchCounter ++;
72           return true;
73
74         }
75       else
76         {
77           fBunchCounter = 0;
78           fWc = 0;
79           return false;
80         }
81     }
82   else
83     {
84       printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
85       printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
86       return false;
87     }
88 }
89
90 */
91
92
93
94
95 Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
96 {
97
98   if(fIsComplete == kTRUE)
99     {
100
101       if(fBunchCounter == 0)
102         {
103           fBunchData = &fData[fDataSize - 1];
104         }
105
106       if(fWc < fDataSize)
107         {
108           if(*fBunchData == 0){ fWc += 1;};
109           fWc += *fBunchData;
110           altroBunch->SetData(fData + fDataSize - fWc);
111           altroBunch->SetBunchSize(*fBunchData -2);
112           fBunchData --;
113           altroBunch->SetEndTimeBin( *fBunchData );
114           //      altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
115           fBunchData -= (altroBunch->GetBunchSize() +1);
116           fBunchCounter ++;
117           return kTRUE;
118         }
119       else
120         {
121           fBunchCounter = 0;
122           fWc = 0;
123           return kFALSE;
124         }
125     }
126   else
127     {
128       printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
129       printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
130       return kFALSE;
131     }
132
133 }
134
135
136
137 void AliAltroData::Reset()
138 {
139    fWc = 0;
140    fBunchCounter = 0;
141 }
142
143
144 Int_t AliAltroData::GetChannel() const
145 {
146  return  fHadd & 0xf;
147 }
148
149 Int_t AliAltroData::GetChip() const
150 {
151  return  (fHadd & 0x70) >> 4 ;
152 }
153
154 Int_t AliAltroData::GetCard() const
155 {
156  return   (fHadd & 0x780) >>  7;
157 }
158
159
160 Int_t AliAltroData::GetBranch() const
161 {
162  return   (fHadd & 0x800 ) >> 11;
163 }