1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
23 // --- ROOT system ---AliEMCALTriggerRawDigit
24 #include <Riostream.h>
27 #include "AliEMCALTriggerRawDigit.h"
30 ClassImp(AliEMCALTriggerRawDigit)
32 //____________________________________________________________________________
33 AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit() : AliEMCALRawDigit(),
40 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
43 //____________________________________________________________________________
44 AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : AliEMCALRawDigit(id, timeSamples, nSamples),
51 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
54 //____________________________________________________________________________
55 AliEMCALTriggerRawDigit::~AliEMCALTriggerRawDigit()
61 //____________________________________________________________________________
62 Bool_t AliEMCALTriggerRawDigit::SetL0Time(const Int_t i)
65 for (Int_t j = 0; j < fNL0Times; j++)
69 AliWarning("L0 time already there! Won't add it twice");
78 AliError("More than 10 L0 times!");
82 fL0Times[fNL0Times - 1] = i;
87 //____________________________________________________________________________
88 Bool_t AliEMCALTriggerRawDigit::GetL0Time(const Int_t i, Int_t& time) const
91 if (i < 0 || i > fNL0Times)
93 AliError("Bad index!");
102 //____________________________________________________________________________
103 Bool_t AliEMCALTriggerRawDigit::GetL0Times(Int_t times[]) const
106 for (Int_t i = 0; i < fNL0Times; i++) times[i] = fL0Times[i];
111 //____________________________________________________________________________
112 Int_t AliEMCALTriggerRawDigit::GetL0TimeSum(const Int_t time) const
118 for (Int_t i = 0; i < fNSamples; i++)
121 GetTimeSample(i, timeBin, amp);
123 if (timeBin >= time && timeBin < time + 4) value += amp;
129 //____________________________________________________________________________
130 Int_t AliEMCALTriggerRawDigit::GetTriggerBit(const TriggerType_t type, const Int_t mode) const
133 Int_t shift = kTriggerTypeEnd * mode;
134 Int_t mask = 1 << type;
136 return ((fTriggerBits >> shift) & mask);
139 //____________________________________________________________________________
140 void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
143 printf("===\n| Digit id: %4d / %d Time Samples: \n",fId,fNSamples);
144 for (Int_t i=0; i < fNSamples; i++)
147 GetTimeSample(i, timeBin, amp);
148 printf("| (%d,%d) ",timeBin,amp);
151 printf("| L0: (%d,%d) / %d Time(s): \n",GetTriggerBit(kL0,1),GetTriggerBit(kL0,0),fNL0Times);
152 for (Int_t i = 0; i < fNL0Times; i++)
155 if (GetL0Time(i, time)) printf("| %d ",time);
158 printf("| L1: g (%d,%d) j (%d,%d) / Time sum: %d\n",
159 GetTriggerBit(kL1Gamma,1),GetTriggerBit(kL1Gamma,0),GetTriggerBit(kL1Jet,1),GetTriggerBit(kL1Jet,0),fL1TimeSum);