1 /**************************************************************************
2 * Copyright(c) 2007, 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 #include "AliTPCPreprocessor.h"
19 #include "AliCDBMetaData.h"
20 #include "AliDCSValue.h"
22 #include "AliTPCSensorTempArray.h"
23 #include "AliTPCDBPressure.h"
25 #include <TTimeStamp.h>
27 const Int_t kValCutTemp = 100; // discard temperatures > 100 degrees
28 const Int_t kDiffCutTemp = 5; // discard temperature differences > 5 degrees
31 // This class is the SHUTTLE preprocessor for the TPC detector.
32 // It contains several components, this far the part containing
33 // temperatures is implemented
36 ClassImp(AliTPCPreprocessor)
38 //______________________________________________________________________________________________
39 AliTPCPreprocessor::AliTPCPreprocessor(AliShuttleInterface* shuttle) :
40 AliPreprocessor("TPC",shuttle),
41 fTemp(0), fPressure(0), fConfigOK(kTRUE)
45 //______________________________________________________________________________________________
46 // AliTPCPreprocessor::AliTPCPreprocessor(const AliTPCPreprocessor& org) :
47 // AliPreprocessor(org),
48 // fTemp(0), fPressure(0), fConfigOK(kTRUE)
50 // // copy constructor not implemented
51 // // -- missing underlying copy constructor in AliPreprocessor
53 // Fatal("AliTPCPreprocessor", "copy constructor not implemented");
55 // // fTemp = new AliTPCSensorTempArray(*(org.fTemp));
58 //______________________________________________________________________________________________
59 AliTPCPreprocessor::~AliTPCPreprocessor()
66 //______________________________________________________________________________________________
67 AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& )
69 Fatal("operator =", "assignment operator not implemented");
74 //______________________________________________________________________________________________
75 void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
78 // Creates AliTestDataDCS object
80 AliPreprocessor::Initialize(run, startTime, endTime);
82 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
83 TTimeStamp(startTime).AsString(),
84 TTimeStamp(endTime).AsString()));
86 // Temperature sensors
88 AliCDBEntry* entry = GetFromOCDB("Config", "Temperature");
89 TTree *confTree = (TTree*) entry->GetObject();
91 AliError(Form("Temperature Config OCDB entry missing.\n"));
92 Log("AliTPCPreprocsessor: Temperature Config OCDB entry missing.\n");
95 fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, confTree);
96 fTemp->SetValCut(kValCutTemp);
97 fTemp->SetDiffCut(kDiffCutTemp);
98 confTree->Delete(); delete confTree; confTree=0;
99 entry->Delete(); delete entry; entry=0;
103 entry = GetFromOCDB("Config", "Pressure");
104 confTree = (TTree*) entry->GetObject();
106 AliError(Form("Pressure Config OCDB entry missing.\n"));
107 Log("AliTPCPreprocsessor: Pressure Config OCDB entry missing.\n");
110 fPressure = new AliDCSSensorArray(fStartTime, fEndTime, confTree);
111 confTree->Delete(); delete confTree; confTree=0;
112 entry->Delete(); delete entry; entry=0;
116 //______________________________________________________________________________________________
117 UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
119 // Fills data into TPC calibrations objects
121 if (!dcsAliasMap) return 9;
122 if (!fConfigOK) return 9;
124 // Amanda servers provide information directly through dcsAliasMap
126 // Temperature sensors are processed by AliTPCCalTemp
129 UInt_t tempResult = MapTemperature(dcsAliasMap);
130 UInt_t result=tempResult;
134 UInt_t pressureResult = MapPressure(dcsAliasMap);
135 result += pressureResult;
137 // Other calibration information will be retrieved through FXS files
139 // TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
140 // const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
142 // TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
143 // const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
148 //______________________________________________________________________________________________
149 UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
152 // extract DCS temperature maps. Perform fits to save space
155 TMap *map = fTemp->ExtractDCS(dcsAliasMap);
157 fTemp->MakeSplineFit(map);
158 AliInfo(Form("Temperature values extracted, fits performed.\n"));
160 AliError(Form("No temperature map extracted.\n"));
161 Log("AliTPCPreprocsessor: no temperature map extracted. \n");
165 // Now store the final CDB file
168 AliCDBMetaData metaData;
169 metaData.SetBeamPeriod(0);
170 metaData.SetResponsible("Haavard Helstrup");
171 metaData.SetComment("Preprocessor AliTPC data base entries.");
173 result = Store("Calib", "Temperature", fTemp, &metaData, 0, 0);
178 } // revert to new return code conventions
183 //______________________________________________________________________________________________
184 UInt_t AliTPCPreprocessor::MapPressure(TMap* dcsAliasMap)
187 // extract DCS temperature maps. Perform fits to save space
190 TMap *map = fPressure->ExtractDCS(dcsAliasMap);
192 fPressure->MakeSplineFit(map);
193 AliInfo(Form("Pressure values extracted, fits performed.\n"));
195 AliError(Form("No atmospheric pressure map extracted.\n"));
196 Log("AliTPCPreprocsessor: no atmospheric pressure map extracted. \n");
200 // Now store the final CDB file
203 AliCDBMetaData metaData;
204 metaData.SetBeamPeriod(0);
205 metaData.SetResponsible("Haavard Helstrup");
206 metaData.SetComment("Preprocessor AliTPC data base entries.");
208 result = Store("Calib", "Pressure", fPressure, &metaData, 0, 0);
213 } // revert to new return code conventions