1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////////////
19 // Class to generate TPC atmospheric pressure data base entries //
20 // Author: Haavard Helstrup //
22 ///////////////////////////////////////////////////////////////////////////////
27 TTimeStamp startTime(2006,10,18,0,0,0,0,kFALSE)
28 TTimeStamp endTime(2006,10,19,0,0,0,0,kFALSE)
32 db->MakeCalib("PressureSensor.txt","DCSMap.root",startTime,endTime,firstRun,lastRun)
36 #include "AliTPCDBPressure.h"
38 ClassImp(AliTPCDBPressure)
40 //______________________________________________________________________________________________
42 AliTPCDBPressure::AliTPCDBPressure():
51 // standard constructor
55 //______________________________________________________________________________________________
57 AliTPCDBPressure::AliTPCDBPressure(const AliTPCDBPressure& org):
59 fFirstRun(org.fFirstRun),
60 fLastRun(org.fLastRun),
71 ((AliTPCDBPressure &) org).Copy(*this);
74 //______________________________________________________________________________________________
75 AliTPCDBPressure::~AliTPCDBPressure(){
85 //______________________________________________________________________________________________
86 AliTPCDBPressure& AliTPCDBPressure::operator= (const AliTPCDBPressure& org )
89 // assignment operator
91 if (&org == this) return *this;
93 new (this) AliTPCDBPressure(org);
97 //______________________________________________________________________________________________
98 void AliTPCDBPressure::Copy(TObject &c) const
107 //______________________________________________________________________________________________
108 void AliTPCDBPressure::MakeCalib(const char *list, const char *mapDCS,
109 const TTimeStamp& startTime,
110 const TTimeStamp& endTime,
111 Int_t firstRun, Int_t lastRun )
113 // The Terminate() function is the last function to be called during
114 // a query. It always runs on the client, it can be used to present
115 // the results graphically or save the results to file.
117 TClonesArray *arr = ReadList(list);
118 AliDCSSensorArray *fPressure = new AliDCSSensorArray(arr);
119 fPressure->SetStartTime(startTime);
120 fPressure->SetEndTime(endTime);
121 TMap* map = SetGraphFile(mapDCS);
123 fPressure->MakeSplineFit(map);
129 SetFirstRun(firstRun);
132 StoreObject("TPC/Calib/Pressure",fPressure, fMetaData);
135 //______________________________________________________________________________________________
136 void AliTPCDBPressure::MakeConfig(const char *file, Int_t firstRun, Int_t lastRun )
139 // Store Configuration file to OCDB
142 TTree *tree = ReadListTree(file);
144 SetFirstRun(firstRun);
147 StoreObject("TPC/Config/Pressure",fConfTree, fMetaData);
152 //______________________________________________________________________________________________
153 AliCDBMetaData* AliTPCDBPressure::CreateMetaObject(const char* objectClassName)
155 AliCDBMetaData *md1= new AliCDBMetaData();
156 md1->SetObjectClassName(objectClassName);
157 md1->SetResponsible("Haavard Helstrup");
158 md1->SetBeamPeriod(2);
159 md1->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
160 md1->SetComment("Pressure");
165 //______________________________________________________________________________________________
166 void AliTPCDBPressure::StoreObject(const char* cdbPath, TObject* object, AliCDBMetaData* metaData)
169 AliCDBId id1(cdbPath, fFirstRun, fLastRun);
170 if (fStorLoc) fStorLoc->Put(object, id1, metaData);
173 //______________________________________________________________________________________________
174 void AliTPCDBPressure::Init(Int_t run){
182 fCalib = AliTPCcalibDB::Instance();
184 fCalib->SetRun(longRun);
185 fPressure = fCalib->GetPressure();
189 //______________________________________________________________________________________________
190 void AliTPCDBPressure::InitDB(Int_t run)
192 // Data base generation
194 char *CDBpath="local:///afs/cern.ch/alice/tpctest/Calib/";
196 fMetaData = CreateMetaObject("AliDCSSensorArray");
197 AliCDBManager *man = AliCDBManager::Instance();
198 man->SetDefaultStorage("local:///afs/cern.ch/alice/tpctest/AliRoot/HEAD");
200 man->SetSpecificStorage("TPC/*/*","local:///afs/cern.ch/alice/tpctest/Calib");
201 AliCDBEntry *config = man->Get("TPC/Config/Pressure");
202 if (config) fConfTree = (TTree*)config->GetObject();
203 fStorLoc = man->GetStorage(CDBpath);
204 if (!fStorLoc) return;
208 //_____________________________________________________________________________
209 TMap* AliTPCDBPressure::SetGraphFile(const char *fname)
212 // Read DCS maps from file given by fname
215 TMap * map = (TMap*)file.Get("DCSMap");
219 //______________________________________________________________________________________________
221 TClonesArray * AliTPCDBPressure::ReadList(const char *fname) {
223 // read values from ascii file
225 TTree* tree = new TTree("pressureConf","pressureConf");
226 tree->ReadFile(fname,"");
227 TClonesArray *arr = AliDCSSensor::ReadTree(tree);
231 //______________________________________________________________________________________________
233 TTree * AliTPCDBPressure::ReadListTree(const char *fname) {
235 // read values from ascii file
237 TTree* tree = new TTree("pressureConf","pressureConf");
238 tree->ReadFile(fname,"");
239 TClonesArray *arr = AliDCSSensor::ReadTree(tree);