]>
Commit | Line | Data |
---|---|---|
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 | ||
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); | |
ba340030 | 76 | const Float_t *pid = caloClusterStructPtr->fPID; |
77 | esdCluster.SetPid(pid); | |
7fc04b67 | 78 | esdCluster.SetM20(caloClusterStructPtr->fM20); |
79 | esdCluster.SetM02(caloClusterStructPtr->fM02); | |
80 | esdCluster.SetNExMax(caloClusterStructPtr->fNExMax); | |
81 | esdCluster.SetEmcCpvDistance(caloClusterStructPtr->fEmcCpvDistance); | |
82 | esdCluster.SetDistanceToBadChannel(caloClusterStructPtr->fDistToBadChannel); | |
34eb3256 | 83 | esdCluster.SetNCells(caloClusterStructPtr->fNCells); |
84 | //esdCluster.SetNCells(0); | |
2a114625 | 85 | if(caloClusterStructPtr->GetNTracksMatched()) |
86 | { | |
87 | TArrayI tracksMatched(caloClusterStructPtr->GetNTracksMatched(), caloClusterStructPtr->fTracksMatched); | |
88 | esdCluster.AddTracksMatched(tracksMatched); | |
89 | } | |
34eb3256 | 90 | UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells]; |
91 | Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells]; | |
2a114625 | 92 | |
7fc04b67 | 93 | for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++) |
94 | { | |
2a1edad1 | 95 | fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index); |
34eb3256 | 96 | //printf("EM: cellId: %d\n", idArrayPtr[index]);; |
7fc04b67 | 97 | } |
2a1edad1 | 98 | esdCluster.SetCellsAbsId(idArrayPtr); |
99 | esdCluster.SetCellsAmplitudeFraction(ampFracArrayPtr); | |
2a114625 | 100 | |
101 | delete [] idArrayPtr; | |
34eb3256 | 102 | delete [] ampFracArrayPtr; |
9a0cbaba | 103 | // idArrayPtr = 0; |
104 | //ampFracArrayPtr = 0; | |
2a114625 | 105 | |
7fc04b67 | 106 | esdPtr->AddCaloCluster(&esdCluster); |
2a1edad1 | 107 | //printf("EM: Energy: %f\n", esdCluster.E()); |
7fc04b67 | 108 | nClusters++; |
109 | } | |
110 | return nClusters; | |
111 | } |