]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliCDBId.cxx
Correct loadpoint in ReorderKine used fro TFluka.
[u/mrichter/AliRoot.git] / STEER / AliCDBId.cxx
CommitLineData
9e1ceb13 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 AliCDBId //
19// Identity of an object stored into a database: //
20// path, run validity range, version, subVersion //
21// //
22/////////////////////////////////////////////////////////////////////
23
24#include "AliCDBId.h"
25
26ClassImp(AliCDBId)
27
28//_____________________________________________________________________________
29AliCDBId::AliCDBId():
30fPath(),
31fRunRange(-1,-1),
32fVersion(-1),
33fSubVersion(-1),
34fLastStorage("new")
35{
36// constructor
37
38}
39
40//_____________________________________________________________________________
41AliCDBId::AliCDBId(const AliCDBId& other):
42TObject(),
43fPath(other.fPath),
44fRunRange(other.fRunRange),
45fVersion(other.fVersion),
46fSubVersion(other.fSubVersion),
47fLastStorage(other.fLastStorage)
48{
49// constructor
50
51}
52
53//_____________________________________________________________________________
54AliCDBId::AliCDBId(const AliCDBPath& path, Int_t firstRun, Int_t lastRun,
55 Int_t version, Int_t subVersion):
56fPath(path),
57fRunRange(firstRun, lastRun),
58fVersion(version),
59fSubVersion(subVersion),
60fLastStorage("new")
61{
62// constructor
63
64}
65
66//_____________________________________________________________________________
67AliCDBId::AliCDBId(const AliCDBPath& path, const AliCDBRunRange& runRange,
68 Int_t version, Int_t subVersion):
69fPath(path),
70fRunRange(runRange),
71fVersion(version),
72fSubVersion(subVersion),
73fLastStorage("new")
74{
75// constructor
76
77}
78
79//_____________________________________________________________________________
80AliCDBId::~AliCDBId() {
81//destructor
82
83}
84
85//_____________________________________________________________________________
86Bool_t AliCDBId::IsValid() const {
87// validity check
8e245d15 88
9e1ceb13 89 if (!(fPath.IsValid() && fRunRange.IsValid())) {
90 return kFALSE;
91 }
92
93 // FALSE if doesn't have version but has subVersion
94 return !(!HasVersion() && HasSubVersion());
95}
96
8e245d15 97//___________________________________________________________________________
98Bool_t AliCDBId::IsEqual(const TObject* obj) const {
99// check if this id is equal to other id (compares path, run range, versions)
100
101 if (this == obj) {
102 return kTRUE;
103 }
104
105 if (AliCDBId::Class() != obj->IsA()) {
106 return kFALSE;
107 }
108 AliCDBId* other = (AliCDBId*) obj;
109 return fPath.GetPath() == other->GetPath() && fRunRange.IsEqual(&other->GetAliCDBRunRange()) &&
110 fVersion == other->GetVersion() && fSubVersion == other->GetSubVersion();
111}
112
9e1ceb13 113//_____________________________________________________________________________
114TString AliCDBId::ToString() const {
115// returns a string of Id data
116
c3a7b59a 117 TString result = Form("path: \"%s\"; run range: [%d,%d]",
118 GetPath().Data(), GetFirstRun(), GetLastRun());
119
120 if(GetVersion() >= 0) result += Form("; version: v%d", GetVersion());
121 if(GetSubVersion() >= 0) result += Form("_s%d", GetSubVersion());
122 return result;
9e1ceb13 123}