]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implement weigths for Q cumulants in local run
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Feb 2009 10:05:21 +0000 (10:05 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Feb 2009 10:05:21 +0000 (10:05 +0000)
PWG2/FLOW/AliFlowAnalysisWithQCumulants.cxx
PWG2/FLOW/AliFlowAnalysisWithQCumulants.h
PWG2/FLOW/AliFlowEventSimple.cxx
PWG2/FLOW/AliFlowEventSimple.h
PWG2/FLOW/macros/makeWeights.C [moved from PWG2/FLOW/macros/makeWeightsForTheSecondRun.C with 68% similarity, mode: 0755]
PWG2/FLOW/macros/runFlowAnalysis.C

index 6a8e541dbfbbf430fcb160e233e37fb7906ec49d..426aa2456591686c1282438b6188b60f94bb29bf 100644 (file)
@@ -68,6 +68,7 @@ ClassImp(AliFlowAnalysisWithQCumulants)
 AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants():  
  fTrack(NULL),
  fHistList(NULL),
+ fWeightsList(NULL),
  fAvMultIntFlowQC(NULL),
  fQvectorComponents(NULL),
  fIntFlowResultsQC(NULL),
@@ -148,14 +149,12 @@ AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants():
  fEventCounter(0),
  fUsePhiWeights(kFALSE),
  fUsePtWeights(kFALSE),
- fUseEtaWeights(kFALSE),
- fPhiWeights(),
- fPtWeights(),
- fEtaWeights()
+ fUseEtaWeights(kFALSE)
 {
  //constructor 
  fHistList = new TList(); 
+ fWeightsList = new TList();
+  
  fnBinsPt = AliFlowCommonConstants::GetNbinsPt();
  fPtMin   = AliFlowCommonConstants::GetPtMin();             
  fPtMax   = AliFlowCommonConstants::GetPtMax();
@@ -163,17 +162,13 @@ AliFlowAnalysisWithQCumulants::AliFlowAnalysisWithQCumulants():
  fnBinsEta = AliFlowCommonConstants::GetNbinsEta();
  fEtaMin   = AliFlowCommonConstants::GetEtaMin();           
  fEtaMax   = AliFlowCommonConstants::GetEtaMax();
- //to be improved
- fPhiWeights.Reset();
- fPtWeights.Reset();
- fEtaWeights.Reset();
 }
 
 AliFlowAnalysisWithQCumulants::~AliFlowAnalysisWithQCumulants()
 {
- //desctructor
+ //destructor
  delete fHistList; 
+ delete fWeightsList;
 }
 
 //================================================================================================================
@@ -512,7 +507,7 @@ void AliFlowAnalysisWithQCumulants::Init()
  fmPrimePerEtaBin->SetYTitle("Counts");
  //fHistList->Add(fOverlapPerEtaBin);
  
- //fEtaReq1nPrimePrimePOI
+ //fEtaReq1nPrimePrimePOIafvQvector1n=anEvent->GetQ(1*n
  fEtaReq1nPrimePrimePOI = new TProfile("fEtaReq1nPrimePrimePOI","Re[q_{n}^{''}]",fnBinsEta,fEtaMin,fEtaMax,"s");
  fEtaReq1nPrimePrimePOI->SetXTitle("#eta");
  fEtaReq1nPrimePrimePOI->SetYTitle("Re[q_{n}^{''}]");
@@ -657,15 +652,6 @@ void AliFlowAnalysisWithQCumulants::Init()
  f8pDistribution->SetXTitle("<8>_{n,n,n,n|n,n,n,n}");
  f8pDistribution->SetYTitle("Counts");
  fHistList->Add(f8pDistribution);
- //phi weights
- //fHistList->Add(&fPhiWeights);
- //pt weights
- //fHistList->Add(&fPtWeights);
- //eta weights
- //fHistList->Add(&fEtaWeights);
 }//end of Init()
 
 //================================================================================================================
