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