X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=HLT%2FBASE%2FAliHLTTTreeProcessor.cxx;h=6864f58f000690449696ec4d365bf606129e0eb0;hb=b3b4933e2d850920916a38b5524c23ef14798786;hp=d8bd54f3510dbdb8b4a10551114ec80563efc481;hpb=80d83a6587cbcea2922011f991ead3ee79bdda63;p=u%2Fmrichter%2FAliRoot.git diff --git a/HLT/BASE/AliHLTTTreeProcessor.cxx b/HLT/BASE/AliHLTTTreeProcessor.cxx index d8bd54f3510..6864f58f000 100644 --- a/HLT/BASE/AliHLTTTreeProcessor.cxx +++ b/HLT/BASE/AliHLTTTreeProcessor.cxx @@ -101,6 +101,26 @@ int AliHLTTTreeProcessor::DoInit(int argc, const char** argv) // ask child to create the tree. int iResult = 0; + // component configuration + //Stage 1: default initialization. + //"Default" (for derived component) histograms. + FillHistogramDefinitions(); + //Default values. + fMaxEntries = kMaxEntries; + fPublishInterval = kInterval; + fLastTime = 0; + //Stage 2: OCDB. + TString cdbPath("HLT/ConfigHLT/"); + cdbPath += GetComponentID(); + // + iResult = ConfigureFromCDBTObjString(cdbPath); + // + if (iResult < 0) + return iResult; + //Stage 3: command line arguments. + if (argc && (iResult = ConfigureFromArgumentString(argc, argv)) < 0) + return iResult; + // calculating a unique id from the hostname and process id // used for identifying output of multiple components TUUID guid = GenerateGUID(); @@ -112,30 +132,13 @@ int AliHLTTTreeProcessor::DoInit(int argc, const char** argv) guid.GetUUID(buf); fUniqueId = bufAsInt[0]; - if (!fTree) { - std::auto_ptr ptr(CreateTree(argc, argv)); + // originally foreseen to pass the arguments to the function, however + // this is not appropriate. Argument scan via overloaded function + // ScanConfigurationArgument + std::auto_ptr ptr(CreateTree(0, NULL)); if (ptr.get()) { - //Stage 1: default initialization. ptr->SetDirectory(0); - //"Default" (for derived component) histograms. - FillHistogramDefinitions(); - //Default values. - fMaxEntries = kMaxEntries; - fPublishInterval = kInterval; - fLastTime = 0; - //Stage 2: OCDB. - TString cdbPath("HLT/ConfigHLT/"); - cdbPath += GetComponentID(); - // - iResult = ConfigureFromCDBTObjString(cdbPath); - // - if (iResult < 0) - return iResult; - //Stage 3: command line arguments. - if (argc && (iResult = ConfigureFromArgumentString(argc, argv)) < 0) - return iResult; - ptr->SetCircular(fMaxEntries); fTree = ptr.release(); } else //No way to process error correctly - error is unknown here. @@ -198,12 +201,12 @@ int AliHLTTTreeProcessor::DoEvent(const AliHLTComponentEventData& evtData, AliHL bool bDoPublishing=false; const int cycleResetInterval=1000; if (fpEventTimer && fpCycleTimer) { - averageEventTime=(fpEventTimer->RealTime()*fgkTimeScale)/(GetEventCount()+1); - fillingtime=fpEventTimer->RealTime()*fgkTimeScale; + averageEventTime=AliHLTUInt32_t(fpEventTimer->RealTime()*fgkTimeScale)/(GetEventCount()+1); + fillingtime=int(fpEventTimer->RealTime()*fgkTimeScale); publishtime=fillingtime; fpEventTimer->Start(kFALSE); fpCycleTimer->Stop(); - averageCycleTime=(fpCycleTimer->RealTime()*fgkTimeScale)/((GetEventCount()%cycleResetInterval)+1); + averageCycleTime=AliHLTUInt32_t(fpCycleTimer->RealTime()*fgkTimeScale)/((GetEventCount()%cycleResetInterval)+1); // adapt processing to 3/4 of the max time bDoFilling=4*averageEventTime<3*fMaxEventTime || (averageEventTimeRealTime()>fIgnoreCycleTime); @@ -228,7 +231,7 @@ int AliHLTTTreeProcessor::DoEvent(const AliHLTComponentEventData& evtData, AliHL } if (fpEventTimer) { fpEventTimer->Stop(); - fillingtime=fpEventTimer->RealTime()*fgkTimeScale-fillingtime; + fillingtime=int(fpEventTimer->RealTime()*fgkTimeScale)-fillingtime; if (fillingtime<0) fillingtime=0; fpEventTimer->Start(kFALSE); } @@ -271,11 +274,11 @@ int AliHLTTTreeProcessor::DoEvent(const AliHLTComponentEventData& evtData, AliHL if (fpEventTimer) { fpEventTimer->Stop(); - publishtime=fpEventTimer->RealTime()*fgkTimeScale-publishtime; + publishtime=int(fpEventTimer->RealTime()*fgkTimeScale)-publishtime; if (publishtime>fillingtime) publishtime-=fillingtime; else publishtime=0; - averageEventTime=(fpEventTimer->RealTime()*fgkTimeScale)/(GetEventCount()+1); + averageEventTime=AliHLTUInt32_t(fpEventTimer->RealTime()*fgkTimeScale)/(GetEventCount()+1); // info output once every 5 seconds static UInt_t lastTime=0; @@ -302,7 +305,7 @@ int AliHLTTTreeProcessor::ScanConfigurationArgument(int argc, const char** argv) // possible arguments: // -maxentries number // -interval number - // -histogram name -size number -expression expression [-cut expression ][-opt option] + // -histogram name -size number -expression expression [-title expression ] -cut expression ][-opt option] // As soon as "-histogram" found, -size and -expression and -outtype are required, // cut and option can be omitted. if (argc <= 0) @@ -312,7 +315,7 @@ int AliHLTTTreeProcessor::ScanConfigurationArgument(int argc, const char** argv) AliHLTHistogramDefinition def; int i = 0; - int maxEntries = 0; + int maxEntries = fMaxEntries; while (i < argc) { const TString argument(argv[i]); @@ -481,13 +484,36 @@ TH1* AliHLTTTreeProcessor::CreateHistogram(const AliHLTHistogramDefinition& d) hist->SetOption(d.GetDrawOption().Data()); } + //Reformatting the histogram name + TString str2=d.GetCut().Data(); + str2.ReplaceAll("Track_", ""); + str2.ReplaceAll("&&", " "); + str2 = histName+" "+str2; + hist->SetTitle(str2); + + if(d.GetTitle().Length()){ + + //removing underscore + size_t found; + string str=d.GetTitle().Data(); + found=str.find_first_of("_"); + if(!(d.GetExpression().CompareTo("Track_pt"))){ + found=str.find_first_of("_",found+1); + } + str[found]=' '; + char axis[100]; + sprintf(axis,"%s",str.c_str()); + + hist->SetXTitle(axis); + hist->GetXaxis()->CenterTitle(); + } return hist; } int AliHLTTTreeProcessor::ParseHistogramDefinition(int argc, const char** argv, int pos, AliHLTHistogramDefinition& dst)const { //Histogram-definition: - // -histogram name -size number -expression expression [-cut expression][-opt option] + // -histogram name -size number -expression expression [-title expression][-cut expression][-opt option] //at pos we have '-histogram', at pos + 1 must be the name. if (pos + 1 == argc) { @@ -531,11 +557,22 @@ int AliHLTTTreeProcessor::ParseHistogramDefinition(int argc, const char** argv, pos += 2; int processed = 6; + dst.SetTitle(""); dst.SetCut(""); dst.SetDrawOption(""); - //remaining options can be the cut and Draw option. - //cut must be first. + //remaining options can be the title, cut and Draw option. + //title must be first + if (pos + 1 >= argc){ + return processed; + } + if (TString(argv[pos]).CompareTo("-title") == 0) { + dst.SetTitle(argv[pos + 1]); + pos += 2; + processed += 2; + } + + //cut must be second. if (pos + 1 >= argc) return processed;