put different cluster parameters (time, n cells, n SM) in the AOD particle, recover...
[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"
de39a0ff 28
29ClassImp(AliEMCALTriggerRawDigit)
30
31//____________________________________________________________________________
32AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit() : AliEMCALRawDigit(),
a61738e1 33fTriggerBits(0),
de39a0ff 34fNL0Times(0),
35fL0Times(),
36fL1TimeSum(-1)
37{
38 // default ctor
39 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
40}
41
42//____________________________________________________________________________
43AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : AliEMCALRawDigit(id, timeSamples, nSamples),
a61738e1 44fTriggerBits(0),
de39a0ff 45fNL0Times(0),
46fL0Times(),
47fL1TimeSum(-1)
48{
79b05051 49 // Ctor
50
de39a0ff 51 for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
52}
53
54//____________________________________________________________________________
55AliEMCALTriggerRawDigit::~AliEMCALTriggerRawDigit()
56{
79b05051 57 // Dtor
58
de39a0ff 59 //delete [] fL0Times;
60}
61
62//____________________________________________________________________________
63Bool_t AliEMCALTriggerRawDigit::SetL0Time(const Int_t i)
64{
79b05051 65 // Set L0 times
66
de39a0ff 67 for (Int_t j = 0; j < fNL0Times; j++)
68 {
69 if (i == fL0Times[j])
70 {
804b828a 71 AliDebug(1,Form("Digit id %d: L0 time %d already there! Won't add it twice",fId,i));
de39a0ff 72 return kFALSE;
73 }
74 }
75
76 fNL0Times++;
77
78 if (fNL0Times > 9)
79 {
80 AliError("More than 10 L0 times!");
81 return kFALSE;
82 }
83
84 fL0Times[fNL0Times - 1] = i;
85
86 return kTRUE;
87}
88
89//____________________________________________________________________________
90Bool_t AliEMCALTriggerRawDigit::GetL0Time(const Int_t i, Int_t& time) const
91{
79b05051 92 // Get L0 times
93
de39a0ff 94 if (i < 0 || i > fNL0Times)
95 {
96 AliError("Bad index!");
97 return kFALSE;
98 }
99
100 time = fL0Times[i];
101
102 return kTRUE;
103}
104
105//____________________________________________________________________________
106Bool_t AliEMCALTriggerRawDigit::GetL0Times(Int_t times[]) const
107{
79b05051 108 // Get L0 times
109
de39a0ff 110 for (Int_t i = 0; i < fNL0Times; i++) times[i] = fL0Times[i];
111
112 return kTRUE;
113}
114
115//____________________________________________________________________________
116Int_t AliEMCALTriggerRawDigit::GetL0TimeSum(const Int_t time) const
117{
79b05051 118 // Get L0 time sum
de39a0ff 119
120 Int_t value = 0;
121
122 for (Int_t i = 0; i < fNSamples; i++)
123 {
124 Int_t timeBin, amp;
125 GetTimeSample(i, timeBin, amp);
126
127 if (timeBin >= time && timeBin < time + 4) value += amp;
128 }
129
130 return value;
131}
132
133//____________________________________________________________________________
a61738e1 134Int_t AliEMCALTriggerRawDigit::GetTriggerBit(const TriggerType_t type, const Int_t mode) const
135{
79b05051 136 // Get trigger bit
137
a61738e1 138 Int_t shift = kTriggerTypeEnd * mode;
139 Int_t mask = 1 << type;
140
141 return ((fTriggerBits >> shift) & mask);
142}
143
144//____________________________________________________________________________
de39a0ff 145void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
146{
79b05051 147 // Dump
148
de39a0ff 149 printf("===\n| Digit id: %4d / %d Time Samples: \n",fId,fNSamples);
150 for (Int_t i=0; i < fNSamples; i++)
151 {
152 Int_t timeBin, amp;
153 GetTimeSample(i, timeBin, amp);
154 printf("| (%d,%d) ",timeBin,amp);
155 }
156 printf("\n");
a61738e1 157 printf("| L0: (%d,%d) / %d Time(s): \n",GetTriggerBit(kL0,1),GetTriggerBit(kL0,0),fNL0Times);
de39a0ff 158 for (Int_t i = 0; i < fNL0Times; i++)
159 {
160 Int_t time;
161 if (GetL0Time(i, time)) printf("| %d ",time);
162 }
163 printf("\n");
63c22917 164 printf("| L1: g high (%d,%d) g low (%d,%d) j high (%d,%d) j low (%d,%d) / Time sum: %d\n",
165 GetTriggerBit(kL1GammaHigh,1),GetTriggerBit(kL1GammaHigh,0),GetTriggerBit(kL1GammaLow,1),GetTriggerBit(kL1GammaLow,0),
166 GetTriggerBit(kL1JetHigh,1), GetTriggerBit(kL1JetHigh,0), GetTriggerBit(kL1JetLow,1), GetTriggerBit(kL1JetLow,0),
167 fL1TimeSum);
de39a0ff 168}
169