]>
Commit | Line | Data |
---|---|---|
ab2463fa | 1 | // Functions to create/store/inspect TRD PID DB. |
2 | // | |
3 | // Author: | |
4 | // Alex Bercuci (A.Bercuci@gsi.de) | |
5 | // | |
6 | ||
7 | ||
8 | //___________________________________________________________________ | |
9 | void makePIDRefs(const char *dir = ".", const char *file="Refs.root") | |
10 | { | |
11 | // Build the reference data for PID. The simulations have to fulfill | |
12 | // the directory structure defined inside AliTRDCalPIDRefMaker. | |
13 | // Parameters: | |
14 | // 1. "dir" - the root directory of the production | |
15 | // 2. "file" - output file containing reference data saved in directory | |
16 | // "dir" | |
17 | ||
18 | AliCDBManager *man = AliCDBManager::Instance(); | |
19 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
20 | man->SetRun(0); | |
21 | ||
22 | AliTRDCalPIDRefMaker maker; | |
23 | maker.BuildLQReferences(file, dir); | |
24 | } | |
25 | ||
26 | //___________________________________________________________________ | |
27 | void generatePIDDB(const char *file = "Refs.root") | |
28 | { | |
29 | // Write TRD PID DB using the reference data from file "file" | |
30 | ||
31 | ||
32 | AliCDBManager *man = AliCDBManager::Instance(); | |
33 | man->SetDefaultStorage("local://$ALICE_ROOT"); | |
34 | man->SetRun(0); | |
35 | ||
36 | AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT"); | |
37 | if (!gStorLoc) return; | |
38 | ||
39 | ||
cf41fa6f | 40 | AliTRDCalPID *pid = new AliTRDCalPID("pid", "TRD PID object"); |
ab2463fa | 41 | pid->LoadLQReferences(file); |
42 | ||
43 | AliCDBMetaData *md= new AliCDBMetaData(); | |
44 | md->SetObjectClassName("AliTRDCalPIDLQ"); | |
45 | md->SetResponsible("Alex Bercuci"); | |
46 | md->SetBeamPeriod(1); | |
cf41fa6f | 47 | md->SetAliRootVersion("v4-06-HEAD"); //root version |
ab2463fa | 48 | md->SetComment("2D PID for TRD"); |
49 | ||
50 | gStorLoc->Put(pid, AliCDBId("TRD/Calib/PIDLQ", 0, 0), md); | |
51 | } | |
52 | ||
53 | //___________________________________________________________________ | |
cf41fa6f | 54 | AliTRDCalPID* getPIDObject() |
ab2463fa | 55 | { |
56 | // Returns PIDLQ object. | |
57 | // In order to browse histos do: | |
cf41fa6f | 58 | // > AliTRDCalPID *pid = getPIDObject(); |
ab2463fa | 59 | // > pid->GetHistogram(0, 3); |
60 | ||
61 | gStyle->SetOptStat(0); | |
62 | ||
63 | AliCDBManager *CDBManager = AliCDBManager::Instance(); | |
64 | CDBManager->SetDefaultStorage("local://$ALICE_ROOT"); | |
65 | CDBManager->SetRun(0); | |
66 | ||
67 | AliCDBEntry *wrap = CDBManager->Get("TRD/Calib/PIDLQ", 0); | |
cf41fa6f | 68 | AliTRDCalPID *pid = dynamic_cast<const AliTRDCalPID *>wrap->GetObject(); |
ab2463fa | 69 | AliCDBMetaData *meta = wrap->GetMetaData(); |
70 | if(!pid){ | |
71 | printf("Error while retriving pid object from DB.\n"); | |
72 | return 0x0; | |
73 | } | |
74 | meta->PrintMetaData(); | |
75 | return pid; | |
76 | } | |
77 |