@@ -673,23 +659,7 @@ void AliFlowAnalysisWithQCumulants::Init()
 void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
 {
  //running over data 
- //set the weights:
- if(fUsePhiWeights)
- {
-  anEvent->SetUseWeightsPhi(fUsePhiWeights);
-  anEvent->SetPhiWeights(&fPhiWeights);
- }
- if(fUsePtWeights)
- {
-  anEvent->SetUseWeightsPt(fUsePtWeights);
-  anEvent->SetPtWeights(&fPtWeights);
- }
- if(fUseEtaWeights)
- {
-  anEvent->SetUseWeightsEta(fUseEtaWeights);
-  anEvent->SetEtaWeights(&fEtaWeights);
- }
-  
  //get the total multiplicity nPrim of event:
  Int_t nPrim = anEvent->NumberOfTracks();//nPrim = RPs + POIs + rest  
 
@@ -707,20 +677,21 @@ void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
  
  afvQvector1n.Set(0.,0.);
  afvQvector1n.SetMult(0);
- afvQvector1n=anEvent->GetQ(1*n); 
-
+ afvQvector1n=anEvent->GetQ(1*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
  afvQvector2n.Set(0.,0.);
  afvQvector2n.SetMult(0);
- afvQvector2n=anEvent->GetQ(2*n);                          
+ afvQvector2n=anEvent->GetQ(2*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
+                                            
  afvQvector3n.Set(0.,0.);
  afvQvector3n.SetMult(0);
- afvQvector3n=anEvent->GetQ(3*n);       
+ afvQvector3n=anEvent->GetQ(3*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights); 
  
  afvQvector4n.Set(0.,0.);
  afvQvector4n.SetMult(0);
- afvQvector4n=anEvent->GetQ(4*n); 
+ afvQvector4n=anEvent->GetQ(4*n,fWeightsList,fUsePhiWeights,fUsePtWeights,fUseEtaWeights);
+
+            
             
  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  //                        !!!! to be removed !!!!
@@ -835,6 +806,7 @@ void AliFlowAnalysisWithQCumulants::Make(AliFlowEventSimple* anEvent)
  if(dMult>1)
  {
   //fill the common control histogram (2nd order):
+  
   fCommonHists2nd->FillControlHistograms(anEvent); 
  
   two1n1n = (pow(afvQvector1n.Mod(),2.)-dMult)/(dMult*(dMult-1.)); //<2>_{n|n}   = <cos(n*(phi1-phi2))>
index 45a57c4c2cbc9dba3f2e299a6a1892970fd70d1b..843973967c3b49335b666b72a3af58eabe79fe79 100644 (file)
@@ -46,7 +46,10 @@ class AliFlowAnalysisWithQCumulants{
 //----------------------------------------------------------------------------------------------------------------
 //                                            setters and getters                                                 
 //----------------------------------------------------------------------------------------------------------------
-  TList* GetHistList() const {return this->fHistList;} //output histogram list
+  TList* GetHistList() const {return this->fHistList;} 
+  
+  void SetWeightsList(TList* wlist) {this->fWeightsList = wlist;}
+  TList* GetWeightsList() const {return this->fWeightsList;}   
  
   void SetIntFlowResults(TH1D* const ifr) {this->fIntFlowResultsQC = ifr;};
   TH1D* GetIntFlowResults() const {return this->fIntFlowResultsQC;};
@@ -116,7 +119,7 @@ class AliFlowAnalysisWithQCumulants{
   
   void SetFour1n1n1n1nPerPtBinRP(TProfile* const pb4PerPtBin1n1n1n1nRP) {this->f4PerPtBin1n1n1n1nRP = pb4PerPtBin1n1n1n1nRP;};
   TProfile* GetFour1n1n1n1nPerPtBinRP() const {return this->f4PerPtBin1n1n1n1nRP;}; 
-  
+
   void SetTwo1n1nPerEtaBinRP(TProfile* const pb2PerEtaBin1n1nRP) {this->f2PerEtaBin1n1nRP = pb2PerEtaBin1n1nRP;};
   TProfile* GetTwo1n1nPerEtaBinRP() const {return this->f2PerEtaBin1n1nRP;};
   
@@ -165,14 +168,14 @@ class AliFlowAnalysisWithQCumulants{
   void SetDirectCorrelations(TProfile* const dc) {this->fDirectCorrelations = dc;};
   TProfile* GetDirectCorrelations() const {return this->fDirectCorrelations;};
   
-  void SetPhiWeights(TH1F const phiW) { this->fPhiWeights = phiW; this->fUsePhiWeights = kTRUE;};
-  TH1F GetPhiWeights() const { return this->fPhiWeights;};
+  void SetUsePhiWeights(Bool_t const) {this->fUsePhiWeights = kTRUE;};
+  Bool_t GetUsePhiWeights() const {return this->fUsePhiWeights;};
   
-  void SetPtWeights(TH1D const ptW) { this->fPtWeights = ptW; ; this->fUsePtWeights = kTRUE;};
-  TH1D GetPtWeights() const { return this->fPtWeights;};
+  void SetUsePtWeights(Bool_t const) {this->fUsePtWeights = kTRUE;};
+  Bool_t GetUsePtWeights() const {return this->fUsePtWeights;};
   
-  void SetEtaWeights(TH1D const etaW) { this->fEtaWeights = etaW; ; this->fUseEtaWeights = kTRUE;};
-  TH1D GetEtaWeights() const { return this->fEtaWeights;};
+  void SetUseEtaWeights(Bool_t const) {this->fUseEtaWeights = kTRUE;};
+  Bool_t GetUseEtaWeights() const {return this->fUseEtaWeights;};
 //----------------------------------------------------------------------------------------------------------------
  
  private:
@@ -181,6 +184,8 @@ class AliFlowAnalysisWithQCumulants{
   
   AliFlowTrackSimple* fTrack;                           //track
   TList*              fHistList;                        //list to hold all output histograms
+  TList*              fWeightsList;                     //list to hold all histograms with weights
+    
   TProfile*           fAvMultIntFlowQC;                 //average selected multiplicity (for int. flow)
  
   TProfile*           fQvectorComponents;               //averages of Q-vector components (1st bin: <Q_x>, 2nd bin: <Q_y>, ...)
@@ -281,13 +286,10 @@ class AliFlowAnalysisWithQCumulants{
   Double_t                   fEtaMax;                   //maximum eta
   Int_t                      fEventCounter;             //counting the number of events    
    
-  Bool_t                     fUsePhiWeights;            // phi weights
-  Bool_t                     fUsePtWeights;             // v_2(pt) weights
-  Bool_t                     fUseEtaWeights;            // v_2(eta) weights
-  TH1F                       fPhiWeights;               // histogram with phi weights
-  TH1D                       fPtWeights;                // histogram with v_2(pt) weights   
-  TH1D                       fEtaWeights;               // histogram with v_2(eta) weights    
-                        
+  Bool_t                     fUsePhiWeights;            //phi weights
+  Bool_t                     fUsePtWeights;             //v_2(pt) weights
+  Bool_t                     fUseEtaWeights;            //v_2(eta) weights
+                     
   ClassDef(AliFlowAnalysisWithQCumulants, 0);
 };
 
index 9d5edc8cbba638b3a61f5482e131a612b0066229..7b378f8a7891c692fff878e56320734bbcfbc96d 100644 (file)
@@ -16,6 +16,7 @@
 #include "Riostream.h"
 #include "TObjArray.h"
 #include "TFile.h"
+#include "TList.h"
 #include "TMath.h"
 #include "TH1F.h"
 #include "TH1D.h"
@@ -41,13 +42,7 @@ ClassImp(AliFlowEventSimple)
   AliFlowEventSimple::AliFlowEventSimple(Int_t aLenght):
     fTrackCollection(NULL),
     fNumberOfTracks(0),
-    fEventNSelTracksIntFlow(0),
-    fUseWeightsPhi(kFALSE),
-    fUseWeightsPt(kFALSE),
-    fUseWeightsEta(kFALSE),
-    fPhiWeights(NULL),
-    fPtWeights(NULL),
-    fEtaWeights(NULL)
+    fEventNSelTracksIntFlow(0)
 {
   //constructor 
   fTrackCollection =  new TObjArray(aLenght) ;
@@ -59,13 +54,7 @@ AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
   TObject(),
   fTrackCollection(anEvent.fTrackCollection),
   fNumberOfTracks(anEvent.fNumberOfTracks),
-  fEventNSelTracksIntFlow(anEvent.fEventNSelTracksIntFlow),
-  fUseWeightsPhi(anEvent.fUseWeightsPhi),
-  fUseWeightsPt(anEvent.fUseWeightsPt),
-  fUseWeightsEta(anEvent.fUseWeightsEta),
-  fPhiWeights(anEvent.fPhiWeights),
-  fPtWeights(anEvent.fPtWeights),
-  fEtaWeights(anEvent.fEtaWeights)
+  fEventNSelTracksIntFlow(anEvent.fEventNSelTracksIntFlow)
 {
   //copy constructor 
 }
@@ -77,12 +66,6 @@ AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEv
   *fTrackCollection = *anEvent.fTrackCollection ;
   fNumberOfTracks = anEvent.fNumberOfTracks;
   fEventNSelTracksIntFlow = anEvent.fEventNSelTracksIntFlow;
-  fUseWeightsPhi = anEvent.fUseWeightsPhi;
-  fUseWeightsPt = anEvent.fUseWeightsPt;
-  fUseWeightsEta = anEvent.fUseWeightsEta;
-  fPhiWeights = anEvent.fPhiWeights;
-  fPtWeights = anEvent.fPtWeights;
-  fEtaWeights = anEvent.fEtaWeights;
   
   return *this;
 }
@@ -105,7 +88,7 @@ AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
 }
 
 //-----------------------------------------------------------------------   
-AliFlowVector AliFlowEventSimple::GetQ(Int_t n) 
+AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights
 {
   //calculate Q-vector in harmonic n without weights (default harmonic n=2)  
   Double_t dQX = 0.;
@@ -131,32 +114,39 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n)
   Double_t wPt=1.;  //weight Pt 
   Double_t wEta=1.; //weight Eta 
   
-  if(fUseWeightsPhi)
+  TH1F *phiWeights = NULL;
+  TH1D *ptWeights = NULL;
+  TH1D *etaWeights = NULL;
+
+  if(weightsList)
   {
-   if(fPhiWeights)
+   if(usePhiWeights)
    {
-    nBinsPhi = fPhiWeights->GetNbinsX();
-   }else{cout<<" WARNING: couldn't find histogram phi_weights in the file weightsForTheSecondRun.root"<<endl;}           
-  } 
-  
-  if(fUseWeightsPt)
-  {
-   if(fPtWeights)
+    phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
+    if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
+   }          
+   if(usePtWeights)
    {
-    dBinWidthPt = fPtWeights->GetBinWidth(1);//assuming that all bins have the same width
-    dNormPt = fPtWeights->Integral();
-   }else{cout<<" WARNING: couldn't find histogram pt_weights in the file weightsForTheSecondRun.root"<<endl;}           
-  } 
-  
-  if(fUseWeightsEta)
-  {
-   if(fEtaWeights)
+    ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
+    if(ptWeights)
+    {
+     dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
+     dNormPt = ptWeights->Integral();
+    } 
+   }       
+   if(useEtaWeights)
    {
-    dBinWidthEta = fEtaWeights->GetBinWidth(1);//assuming that all bins have the same width
-    dNormEta = fEtaWeights->Integral();
-   }else{cout<<" WARNING: couldn't find histogram eta_weights in the file weightsForTheSecondRun.root"<<endl;}           
-  } 
+    etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
+    if(etaWeights)
+    {
+     dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
+     dNormEta = etaWeights->Integral();
+    } 
+   }          
+  } // end of if(weightsList)
+
   
+  // loop over tracks    
   for(Int_t i=0;i<fNumberOfTracks;i++)                               
   {
    pTrack = (AliFlowTrackSimple*)TrackCollection()->At(i); 
@@ -167,25 +157,28 @@ AliFlowVector AliFlowEventSimple::GetQ(Int_t n)
      dPhi = pTrack->Phi();
      dPt  = pTrack->Pt();
      dEta = pTrack->Eta();
+    
      //determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
-     if(fUseWeightsPhi && fPhiWeights && (nBinsPhi!=0) && (fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())))!=0))
+     if(phiWeights && (nBinsPhi!=0) && (phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())))!=0))
      {
-      wPhi=pow(nBinsPhi*fPhiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi()))),-1);
+      wPhi=pow(nBinsPhi*phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi()))),-1);
      }
      //determine v'(pt) weight:    
