]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/util/AliHLTESDCaloClusterMaker.cxx
19956dceb0963d6812aee5aee7f500d26d277e4b
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTESDCaloClusterMaker.cxx
1
2 /**************************************************************************
3  * This file is property of and copyright by the ALICE HLT Project        * 
4  * All rights reserved.                                                   *
5  *                                                                        *
6  * Primary Authors: Oystein Djuvsland                                     *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          * 
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17
18 /** 
19  * @file   AliHLTESDCaloClusterMaker.cxx
20  * @author Oystein Djuvsland
21  * @date 
22  * @brief  ESD Calo Cluster maker for  HLT 
23  */
24
25 // see header file for class documentation
26 // or
27 // refer to README to build package
28 // or 
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
30
31 #include "AliESDEvent.h"
32 #include "AliHLTESDCaloClusterMaker.h"
33 #include "AliHLTCaloClusterDataStruct.h"
34 #include "AliHLTCaloClusterReader.h"
35 #include "AliESDCaloCluster.h"
36 #include <iostream>
37
38 ClassImp(AliHLTESDCaloClusterMaker);
39
40 AliHLTESDCaloClusterMaker::AliHLTESDCaloClusterMaker() : 
41   fClusterReaderPtr(0)
42 {
43   //See header file for documentation
44   fClusterReaderPtr = new AliHLTCaloClusterReader();
45
46 }
47
48 AliHLTESDCaloClusterMaker::~AliHLTESDCaloClusterMaker()
49 {
50   //See header file for documentation
51
52 }
53
54 Int_t 
55 AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr)
56 {
57   // See header file for documentation
58
59   AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
60
61   fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
62
63   Int_t nClusters = 0;
64
65   while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
66     {
67       AliESDCaloCluster esdCluster;
68
69       esdCluster.SetID(caloClusterStructPtr->fID);
70       esdCluster.SetClusterType(caloClusterStructPtr->fClusterType);
71       esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos));
72       esdCluster.SetE(caloClusterStructPtr->fEnergy);
73       esdCluster.SetTOF(caloClusterStructPtr->fTOF);
74       esdCluster.SetClusterDisp(caloClusterStructPtr->fDispersion);
75       esdCluster.SetClusterChi2(caloClusterStructPtr->fFitQuality);
76 //      esdCluster.SetPid((Float_t*)(caloClusterStructPtr->fPID));
77       esdCluster.SetM20(caloClusterStructPtr->fM20);
78       esdCluster.SetM02(caloClusterStructPtr->fM02);
79       esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
80       esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
81       esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
82       esdCluster.SetNCells(caloClusterStructPtr->fNCells);
83       //      UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
84       //      Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
85       for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
86         {
87           //      fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
88         }
89       //      esdCluster.SetCellsAbsId(idArrayPtr);
90       //      esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
91
92       printf("Cluster energy: %f\n", esdCluster.E());
93       
94       esdPtr->AddCaloCluster(&esdCluster);
95       nClusters++;
96     }
97   return nClusters;
98 }