3dedb44a |
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 | // Class AliGRPPreprocessor |
18 | // Global Run Parameters (GRP) preprocessor |
19 | // Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch |
20 | //------------------------------------------------------------------------- |
21 | |
22 | #include "AliGRPPreprocessor.h" |
23 | #include "AliGRPDCS.h" |
24 | |
25 | #include "AliCDBMetaData.h" |
26 | #include "AliLog.h" |
27 | |
28 | #include <TTimeStamp.h> |
29 | #include <TMap.h> |
30 | #include <TObjString.h> |
31 | |
32 | class AliDCSValue; |
33 | class AliShuttleInterface; |
34 | |
35 | #include <TH1.h> |
36 | |
37 | ClassImp(AliGRPPreprocessor) |
38 | |
39 | //_______________________________________________________________ |
40 | AliGRPPreprocessor::AliGRPPreprocessor(): |
41 | AliPreprocessor("GRP",0) { |
42 | // default constructor - Don't use this! |
43 | |
44 | } |
45 | |
46 | //_______________________________________________________________ |
47 | AliGRPPreprocessor::AliGRPPreprocessor(AliShuttleInterface* shuttle): |
48 | AliPreprocessor("GRP",shuttle) { |
49 | // constructor - shuttle must be instantiated! |
50 | |
51 | } |
52 | |
53 | //_______________________________________________________________ |
54 | AliGRPPreprocessor::~AliGRPPreprocessor() { |
55 | //destructor |
56 | } |
57 | |
58 | //_______________________________________________________________ |
59 | void AliGRPPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime) { |
60 | // Initialize preprocessor |
61 | |
62 | AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, TTimeStamp(startTime).AsString(), TTimeStamp(endTime).AsString())); |
63 | |
64 | fRun = run; |
65 | fStartTime = startTime; |
66 | fEndTime = endTime; |
67 | AliInfo("This preprocessor is to test the GetRunParameter function."); |
68 | } |
69 | |
70 | //_______________________________________________________________ |
71 | UInt_t AliGRPPreprocessor::Process(TMap* valueMap) { |
72 | // process data retrieved by the Shuttle |
73 | const char* timeStart = GetRunParameter("time_start"); |
74 | const char* timeEnd = GetRunParameter("time_end"); |
75 | TObjArray *alias1 = (TObjArray *)valueMap->GetValue("SFTTemp1.FloatValue"); |
76 | AliGRPDCS *dcs = new AliGRPDCS(alias1); |
77 | TH1F *h1 = new TH1F("alias1","",100,15,25); |
78 | TString sAlias1Mean = dcs->ProcessDCS(h1); |
79 | |
80 | Int_t result=0; |
81 | |
82 | if (sAlias1Mean) { |
83 | Log(Form("<alias1> for run %d: %s",fRun, sAlias1Mean.Data())); |
84 | } else { |
85 | Log(Form("DCSAlias1 not put in TMap!")); |
86 | } |
87 | if (timeStart) { |
88 | Log(Form("Start time for run %d: %s",fRun, timeStart)); |
89 | } else { |
90 | Log(Form("Start time not put in logbook!")); |
91 | } |
92 | if (timeEnd) { |
93 | Log(Form("End time for run %d: %s",fRun, timeEnd)); |
94 | } else { |
95 | Log(Form("End time not put in logbook!")); |
96 | } |
97 | |
98 | TList *values = new TList(); |
99 | values->SetOwner(1); |
100 | |
101 | TMap *map1 = new TMap(); |
102 | map1->Add(new TObjString("histoDCS1"),h1); |
103 | values->Add(map1); |
104 | |
105 | TMap *map2 = new TMap(); |
106 | map2->Add(new TObjString("DCS1"),new TObjString(sAlias1Mean)); |
107 | values->Add(map2); |
108 | |
109 | TMap *map3 = new TMap(); |
110 | map3->Add(new TObjString("fAliceStartTime"),new TObjString(timeStart)); |
111 | values->Add(map3); |
112 | |
113 | TMap *map4 = new TMap(); |
114 | map4->Add(new TObjString("fAliceStopTime"),new TObjString(timeEnd)); |
115 | values->Add(map4); |
116 | |
117 | AliCDBMetaData md; |
118 | md.SetResponsible("Panos"); |
119 | |
120 | result = Store("GRP", "Values", values, &md); |
121 | |
122 | delete values; |
123 | |
124 | return result; |
125 | } |
126 | |