]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTPHOSESDMakerComponent.cxx
Updated DA for mapping - MON
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSESDMakerComponent.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Authors: Oystein Djuvsland <oysteind@ift.uib.no>                       *
5  *                                                                        *
6  * Permission to use, copy, modify and distribute this software and its   *
7  * documentation strictly for non-commercial purposes is hereby granted   *
8  * without fee, provided that the above copyright notice appears in all   *
9  * copies and that both the copyright notice and this permission notice   *
10  * appear in the supporting documentation. The authors make no claims     *
11  * about the suitability of this software for any purpose. It is          *
12  * provided "as is" without express or implied warranty.                  *
13  **************************************************************************/
14
15
16 #include <iostream>
17
18 #include "AliHLTPHOSESDMakerComponent.h"
19 #include "AliHLTPHOSESDMaker.h"
20 #include "AliHLTPHOSCaloClusterContainerStruct.h"
21 #include "AliESDEvent.h"
22 #include "AliHLTPHOSDefinitions.h"
23 #include "AliHLTDataTypes.h"
24 #include "AliESDCaloCluster.h"
25
26 /** @file   AliHLTPHOSESDMakerComponent.cxx
27     @author Oystein Djuvsland
28     @date   
29     @brief  An ESD maker component for PHOS HLT
30 */
31
32 // see header file for class documentation
33 // or
34 // refer to README to build package
35 // or
36 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
37
38 #if __GNUC__>= 3
39 using namespace std;
40 #endif
41
42 const AliHLTComponentDataType AliHLTPHOSESDMakerComponent::fgkInputDataTypes[]=
43   {
44     kAliHLTVoidDataType,{0,"",""}
45   };
46
47 AliHLTPHOSESDMakerComponent gAliHLTPHOSESDMakerComponent;
48
49
50 AliHLTPHOSESDMakerComponent::AliHLTPHOSESDMakerComponent(): 
51   AliHLTPHOSProcessor(), 
52   fESDMakerPtr(0),
53   fESDEventPtr(0)
54 {
55   //See headerfile for documentation
56 }
57
58 AliHLTPHOSESDMakerComponent::~AliHLTPHOSESDMakerComponent()
59 {
60   //See headerfile for documentation
61
62   if (fESDMakerPtr)
63     {
64       delete fESDMakerPtr;
65       fESDMakerPtr = 0;
66     }
67   if (fESDEventPtr)
68     {
69       delete fESDEventPtr;
70       fESDEventPtr = 0;
71     }
72
73 }
74
75
76 int
77 AliHLTPHOSESDMakerComponent::Deinit()
78 {
79   //See headerfile for documentation
80
81   if (fESDMakerPtr)
82     {
83       delete fESDMakerPtr;
84       fESDMakerPtr = 0;
85     }
86   if (fESDEventPtr)
87     {
88       delete fESDEventPtr;
89       fESDEventPtr = 0;
90     }
91
92   return 0;
93 }
94
95 const Char_t*
96 AliHLTPHOSESDMakerComponent::GetComponentID()
97 {
98   //See headerfile for documentation
99
100   return "PhosEsdMaker";
101 }
102
103 void
104 AliHLTPHOSESDMakerComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
105 {
106   //See headerfile for documentation
107   list.clear();
108   list.push_back(AliHLTPHOSDefinitions::fgkClusterDataType);
109 //   const AliHLTComponentDataType* pType=fgkInputDataTypes;
110 //   while (pType->fID!=0)
111 //     {
112 //       list.push_back(*pType);
113 //       pType++;
114 //     }
115 }
116
117 AliHLTComponentDataType
118 AliHLTPHOSESDMakerComponent::GetOutputDataType()
119 {
120   //See headerfile for documentation
121
122   return kAliHLTDataTypeESDObject;
123 }
124
125 void
126 AliHLTPHOSESDMakerComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
127
128 {
129   //See headerfile for documentation
130
131   constBase = 30;
132   inputMultiplier = 4;
133 }
134  
135 Int_t 
136 AliHLTPHOSESDMakerComponent::DoEvent( const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/ ) 
137 {
138   // see header file for class documentation
139  
140   
141   AliHLTPHOSCaloClusterContainerStruct* caloClusterContainerPtr = 0;
142   
143   const AliHLTComponentBlockData* iter = 0;
144
145   UInt_t specification = 0;
146
147   fESDMakerPtr->ResetESD();
148
149   fESDEventPtr = new AliESDEvent();
150   fESDEventPtr->CreateStdContent();
151   fESDMakerPtr->SetESDEvent(fESDEventPtr);
152   
153   for ( iter = GetFirstInputBlock(AliHLTPHOSDefinitions::fgkCaloClusterDataType); iter != 0; iter = GetNextInputBlock()) 
154     {
155       specification = specification|iter->fSpecification;
156       caloClusterContainerPtr = reinterpret_cast<AliHLTPHOSCaloClusterContainerStruct*>(iter->fPtr);
157       fESDMakerPtr->FillESDEvent(caloClusterContainerPtr);
158       //      fESDMakerPtr->SetCaloClusterContainer(caloClusterContainerPtr);
159     }
160   
161   PushBack(fESDEventPtr, kAliHLTDataTypeESDObject|kAliHLTDataOriginPHOS, specification);
162  
163   if(fESDEventPtr)
164     {
165       delete fESDEventPtr;
166       fESDEventPtr = 0;
167     }
168
169   fPhosEventCount++; 
170   if(fPrintInfoModule == kTRUE)
171     {
172       if(fPhosEventCount%fPrintInfoFrequncyModule == 0)
173         {
174           Logging(kHLTLogInfo, __FILE__ , "writing data" , "Made ESD from event %lu",  fPhosEventCount);
175         }  
176     }
177   return 0;
178 }
179
180
181 int
182 AliHLTPHOSESDMakerComponent::DoInit(int argc, const char** argv )
183 {
184   //See headerfile for documentation
185
186   fESDMakerPtr = new AliHLTPHOSESDMaker();
187   //fESDMakerPtr->SetESDEvent(fESDEventPtr);
188   //
189   ScanArgumentsModule(argc, argv);
190   for (int i = 0; i < argc; i++)
191     {
192       
193     }
194
195   return 0;
196 }
197
198 AliHLTComponent*
199 AliHLTPHOSESDMakerComponent::Spawn()
200 {
201   //See headerfile for documentation
202
203   return new AliHLTPHOSESDMakerComponent();
204 }