1. Re-organization of function calls in TestPreprocessor to make it more meaningful.
[u/mrichter/AliRoot.git] / SHUTTLE / test / TestTRDPreprocessor.cxx
CommitLineData
59ab3716 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// Prototype of TRD Preprocessor
18//
19
20#include "TestTRDPreprocessor.h"
21
22#include "AliCDBMetaData.h"
23#include "AliDCSValue.h"
24#include "AliLog.h"
25#include "AliShuttleInterface.h"
26
27#include <TTimeStamp.h>
28#include <TObjString.h>
29#include <TSystem.h>
886d60e6 30#include <TList.h>
59ab3716 31
32ClassImp(TestTRDPreprocessor)
33
34//________________________________________________________________________________________
35TestTRDPreprocessor::TestTRDPreprocessor():
36 AliPreprocessor("TRD",0)
37{
38// default constructor - Don't use this!
39
40}
41
42//________________________________________________________________________________________
43TestTRDPreprocessor::TestTRDPreprocessor(AliShuttleInterface* shuttle):
44 AliPreprocessor("TRD", shuttle)
45{
46// constructor - shuttle must be instantiated!
47
48}
49
50//________________________________________________________________________________________
51void TestTRDPreprocessor::Initialize(Int_t run, UInt_t startTime,
52 UInt_t endTime)
53{
54// Initialize preprocessor
55
56 AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
57 TTimeStamp(startTime).AsString(),
58 TTimeStamp(endTime).AsString()));
59
60 fRun = run;
61 fStartTime = startTime;
62 fEndTime = endTime;
63}
64
65//________________________________________________________________________________________
66UInt_t TestTRDPreprocessor::Process(TMap* /*valueMap*/)
67{
68// process data retrieved by the Shuttle
69
70 //TIter iter(valueMap);
71 //TPair* aPair;
72 //while ((aPair = (TPair*) iter.Next())) {
73 //aPair->Print();
74 //}
75 //AliCDBMetaData metaData;
76 //metaData.SetComment("This is a test!");
77
78 // return Store(valueMap, &metaData);
79
80 TList* filesources = GetFileSources(AliShuttleInterface::kHLT, "Calib_String");
81
82 if(!filesources) {
83 AliError(Form("No sources found for Calib_String for run %d !", fRun));
84 return 0;
85 }
86
87 AliInfo("Here's the list of sources for Calib_String");
88 filesources->Print();
89
90 TIter iter(filesources);
91 TObjString* source;
92 int i=0;
93 UInt_t result = 0;
94 while((source=dynamic_cast<TObjString*> (iter.Next()))){
95 printf("\n\n Getting file #%d\n",++i);
96 //if(i==1) continue;
97 TString filename = GetFile(AliShuttleInterface::kHLT, "Calib_String", source->GetName());
98 if(!filename.Length()) {
99 AliError(Form("Error: retrieval of file from source %s failed!", source->GetName()));
100 delete filesources;
101 return 0;
102 }
103 TString command = Form("more %s",filename.Data());
104 gSystem->Exec(command.Data());
105
106 // STORAGE! The First file name will be stored into CDB, the second into reference storage
107 TObjString filenameObj(filename);
108 AliCDBMetaData metaData;
109 result = Store("Calib", "Data", &filenameObj, &metaData);
110// if(i==1) result = Store("Calib", "Data", &filenameObj, &metaData);
111// if(i==2) result = StoreReferenceData("Calib", "RefData", &filenameObj, &metaData);
112
113 }
114 delete filesources;
115
116 return result;
117}
118