New class and root file to compute event plane resolution
authorfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Feb 2013 23:14:08 +0000 (23:14 +0000)
committerfprino <fprino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 14 Feb 2013 23:14:08 +0000 (23:14 +0000)
PWGHF/CMakelibPWGHFvertexingHF.pkg
PWGHF/PWGHFvertexingHFLinkDef.h
PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.cxx [new file with mode: 0644]
PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.h [new file with mode: 0644]
PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root [new file with mode: 0644]

index 7148443..2281322 100644 (file)
@@ -77,6 +77,7 @@ set ( SRCS
     vertexingHF/AliAnalysisTaskSEMonitNorm.cxx 
     vertexingHF/AliAnalysisTaskSEBkgLikeSignD0.cxx 
     vertexingHF/AliAnalysisTaskSEImproveITS.cxx 
+    vertexingHF/charmFlow/AliEventPlaneResolutionHandler.cxx
     vertexingHF/charmFlow/AliAnalysisTaskSEHFv2.cxx
     vertexingHF/charmFlow/AliHFAfterBurner.cxx
     vertexingHF/charmFlow/AliAnalysisTaskFlowD2H.cxx
index 740682a..b83d00a 100644 (file)
@@ -55,6 +55,7 @@
 #pragma link C++ class AliAnalysisTaskSEMonitNorm+;
 #pragma link C++ class AliAnalysisTaskSEBkgLikeSignD0+;
 #pragma link C++ class AliAnalysisTaskSEImproveITS+;
+#pragma link C++ class AliEventPlaneResolutionHandler+;
 #pragma link C++ class AliAnalysisTaskSEHFv2+;
 #pragma link C++ class AliAnalysisTaskFlowD2H+;
 #pragma link C++ class AliHFAfterBurner+;
diff --git a/PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.cxx b/PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.cxx
new file mode 100644 (file)
index 0000000..bc3bb37
--- /dev/null
@@ -0,0 +1,210 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include <TMath.h>
+#include <TH1F.h>
+#include <TFile.h>
+#include "AliVertexingHFUtils.h"
+#include "AliEventPlaneResolutionHandler.h"
+#include "AliLog.h"
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Class with functions useful for different D2H analyses        //
+// - event plane resolution                                      //
+// - <pt> calculation with side band subtraction                 //
+// - tracklet multiplicity calculation                            //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+ClassImp(AliEventPlaneResolutionHandler)
+
+//______________________________________________________________________
+AliEventPlaneResolutionHandler::AliEventPlaneResolutionHandler():TObject(),
+  fEventPlane(kTPCPosEta),
+  fResolOption(kTwoEtaSub),
+  fMinCent(30.),
+  fMaxCent(50.),
+  fCorrHistoName1(""),
+  fCorrHistoName2(""),
+  fCorrHistoName3(""),
+  fNsubevents(2),
+  fExtrapToFull(kFALSE),
+  fUseNcollWeights(kFALSE),
+  fRootFileName("$ALICE_ROOT/PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root")
+{
+  // Default contructor
+  InitializeNcoll();
+}
+//______________________________________________________________________
+AliEventPlaneResolutionHandler::AliEventPlaneResolutionHandler(TString filename):TObject(),
+  fEventPlane(kTPCPosEta),
+  fResolOption(kTwoEtaSub),
+  fMinCent(30.),
+  fMaxCent(50.),
+  fCorrHistoName1(""),
+  fCorrHistoName2(""),
+  fCorrHistoName3(""),
+  fNsubevents(2),
+  fExtrapToFull(kFALSE),
+  fUseNcollWeights(kFALSE),
+  fRootFileName(filename.Data())
+{
+  // Standard contructor
+  InitializeNcoll();
+}
+//______________________________________________________________________
+Double_t AliEventPlaneResolutionHandler::GetEventPlaneResolution(Double_t minCent, Double_t maxCent){
+  // method to compute the event plane resolution starting from correlations
+
+  TFile* inputFile=new TFile(fRootFileName.Data());
+  if(!inputFile || (inputFile && !inputFile->IsOpen())){
+    printf("Root file not opened --- Return dummy resolution value\n");
+    return -1.;
+  }
+  Bool_t isOk=SetHistoNames();
+  if(!isOk){
+    printf("Return dummy resolution value\n");
+    return -1.;
+  }
+  
+  Int_t minCentrTimesTen=(Int_t)(minCent*10);
+  Int_t maxCentrTimesTen=(Int_t)(maxCent*10);
+  Int_t ncBin=minCentrTimesTen/25;
+  Bool_t useNcoll=fUseNcollWeights;
+  if(minCent>50.5 || maxCent>50.5) fUseNcollWeights=kFALSE;
+
+  TH1F* hevpls2=0x0;
+  TH1F* hevpls3=0x0;
+  TH1F* hevpls1=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName1.Data(),minCentrTimesTen,minCentrTimesTen+25));
+  hevpls1->SetName(Form("%sCentr%d_%d",fCorrHistoName1.Data(),minCentrTimesTen,maxCentrTimesTen));
+  if(fUseNcollWeights) hevpls1->Scale(fNcoll[ncBin]);
+  if(fNsubevents==3){
+    hevpls2=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,minCentrTimesTen+25));
+    hevpls2->SetName(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,maxCentrTimesTen));
+    hevpls3=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName3.Data(),minCentrTimesTen,minCentrTimesTen+25));
+    hevpls3->SetName(Form("%sCentr%d_%d",fCorrHistoName2.Data(),minCentrTimesTen,maxCentrTimesTen));
+    if(fUseNcollWeights){
+      hevpls2->Scale(fNcoll[ncBin]);
+      hevpls3->Scale(fNcoll[ncBin]);
+    }
+  }
+  for(Int_t iCentr=minCentrTimesTen+25; iCentr<maxCentrTimesTen; iCentr+=25){
+    ncBin=iCentr/25;
+    TH1F* htmp1=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName1.Data(),iCentr,iCentr+25));
+    if(fUseNcollWeights) htmp1->Scale(fNcoll[ncBin]);
+    hevpls1->Add(htmp1);
+    if(fNsubevents==3){
+      TH1F* htmp2=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName2.Data(),iCentr,iCentr+25));
+      TH1F* htmp3=(TH1F*)inputFile->Get(Form("%sCentr%d_%d",fCorrHistoName3.Data(),iCentr,iCentr+25));
+      if(fUseNcollWeights){
+       htmp2->Scale(fNcoll[ncBin]);
+       htmp3->Scale(fNcoll[ncBin]);
+      }
+      hevpls2->Add(htmp2);
+      hevpls3->Add(htmp3);
+    }
+  }
+  fUseNcollWeights=useNcoll;
+  Double_t resol=1.;
+  if(fNsubevents==2){
+    if(fExtrapToFull) resol=AliVertexingHFUtils::GetFullEvResol(hevpls1);
+    else resol=AliVertexingHFUtils::GetSubEvResol(hevpls1);
+  }else if(fNsubevents==3){
+    Double_t correl1=hevpls1->GetMean();
+    Double_t correl2=hevpls2->GetMean();
+    Double_t correl3=hevpls3->GetMean();
+    resol=TMath::Sqrt(correl1*correl2/correl3);
+  }
+  inputFile->Close();
+  return resol;
+}
+//______________________________________________________________________
+Bool_t AliEventPlaneResolutionHandler::SetHistoNames(){
+  // set names for histograms to be read
+  if(fEventPlane==kTPCPosEta && fResolOption==kTwoRandSub){
+    fCorrHistoName1="hCorrelRandSubTPCPosEta";
+    fNsubevents=2;
+    fExtrapToFull=kTRUE;
+  }else if(fEventPlane==kTPCPosEta && fResolOption==kTwoChargeSub){
+    fCorrHistoName1="hCorrelChargeSubTPCPosEta";
+    fNsubevents=2;
+    fExtrapToFull=kTRUE;
+  }else if(fEventPlane==kTPCPosEta && fResolOption==kTwoEtaSub){
+    fCorrHistoName1="hCorrelTPCEtaPosTPCEtaNeg";
+    fNsubevents=2;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kTPCPosEta && fResolOption==kThreeSub){
+    fCorrHistoName1="hCorrelTPCPosEtaV0A";
+    fCorrHistoName2="hCorrelTPCPosEtaV0C";
+    fCorrHistoName3="hCorrelV0AV0C";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kTPCFullEta && fResolOption==kTwoRandSub){
+    fCorrHistoName1="hCorrelRandSubTPCFullEta";
+    fNsubevents=2;
+    fExtrapToFull=kTRUE;
+  }else if(fEventPlane==kTPCFullEta && fResolOption==kTwoEtaSub){
+    fCorrHistoName1="hCorrelTPCEtaPosTPCEtaNeg";
+    fNsubevents=2;
+    fExtrapToFull=kTRUE;
+  }else if(fEventPlane==kTPCFullEta && fResolOption==kThreeSub){
+    fCorrHistoName1="hCorrelTPCFullEtaV0A";
+    fCorrHistoName2="hCorrelTPCFullEtaV0C";
+    fCorrHistoName3="hCorrelV0AV0C";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kVZERO && fResolOption==kThreeSub){
+    fCorrHistoName1="hCorrelTPCEtaPosV0";
+    fCorrHistoName2="hCorrelTPCEtaNegV0";
+    fCorrHistoName3="hCorrelTPCEtaPosTPCEtaNeg";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kVZERO && fResolOption==kThreeSubTPCGap){
+    fCorrHistoName1="hCorrelTPCEtaGt02V0";
+    fCorrHistoName2="hCorrelTPCEtaLt02V0";
+    fCorrHistoName3="hCorrelTPCEtaGt02TPCEtaLt02";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kVZEROA && fResolOption==kThreeSub){
+    fCorrHistoName1="hCorrelTPCFullEtaV0A";
+    fCorrHistoName2="hCorrelV0AV0C";
+    fCorrHistoName3="hCorrelTPCFullEtaV0C";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else if(fEventPlane==kVZEROC && fResolOption==kThreeSub){
+    fCorrHistoName1="hCorrelTPCFullEtaV0C";
+    fCorrHistoName2="hCorrelV0AV0C";
+    fCorrHistoName3="hCorrelTPCFullEtaV0A";
+    fNsubevents=3;
+    fExtrapToFull=kFALSE;
+  }else{
+    printf("Not possible to compute the resolution with the required option\n");
+    return kFALSE;
+  }
+  return kTRUE;
+}
+//______________________________________________________________________
+void AliEventPlaneResolutionHandler::InitializeNcoll(){
+  // Ncoll values in 2.5% wide classes
+  Double_t ncoll[20]={1790.77,1578.44,1394.82,1236.17,1095.08,
+                     969.86,859.571,759.959,669.648,589.588,
+                     516.039,451.409,392.853,340.493,294.426,
+                     252.385,215.484,183.284,155.101,130.963};
+  for(Int_t i=0; i<20; i++) fNcoll[i]=ncoll[i];
+}
diff --git a/PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.h b/PWGHF/vertexingHF/charmFlow/AliEventPlaneResolutionHandler.h
new file mode 100644 (file)
index 0000000..d350138
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef ALIEVENTPLANERESOLUTIONHANDLER_H
+#define ALIEVENTPLANERESOLUTIONHANDLER_H
+
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////
+//                                                               //
+// Class to compute event plane resolution starting from root    //
+// file with event plane correlation histos                      //
+// Origin: F.Prino, Torino, prino@to.infn.it                     //
+//                                                               //
+///////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class TFile;
+class TH1F;
+
+class AliEventPlaneResolutionHandler : public TObject{
+ public:
+  AliEventPlaneResolutionHandler();
+  AliEventPlaneResolutionHandler(TString filename);
+  virtual ~AliEventPlaneResolutionHandler(){};
+
+  void SetCentralityRange(Double_t minC, Double_t maxC){
+    fMinCent=minC;
+    fMaxCent=maxC;
+  }
+  void SetUseNcollWeights(Bool_t opt){fUseNcollWeights=opt;}
+  void SetEventPlane(Int_t ep){fEventPlane=ep;}
+  void SetTPCFullEtaEventPlane(){fEventPlane=kTPCFullEta;}
+  void SetTPCPositiveEtaEventPlane(){fEventPlane=kTPCPosEta;}
+  void SetVZEROFullEventPlane(){fEventPlane=kVZERO;}
+  void SetVZEROAEventPlane(){fEventPlane=kVZEROA;}
+  void SetVZEROCEventPlane(){fEventPlane=kVZEROC;}
+
+  void SetResolutionOption(Int_t res){fResolOption=res;}
+  void SetResolutionFromTwoRandomSubevents(){fResolOption=kTwoRandSub;}
+  void SetResolutionFromTwoChargeSubevents(){fResolOption=kTwoChargeSub;}
+  void SetResolutionFromTwoEtaSubevents(){fResolOption=kTwoEtaSub;}
+  void SetResolutionFromThreeSubevents(){fResolOption=kThreeSub;}
+  void SetResolutionFromThreeSubeventsTPCGap(){fResolOption=kThreeSubTPCGap;}
+
+  Double_t GetEventPlaneResolution(){
+    return GetEventPlaneResolution(fMinCent,fMaxCent);
+  }
+  Double_t GetEventPlaneResolution(Double_t minCent, Double_t maxCent);
+
+
+
+  enum EEventPlane {kTPCFullEta, kTPCPosEta,kVZERO,kVZEROA,kVZEROC};
+  enum EResolOption {kTwoRandSub,kTwoChargeSub,kTwoEtaSub,kThreeSub,kThreeSubTPCGap};
+
+ private:
+  Bool_t SetHistoNames();
+  void InitializeNcoll();
+  AliEventPlaneResolutionHandler(const AliEventPlaneResolutionHandler &source);
+  AliEventPlaneResolutionHandler& operator=(const AliEventPlaneResolutionHandler& source); 
+
+
+  Int_t    fEventPlane;      // event plane determination (see enum)
+  Int_t    fResolOption;     // option to get the resolution (see enum)
+  Double_t fMinCent;         // minimum centrality
+  Double_t fMaxCent;         // maximum centrality
+  TString  fCorrHistoName1;  // name of 1st histogram
+  TString  fCorrHistoName2;  // name of 2nd histogram
+  TString  fCorrHistoName3;  // name of 3rd histogram
+  Int_t    fNsubevents;      // number of subevents to be used
+  Bool_t   fExtrapToFull;    // flag for extrapolating to full event
+  Bool_t   fUseNcollWeights; // flag use/not use Ncoll to weight centrality sub-ranges
+  Double_t fNcoll[20];       // values of Ncoll in the subranges
+  TString  fRootFileName;    // file with histos of correlations
+
+  ClassDef(AliEventPlaneResolutionHandler,0) 
+};
+#endif
diff --git a/PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root b/PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root
new file mode 100644 (file)
index 0000000..7380871
Binary files /dev/null and b/PWGHF/vertexingHF/charmFlow/EventPlaneResolutionHistos.root differ