1 /////////////////////////////////////////////////////////////////////
2 // Author: Henrik Tydesjo //
4 // This class is used to store information on generated Fast-OR //
5 // signals. 1200 bits, one per pixel chip. //
7 /////////////////////////////////////////////////////////////////////
9 #include "AliITSFOSignalsSPD.h"
11 ClassImp(AliITSFOSignalsSPD)
13 AliITSFOSignalsSPD::AliITSFOSignalsSPD() :
14 TObject(), fSignals(1200)
16 // default constructor
18 //______________________________________________________________________
19 AliITSFOSignalsSPD::~AliITSFOSignalsSPD() {}
20 //______________________________________________________________________
21 AliITSFOSignalsSPD::AliITSFOSignalsSPD(const AliITSFOSignalsSPD& fo):
22 TObject(), fSignals(fo.fSignals)
26 //______________________________________________________________________
27 AliITSFOSignalsSPD& AliITSFOSignalsSPD::operator=(const AliITSFOSignalsSPD& fo) {
28 // assignment operator
30 fSignals = fo.fSignals;
34 //______________________________________________________________________
35 void AliITSFOSignalsSPD::SetSignal(UInt_t eq, UInt_t hs, UInt_t chip, Bool_t setVal) {
36 // Set 0 or 1 for a specific chip
37 fSignals.SetBitNumber(GetChipKey(eq,hs,chip),setVal);
39 //______________________________________________________________________
40 Bool_t AliITSFOSignalsSPD::GetSignal(UInt_t eq, UInt_t hs, UInt_t chip) const {
41 // check if a specific chip has a signal
42 return fSignals.TestBitNumber(GetChipKey(eq,hs,chip));
44 //______________________________________________________________________
45 Bool_t AliITSFOSignalsSPD::GetNextSignal(Int_t& eq, Int_t& hs, Int_t& chip) const {
46 // Returns true if a signal was found (start looking after the bit number
47 // corresponding to the input parameters eq,hs,chip).
48 // If either of eq,hs,chip < 0 , start from beginning of TBits array.
49 // See example of usage in DumpSignals method.
51 if (eq<0 || hs<0 || chip<0) searchIndex = 0;
52 else searchIndex = GetChipKey(eq, hs, chip) + 1;
53 UInt_t nextIndex = fSignals.FirstSetBit(searchIndex);
54 if (nextIndex==1200) return kFALSE;
55 GetChipFromKey(nextIndex, eq, hs, chip);
58 //__________________________________________________________________________________
59 void AliITSFOSignalsSPD::DumpSignals() {
60 // print a list of the chips which have a signal
61 printf("These chips (given in eq,hs,chip) have a signal:\n");
66 while (GetNextSignal(eq,hs,chip)) {
67 printf("%d,%d,%d\n",eq,hs,chip);
70 printf("In total %d signals.\n",nrSignals);
72 //______________________________________________________________________
73 UInt_t AliITSFOSignalsSPD::GetChipKey(Int_t eq, Int_t hs, Int_t chip) const {
74 // translates eq,hs,chip numbers into one integer key (0-1199)
75 if (eq>=20 || eq<0 || hs>=6 || hs<0 || chip>=10 || chip<0) {
76 Error("AliITSFOSignalsSPD::GetChipKey", "eq,hs,chip = %d,%d,%d out of range",eq,hs,chip);
79 return eq*60 + hs*10 + chip;
81 //__________________________________________________________________________________
82 void AliITSFOSignalsSPD::GetChipFromKey(UInt_t key, Int_t& eq, Int_t& hs, Int_t& chip) const {
83 // translates a chip key back into eq,hs,chip numbers
85 Error("AliITSFOSignalsSPD::GetChipFromKey", "key = %d out of range", key);