Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / ITS / AliITSOnlineSPDfoInfo.cxx
1 /**************************************************************************
2  * Copyright(c) 2008-2010, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
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 /* $Id$ */
17
18 ////////////////////////////////////////////////////////////////
19 // Author: A. Mastroserio                                     // 
20 // This class is used within the detector algorithm framework //
21 // to collect information on how the scan was arranged.       //
22 ////////////////////////////////////////////////////////////////
23
24 #include "AliITSOnlineSPDfoInfo.h"
25 #include "AliLog.h"
26
27 ClassImp(AliITSOnlineSPDfoInfo)
28   
29 //_____________________________________________________________________
30 AliITSOnlineSPDfoInfo::AliITSOnlineSPDfoInfo(): 
31  fRunNumber(0), fRouter(999), fNumTriggers(0),
32  fDBversion(0), fNumDACindex(0), fDACindex(0),
33  fActiveChipsAndHS()
34 {
35 for(Int_t i=0; i<60; i++) fActiveChipsAndHS.SetBitNumber(i,kFALSE);
36 }
37 //_____________________________________________________________________
38 AliITSOnlineSPDfoInfo::~AliITSOnlineSPDfoInfo() 
39 {}
40 //_____________________________________________________________________
41 void AliITSOnlineSPDfoInfo::ClearThis() {
42   // reset all values for this object
43   fRunNumber=0;
44   fRouter=999;
45   fNumTriggers=0;
46   fDBversion=0;
47   fNumDACindex=0;
48   fDACindex.Reset();
49   for(Int_t i=0; i<60; i++) fActiveChipsAndHS.SetBitNumber(i,kFALSE);
50 }
51 //_____________________________________________________________________
52 void AliITSOnlineSPDfoInfo::AddDACindex(Short_t index) {
53   // add a new DAC index, allocate space for TArrayS
54   fNumDACindex++;
55   fDACindex.Set(fNumDACindex);
56   fDACindex.AddAt(index, fNumDACindex-1);
57 }
58 //_____________________________________________________________________
59 Short_t AliITSOnlineSPDfoInfo::GetDACindex(UShort_t id) const {
60   // returns the DAC index at position id of TArrayS
61   if (id>=fNumDACindex) return -1;
62   else                  return fDACindex.At(id);
63 }
64 //_____________________________________________________________________
65 Bool_t AliITSOnlineSPDfoInfo::IsActiveHS(UInt_t hs) const {
66   Bool_t isHS =kFALSE;
67   for(Int_t iChip =0; iChip<10; iChip++) isHS = IsActiveChip(hs,iChip);
68   return isHS;
69 }
70 //_____________________________________________________________________
71 Bool_t AliITSOnlineSPDfoInfo::IsActiveChip(UInt_t hs, UInt_t chip) const {
72   if(hs > 5 || chip > 9) {
73     AliError(Form("hs %i or  chip %i  is out of range [hs=0-5  chip=0=9]\n",hs,chip));
74   return kFALSE;
75   }
76   return fActiveChipsAndHS.TestBitNumber(10*hs+chip);
77 }
78 //_____________________________________________________________________
79