-     if(fUseWeightsPt && fPtWeights && dBinWidthPt && dNormPt)
+     if(ptWeights && dBinWidthPt && dNormPt)
      {
-      wPt=fPtWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPt/dBinWidthPt)))/dNormPt; 
+      wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPt/dBinWidthPt)))/dNormPt; 
      }            
      //determine v'(eta) weight:    
-     if(fUseWeightsEta && fEtaWeights && dBinWidthEta && dNormEta)
+     if(etaWeights && dBinWidthEta && dNormEta)
      {
-      wEta=fEtaWeights->GetBinContent(1+(Int_t)(TMath::Floor(dEta/dBinWidthEta)))/dNormEta; 
-     }  
+      wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor(dEta/dBinWidthEta)))/dNormEta; 
+     } 
+       
      //building up the weighted Q-vector:       
      dQX += wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
      dQY += wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi); 
      iUsedTracks++;
+     
     }//end of if (pTrack->UseForIntegratedFlow())
    }//end of if (pTrack)
    else {cerr << "no particle!!!"<<endl;}
index 975d7c74fff33ad4b9b6186bb8f56d5dc6029b66..0ccde4c784bc609f6d54b6a2265b13535662a765 100644 (file)
@@ -34,36 +34,16 @@ class AliFlowEventSimple: public TObject {
   void SetNumberOfTracks(Int_t nr)          { this->fNumberOfTracks = nr; }
   void SetEventNSelTracksIntFlow(Int_t nr)  { this->fEventNSelTracksIntFlow = nr; }
  
-  //setters and getters
-  void SetUseWeightsPhi(Bool_t const uwPhi) { this->fUseWeightsPhi = uwPhi;};
-  Bool_t GetUseWeightsPhi() const { return this->fUseWeightsPhi;};
-  
-  void SetUseWeightsPt(Bool_t const uwPt) { this->fUseWeightsPt = uwPt;};
-  Bool_t GetUseWeightsPt() const { return this->fUseWeightsPt;};
-  
-  void SetUseWeightsEta(Bool_t const uwEta) { this->fUseWeightsEta = uwEta;};
-  Bool_t GetUseWeightsEta() const { return this->fUseWeightsEta;};
-  
-  void SetPhiWeights(TH1F* const fphiw)     { this->fPhiWeights = fphiw;};
-  void SetPtWeights(TH1D* const fptw)       { this->fPtWeights = fptw;};
-  void SetEtaWeights(TH1D* const fetaw)     { this->fEtaWeights = fetaw;};
-  
   AliFlowTrackSimple* GetTrack(Int_t i);
   TObjArray* TrackCollection() const        { return this->fTrackCollection; }
-  AliFlowVector GetQ(Int_t n=2);                //get Q-vector evaluated in harmonic n (default harmonic n=2) 
-  
+  AliFlowVector GetQ(Int_t n=2, TList *weightsList=NULL, Bool_t usePhiWeights=kFALSE, Bool_t usePtWeights=kFALSE, Bool_t useEtaWeights=kFALSE);
+   
  private:
   TObjArray*           fTrackCollection;        // collection of tracks
   Int_t                fNumberOfTracks;         // number of tracks
   Int_t                fEventNSelTracksIntFlow; // number of tracks selected for integrated flow calculation
   
-  Bool_t fUseWeightsPhi;       // phi weights
-  Bool_t fUseWeightsPt;        // v_2(pt) weights
-  Bool_t fUseWeightsEta;       // v_2(eta) weights   
-  TH1F *fPhiWeights;           // phi weights
-  TH1D *fPtWeights;            // v_2(pt) weights   
-  TH1D *fEtaWeights;           // v_2(eta) weights
-  
   ClassDef(AliFlowEventSimple,1)                // macro for rootcint
 };
 
