]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDDBAccess.C
Add pad gain correction + the x position 0 <-> time bin 0 - x increases TOWARDS inter...
[u/mrichter/AliRoot.git] / TRD / AliTRDDBAccess.C
1
2 AliCDBStorage      *storLoc;
3 AliCDBStorage      *storGrid;
4 AliCDBEntry        *entry     = 0;
5 AliTRDCalPad    *calobj    = 0;
6 AliTRDCalROC *calobjROC = 0;
7
8 void AliTRDDBAccess()
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
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);
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(); 
29   md1->SetObjectClassName("AliTRDCalPad");
30   md1->SetResponsible("Christoph Blume");
31   md1->SetBeamPeriod(1);
32   md1->SetAliRootVersion("05-04-00"); //root version
33   md1->SetComment("This is a Vdrift test");
34   TObjString *strVdrift = new TObjString("Drift velocities for 540 chambers");
35   md1->SetProperty("key1",strVdrift);
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
46   calobj    = (AliTRDCalPad *) entry->GetObject();
47   calobjROC = calobj->GetCalROC(0,2,0);
48   printf("\nTRD :: Drift velocities (1): %f (1,1), %f (2,2), %f (3.3)\n"
49         ,calobjROC->GetValue(1,1)
50         ,calobjROC->GetValue(2,2)
51         ,calobjROC->GetValue(3,3));
52
53   // Update object
54   calobjROC->SetValue(1,1,1.60);
55   calobjROC->SetValue(2,2,1.35);
56   calobjROC->SetValue(3,3,1.10);
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);
65   entry = storLoc->Get("TRD/Calib/Vdrift",5);
66   entry = storLoc->Get("TRD/Calib/Vdrift",5);
67
68   calobj    = (AliTRDCalPad *) entry->GetObject();
69   calobjROC = calobj->GetCalROC(0,2,0);
70   printf("\nTRD :: Drift velocities (2): %f (1,1), %f (2,2), %f (3.3)\n"
71         ,calobjROC->GetValue(1,1)
72         ,calobjROC->GetValue(2,2)
73         ,calobjROC->GetValue(3,3));
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
87   entry->Dump();
88   cout << entry->IsOwner() << endl;
89   
90   AliCDBManager::Instance()->Destroy();
91   delete entry;
92   delete md1;
93
94 }