New classes for shuttle (Laurent)
[u/mrichter/AliRoot.git] / MUON / TestMUONPreprocessor.C
CommitLineData
ea199e33 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/* $Id$ */
17
18#if !defined(__CINT__) || defined(__MAKECINT__)
19
20// This macro runs the test preprocessor
21// It uses AliTestShuttle to simulate a full Shuttle process
22
23// The input data is created in the functions
24// CreateDCSAliasMap() creates input that would in the same way come from DCS
25// ReadDCSAliasMap() reads from a file
26// CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle
27//
28// According to SHUTTLE/TestShuttle/TestPreprocessor.C
29// By Laurent Aphecetche, SUBATECH Nantes
30
31#include "AliCDBManager.h"
32#include "AliShuttleInterface.h"
33#include "AliCDBId.h"
34#include "AliTestShuttle.h"
35#include "TMap.h"
36#include "Riostream.h"
37#include "TSystem.h"
38#include "AliMpExMap.h"
39#include "TMap.h"
40#include "TString.h"
41#include "TObjArray.h"
42#include "AliMpHelper.h"
43#include "AliDCSValue.h"
44#include "TObjString.h"
45#include "TRandom.h"
46#include "AliMUONPreprocessor.h"
47#include "AliCDBEntry.h"
48#endif
49
50void TestMUONPreprocessor()
51{
52 // load library
53 gSystem->Load("../SHUTTLE/TestShuttle/libTestShuttle.so");
54
55 // initialize location of CDB
56 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
57
58 // create AliTestShuttle instance
59 // The parameters are run, startTime, endTime
60 AliTestShuttle* shuttle = new AliTestShuttle(800, 0, 1);
61
62 // TODO(1)
63 //
64 // The shuttle can read DCS data, if the preprocessor should be tested to process DCS data,
65 // some fake data has to be created.
66 //
67 // The "fake" input data can be taken using either (a) or (b):
68 // (a) data from a file: Use ReadDCSAliasMap()
69 // the format of the file is explained in ReadDCSAliasMap()
70 // To use it uncomment the following line:
71 //
72// TMap* dcsAliasMap = ReadDCSAliasMap();
73 //
74 // (b) generated in this macro: Use CreateDCSAliasMap() and its documentation
75 // To use it uncomment the following line:
76 //
77// TMap* dcsAliasMap = CreateDCSAliasMap();
78
79 // now give the alias map to the shuttle
80 // shuttle->SetDCSInput(dcsAliasMap);
81
82 // TODO(2)
83 //
84 // The shuttle can also process files that originate from DCS, DAQ and HLT.
85 // To test it, we provide some local files and locations where these would be found when
86 // the online machinery would be there.
87 // In real life this functions would be produces by the sub-detectors
88 // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle.
89 //
90 // Files are added with the function AliTestShuttle::AddInputFile. The syntax is:
91 // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>)
92 // In this example we add a file originating from the GDC with the id PEDESTALS
93 // Three files originating from different LDCs but with the same id are also added
94// shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "PEDESTALS", "GDC", "file1.root");
95// shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC0", "file2a.root");
96// shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC1", "file2b.root");
97// shuttle->AddInputFile(AliTestShuttle::kDAQ, "DET", "DRIFTVELOCITY", "LDC2", "file2b.root");
98
99 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC0","$ALICE_ROOT/MUON/data/LDC0.ped");
100 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC1","$ALICE_ROOT/MUON/data/LDC1.ped");
101 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC2","$ALICE_ROOT/MUON/data/LDC2.ped");
102 shuttle->AddInputFile(AliTestShuttle::kDAQ,"MUON","PEDESTALS","LDC3","$ALICE_ROOT/MUON/data/LDC3.ped");
103
104 // TODO(3)
105 // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
106// AliPreprocessor* pp = new AliTestPreprocessor("DET", shuttle);
107 new AliMUONPreprocessor("MUON",shuttle);
108
109 shuttle->Print();
110
111 // Test the preprocessor
112 shuttle->Process();
113
114 // TODO(4)
115 // In the preprocessor AliShuttleInterface::Store should be called to put the final
116 // data to the CDB. To check if all went fine have a look at the files produced in
117 // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
118 //
119 // Check the file which should have been created
120// AliCDBEntry* entry = AliCDBManager::Instance()->Get("DET/SHUTTLE/Data", 7);
121// if (!entry)
122// {
123// printf("The file is not there. Something went wrong.\n");
124// return;
125// }
126//
127// AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (entry->GetObject());
128// // If everything went fine, draw the result
129// if (output)
130// output->Draw();
131}