old mode 100644 (file)
new mode 100755 (executable)
similarity index 68%
rename from PWG2/FLOW/macros/makeWeightsForTheSecondRun.C
rename to PWG2/FLOW/macros/makeWeights.C
index 4c4c950..3cbc642
@@ -1,18 +1,18 @@
-//=====================================================================================
-// Before using the macro makeWeightsForTheSecondRun.C you should already have         
-// available the output .root files from various methods from the first run over data 
-// without any weights. When calling this macro you must specify the analysis type 
-// and the method from which output file you would like to make the weights for the 
-// second run (for the cumulants, GFC and QC, you must also specify the order): 
+//==========================================================================================
+// Before using the macro makeWeights.C you should already have available the output .root 
+// files from various methods from the previous run over data (without any weights). When 
+// calling this macro you must specify the analysis type and the method from which output 
+// file you would like to make the weights for the next run (for the cumulants, GFC and QC,
+// you must also specify the order): 
 // 
 // 1. type of analysis can be: ESD, AOD, MC, ESDMC0 or ESDMC1;
 //
 // 2. method can be: MCEP, LYZ1, LYZ2, LYZEP, FQD, GFC or QC; 
 //
 // 3. cumulant order can be: 2nd, 4th, 6th or 8th.                                                   
-//=====================================================================================
+//==========================================================================================
 
