LCOV - code coverage report
Current view: top level - ZDC/ZDCrec - AliZDCRecoParamPbPb.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 11 85 12.9 %
Date: 2016-06-14 17:26:59 Functions: 6 13 46.2 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : ///////////////////////////////////////////////////////////////////////////////
      17             : //                                                                           //
      18             : // Class with ZDC reconstruction parameters                                  //
      19             : // Origin: Chiara.Oppedisano@to.infn.it                                      //
      20             : //                                                                           //
      21             : ///////////////////////////////////////////////////////////////////////////////
      22             : 
      23             : #include <TFile.h>
      24             : #include <TTree.h>
      25             : #include <TH2F.h>
      26             : #include <TH1D.h>
      27             : 
      28             : #include "AliZDCRecoParam.h"
      29             : #include "AliZDCRecoParamPbPb.h"
      30             : 
      31          12 : ClassImp(AliZDCRecoParamPbPb)
      32             : 
      33             : //_____________________________________________________________________________
      34             : AliZDCRecoParamPbPb::AliZDCRecoParamPbPb() :
      35           2 :   AliZDCRecoParam(),
      36           2 :   fhNpartDist(0x0),
      37           2 :   fhbDist(0x0),
      38           2 :   fClkCenter(0)
      39          10 : {
      40             :   //
      41             :   //Default constructor
      42           4 : }
      43             : //_____________________________________________________________________________
      44             : AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(TH1D *hNpart, TH1D *hb, Float_t clkCent) :
      45           0 :   AliZDCRecoParam(),
      46           0 :   fhNpartDist(hNpart),
      47           0 :   fhbDist(hb),
      48           0 :   fClkCenter(clkCent)
      49           0 : {
      50             :   //
      51             :   //Standard constructor
      52           0 : }
      53             : 
      54             : //______________________________________________________________________________
      55             : AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(const AliZDCRecoParamPbPb &oldrecopar) :
      56           0 :   AliZDCRecoParam(),
      57           0 :   fhNpartDist(0x0),
      58           0 :   fhbDist(0x0),
      59           0 :   fClkCenter(oldrecopar.fClkCenter)
      60           0 : {
      61             :   //Copy constructor
      62           0 :   if(oldrecopar.fhNpartDist){
      63           0 :     fhNpartDist = new TH1D(*oldrecopar.fhNpartDist);
      64           0 :     fhNpartDist->SetDirectory(0);
      65             :   }
      66           0 :   if(oldrecopar.fhbDist){
      67           0 :       fhbDist = new TH1D(*oldrecopar.fhbDist);
      68           0 :       fhbDist->SetDirectory(0);
      69             :   }
      70           0 : }
      71             : 
      72             : //_____________________________________________________________________________
      73             : AliZDCRecoParamPbPb &AliZDCRecoParamPbPb::operator =(const AliZDCRecoParamPbPb &recpar)
      74             : {
      75             :   // Equal operator.
      76           0 :   this->~AliZDCRecoParamPbPb();
      77           0 :   new(this) AliZDCRecoParamPbPb(recpar);
      78           0 :   return *this;  
      79             :  
      80           0 : }
      81             :  
      82             : //_____________________________________________________________________________
      83             : AliZDCRecoParamPbPb::~AliZDCRecoParamPbPb()
      84          12 : {
      85             :   // destructor
      86             : 
      87           6 :   if(fhNpartDist) delete fhNpartDist;
      88           6 :   if(fhbDist)     delete fhbDist;
      89           6 : }
      90             : 
      91             : //_____________________________________________________________________________
      92             : void AliZDCRecoParamPbPb::SetGlauberMCDist(Float_t beamEnergy)
      93             : {
      94             :   // Setting Glauber MC distributions
      95             :   // from histos file stored in $ALICE_ROOT/ZDC
      96           0 :   TH1::AddDirectory(0);
      97           0 :   TH2::AddDirectory(0);
      98             :   
      99           0 :   TFile *fileGlauberMC =  TFile::Open("$ALICE_ROOT/ZDC/GlauberMCDist.root");
     100           0 :   if(!fileGlauberMC) {
     101           0 :     AliError((" Opening file $ALICE_ROOT/ZDC/GlauberMCDist.root failed\n"));
     102           0 :     return;
     103             :   }
     104             :   
     105           0 :   Float_t sqrtS = 2*beamEnergy;
     106             :   //
     107           0 :   if(TMath::Abs(sqrtS-5500) < 100.){
     108           0 :     AliDebug(2, " ZDC -> Looking for energy5500 in file $ALICE_ROOT/ZDC/GlauberMCDist.root");
     109           0 :     fileGlauberMC->cd("energy5500");
     110           0 :     fileGlauberMC->GetObject("energy5500/hbGlauber;1", fhbDist);
     111           0 :     if(!fhbDist) AliError("  PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
     112           0 :     fileGlauberMC->GetObject("energy5500/hNpartGlauber;1", fhNpartDist);
     113           0 :     if(!fhNpartDist) AliError("  PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     114             :   }
     115           0 :   else if(TMath::Abs(sqrtS-2760) < 100.){
     116           0 :     AliDebug(2, " ZDC -> Looking for energy2760 in file $ALICE_ROOT/ZDC/GlauberMCDist.root");
     117           0 :     fileGlauberMC->cd("energy2760");
     118           0 :     fileGlauberMC->GetObject("energy2760/hbGlauber;1", fhbDist);
     119           0 :     if(!fhbDist) AliError("  PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
     120           0 :     fileGlauberMC->GetObject("energy2760/hNpartGlauber;1", fhNpartDist);
     121           0 :     if(!fhNpartDist) AliError("  PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     122             :   }
     123           0 :   else AliError(Form(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", sqrtS));
     124             :   //
     125           0 :   fhNpartDist->SetDirectory(0);
     126           0 :   fhbDist->SetDirectory(0);
     127             :   
     128           0 :   fileGlauberMC->Close();
     129           0 : }
     130             : 
     131             : //_____________________________________________________________________________
     132             : AliZDCRecoParamPbPb *AliZDCRecoParamPbPb::GetHighFluxParam(Float_t beamEnergy) 
     133             : {
     134             :   // Create high flux reco parameter
     135           0 :   TH1::AddDirectory(0);
     136           0 :   TH2::AddDirectory(0);
     137             :   
     138           0 :   TFile *fileGlauberMC =  TFile::Open("$ALICE_ROOT/ZDC/GlauberMCDist.root");
     139           0 :   if(!fileGlauberMC) {
     140           0 :     printf(" Opening file $ALICE_ROOT/ZDC/GlauberMCDist.root failed\n");
     141           0 :     return NULL;
     142             :   }
     143             :   
     144           0 :   Float_t sqrtS = 2*beamEnergy;
     145             :   
     146           0 :   TH1D *hNpartDist=0x0, *hbDist=0x0;
     147           0 :   if(TMath::Abs(sqrtS-5500)<100.){
     148           0 :     fileGlauberMC->cd("energy5500");
     149           0 :     fileGlauberMC->GetObject("energy5500/hNpartGlauber;1", hNpartDist);
     150           0 :     if(!hNpartDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     151           0 :     fileGlauberMC->GetObject("energy5500/hbGlauber;1", hbDist);
     152           0 :     if(!hbDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
     153             :   }
     154           0 :   else if(TMath::Abs(sqrtS-2760)<100.){
     155           0 :     fileGlauberMC->cd("energy2760");
     156           0 :     fileGlauberMC->GetObject("energy2760/hNpartGlauber;1", hNpartDist);
     157           0 :     if(!hNpartDist) printf("  PROBLEM!!! Can't get Glauber MC Npart distribution from file GlauberMCDist.root\n");
     158           0 :     fileGlauberMC->GetObject("energy2760/hbGlauber;1", hbDist);
     159           0 :     if(!hbDist) printf("  AliZDCRecoParamPbPb::GetHighFluxParam() PROBLEM!!! Can't get Glauber MC b distribution from file GlauberMCDist.root\n");
     160             :   }
     161           0 :   else printf(" No AliZDCRecoParam provided for Pb-Pb @ sqrt(s) = %1.0f GeV\n", sqrtS);
     162             :   //
     163           0 :   if(hNpartDist) hNpartDist->SetDirectory(0);
     164           0 :   if(hbDist) hbDist->SetDirectory(0);
     165             : 
     166           0 :   AliZDCRecoParamPbPb* zdcRecoParam = new AliZDCRecoParamPbPb(hNpartDist, hbDist, 0.1);
     167             :   //
     168           0 :   fileGlauberMC->Close();
     169             :               
     170             :   return zdcRecoParam;
     171             :   
     172           0 : }

Generated by: LCOV version 1.11