from Ante Bilandzic: proper use of weights calculated in a previous run over the...
authormkrzewic <mikolaj.krzewicki@cern.ch>
Tue, 1 Apr 2014 12:34:55 +0000 (14:34 +0200)
committermkrzewic <mikolaj.krzewicki@cern.ch>
Tue, 1 Apr 2014 12:34:55 +0000 (14:34 +0200)
PWG/FLOW/Base/AliFlowAnalysisWithMultiparticleCorrelations.cxx
PWG/FLOW/Tasks/AliAnalysisTaskMultiparticleCorrelations.cxx
PWG/FLOW/Tasks/AliAnalysisTaskMultiparticleCorrelations.h

index 2e05770..56e3fac 100644 (file)
@@ -4570,7 +4570,7 @@ void AliFlowAnalysisWithMultiparticleCorrelations::SetWeightsHist(TH1D* const hi
  TString sType[2] = {"RP","POI"};
  TString sVariable[3] = {"phi","pt","eta"};
  fWeightsHist[rp][ppe]->SetName(Form("%s weights (%s)",sVariable[ppe].Data(),sType[rp].Data()));
- fWeightsHist[rp][ppe]->SetTitle(Form("%s weights (%s)",sVariable[ppe].Data(),sType[rp].Data()));
+ //fWeightsHist[rp][ppe]->SetTitle(Form("%s weights (%s)",sVariable[ppe].Data(),sType[rp].Data()));
 
  // Flag:
  fUseWeights[rp][ppe] = kTRUE; 
@@ -4853,8 +4853,9 @@ TH1D *AliFlowAnalysisWithMultiparticleCorrelations::GetHistogramWithWeights(cons
  TList *list = dynamic_cast<TList*>(directoryFile->Get(listName));
  if(!list)
  {
-  //printf("\n => if(!list)\n\n");   
-  Fatal(sMethodName.Data(),"if(!list)");
+  cout<<Form("listName = %s",listName)<<endl;
+  Warning(sMethodName.Data(),"if(!list)"); 
+  return NULL;
  }
  // Finally, access the desired histogram:
  hist = dynamic_cast<TH1D*>(list->FindObject(Form("%s,%s",type,variable)));
index 51293a3..65f252b 100644 (file)
@@ -302,20 +302,25 @@ void AliAnalysisTaskMultiparticleCorrelations::UserCreateOutputObjects()
 
  // Weights:
  TString type[2] = {"RP","POI"};
- TString variable[3] = {"phi","pt","eta"};
+ TString variable[3] = {"phi","pt","eta"}; 
  for(Int_t rp=0;rp<2;rp++) // [RP,POI]
  {
   for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
   {
    if(fUseWeights[rp][ppe])
    {
-    if(!fWeightsHist[rp][ppe]){Fatal(sMethodName.Data(),"fWeightsHist[%d][%d]",rp,ppe);}
-    else{fMPC->SetWeightsHist(fWeightsHist[rp][ppe],type[rp].Data(),variable[ppe].Data());}
-   }
+    if(!fWeightsHist[rp][ppe])
+    {
+     fWeightsHist[rp][ppe] = GetHistogramWithWeights(TString(Form("%s/%s",gSystem->pwd(),"weights.root")).Data(),TString(this->fName).Data(),type[rp].Data(),variable[ppe].Data());
+    }
+    if(!fWeightsHist[rp][ppe])
+    {
+     Fatal(sMethodName.Data(),"fWeightsHist[%d][%d]",rp,ppe);
+    } else{fMPC->SetWeightsHist(fWeightsHist[rp][ppe],type[rp].Data(),variable[ppe].Data());}
+   } // if(fUseWeights[rp][ppe])
   } // for(Int_t ppe=0;ppe<3;ppe++) // [phi,pt,eta]
  } // for(Int_t rp=0;rp<2;rp++) // [RP,POI]
 
-
  // Control histos:
  // Kinematics:
  //TString typeKine[2] = {"RP","POI"};
index 84ad690..ec39389 100644 (file)
@@ -68,7 +68,7 @@ class AliAnalysisTaskMultiparticleCorrelations : public AliAnalysisTaskSE{
   void SetWeightsHist(TH1D* const hist, const char *type, const char *variable); // .cxx
   TH1D* GetHistogramWithWeights(const char *filePath, const char *listName, const char *type, const char *variable)
   {
-   AliFlowAnalysisWithMultiparticleCorrelations *mpc;
+   AliFlowAnalysisWithMultiparticleCorrelations *mpc = new AliFlowAnalysisWithMultiparticleCorrelations();
    return mpc->GetHistogramWithWeights(filePath,listName,type,variable);
   };