-void makeWeightsForTheSecondRun(TString type="ESD", TString method="GFC", TString cumulantOrder="4th")
+void makeWeights(TString type="ESD", TString method="GFC", TString cumulantOrder="4th")
 {
  //load needed libraries:
  gSystem->AddIncludePath("-I$ROOTSYS/include");
@@ -59,8 +59,9 @@ void makeWeightsForTheSecondRun(TString type="ESD", TString method="GFC", TStrin
   }//end of if(pList)  
  }//end of if(file) 
 
- //making the output file and storing the histograms needed for the weights:
- TFile* outputFile = new TFile("weightsForTheSecondRun.root","RECREATE"); 
+ //making the output file and creating the TList to hold the histograms with weights:
+ TFile* outputFile = new TFile("weights.root","RECREATE"); 
+ TList* listWeights = new TList();
  //common control histos:
  if(commonHist)
  {
@@ -72,25 +73,24 @@ void makeWeightsForTheSecondRun(TString type="ESD", TString method="GFC", TStrin
   {
    (commonHist->GetHistPhiInt())->Scale(1./norm);
   } 
-  //writing the normalized histogram in output file: 
-  (commonHist->GetHistPhiInt())->Write();
- }else
-  {
-   cout<<" WARNING: the common control histos from the 1st run were not accessed."<<endl;
-  } 
+  listWeights->Add(commonHist->GetHistPhiInt());
+ }else{cout<<" WARNING: the common control histos from the 1st run were not accessed."<<endl;} 
  //common results histos:
  if(commonHistRes)
  {
-  //diff. flow in pt from the first run:
+  //diff. flow (pt):
   (commonHistRes->GetHistDiffFlowPtPOI())->SetName("pt_weights");
-  (commonHistRes->GetHistDiffFlowPtPOI())->Write();
-  //diff. flow in eta from the first run:
+  listWeights->Add(commonHistRes->GetHistDiffFlowPtPOI());
+  //diff. flow (eta):
   (commonHistRes->GetHistDiffFlowEtaPOI())->SetName("eta_weights");
-  (commonHistRes->GetHistDiffFlowEtaPOI())->Write();
- }else
-  {
-   cout<<" WARNING: the common results histos from the 1st run were not accessed."<<endl;
-  }  
+  listWeights->Add(commonHistRes->GetHistDiffFlowEtaPOI());
+ }else{cout<<" WARNING: the common results histos from the 1st run were not accessed."<<endl;}  
  
