]>
Commit | Line | Data |
---|---|---|
32392f88 | 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" | |
32392f88 | 32 | |
33 | //______________________________________________________________________________ | |
34 | AliAnaScale::AliAnaScale() : | |
35 | fDebug(0), | |
36 | fScale(1.0), | |
37 | fInputList(0x0), | |
c90ac396 | 38 | fOutputList(0x0), |
39 | fSumw2(0), | |
40 | fhCount() | |
32392f88 | 41 | { |
42 | //Default constructor | |
43 | } | |
44 | //______________________________________________________________________________ | |
45 | AliAnaScale::AliAnaScale(const char *name) : | |
46 | AliAnalysisTask(name,""), | |
47 | fDebug(0), | |
48 | fScale(1.0), | |
49 | fInputList(0x0), | |
c90ac396 | 50 | fOutputList(0x0), |
51 | fSumw2(0), | |
52 | fhCount(0) | |
32392f88 | 53 | { |
54 | // Constructor. | |
55 | // Called only after the event loop | |
56 | SetPostEventLoop(kTRUE); | |
57 | // Input slot #0 | |
58 | DefineInput(0, TList::Class()) ; | |
59 | // Output slot | |
60 | DefineOutput(0, TList::Class()) ; | |
61 | } | |
62 | ||
63 | //______________________________________________________________________________ | |
64 | AliAnaScale::~AliAnaScale() | |
65 | { | |
66 | // dtor | |
67 | ||
68 | } | |
69 | ||
70 | ||
71 | //______________________________________________________________________________ | |
72 | void AliAnaScale::ConnectInputData(const Option_t*) | |
73 | { | |
74 | // Initialisation of branch container and histograms | |
75 | ||
c90ac396 | 76 | if(fDebug > 1) printf("*** Initialization of %s \n", GetName()) ; |
32392f88 | 77 | fInputList = dynamic_cast<TList*>(GetInputData(0)) ; |
32392f88 | 78 | } |
79 | //________________________________________________________________________ | |
80 | void AliAnaScale::CreateOutputObjects() | |
81 | { | |
82 | // Create the outputs containers | |
c90ac396 | 83 | |
84 | fOutputList = new TList() ; | |
85 | fOutputList->SetName(GetName()) ; | |
86 | ||
87 | fhCount =new TH1F("hCount","count files",1,0,1); | |
88 | fOutputList->Add(fhCount); | |
32392f88 | 89 | |
90 | } | |
91 | ||
92 | //______________________________________________________________________________ | |
93 | void AliAnaScale::Exec(Option_t *) | |
94 | { | |
95 | // Do the Scaling | |
c90ac396 | 96 | |
97 | if(fDebug > 0 ) printf(">>>>> Scaling factor %e, do Sumw2 %d <<<<< \n",fScale,fSumw2) ; | |
98 | ||
4b707925 | 99 | TIter next(fInputList) ; |
100 | TObject * h ; | |
101 | while ( (h = next()) ) { | |
102 | if(h){ | |
103 | if ( strcmp(h->ClassName(),"TNtuple") ) { | |
2c8efea8 | 104 | char name[128] ; |
4b707925 | 105 | sprintf(name, "%sScaled", h->GetName()) ; |
106 | TH1 * hout = dynamic_cast<TH1*> (h->Clone(name)) ; | |
c90ac396 | 107 | |
108 | if(fSumw2) hout->Sumw2(); | |
4b707925 | 109 | hout->Scale(fScale) ; |
110 | fOutputList->Add(hout) ; | |
111 | } | |
112 | else fOutputList->Add(h) ; | |
113 | } | |
114 | } | |
c90ac396 | 115 | // number of files |
116 | ||
117 | //File scaled, needed for file merging on grid | |
118 | fhCount->Fill(0); | |
119 | ||
32392f88 | 120 | PostData(0, fOutputList); |
121 | } | |
122 | ||
123 | ||
124 | //______________________________________________________________________________ | |
125 | void AliAnaScale::Init() | |
126 | { | |
127 | // Intialisation of parameters | |
c90ac396 | 128 | if(fDebug > 0 )printf("No initialization in scale class \n") ; |
129 | ||
32392f88 | 130 | } |
131 | ||
132 | //______________________________________________________________________________ | |
133 | void AliAnaScale::Terminate(Option_t *) | |
134 | { | |
135 | // Processing when the event loop is ended | |
136 | ||
32392f88 | 137 | |
32392f88 | 138 | } |