restoring bachward compatibility for r42844
[u/mrichter/AliRoot.git] / HLT / BASE / util / AliHLTESDCaloClusterMaker.cxx
CommitLineData
d0bb5541 1//-*- Mode: C++ -*-
2// $Id$
7fc04b67 3
4/**************************************************************************
5 * This file is property of and copyright by the ALICE HLT Project *
6 * All rights reserved. *
7 * *
8 * Primary Authors: Oystein Djuvsland *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19
20/**
21 * @file AliHLTESDCaloClusterMaker.cxx
22 * @author Oystein Djuvsland
23 * @date
24 * @brief ESD Calo Cluster maker for HLT
25 */
26
27// see header file for class documentation
28// or
29// refer to README to build package
30// or
31// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
32
33#include "AliESDEvent.h"
34#include "AliHLTESDCaloClusterMaker.h"
35#include "AliHLTCaloClusterDataStruct.h"
36#include "AliHLTCaloClusterReader.h"
37#include "AliESDCaloCluster.h"
38#include <iostream>
39
40ClassImp(AliHLTESDCaloClusterMaker);
41
42AliHLTESDCaloClusterMaker::AliHLTESDCaloClusterMaker() :
43 fClusterReaderPtr(0)
44{
45 //See header file for documentation
46 fClusterReaderPtr = new AliHLTCaloClusterReader();
47
48}
49
50AliHLTESDCaloClusterMaker::~AliHLTESDCaloClusterMaker()
51{
52 //See header file for documentation
53
54}
55
56Int_t
57AliHLTESDCaloClusterMaker::FillESD(AliESDEvent *esdPtr, const AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr)
58{
59 // See header file for documentation
60
61 AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
62
63 fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
64
65 Int_t nClusters = 0;
66
67 while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
68 {
69 AliESDCaloCluster esdCluster;
70
71 esdCluster.SetID(caloClusterStructPtr->fID);
c8fe2783 72 esdCluster.SetType(caloClusterStructPtr->fClusterType);
7fc04b67 73 esdCluster.SetPosition((Float_t*)(caloClusterStructPtr->fGlobalPos));
74 esdCluster.SetE(caloClusterStructPtr->fEnergy);
75 esdCluster.SetTOF(caloClusterStructPtr->fTOF);
c8fe2783 76 esdCluster.SetDispersion(caloClusterStructPtr->fDispersion);
77 esdCluster.SetChi2(caloClusterStructPtr->fFitQuality);
ba340030 78 const Float_t *pid = caloClusterStructPtr->fPID;
c8fe2783 79 esdCluster.SetPID(pid);
7fc04b67 80 esdCluster.SetM20(caloClusterStructPtr->fM20);
81 esdCluster.SetM02(caloClusterStructPtr->fM02);
82 esdCluster.SetNExMax(caloClusterStructPtr->fNExMax);
83 esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance);
84 esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel);
34eb3256 85 esdCluster.SetNCells(caloClusterStructPtr->fNCells);
86 //esdCluster.SetNCells(0);
2a114625 87 if(caloClusterStructPtr->GetNTracksMatched())
88 {
89 TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched);
90 esdCluster.AddTracksMatched(tracksMatched);
91 }
34eb3256 92 UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
93 Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
2a114625 94
7fc04b67 95 for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
96 {
2a1edad1 97 fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
34eb3256 98 //printf("EM: cellId: %d\n", idArrayPtr[index]);;
7fc04b67 99 }
2a1edad1 100 esdCluster.SetCellsAbsId(idArrayPtr);
101 esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr);
d0bb5541 102#ifndef HAVE_NOT_ALIESDCALOCLUSTER_r38477
103 // this is to ensure compilation with the v4-18-Release branch for the moment
104 // until the changes of AliESDCaloCluster have been ported
3469a4b7 105 esdCluster.SetTrackDistance(caloClusterStructPtr->fTrackDx, caloClusterStructPtr->fTrackDz);
d0bb5541 106#endif //HAVE_NOT_ALIESDCALOCLUSTER_r38477
2a114625 107
108 delete [] idArrayPtr;
34eb3256 109 delete [] ampFracArrayPtr;
9a0cbaba 110// idArrayPtr = 0;
111 //ampFracArrayPtr = 0;
2a114625 112
7fc04b67 113 esdPtr->AddCaloCluster(&esdCluster);
2a1edad1 114 //printf("EM: Energy: %f\n", esdCluster.E());
7fc04b67 115 nClusters++;
116 }
117 return nClusters;
118}