]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FASTSIM/AliFastMuonTriggerEff.cxx
Bug in storage manager making possible to delete permanent event fixed
[u/mrichter/AliRoot.git] / FASTSIM / AliFastMuonTriggerEff.cxx
index bd798123cfcde13ca2b09bf56f3a380678c13238..a45c7eaf25b4aaae35d598ffed308c4dad996cde 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-The trigger parametrization is computed for background levels 0., 0.5 and 1.
-In order to set a background level different from 0 it is necessary to 
-explicitly force it with:
-ForceBkgLevel(BkgLevel).
+/* $Id$ */
+// The trigger parametrization is computed for background levels 0., 0.5 and 1.
+// In order to set a background level different from 0 it is necessary to 
+// explicitly force it with:
+// ForceBkgLevel(BkgLevel).
+// For intermediate background levels, the trigger response is linearly 
+// interpolated between these values.
+// There is increased granularity in the pT region below 3 GeV. Although
+// it does not seem to be necessary it is also possible to interpolate
+// between pT bins using SetInt().
+// Author: Pietro Cortese (Universita' del Piemonte Orientale - Alessandria 
+// and INFN of Torino)
 
-For intermediate background levels, the trigger response is linearly 
-interpolated between these values.
-
-There is increased granularity in the pT region below 3 GeV. Although
-it does not seem to be necessary it is also possible to interpolate
-between pT bins using SetInt().
-
-$Log$
-Revision 1.8  2005/09/22 11:31:42  morsch
-Completely revised version. (P. Cortese)
-
-*/
 
 #include "AliFastMuonTriggerEff.h"
+#include "TROOT.h"
+#include "TFile.h"
+#include "stdlib.h"
+#include "TH3.h"
+#include "TObjString.h"
+
 #define PLIN printf("%s: %d: ",__FILE__,__LINE__)
 
 ClassImp(AliFastMuonTriggerEff)
 
 AliFastMuonTriggerEff::AliFastMuonTriggerEff():
