AliRoot Core  3dc7879 (3dc7879)
AliTPCGenDBTemp.cxx
Go to the documentation of this file.
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 
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 
47 {
48 
49 //
50 // Copy constructor
51 //
52  AliError("copy constructor not implemented");
53 
54 }
55 
56 //______________________________________________________________________________________________
58 //
59 // destructor
60 //
61 
62 }
63 //______________________________________________________________________________________________
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 
void SetStartTime(const TTimeStamp &start)
void SetEndTime(const TTimeStamp &end)
void MakeSplineFit(TMap *map, Bool_t keepMap=kFALSE)
void MakeConfig(const char *file, Int_t firstRun, Int_t lastRun, const char *confDir)
TMap * SetGraphFile(const char *fname)
const Int_t kValCut
void SetConfTree(TTree *tree)
Definition: AliDCSGenDB.h:59
AliCDBMetaData * fMetaData
Definition: AliDCSGenDB.h:79
TTree * fConfTree
Definition: AliDCSGenDB.h:80
TTree * tree
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
void SetSensorArray(AliDCSSensorArray *arr)
Definition: AliDCSGenDB.h:66
const Int_t kDiffCut
void SetValCut(const Int_t valCut)
void SetLastRun(Int_t lrun)
Definition: AliDCSGenDB.h:57
void MakeCalib(const char *file, const char *fMap, const TTimeStamp &startTime, const TTimeStamp &endTime, Int_t run, const TString &amandaString="")
void SetDiffCut(const Int_t diffCut)
void SetFirstRun(Int_t frun)
Definition: AliDCSGenDB.h:56
TPC calibration class for parameters which saved per pad.
AliTPCGenDBTemp & operator=(const AliTPCGenDBTemp &)
static TTree * ReadListTree(const char *fname, const char *title="tempConf")
static TClonesArray * ReadTree(TTree *tree, const TString &amandaString=kAmandaStringTPC)
#define AliError(message)
Definition: AliLog.h:591
static TClonesArray * ReadList(const char *fname, const char *title="tempConf", const TString &amandaString="")
char * fname
void StoreObject(const char *cdbPath, TObject *object, AliCDBMetaData *metaData)