]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/AliCDBMetaData.cxx
Adding NSD analysis as well as new features and removing warnings
[u/mrichter/AliRoot.git] / STEER / AliCDBMetaData.cxx
... / ...
CommitLineData
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/////////////////////////////////////////////////////////////////////
17// //
18// class AliCDBMetaData //
19// Set of data describing the object //
20// but not used to identify the object //
21// //
22/////////////////////////////////////////////////////////////////////
23
24#include "AliCDBMetaData.h"
25#include "AliLog.h"
26
27#include <TObjString.h>
28#include <TTimeStamp.h>
29
30ClassImp(AliCDBMetaData)
31
32//_____________________________________________________________________________
33AliCDBMetaData::AliCDBMetaData() :
34TObject(),
35fObjectClassName(""),
36fResponsible(""),
37fBeamPeriod(0),
38fAliRootVersion(""),
39fComment(""),
40fProperties()
41{
42// default constructor
43
44 fProperties.SetOwner(1);
45}
46
47//_____________________________________________________________________________
48AliCDBMetaData::AliCDBMetaData(const char *responsible, UInt_t beamPeriod,
49 const char* alirootVersion, const char* comment) :
50TObject(),
51fObjectClassName(""),
52fResponsible(responsible),
53fBeamPeriod(beamPeriod),
54fAliRootVersion(alirootVersion),
55fComment(comment),
56fProperties()
57{
58// constructor
59
60 fProperties.SetOwner(1);
61}
62
63//_____________________________________________________________________________
64AliCDBMetaData::~AliCDBMetaData() {
65// destructor
66
67}
68
69//_____________________________________________________________________________
70void AliCDBMetaData::SetProperty(const char* property, TObject* object) {
71// add something to the list of properties
72
73 fProperties.Add(new TObjString(property), object);
74}
75
76//_____________________________________________________________________________
77TObject* AliCDBMetaData::GetProperty(const char* property) const {
78// get a property specified by its name (property)
79
80 return fProperties.GetValue(property);
81}
82
83//_____________________________________________________________________________
84Bool_t AliCDBMetaData::RemoveProperty(const char* property) {
85// removes a property
86
87 TObjString objStrProperty(property);
88 TObjString* aKey = (TObjString*) fProperties.Remove(&objStrProperty);
89
90 if (aKey) {
91 delete aKey;
92 return kTRUE;
93 } else {
94 return kFALSE;
95 }
96}
97
98//_____________________________________________________________________________
99void AliCDBMetaData::AddDateToComment() {
100// add the date to the comment.
101// This method is supposed to be useful if called at the time when the object
102// is created, so that later it can more easily be tracked, in particular
103// when the date of the file can be lost or when one is interested in the
104// date of creation, irrespective of a later copy of it
105
106 TTimeStamp ts(time(0));
107 TString comment(GetComment());
108 comment += Form("\tDate of production: %s\n", ts.AsString());
109 comment.Remove(comment.Last('+'));
110 SetComment(comment);
111
112}
113
114//_____________________________________________________________________________
115void AliCDBMetaData::PrintMetaData() {
116// print the object's metaData
117
118 TString message;
119 if(fObjectClassName != "")
120 message += Form("\tObject's class name: %s\n", fObjectClassName.Data());
121 if(fResponsible != "")
122 message += Form("\tResponsible: %s\n", fResponsible.Data());
123 if(fBeamPeriod != 0)
124 message += Form("\tBeam period: %d\n", fBeamPeriod);
125 if(fAliRootVersion != "")
126 message += Form("\tAliRoot version: %s\n", fAliRootVersion.Data());
127 if(fComment != "")
128 message += Form("\tComment: %s\n", fComment.Data());
129 if(fProperties.GetEntries() > 0){
130 message += "\tProperties key names:";
131
132 TIter iter(fProperties.GetTable());
133 TPair* aPair;
134 while ((aPair = (TPair*) iter.Next())) {
135 message += Form("\t\t%s\n", ((TObjString* ) aPair->Key())->String().Data());
136 }
137 }
138 message += '\n';
139 AliInfo(Form("**** Object's MetaData parameters **** \n%s", message.Data()));
140}