- moved digit struct to BASE/util to facilitate for ESD conversion in the global...
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTESDCaloClusterMaker.cxx
CommitLineData
7fc04b67 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
38ClassImp(AliHLTESDCaloClusterMaker);
39
40AliHLTESDCaloClusterMaker::AliHLTESDCaloClusterMaker() :
41 fClusterReaderPtr(0)
42{
43 //See header file for documentation
44 fClusterReaderPtr = new AliHLTCaloClusterReader();
45
46}
47
48AliHLTESDCaloClusterMaker::~AliHLTESDCaloClusterMaker()
49{
50 //See header file for documentation
51
52}
53
54Int_t
55AliHLTESDCaloClusterMaker::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);
b4479a87 76// esdCluster.SetPid((Float_t*)(caloClusterStructPtr->fPID));
7fc04b67 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);
b210e538 83 // UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
84 // Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
7fc04b67 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
b4479a87 92 printf("Cluster energy: %f\n", esdCluster.E());
93
7fc04b67 94 esdPtr->AddCaloCluster(&esdCluster);
95 nClusters++;
96 }
97 return nClusters;
98}