Classe for Quarkonia acceptances (Gines)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 24 May 2006 18:01:49 +0000 (18:01 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 24 May 2006 18:01:49 +0000 (18:01 +0000)
PWG3/AliQuarkoniaAcceptance.cxx [new file with mode: 0644]
PWG3/AliQuarkoniaAcceptance.h [new file with mode: 0644]
PWG3/PWG3baseLinkDef.h [new file with mode: 0644]
PWG3/libPWG3base.pkg [new file with mode: 0644]

diff --git a/PWG3/AliQuarkoniaAcceptance.cxx b/PWG3/AliQuarkoniaAcceptance.cxx
new file mode 100644 (file)
index 0000000..72847cd
--- /dev/null
@@ -0,0 +1,120 @@
+/* $Id$ */
+
+// Root 
+#include "TAxis.h"
+#include "TFile.h"
+#include "TH2.h"
+#include "TString.h"
+
+// AliRoot includes
+#include "AliQuarkoniaAcceptance.h"
+#include "AliLog.h"
+
+
+
+//_______________________________________________________________________
+AliQuarkoniaAcceptance::AliQuarkoniaAcceptance(Int_t quarkoniaResonance, Int_t decayChannel):
+  fAcceptanceFileName("$ALICE_ROOT/PWG3/QuarkoniaAcceptance.root"),
+  fQuarkoniaResonance(quarkoniaResonance),
+  fDecayChannel(decayChannel),
+  fAcceptance(0x0)
+{
+
+
+}
+//_______________________________________________________________________
+AliQuarkoniaAcceptance::~AliQuarkoniaAcceptance()
+{
+  delete fAcceptance; 
+}
+
+//_______________________________________________________________________
+void AliQuarkoniaAcceptance::Init()
+{
+  switch (fQuarkoniaResonance)  {  
+  case kJpsi:
+    SetTitle("Jpsi");
+    break;
+  case kPsiP:
+    SetTitle("PsiP");
+    break;
+  case kUpsilon:
+    SetTitle("Upsilon");
+    break;
+  case kUpsilonP:
+    SetTitle("UpsilonP");
+    break;
+  case kUpsilonPP:
+    SetTitle("UpsilonPP");
+    break;
+  case kOmega:
+    SetTitle("Omega");
+    break;
+  case kPhi:
+    SetTitle("Phi");
+    break;
+  }
+
+  switch ( fDecayChannel) {
+  case kDimuon:
+    SetName("Dimuon");
+    break;
+  case kDielectron:
+    SetName("Dielectron");
+    break;
+  }
+
+  if(!fAcceptance) delete fAcceptance; 
+
+  TFile acceptanceFile(fAcceptanceFileName);
+  if ( acceptanceFile.IsOpen() ) {
+    char histoname[30];
+    sprintf(histoname,"h%s%sAccep",GetTitle(),GetName());
+    fAcceptance = (TH2F*) acceptanceFile.Get(histoname);
+    if ( !fAcceptance ) {
+      AliError(Form("Acceptance data for quarkonia %s and channel %s not found", GetTitle(), GetName() ));
+    }
+    else {
+      fAcceptance->SetDirectory(0);
+    }
+    acceptanceFile.Close();
+  }
+  else {
+    AliError(Form("File %s not found",fAcceptanceFileName.Data()));
+  }
+}
+//_______________________________________________________________________  
+TH2F*  AliQuarkoniaAcceptance::GetAcceptanceHisto() const
+{
+  if (fAcceptance) return fAcceptance;
+  else {
+    AliError(Form("Acceptance data for quarkonia %s and channel %s not found",GetTitle(),GetName()));
+    return 0x0;
+  }
+}
+//_______________________________________________________________________  
+void  AliQuarkoniaAcceptance::GetAcceptance(Float_t rap, Float_t pT, Double_t &accep, Double_t &error)
+{
+  Int_t binx=0;
+  Int_t biny=0;
+
+  if (!fAcceptance) {
+    AliError(Form("Acceptance data for quarkonia %s and channel %s not found",GetTitle(),GetName()));
+  }
+  else {
+    if (   rap < (fAcceptance->GetXaxis())->GetXmin()  ||  
+          rap > (fAcceptance->GetXaxis())->GetXmax()  ||
+          pT  < (fAcceptance->GetYaxis())->GetXmin()  ||  
+          pT  > (fAcceptance->GetYaxis())->GetXmax()     ) {
+      AliInfo("Values out of range");
+      accep = 0.;
+      error = 0.;
+    }
+    else  { 
+      binx  = fAcceptance->GetXaxis()->FindBin(rap);  
+      biny  = fAcceptance->GetYaxis()->FindBin(pT);
+      accep = fAcceptance->GetBinContent(binx,biny);
+      error = fAcceptance->GetBinError(binx,biny);
+    }
+  }
+} 
diff --git a/PWG3/AliQuarkoniaAcceptance.h b/PWG3/AliQuarkoniaAcceptance.h
new file mode 100644 (file)
index 0000000..03fcad9
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALIQUARKONIAACCEPTANCE_H
+#define ALIQUARKONIAACCEPTANCE_H
+
+/* $Id$ */
+//===================================================================
+//  class AliQUARKONIAACCEPTANCE                               
+//  This class will provide the quarkonia decay acceptance in ALICE
+//  for different resonances :
+//    kJpsi
+//    kPsiP
+//    kUpsilon
+//    kUpsilonP
+//    kUpsilonPP
+//  and for some vector mesons :
+//    kPhi
+//    kOmega
+//  and different channels
+//    kDimuon
+//    kDielectron
+//
+//  Acceptance for the Dimuon channel is defined with respect to 
+//  a flat distribution of quarkonia emited in the rapidity range 
+//  -4 < y < -2.5. Acceptance is defined as both muon from the 
+//  decay to be in the theta range 171. < theta < 178.
+//                                                              
+//   Gines MARTINEZ, Subatech, May 06   
+//===================================================================
+#include "TNamed.h"
+class TH2F;
+class TString;
+
+
+class AliQuarkoniaAcceptance : public TNamed
+{
+ public:
+    
+  enum quarkonia{kJpsi, kPsiP, kUpsilon, kUpsilonP, kUpsilonPP, kOmega, kPhi};
+  enum channel{kDimuon, kDielectron};
+  
+  AliQuarkoniaAcceptance(Int_t quarkoniaResonance=kJpsi, Int_t decayChannel=kDimuon);
+  virtual ~AliQuarkoniaAcceptance();  
+  void   Init(); 
+  TH2F*  GetAcceptanceHisto() const;
+  void   GetAcceptance(Float_t rap, Float_t pT, Double_t & accep, Double_t & error); 
+  void   SetAcceptanceFileName(char * acceptanceFileName) { fAcceptanceFileName = acceptanceFileName; }
+  void   SetQuarkoniaResonance(Int_t quarkoniaResonance=kJpsi) { fQuarkoniaResonance= quarkoniaResonance;}
+  void   SetDecayChannel(Int_t decayChannel=kDimuon) { fDecayChannel = decayChannel;}
+  
+ protected: 
+  AliQuarkoniaAcceptance(const AliQuarkoniaAcceptance& rhs);
+  AliQuarkoniaAcceptance& operator=(const AliQuarkoniaAcceptance& rhs);
+  
+  TString        fAcceptanceFileName;      // Name of the acceptance root file
+  Int_t          fQuarkoniaResonance;      // Resonance Acceptance
+  Int_t          fDecayChannel;            // Studied decay channel
+  TH2F *         fAcceptance;              // Acceptance histogram
+  
+ private:  
+  
+  ClassDef(AliQuarkoniaAcceptance,1)
+    };
+#endif
+
diff --git a/PWG3/PWG3baseLinkDef.h b/PWG3/PWG3baseLinkDef.h
new file mode 100644 (file)
index 0000000..22af67b
--- /dev/null
@@ -0,0 +1,10 @@
+#ifdef __CINT__
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ class AliQuarkoniaAcceptance+; 
+
+#endif
+
+
diff --git a/PWG3/libPWG3base.pkg b/PWG3/libPWG3base.pkg
new file mode 100644 (file)
index 0000000..56592e7
--- /dev/null
@@ -0,0 +1,11 @@
+# $Id$
+
+SRCS:=  AliQuarkoniaAcceptance.cxx         
+     
+     
+HDRS:= $(SRCS:.cxx=.h)
+
+DHDR:= PWG3baseLinkDef.h
+
+EINCLUDE:= 
+