]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCPreprocessor.cxx
Add temperature entry (Marian)
[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
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
26 const char kFname[]="$ALICE_ROOT/TPC/Cal";
27 const char kAmandaStringTemp[] = "tpc_PT_%d.Temperature";
28
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
35 ClassImp(AliTPCPreprocessor)
36
37 //______________________________________________________________________________________________
38 AliTPCPreprocessor::AliTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle) :
39   AliPreprocessor(detector, shuttle),
40   fTemp(0)
41 {
42   // constructor
43 }
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 // }
56
57 //______________________________________________________________________________________________
58 AliTPCPreprocessor::~AliTPCPreprocessor()
59 {
60   // destructor
61   
62   delete fTemp;
63 }
64 //______________________________________________________________________________________________
65 AliTPCPreprocessor& AliTPCPreprocessor::operator = (const AliTPCPreprocessor& )
66 {
67   Fatal("operator =", "assignment operator not implemented");
68   return *this;
69 }
70
71
72 //______________________________________________________________________________________________
73 void 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
84         fTemp = new AliTPCSensorTempArray(fStartTime, fEndTime, kFname);
85         fTemp->SetAmandaString(kAmandaStringTemp);
86 }
87
88 //______________________________________________________________________________________________
89 UInt_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
98
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 //______________________________________________________________________________________________
114 UInt_t AliTPCPreprocessor::MapTemperature(TMap* dcsAliasMap)
115 {
116
117    // extract DCS temperature maps. Perform fits to save space
118
119   UInt_t result=0;
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");
127     result=9;
128   }
129   delete map;
130   // Now store the final CDB file
131   
132   if ( result == 0 ) { 
133         AliCDBMetaData metaData;
134         metaData.SetBeamPeriod(0);
135         metaData.SetResponsible("Haavard Helstrup");
136         metaData.SetComment("Preprocessor AliTPC data base entries.");
137
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    }
145
146    return result;
147 }