Unnecessary include of TNamed removed.
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
CommitLineData
54472e4f 1/**************************************************************************
2 * Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
72df5829 16
54472e4f 17#include "AliTPCPreprocessor.h"
18
19#include "AliCDBMetaData.h"
20#include "AliDCSValue.h"
21#include "AliLog.h"
22#include "AliTPCSensorTempArray.h"
23
24#include <TTimeStamp.h>
25
5c25d2b9 26const char kFname[]="$ALICE_ROOT/TPC/Cal";
72df5829 27const char kAmandaStringTemp[] = "tpc_PT_%d.Temperature";
28
54472e4f 29//
30// This class is the SHUTTLE preprocessor for the TPC detector.
31// It contains several components, this far the part containing
32// temperatures is implemented
33//
34
35ClassImp(AliTPCPreprocessor)
36
37//______________________________________________________________________________________________
38AliTPCPreprocessor::AliTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
39 AliPreprocessor(detector, shuttle),
40 fTemp(0)
41{
42 // constructor
43}
72df5829 44//______________________________________________________________________________________________
45// AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& org) :
46// AliPreprocessor(org),
47// fTemp(0)
48// {
49// // copy constructor not implemented
50// // -- missing underlying copy constructor in AliPreprocessor
51//
52// Fatal("AliTPCPreprocessor", "copy constructor not implemented");
53//
54// // fTemp = new AliTPCSensorTempArray(*(org.fTemp));
55// }
54472e4f 56
57//______________________________________________________________________________________________
58AliTPCPreprocessor::~AliTPCPreprocessor()
59{
60 // destructor
61
62 delete fTemp;
63}
72df5829 64//______________________________________________________________________________________________
65AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& )
66{
67 Fatal("operator =", "assignment operator not implemented");
68 return *this;
69}
70
54472e4f 71
72//______________________________________________________________________________________________
73void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
74 UInt_t endTime)
75{
76 // Creates AliTestDataDCS object
77
78 AliPreprocessor::Initialize(run, startTime, endTime);
79
80 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
81 TTimeStamp(startTime).AsString(),
82 TTimeStamp(endTime).AsString()));
83
72df5829 84 fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, kFname);
85 fTemp->SetAmandaString(kAmandaStringTemp);
54472e4f 86}
87
88//______________________________________________________________________________________________
89UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
90{
91 // Fills data into TPC calibrations objects
92
93 if (!dcsAliasMap) return 0;
94
95 // Amanda servers provide information directly through dcsAliasMap
96
97 // Temperature sensors are processed by AliTPCCalTemp
72df5829 98
54472e4f 99 UInt_t tempResult = MapTemperature(dcsAliasMap);
100 UInt_t result=tempResult;
101
102 // Other calibration information will be retrieved through FXS files
103 // examples:
104 // TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
105 // const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
106 //
107 // TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
108 // const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
109
110
111 return result;
112}
113//______________________________________________________________________________________________
114UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
115{
116
117 // extract DCS temperature maps. Perform fits to save space
118
72df5829 119 UInt_t result=0;
54472e4f 120 TMap *map = fTemp->ExtractDCS(dcsAliasMap);
121 if (map) {
122 fTemp->MakeSplineFit(map);
123 AliInfo(Form("Temperature values extracted, fits performed.\n"));
124 } else {
125 AliError(Form("No temperature map extracted.\n"));
126 Log("AliTPCPreprocsessor: no temperature map extracted. \n");
72df5829 127 result=9;
54472e4f 128 }
129 delete map;
130 // Now store the final CDB file
131
72df5829 132 if ( result == 0 ) {
133 AliCDBMetaData metaData;
54472e4f 134 metaData.SetBeamPeriod(0);
135 metaData.SetResponsible("Haavard Helstrup");
136 metaData.SetComment("Preprocessor AliTPC data base entries.");
137
72df5829 138 result = Store("Calib", "Temperature", fTemp, &metaData, 0, 0);
139 if ( result == 1 ) {
140 result = 0;
141 } else {
142 result = 1;
143 } // revert to new return code conventions
144 }
54472e4f 145
146 return result;
147}