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