]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/AliAnaScale.cxx
Make it independent from (loading the) mapping
[u/mrichter/AliRoot.git] / PWG4 / AliAnaScale.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 /* $Id: */
17
18 //_________________________________________________________________________
19 // A basic analysis task to analyse photon detected by PHOS
20 //
21 //*-- Yves Schutz 
22 //////////////////////////////////////////////////////////////////////////////
23
24 #include <TFile.h> 
25 #include <TH1.h>
26 #include <TH1F.h>
27 #include <TH1I.h>
28 #include <TCanvas.h> 
29
30 #include "AliAnaScale.h" 
31 #include "AliAnalysisManager.h"
32 #include "AliLog.h"
33
34 //______________________________________________________________________________
35 AliAnaScale::AliAnaScale() : 
36   fDebug(0),
37   fScale(1.0),
38   fInputList(0x0), 
39   fOutputList(0x0), 
40   fhInPHOSEnergy(0),
41   fhOuPHOSEnergy(0)
42 {
43   //Default constructor
44 }
45 //______________________________________________________________________________
46 AliAnaScale::AliAnaScale(const char *name) : 
47   AliAnalysisTask(name,""),  
48   fDebug(0),
49   fScale(1.0), 
50   fInputList(0x0), 
51   fOutputList(0x0), 
52   fhInPHOSEnergy(0),
53   fhOuPHOSEnergy(0)
54 {
55   // Constructor.
56   // Called only after the event loop
57   SetPostEventLoop(kTRUE);
58   // Input slot #0 
59   DefineInput(0,  TList::Class()) ; 
60   // Output slot 
61   DefineOutput(0,  TList::Class()) ; 
62 }
63
64 //______________________________________________________________________________
65 AliAnaScale::~AliAnaScale()
66 {
67   // dtor
68   
69 }
70
71
72 //______________________________________________________________________________
73 void AliAnaScale::ConnectInputData(const Option_t*)
74 {
75   // Initialisation of branch container and histograms 
76     
77   AliInfo(Form("*** Initialization of %s", GetName())) ; 
78   fInputList     = dynamic_cast<TList*>(GetInputData(0)) ;  
79   fhInPHOSEnergy = dynamic_cast<TH1D*>(fInputList->At(2));
80 }
81 //________________________________________________________________________
82 void AliAnaScale::CreateOutputObjects()
83 {  
84   // Create the outputs containers
85   // Is created in Exec(), because the input must be available
86
87 }
88
89 //______________________________________________________________________________
90 void AliAnaScale::Exec(Option_t *) 
91 {
92   // Do the Scaling
93     
94   fhOuPHOSEnergy = static_cast<TH1D*>(fhInPHOSEnergy->Clone("PHOSEnergyScaled")) ;
95   
96   // create output container
97   
98   fOutputList = new TList() ; 
99   fOutputList->SetName(GetName()) ; 
100
101   fOutputList->AddAt(fhOuPHOSEnergy,          0) ; 
102   fhOuPHOSEnergy->Scale(fScale) ; 
103   PostData(0, fOutputList);
104 }
105
106
107 //______________________________________________________________________________
108 void AliAnaScale::Init()
109 {
110   // Intialisation of parameters
111   AliInfo("Doing initialisation") ;
112   // nothing to be done
113 }
114
115 //______________________________________________________________________________
116 void AliAnaScale::Terminate(Option_t *)
117 {
118   // Processing when the event loop is ended
119   
120   AliInfo(Form(" *** %s Report:", GetName())) ; 
121   printf("        PHOS Energy Integral In         : %5.3e \n", fhInPHOSEnergy->Integral() ) ;
122   printf("        PHOS Energy Integral Ou         : %5.3e \n", fhOuPHOSEnergy->Integral() ) ;
123
124   TCanvas  * cPHOS = new TCanvas("cPHOS", "PHOS ESD Test", 400, 10, 600, 700) ;
125
126   cPHOS->Divide(2, 1);
127   cPHOS->cd(1) ; 
128   if ( fhInPHOSEnergy->GetMaximum() > 0. ) 
129     gPad->SetLogy();
130   fhInPHOSEnergy->SetAxisRange(0, 25.);
131   fhInPHOSEnergy->SetLineColor(2);
132   fhInPHOSEnergy->Draw();
133
134   cPHOS->cd(2) ; 
135   if ( fhOuPHOSEnergy->GetMaximum() > 0. ) 
136     gPad->SetLogy();
137   fhOuPHOSEnergy->SetAxisRange(0, 25.);
138   fhOuPHOSEnergy->SetLineColor(2);
139   fhOuPHOSEnergy->Draw();
140 }