]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCRecoParamPbPb.cxx
Detector Algorithm for pedestal runs.
[u/mrichter/AliRoot.git] / ZDC / AliZDCRecoParamPbPb.cxx
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 ClassImp(AliZDCRecoParamPbPb)
32
33 //_____________________________________________________________________________
34 AliZDCRecoParamPbPb::AliZDCRecoParamPbPb() :
35   AliZDCRecoParam(),
36   fhNpartDist(0x0),
37   fhbDist(0x0),
38   fClkCenter(0)
39 {
40   //
41   //Default constructor
42 }
43 //_____________________________________________________________________________
44 AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(TH1D *hNpart, TH1D *hb, Float_t clkCent) :
45   AliZDCRecoParam(),
46   fhNpartDist(hNpart),
47   fhbDist(hb),
48   fClkCenter(clkCent)
49 {
50   //
51   //Standard constructor
52 }
53
54 //______________________________________________________________________________
55 AliZDCRecoParamPbPb::AliZDCRecoParamPbPb(const AliZDCRecoParamPbPb &oldrecopar) :
56   AliZDCRecoParam(),
57   fhNpartDist(0x0),
58   fhbDist(0x0),
59   fClkCenter(oldrecopar.fClkCenter)
60 {
61   //Copy constructor
62   if(oldrecopar.fhNpartDist){
63     fhNpartDist = new TH1D(*oldrecopar.fhNpartDist);
64     fhNpartDist->SetDirectory(0);
65   }
66   if(oldrecopar.fhbDist){
67       fhbDist = new TH1D(*oldrecopar.fhbDist);
68       fhbDist->SetDirectory(0);
69   }
70 }
71
72 //_____________________________________________________________________________
73 AliZDCRecoParamPbPb &AliZDCRecoParamPbPb::operator =(const AliZDCRecoParamPbPb &recpar)
74 {
75   // Equal operator.
76   this->~AliZDCRecoParamPbPb();
77   new(this) AliZDCRecoParamPbPb(recpar);
78   return *this;  
79  
80 }
81  
82 //_____________________________________________________________________________
83 AliZDCRecoParamPbPb::~AliZDCRecoParamPbPb()
84 {
85   // destructor
86
87   if(fhNpartDist) delete fhNpartDist;
88   if(fhbDist)     delete fhbDist;
89 }
90
91 //_____________________________________________________________________________
92 void AliZDCRecoParamPbPb::SetGlauberMCDist()
93 {
94   // Setting Glauber MC distributions
95   // from histos file stored in $ALICE_ROOT/ZDC
96   TFile * fileHistos = TFile::Open("$ALICE_ROOT/ZDC/GlauberMCHistos.root");
97   //
98   fhNpartDist = (TH1D*) fileHistos->Get("hDist");
99   fhNpartDist->SetDirectory(0);
100   fhbDist = (TH1D*) fileHistos->Get("hbDist");
101   fhbDist->SetDirectory(0);
102   
103   fileHistos->Close();
104 }
105
106 //_____________________________________________________________________________
107 AliZDCRecoParamPbPb *AliZDCRecoParamPbPb::GetHighFluxParam() 
108 {
109   // Create high flux reco parameter
110   TH1::AddDirectory(0);
111   TH2::AddDirectory(0);
112   //
113   TFile * fileHistos = TFile::Open("$ALICE_ROOT/ZDC/GlauberMCHistos.root");
114   fileHistos->cd();
115   //
116   TH1D* hDist = (TH1D*) fileHistos->Get("hDist");
117   hDist->SetDirectory(0);
118   //
119   TH1D* hbDist = (TH1D*) fileHistos->Get("hbDist");
120   hbDist->SetDirectory(0);
121   
122   AliZDCRecoParamPbPb* zdcRecoParam = new AliZDCRecoParamPbPb(hDist, hbDist, 0.1);
123   //
124   fileHistos->Close();
125               
126   return zdcRecoParam;
127   
128 }