]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCPreprocessor.cxx
In case of bad or missing mapping, an error is stored within the raw-reader error...
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessor.cxx
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
16 #include "AliTPCPreprocessor.h"
17
18 #include "AliCDBMetaData.h"
19 #include "AliDCSValue.h"
20 #include "AliLog.h"
21 #include "AliTPCSensorTempArray.h"
22
23 #include <TTimeStamp.h>
24
25 //
26 // This class is the SHUTTLE preprocessor for the TPC detector.
27 // It contains several components, this far the part containing 
28 // temperatures is implemented
29 //
30
31 ClassImp(AliTPCPreprocessor)
32
33 //______________________________________________________________________________________________
34 AliTPCPreprocessor::AliTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
35   AliPreprocessor(detector, shuttle),
36   fTemp(0)
37 {
38   // constructor
39 }
40
41 //______________________________________________________________________________________________
42 AliTPCPreprocessor::~AliTPCPreprocessor()
43 {
44   // destructor
45   
46   delete fTemp;
47 }
48
49 //______________________________________________________________________________________________
50 void AliTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
51         UInt_t endTime)
52 {
53   // Creates AliTestDataDCS object
54
55   AliPreprocessor::Initialize(run, startTime, endTime);
56
57         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
58                 TTimeStamp(startTime).AsString(),
59                 TTimeStamp(endTime).AsString()));
60
61         fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime);
62 }
63
64 //______________________________________________________________________________________________
65 UInt_t AliTPCPreprocessor::Process(TMap* dcsAliasMap)
66 {
67   // Fills data into TPC calibrations objects
68
69   if (!dcsAliasMap) return 0;
70
71   // Amanda servers provide information directly through dcsAliasMap
72
73   // Temperature sensors are processed by AliTPCCalTemp
74   
75   UInt_t tempResult = MapTemperature(dcsAliasMap);
76   UInt_t result=tempResult;
77   
78   // Other calibration information will be retrieved through FXS files
79   //  examples: 
80   //    TList* fileSourcesDAQ = GetFile(AliShuttleInterface::kDAQ, "pedestals");
81   //    const char* fileNamePed = GetFile(AliShuttleInterface::kDAQ, "pedestals", "LDC1");
82   //
83   //    TList* fileSourcesHLT = GetFile(AliShuttleInterface::kHLT, "calib");
84   //    const char* fileNameHLT = GetFile(AliShuttleInterface::kHLT, "calib", "LDC1");
85
86
87   return result;
88 }
89 //______________________________________________________________________________________________
90 UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
91 {
92
93    // extract DCS temperature maps. Perform fits to save space
94
95   TMap *map = fTemp->ExtractDCS(dcsAliasMap);
96   if (map) {
97     fTemp->MakeSplineFit(map);
98     AliInfo(Form("Temperature values extracted, fits performed.\n"));
99   } else {
100     AliError(Form("No temperature map extracted.\n"));
101     Log("AliTPCPreprocsessor: no temperature map extracted. \n");
102   }
103   delete map;
104   // Now store the final CDB file
105   
106   AliCDBMetaData metaData;
107         metaData.SetBeamPeriod(0);
108         metaData.SetResponsible("Haavard Helstrup");
109         metaData.SetComment("Preprocessor AliTPC data base entries.");
110
111         UInt_t result = Store("TPC/Calib/Temperature", "Data", fTemp, &metaData, 0, 0);
112         delete fTemp;
113         fTemp = 0;
114
115    return result;
116 }