]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSESDMaker.cxx
Standard logging
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSESDMaker.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        * 
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors: Oystein Djuvsland                                     *
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  * @file   AliHLTPHOSESDMaker.cxx
18  * @author Oystein Djuvsland
19  * @date 
20  * @brief  ESD maker for PHOS HLT 
21  */
22
23 // see header file for class documentation
24 // or
25 // refer to README to build package
26 // or 
27 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
28
29 #include "AliHLTPHOSESDMaker.h"
30 #include "AliHLTPHOSCaloClusterContainerStruct.h"
31 #include "AliHLTPHOSBase.h"
32 #include "AliHLTPHOSCaloClusterDataStruct.h"
33 #include "AliESDEvent.h"
34 #include "AliESDCaloCluster.h"
35 #include "TClonesArray.h"
36
37 ClassImp(AliHLTPHOSESDMaker);
38
39 AliHLTPHOSESDMaker::AliHLTPHOSESDMaker() : 
40   AliHLTPHOSBase(),
41   fNCaloClusters(0),
42   fCaloClustersPtr(0),
43   fESDEventPtr(0),
44   fCaloClusterContainerPtr(0)
45 {
46   //See header file for documentation
47   fCaloClustersPtr = new TClonesArray("AliESDCaloCluster", 0);
48 }
49
50 AliHLTPHOSESDMaker::~AliHLTPHOSESDMaker()
51 {
52   //See header file for documentation
53   if(fCaloClustersPtr)
54     {
55       //fCaloClustersPtr->Delete();
56       //fCaloClustersPtr = 0;
57     }
58 }
59
60 Int_t
61 AliHLTPHOSESDMaker::FillESDCaloClusters()
62 {
63   //See header file for documentation
64
65   AliESDCaloCluster *caloCluster = 0;
66   AliHLTPHOSCaloClusterDataStruct* caloClusterStruct = 0;
67
68   for(UInt_t i = 0; i < fCaloClusterContainerPtr->fNCaloClusters; i++)
69     {
70       caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->At(i + fNCaloClusters);
71       caloClusterStruct = &(fCaloClusterContainerPtr->fCaloClusterArray[i]);
72       caloCluster->SetID(caloClusterStruct->fID);
73       caloCluster->SetClusterType(caloClusterStruct->fClusterType);
74       caloCluster->SetPosition((Float_t*)&caloClusterStruct->fGlobalPos[0]);
75       caloCluster->SetE(caloClusterStruct->fEnergy);
76       caloCluster->SetClusterDisp(caloClusterStruct->fDispersion);
77       caloCluster->SetClusterChi2(caloClusterStruct->fFitQuality);
78       caloCluster->SetPid((Float_t*)&caloClusterStruct->fPID[0]);
79       caloCluster->SetM20(caloClusterStruct->fM20);
80       caloCluster->SetM02(caloClusterStruct->fM02);
81       caloCluster->SetM11(caloClusterStruct->fM11);
82       caloCluster->SetNExMax(caloClusterStruct->fNExMax);
83       caloCluster->SetEmcCpvDistance(caloClusterStruct->fEmcCpvDistance);
84       caloCluster->SetDistanceToBadChannel(caloClusterStruct->fDistToBadChannel);
85       caloCluster->SetNCells(caloClusterStruct->fNCells);
86       caloCluster->SetCellsAbsId(caloClusterStruct->fCellsAbsId);
87       caloCluster->SetCellsAmplitudeFraction(caloClusterStruct->fCellsAmpFraction);
88       fNCaloClusters++;
89     }
90
91   return 0;
92 }
93
94 Int_t
95 AliHLTPHOSESDMaker::FillESDEvent()
96 {
97   //See header file for documentation
98   
99   AliESDCaloCluster *caloCluster = 0;
100   AliHLTPHOSCaloClusterDataStruct* caloClusterStruct = 0;
101   for(UInt_t i = 0; i < fCaloClusterContainerPtr->fNCaloClusters; i++)
102     {
103       //      caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i + fNCaloClusters);
104       caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i);
105       caloClusterStruct = &(fCaloClusterContainerPtr->fCaloClusterArray[i]);
106
107       caloCluster->SetID(caloClusterStruct->fID);
108       caloCluster->SetClusterType(caloClusterStruct->fClusterType);
109       caloCluster->SetPosition((Float_t*)&caloClusterStruct->fGlobalPos[0]);
110       caloCluster->SetE(caloClusterStruct->fEnergy);
111       caloCluster->SetClusterDisp(caloClusterStruct->fDispersion);
112       caloCluster->SetClusterChi2(caloClusterStruct->fFitQuality);
113       caloCluster->SetPid((Float_t*)&caloClusterStruct->fPID[0]);
114       caloCluster->SetM20(caloClusterStruct->fM20);
115       caloCluster->SetM02(caloClusterStruct->fM02);
116       caloCluster->SetM11(caloClusterStruct->fM11);
117       caloCluster->SetNExMax(caloClusterStruct->fNExMax);
118       caloCluster->SetEmcCpvDistance(caloClusterStruct->fEmcCpvDistance);
119       caloCluster->SetDistanceToBadChannel(caloClusterStruct->fDistToBadChannel);
120       caloCluster->SetNCells(caloClusterStruct->fNCells);
121       caloCluster->SetCellsAbsId(caloClusterStruct->fCellsAbsId);
122       caloCluster->SetCellsAmplitudeFraction(caloClusterStruct->fCellsAmpFraction);
123       fESDEventPtr->AddCaloCluster(caloCluster);
124       fNCaloClusters++;  
125     }
126   
127   return 0;
128 }
129 Int_t
130 AliHLTPHOSESDMaker::FillESDEvent(AliHLTPHOSCaloClusterContainerStruct* caloClusterContainerPtr)
131 {
132   //See header file for documentation
133
134   caloClusterContainerPtr--;
135   caloClusterContainerPtr++;
136   
137   //  AliESDCaloCluster *caloCluster = 0;
138   //  AliHLTPHOSCaloClusterDataStruct* caloClusterStruct = 0;
139   
140   for(UInt_t i = 0; i < 1/*caloClusterContainerPtr->fNCaloClusters*/; i++)
141     {
142       //      caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i + fNCaloClusters);
143       //caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i + fNCaloClusters);
144       /*      caloClusterStruct = &(caloClusterContainerPtr->fCaloClusterArray[i]);
145       caloCluster->SetID(caloClusterStruct->fID);
146       caloCluster->SetClusterType(caloClusterStruct->fClusterType);
147       caloCluster->SetPosition((Float_t*)&caloClusterStruct->fGlobalPos[0]);
148       caloCluster->SetE(caloClusterStruct->fEnergy);
149       caloCluster->SetClusterDisp(caloClusterStruct->fDispersion);
150       caloCluster->SetClusterChi2(caloClusterStruct->fFitQuality);
151       caloCluster->SetPid((Float_t*)&caloClusterStruct->fPID[0]);
152       caloCluster->SetM20(caloClusterStruct->fM20);
153       caloCluster->SetM02(caloClusterStruct->fM02);
154       caloCluster->SetM11(caloClusterStruct->fM11);
155       caloCluster->SetNExMax(caloClusterStruct->fNExMax);
156       caloCluster->SetEmcCpvDistance(caloClusterStruct->fEmcCpvDistance);
157       caloCluster->SetDistanceToBadChannel(caloClusterStruct->fDistToBadChannel);
158       caloCluster->SetNCells(caloClusterStruct->fNCells);
159       caloCluster->SetCellsAbsId(caloClusterStruct->fCellsAbsId);
160       caloCluster->SetCellsAmplitudeFraction(caloClusterStruct->fCellsAmpFraction);
161       fESDEventPtr->AddCaloCluster(caloCluster);
162        */
163       fNCaloClusters++;  
164     }
165   
166   return 0;
167 }
168
169 void 
170 AliHLTPHOSESDMaker::ResetESD()
171 {
172   fNCaloClusters = 0;
173   // fCaloClustersPtr->Delete();
174 }
175