1 /*************************************************************************
2 * Copyright(c) 1998-2048, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // Author: Dariusz Miskowiec <mailto:d.miskowiec@gsi.de> 2007
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 //=============================================================================
26 #include <TCollection.h>
29 #include "AliUnicorAnal.h"
31 ClassImp(AliUnicorAnal)
33 TDatabasePDG AliUnicorAnal::fgPDG;
35 //=============================================================================
36 AliUnicorAnal::AliUnicorAnal(char *nam) : TNamed(nam,nam), fHistos() {
41 TDirectory *dir = gROOT->mkdir(GetName());
43 printf("%s object named %s created\n",ClassName(),GetName());
45 //=============================================================================
46 Long64_t AliUnicorAnal::Merge(const TCollection * const list) {
48 // sumup fHistos objects
50 for (int i=0; i<fHistos.GetEntries(); i++) {
51 if (fHistos.At(i)->IsA()->InheritsFrom("TH1")) {
52 TH1 *hi = (TH1*) fHistos.At(i);
54 while (AliUnicorAnal *analtoadd = (AliUnicorAnal*) next()) {
55 TH1 *histotoadd = (TH1*) analtoadd->GetHist(i);
62 //=============================================================================
63 void AliUnicorAnal::Save(const char *outfil, const char *mode)
65 // store histograms on file in a directory named after the object
66 // mode should be "update" (default) or "new"
68 printf("%s %s: saving histograms on %s (%s)\n",ClassName(),GetName(),outfil,mode);
69 TFile * f = TFile::Open(outfil, mode);
70 TDirectory *dest = f->mkdir(GetName());
76 //=============================================================================