1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 /// Base class to hold a set of results for the same quantity,
18 /// computed using various methods, each with their errors
20 /// author: Laurent Aphecetche (Subatech)
23 #include "AliAnalysisMuMuResult.h"
25 ClassImp(AliAnalysisMuMuResult)
27 #include "THashList.h"
32 #include "TObjArray.h"
33 #include "TParameter.h"
38 //_____________________________________________________________________________
39 AliAnalysisMuMuResult::AliAnalysisMuMuResult(const char* name, const char* title, AliAnalysisMuMuResult::EResultMergingMethod mergingMethod) :
47 fSubResultsToBeIncluded(0x0),
48 fResultMergingMethod(mergingMethod),
55 //_____________________________________________________________________________
56 AliAnalysisMuMuResult::AliAnalysisMuMuResult(const AliAnalysisMuMuResult& rhs)
65 fSubResultsToBeIncluded(0x0),
70 /// Note that the mother is lost
71 /// fKeys remains 0x0 so it will be recomputed if need be
75 fSubResults = static_cast<TObjArray*>(rhs.fSubResults->Clone());
80 fMap = static_cast<TMap*>(rhs.fMap->Clone());
83 if ( rhs.fAlias.Length() > 0 )
88 if ( rhs.fSubResultsToBeIncluded )
90 fSubResultsToBeIncluded = static_cast<TList*>(rhs.fSubResultsToBeIncluded->Clone());
93 if ( rhs.fVisibleKeys )
95 fVisibleKeys = static_cast<THashList*>(rhs.Clone());
99 //_____________________________________________________________________________
100 AliAnalysisMuMuResult& AliAnalysisMuMuResult::operator=(const AliAnalysisMuMuResult& rhs)
102 /// Assignment operator
108 delete fSubResultsToBeIncluded;
113 fSubResultsToBeIncluded = 0x0;
117 fSubResults = static_cast<TObjArray*>(rhs.fSubResults->Clone());
122 fMap = static_cast<TMap*>(rhs.fMap->Clone());
125 if ( rhs.fSubResultsToBeIncluded )
127 fSubResultsToBeIncluded = static_cast<TList*>(rhs.fSubResultsToBeIncluded->Clone());
130 static_cast<TNamed&>(*this)=rhs;
132 fWeight = rhs.fWeight;
135 if ( rhs.fAlias.Length() > 0 )
140 fIsValid = rhs.fIsValid;
142 if ( rhs.fVisibleKeys )
144 fVisibleKeys = static_cast<THashList*>(rhs.Clone());
152 //_____________________________________________________________________________
153 AliAnalysisMuMuResult::~AliAnalysisMuMuResult()
159 delete fSubResultsToBeIncluded;
163 //_____________________________________________________________________________
164 Bool_t AliAnalysisMuMuResult::AdoptSubResult(AliAnalysisMuMuResult* r)
166 /// Adopt (i.e. becomes owner) of a subresult
169 fSubResults = new TObjArray;
170 fSubResults->SetOwner(kTRUE);
173 Int_t subresultsBeforeAdd = fSubResults->GetEntriesFast();
177 Int_t subresultsAfterAdd = fSubResults->GetEntriesFast();
179 SubResultsToBeIncluded()->Add(new TObjString(r->Alias()));
181 if ( subresultsBeforeAdd < subresultsAfterAdd ) return kTRUE;
185 //_____________________________________________________________________________
186 TObject* AliAnalysisMuMuResult::Clone(const char* /*newname*/) const
188 /// Clone this result
189 return new AliAnalysisMuMuResult(*this);
193 //_____________________________________________________________________________
194 Double_t AliAnalysisMuMuResult::ErrorAB(Double_t a, Double_t aerr, Double_t b, Double_t berr)
196 /// Compute the quadratic sum of 2 errors
200 if ( TMath::Abs(a) > 1E-12 )
202 e += (aerr*aerr)/(a*a);
205 if ( TMath::Abs(b) > 1E-12 )
207 e += (berr*berr)/(b*b);
210 return TMath::Sqrt(e);
213 //_____________________________________________________________________________
214 Double_t AliAnalysisMuMuResult::ErrorABC(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror)
216 /// Compute the quadratic sum of 3 errors
220 if ( TMath::Abs(a) > 1E-12 )
222 e += (aerr*aerr)/(a*a);
225 if ( TMath::Abs(b) > 1E-12 )
227 e += (berr*berr)/(b*b);
230 if ( TMath::Abs(c) > 1E-12 )
232 e += (cerror*cerror)/(c*c);
235 return TMath::Sqrt(e);
238 //_____________________________________________________________________________
239 Double_t AliAnalysisMuMuResult::ErrorABCD(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror, Double_t d, Double_t derror)
241 /// Compute the quadratic sum of 4 errors
245 if ( TMath::Abs(a) > 1E-12 )
247 e += (aerr*aerr)/(a*a);
250 if ( TMath::Abs(b) > 1E-12 )
252 e += (berr*berr)/(b*b);
255 if ( TMath::Abs(c) > 1E-12 )
257 e += (cerror*cerror)/(c*c);
260 if ( TMath::Abs(d) > 1E-12 )
262 e += (derror*derror)/(d*d);
265 return TMath::Sqrt(e);
268 //_____________________________________________________________________________
269 Double_t AliAnalysisMuMuResult::ErrorABCDE(Double_t a, Double_t aerr, Double_t b, Double_t berr, Double_t c, Double_t cerror, Double_t d, Double_t derror, Double_t ee, Double_t eeerror)
271 /// Compute the quadratic sum of 4 errors
275 if ( TMath::Abs(a) > 1E-12 )
277 e += (aerr*aerr)/(a*a);
280 if ( TMath::Abs(b) > 1E-12 )
282 e += (berr*berr)/(b*b);
285 if ( TMath::Abs(c) > 1E-12 )
287 e += (cerror*cerror)/(c*c);
290 if ( TMath::Abs(d) > 1E-12 )
292 e += (derror*derror)/(d*d);
295 if ( TMath::Abs(e) > 1E-12 )
297 e += (eeerror*eeerror)/(ee*ee);
300 return TMath::Sqrt(e);
304 //_____________________________________________________________________________
305 void AliAnalysisMuMuResult::Exclude(const char* subResultList)
307 // exclude some subresult names from the list of subresult
308 // to be used when computing the mean
310 TString slist(subResultList);
312 TString tobeincluded = GetSubResultNameList();
316 Exclude(tobeincluded);
320 if ( fSubResultsToBeIncluded )
322 TObjArray* a = slist.Tokenize(",");
326 while ( ( s = static_cast<TObjString*>(nextA())) )
328 TObject* o = fSubResultsToBeIncluded->FindObject(s->String());
329 fSubResultsToBeIncluded->Remove(o);
336 //_____________________________________________________________________________
337 Double_t AliAnalysisMuMuResult::GetErrorStat(const char* name, const char* subResultName) const
339 // compute the mean value from all subresults that are included
341 if ( strlen(subResultName) > 0 )
345 AliError(Form("No subresult from which I could get the %s one...",subResultName));
346 return TMath::Limits<Double_t>::Max();
348 AliAnalysisMuMuResult* sub = static_cast<AliAnalysisMuMuResult*>(fSubResults->FindObject(subResultName));
351 AliError(Form("Could not get subresult named %s",subResultName));
352 return TMath::Limits<Double_t>::Max();
354 return sub->GetErrorStat(name);
359 TObjArray* p = static_cast<TObjArray*>(fMap->GetValue(name));
362 TParameter<double>* val = static_cast<TParameter<double>*>(p->At(kErrorStat));
363 return val->GetVal();
367 TIter next(fSubResults);
368 AliAnalysisMuMuResult* r;
370 if ( fResultMergingMethod == kMean )
378 // Double_t mean = GetValue(name);
379 Double_t wval = 0, wval2 = 0, w2err2 = 0, sumw = 0;
380 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
382 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
384 Double_t val = r->GetValue(name);
385 Double_t err = r->GetErrorStat(name);
387 Double_t wstat = 1./val;
388 Double_t w = 1./err/err/wstat;
395 w2err2 += w*w*err*err;
400 // Double_t error = r->GetErrorStat(name);
402 // Double_t e2 = error*error;
404 // if ( !(e2>0.0 ) ) e2 = TMath::Sqrt(r->GetValue(name));
408 // v2 += 1.0/(e2*e2);
410 // d += ( (r->GetValue(name) - mean)*(r->GetValue(name)-mean) / e2);
415 if ( n<1 ) return 0.0;
420 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
422 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
424 return r->GetErrorStat(name);
430 return TMath::Sqrt(w2err2*n)/sumw;
431 // sys = TMath::Sqrt(wval2/sumw - mean*mean);
433 // Double_t variance= (1.0/v1)*(1.0/(n-1))*d;
434 // // variance corrected by over/under-estimation of errors
435 // // i.e. scaled by chisquare per ndf
437 // return TMath::Sqrt(variance);
445 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
447 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
449 Double_t e = r->GetErrorStat(name)/r->GetValue(name);
451 sum += r->GetValue(name);
457 return sum*TMath::Sqrt(sume2);
461 return TMath::Limits<Double_t>::Max();
464 return TMath::Limits<Double_t>::Max();
467 //_____________________________________________________________________________
468 Double_t AliAnalysisMuMuResult::GetRMS(const char* name, const char* subResultName) const
470 // compute the rms of the subresults
471 // returns zero if no subresults
473 if ( strlen(subResultName) > 0 )
477 AliError(Form("No subresult from which I could get the %s one...",subResultName));
478 return TMath::Limits<Double_t>::Max();
480 AliAnalysisMuMuResult* sub = static_cast<AliAnalysisMuMuResult*>(fSubResults->FindObject(subResultName));
483 AliError(Form("Could not get subresult named %s",subResultName));
484 return TMath::Limits<Double_t>::Max();
486 return sub->GetRMS(name);
491 TObjArray* p = static_cast<TObjArray*>(fMap->GetValue(name));
494 TParameter<double>* val = static_cast<TParameter<double>*>(p->At(kRMS));
495 return val ? val->GetVal() : 0.0; // val can be null for old results which did not have the rms set
499 TIter next(fSubResults);
500 AliAnalysisMuMuResult* r;
506 Double_t xmean = GetValue(name);
508 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
510 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
512 Double_t e2 = r->GetErrorStat(name);
516 if ( !(e2>0.0) ) e2 = TMath::Sqrt(r->GetValue(name));
518 Double_t wi = 1.0/e2;
521 Double_t diff = r->GetValue(name) - xmean;
527 if ( n < 1 ) return 0.0;
532 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
534 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
536 return r->GetRMS(name);
541 Double_t unbiased = TMath::Sqrt( (v1/(v1*v1-v2)) * sum);
543 Double_t biased = TMath::Sqrt( sum/v1 );
545 AliDebug(1,Form("v1 %e v1*v1 %e v2 %e -> biased %e unbiased %e (ratio %e)",v1,v1*v1,v2,biased,unbiased,unbiased/biased));
550 //_____________________________________________________________________________
551 TString AliAnalysisMuMuResult::GetSubResultNameList() const
553 // get a comma separated list of our subresult aliases
554 TString tobeincluded;
555 TIter next(fSubResults);
556 AliAnalysisMuMuResult* r;
558 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next())) )
560 if (tobeincluded.Length()>0) tobeincluded+=",";
561 tobeincluded += r->Alias();
566 //_____________________________________________________________________________
567 Double_t AliAnalysisMuMuResult::GetValue(const char* name, const char* subResultName) const
569 // get a value (either directly or by computing the mean of the subresults)
571 if ( strlen(subResultName) > 0 )
575 AliError(Form("No subresult from which I could get the %s one...",subResultName));
576 return TMath::Limits<Double_t>::Max();
578 AliAnalysisMuMuResult* sub = static_cast<AliAnalysisMuMuResult*>(fSubResults->FindObject(subResultName));
581 AliError(Form("Could not get subresult named %s",subResultName));
582 return TMath::Limits<Double_t>::Max();
584 return sub->GetValue(name);
589 TObjArray* p = static_cast<TObjArray*>(fMap->GetValue(name));
592 TParameter<double>* val = static_cast<TParameter<double>*>(p->At(kValue));
593 return val->GetVal();
597 // merge the value from all subresults
598 TIter next(fSubResults);
599 AliAnalysisMuMuResult* r;
601 if ( fResultMergingMethod == kMean )
604 Double_t errorSum(0.0);
606 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
608 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
610 Double_t e = r->GetErrorStat(name)/TMath::Sqrt(r->GetValue(name)); //The Sqrt(r->GetValue(name)) was not here before
612 if ( !(e2>0.0 ) ) e2 = TMath::Sqrt(r->GetValue(name));
614 mean += r->GetValue(name)/e2;
618 if ( errorSum != 0.0 )
620 return mean/errorSum;
624 return TMath::Limits<Double_t>::Max();
631 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
633 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
635 sum += r->GetValue(name);
643 //_____________________________________________________________________________
644 Int_t AliAnalysisMuMuResult::HasValue(const char* name, const char* subResultName) const
646 /// Whether this result (or subresult if subResultName is provided) has a property
649 /// When having subresults, return the number of subresults that have this value
652 if ( strlen(subResultName) > 0 )
656 AliError(Form("No subresult from which I could get the %s one...",subResultName));
659 AliAnalysisMuMuResult* sub = static_cast<AliAnalysisMuMuResult*>(fSubResults->FindObject(subResultName));
662 AliError(Form("Could not get subresult named %s",subResultName));
665 return sub->HasValue(name);
668 if ( fMap && ( fMap->GetValue(name) != 0x0 ) )
673 TIter next(fSubResults);
674 AliAnalysisMuMuResult* r;
677 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
679 if ( r->HasValue(name) ) ++n;
685 //_____________________________________________________________________________
686 void AliAnalysisMuMuResult::Hide(const char* keyPattern)
688 /// Specify which keys will be hidden in the Print method...
692 fVisibleKeys = new THashList;
693 fVisibleKeys->SetOwner(kTRUE);
695 fVisibleKeys->Clear();
697 TIter next(fSubResults);
698 AliAnalysisMuMuResult* r;
699 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next())) )
704 TIter nextKey(Keys());
707 TPRegexp re(keyPattern);
709 while ( ( str = static_cast<TObjString*>(nextKey()) ) )
711 if ( !re.MatchB(str->String()) )
713 fVisibleKeys->Add(new TObjString(*str));
718 //_____________________________________________________________________________
719 void AliAnalysisMuMuResult::Include(const char* subResultList)
721 // (re)include some subresult names
723 TString slist(subResultList);
725 if ( slist.Length()==0 )
733 slist = GetSubResultNameList();
736 TObjArray* a = slist.Tokenize(",");
741 while ( ( s = static_cast<TObjString*>(next()) ) )
743 if (!fSubResultsToBeIncluded )
745 fSubResultsToBeIncluded = new TList;
746 fSubResultsToBeIncluded->SetOwner(kTRUE);
748 if (!IsIncluded(s->String()))
750 fSubResultsToBeIncluded->Add(s);
757 //_____________________________________________________________________________
758 Bool_t AliAnalysisMuMuResult::IsIncluded(const TString& alias) const
760 // whether that subresult alias should be included when computing means, etc...
762 if (!fSubResultsToBeIncluded) return kTRUE;
764 return ( fSubResultsToBeIncluded->FindObject(alias) != 0x0 );
767 //_____________________________________________________________________________
768 Bool_t AliAnalysisMuMuResult::IsValidValue(Double_t val) const
770 /// Whether val is a valid one
771 return ( val < TMath::Limits<Double_t>::Max() );
774 //_____________________________________________________________________________
775 THashList* AliAnalysisMuMuResult::Keys() const
777 /// Return the complete list of keys we're using
780 fKeys = new THashList;
781 fKeys->SetOwner(kTRUE);
785 while ( ( key = static_cast<TObjString*>(next()) ) )
787 if ( !fKeys->FindObject(key->String()) )
789 fKeys->Add(new TObjString(key->String()));
793 AliAnalysisMuMuResult* r;
794 TIter nextResult(fSubResults);
796 while ( ( r = static_cast<AliAnalysisMuMuResult*>(nextResult())) )
798 TIter nextHL(r->Keys());
801 while ( ( s = static_cast<TObjString*>(nextHL())) )
803 if ( !fKeys->FindObject(s->String()) )
805 fKeys->Add(new TObjString(s->String()));
815 //_____________________________________________________________________________
816 Long64_t AliAnalysisMuMuResult::Merge(TCollection* list)
820 /// Merge a list of AliAnalysisMuMuResult objects with this
821 /// Returns the number of merged objects (including this).
823 /// Note that the merging is to be understood here as a weighed mean operation
827 if (list->IsEmpty()) return 1;
832 Double_t sumw(Weight()); // sum of weights
834 while ( ( currObj = next() ) )
836 AliAnalysisMuMuResult* result = dynamic_cast<AliAnalysisMuMuResult*>(currObj);
839 AliFatal(Form("object named \"%s\" is a %s instead of an AliAnalysisMuMuResult!", currObj->GetName(), currObj->ClassName()));
843 sumw += result->Weight();
846 TIter nextKey(Keys());
849 while ( ( key = static_cast<TObjString*>(nextKey())) )
851 Double_t value = GetValue(key->String())*Weight()/sumw;
852 Double_t e = GetErrorStat(key->String());
853 Double_t e2 = e*e*Weight()*Weight()/sumw/sumw;
857 while ( ( currObj = next() ) )
859 AliAnalysisMuMuResult* result = dynamic_cast<AliAnalysisMuMuResult*>(currObj);
866 if (!result->HasValue(key->String()))
868 AliError(Form("Did not find key %s in of the result to merge",key->String().Data()));
872 // can only merge under the condition we have the same bin
874 Double_t w = result->Weight()/sumw;
878 value += result->GetValue(key->String())*w;
879 e2 += result->GetErrorStat(key->String())*result->GetErrorStat(key->String())*w2;
888 TIter nextSubresult(fSubResults);
889 AliAnalysisMuMuResult* r;
891 while ( ( r = static_cast<AliAnalysisMuMuResult*>(nextSubresult())) )
897 while ( ( currObj = next() ) )
899 sublist.Add(currObj);
907 return list->GetEntries()+1;
910 //_____________________________________________________________________________
911 Int_t AliAnalysisMuMuResult::NofIncludedSubResults(const char* name) const
913 // Return the number of subresults which have key name and are included
915 TIter next(fSubResults);
916 AliAnalysisMuMuResult* r;
918 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next()) ) )
920 if ( IsIncluded(r->Alias()) && r->HasValue(name) )
928 //_____________________________________________________________________________
929 void AliAnalysisMuMuResult::Print(Option_t* opt) const
936 for ( Int_t i = 0; i < 9; ++i )
938 sopt.ReplaceAll(Form("%d",i),"");
942 pot.ReplaceAll("ALL","");
943 pot.ReplaceAll("FULL","");
945 std::cout << pot.Data() << " ";
947 if ( fAlias.Length() > 0 )
949 std::cout << Form("%s - ",fAlias.Data());
952 std::cout << Form("%s %s %s",
953 GetName(),GetTitle(),fWeight > 0.0 ? Form(" WEIGHT %e",fWeight) : "");
955 if ( fSubResults && fSubResults->GetEntries()>1 )
957 std::cout << " (" << fSubResults->GetEntries() << " subresults)";
960 std::cout << std::endl;
965 Int_t nsub = fSubResults ? fSubResults->GetEntries() : 0;
967 while ( ( key = static_cast<TObjString*>(next())) )
969 if ( fVisibleKeys && ! fVisibleKeys->FindObject(key->String()) ) continue;
971 if ( nsub==0 || nsub == HasValue(key->String().Data()) )
973 PrintValue(key->String().Data(),pot.Data(),
974 GetValue(key->String()),
975 GetErrorStat(key->String()),
976 GetRMS(key->String()));
980 if ( fSubResults /* && fSubResults->GetEntries() > 1 */ && ( sopt.Contains("ALL") || sopt.Contains("FULL") ) )
982 std::cout << pot.Data() << "\t===== sub results ===== " << std::endl;
986 TIter nextSubresult(fSubResults);
987 AliAnalysisMuMuResult* r;
989 while ( ( r = static_cast<AliAnalysisMuMuResult*>(nextSubresult()) ) )
991 if ( !IsIncluded(r->Alias()) )
993 std::cout << " [EXCLUDED]";
995 r->Print(sopt.Data());
1000 //_____________________________________________________________________________
1001 void AliAnalysisMuMuResult::PrintValue(const char* key, const char* opt,
1002 Double_t value, Double_t errorStat, Double_t rms) const
1004 // print one value and its associated error
1006 if ( TString(key).Contains("AccEff") )
1008 std::cout << opt << Form("\t\t%20s %9.2f +- %5.2f %% (%5.2f %%)",key,value*100,errorStat*100,
1009 value != 0.0 ? errorStat*100.0/value : 0.0 );
1013 std::cout << Form(" RMS %9.2f (%5.2f %%)",rms,100.0*rms/value);
1016 std::cout << std::endl;
1018 else if ( TString(key).BeginsWith("Sigma") || TString(key).BeginsWith("Mean") )
1020 std::cout << opt << Form("\t\t%20s %9.2f +- %5.2f (%5.2f %%) MeV/c^2",key,value*1E3,1E3*errorStat,
1021 value != 0.0 ? errorStat*100.0/value : 0.0);
1025 std::cout << Form(" RMS %9.2f (%5.2f %%)",rms,100.0*rms/value);
1028 std::cout << std::endl;
1030 else if ( TString(key).Contains("Nof") || ( TString(key).Contains("Fnorm") && !TString(key).Contains("persion") ) )
1032 std::cout << opt << Form("\t\t%20s %9.3f +- %5.3f (%5.2f %%)",key,value,errorStat,
1033 value != 0.0 ? errorStat*100.0/value : 0.0);
1037 std::cout << Form(" RMS %9.2f (%5.2f %%)",rms,100.0*rms/value);
1039 std::cout << std::endl;
1041 else if ( value > 1E-3 && value < 1E3 )
1043 if (errorStat > 0.0)
1045 std::cout << opt << Form("\t\t%20s %9.3f +- %5.3f (%5.3f %%)",key,value,errorStat,
1046 value != 0.0 ? errorStat*100.0/value : 0.0);
1049 std::cout << Form(" RMS %9.2f (%5.2f %%)",rms,100.0*rms/value);
1054 std::cout << opt << Form("\t\t%20s %9.3f",key,value);
1056 std::cout << std::endl;
1060 if ( errorStat > 0.0 )
1063 std::cout << opt << Form("\t\t%20s %9.2e +- %9.2e (%5.2f %%)",key,value,errorStat,
1064 value != 0.0 ? errorStat*100.0/value : 0.0);
1067 std::cout << Form(" RMS %9.2e (%5.2f %%)",rms,100.0*rms/value);
1072 std::cout << opt << Form("\t\t%20s %9.2e ",key,value);
1074 std::cout << std::endl;
1078 //_____________________________________________________________________________
1079 void AliAnalysisMuMuResult::Scale(Double_t w)
1081 /// Scale all our internal values by value
1086 while ( ( key = static_cast<TObjString*>(next())) )
1088 Double_t value = GetValue(key->String());
1089 Double_t error = GetErrorStat(key->String());
1090 Double_t rms = GetRMS(key->String());
1092 Set(key->String(),value*w,error*w,rms*w);
1097 //_____________________________________________________________________________
1098 void AliAnalysisMuMuResult::Set(const char* name, Double_t value, Double_t errorStat, Double_t rms)
1100 /// Set a (value,error) pair with a given name
1105 fMap->SetOwnerKeyValue(kTRUE,kTRUE);
1108 TObjArray* p = static_cast<TObjArray*>(fMap->GetValue(name));
1111 p = new TObjArray(4);
1115 p->AddAt(new TParameter<Double_t>(name,value),kValue);
1116 p->AddAt(new TParameter<Double_t>(name,errorStat),kErrorStat);
1117 p->AddAt(new TParameter<Double_t>(name,rms),kRMS);
1119 fMap->Add(new TObjString(name),p);
1121 delete fKeys; // invalidate previously computed keys arrays, if any
1123 // Show("*"); // invalidate as well any printout filter that may have been set
1127 static_cast<TParameter<double>*>(p->At(kValue))->SetVal(value);
1128 static_cast<TParameter<double>*>(p->At(kErrorStat))->SetVal(errorStat);
1129 static_cast<TParameter<double>*>(p->At(kRMS))->SetVal(rms);
1133 //_____________________________________________________________________________
1134 void AliAnalysisMuMuResult::Show(const char* keyPattern)
1136 /// Specify which keys will be shown in the Print method...
1140 fVisibleKeys = new THashList;
1141 fVisibleKeys->SetOwner(kTRUE);
1143 fVisibleKeys->Clear();
1145 TIter next(fSubResults);
1146 AliAnalysisMuMuResult* r;
1147 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next())) )
1149 r->Show(keyPattern);
1152 TIter nextKey(Keys());
1155 TPRegexp re(keyPattern);
1157 while ( ( str = static_cast<TObjString*>(nextKey()) ) )
1159 if ( re.MatchB(str->String()) )
1161 fVisibleKeys->Add(new TObjString(*str));
1167 //_____________________________________________________________________________
1168 AliAnalysisMuMuResult*
1169 AliAnalysisMuMuResult::SubResult(const char* subResultName) const
1171 /// get a given subresult
1176 TIter next(fSubResults);
1177 AliAnalysisMuMuResult* r;
1178 while ( ( r = static_cast<AliAnalysisMuMuResult*>(next())) )
1180 if ( r->Alias() == subResultName )
1188 //_____________________________________________________________________________
1189 TList* AliAnalysisMuMuResult::SubResultsToBeIncluded() const
1191 if (!fSubResultsToBeIncluded)
1193 fSubResultsToBeIncluded = new TList;
1194 fSubResultsToBeIncluded->SetOwner(kTRUE);
1196 return fSubResultsToBeIncluded;