]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCGenDBTemp.cxx
Tree chaching implemented and update of merging of trees
[u/mrichter/AliRoot.git] / TPC / AliTPCGenDBTemp.cxx
1
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
9 //  Data base entry generation:
10   
11 //  AliTPCGenDBTemp db
12 //  db->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
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
21
22 #include "AliTPCGenDBTemp.h"
23 #include "AliLog.h"
24
25 ClassImp(AliTPCGenDBTemp)
26
27 const Int_t kValCut = 100;         // discard temperatures > 100 degrees
28 const Int_t kDiffCut = 5;          // discard temperature differences > 5 degrees
29
30 //______________________________________________________________________________________________
31
32 AliTPCGenDBTemp::AliTPCGenDBTemp():
33    AliDCSGenDB()
34 {
35 }
36
37 //______________________________________________________________________________________________
38
39 AliTPCGenDBTemp::AliTPCGenDBTemp(const char *defaultStorage, const char *specificStorage) :
40    AliDCSGenDB(defaultStorage,specificStorage)
41 {
42 }
43
44 //______________________________________________________________________________________________
45
46 AliTPCGenDBTemp::AliTPCGenDBTemp(const AliTPCGenDBTemp& ) : AliDCSGenDB()
47 {
48
49 //
50 //  Copy constructor
51 //
52  AliError("copy constructor not implemented");
53
54 }
55
56 //______________________________________________________________________________________________
57 AliTPCGenDBTemp::~AliTPCGenDBTemp(){
58 //
59 // destructor
60 //
61
62 }
63 //______________________________________________________________________________________________
64 AliTPCGenDBTemp& AliTPCGenDBTemp::operator= (const AliTPCGenDBTemp&  )
65 {
66  //
67  // assignment operator
68  //
69  AliError("assignment operator not implemented");
70  return *this;
71 }
72
73
74 //______________________________________________________________________________________________
75
76 void AliTPCGenDBTemp::MakeCalib(const char *fList, const char *fMap,
77                              const TTimeStamp& startTime,
78                              const TTimeStamp& endTime,
79                              Int_t run, const TString& amandaString )
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
85    AliTPCSensorTempArray *temperature=0;
86    if ( amandaString.Length()== 0 ) {
87     temperature = new AliTPCSensorTempArray(fList);
88    } else {
89     temperature = new AliTPCSensorTempArray(fList,amandaString);
90    }
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
111 TClonesArray * AliTPCGenDBTemp::ReadList(const char *fname, const char *title,
112                        const TString& amandaString) {
113   //
114   // read values from ascii file
115   //
116   TTree* tree = new TTree(title,title);
117   tree->ReadFile(fname,"");
118   TClonesArray *arr;
119   if ( amandaString.Length()== 0 ) {
120     arr = AliTPCSensorTemp::ReadTree(tree);
121   } else {
122     arr = AliTPCSensorTemp::ReadTree(tree,amandaString);
123   }
124   delete tree;
125   return arr;
126 }
127
128 //______________________________________________________________________________________________
129
130 TTree * AliTPCGenDBTemp::ReadListTree(const char *fname, const char *title) {
131   //
132   // read values from ascii file
133   //
134   TTree* tree = new TTree(title,title);
135   tree->ReadFile(fname,"");
136   return tree;
137 }
138
139 //______________________________________________________________________________________________
140 void AliTPCGenDBTemp::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun, 
141                              const char *confDir)
142 {
143    //
144    // Store Configuration file to OCDB
145    //
146
147    TTree *tree = ReadListTree(file,"tempConf");
148    SetConfTree(tree);
149    SetFirstRun(firstRun);
150    SetLastRun(lastRun);
151
152    StoreObject(confDir, fConfTree, fMetaData);
153 }
154
155