1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 **************************************************************************/
17 * Container class for histogram objects. Currenly can handle
22 * Histograms can be stored in groups. For this the parent group is
23 * included inside the histogram name, i.e. /base/inheriting/histogram.
24 * In case just the histogram name is given, it is assumed that the
25 * histogram is stored at the top level.
27 * Author: Markus Fasel
37 #include <THnSparse.h>
38 #include <THashList.h>
39 #include <TObjArray.h>
40 #include <TObjString.h>
45 #include "AliEMCalHistoContainer.h"
47 ClassImp(EMCalTriggerPtAnalysis::AliEMCalHistoContainer)
49 namespace EMCalTriggerPtAnalysis {
51 //______________________________________________________________________________
52 AliEMCalHistoContainer::AliEMCalHistoContainer():
58 * Default constructor, only initialising pointers with 0
62 //______________________________________________________________________________
63 AliEMCalHistoContainer::AliEMCalHistoContainer(const char *name):
64 TNamed(name, Form("Histogram container %s", name)),
69 * Main constructor, creating also a list for the histograms
71 * @param name: Name of the object (list named accordingly)
73 fHistos = new THashList();
74 fHistos->SetName(Form("histos%s", name));
78 //______________________________________________________________________________
79 AliEMCalHistoContainer::~AliEMCalHistoContainer(){
81 * Destructor, deletes the list of histograms if it is the owner
83 if(fHistos && fIsOwner) delete fHistos;
86 //______________________________________________________________________________
87 void AliEMCalHistoContainer::CreateHistoGroup(const char *groupname, const char *parent) throw(HistoContainerContentException) {
89 * Create a new group of histograms within a parent group. Groups are represented as list. The default parent is
90 * always the top list. List name structure accouding to unix paths (i.e. top list /, hirarchies separated by /).
92 * @param groupname: Name of the new group
93 * @param parent (@default "/"): Name of the parent group
94 * @throw HistoContainerContentException
96 THashList *parentgroup = FindGroup(parent);
97 if(!parentgroup) throw HistoContainerContentException(NULL, parent, HistoContainerContentException::kGroupException);
98 THashList *childgroup = new THashList();
99 childgroup->SetName(groupname);
100 parentgroup->Add(childgroup);
103 //______________________________________________________________________________
104 void AliEMCalHistoContainer::CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt) throw(HistoContainerContentException){
106 * Create a new TH1 within the container. The histogram name also contains the parent group(s) according to the common
109 * @param name: Name of the histogram
110 * @param title: Title of the histogram
111 * @param nbins: number of bins
112 * @param xmin: min. value of the range
113 * @param xmax: max. value of the range
114 * @throw HistoContainerContentException
116 TString dirname(basename(name)), hname(histname(name));
117 THashList *parent(FindGroup(dirname.Data()));
119 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
120 if(parent->FindObject(hname.Data()))
121 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
122 TH1 *hist = new TH1D(hname.Data(), title, nbins, xmin, xmax);
123 TString optionstring(opt);
124 optionstring.ToLower();
125 if(optionstring.Contains("s"))
130 //______________________________________________________________________________
131 void AliEMCalHistoContainer::CreateTH1(const char *name, const char *title, int nbins, const double *xbins, Option_t *opt) throw(HistoContainerContentException){
133 * Create a new TH1 within the container. The histogram name also contains the parent group(s) according to the common
136 * @param name: Name of the histogram
137 * @param title: Title of the histogram
138 * @param nbins: number of bins
139 * @param xbins: array of bin limits
140 * @throw HistoContainerContentException
142 TString dirname(basename(name)), hname(histname(name));
143 THashList *parent(FindGroup(dirname));
145 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
146 if(parent->FindObject(hname.Data()))
147 throw HistoContainerContentException(hname, dirname.Data(), HistoContainerContentException::kHistDuplicationException);
148 TH1 *hist = new TH1D(hname.Data(), title, nbins, xbins);
149 TString optionstring(opt);
150 optionstring.ToLower();
151 if(optionstring.Contains("s"))
156 //______________________________________________________________________________
157 void AliEMCalHistoContainer::CreateTH1(const char *name, const char *title, const TArrayD &xbins, Option_t *opt) throw(HistoContainerContentException){
159 * Create a new TH1 within the container. The histogram name also contains the parent group(s) according to the common
162 * @param name: Name of the histogram
163 * @param title: Title of the histogram
164 * @param xbins: array of bin limits (contains also number of bins)
165 * @throw HistoContainerContentException
167 TString dirname(basename(name)), hname(histname(name));
168 THashList *parent(FindGroup(dirname));
170 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
171 if(parent->FindObject(hname.Data()))
172 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
173 TH1 *hist = new TH1D(hname.Data(), title, xbins.GetSize()-1, xbins.GetArray());
174 TString optionstring(opt);
175 optionstring.ToLower();
176 if(optionstring.Contains("s"))
181 //______________________________________________________________________________
182 void AliEMCalHistoContainer::CreateTH2(const char *name, const char *title,
183 int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt) throw(HistoContainerContentException){
185 * Create a new TH2 within the container. The histogram name also contains the parent group(s) according to the common
188 * @param name: Name of the histogram
189 * @param title: Title of the histogram
190 * @param nbinsx: number of bins in x-direction
191 * @param xmin: min. value of the range in x-direction
192 * @param xmax: max. value of the range in x-direction
193 * @param nbinsy: number of bins in y-direction
194 * @param ymin: min. value of the range in y-direction
195 * @param ymax: max. value of the range in y-direction
196 * @throw HistoContainerContentException
198 TString dirname(basename(name)), hname(histname(name));
199 THashList *parent(FindGroup(dirname.Data()));
201 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
202 if(parent->FindObject(hname.Data()))
203 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
204 TH2 *hist = new TH2D(hname.Data(), title, nbinsx, xmin, xmax, nbinsy, ymin, ymax);
205 TString optionstring(opt);
206 optionstring.ToLower();
207 if(optionstring.Contains("s"))
212 //______________________________________________________________________________
213 void AliEMCalHistoContainer::CreateTH2(const char *name, const char *title,
214 int nbinsx, const double *xbins, int nbinsy, const double *ybins, Option_t *opt) throw(HistoContainerContentException){
216 * Create a new TH2 within the container. The histogram name also contains the parent group(s) according to the common
219 * @param name: Name of the histogram
220 * @param title: Title of the histogram
221 * @param nbinsx: number of bins in x-direction
222 * @param xbins: array of bin limits in x-direction
223 * @param nbinsy: number of bins in y-direction
224 * @param ybins: array of bin limits in y-direction
225 * @throw HistoContainerContentException
227 TString dirname(basename(name)), hname(histname(name));
228 THashList *parent(FindGroup(dirname.Data()));
230 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
231 if(parent->FindObject(hname.Data()))
232 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
233 TH2 *hist = new TH2D(hname.Data(), title, nbinsx, xbins, nbinsy, ybins);
234 TString optionstring(opt);
235 optionstring.ToLower();
236 if(optionstring.Contains("s"))
241 //______________________________________________________________________________
242 void AliEMCalHistoContainer::CreateTH2(const char *name, const char *title, const TArrayD &xbins, const TArrayD &ybins, Option_t *opt) throw(HistoContainerContentException){
244 * Create a new TH2 within the container. The histogram name also contains the parent group(s) according to the common
247 * @param name: Name of the histogram
248 * @param title: Title of the histogram
249 * @param xbins: array of bin limits in x-direction (contains also the number of bins)
250 * @param ybins: array of bin limits in y-direction (contains also the number of bins)
251 * @throw HistoContainerContentException
253 TString dirname(basename(name)), hname(histname(name));
254 THashList *parent(FindGroup(dirname.Data()));
256 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
257 if(parent->FindObject(hname.Data()))
258 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
259 TH2 *hist = new TH2D(hname.Data(), title, xbins.GetSize() - 1, xbins.GetArray(), ybins.GetSize() - 1, ybins.GetArray());
260 TString optionstring(opt);
261 optionstring.ToLower();
262 if(optionstring.Contains("s"))
267 //______________________________________________________________________________
268 void AliEMCalHistoContainer::CreateTH3(const char* name, const char* title, int nbinsx, double xmin, double xmax,
269 int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt) throw (HistoContainerContentException) {
271 * Create a new TH3 within the container. The histogram name also contains the parent group(s) according to the common
274 * @param nbinsx: number of bins in x-direction
275 * @param xmin: min. value of the range in x-direction
276 * @param xmax: max. value of the range in x-direction
277 * @param nbinsy: number of bins in y-direction
278 * @param ymin: min. value of the range in y-direction
279 * @param ymax: max. value of the range in y-direction
280 * @param nbinsz: number of bins in z-direction
281 * @param zmin: min. value of the range in z-direction
282 * @param zmax: max. value of the range in z-direction
283 * @throw HistoContainerContentException
285 TString dirname(basename(name)), hname(histname(name));
286 THashList *parent(FindGroup(dirname.Data()));
288 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
289 if(parent->FindObject(hname.Data()))
290 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
291 TH3 *hist = new TH3D(hname.Data(), title, nbinsx, xmin, xmax, nbinsy, ymin, ymax, nbinsz, zmin, zmax);
292 TString optionstring(opt);
293 optionstring.ToLower();
294 if(optionstring.Contains("s"))
299 //______________________________________________________________________________
300 void AliEMCalHistoContainer::CreateTH3(const char* name, const char* title, int nbinsx, const double* xbins,
301 int nbinsy, const double* ybins, int nbinsz, const double* zbins, Option_t *opt) throw (HistoContainerContentException) {
303 * Create a new TH3 within the container. The histogram name also contains the parent group(s) according to the common
306 * @param name: Name of the histogram
307 * @param title: Title of the histogram
308 * @param nbinsx: number of bins in x-direction
309 * @param xbins: array of bin limits in x-direction
310 * @param nbinsy: number of bins in y-direction
311 * @param ybins: array of bin limits in y-direction
312 * @param nbinsz: number of bins in z-direction
313 * @param zbins: array of bin limits in z-direction
314 * @throw HistoContainerContentException
316 TString dirname(basename(name)), hname(histname(name));
317 THashList *parent(FindGroup(dirname.Data()));
319 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
320 if(parent->FindObject(hname.Data()))
321 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
322 TH3 *hist = new TH3D(hname.Data(), title, nbinsx, xbins, nbinsy, ybins, nbinsz, zbins);
323 TString optionstring(opt);
324 optionstring.ToLower();
325 if(optionstring.Contains("s"))
330 //______________________________________________________________________________
331 void AliEMCalHistoContainer::CreateTH3(const char* name, const char* title, const TArrayD& xbins, const TArrayD& ybins,
332 const TArrayD& zbins, Option_t *opt) throw (HistoContainerContentException) {
334 * Create a new TH3 within the container. The histogram name also contains the parent group(s) according to the common
337 * @param name: Name of the histogram
338 * @param title: Title of the histogram
339 * @param xbins: array of bin limits in x-direction (contains also the number of bins)
340 * @param ybins: array of bin limits in y-direction (contains also the number of bins)
341 * @param zbins: array of bin limits in z-direction (contains also the number of bins)
342 * @throw HistoContainerContentException
344 TString dirname(basename(name)), hname(histname(name));
345 THashList *parent(FindGroup(dirname.Data()));
347 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
348 if(parent->FindObject(hname.Data()))
349 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
350 TH3 *hist = new TH3D(hname.Data(), title, xbins.GetSize()-1, xbins.GetArray(), ybins.GetSize()-1, ybins.GetArray(), zbins.GetSize()-1, zbins.GetArray());
351 TString optionstring(opt);
352 optionstring.ToLower();
353 if(optionstring.Contains("s"))
358 //______________________________________________________________________________
359 void AliEMCalHistoContainer::CreateTHnSparse(const char *name, const char *title,
360 int ndim, const int *nbins, const double *min, const double *max, Option_t *opt) throw(HistoContainerContentException){
362 * Create a new THnSparse within the container. The histogram name also contains the parent group(s) according to the common
365 * @param name: Name of the histogram
366 * @param title: Title of the histogram
367 * @param ndim: Number of dimensions
368 * @param nbins: Number of bins per dimension
369 * @param min: min. value of the range for each dimension
370 * @param max: max. value of the range for each dimension
371 * @throw HistoContainerContentException
373 TString dirname(basename(name)), hname(histname(name));
374 THashList *parent(FindGroup(dirname.Data()));
376 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
377 if(parent->FindObject(hname.Data()))
378 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
379 THnSparseD *hist = new THnSparseD(hname.Data(), title, ndim, nbins, min, max);
380 TString optionstring(opt);
381 optionstring.ToLower();
382 if(optionstring.Contains("s"))
387 //______________________________________________________________________________
388 void AliEMCalHistoContainer::CreateTHnSparse(const char *name, const char *title, int ndim, const TAxis **axes, Option_t *opt) throw(HistoContainerContentException){
390 * Create a new THnSparse within the container. The histogram name also contains the parent group(s) according to the common
393 * @param name: Name of the histogram
394 * @param title: Title of the histogram
395 * @param ndim: Number of dimensions
396 * @param axes: Array of pointers to TAxis for containing the axis definition for each dimension
397 * @throw HistoContainerContentException
399 TString dirname(basename(name)), hname(histname(name));
400 THashList *parent(FindGroup(dirname.Data()));
402 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
403 if(parent->FindObject(hname))
404 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistDuplicationException);
405 TArrayD xmin(ndim), xmax(ndim);
407 for(int idim = 0; idim < ndim; ++idim){
408 const TAxis &myaxis = *(axes[idim]);
409 nbins[idim] = myaxis.GetNbins();
410 xmin[idim] = myaxis.GetXmin();
411 xmax[idim] = myaxis.GetXmax();
413 THnSparseD *hsparse = new THnSparseD(hname.Data(), title, ndim, nbins.GetArray(), xmin.GetArray(), xmax.GetArray());
414 for(int id = 0; id < ndim; ++id)
415 *(hsparse->GetAxis(id)) = *(axes[id]);
416 TString optionstring(opt);
417 optionstring.ToLower();
418 if(optionstring.Contains("s"))
420 parent->Add(hsparse);
423 //______________________________________________________________________________
424 void AliEMCalHistoContainer::SetObject(TObject * const o, const char *group) throw(HistoContainerContentException){
426 * Set a new group into the container into the parent group
428 * @param o: the object ot be included
431 THashList *parent(FindGroup(group));
433 throw HistoContainerContentException(NULL, strcmp(group, "/") ? group : "", HistoContainerContentException::kGroupException);
434 if(parent->FindObject(o->GetName()))
435 throw HistoContainerContentException(o->GetName(), strcmp(group, "/") ? group : "", HistoContainerContentException::kHistDuplicationException);
436 if(!(dynamic_cast<THnBase *>(o) || dynamic_cast<TH1 *>(o)))
437 throw HistoContainerContentException(o->GetName(), strcmp(group, "/") ? group : "", HistoContainerContentException::kTypeException);
441 //______________________________________________________________________________
442 void AliEMCalHistoContainer::FillTH1(const char *name, double x, double weight) throw(HistoContainerContentException){
444 * Fill a 1D histogram within the container. The histogram name also contains the parent group(s) according to the common
447 * @param name: Name of the histogram
448 * @param x: x-coordinate
449 * @param weight (@default 1): optional weight of the entry
450 * @throw HistoContainerContentException
452 TString dirname(basename(name)), hname(histname(name));
453 THashList *parent(FindGroup(dirname.Data()));
455 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
456 TH1 *hist = dynamic_cast<TH1 *>(parent->FindObject(hname.Data()));
458 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
459 hist->Fill(x, weight);
462 //______________________________________________________________________________
463 void AliEMCalHistoContainer::FillTH2(const char *name, double x, double y, double weight) throw(HistoContainerContentException){
465 * Fill a 2D histogram within the container. The histogram name also contains the parent group(s) according to the common
468 * @param name: Name of the histogram
469 * @param x: x-coordinate
470 * @param y: y-coordinate
471 * @param weight (@default 1): optional weight of the entry
472 * @throw HistoContainerContentException
474 TString dirname(basename(name)), hname(histname(name));
475 THashList *parent(FindGroup(dirname.Data()));
477 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
478 TH2 *hist = dynamic_cast<TH2 *>(parent->FindObject(hname.Data()));
480 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
481 hist->Fill(x, y, weight);
484 //______________________________________________________________________________
485 void AliEMCalHistoContainer::FillTH2(const char *name, double *point, double weight) throw(HistoContainerContentException){
487 * Fill a 2D histogram within the container. The histogram name also contains the parent group(s) according to the common
490 * @param name: Name of the histogram
491 * @param point: coordinates of the data
492 * @param weight (@default 1): optional weight of the entry
493 * @throw HistoContainerContentException
495 TString dirname(basename(name)), hname(histname(name));
496 THashList *parent(FindGroup(dirname.Data()));
498 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
499 TH2 *hist = dynamic_cast<TH2 *>(parent->FindObject(hname.Data()));
501 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
502 hist->Fill(point[0], point[1], weight);
505 //______________________________________________________________________________
506 void AliEMCalHistoContainer::FillTH3(const char* name, double x, double y, double z, double weight) throw (HistoContainerContentException) {
508 * Fill a 3D histogram within the container. The histogram name also contains the parent group(s) according to the common
511 * @param name: Name of the histogram
512 * @param x: x-coordinate
513 * @param y: y-coordinate
514 * @param z: z-coordinate
515 * @param weight (@default 1): optional weight of the entry
516 * @throw HistoContainerContentException
518 TString dirname(basename(name)), hname(histname(name));
519 THashList *parent(FindGroup(dirname.Data()));
521 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
522 TH3 *hist = dynamic_cast<TH3 *>(parent->FindObject(hname.Data()));
524 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
525 hist->Fill(x, y, z, weight);
528 //______________________________________________________________________________
529 void AliEMCalHistoContainer::FillTH3(const char* name, const double* point, double weight) throw (HistoContainerContentException) {
530 TString dirname(basename(name)), hname(histname(name));
531 THashList *parent(FindGroup(dirname.Data()));
533 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
534 TH3 *hist = dynamic_cast<TH3 *>(parent->FindObject(hname.Data()));
536 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
537 hist->Fill(point[0], point[1], point[2], weight);
541 //______________________________________________________________________________
542 void AliEMCalHistoContainer::FillTHnSparse(const char *name, const double *x, double weight) throw(HistoContainerContentException){
544 * Fill a nD histogram within the container. The histogram name also contains the parent group(s) according to the common
547 * @param name: Name of the histogram
548 * @param x: coordinates of the data
549 * @param weight (@default 1): optional weight of the entry
550 * @throw HistoContainerContentException
552 TString dirname(basename(name)), hname(histname(name));
553 THashList *parent(FindGroup(dirname.Data()));
555 throw HistoContainerContentException(NULL, dirname.Data(), HistoContainerContentException::kGroupException);
556 THnSparseD *hist = dynamic_cast<THnSparseD *>(parent->FindObject(hname.Data()));
558 throw HistoContainerContentException(hname.Data(), dirname.Data(), HistoContainerContentException::kHistNotFoundException);
559 hist->Fill(x, weight);
562 //______________________________________________________________________________
563 TObject *AliEMCalHistoContainer::FindObject(const char *name) const {
565 * Find an object inside the container. The object can also be within a
566 * histogram group. For this the name has to follow the common notation
568 * @param name: Name of the object to find inside the container
569 * @return: pointer to the object (NULL if not found)
571 TString dirname(basename(name)), hname(histname(name));
572 THashList *parent(FindGroup(dirname.Data()));
573 if(!parent) return NULL;
574 return parent->FindObject(hname);
577 //______________________________________________________________________________
578 TObject* AliEMCalHistoContainer::FindObject(const TObject* obj) const {
580 * Find and object inside the container. The object name is expected to contain the
581 * full path of the histogram object, including parent groups
583 * @param obj: the object to find
584 * @return: pointer to the object (NULL if not found)
586 TString dirname(basename(obj->GetName())), hname(histname(obj->GetName()));
587 THashList *parent(FindGroup(dirname.Data()));
588 if(!parent) return NULL;
589 return parent->FindObject(hname);
592 //______________________________________________________________________________
593 THashList *AliEMCalHistoContainer::FindGroup(const char *dirname) const {
595 * Find histogram group. Name is using common notation
597 * @param dirname: Path of the group (treat empty path as top node
598 * @return: TList of objects (NULL if group does not exist)
600 if(!strlen(dirname) || !strcmp(dirname, "/")) return fHistos;
601 std::vector<std::string> tokens;
602 TokenizeFilename(dirname, "/", tokens);
603 THashList *currentdir(fHistos);
604 for(std::vector<std::string>::iterator it = tokens.begin(); it != tokens.end(); ++it){
605 currentdir = dynamic_cast<THashList *>(currentdir->FindObject(it->c_str()));
606 if(!currentdir) break;
611 //______________________________________________________________________________
612 void AliEMCalHistoContainer::TokenizeFilename(const char *name, const char *delim, std::vector<std::string> &listoftokens) const {
614 * Tokenizes a string. Results are stored inside the vector listoftokens
616 * @ param name: string to be tokenised
617 * @ param delim: delimiter string
618 * @ param listoftokens: list of tokens (C++ strings)
621 TObjArray *arr = s.Tokenize(delim);
622 TObjString *ostr(NULL);
624 while((ostr = dynamic_cast<TObjString *>(toks()))){
625 listoftokens.push_back(std::string(ostr->String().Data()));
630 //______________________________________________________________________________
631 const char *AliEMCalHistoContainer::basename(const char *path) const {
633 * Helper function extracting the basename from a given histogram path.
635 * @param path: histogram path
636 * @return: basename extracted
639 int index = s.Last('/');
640 if(index < 0) return ""; // no directory structure
641 return TString(s(0, index)).Data();
644 //______________________________________________________________________________
645 const char *AliEMCalHistoContainer::histname(const char *path) const {
647 * Helper function extracting the histogram name from a given histogram path.
649 * @param path: histogram path
650 * @return: basename extracted
653 int index = s.Last('/');
654 if(index < 0) return path; // no directory structure
655 return TString(s(index+1, s.Length() - (index+1))).Data();