]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDDBAccess.C
Missing DATE event types are added to the base raw data header
[u/mrichter/AliRoot.git] / TRD / AliTRDDBAccess.C
CommitLineData
ed25c022 1
2AliCDBStorage *storLoc;
3AliCDBStorage *storGrid;
4AliCDBEntry *entry = 0;
3551db50 5AliTRDCalPad *calobj = 0;
6AliTRDCalROC *calobjROC = 0;
ed25c022 7
969b8f0c 8void AliTRDDBAccess()
ed25c022 9{
10
11 // Single instance of AliCDBManager.
12 AliCDBManager *man = AliCDBManager::Instance();
13
14 printf("\nTRD :: Activating Local storage...\n");
15 storLoc = man->GetStorage("local://DBLocal");
16
17 // Create the new database object
3551db50 18 AliTRDCalPad *calVdrift = new AliTRDCalPad("Vdrift","TRD drift velocities");
19 AliTRDCalROC *calROCVdrift = calVdrift->GetCalROC(0,2,0);
20 calROCVdrift->SetValue(1,1,1.50);
21 calROCVdrift->SetValue(2,2,1.55);
22 calROCVdrift->SetValue(3,3,1.60);
ed25c022 23
24 // Id of the object: AliCDBId("name", firstRun, lastRun)
25 AliCDBId id1("TRD/Calib/Vdrift",0,10);
26
27 // MetaData describing the object
28 AliCDBMetaData *md1= new AliCDBMetaData();
3551db50 29 md1->SetObjectClassName("AliTRDCalPad");
ed25c022 30 md1->SetResponsible("Christoph Blume");
31 md1->SetBeamPeriod(1);
32 md1->SetAliRootVersion("05-04-00"); //root version
969b8f0c 33 md1->SetComment("This is a Vdrift test");
34 TObjString *strVdrift = new TObjString("Drift velocities for 540 chambers");
35 md1->SetProperty("key1",strVdrift);
ed25c022 36
37 // Store the object into local storage
38 // Filename: DBLocal/TRD/Calib/Vdrift/Run0_10_v0_s0.root
39 printf("\nTRD :: Storing object into local storage...\n");
40 storLoc->Put(calVdrift,id1,md1);
41
42 // Read, update, store again
43 printf("\nTRD :: Retrieve object from local storage...\n");
44 entry = storLoc->Get("TRD/Calib/Vdrift",5);
45
3551db50 46 calobj = (AliTRDCalPad *) entry->GetObject();
47 calobjROC = calobj->GetCalROC(0,2,0);
ed25c022 48 printf("\nTRD :: Drift velocities (1): %f (1,1), %f (2,2), %f (3.3)\n"
3551db50 49 ,calobjROC->GetValue(1,1)
50 ,calobjROC->GetValue(2,2)
51 ,calobjROC->GetValue(3,3));
ed25c022 52
53 // Update object
3551db50 54 calobjROC->SetValue(1,1,1.60);
55 calobjROC->SetValue(2,2,1.35);
56 calobjROC->SetValue(3,3,1.10);
ed25c022 57
58 // Store into local: filename = Run0_10_v0_s1.root
59 printf("\nTRD :: Storing object into local storage...\n");
60 storLoc->Put(entry);
61
62 // Read, update, store again
63 printf("\nTRD :: Retrieve object from local storage...\n");
64 entry = storLoc->Get("TRD/Calib/Vdrift",5);
3551db50 65 entry = storLoc->Get("TRD/Calib/Vdrift",5);
66 entry = storLoc->Get("TRD/Calib/Vdrift",5);
ed25c022 67
3551db50 68 calobj = (AliTRDCalPad *) entry->GetObject();
69 calobjROC = calobj->GetCalROC(0,2,0);
ed25c022 70 printf("\nTRD :: Drift velocities (2): %f (1,1), %f (2,2), %f (3.3)\n"
3551db50 71 ,calobjROC->GetValue(1,1)
72 ,calobjROC->GetValue(2,2)
73 ,calobjROC->GetValue(3,3));
ed25c022 74
75 printf("\nTRD :: Activating GRID storage...\n");
76 storGrid = 0x0;
77 storGrid = man->GetStorage("alien://aliendb4.cern.ch:9000;cblume;DBGrid;ALICE::CERN::se01");
78 if (!storGrid) {
79 printf("\nTRD :: Failure in activating GRID storage...\n");
80 }
81
82 // Store into GRID: filename = DBGrid/TRD/Calib/Vdrift/Run0_10_v1.root
83 if (storGrid) {
84 storGrid->Put(entry);
85 }
86
3551db50 87 entry->Dump();
88 cout << entry->IsOwner() << endl;
89
ed25c022 90 AliCDBManager::Instance()->Destroy();
91 delete entry;
92 delete md1;
93
94}