]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG2/FLOW/AliFlowTasks/AliAnalysisTaskLeeYangZeros.cxx
added merging for Lee Yang Zeroes
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliAnalysisTaskLeeYangZeros.cxx
index 698422e5de375fade46a24b269dbf28fd17181a8..052c4152c096bc382c06122685669c81d5207fb5 100644 (file)
@@ -141,143 +141,22 @@ void AliAnalysisTaskLeeYangZeros::Exec(Option_t *)
 void AliAnalysisTaskLeeYangZeros::Terminate(Option_t *) 
 {
   // Called once at the end of the query
-
-  const Int_t iNtheta = AliFlowLYZConstants::kTheta;
-
+  
   AliFlowAnalysisWithLeeYangZeros* fLyzTerm = new AliFlowAnalysisWithLeeYangZeros() ;
   fLyzTerm -> SetFirstRun(GetFirstRunLYZ());   //set first run true or false
   fLyzTerm -> SetUseSum(GetUseSumLYZ());       //set use sum true or false
    
   fListHistos = (TList*)GetOutputData(0);
-  //cout << "histogram list in Terminate" << endl;
-
-  if (fListHistos) {
-
-    //define histograms for first and second run
-    AliFlowCommonHist *pCommonHist = NULL;
-    AliFlowCommonHistResults *pCommonHistResults = NULL;
-    TProfile* pHistProVtheta = NULL;
-    TProfile* pHistProReDenom = NULL;
-    TProfile* pHistProImDenom = NULL;
-    TProfile* pHistProReDtheta = NULL;
-    TProfile* pHistProImDtheta = NULL;
-    TProfile* pHistProVetaRP = NULL;
-    TProfile* pHistProVetaPOI = NULL;
-    TProfile* pHistProVPtRP  = NULL;
-    TProfile* pHistProVPtPOI  = NULL;
-    AliFlowLYZHist1 *pLYZHist1[iNtheta] = {NULL};      //array of pointers to AliFlowLYZHist1
-    AliFlowLYZHist2 *pLYZHist2RP[iNtheta] = {NULL};    //array of pointers to AliFlowLYZHist2
-    AliFlowLYZHist2 *pLYZHist2POI[iNtheta] = {NULL};   //array of pointers to AliFlowLYZHist2
-
-    if (GetFirstRunLYZ()) { //first run
-      //Get the common histograms from the output list
-      pCommonHist = dynamic_cast<AliFlowCommonHist*> 
-       (fListHistos->FindObject("AliFlowCommonHistLYZ1"));
-      pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*> 
-       (fListHistos->FindObject("AliFlowCommonHistResultsLYZ1"));
-    }
-    else { //second run
-      //Get the common histograms from the output list
-      pCommonHist = dynamic_cast<AliFlowCommonHist*> 
-       (fListHistos->FindObject("AliFlowCommonHistLYZ2"));
-      pCommonHistResults = dynamic_cast<AliFlowCommonHistResults*> 
-       (fListHistos->FindObject("AliFlowCommonHistResultsLYZ2"));
-    }
-
-    TProfile* pHistProR0theta = dynamic_cast<TProfile*> 
-      (fListHistos->FindObject("First_FlowPro_r0theta_LYZ"));
-
-    TH1F* pHistQsumforChi = dynamic_cast<TH1F*> 
-      (fListHistos->FindObject("Flow_QsumforChi_LYZ"));
-
-    
-    if (GetFirstRunLYZ()) { //for firstrun
-      //Get the histograms from the output list
-      for(Int_t theta = 0;theta<iNtheta;theta++){
-       TString name = "AliFlowLYZHist1_"; 
-       name += theta;
-       pLYZHist1[theta] = dynamic_cast<AliFlowLYZHist1*> 
-         (fListHistos->FindObject(name));
-      }
-      pHistProVtheta = dynamic_cast<TProfile*> 
-         (fListHistos->FindObject("First_FlowPro_Vtheta_LYZ"));
-
-      //Set the histogram pointers and call Finish()
-      if (pCommonHist && pCommonHistResults && pLYZHist1[0] && 
-         pHistProVtheta && pHistProR0theta && pHistQsumforChi ) {
-       fLyzTerm->SetCommonHists(pCommonHist);
-       fLyzTerm->SetCommonHistsRes(pCommonHistResults);
-       fLyzTerm->SetHist1(pLYZHist1);
-       fLyzTerm->SetHistProVtheta(pHistProVtheta);
-       fLyzTerm->SetHistProR0theta(pHistProR0theta);
-       fLyzTerm->SetHistQsumforChi(pHistQsumforChi);
-       fLyzTerm->Finish();
-       PostData(0,fListHistos);
-      } else { 
-       cout<<"WARNING: Histograms needed to run Finish() firstrun are not accessable!"<<endl; 
-      }
-    } else { //for second run
-      //Get the histograms from the output list
-      for(Int_t theta = 0;theta<iNtheta;theta++){
-       TString nameRP = "AliFlowLYZHist2RP_"; 
-       nameRP += theta;
-       pLYZHist2RP[theta] = dynamic_cast<AliFlowLYZHist2*> 
-         (fListHistos->FindObject(nameRP));
-       TString namePOI = "AliFlowLYZHist2POI_"; 
-       namePOI += theta;
-       pLYZHist2POI[theta] = dynamic_cast<AliFlowLYZHist2*> 
-         (fListHistos->FindObject(namePOI));
-
-      }
-      
-      pHistProReDenom = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_ReDenom_LYZ"));
-      pHistProImDenom = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_ImDenom_LYZ"));
-
-      pHistProReDtheta = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_ReDtheta_LYZ"));
-      pHistProImDtheta = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_ImDtheta_LYZ"));
-
-      pHistProVetaRP = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_VetaRP_LYZ"));
-      pHistProVetaPOI = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_VetaPOI_LYZ"));
-      pHistProVPtRP = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_VPtRP_LYZ"));
-      pHistProVPtPOI = dynamic_cast<TProfile*> 
-       (fListHistos->FindObject("Second_FlowPro_VPtPOI_LYZ"));
-
-
-      //Set the histogram pointers and call Finish()
-      if (pCommonHist && pCommonHistResults && pLYZHist2RP[0] && pLYZHist2POI[0] && 
-         pHistProR0theta && pHistProReDenom && pHistProImDenom && pHistProVetaRP && 
-         pHistProVetaPOI && pHistProVPtRP && pHistProVPtPOI) {
-       fLyzTerm->SetCommonHists(pCommonHist);
-       fLyzTerm->SetCommonHistsRes(pCommonHistResults);
-       fLyzTerm->SetHist2RP(pLYZHist2RP);
-       fLyzTerm->SetHist2POI(pLYZHist2POI);
-       fLyzTerm->SetHistProR0theta(pHistProR0theta);
-       fLyzTerm->SetHistProReDenom(pHistProReDenom);
-       fLyzTerm->SetHistProImDenom(pHistProImDenom);
-       fLyzTerm->SetHistProReDtheta(pHistProReDtheta);
-       fLyzTerm->SetHistProImDtheta(pHistProImDtheta);
-       fLyzTerm->SetHistProVetaRP(pHistProVetaRP);
-       fLyzTerm->SetHistProVetaPOI(pHistProVetaPOI);
-       fLyzTerm->SetHistProVPtRP(pHistProVPtRP);
-       fLyzTerm->SetHistProVPtPOI(pHistProVPtPOI);
-       fLyzTerm->SetHistQsumforChi(pHistQsumforChi);
-       fLyzTerm->Finish();
+  
+  if(fListHistos) 
+  {
+   fLyzTerm -> GetOutputHistograms(fListHistos);
+   fLyzTerm -> Finish();
        PostData(0,fListHistos);
-      } else { 
-       cout<<"WARNING: Histograms needed to run Finish() secondrun are not accessable!"<<endl; 
-      }
-    }
-          
-    //    fListHistos->Print(); 
-  }    
-  else { cout << "histogram list pointer in Lee-Yang Zeros is empty" << endl;}
+  } else 
+    {
+     cout << "histogram list pointer in Lee-Yang Zeros is empty in AliAnalysisTaskLYZ::Terminate ()" << endl;
+    } 
 
   //cout<<".....finished"<<endl;
 }