]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSESDMaker.cxx
Selectiv readout and writing to FXS (oystein)
[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       //cout << caloCluster << endl;
107       //cout << "Cells = " << caloClusterStruct->fNCells << endl;
108       caloCluster->SetID(caloClusterStruct->fID);
109       caloCluster->SetClusterType(caloClusterStruct->fClusterType);
110       caloCluster->SetPosition((Float_t*)&caloClusterStruct->fGlobalPos[0]);
111       caloCluster->SetE(caloClusterStruct->fEnergy);
112       caloCluster->SetClusterDisp(caloClusterStruct->fDispersion);
113       caloCluster->SetClusterChi2(caloClusterStruct->fFitQuality);
114       caloCluster->SetPid((Float_t*)&caloClusterStruct->fPID[0]);
115       caloCluster->SetM20(caloClusterStruct->fM20);
116       caloCluster->SetM02(caloClusterStruct->fM02);
117       caloCluster->SetM11(caloClusterStruct->fM11);
118       caloCluster->SetNExMax(caloClusterStruct->fNExMax);
119       caloCluster->SetEmcCpvDistance(caloClusterStruct->fEmcCpvDistance);
120       caloCluster->SetDistanceToBadChannel(caloClusterStruct->fDistToBadChannel);
121       caloCluster->SetNCells(caloClusterStruct->fNCells);
122       caloCluster->SetCellsAbsId(caloClusterStruct->fCellsAbsId);
123       caloCluster->SetCellsAmplitudeFraction(caloClusterStruct->fCellsAmpFraction);
124       fESDEventPtr->AddCaloCluster(caloCluster);
125       //cout << caloCluster->E() << endl;
126       fNCaloClusters++;  
127     }
128   
129   return 0;
130 }
131 Int_t
132 AliHLTPHOSESDMaker::FillESDEvent(AliHLTPHOSCaloClusterContainerStruct* caloClusterContainerPtr)
133 {
134   //See header file for documentation
135   
136   AliESDCaloCluster *caloCluster = 0;
137   AliHLTPHOSCaloClusterDataStruct* caloClusterStruct = 0;
138   
139   for(UInt_t i = 0; i < 1/*caloClusterContainerPtr->fNCaloClusters*/; i++)
140     {
141       //      caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i + fNCaloClusters);
142       //caloCluster = (AliESDCaloCluster*)fCaloClustersPtr->New(i + fNCaloClusters);
143       /*      caloClusterStruct = &(caloClusterContainerPtr->fCaloClusterArray[i]);
144       caloCluster->SetID(caloClusterStruct->fID);
145       caloCluster->SetClusterType(caloClusterStruct->fClusterType);
146       caloCluster->SetPosition((Float_t*)&caloClusterStruct->fGlobalPos[0]);
147       caloCluster->SetE(caloClusterStruct->fEnergy);
148       caloCluster->SetClusterDisp(caloClusterStruct->fDispersion);
149       caloCluster->SetClusterChi2(caloClusterStruct->fFitQuality);
150       caloCluster->SetPid((Float_t*)&caloClusterStruct->fPID[0]);
151       caloCluster->SetM20(caloClusterStruct->fM20);
152       caloCluster->SetM02(caloClusterStruct->fM02);
153       caloCluster->SetM11(caloClusterStruct->fM11);
154       caloCluster->SetNExMax(caloClusterStruct->fNExMax);
155       caloCluster->SetEmcCpvDistance(caloClusterStruct->fEmcCpvDistance);
156       caloCluster->SetDistanceToBadChannel(caloClusterStruct->fDistToBadChannel);
157       caloCluster->SetNCells(caloClusterStruct->fNCells);
158       caloCluster->SetCellsAbsId(caloClusterStruct->fCellsAbsId);
159       caloCluster->SetCellsAmplitudeFraction(caloClusterStruct->fCellsAmpFraction);
160       fESDEventPtr->AddCaloCluster(caloCluster);
161       //cout << caloCluster->E() << endl;*/
162       fNCaloClusters++;  
163     }
164   
165   return 0;
166 }
167
168 void 
169 AliHLTPHOSESDMaker::ResetESD()
170 {
171   fNCaloClusters = 0;
172   // fCaloClustersPtr->Delete();
173 }
174