]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCGenDBTemp.cxx
macro to run on alien
[u/mrichter/AliRoot.git] / TPC / AliTPCGenDBTemp.cxx
CommitLineData
9312398d 1
9312398d 2// TTimeStamp startTime(2006,10,18,0,0,0,0,kFALSE)
3// TTimeStamp endTime(2006,10,19,0,0,0,0,kFALSE)
4// Int_t run=2546
5// AliTPCGenDBTemp db
6// db->Init(run,"TPC/Config/Temperature","TPC/*/*")
7// db->MakeCalib("TempSensor.txt","DCSMap.root",startTime,endTime,run)
8
e03a46ac 9// Data base entry generation:
10
11// AliTPCGenDBTemp db
162637e4 12// db->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
e03a46ac 13// db->SetSpecificStorage("local:///afs/cern.ch/alice/tpctest/Calib/");
14// db->Init(0,"TPC/Config/Temperature","TPC/*/*")
15// db->MakeConfig("TempSensor.txt",0,999999999,"TPC/Config/Temperature")
16
17
18
19
20
9312398d 21
22#include "AliTPCGenDBTemp.h"
9f016d99 23#include "AliLog.h"
9312398d 24
25ClassImp(AliTPCGenDBTemp)
26
27const Int_t kValCut = 100; // discard temperatures > 100 degrees
28const Int_t kDiffCut = 5; // discard temperature differences > 5 degrees
29
30//______________________________________________________________________________________________
31
32AliTPCGenDBTemp::AliTPCGenDBTemp():
33 AliDCSGenDB()
34{
35}
36
37//______________________________________________________________________________________________
38
9f016d99 39AliTPCGenDBTemp::AliTPCGenDBTemp(const char *defaultStorage, const char *specificStorage) :
40 AliDCSGenDB(defaultStorage,specificStorage)
41{
42}
43
44//______________________________________________________________________________________________
45
f4a89669 46AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& ) : AliDCSGenDB()
9312398d 47{
48
49//
50// Copy constructor
51//
9f016d99 52 AliError("copy constructor not implemented");
9312398d 53
9312398d 54}
55
56//______________________________________________________________________________________________
57AliTPCGenDBTemp::~AliTPCGenDBTemp(){
58//
59// destructor
60//
61
62}
63//______________________________________________________________________________________________
e03a46ac 64AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp& )
9312398d 65{
66 //
67 // assignment operator
68 //
9f016d99 69 AliError("assignment operator not implemented");
9312398d 70 return *this;
71}
72
73
74//______________________________________________________________________________________________
75
76void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
77 const TTimeStamp& startTime,
78 const TTimeStamp& endTime,
5a163c08 79 Int_t run, const TString& amandaString )
9312398d 80{
81 // The Terminate() function is the last function to be called during
82 // a query. It always runs on the client, it can be used to present
83 // the results graphically or save the results to file.
84
5a163c08 85 AliTPCSensorTempArray *temperature=0;
86 if ( amandaString.Length()== 0 ) {
87 temperature = new AliTPCSensorTempArray(fList);
88 } else {
89 temperature = new AliTPCSensorTempArray(fList,amandaString);
90 }
9312398d 91 temperature->SetStartTime(startTime);
92 temperature->SetEndTime(endTime);
93 temperature->SetValCut(kValCut);
94 temperature->SetDiffCut(kDiffCut);
95 TMap* map = SetGraphFile(fMap);
96 if (map) {
97 temperature->MakeSplineFit(map);
98 }
99 delete map;
100 map=0;
101 fMap=0;
102
103 SetFirstRun(run);
104 SetLastRun(run);
105 SetSensorArray(temperature);
106 StoreObject("TPC/Calib/Temperature",temperature, fMetaData);
107}
108
109//______________________________________________________________________________________________
110
e03a46ac 111TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname, const char *title,
112 const TString& amandaString) {
9312398d 113 //
114 // read values from ascii file
115 //
e03a46ac 116 TTree* tree = new TTree(title,title);
9312398d 117 tree->ReadFile(fname,"");
e03a46ac 118 TClonesArray *arr;
119 if ( amandaString.Length()== 0 ) {
120 arr = AliTPCSensorTemp::ReadTree(tree);
121 } else {
122 arr = AliTPCSensorTemp::ReadTree(tree,amandaString);
123 }
9312398d 124 delete tree;
125 return arr;
126}
127
128//______________________________________________________________________________________________
129
453bd596 130TTree * AliTPCGenDBTemp::ReadListTree(const char *fname, const char *title) {
9312398d 131 //
132 // read values from ascii file
133 //
e03a46ac 134 TTree* tree = new TTree(title,title);
9312398d 135 tree->ReadFile(fname,"");
9312398d 136 return tree;
137}
453bd596 138
e03a46ac 139//______________________________________________________________________________________________
140void AliTPCGenDBTemp::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun,
453bd596 141 const char *confDir)
e03a46ac 142{
143 //
144 // Store Configuration file to OCDB
145 //
146
453bd596 147 TTree *tree = ReadListTree(file,"tempConf");
e03a46ac 148 SetConfTree(tree);
149 SetFirstRun(firstRun);
150 SetLastRun(lastRun);
151
152 StoreObject(confDir, fConfTree, fMetaData);
153}
154
155