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
29 #include "TObjString.h"
30 #include "TObjArray.h"
33 #include "AliHLTTRDHistoMergerComponent.h"
34 #include "AliHLTTRDDefinitions.h"
35 #include "AliHLTTRDUtils.h"
37 #define stringCompare(a,b) !(strcmp(a,b))
39 //#include "AliHLTTRD.h"
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTTRDHistoMergerComponent)
46 AliHLTTRDHistoMergerComponent::AliHLTTRDHistoMergerComponent()
50 // see header file for class documentation
52 // refer to README to build package
54 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 for(int i=0; i<9; i++)
59 for(int i=0; i<18; i++)
64 AliHLTTRDHistoMergerComponent::~AliHLTTRDHistoMergerComponent()
66 // see header file for class documentation
69 // Public functions to implement AliHLTComponent's interface.
70 // These functions are required for the registration process
72 const char* AliHLTTRDHistoMergerComponent::GetComponentID()
74 // see header file for class documentation
76 return "TRDHistoMerger";
79 void AliHLTTRDHistoMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
81 // see header file for class documentation
83 list.push_back(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
86 AliHLTComponentDataType AliHLTTRDHistoMergerComponent::GetOutputDataType()
88 // see header file for class documentation
89 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
93 void AliHLTTRDHistoMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
95 // see header file for class documentation
96 constBase = fOutputSize;
100 AliHLTComponent* AliHLTTRDHistoMergerComponent::Spawn()
102 // see header file for class documentation
103 return new AliHLTTRDHistoMergerComponent;
106 int AliHLTTRDHistoMergerComponent::DoInit(int argc, const char** argv)
111 TString configuration="";
113 for (int i=0; i<argc && iResult>=0; i++) {
115 if (!configuration.IsNull()) configuration+=" ";
116 configuration+=argument;
119 if (!configuration.IsNull()) {
120 iResult=Configure(configuration.Data());
123 for(int i=0; i<9; i++)
126 for(int i=0; i<18; i++)
132 int AliHLTTRDHistoMergerComponent::DoDeinit()
134 // see header file for class documentation
139 int AliHLTTRDHistoMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
140 AliHLTComponentTriggerData& /*trigData*/)
142 if(!IsDataEvent())return 0;
147 for(const TObject* iter = GetFirstInputObject(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
148 iter != NULL; iter = GetNextInputObject() ) {
150 if(!dynamic_cast<const TH1*>(iter))
153 AliHLTUInt32_t spec = GetSpecification(iter);
154 int SM = AliHLTTRDUtils::GetSM(spec);
158 for(int i = 0; fHistoArr[i]; i++){
159 PushBack((TObject*)fHistoArr[i], kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
163 for(int i=0; i<18; i++)
172 HLTError("Got more histogramms than expected.");
176 if(!fHistoArr[histNr]) fHistoArr[histNr] = (TH1*)iter->Clone();
177 else if(stringCompare(fHistoArr[histNr]->GetName(),iter->GetName()))
178 fHistoArr[histNr]->Add((TH1*)iter);
186 int AliHLTTRDHistoMergerComponent::Configure(const char* arguments){
188 if (!arguments) return iResult;
190 TString allArgs=arguments;
194 TObjArray* pTokens=allArgs.Tokenize(" ");
196 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
197 argument=((TObjString*)pTokens->At(i))->GetString();
198 if (argument.IsNull()) continue;
200 if (argument.CompareTo("output_size")==0) {
201 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
202 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
203 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
207 HLTError("unknown argument: %s", argument.Data());
215 HLTError("missing parameter for argument %s", argument.Data());