]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSFileWriterComponent.cxx
moving all definitions to AliHLTPHOSDefinitions
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSFileWriterComponent.cxx
CommitLineData
acd526ae 1/**************************************************************************
2 * Copyright(c) 2006, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Per Thomas Hille for the ALICE HLT Project. *
5 * Contributors are mentioned in the code where appropriate. *
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
d504c864 16#include "AliHLTPHOSDefinitions.h"
acd526ae 17#include "AliHLTPHOSFileWriterComponent.h"
f4d27262 18#include <iostream>
f4d27262 19#include <TObjString.h>
f4d27262 20#include "AliRawReaderMemory.h"
21#include "AliCaloRawStream.h"
22#include <cstdlib>
45c8f2b2 23#include "AliRawReaderMemory.h"
24#include "AliCaloRawStream.h"
f4d27262 25#include "AliHLTPHOSRcuCellEnergyDataStruct.h"
26#include "AliHLTPHOSDataHeaderStruct.h"
27#include "AliHLTDataTypes.h"
d504c864 28#include "AliHLTPHOSDDLPackedFileWriter.h"
29#include "AliHLTPHOSCellEnergiesFileWriter.h"
f4d27262 30
31
d504c864 32const AliHLTComponentDataType AliHLTPHOSFileWriterComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array
acd526ae 33
34
35AliHLTPHOSFileWriterComponent gAliHLTPHOSFileWriterComponent;
36
d504c864 37//____________________________________________________________________________________
05be0766 38AliHLTPHOSFileWriterComponent::AliHLTPHOSFileWriterComponent(): AliHLTFileWriter(), fCellEnergiesFileWriterPtr(0) \
39 , fDDLPackedFileWriterPtr(0), fDirectory(""),fFilename(""), fEventCount(0)
acd526ae 40{
d504c864 41 /*
42 *Default constructor
43 */
f4d27262 44 for(int i=0; i<N_DATATYPES; i++)
45 {
46 fDataTypesToFile[i] = kAliHLTVoidDataType;
47 }
48
49 fCellEnergiesFileWriterPtr = new AliHLTPHOSCellEnergiesFileWriter();
50 fDDLPackedFileWriterPtr = new AliHLTPHOSDDLPackedFileWriter();
acd526ae 51
f4d27262 52}
acd526ae 53
d504c864 54//____________________________________________________________________________________
acd526ae 55AliHLTPHOSFileWriterComponent::~AliHLTPHOSFileWriterComponent()
56{
f4d27262 57 delete fCellEnergiesFileWriterPtr;
58 delete fDDLPackedFileWriterPtr;
59}
60
61
d504c864 62//____________________________________________________________________________________
05be0766 63AliHLTPHOSFileWriterComponent::AliHLTPHOSFileWriterComponent(const AliHLTPHOSFileWriterComponent & ): AliHLTFileWriter(), fCellEnergiesFileWriterPtr(0), \
64 fDDLPackedFileWriterPtr(0), fDirectory(""),fFilename(""), fEventCount(0)
f4d27262 65{
66
67}
acd526ae 68
d504c864 69
70//____________________________________________________________________________________
f4d27262 71int
72AliHLTPHOSFileWriterComponent::AddDataType(string dataType)
73{
74 int ret = -1;
75 int tmpCnt = 0;
76 for(int i=0; i< N_DATATYPES; i++)
77 {
78 if( fDataTypesToFile[i] != kAliHLTVoidDataType)
79 {
80 tmpCnt ++;
81 }
82 }
83
84 string cmpString("gkCellEnergyDataType");
85
86 if(dataType.compare("gkCellEnergyDataType") == 0)
87 {
d504c864 88 fDataTypesToFile[tmpCnt] = AliHLTPHOSDefinitions::fgkCellEnergyDataType;
f4d27262 89 cout <<"regsitring dataType for filewriting: fDataTypesToFile[" << tmpCnt <<"]"<<endl;
90 }
91 else if(dataType.compare("gkDDLPackedRawDataType") == 0)
92 {
d504c864 93 fDataTypesToFile[tmpCnt] = AliHLTPHOSDefinitions::fgkDDLPackedRawDataType;
f4d27262 94 }
95
96 cout << "dataType.compare(cmpString) = " <<dataType.compare(cmpString)<<endl;
97 return ret;
98}
99
d504c864 100//____________________________________________________________________________________
f4d27262 101int
102AliHLTPHOSFileWriterComponent::Deinit()
103{
104 return 0;
105}
106
d504c864 107//____________________________________________________________________________________
f4d27262 108int
109AliHLTPHOSFileWriterComponent::DoDeinit()
110{
111 Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSFileWriterComponen DoDeinit");
112 return 0;
acd526ae 113}
114
d504c864 115
116//____________________________________________________________________________________
acd526ae 117const char*
118AliHLTPHOSFileWriterComponent::GetComponentID()
119{
acd526ae 120 return "PhosFileWriter";
121}
122
d504c864 123
124//____________________________________________________________________________________
f4d27262 125AliHLTComponent*
126AliHLTPHOSFileWriterComponent::Spawn()
acd526ae 127{
acd526ae 128 return new AliHLTPHOSFileWriterComponent;
129}
130
f4d27262 131
d504c864 132//____________________________________________________________________________________
f4d27262 133void
134AliHLTPHOSFileWriterComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
135{
d504c864 136 const AliHLTComponentDataType* pType=fgkInputDataTypes;
f4d27262 137 while (pType->fID!=0) {
138 list.push_back(*pType);
139 pType++;
140 }
141}
142
d504c864 143//____________________________________________________________________________________
f4d27262 144AliHLTComponentDataType
145AliHLTPHOSFileWriterComponent::GetOutputDataType()
146{
d504c864 147 return AliHLTPHOSDefinitions::fgkCellEnergyDataType;
f4d27262 148}
149
d504c864 150//____________________________________________________________________________________
f4d27262 151void
152AliHLTPHOSFileWriterComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier )
153
154{
45c8f2b2 155 // see header file for documentation
f4d27262 156 constBase = 30;
157 inputMultiplier = 0.1;
158}
159
d504c864 160//____________________________________________________________________________________
f4d27262 161Bool_t
162AliHLTPHOSFileWriterComponent::IsRegisteredDataType(const AliHLTComponentDataType& dataType)
163{
45c8f2b2 164 // see header file for documentation
f4d27262 165 Bool_t tmp = kFALSE;
166 for(int i =0; i<N_DATATYPES; i++)
167 {
168 if((fDataTypesToFile[i] == dataType) && (dataType != kAliHLTVoidDataType))
169 {
170 tmp = kTRUE;
171 }
172 }
173
174 return tmp;
175}