]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/UNICOR/AliUnicorAnal.cxx
Bug coreected in PTM gain array indexes
[u/mrichter/AliRoot.git] / PWG2 / UNICOR / AliUnicorAnal.cxx
1 /************************************************************************* 
2 * Copyright(c) 1998-2048, 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 // Author: Dariusz Miskowiec <mailto:d.miskowiec@gsi.de> 2007
17
18 //=============================================================================
19 // parent class of all analyzers
20 // keeps the obj array of histograms filled by the daughter
21 // takes care of storing them on file at the end
22 //=============================================================================
23
24 #include <TROOT.h>
25 #include <TFile.h>
26 #include "AliUnicorAnal.h"
27
28 ClassImp(AliUnicorAnal)
29   
30 TDatabasePDG AliUnicorAnal::fgPDG;
31
32 //=============================================================================
33 AliUnicorAnal::AliUnicorAnal(char *nam) : TNamed(nam,nam), fHistos() 
34 {
35   // constructor
36
37   fHistos.SetOwner(1);
38   TDirectory *dir = gROOT->mkdir(GetName());
39   dir->cd();
40
41   printf("%s object named %s created\n",ClassName(),GetName());
42 }
43 //=============================================================================
44 void AliUnicorAnal::Save(const char *outfil, const char *mode) 
45 {
46   // store histograms on file in a directory named after the object
47   // mode should be "update" (default) or "new"
48
49   printf("%s saving  histograms on %s (%s)\n",GetName(),outfil,mode);  
50   TFile * f = TFile::Open(outfil, mode);
51   TDirectory *dest = f->mkdir(GetName());
52   dest->cd();
53   fHistos.Write();
54   gROOT->cd();
55   f->Close();
56 }
57 //=============================================================================