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 "TIterator.h"
28 #include "Riostream.h"
30 ClassImp(AliEMCALTriggerData)
33 AliEMCALTriggerData::AliEMCALTriggerData() : TObject(),
44 for (Int_t i = 0; i < 2; i++)
46 fL0Patches[i] = new TClonesArray("AliEMCALTriggerPatch");
47 fL1GammaPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
48 fL1JetPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
51 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;
52 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;
56 AliEMCALTriggerData::~AliEMCALTriggerData()
59 for (Int_t i = 0; i < 2; i++)
61 if ( fL0Patches[i]) fL0Patches[i]->Delete();
62 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
63 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
68 void AliEMCALTriggerData::SetL0Region(Int_t i, const Int_t**& region)
73 AliError("Bad index!");
77 for (Int_t j=0;j<24;j++)
78 for (Int_t k=0;k<4;k++) fL0Region[i][j][k] = region[j][k];
82 void AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const
87 AliError("Bad index!");
94 patches = *fL0Patches[i];
97 patches = *fL1GammaPatches[i];
100 patches = *fL1JetPatches[i];
103 AliError("Unknown trigger type!");
109 TClonesArray* AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i) const
114 AliError("Bad index!");
121 return fL0Patches[i];
124 return fL1GammaPatches[i];
127 return fL1JetPatches[i];
130 AliError("Unknown trigger type!");
138 void AliEMCALTriggerData::SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches)
143 AliError("Bad index!");
147 if (patches.GetEntriesFast())
149 TClonesArray* arr = 0x0;
157 arr = fL1GammaPatches[i];
160 arr = fL1JetPatches[i];
163 AliError("Unknown trigger type!");
169 Int_t size = arr->GetSize() + patches.GetSize();
173 for (Int_t k = 0; k < patches.GetEntriesFast(); k++)
175 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>(patches.At(k));
176 new((*arr)[arr->GetEntriesFast()]) AliEMCALTriggerPatch(*p);
181 AliError("TClonesArray is NULL!");
187 void AliEMCALTriggerData::SetL1Region(Int_t i, Int_t**& region)
192 AliError("Bad index!");
196 for (Int_t j = 0; j < 48; j++)
197 for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = region[j][k];
201 void AliEMCALTriggerData::GetL1Region(Int_t i, Int_t arr[][64]) const
206 AliError("Bad index!");
210 for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) { arr[j][k] = fL1Region[i][j][k]; }
215 void AliEMCALTriggerData::Scan() const
221 printf("\tFound (%2d,%2d) patches\n", fL0Patches[1]->GetEntriesFast(), fL0Patches[0]->GetEntriesFast());
223 nP = fL0Patches[1]->MakeIterator();
224 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
226 nP = fL0Patches[0]->MakeIterator();
227 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
229 printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[1]->GetEntriesFast(), fL1GammaPatches[0]->GetEntriesFast());
231 nP = fL1GammaPatches[1]->MakeIterator();
232 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
234 nP = fL1GammaPatches[0]->MakeIterator();
235 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
236 printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[1]->GetEntriesFast(), fL1JetPatches[0]->GetEntriesFast());
238 nP = fL1JetPatches[1]->MakeIterator();
239 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
241 nP = fL1JetPatches[0]->MakeIterator();
242 while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
246 void AliEMCALTriggerData::Reset()
249 for (Int_t i = 0; i < 2; i++)
251 if ( fL0Patches[i]) fL0Patches[i]->Delete();
252 if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
253 if ( fL1JetPatches[i]) fL1JetPatches[i]->Delete();
256 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;