- delete outputFile;
+ outputFile->WriteObject(listWeights,"weights","SingleKey");
+
+ delete listWeights;
+ delete outputFile; 
 }  
+
+
+
index f4ae78fed30dd969f0751fb0c52a04f1a93c46e1..94a54ef2089c2771dc5db84691e45caaf2306ce9 100644 (file)
@@ -3,21 +3,21 @@
 #include "Riostream.h"
 #include "TFile.h"
 
-//----------------------------------------------------------
-//RUN SETTINGS
+//--------------------------------------------------------------------------------------
+// RUN SETTINGS
 //flow analysis method can be: (set to kTRUE or kFALSE)
 Bool_t SP    = kFALSE;
-Bool_t LYZ1  = kTRUE;
+Bool_t LYZ1  = kFALSE;
 Bool_t LYZ2  = kFALSE;  
 Bool_t LYZEP = kFALSE; 
 Bool_t GFC   = kTRUE;
 Bool_t QC    = kTRUE;
 Bool_t FQD   = kFALSE;
 Bool_t MCEP  = kFALSE; //does not work yet 24/12/08
-//----------------------------------------------------------
+//--------------------------------------------------------------------------------------
 
-//----------------------------------------------------------
-//CUT SETTINGS
+//--------------------------------------------------------------------------------------
+// CUT SETTINGS
 //integrated selection
 Double_t ptMaxInt  = 10.;
 Double_t ptMinInt  = 0.;
@@ -35,15 +35,15 @@ Double_t etaMinDiff = -1.;
 Double_t phiMaxDiff = 7.5;
 Double_t phiMinDiff = 0.;
 Int_t PIDDiff       = 211;
-//----------------------------------------------------------
+//--------------------------------------------------------------------------------------
 
-//----------------------------------------------------------
-//WEIGHTS SETTINGS 
+//--------------------------------------------------------------------------------------
+// WEIGHTS SETTINGS 
 //to use or not to use the weights - that is a question!
