]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliCDBGrid.cxx
Added new method DisIntegrate(AliMUONHit&, TList& digits) to replace the one in
[u/mrichter/AliRoot.git] / STEER / AliCDBGrid.cxx
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 // AliCDBGrid                                                                                  //
19 // access class to a DataBase in an AliEn storage                                              //
20 //                                                                                             //
21 /////////////////////////////////////////////////////////////////////////////////////////////////
22
23
24 #include <TGrid.h>
25 #include <TGridResult.h>
26 #include <TFile.h>
27 #include <TKey.h>
28 #include <TROOT.h>
29 #include <TSystem.h>
30 #include <TObjArray.h>
31 #include <TObjString.h>
32 #include <TRegexp.h>
33
34 #include "AliLog.h"
35 #include "AliCDBEntry.h"
36 #include "AliCDBGrid.h"
37
38
39 ClassImp(AliCDBGrid)
40
41 //_____________________________________________________________________________
42 AliCDBGrid::AliCDBGrid(const char *gridUrl, const char *user, const char *dbFolder, const char *se) :
43 AliCDBStorage(),
44 fGridUrl(gridUrl),
45 fUser(user),
46 fDBFolder(dbFolder),
47 fSE(se)
48 {
49 // constructor //
50
51         // if the same Grid is alreay active, skip connection
52         if (!gGrid || fGridUrl != gGrid->GridUrl()  
53              || fUser != gGrid->GetUser()) {
54                 // connection to the Grid
55                 TGrid::Connect(fGridUrl.Data(),fUser.Data());
56         }
57
58         if(!gGrid) {
59                 AliError("Connection failed!");
60                 return;
61         }
62
63         TString initDir(gGrid->Pwd(0));
64         if (fDBFolder[0] != '/') {
65                 fDBFolder.Prepend(initDir);
66         }
67
68         // check DBFolder: trying to cd to DBFolder; if it does not exist, create it
69         if(!gGrid->Cd(fDBFolder.Data(),0)){
70                 AliDebug(2,Form("Creating new folder <%s> ...",fDBFolder.Data()));
71                 if(!gGrid->Mkdir(fDBFolder.Data(),"",0)){
72                         AliError(Form("Cannot create folder <%s> !",fDBFolder.Data())); 
73                 }
74         } else {
75                 AliDebug(2,Form("Folder <%s> found",fDBFolder.Data()));
76         }
77
78         // removes any '/' at the end of path, then append one '/'
79         while(fDBFolder.EndsWith("/")) fDBFolder.Remove(fDBFolder.Last('/')); 
80         fDBFolder+="/";
81
82         // return to the initial directory
83         gGrid->Cd(initDir.Data(),0);
84 }
85
86 //_____________________________________________________________________________
87 AliCDBGrid::~AliCDBGrid()
88 {
89 // destructor
90
91 }
92
93 //_____________________________________________________________________________
94 Bool_t AliCDBGrid::FilenameToId(const char* filename, AliCDBRunRange& runRange, 
95                                 Int_t& gridVersion) {
96 // build AliCDBId from filename numbers
97
98         Ssiz_t mSize;
99         
100         // valid filename: Run#firstRun_#lastRun_v#version.root
101         TRegexp keyPattern("^Run[0-9]+_[0-9]+_v[0-9]+.root$");
102         keyPattern.Index(filename, &mSize);
103         if (!mSize) {
104                 AliDebug(2,Form("Bad filename <%s>.", filename));
105                 return kFALSE;
106         }
107
108         TString idString(filename);
109         idString.Resize(idString.Length() - sizeof(".root") + 1);
110
111         TObjArray* strArray = (TObjArray*) idString.Tokenize("_");
112
113         TString firstRunString(((TObjString*) strArray->At(0))->GetString());
114         runRange.SetFirstRun(atoi(firstRunString.Data() + 3));
115         runRange.SetLastRun(atoi(((TObjString*) strArray->At(1))->GetString()));
116         
117         TString verString(((TObjString*) strArray->At(2))->GetString());
118         gridVersion = atoi(verString.Data() + 1);
119
120         delete strArray;
121
122         return kTRUE;
123 }
124
125 //_____________________________________________________________________________
126 Bool_t AliCDBGrid::IdToFilename(const AliCDBRunRange& runRange, Int_t gridVersion, 
127                                  TString& filename) {
128 // build file name from AliCDBId data (run range, version)
129
130         if (!runRange.IsValid()) {
131                 AliDebug(2,Form("Invalid run range <%d, %d>.", 
132                         runRange.GetFirstRun(), runRange.GetLastRun()));
133                 return kFALSE;
134         }
135
136         if (gridVersion < 0) {
137                 AliDebug(2,Form("Invalid version <%d>.", gridVersion));
138                 return kFALSE;
139         }
140  
141         filename += "Run";
142         filename += runRange.GetFirstRun();
143         filename += "_";
144         filename += runRange.GetLastRun();
145         filename += "_v";
146         filename += gridVersion;
147         filename += ".root";
148
149         return kTRUE;
150 }
151
152 //_____________________________________________________________________________
153 Bool_t AliCDBGrid::PrepareId(AliCDBId& id) {
154 // prepare id (version) of the object that will be stored (called by PutEntry)
155
156         TString initDir(gGrid->Pwd(0));
157         TString pathName= id.GetPath();
158
159         TString dirName(fDBFolder);
160
161         Bool_t dirExist=kFALSE;
162  
163         // go to the path; if directory does not exist, create it
164         TObjArray *arrName=pathName.Tokenize("/");
165         for(int i=0;i<arrName->GetEntries();i++){
166                 TString buffer((arrName->At(i))->GetName());
167                 dirName+=buffer; dirName+="/";
168                 dirExist=gGrid->Cd(dirName,0);
169                 if (!dirExist) {
170                         AliDebug(2,Form("Creating new folder <%s> ...",dirName.Data()));
171                         if(!gGrid->Mkdir(dirName,"",0)){
172                                 AliError(Form("Cannot create directory <%s> !",dirName.Data()));
173                                 gGrid->Cd(initDir.Data());
174                         return kFALSE;
175                         }
176                 }
177         }
178         delete arrName;
179         gGrid->Cd(initDir,0);
180
181         const char* filename;
182         AliCDBRunRange aRunRange; // the runRange got from filename 
183         AliCDBRunRange lastRunRange(-1,-1); // highest runRange found
184         Int_t aVersion; // the version got from filename 
185         Int_t lastVersion=0; // highest version found
186
187         TGridResult *res = gGrid->Ls(dirName);
188
189         //loop on the files in the directory, look for highest version
190         for(int i=0; i < res->GetEntries(); i++){
191                 filename=res->GetFileName(i);
192                 if (!FilenameToId(filename, aRunRange, aVersion)) continue;
193                 if (aRunRange.Overlaps(id.GetAliCDBRunRange()) && aVersion > lastVersion) {
194                         lastVersion = aVersion;
195                         lastRunRange = aRunRange;
196                 }
197
198         }
199         delete res; 
200  
201         id.SetVersion(lastVersion + 1);
202
203         TString lastStorage = id.GetLastStorage();
204         if(lastStorage.Contains(TString("new"), TString::kIgnoreCase) && id.GetVersion() > 1 ){
205                 AliWarning(Form("A NEW object is being stored with version %d",
206                                         id.GetVersion()));
207                 AliWarning(Form("and it will hide previously stored object with version %d!",
208                                         id.GetVersion()-1));
209         }
210
211         if(!lastRunRange.IsAnyRange() && !(lastRunRange.IsEqual(&id.GetAliCDBRunRange()))) 
212                 AliWarning(Form("Run range modified w.r.t. previous version (Run%d_%d_v%d)",
213                         lastRunRange.GetFirstRun(), lastRunRange.GetLastRun(), id.GetVersion()));
214     
215         return kTRUE;
216 }
217
218 //_____________________________________________________________________________
219 AliCDBId AliCDBGrid::GetId(const AliCDBId& query) {
220 // look for filename matching query (called by GetEntry)
221
222         TString initDir(gGrid->Pwd(0));
223
224         AliCDBId result(query.GetAliCDBPath(), -1, -1, -1, -1);
225
226         TString dirName(fDBFolder);
227         dirName += query.GetPath(); // dirName = fDBFolder/idPath
228
229         if (!gGrid->Cd(dirName,0)) {
230                 AliError(Form("Directory <%s> not found", (query.GetPath()).Data()));
231                 AliError(Form("in DB folder %s", fDBFolder.Data()));
232                 return result;
233         }
234  
235         TGridResult *res = gGrid->Ls(dirName);
236
237         const char* filename;
238         AliCDBRunRange aRunRange; // the runRange got from filename
239         Int_t aVersion; // the version got from filename
240  
241         for(int i=0; i < res->GetEntries(); i++){
242                 filename=res->GetFileName(i);
243                 if (!FilenameToId(filename, aRunRange, aVersion)) continue;
244                 // aRunRange and aVersion filled from filename
245                 
246                 if (!aRunRange.Comprises(query.GetAliCDBRunRange())) continue; 
247                 // aRunRange contains requested run!
248
249                 if (!query.HasVersion()){ // look for highest version
250                         if(result.GetVersion() > aVersion) continue;
251                         if(result.GetVersion() == aVersion) {
252                                 AliError(Form("More than one object valid for run %d, version %d!", 
253                                         query.GetFirstRun(), aVersion));
254                                 result.SetRunRange(-1,-1); result.SetVersion(-1);
255                         return result; 
256                         }
257                         result.SetVersion(aVersion);
258                         result.SetFirstRun(aRunRange.GetFirstRun());
259                         result.SetLastRun(aRunRange.GetLastRun());
260
261                 } else { // look for specified version
262                         if(query.GetVersion() != aVersion) continue;
263                         if(result.GetVersion() == aVersion){
264                                 AliError(Form("More than one object valid for run %d, version %d!", 
265                                         query.GetFirstRun(), aVersion));
266                                         result.SetRunRange(-1,-1); result.SetVersion(-1); 
267                                         return result; 
268                         }
269                         result.SetVersion(aVersion);
270                         result.SetFirstRun(aRunRange.GetFirstRun());
271                         result.SetLastRun(aRunRange.GetLastRun());
272                 }
273         } // end loop on filenames
274         delete res;
275         
276         gGrid->Cd(initDir.Data(),0);
277  
278         return result;
279 }
280
281 //_____________________________________________________________________________
282 AliCDBEntry* AliCDBGrid::GetEntry(const AliCDBId& queryId) {
283 // get AliCDBEntry from the database
284
285         AliCDBId dataId;
286         
287         // look for a filename matching query requests (path, runRange, version, subVersion)
288         if (!queryId.HasVersion()) {
289                 // if version is not specified, first check the selection criteria list
290                 dataId = GetId(GetSelection(queryId));
291         } else {
292                 dataId = GetId(queryId);
293         }
294
295         if (!dataId.IsSpecified()) return NULL;
296
297         TString filename;
298         if (!IdToFilename(dataId.GetAliCDBRunRange(), dataId.GetVersion(),filename)) {
299                 AliError("Bad data ID encountered! Subnormal error!");
300                 return NULL;
301         }
302
303         filename.Prepend("/alien" + fDBFolder + queryId.GetPath() + '/');
304         filename += "?se="; filename += fSE.Data(); 
305
306         AliInfo(Form("Opening file: %s",filename.Data()));
307         TFile *file = TFile::Open(filename);
308         if (!file) {
309                 AliError(Form("Can't open file <%s>!", filename.Data()));
310                 return NULL;
311         }
312
313         // get the only AliCDBEntry object from the file
314         // the object in the file is an AliCDBEntry entry named "AliCDBEntry"
315
316         TObject* anObject = file->Get("AliCDBEntry");
317
318         if (!anObject) {
319                 AliError("Bad storage data: NULL entry object!");
320                 return NULL;
321         }
322
323         if (AliCDBEntry::Class() != anObject->IsA()) {
324                 AliError("Bad storage data: Invalid entry object!");
325                 return NULL;
326         }
327
328         AliCDBId entryId = ((AliCDBEntry* ) anObject)->GetId();
329  
330         // The object's Id is not reset during storage
331         // If object's Id runRange or version do not match with filename,
332         // it means that someone renamed file by hand. In this case a warning msg is issued.
333  
334         ((AliCDBEntry*) anObject)->SetLastStorage("grid");
335  
336         if(!((entryId.GetAliCDBRunRange()).IsEqual(&dataId.GetAliCDBRunRange())) || 
337                 entryId.GetVersion() != dataId.GetVersion()){
338                 AliWarning(Form("Either RunRange or gridVersion in the object's metadata do noth match with fileName numbers:"));
339                 AliWarning(Form("someone renamed file by hand!"));
340         }
341
342         // close file, return retieved entry
343         file->Close(); delete file; file=0;
344         return (AliCDBEntry*) anObject;
345 }
346
347 //_____________________________________________________________________________
348 void AliCDBGrid::GetEntriesForLevel0(const char* level0,
349         const AliCDBId& queryId, TList* result) {
350 // multiple request (AliCDBStorage::GetAll)
351
352         TString level0Dir=fDBFolder;
353         level0Dir += level0;
354
355         if (!gGrid->Cd(level0Dir,0)) {
356                 AliError(Form("Level0 directory <%s> not found", level0Dir.Data()));
357                 return;
358         }
359
360         TGridResult *res = gGrid->Ls(level0Dir);
361         TString level1;
362         for(int i=0; i < res->GetEntries(); i++){
363                 level1=res->GetFileName(i);
364         if (queryId.GetAliCDBPath().Level1Comprises(level1))
365                 GetEntriesForLevel1(level0, level1, queryId, result);
366         }
367         delete res;
368 }
369
370 //_____________________________________________________________________________
371 void AliCDBGrid::GetEntriesForLevel1(const char* level0, const char* level1,
372         const AliCDBId& queryId, TList* result) {
373 // multiple request (AliCDBStorage::GetAll)
374
375         TString level1Dir=fDBFolder;
376         level1Dir += level0;
377         level1Dir += '/';
378         level1Dir += level1;
379
380         if (!gGrid->Cd(level1Dir,0)) {
381                 AliError(Form("Level1 directory <%s> not found", level1Dir.Data()));
382                 return;
383         }
384
385         TGridResult *res = gGrid->Ls(level1Dir);
386         TString level2;
387         for(int i=0; i < res->GetEntries(); i++){
388                 level2=res->GetFileName(i);
389                 if (queryId.GetAliCDBPath().Level2Comprises(level2)){
390                         AliCDBPath entryPath(level0, level1, level2);
391                         AliCDBId entryId(entryPath, 
392                                 queryId.GetAliCDBRunRange(),
393                                 queryId.GetVersion(), 
394                                 queryId.GetSubVersion());
395
396                         AliCDBEntry* anEntry = GetEntry(entryId);
397                         if (anEntry) result->Add(anEntry);
398
399                 }
400         }
401         delete res;
402 }
403
404 //_____________________________________________________________________________
405 TList* AliCDBGrid::GetEntries(const AliCDBId& queryId) {
406 // multiple request (AliCDBStorage::GetAll)
407
408         TList* result = new TList();
409         result->SetOwner();
410
411         TString initDir(gGrid->Pwd(0));
412
413         TGridResult *res = gGrid->Ls(fDBFolder);
414         TString level0;
415
416         for(int i=0; i < res->GetEntries(); i++){
417                 level0=res->GetFileName(i);
418                 if (queryId.GetAliCDBPath().Level0Comprises(level0)) 
419                         GetEntriesForLevel0(level0, queryId, result);                               
420         }        
421         delete res;
422  
423         gGrid->Cd(initDir.Data(),0);
424         return result;  
425 }
426
427 //_____________________________________________________________________________
428 Bool_t AliCDBGrid::PutEntry(AliCDBEntry* entry) {
429 // put an AliCDBEntry object into the database
430         
431         AliCDBId& id = entry->GetId();
432
433         // set version for the entry to be stored
434         if (!PrepareId(id)) return kFALSE;       
435
436         // build filename from entry's id
437         TString filename;
438         if (!IdToFilename(id.GetAliCDBRunRange(), id.GetVersion(), filename)) {
439                 AliError("Bad ID encountered! Subnormal error!");
440                 return kFALSE;
441         } 
442
443         filename.Prepend("/alien" + fDBFolder + id.GetPath() + '/');
444         TString filenameCopy(filename);
445         filename += "?se="; filename += fSE.Data(); 
446  
447         TDirectory* saveDir = gDirectory;
448
449         // open file
450         TFile *file = TFile::Open(filename,"CREATE");
451         if(!file || !file->IsWritable()){
452                 AliError(Form("Can't open file <%s>!", filename.Data()));    
453                 if(file && !file->IsWritable()) file->Close(); delete file; file=0;
454                 return kFALSE;
455         }
456   
457         file->cd(); 
458
459         entry->SetVersion(id.GetVersion());
460
461         // write object (key name: "AliCDBEntry")
462         Bool_t result = (entry->Write("AliCDBEntry") != 0); 
463         if (!result) AliError(Form("Can't write entry to file <%s>!",filename.Data()));
464
465
466         if (saveDir) saveDir->cd(); else gROOT->cd();
467         file->Close(); delete file; file=0;
468         if(result) {
469                 AliInfo(Form("CDB object stored into file %s",filenameCopy.Data()));
470                 AliInfo(Form("using S.E. %s", fSE.Data()));
471         }
472  
473         return result;
474 }
475
476 //_____________________________________________________________________________
477 TList* AliCDBGrid::GetIdListFromFile(const char* fileName){
478
479         TString turl(fileName);
480         turl.Prepend("/alien" + fDBFolder);
481         turl += "?se="; turl += fSE.Data(); 
482         TFile *file = TFile::Open(turl);
483         if (!file) {
484                 AliError(Form("Can't open selection file <%s>!", turl.Data()));
485                 return NULL;
486         }
487
488         TList *list = new TList();
489         list->SetOwner();
490         int i=0;
491         TString keycycle;
492         
493         AliCDBId *id;
494         while(1){
495                 i++;
496                 keycycle = "AliCDBId;";
497                 keycycle+=i;
498                 
499                 id = (AliCDBId*) file->Get(keycycle);
500                 if(!id) break;
501                 list->AddFirst(id);
502         }
503         file->Close(); delete file; file=0;
504         
505         return list;
506
507
508 }
509
510 //_____________________________________________________________________________
511 Bool_t AliCDBGrid::Contains(const char* path) const{
512 // check for path in storage's DBFolder
513
514         TString initDir(gGrid->Pwd(0));
515         TString dirName(fDBFolder);
516         dirName += path; // dirName = fDBFolder/path
517         Bool_t result=kFALSE;
518         if (gGrid->Cd(dirName,0)) result=kTRUE;
519         gGrid->Cd(initDir.Data(),0);
520         return result;
521 }
522
523 /////////////////////////////////////////////////////////////////////////////////////////////////
524 //                                                                                             //
525 // AliCDBGrid factory                                                                          //
526 //                                                                                             //
527 /////////////////////////////////////////////////////////////////////////////////////////////////
528
529 ClassImp(AliCDBGridFactory)
530
531 //_____________________________________________________________________________
532 Bool_t AliCDBGridFactory::Validate(const char* gridString) {
533 // check if the string is valid Grid URI
534
535         // pattern: alien://hostName:Port;user;dbPath;SE
536         // example of a valid pattern:
537         // "alien://aliendb4.cern.ch:9000;colla;DBTest;ALICE::CERN::Server"
538 //        TRegexp gridPattern("^alien://.+:[0-9]+;[a-zA-Z0-9_-.]+;.+;.+$");
539         TRegexp gridPattern("^alien://.+$");
540
541         return TString(gridString).Contains(gridPattern);
542 }
543
544 //_____________________________________________________________________________
545 AliCDBParam* AliCDBGridFactory::CreateParameter(const char* gridString) {
546 // create AliCDBGridParam class from the URI string
547
548         if (!Validate(gridString)) {
549                 return NULL;
550         }
551         //TString buffer(gridString + sizeof("alien://") - 1);
552         TString buffer(gridString);
553  
554         TString gridUrl         = "alien://"; 
555         TString user            = "";
556         TString dbFolder        = "DBGrid";
557         TString se              = "ALICE::CERN::se01";
558
559         TObjArray *arr = buffer.Tokenize('?');
560         TIter iter(arr);
561         TObjString *str;
562         
563         while((str = (TObjString*) iter.Next())){
564                 TString entry(str->String());
565                 Int_t indeq = entry.Index('=');
566                 if(indeq == -1) {
567                         if(entry.BeginsWith("alien://")) { // maybe it's a gridUrl!
568                                 gridUrl = entry;
569                                 continue;
570                         } else {
571                                 AliError(Form("Invalid entry! %s",entry.Data()));
572                                 continue;
573                         }
574                 }
575                 
576                 TString key = entry(0,indeq);
577                 TString value = entry(indeq+1,entry.Length()-indeq);
578
579                 if(key.Contains("grid",TString::kIgnoreCase)) {
580                         gridUrl += value;
581                 } 
582                 else if (key.Contains("user",TString::kIgnoreCase)){
583                         user = value;
584                 }
585                 else if (key.Contains("folder",TString::kIgnoreCase)){
586                         dbFolder = value;
587                 }
588                 else if (key.Contains("se",TString::kIgnoreCase)){
589                         se = value;
590                 }
591                 else{
592                         AliError(Form("Invalid entry! %s",entry.Data()));
593                 }
594         }
595         delete arr; arr=0;
596                 
597         AliInfo(Form("gridUrl:  %s",gridUrl.Data()));
598         AliInfo(Form("user:     %s",user.Data()));
599         AliInfo(Form("dbFolder: %s",dbFolder.Data()));
600         AliInfo(Form("s.e.:     %s",se.Data()));
601
602         return new AliCDBGridParam(gridUrl, user, dbFolder, se);       
603 }
604
605 //_____________________________________________________________________________
606 AliCDBStorage* AliCDBGridFactory::Create(const AliCDBParam* param) {
607 // create AliCDBGrid storage instance from parameters
608         
609         if (AliCDBGridParam::Class() == param->IsA()) {
610                 
611                 const AliCDBGridParam* gridParam = (const AliCDBGridParam*) param;
612                 AliCDBGrid *grid = new AliCDBGrid(gridParam->GridUrl(), 
613                                       gridParam->GetUser(), gridParam->GetDBFolder(),
614                                       gridParam->GetSE()); 
615
616                 if(gGrid) return grid;
617         }
618
619         return NULL;
620 }
621
622 /////////////////////////////////////////////////////////////////////////////////////////////////
623 //                                                                                             //
624 // AliCDBGrid Parameter class                                                                  //                                          //
625 //                                                                                             //
626 /////////////////////////////////////////////////////////////////////////////////////////////////
627
628 ClassImp(AliCDBGridParam)
629
630 //_____________________________________________________________________________
631 AliCDBGridParam::AliCDBGridParam() {
632 // default constructor
633
634 }
635
636 //_____________________________________________________________________________
637 AliCDBGridParam::AliCDBGridParam(const char* gridUrl, 
638                                 const char* user, 
639                                 const char* dbFolder, 
640                                 const char* se):
641  fGridUrl(gridUrl),
642  fUser(user),
643  fDBFolder(dbFolder),
644  fSE(se)
645 {
646 // constructor
647         
648         SetType("alien");
649
650         TString uri;
651         uri+=fGridUrl; uri+="?";
652         uri+="User=";   uri+=fUser; uri+="?"; 
653         uri+="DBFolder="; uri+=fDBFolder; uri+="?";
654         uri+="SE=";     uri+=fSE;
655         
656         SetURI(uri);
657 }
658
659 //_____________________________________________________________________________
660 AliCDBGridParam::~AliCDBGridParam() {
661 // destructor
662
663 }
664
665 //_____________________________________________________________________________
666 AliCDBParam* AliCDBGridParam::CloneParam() const {
667 // clone parameter
668
669         return new AliCDBGridParam(fGridUrl, fUser, fDBFolder, fSE);
670 }
671
672 //_____________________________________________________________________________
673 ULong_t AliCDBGridParam::Hash() const {
674 // return Hash function
675
676         return fGridUrl.Hash()+fUser.Hash()+fDBFolder.Hash()+fSE.Hash();
677 }
678
679 //_____________________________________________________________________________
680 Bool_t AliCDBGridParam::IsEqual(const TObject* obj) const {
681 // check if this object is equal to AliCDBParam obj
682
683         if (this == obj) {
684                 return kTRUE;
685         }
686
687         if (AliCDBGridParam::Class() != obj->IsA()) {
688                 return kFALSE;
689         }
690
691         AliCDBGridParam* other = (AliCDBGridParam*) obj;
692
693         if(fGridUrl != other->fGridUrl) return kFALSE;
694         if(fUser != other->fUser) return kFALSE;
695         if(fDBFolder != other->fDBFolder) return kFALSE;
696         if(fSE != other->fSE) return kFALSE;
697         return kTRUE;
698 }
699