2 //**************************************************************************
3 //* This file is property of and copyright by the ALICE HLT Project *
4 //* ALICE Experiment at CERN, All rights reserved. *
7 //* for The ALICE HLT Project. *
9 //* Permission to use, copy, modify and distribute this software and its *
10 //* documentation strictly for non-commercial purposes is hereby granted *
11 //* without fee, provided that the above copyright notice appears in all *
12 //* copies and that both the copyright notice and this permission notice *
13 //* appear in the supporting documentation. The authors make no claims *
14 //* about the suitability of this software for any purpose. It is *
15 //* provided "as is" without express or implied warranty. *
16 //**************************************************************************
18 /** @file AliHLTTRDHistoMergerComponent.cxx
19 @author Theodor Rascanu
20 @brief Component for adding histos of partition wise working histo components
25 #include "TObjString.h"
26 #include "TObjArray.h"
29 #include "AliHLTTRDHistoMergerComponent.h"
30 #include "AliHLTTRDDefinitions.h"
31 #include "AliHLTTRDUtils.h"
33 #define stringCompare(a,b) !(strcmp(a,b))
35 //#include "AliHLTTRD.h"
41 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTTRDHistoMergerComponent)
44 AliHLTTRDHistoMergerComponent::AliHLTTRDHistoMergerComponent()
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
54 for(int i=0; i<9; i++)
57 for(int i=0; i<18; i++)
62 AliHLTTRDHistoMergerComponent::~AliHLTTRDHistoMergerComponent()
64 // see header file for class documentation
67 // Public functions to implement AliHLTComponent's interface.
68 // These functions are required for the registration process
70 const char* AliHLTTRDHistoMergerComponent::GetComponentID()
72 // see header file for class documentation
74 return "TRDHistoMerger";
77 void AliHLTTRDHistoMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
79 // see header file for class documentation
81 list.push_back(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
84 AliHLTComponentDataType AliHLTTRDHistoMergerComponent::GetOutputDataType()
86 // see header file for class documentation
87 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
91 void AliHLTTRDHistoMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
93 // see header file for class documentation
94 constBase = fOutputSize;
98 AliHLTComponent* AliHLTTRDHistoMergerComponent::Spawn()
100 // see header file for class documentation
101 return new AliHLTTRDHistoMergerComponent;
104 int AliHLTTRDHistoMergerComponent::DoInit(int argc, const char** argv)
109 TString configuration="";
111 for (int i=0; i<argc && iResult>=0; i++) {
113 if (!configuration.IsNull()) configuration+=" ";
114 configuration+=argument;
117 if (!configuration.IsNull()) {
118 iResult=Configure(configuration.Data());
121 for(int i=0; i<9; i++)
124 for(int i=0; i<18; i++)
130 int AliHLTTRDHistoMergerComponent::DoDeinit()
132 // see header file for class documentation
137 int AliHLTTRDHistoMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
138 AliHLTComponentTriggerData& /*trigData*/)
140 if(!IsDataEvent())return 0;
145 for(const TObject* iter = GetFirstInputObject(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
146 iter != NULL; iter = GetNextInputObject() ) {
148 if(!dynamic_cast<const TH1*>(iter))
151 AliHLTUInt32_t spec = GetSpecification(iter);
152 int SM = AliHLTTRDUtils::GetSM(spec);
156 for(int i = 0; fHistoArr[i]; i++){
157 PushBack((TObject*)fHistoArr[i], kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
161 for(int i=0; i<18; i++)
170 HLTError("Got more histogramms than expected.");
174 if(!fHistoArr[histNr]) fHistoArr[histNr] = (TH1*)iter->Clone();
175 else if(stringCompare(fHistoArr[histNr]->GetName(),iter->GetName()))
176 fHistoArr[histNr]->Add((TH1*)iter);
184 int AliHLTTRDHistoMergerComponent::Configure(const char* arguments){
186 if (!arguments) return iResult;
188 TString allArgs=arguments;
192 TObjArray* pTokens=allArgs.Tokenize(" ");
194 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
195 argument=((TObjString*)pTokens->At(i))->GetString();
196 if (argument.IsNull()) continue;
198 if (argument.CompareTo("output_size")==0) {
199 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
200 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
201 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
205 HLTError("unknown argument: %s", argument.Data());
213 HLTError("missing parameter for argument %s", argument.Data());