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