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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 EMCal trigger data container
20 for data (both raw & rec) persistency
21 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
24 #include "AliEMCALTriggerData.h"
25 #include "AliEMCALTriggerPatch.h"
27 #include "Riostream.h"
29 ClassImp(AliEMCALTriggerData)
32 AliEMCALTriggerData::AliEMCALTriggerData() : TObject(),
43 for (Int_t i = 0; i < 2; i++)
45 fL0Patches[i] = new TClonesArray("AliEMCALTriggerPatch");
46 fL1GammaPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
47 fL1JetPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
50 for (Int_t i = 0; i < 32; i++) for (Int_t j = 0; j < 24; j++) for (Int_t k = 0; k < 4; k++) fL0Region[i][j][k] = 0;
51 for (Int_t i = 0; i < 2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;
55 AliEMCALTriggerData::~AliEMCALTriggerData()
58 for (Int_t i = 0; i < 2; i++)
60 if ( fL0Patches[i]) fL0Patches[i]->Delete();
61 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
62 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
67 void AliEMCALTriggerData::SetL0Region(Int_t i, const Int_t**& region)
72 AliError("Bad index!");
76 for (Int_t j=0;j<24;j++)
77 for (Int_t k=0;k<4;k++) fL0Region[i][j][k] = region[j][k];
81 void AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const
86 AliError("Bad index!");
93 patches = *fL0Patches[i];
96 patches = *fL1GammaPatches[i];
99 patches = *fL1JetPatches[i];
102 AliError("Unknown trigger type!");
108 TClonesArray* AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i) const
113 AliError("Bad index!");
120 return fL0Patches[i];
123 return fL1GammaPatches[i];
126 return fL1JetPatches[i];
129 AliError("Unknown trigger type!");
137 void AliEMCALTriggerData::SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches)
142 AliError("Bad index!");
146 if (patches.GetEntriesFast())
148 TClonesArray* arr = 0x0;
156 arr = fL1GammaPatches[i];
159 arr = fL1JetPatches[i];
162 AliError("Unknown trigger type!");
168 Int_t size = arr->GetSize() + patches.GetSize();
172 for (Int_t k = 0; k < patches.GetEntriesFast(); k++)
174 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>(patches.At(k));
175 new((*arr)[arr->GetEntriesFast()]) AliEMCALTriggerPatch(*p);
180 AliError("TClonesArray is NULL!");
186 void AliEMCALTriggerData::SetL1Region(Int_t i, Int_t**& region)
191 AliError("Bad index!");
195 for (Int_t j = 0; j < 48; j++)
196 for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = region[j][k];
200 void AliEMCALTriggerData::GetL1Region(Int_t i, Int_t arr[][64]) const
205 AliError("Bad index!");
209 for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) { arr[j][k] = fL1Region[i][j][k]; }
214 void AliEMCALTriggerData::Scan() const
218 printf("\tFound (%2d , %2d) patches\n", fL0Patches[0]->GetEntriesFast(), fL0Patches[1]->GetEntriesFast());
220 printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[0]->GetEntriesFast(), fL1GammaPatches[1]->GetEntriesFast());
221 printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[0]->GetEntriesFast(), fL1JetPatches[1]->GetEntriesFast());
225 void AliEMCALTriggerData::Reset()
228 for (Int_t i = 0; i < 2; i++)
230 if ( fL0Patches[i]) fL0Patches[i]->Delete();
231 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
232 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
235 for (Int_t i = 0; i < 2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;