]>
Commit | Line | Data |
---|---|---|
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 | 32 | const AliHLTComponentDataType AliHLTPHOSFileWriterComponent::fgkInputDataTypes[]={kAliHLTVoidDataType,{0,"",""}}; //'zero' terminated array |
acd526ae | 33 | |
34 | ||
35 | AliHLTPHOSFileWriterComponent gAliHLTPHOSFileWriterComponent; | |
36 | ||
d504c864 | 37 | //____________________________________________________________________________________ |
05be0766 | 38 | AliHLTPHOSFileWriterComponent::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 | 55 | AliHLTPHOSFileWriterComponent::~AliHLTPHOSFileWriterComponent() |
56 | { | |
f4d27262 | 57 | delete fCellEnergiesFileWriterPtr; |
58 | delete fDDLPackedFileWriterPtr; | |
59 | } | |
60 | ||
61 | ||
d504c864 | 62 | //____________________________________________________________________________________ |
05be0766 | 63 | AliHLTPHOSFileWriterComponent::AliHLTPHOSFileWriterComponent(const AliHLTPHOSFileWriterComponent & ): AliHLTFileWriter(), fCellEnergiesFileWriterPtr(0), \ |
64 | fDDLPackedFileWriterPtr(0), fDirectory(""),fFilename(""), fEventCount(0) | |
f4d27262 | 65 | { |
66 | ||
67 | } | |
acd526ae | 68 | |
d504c864 | 69 | |
70 | //____________________________________________________________________________________ | |
f4d27262 | 71 | int |
72 | AliHLTPHOSFileWriterComponent::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 | 101 | int |
102 | AliHLTPHOSFileWriterComponent::Deinit() | |
103 | { | |
104 | return 0; | |
105 | } | |
106 | ||
d504c864 | 107 | //____________________________________________________________________________________ |
f4d27262 | 108 | int |
109 | AliHLTPHOSFileWriterComponent::DoDeinit() | |
110 | { | |
111 | Logging(kHLTLogInfo, "HLT", "PHOS", ",AliHLTPHOSFileWriterComponen DoDeinit"); | |
112 | return 0; | |
acd526ae | 113 | } |
114 | ||
d504c864 | 115 | |
116 | //____________________________________________________________________________________ | |
acd526ae | 117 | const char* |
118 | AliHLTPHOSFileWriterComponent::GetComponentID() | |
119 | { | |
acd526ae | 120 | return "PhosFileWriter"; |
121 | } | |
122 | ||
d504c864 | 123 | |
124 | //____________________________________________________________________________________ | |
f4d27262 | 125 | AliHLTComponent* |
126 | AliHLTPHOSFileWriterComponent::Spawn() | |
acd526ae | 127 | { |
acd526ae | 128 | return new AliHLTPHOSFileWriterComponent; |
129 | } | |
130 | ||
f4d27262 | 131 | |
d504c864 | 132 | //____________________________________________________________________________________ |
f4d27262 | 133 | void |
134 | AliHLTPHOSFileWriterComponent::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 | 144 | AliHLTComponentDataType |
145 | AliHLTPHOSFileWriterComponent::GetOutputDataType() | |
146 | { | |
d504c864 | 147 | return AliHLTPHOSDefinitions::fgkCellEnergyDataType; |
f4d27262 | 148 | } |
149 | ||
d504c864 | 150 | //____________________________________________________________________________________ |
f4d27262 | 151 | void |
152 | AliHLTPHOSFileWriterComponent::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 | 161 | Bool_t |
162 | AliHLTPHOSFileWriterComponent::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 | } |