]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/Macros/AliTRDpidCDB.C
ACORDEv1 is now the default
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDpidCDB.C
CommitLineData
ab2463fa 1// Functions to create/store/inspect TRD PID DB.
2//
3// Author:
4// Alex Bercuci (A.Bercuci@gsi.de)
5//
6
7
8//___________________________________________________________________
9void 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//___________________________________________________________________
44dbae42 27void generatePIDDB(const char *fileNN = "NN.root", const char *fileLQ = "LQ.root")
ab2463fa 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");
44dbae42 37 if (!gStorLoc) return;
ab2463fa 38
39
44dbae42 40 AliTRDCalPID *pidLQ = new AliTRDCalPIDLQ("pidLQ", "LQ TRD PID object");
41 pidLQ->LoadReferences(fileLQ);
42 AliCDBMetaData *md= new AliCDBMetaData();
43 md->SetObjectClassName("AliTRDCalPIDLQ");
44 md->SetResponsible("Alex Bercuci");
45 md->SetBeamPeriod(1);
46 md->SetAliRootVersion("v4-06-HEAD"); //root version
47 md->SetComment("2D PID for TRD");
48 gStorLoc->Put(pidLQ, AliCDBId("TRD/Calib/PIDLQ", 0, 999999999, 0, 1), md);
49
50 AliTRDCalPID *pidNN = new AliTRDCalPIDNN("pidNN", "NN TRD PID object");
51 pidNN->LoadReferences(fileNN);
52 md->SetObjectClassName("AliTRDCalPIDNN");
53 md->SetResponsible("Alex Wilk");
54 md->SetBeamPeriod(1);
55 md->SetAliRootVersion("v4-06-HEAD"); //root version
56 md->SetComment("NN PID for TRD");
57
58 gStorLoc->Put(pidNN, AliCDBId("TRD/Calib/PIDNN", 0, 999999999, 0, 1), md);
ab2463fa 59}
60
61//___________________________________________________________________
44dbae42 62AliTRDCalPID* getPIDObject(const char *method="NN")
ab2463fa 63{
64// Returns PIDLQ object.
65// In order to browse histos do:
cf41fa6f 66// > AliTRDCalPID *pid = getPIDObject();
ab2463fa 67// > pid->GetHistogram(0, 3);
68
69 gStyle->SetOptStat(0);
70
71 AliCDBManager *CDBManager = AliCDBManager::Instance();
72 CDBManager->SetDefaultStorage("local://$ALICE_ROOT");
73 CDBManager->SetRun(0);
74
44dbae42 75 AliCDBEntry *wrap = CDBManager->Get(Form("TRD/Calib/PID%s", method), 0);
cf41fa6f 76 AliTRDCalPID *pid = dynamic_cast<const AliTRDCalPID *>wrap->GetObject();
ab2463fa 77 AliCDBMetaData *meta = wrap->GetMetaData();
78 if(!pid){
79 printf("Error while retriving pid object from DB.\n");
80 return 0x0;
81 }
82 meta->PrintMetaData();
83 return pid;
84}
85