]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALTriggerData.cxx
Fixed sprintf, so that the pointer address is printed correctly
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerData.cxx
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 purpeateose. It is      *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17  
18  
19 EMCal trigger data container
20 for persistency of produced data presently stored in TTreeD
21 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
22 */
23
24 #include "AliEMCALTriggerData.h"
25 #include "AliEMCALTriggerPatch.h"
26
27 ClassImp(AliEMCALTriggerData)
28
29 //_____________
30 AliEMCALTriggerData::AliEMCALTriggerData() : TObject(),
31 fL0Patches( new TClonesArray("AliEMCALTriggerPatch") ),
32 fL0NPatches(),
33 fL0RegionSize(0,0),
34 fL0SubRegionSize(0,0),
35 fL0PatchSize(0,0),
36 fL1GammaPatches( new TClonesArray("AliEMCALTriggerPatch") ),
37 fL1JetPatches( new TClonesArray("AliEMCALTriggerPatch") ),
38 fL1RegionSize(0,0),
39 fL1GammaPatchSize(0,0),
40 fL1GammaSubRegionSize(0,0),
41 fL1JetPatchSize(0,0),
42 fL1JetSubRegionSize(0,0)
43 {  
44         for (Int_t i=0;i<32;i++) fL0NPatches[i] = 0;
45         for (Int_t i=0;i<48;i++) for (Int_t j=0;j<64;j++) fL1Region[i][j] = 0;
46         
47         fL1V0[0] = fL1V0[1] = 0;
48 }
49
50 //_____________
51 AliEMCALTriggerData::~AliEMCALTriggerData()
52 {
53 }
54
55 //_____________
56 void AliEMCALTriggerData::SetL0Patches(Int_t i, const TClonesArray& patches)
57 {
58         Int_t new_size = patches.GetEntriesFast();
59         Int_t old_size = fL0Patches->GetEntriesFast();
60
61         fL0NPatches[i] = new_size;
62         
63         Int_t size = 0;
64         for (Int_t j=0;j<=i;j++) size += fL0NPatches[j];
65                 
66         fL0Patches->Expand( size );
67                         
68         for (Int_t j=0;j<new_size;j++)
69         {
70                 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>( patches.At(j) );
71                 new((*fL0Patches)[old_size+j]) AliEMCALTriggerPatch( *p );
72         }
73 }
74
75 //_____________
76 void AliEMCALTriggerData::SetL1GammaPatches(const TClonesArray& patches)
77 {
78         Int_t size = patches.GetEntriesFast();
79         fL1GammaPatches->Expand( size );
80
81         for (Int_t j=0;j<size;j++)
82         {
83                 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>( patches.At(j) );
84                 new((*fL1GammaPatches)[j]) AliEMCALTriggerPatch( *p );
85         }
86 }
87
88 //_____________
89 void AliEMCALTriggerData::SetL1JetPatches(const TClonesArray& patches)
90 {
91         Int_t size = patches.GetEntriesFast();
92         
93         fL1JetPatches->Expand( size );
94         
95         for (Int_t j=0;j<size;j++)
96         {
97                 AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>( patches.At(j) );
98                 new((*fL1JetPatches)[j]) AliEMCALTriggerPatch( *p );
99         }
100 }
101
102 //_____________
103 void AliEMCALTriggerData::SetL1Region(Int_t**& region)
104 {
105         //
106         for (Int_t i=0;i<48;i++)
107                 for (Int_t j=0;j<64;j++)
108                 {
109                         fL1Region[i][j] = region[i][j];
110                 }
111 }
112
113 //_____________
114 void AliEMCALTriggerData::SetL1V0(const Int_t*& arr)
115 {
116         for (Int_t i=0;i<2;i++) fL1V0[i] = arr[i];
117 }
118
119 //_____________
120 void AliEMCALTriggerData::Scan() const
121 {
122         //
123         printf("L0:\n");
124         for (Int_t i=0;i<32;i++) printf("\tFound %2d patches in TRU %2d\n",fL0NPatches[i],i);
125         
126         printf("L1:\n");
127         printf("\tRegion of size.....................(%2d,%2d)\n",int(fL1RegionSize.X()),int(fL1RegionSize.Y()));
128         printf("\tGamma sub-region size..............(%2d,%2d)\n",int(fL1GammaSubRegionSize.X()),int(fL1GammaSubRegionSize.Y()));
129         printf("\tJet sub-region size................(%2d,%2d)\n",int(fL1JetSubRegionSize.X()),int(fL1JetSubRegionSize.Y()));
130         printf("\tFound %4d gamma patches of size...(%2d,%2d)\n",fL1GammaPatches->GetEntriesFast(),int(fL1GammaPatchSize.X()),int(fL1GammaPatchSize.Y()));
131         printf("\tFound %4d jet patches of size.....(%2d,%2d)\n",fL1JetPatches->GetEntriesFast(),int(fL1JetPatchSize.X()),int(fL1JetPatchSize.Y()));
132 }
133
134 //_____________
135 void AliEMCALTriggerData::Reset()
136 {
137         //
138     if (fL0Patches)           fL0Patches->Delete(); 
139         if (fL1GammaPatches) fL1GammaPatches->Delete();
140         if (fL1JetPatches)     fL1JetPatches->Delete(); 
141
142         for (Int_t i=0;i<32;i++) fL0NPatches[i] = 0;
143         for (Int_t i=0;i<48;i++) for (Int_t j=0;j<64;j++) fL1Region[i][j] = 0;
144         fL1V0[0] = fL1V0[1] = 0;
145 }
146
147
148