next50 trigger mask in AliHLTGlobalEsdConverterComponent
[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
ab2463fa 8
9//___________________________________________________________________
9ded305e 10void generatePIDDBLQ(const char *file = "TRD.CalibPIDrefMakerLQ.root")
ab2463fa 11{
12// Write TRD PID DB using the reference data from file "file"
13
14
e7d6a389 15 AliCDBManager *man = AliCDBManager::Instance();
16 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
17 man->SetSpecificStorage("TRD/Calib/PIDLQ", "local://.");
18 man->SetRun(0);
ab2463fa 19
e7d6a389 20 AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB");
21 if (!gStorLoc) return;
ab2463fa 22
9ded305e 23 if(gSystem->Load("libSTAT.so")<0) return;
24 AliTRDCalPID *pid = new AliTRDCalPIDLQ("pidLQ", "LQ TRD PID object");
25 if(!pid->LoadReferences(file)) return;
e7d6a389 26 AliCDBMetaData *md= new AliCDBMetaData();
27 md->SetObjectClassName("AliTRDCalPIDLQ");
28 md->SetResponsible("Alexandru Bercuci");
29 md->SetBeamPeriod(1);
9ded305e 30 md->SetAliRootVersion("v4-17-Release"); //root version
e7d6a389 31 md->SetComment("2D PID for TRD");
9ded305e 32 gStorLoc->Put(pid, AliCDBId("TRD/Calib/PIDLQ", 0, 999999999, 0, 1), md, AliCDBManager::kReference);
ab2463fa 33}
34
35//___________________________________________________________________
ee8fb199 36void generatePIDDBNN(const char *fileNN = "NN.root")
37{
38// Write TRD PID DB using the reference data from file "file"
39
40
41 AliCDBManager *man = AliCDBManager::Instance();
42 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
43 man->SetSpecificStorage("TRD/Calib/PIDNN", "local://.");
44 man->SetRun(0);
45
46 AliCDBStorage *gStorLoc = man->GetStorage("local://$ALICE_ROOT/OCDB");
47 if (!gStorLoc) return;
48
49 AliTRDCalPID *pidNN = new AliTRDCalPIDNN("pidNN", "NN TRD PID object");
50 pidNN->LoadReferences(fileNN);
51 AliCDBMetaData *md= new AliCDBMetaData();
52 md->SetObjectClassName("AliTRDCalPIDNN");
53 md->SetResponsible("Alexander Wilk");
54 md->SetBeamPeriod(1);
55 md->SetAliRootVersion("v4-16-Release"); //root version
56 md->SetComment("NN PID for TRD");
57 gStorLoc->Put(pidNN, AliCDBId("TRD/Calib/PIDNN", 0, 999999999, 0, 1), md, AliCDBManager::kReference);
58}
59
60//___________________________________________________________________
44dbae42 61AliTRDCalPID* getPIDObject(const char *method="NN")
ab2463fa 62{
63// Returns PIDLQ object.
64// In order to browse histos do:
cf41fa6f 65// > AliTRDCalPID *pid = getPIDObject();
ab2463fa 66// > pid->GetHistogram(0, 3);
67
e7d6a389 68 gStyle->SetOptStat(0);
69
ab2463fa 70 AliCDBManager *CDBManager = AliCDBManager::Instance();
e7d6a389 71 CDBManager->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
72 CDBManager->SetRun(0);
ab2463fa 73
e7d6a389 74 AliCDBEntry *wrap = CDBManager->Get(Form("TRD/Calib/PID%s", method), 0);
75 AliTRDCalPID *pid = dynamic_cast<const AliTRDCalPID *>wrap->GetObject();
76 AliCDBMetaData *meta = wrap->GetMetaData();
77 if(!pid){
78 printf("Error while retriving pid object from DB.\n");
79 return 0x0;
80 }
81 meta->PrintMetaData();
82 return pid;
ab2463fa 83}
84