]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSESDMakerComponent.cxx
- fixing compilation warnings
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSESDMakerComponent.cxx
1 // $Id$
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
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 #include <iostream>
19
20 #include "AliHLTPHOSESDMakerComponent.h"
21 #include "AliHLTPHOSESDMaker.h"
22 #include "AliHLTPHOSCaloClusterContainerStruct.h"
23 #include "AliESDEvent.h"
24 #include "AliHLTPHOSDefinitions.h"
25 #include "AliHLTDataTypes.h"
26 #include "AliESDCaloCluster.h"
27
28 /** @file   AliHLTPHOSESDMakerComponent.cxx
29     @author Oystein Djuvsland
30     @date   
31     @brief  An ESD 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 const AliHLTComponentDataType AliHLTPHOSESDMakerComponent::fgkInputDataTypes[]=
45   {
46     kAliHLTVoidDataType,{0,"",""}
47   };
48
49 AliHLTPHOSESDMakerComponent gAliHLTPHOSESDMakerComponent;
50
51
52 AliHLTPHOSESDMakerComponent::AliHLTPHOSESDMakerComponent(): 
53   AliHLTPHOSProcessor(), 
54   fESDMakerPtr(0),
55   fESDEventPtr(0)
56 {
57   //See headerfile for documentation
58 }
59
60 AliHLTPHOSESDMakerComponent::~AliHLTPHOSESDMakerComponent()
61 {
62   //See headerfile for documentation
63
64   if (fESDMakerPtr)
65     {
66       delete fESDMakerPtr;
67       fESDMakerPtr = 0;
68     }
69   if (fESDEventPtr)
70     {
71       delete fESDEventPtr;
72       fESDEventPtr = 0;
73     }
74
75 }
76
77
78 int
79 AliHLTPHOSESDMakerComponent::Deinit()
80 {
81   //See headerfile for documentation
82
83   if (fESDMakerPtr)
84     {
85       delete fESDMakerPtr;
86       fESDMakerPtr = 0;
87     }
88   if (fESDEventPtr)
89     {
90       delete fESDEventPtr;
91       fESDEventPtr = 0;
92     }
93
94   return 0;
95 }
96
97 const Char_t*
98 AliHLTPHOSESDMakerComponent::GetComponentID()
99 {
100   //See headerfile for documentation
101
102   return "PhosEsdMaker";
103 }
104
105 void
106 AliHLTPHOSESDMakerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
107 {
108   //See headerfile for documentation
109   list.clear();
110   list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType);
111 //   const AliHLTComponentDataType* pType=fgkInputDataTypes;
112 //   while (pType->fID!=0)
113 //     {
114 //       list.push_back(*pType);
115 //       pType++;
116 //     }
117 }
118
119 AliHLTComponentDataType
120 AliHLTPHOSESDMakerComponent::GetOutputDataType()
121 {
122   //See headerfile for documentation
123
124   return kAliHLTDataTypeESDObject;
125 }
126
127 void
128 AliHLTPHOSESDMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
129
130 {
131   //See headerfile for documentation
132
133   constBase = 30;
134   inputMultiplier = 4;
135 }
136  
137 Int_t 
138 AliHLTPHOSESDMakerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) 
139 {
140   // see header file for class documentation
141  
142   
143   AliHLTPHOSCaloClusterContainerStruct* caloClusterContainerPtr = 0;
144   
145   const AliHLTComponentBlockData* iter = 0;
146
147   UInt_t specification = 0;
148
149   fESDMakerPtr->ResetESD();
150
151   fESDEventPtr = new AliESDEvent();
152   fESDEventPtr->CreateStdContent();
153   fESDMakerPtr->SetESDEvent(fESDEventPtr);
154   
155   for ( iter = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkCaloClusterDataType); iter != 0; iter = GetNextInputBlock()) 
156     {
157       specification = specification|iter->fSpecification;
158       caloClusterContainerPtr = reinterpret_cast<AliHLTPHOSCaloClusterContainerStruct*>(iter->fPtr);
159       fESDMakerPtr->FillESDEvent(caloClusterContainerPtr);
160       //      fESDMakerPtr->SetCaloClusterContainer(caloClusterContainerPtr);
161     }
162   
163   PushBack(fESDEventPtr, kAliHLTDataTypeESDObject|kAliHLTDataOriginPHOS, specification);
164  
165   if(fESDEventPtr)
166     {
167       delete fESDEventPtr;
168       fESDEventPtr = 0;
169     }
170
171   fPhosEventCount++; 
172   if(fPrintInfoModule == kTRUE)
173     {
174       if(fPhosEventCount%fPrintInfoFrequncyModule == 0)
175         {
176           Logging(kHLTLogInfo, __FILE__ , "writing data" , "Made ESD from event %lu",  fPhosEventCount);
177         }  
178     }
179   return 0;
180 }
181
182
183 int
184 AliHLTPHOSESDMakerComponent::DoInit(int argc, const char** argv )
185 {
186   //See headerfile for documentation
187
188   fESDMakerPtr = new AliHLTPHOSESDMaker();
189   //fESDMakerPtr->SetESDEvent(fESDEventPtr);
190   //
191   ScanArgumentsModule(argc, argv);
192   for (int i = 0; i < argc; i++)
193     {
194       
195     }
196
197   return 0;
198 }
199
200 AliHLTComponent*
201 AliHLTPHOSESDMakerComponent::Spawn()
202 {
203   //See headerfile for documentation
204
205   return new AliHLTPHOSESDMakerComponent();
206 }