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
58 AliHLTTRDHistoMergerComponent::~AliHLTTRDHistoMergerComponent()
60 // see header file for class documentation
63 // Public functions to implement AliHLTComponent's interface.
64 // These functions are required for the registration process
66 const char* AliHLTTRDHistoMergerComponent::GetComponentID()
68 // see header file for class documentation
70 return "TRDHistoMerger";
73 void AliHLTTRDHistoMergerComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
75 // see header file for class documentation
77 list.push_back(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
80 AliHLTComponentDataType AliHLTTRDHistoMergerComponent::GetOutputDataType()
82 // see header file for class documentation
83 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
87 void AliHLTTRDHistoMergerComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
89 // see header file for class documentation
90 constBase = fOutputSize;
94 AliHLTComponent* AliHLTTRDHistoMergerComponent::Spawn()
96 // see header file for class documentation
97 return new AliHLTTRDHistoMergerComponent;
100 int AliHLTTRDHistoMergerComponent::DoInit(int argc, const char** argv)
105 TString configuration="";
107 for (int i=0; i<argc && iResult>=0; i++) {
109 if (!configuration.IsNull()) configuration+=" ";
110 configuration+=argument;
113 if (!configuration.IsNull()) {
114 iResult=Configure(configuration.Data());
117 for(int i=0; i<9; i++)
120 for(int i=0; i<18; i++)
126 int AliHLTTRDHistoMergerComponent::DoDeinit()
128 // see header file for class documentation
133 int AliHLTTRDHistoMergerComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
134 AliHLTComponentTriggerData& /*trigData*/)
136 if(!IsDataEvent())return 0;
141 for(const TObject* iter = GetFirstInputObject(kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD);
142 iter != NULL; iter = GetNextInputObject() ) {
144 if(!dynamic_cast<const TH1*>(iter))
147 AliHLTUInt32_t spec = GetSpecification(iter);
148 int SM = AliHLTTRDUtils::GetSM(spec);
152 for(int i = 0; fHistoArr[i]; i++){
153 PushBack((TObject*)fHistoArr[i], kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
157 for(int i=0; i<18; i++)
166 HLTError("Got more histogramms than expected.");
170 if(!fHistoArr[histNr]) fHistoArr[histNr] = (TH1*)iter->Clone();
171 else if(stringCompare(fHistoArr[histNr]->GetName(),iter->GetName()))
172 fHistoArr[histNr]->Add((TH1*)iter);
180 int AliHLTTRDHistoMergerComponent::Configure(const char* arguments){
182 if (!arguments) return iResult;
184 TString allArgs=arguments;
188 TObjArray* pTokens=allArgs.Tokenize(" ");
190 for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
191 argument=((TObjString*)pTokens->At(i))->GetString();
192 if (argument.IsNull()) continue;
194 if (argument.CompareTo("output_size")==0) {
195 if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
196 HLTInfo("Setting output size to: %s", ((TObjString*)pTokens->At(i))->GetString().Data());
197 fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
201 HLTError("unknown argument: %s", argument.Data());
209 HLTError("missing parameter for argument %s", argument.Data());