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 #include "AliMpSegmentation.h"
48 #include <Riostream.h>
49 //______________________________________________________________________________
50 Bool_t AliMpCDB::LoadMpSegmentation(Bool_t warn)
52 /// Load the sementation from the CDB if it does not yet exist;
53 /// return false only in case loading from CDB failed
57 if ( AliMpSegmentation::Instance(false) ) {
59 AliWarningClass("Segmentation has been already loaded.");
63 AliCDBManager* cdbManager = AliCDBManager::Instance();
64 if ( ! cdbManager->GetDefaultStorage() )
65 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
67 Int_t run = cdbManager->GetRun();
70 cdbManager->SetRun(run);
74 = cdbManager->Get("MUON/Calib/Mapping", run);
76 return (AliMpSegmentation*)cdbEntry->GetObject() != 0x0;
79 //______________________________________________________________________________
80 Bool_t AliMpCDB::LoadDDLStore(Bool_t warn)
82 /// Load the DDL store from the CDB if it does not yet exist
83 /// return false only in case loading from CDB failed
87 if ( AliMpDDLStore::Instance(false) ) {
89 AliWarningClass("DDL Store has been already loaded.");
93 AliCDBManager* cdbManager = AliCDBManager::Instance();
94 if ( ! cdbManager->GetDefaultStorage() )
95 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
97 Int_t run = cdbManager->GetRun();
100 cdbManager->SetRun(run);
103 AliCDBEntry* cdbEntry
104 = cdbManager->Get("MUON/Calib/DDLStore", run);
106 return (AliMpDDLStore*)cdbEntry->GetObject() != 0x0;
109 //______________________________________________________________________________
110 Bool_t AliMpCDB::WriteMpSegmentation()
112 /// Write mapping segmentation in OCDB
114 AliCDBManager* cdbManager = AliCDBManager::Instance();
115 if ( ! cdbManager->GetDefaultStorage() )
116 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
118 AliCDBMetaData* cdbData = new AliCDBMetaData();
119 cdbData->SetResponsible("Dimuon Offline project");
120 cdbData->SetComment("MUON mapping");
121 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
122 AliCDBId id("MUON/Calib/Mapping", 0, 9999999);
124 AliMpSegmentation::ReadData(false);
125 return cdbManager->Put(AliMpSegmentation::Instance(), id, cdbData);
128 //______________________________________________________________________________
129 Bool_t AliMpCDB::WriteDDLStore()
131 /// Write mapping DDL store in OCDB
133 AliCDBManager* cdbManager = AliCDBManager::Instance();
134 if ( ! cdbManager->GetDefaultStorage() )
135 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
137 AliCDBMetaData* cdbData = new AliCDBMetaData();
138 cdbData->SetResponsible("Dimuon Offline project");
139 cdbData->SetComment("MUON DDL store");
140 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
141 AliCDBId id("MUON/Calib/DDLStore", 0, 9999999);
143 AliMpSegmentation::ReadData(false);
144 AliMpDDLStore::ReadData(false);
145 return cdbManager->Put(AliMpDDLStore::Instance(), id, cdbData);