]>
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 | ||
e7d6a389 | 18 | AliCDBManager *man = AliCDBManager::Instance(); |
19 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
20 | man->SetRun(0); | |
ab2463fa | 21 | |
e7d6a389 | 22 | AliTRDCalPIDRefMaker maker; |
23 | maker.BuildLQReferences(file, dir); | |
ab2463fa | 24 | } |
25 | ||
26 | //___________________________________________________________________ | |
e7d6a389 | 27 | void generatePIDDB() |
ab2463fa | 28 | { |
29 | // Write TRD PID DB using the reference data from file "file" | |
30 | ||
31 | ||
e7d6a389 | 32 | AliCDBManager *man = AliCDBManager::Instance(); |
33 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
34 | man->SetSpecificStorage("TRD/Calib/PIDLQ", "local://."); | |
35 | man->SetRun(0); | |
ab2463fa | 36 | |
e7d6a389 | 37 | AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB"); |
38 | if (!gStorLoc) return; | |
ab2463fa | 39 | |
e7d6a389 | 40 | AliTRDpidRefMakerLQ pidMaker; |
41 | TObject *o = pidMaker.GetOCDBEntry("20091101"); | |
42 | AliCDBMetaData *md= new AliCDBMetaData(); | |
43 | md->SetObjectClassName("AliTRDCalPIDLQ"); | |
44 | md->SetResponsible("Alexandru Bercuci"); | |
45 | md->SetBeamPeriod(1); | |
46 | md->SetAliRootVersion("v4-16-Release"); //root version | |
47 | md->SetComment("2D PID for TRD"); | |
48 | gStorLoc->Put(o, AliCDBId("TRD/Calib/PIDLQ", 0, 999999999, 0, 1), md, AliCDBManager::kReference); | |
ab2463fa | 49 | } |
50 | ||
ee8fb199 | 51 | //___________________________________________________________________ |
52 | void generatePIDDBNN(const char *fileNN = "NN.root") | |
53 | { | |
54 | // Write TRD PID DB using the reference data from file "file" | |
55 | ||
56 | ||
57 | AliCDBManager *man = AliCDBManager::Instance(); | |
58 | man->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
59 | man->SetSpecificStorage("TRD/Calib/PIDNN", "local://."); | |
60 | man->SetRun(0); | |
61 | ||
62 | AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB"); | |
63 | if (!gStorLoc) return; | |
64 | ||
65 | AliTRDCalPID *pidNN = new AliTRDCalPIDNN("pidNN", "NN TRD PID object"); | |
66 | pidNN->LoadReferences(fileNN); | |
67 | AliCDBMetaData *md= new AliCDBMetaData(); | |
68 | md->SetObjectClassName("AliTRDCalPIDNN"); | |
69 | md->SetResponsible("Alexander Wilk"); | |
70 | md->SetBeamPeriod(1); | |
71 | md->SetAliRootVersion("v4-16-Release"); //root version | |
72 | md->SetComment("NN PID for TRD"); | |
73 | gStorLoc->Put(pidNN, AliCDBId("TRD/Calib/PIDNN", 0, 999999999, 0, 1), md, AliCDBManager::kReference); | |
74 | } | |
75 | ||
ab2463fa | 76 | //___________________________________________________________________ |
44dbae42 | 77 | AliTRDCalPID* getPIDObject(const char *method="NN") |
ab2463fa | 78 | { |
79 | // Returns PIDLQ object. | |
80 | // In order to browse histos do: | |
cf41fa6f | 81 | // > AliTRDCalPID *pid = getPIDObject(); |
ab2463fa | 82 | // > pid->GetHistogram(0, 3); |
83 | ||
e7d6a389 | 84 | gStyle->SetOptStat(0); |
85 | ||
ab2463fa | 86 | AliCDBManager *CDBManager = AliCDBManager::Instance(); |
e7d6a389 | 87 | CDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
88 | CDBManager->SetRun(0); | |
ab2463fa | 89 | |
e7d6a389 | 90 | AliCDBEntry *wrap = CDBManager->Get(Form("TRD/Calib/PID%s", method), 0); |
91 | AliTRDCalPID *pid = dynamic_cast<const AliTRDCalPID *>wrap->GetObject(); | |
92 | AliCDBMetaData *meta = wrap->GetMetaData(); | |
93 | if(!pid){ | |
94 | printf("Error while retriving pid object from DB.\n"); | |
95 | return 0x0; | |
96 | } | |
97 | meta->PrintMetaData(); | |
98 | return pid; | |
ab2463fa | 99 | } |
100 |