]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSESDEntriesMakerComponent.cxx
- changes to make the clusterisation work for EMCAL
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSESDEntriesMakerComponent.cxx
1
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  *                                                                        *
5  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
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 #include <iostream>
18
19 #include "AliHLTPHOSESDEntriesMakerComponent.h"
20 #include "AliHLTCaloClusterDataStruct.h"
21 #include "AliHLTPHOSDigitDataStruct.h"
22 #include "AliESDEvent.h"
23 #include "AliHLTPHOSDefinitions.h"
24 #include "AliHLTDataTypes.h"
25 #include "AliESDCaloCluster.h"
26 #include "AliHLTESDCaloClusterMaker.h"
27
28 /** @file   AliHLTPHOSESDEntriesMakerComponent.cxx
29     @author Oystein Djuvsland
30     @date   
31     @brief  An ESD entries maker component for PHOS HLT
32 */
33
34 // see header file for class documentation
35 // or
36 // refer to README to build package
37 // or
38 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
39
40 #if __GNUC__>= 3
41 using namespace std;
42 #endif
43
44 AliHLTPHOSESDEntriesMakerComponent gAliHLTPHOSESDEntriesMakerComponent;
45
46 AliHLTPHOSESDEntriesMakerComponent::AliHLTPHOSESDEntriesMakerComponent(): 
47   AliHLTPHOSProcessor(), 
48   fESDCaloClusterMakerPtr(0),
49   fESDCaloClustersPtr(0)
50 {
51   //See headerfile for documentation
52 }
53
54 AliHLTPHOSESDEntriesMakerComponent::~AliHLTPHOSESDEntriesMakerComponent()
55 {
56   //See headerfile for documentation
57   if (fESDCaloClusterMakerPtr)
58     {
59       delete fESDCaloClusterMakerPtr;
60       fESDCaloClusterMakerPtr = 0;
61     }
62 }
63
64 int
65 AliHLTPHOSESDEntriesMakerComponent::Deinit()
66 {
67   //See headerfile for documentation
68   if (fESDCaloClusterMakerPtr)
69     {
70       delete fESDCaloClusterMakerPtr;
71       fESDCaloClusterMakerPtr = 0;
72     }
73   return 0;
74 }
75
76 const Char_t*
77 AliHLTPHOSESDEntriesMakerComponent::GetComponentID()
78 {
79   //See headerfile for documentation
80   return "PhosEsdEntriesMaker";
81 }
82
83 void
84 AliHLTPHOSESDEntriesMakerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
85 {
86   //See headerfile for documentation
87   list.clear();
88   list.push_back(AliHLTPHOSDefinitions::fgkCaloClusterDataType);
89 }
90
91 AliHLTComponentDataType
92 AliHLTPHOSESDEntriesMakerComponent::GetOutputDataType()
93 {
94   //See headerfile for documentation
95   return AliHLTPHOSDefinitions::fgkESDCaloClusterDataType;
96 }
97
98 void
99 AliHLTPHOSESDEntriesMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
100
101 {
102   //See headerfile for documentation
103   constBase = 30;
104   inputMultiplier = 2;
105 }
106  
107 Int_t 
108 AliHLTPHOSESDEntriesMakerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) 
109 {
110   
111   // see header file for class documentation
112  
113   fESDCaloClustersPtr->Delete();
114   //fESDCaloClustersPtr = new TClonesArray(AliESDCaloCluster::Class(), 10);
115   AliHLTCaloClusterHeaderStruct* caloClusterHeaderPtr = 0;
116
117   const AliHLTComponentBlockData* iter = 0;
118   //  UInt_t nClusters = 0;
119
120   UInt_t clusterSpecification = 0;
121   //  UInt_t digitSpecification  = 0;
122   //UInt_t nDigits = 0;
123
124   for ( iter = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkCaloClusterDataType); iter != 0; iter = GetNextInputBlock()) 
125     {
126       clusterSpecification = clusterSpecification|iter->fSpecification;
127       caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
128       HLTDebug("%d HLT clusters", caloClusterHeaderPtr->fNClusters);
129       //      nClusters = fESDCaloClusterMakerPtr->FillESDCaloClusters(fESDCaloClustersPtr, caloClusterHeaderPtr);
130     }
131
132 //   for(iter = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkDigitDataType); iter != 0; iter =GetNextInputBlock())
133 //     {
134 //       digitSpecification = digitSpecification|iter->fSpecification;
135 //       digitsPtr = reinterpret_cast<AliHLTPHOSDigitDataStruct*>(iter->fPtr);
136 //       nDigits = iter->fSize/sizeof(AliHLTPHOSDigitDataStruct);
137 //       fESDCaloCellMaker->FillESDCaloCells(fESDCaloCellsPtr, digitsPtr, nDigits);
138 //     }
139   
140   // for(int i = 0; i < nClusters; i++)
141   //   {
142   //     HLTDebug("Cluster energy: %f", ((AliESDCaloCluster*)(fESDCaloClustersPtr->At(i)))->E());
143   //   }
144
145   ///  HLTError("Number of ESD clusters: %d", nClusters);
146   PushBack(fESDCaloClustersPtr, AliHLTPHOSDefinitions::fgkESDCaloClusterDataType|kAliHLTDataOriginPHOS);
147   //  PushBack(fESDCaloCellsPtr, AliHLTPHOSDefinitions::fgkESDCaloCellsDataType|kAliHLTDataOriginPHOS, digitSpecification);
148   
149   //delete fESDCaloClustersPtr; 
150
151   return 0;
152 }
153
154
155 int
156 AliHLTPHOSESDEntriesMakerComponent::DoInit(int argc, const char** argv )
157 {
158   //See headerfile for documentation
159
160   fESDCaloClusterMakerPtr = new AliHLTESDCaloClusterMaker();
161
162   fESDCaloClustersPtr = new TClonesArray(AliESDCaloCluster::Class(), 10);
163
164   ScanArgumentsModule(argc, argv);
165   for (int i = 0; i < argc; i++)
166     {
167       
168     }
169
170   return 0;
171 }
172
173 AliHLTComponent*
174 AliHLTPHOSESDEntriesMakerComponent::Spawn()
175 {
176   //See headerfile for documentation
177
178   return new AliHLTPHOSESDEntriesMakerComponent();
179 }