]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALTriggerRawDigit.cxx
Changes for #82873: Module debugging broken (Christian)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerRawDigit.cxx
CommitLineData
de39a0ff 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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/*
17
18
19
20 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
21*/
22
23// --- ROOT system ---AliEMCALTriggerRawDigit
24#include <Riostream.h>
25#include <TMath.h>
26
27#include "AliEMCALTriggerRawDigit.h"
28#include "AliLog.h"
29
30ClassImp(AliEMCALTriggerRawDigit)
31
32//____________________________________________________________________________
33AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit() : AliEMCALRawDigit(),
a61738e1 34fTriggerBits(0),
de39a0ff 35fNL0Times(0),
36fL0Times(),
37fL1TimeSum(-1)
38{
39 // default ctor
40 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
41}
42
43//____________________________________________________________________________
44AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : AliEMCALRawDigit(id, timeSamples, nSamples),
a61738e1 45fTriggerBits(0),
de39a0ff 46fNL0Times(0),
47fL0Times(),
48fL1TimeSum(-1)
49{
50 //
51 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
52}
53
54//____________________________________________________________________________
55AliEMCALTriggerRawDigit::~AliEMCALTriggerRawDigit()
56{
57 //
58 //delete [] fL0Times;
59}
60
61//____________________________________________________________________________
62Bool_t AliEMCALTriggerRawDigit::SetL0Time(const Int_t i)
63{
64 //
65 for (Int_t j = 0; j < fNL0Times; j++)
66 {
67 if (i == fL0Times[j])
68 {
69 AliWarning("L0 time already there! Won't add it twice");
70 return kFALSE;
71 }
72 }
73
74 fNL0Times++;
75
76 if (fNL0Times > 9)
77 {
78 AliError("More than 10 L0 times!");
79 return kFALSE;
80 }
81
82 fL0Times[fNL0Times - 1] = i;
83
84 return kTRUE;
85}
86
87//____________________________________________________________________________
88Bool_t AliEMCALTriggerRawDigit::GetL0Time(const Int_t i, Int_t& time) const
89{
90 //
91 if (i < 0 || i > fNL0Times)
92 {
93 AliError("Bad index!");
94 return kFALSE;
95 }
96
97 time = fL0Times[i];
98
99 return kTRUE;
100}
101
102//____________________________________________________________________________
103Bool_t AliEMCALTriggerRawDigit::GetL0Times(Int_t times[]) const
104{
105 //
de39a0ff 106 for (Int_t i = 0; i < fNL0Times; i++) times[i] = fL0Times[i];
107
108 return kTRUE;
109}
110
111//____________________________________________________________________________
112Int_t AliEMCALTriggerRawDigit::GetL0TimeSum(const Int_t time) const
113{
114 //
115
116 Int_t value = 0;
117
118 for (Int_t i = 0; i < fNSamples; i++)
119 {
120 Int_t timeBin, amp;
121 GetTimeSample(i, timeBin, amp);
122
123 if (timeBin >= time && timeBin < time + 4) value += amp;
124 }
125
126 return value;
127}
128
a61738e1 129//____________________________________________________________________________
130Int_t AliEMCALTriggerRawDigit::GetTriggerBit(const TriggerType_t type, const Int_t mode) const
131{
132 //
133 Int_t shift = kTriggerTypeEnd * mode;
134 Int_t mask = 1 << type;
135
136 return ((fTriggerBits >> shift) & mask);
137}
138
de39a0ff 139//____________________________________________________________________________
140void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
141{
142 //
143 printf("===\n| Digit id: %4d / %d Time Samples: \n",fId,fNSamples);
144 for (Int_t i=0; i < fNSamples; i++)
145 {
146 Int_t timeBin, amp;
147 GetTimeSample(i, timeBin, amp);
148 printf("| (%d,%d) ",timeBin,amp);
149 }
150 printf("\n");
a61738e1 151 printf("| L0: (%d,%d) / %d Time(s): \n",GetTriggerBit(kL0,1),GetTriggerBit(kL0,0),fNL0Times);
de39a0ff 152 for (Int_t i = 0; i < fNL0Times; i++)
153 {
154 Int_t time;
155 if (GetL0Time(i, time)) printf("| %d ",time);
156 }
157 printf("\n");
a61738e1 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);
de39a0ff 160}
161