-    AliFastResponse("Efficiency", "Muon Trigger Efficiency")
+    AliFastResponse("Efficiency", "Muon Trigger Efficiency"),
+    fPtMin(0.),
+    fPtMax(0.),
+    fDpt(0.),
+    fnptb(0),
+    fPhiMin(0.),
+    fPhiMax(0.),
+    fDphi(0.),
+    fnphib(0),
+    fThetaMin(0.),
+    fThetaMax(0.),
+    fDtheta(0.),
+    fnthetab(0),
+    fCut(kLow),
+    fZones(0),
+    fhEffAPt(0),
+    fhEffLPt(0),
+    fhEffHPt(0),
+    fhLX(0),
+    fhLY(0),
+    fhLZ(0),
+    fBkg(0.),
+    fTableTitle(0),
+    fDescription(0),
+    fInt(0),
+    fibx(0),
+    fiby(0),
+    fibz(0)
 {
 //
 // Default constructor
 //
-    SetCut(kLow);
-    fZones=0;
-    SetBkgLevel(0.);
-    UnsetInt();
+}
+
+AliFastMuonTriggerEff::AliFastMuonTriggerEff(const char* Name, const char* Title):
+    AliFastResponse(Name, Title),
+    fPtMin(0.),
+    fPtMax(0.),
+    fDpt(0.),
+    fnptb(0),
+    fPhiMin(0.),
+    fPhiMax(0.),
+    fDphi(0.),
+    fnphib(0),
+    fThetaMin(0.),
+    fThetaMax(0.),
+    fDtheta(0.),
+    fnthetab(0),
+    fCut(kLow),
+    fZones(0),
+    fhEffAPt(0),
+    fhEffLPt(0),
+    fhEffHPt(0),
+    fhLX(0),
+    fhLY(0),
+    fhLZ(0),
+    fBkg(0.),
+    fTableTitle(0),
+    fDescription(0),
+    fInt(0),
+    fibx(0),
+    fiby(0),
+    fibz(0)
+{
+// Another constructor
+}
+
+AliFastMuonTriggerEff::AliFastMuonTriggerEff(const AliFastMuonTriggerEff& eff)
+    :AliFastResponse(eff),
+    fPtMin(0.),
+    fPtMax(0.),
+    fDpt(0.),
+    fnptb(0),
+    fPhiMin(0.),
+    fPhiMax(0.),
+    fDphi(0.),
+    fnphib(0),
+    fThetaMin(0.),
+    fThetaMax(0.),
+    fDtheta(0.),
+    fnthetab(0),
+    fCut(kLow),
+    fZones(0),
+    fhEffAPt(0),
+    fhEffLPt(0),
+    fhEffHPt(0),
+    fhLX(0),
+    fhLY(0),
+    fhLZ(0),
+    fBkg(0.),
+    fTableTitle(0),
+    fDescription(0),
+    fInt(0),
+    fibx(0),
+    fiby(0),
+    fibz(0)
+{
+// Copy constructor
+    eff.Copy(*this);
 }
 
 void AliFastMuonTriggerEff::SetCut(Int_t cut) 
 {  
+  //
+  // Set the pt cut
   if(cut==kLow){
     printf("Selecting Low Pt cut\n");
   }else if(cut==kHigh){
@@ -67,6 +160,9 @@ void AliFastMuonTriggerEff::SetCut(Int_t cut)
 
 Int_t AliFastMuonTriggerEff::SetBkgLevel(Float_t Bkg)
 {
+  //
+  // Set the background level
+  //
     if((Bkg!=0.)) {
        printf("%s: Warning: requested Bkg: %f\n",
        __FILE__,Bkg);
@@ -87,6 +183,9 @@ Int_t AliFastMuonTriggerEff::SetBkgLevel(Float_t Bkg)
 
 Int_t AliFastMuonTriggerEff::ForceBkgLevel(Float_t Bkg)
 {
+  //
+  // Check and enforce consistency of the background level 
+  // 
     if((Bkg!=0.)) {
        printf("%s: Warning: requested Bkg: %f\n",
        __FILE__,Bkg);
@@ -103,11 +202,14 @@ Int_t AliFastMuonTriggerEff::ForceBkgLevel(Float_t Bkg)
     return 0;
 }
 
-Int_t AliFastMuonTriggerEff::LoadTables(Char_t *namet=""){
+Int_t AliFastMuonTriggerEff::LoadTables(const Char_t *namet){
+  //
+  // Load the trigger tables
+  //
     Char_t hNameA[100],hNameL[100],hNameH[100];
-    sprintf(hNameA,"hEffAPt%s",namet);
-    sprintf(hNameL,"hEffLPt%s",namet);
-    sprintf(hNameH,"hEffHPt%s",namet);
+    snprintf(hNameA, 100, "hEffAPt%s",namet);
+    snprintf(hNameL, 100, "hEffLPt%s",namet);
+    snprintf(hNameH, 100, "hEffHPt%s",namet);
     fhEffAPt = (TH3F*)gDirectory->Get(hNameA);
     fhEffLPt = (TH3F*)gDirectory->Get(hNameL);
     fhEffHPt = (TH3F*)gDirectory->Get(hNameH);
@@ -145,11 +247,11 @@ void AliFastMuonTriggerEff::Init()
     Int_t intb=0;
     Char_t namet[10];
     if(TMath::Abs(fBkg)<0.00001){
-      sprintf(namet,"00");
+      snprintf(namet, 10, "00");
     }else if(TMath::Abs(fBkg-0.5)<0.00001){
-      sprintf(namet,"05");
+      snprintf(namet, 10, "05");
     }else if(TMath::Abs(fBkg-1.0)<0.00001){
-      sprintf(namet,"10");
+      snprintf(namet, 10, "10");
     }else{
       PLIN; printf("A table for Bkg level: %f does not exists\n",fBkg);
       intb=1;
@@ -159,13 +261,13 @@ void AliFastMuonTriggerEff::Init()
       TH3F* ha1,*hl1,*hh1,*ha2,*hl2,*hh2,*ha0,*hl0,*hh0;
       Char_t name1[10],name2[10]; Float_t b1,b2;
       if(fBkg>0&&fBkg<0.5){
-        sprintf(name1,"00");
-        sprintf(name2,"05");
+        snprintf(name1,10, "00");
+        snprintf(name2,10, "05");
        b1=0.;
        b2=0.5;
       }else if(fBkg>0.5){
-        sprintf(name1,"05");
-        sprintf(name2,"10");
+        snprintf(name1, 10, "05");
+        snprintf(name2, 10, "10");
        b1=0.5;
        b2=1.0;
        if(fBkg>1.0){
@@ -253,6 +355,10 @@ void AliFastMuonTriggerEff::Init()
     fnptb=fhEffLPt->GetNbinsZ();
     fDpt      = (fPtMax-fPtMin)/fnptb;
 
+    printf("***** This version of AliFastMuonTriggerEff can use both *****\n");
+    printf("***** new and old ALICE reference frames depending on    *****\n");
+    printf("***** which LUT has been loaded. You can find below some *****\n");
+    printf("***** information on the current parametrization:        *****\n");
     printf("%4d bins in theta [%f:%f]\n",fnthetab,fThetaMin,fThetaMax);
     printf("%4d bins in phi [%f:%f]\n",fnphib,fPhiMin,fPhiMax);
     printf("%4d bins in pt [%f:%f]\n",fnptb,fPtMin,fPtMax);
@@ -349,7 +455,7 @@ void AliFastMuonTriggerEff::Evaluate(Float_t charge, Float_t pt,Float_t theta,
        printf(" 6:1 No more points above! No interpolation is needed!\n");
         #endif
        return;        
-      }else if(ptc==pt){
+      }else if(TMath::Abs(ptc-pt) < 1.e-10){
         #ifdef MYTRIGDEBUG
          printf(" 6:1 No interpolation is needed!\n");
         #endif
@@ -408,15 +514,7 @@ void AliFastMuonTriggerEff::Evaluate(Float_t charge, Float_t pt,Float_t theta,
   return;
 }
 
-void AliFastMuonTriggerEff::Evaluate(Float_t charge, Float_t pt, Float_t theta,
-                                Float_t phi, Float_t& effLow, Float_t& effHigh)
-{
-    //
-    //  Trigger efficiency for pt, theta, phi (low and high cut)
-    //
-    Float_t effAny;
-    Evaluate(charge,pt,theta,phi,effLow,effHigh,effAny);
-}
+
 
 Float_t AliFastMuonTriggerEff::Evaluate(Float_t charge, Float_t pt,
                    Float_t theta, Float_t phi)
@@ -443,3 +541,11 @@ Float_t AliFastMuonTriggerEff::Evaluate(Float_t charge, Float_t pt,
 
     return eff;
 }
+
+AliFastMuonTriggerEff& AliFastMuonTriggerEff::operator=(const  AliFastMuonTriggerEff& rhs)
+{
+// Assignment operator
+    rhs.Copy(*this);
+    return *this;
+}
+