1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
18 // Category: management
20 //-----------------------------------------------------------------------------
22 // -----------------------
23 // Manager class for mapping CDB IO
24 // Author: Ivana Hrivnacova, IPN Orsay
25 //-----------------------------------------------------------------------------
29 #include "AliMpSegmentation.h"
30 #include "AliMpDDLStore.h"
33 #include "AliCDBManager.h"
34 #include "AliCDBEntry.h"
47 //______________________________________________________________________________
48 Bool_t AliMpCDB::LoadMpSegmentation(Bool_t warn)
50 /// Load the sementation from the CDB if it does not yet exist;
51 /// return false only in case loading from CDB failed
55 if ( AliMpSegmentation::Instance(false) ) {
57 AliWarningClass("Segmentation has been already loaded.");
61 AliCDBManager* cdbManager = AliCDBManager::Instance();
62 if ( ! cdbManager->GetDefaultStorage() )
63 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
65 Int_t run = cdbManager->GetRun();
68 cdbManager->SetRun(run);
72 = cdbManager->Get("MUON/Calib/Mapping", run);
74 return (AliMpSegmentation*)cdbEntry->GetObject() != 0x0;
77 //______________________________________________________________________________
78 Bool_t AliMpCDB::LoadDDLStore(Bool_t warn)
80 /// Load the DDL store from the CDB if it does not yet exist
81 /// return false only in case loading from CDB failed
85 if ( AliMpDDLStore::Instance(false) ) {
87 AliWarningClass("DDL Store has been already loaded.");
93 LoadMpSegmentation(warn);
97 AliCDBManager* cdbManager = AliCDBManager::Instance();
98 if ( ! cdbManager->GetDefaultStorage() )
99 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
101 Int_t run = cdbManager->GetRun();
104 cdbManager->SetRun(run);
107 AliCDBEntry* cdbEntry
108 = cdbManager->Get("MUON/Calib/DDLStore", run);
110 return (AliMpDDLStore*)cdbEntry->GetObject() != 0x0;
113 //______________________________________________________________________________
114 Bool_t AliMpCDB::WriteMpSegmentation()
116 /// Write mapping segmentation in OCDB
118 AliCDBManager* cdbManager = AliCDBManager::Instance();
119 if ( ! cdbManager->GetDefaultStorage() )
120 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
122 AliCDBMetaData* cdbData = new AliCDBMetaData();
123 cdbData->SetResponsible("Dimuon Offline project");
124 cdbData->SetComment("MUON mapping");
125 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
126 AliCDBId id("MUON/Calib/Mapping", 0, 9999999);
128 AliMpSegmentation::ReadData(false);
129 return cdbManager->Put(AliMpSegmentation::Instance(), id, cdbData);
132 //______________________________________________________________________________
133 Bool_t AliMpCDB::WriteDDLStore()
135 /// Write mapping DDL store in OCDB
137 AliCDBManager* cdbManager = AliCDBManager::Instance();
138 if ( ! cdbManager->GetDefaultStorage() )
139 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
141 AliCDBMetaData* cdbData = new AliCDBMetaData();
142 cdbData->SetResponsible("Dimuon Offline project");
143 cdbData->SetComment("MUON DDL store");
144 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
145 AliCDBId id("MUON/Calib/DDLStore", 0, 9999999);
147 AliMpSegmentation::ReadData(false);
148 AliMpDDLStore::ReadData(false);
149 return cdbManager->Put(AliMpDDLStore::Instance(), id, cdbData);