-Bool_t useWeightsPhi = kFALSE;//Phi
-Bool_t useWeightsPt  = kFALSE;//v'(pt)
-Bool_t useWeightsEta = kFALSE;//v'(eta)
-//----------------------------------------------------------
+Bool_t usePhiWeights = kFALSE; //Phi (correction for non-uniform azimuthal acceptance)
+Bool_t usePtWeights  = kFALSE; //v'(pt) (differential flow in pt)
+Bool_t useEtaWeights = kFALSE; //v'(eta) (differential flow in eta)
+//--------------------------------------------------------------------------------------
 
 Int_t offset = 0;
                                           
@@ -76,22 +76,7 @@ int runFlowAnalysis(Int_t aRuns = 44, const char*
   
   // flow event in AliRoot
   AliFlowEventSimpleMaker* fEventMaker = new AliFlowEventSimpleMaker();
-  
-  /*   
-  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-  //                       !!!! to be removed
-  // if weights are being used initialize the weight's histos in AliFlowEvenSimpleMaker:
-  fEventMaker->SetUseWeightsPhi(useWeightsPhi);
-  fEventMaker->SetUseWeightsPt(useWeightsPt);
-  fEventMaker->SetUseWeightsEta(useWeightsEta);
-  if(useWeightsPhi||useWeightsPt||useWeightsEta)
-  {
-   fEventMaker->Init(file);
-  }
-  //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-  */  
-  
-  
+   
   // In root
 
   /*    
@@ -111,7 +96,7 @@ int runFlowAnalysis(Int_t aRuns = 44, const char*
   // output histosgrams
   gROOT->LoadMacro("code/AliFlowCommonHist.cxx+");
   gROOT->LoadMacro("code/AliFlowCommonHistResults.cxx+");
-  gROOT->LoadMacro("code/AliFlowLYZHist1.cxx+");fPhiWeights
+  gROOT->LoadMacro("code/AliFlowLYZHist1.cxx+");
   gROOT->LoadMacro("code/AliFlowLYZHist2.cxx+");
 
   // functions needed for various methods
@@ -163,19 +148,17 @@ int runFlowAnalysis(Int_t aRuns = 44, const char*
   cutsDiff->SetPhiMin(phiMinDiff);
   cutsDiff->SetPID(PIDDiff);
 
-  //weights:
-  //open the file with the weights: 
-  TFile *file = NULL;
-  TH1F *phiWeights = NULL;
-  TH1D *ptWeights = NULL;
-  TH1D *etaWeights = NULL;
+  //if the weights are used: 
+  TFile *fileWithWeights = NULL;
+  TList *listWithWeights = NULL;
   
-  if(useWeightsPhi||useWeightsPt||useWeightsEta)
+  if(usePhiWeights||usePtWeights||useEtaWeights)
   {
-   file = TFile::Open("weightsForTheSecondRun.root", "READ");
-   if(useWeightsPhi) file->GetObject("phi_weights",phiWeights); 
-   if(useWeightsPt) file->GetObject("pt_weights",ptWeights); 
-   if(useWeightsEta) file->GetObject("eta_weights",etaWeights);    
+   fileWithWeights = TFile::Open("weights.root","READ");
+   if(fileWithWeights)
+   {
+    listWithWeights = (TList*)fileWithWeights->Get("weights");
+   }else{cout<<" WARNING: the file <weights.root> with weights from the previous run was not accessed."<<endl;}    
   }
 
   //flow methods:  
@@ -198,9 +181,10 @@ int runFlowAnalysis(Int_t aRuns = 44, const char*
   if(QC) { 
     AliFlowAnalysisWithQCumulants* qc = new AliFlowAnalysisWithQCumulants();
     qc->Init();
-    if(useWeightsPhi) qc->SetPhiWeights(*phiWeights);
-    if(useWeightsPt) qc->SetPtWeights(*ptWeights);
-    if(useWeightsEta) qc->SetEtaWeights(*etaWeights);    
+    if(listWithWeights) qc->SetWeightsList(listWithWeights);
+    if(usePhiWeights) qc->SetUsePhiWeights(usePhiWeights);
+    if(usePtWeights) qc->SetUsePtWeights(usePtWeights);
+    if(useEtaWeights) qc->SetUseEtaWeights(useEtaWeights);
   }
   
   //GFC = Generating Function Cumulants