major update (Alberto)
[u/mrichter/AliRoot.git] / SHUTTLE / test / TestTPCPreprocessor.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 // Example of a Shuttle Preprocessor
18 //
19
20 #include "TestTPCPreprocessor.h"
21
22 #include "AliCDBMetaData.h"
23 #include "AliDCSValue.h"
24 #include "AliLog.h"
25
26 #include <TTimeStamp.h>
27 #include <TObjString.h>
28 #include <TH2F.h>
29
30 ClassImp(TestTPCPreprocessor)
31
32 //________________________________________________________________________________________
33 TestTPCPreprocessor::TestTPCPreprocessor():
34         AliPreprocessor("TPC",0)
35 {
36 // default constructor - Don't use this!
37
38         fData = 0;
39 }
40
41 //________________________________________________________________________________________
42 TestTPCPreprocessor::TestTPCPreprocessor(AliShuttleInterface* shuttle):
43         AliPreprocessor("TPC", shuttle)
44 {
45 // constructor - shuttle must be instantiated!
46
47         fData = 0;
48
49 }
50
51 //________________________________________________________________________________________
52 TestTPCPreprocessor::~TestTPCPreprocessor()
53 {
54 // destructor
55
56         delete fData;
57         fData = 0;
58
59 }
60
61 //________________________________________________________________________________________
62 void TestTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
63         UInt_t endTime)
64 {
65 // Initialize preprocessor
66
67         fRun=run;
68         fStartTime = startTime;
69         fEndTime = endTime;
70         AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
71                 TTimeStamp(startTime).AsString(),
72                 TTimeStamp(endTime).AsString()));
73
74         fData = new AliTPCDataDCS(fRun, fStartTime, fEndTime);
75 }
76
77 //________________________________________________________________________________________
78 UInt_t TestTPCPreprocessor::Process(TMap* aliasMap)
79 {
80 // Process data
81
82         fData->ProcessData(*aliasMap);
83         AliCDBMetaData metaData;
84         metaData.SetBeamPeriod(0);
85         metaData.SetResponsible("Alberto Colla");
86         metaData.SetComment("This preprocessor fills an AliTPCDataDCS object.");
87
88         return Store("Calib", "TPCData", fData, &metaData);
89         delete fData;
90         fData = 0;
91 }
92