updated test classes (alberto)
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 14:44:30 +0000 (14:44 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 4 Jul 2006 14:44:30 +0000 (14:44 +0000)
16 files changed:
SHUTTLE/Shuttle.C
SHUTTLE/test/AliTPCDataDCS.cxx [new file with mode: 0644]
SHUTTLE/test/AliTPCDataDCS.h [new file with mode: 0644]
SHUTTLE/test/LinkDef.h
SHUTTLE/test/Makefile
SHUTTLE/test/TestClientAlbe.C [new file with mode: 0644]
SHUTTLE/test/TestClientAlias.C [new file with mode: 0644]
SHUTTLE/test/TestClientDP.C [new file with mode: 0644]
SHUTTLE/test/TestITSPreProcessor.cxx [deleted file]
SHUTTLE/test/TestITSPreProcessor.h [deleted file]
SHUTTLE/test/TestITSPreprocessor.cxx [new file with mode: 0644]
SHUTTLE/test/TestITSPreprocessor.h [new file with mode: 0644]
SHUTTLE/test/TestShuttle.C
SHUTTLE/test/TestShuttleConfig.C
SHUTTLE/test/TestTPCPreprocessor.cxx [new file with mode: 0644]
SHUTTLE/test/TestTPCPreprocessor.h [new file with mode: 0644]

index 9341df2..b14e859 100644 (file)
@@ -3,21 +3,25 @@ void Shuttle(const char* param = "listen") {
        gSystem->Load("libSHUTTLE");
         gSystem->Load("$ROOTSYS/lib/libRLDAP");
        gSystem->Load("$ROOTSYS/lib/libThread");
+       gSystem->Load("test/libTest.so");
 
 //     AliLog::SetGlobalDebugLevel(1);
 
-        AliShuttleConfig config("pcepalice60.cern.ch", 389,
-                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
-        config.Print();
+       AliCDBManager *man = AliCDBManager::Instance();
+       man->SetDefaultStorage("local://MainCDB");
 
-       AliCDBStorage* cdbStorage = AliCDBManager::Instance()->
-                       GetStorage("local://~/temp/DCS");
+       AliShuttleConfig config("pcalice290.cern.ch", 389,
+                       "o=alice,dc=cern,dc=ch");
+       config.SetProcessAll(kTRUE);
+        config.Print();
 
-       AliShuttleTrigger trigger(&config, cdbStorage);
+       AliShuttleTrigger trigger(&config);
 
        AliShuttle* shuttle = trigger.GetShuttle();
+
        // Add here detectors preprocessor ...
-       //shuttle->RegisterCDBPreProcessor(new TestITSPreProcessor());
+       TestTPCPreprocessor *tpcPrep = new TestTPCPreprocessor("TPC",shuttle);
+       TestITSPreprocessor *itsPrep = new TestITSPreprocessor("ITS",shuttle);
 
        TString paramStr(param);
        
diff --git a/SHUTTLE/test/AliTPCDataDCS.cxx b/SHUTTLE/test/AliTPCDataDCS.cxx
new file mode 100644 (file)
index 0000000..89d12d2
--- /dev/null
@@ -0,0 +1,231 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+//
+// This is an example of a container class
+// of the data retreieved from the DCS archive DB.
+// It is called by the detector's Preprocessor and
+// it is stored in the CDB.
+//
+
+#include "AliTPCDataDCS.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TH2F.h>
+#include <TProfile.h>
+#include <TGraph.h>
+#include <TDatime.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+
+ClassImp(AliTPCDataDCS)
+
+//---------------------------------------------------------------
+AliTPCDataDCS::AliTPCDataDCS():
+       TObject(),
+       fRun(0),
+       fStartTime(0),
+       fEndTime(0),
+       fGraphs("TGraph",kNGraphs),
+       fIsProcessed(kFALSE)
+{
+// default constructor
+
+       for(int i=0;i<kNHistos;i++) fHv[i]=0x0;
+        fFunc = 0;
+}
+
+//---------------------------------------------------------------
+AliTPCDataDCS::AliTPCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
+       TObject(),
+       fRun(nRun),
+       fStartTime(startTime),
+       fEndTime(endTime),
+       fGraphs("TGraph",kNGraphs),
+       fIsProcessed(kFALSE)
+{
+// constructor
+
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
+       TTimeStamp(startTime).AsString(),
+       TTimeStamp(endTime).AsString()));
+
+        fFunc = 0;
+       Init();
+
+}
+
+//---------------------------------------------------------------
+AliTPCDataDCS::~AliTPCDataDCS()
+{
+// destructor
+
+       for(int i=0;i<kNHistos;i++) {delete fHv[i]; fHv[i]=0;}
+       fGraphs.Clear("C");
+       fFunc=0;
+}
+
+//---------------------------------------------------------------
+void AliTPCDataDCS::ProcessData(TMap& aliasMap)
+{
+// process TMap of alias values retrieved from the DCS archive DB
+
+       if(!(fHv[0])) Init();
+
+       TObjArray *aliasArr;
+       AliDCSValue* aValue;
+       for(int j=0; j<kNAliases; j++){
+               aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
+               if(!aliasArr){
+                       AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
+                       continue;
+               }
+               Introduce(j, aliasArr);
+
+               if(aliasArr->GetEntries()<2){
+                       AliError(Form("Alias %s has just %d entries!",
+                                       fAliasNames[j].Data(),aliasArr->GetEntries()));
+                       continue;
+               }
+
+               TIter iterarray(aliasArr);
+
+               Double_t *time = new Double_t[aliasArr->GetEntries()];
+               Double_t *val = new Double_t[aliasArr->GetEntries()];
+
+               UInt_t ne=0;
+               while ((aValue = (AliDCSValue*) iterarray.Next())) {
+               val[ne] = aValue->GetSimpleValue().GetFloat();
+               time[ne] = (Double_t) (aValue->GetTimeStamp());
+               // fill histos (alias 0-2)
+               if(j < 3) fHv[j]->Fill(val[ne]);
+               ne++;
+               }
+               // fill graphs (alias 3-5)
+               if(j >= 3) CreateGraph(j, aliasArr->GetEntries(), time, val);
+               delete[] val;
+               delete[] time;
+       }
+
+       // calculate mean and rms of the first two histos
+       for(int i=0;i<kNHistos;i++){
+               fMean[i] = fHv[i]->GetMean();
+               fWidth[i] = fHv[i]->GetRMS();
+       }
+
+       // pol1 fit of the first graph
+       if(fGraphs.GetEntries() > 0){
+               ((TGraph*) fGraphs.UncheckedAt(0))->Fit("pol1");
+               fFunc = ((TGraph*) fGraphs.UncheckedAt(0))->GetFunction("pol1");
+       }
+
+       fIsProcessed=kTRUE;
+
+
+}
+
+//---------------------------------------------------------------
+void AliTPCDataDCS::Init()
+{
+// Init alias names and histos
+
+       TH1::AddDirectory(kFALSE);
+
+       fGraphs.SetOwner(1);
+
+       for(int i=0;i<kNAliases;i++){
+               fAliasNames[i] = "TpcHvSect0";
+               fAliasNames[i] += i;
+               fAliasNames[i] += ".FloatValue";
+       }
+
+       for(int i=0;i<kNHistos;i++){
+               fHv[i] = new TH1F(fAliasNames[i].Data(),fAliasNames[i].Data(), 20, kHvMin, kHvMax);
+               fHv[i]->GetXaxis()->SetTitle("Hv");
+       }
+}
+
+//---------------------------------------------------------------
+void AliTPCDataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr)
+{
+// Say something about alias value array being processed
+
+       int entries=aliasArr->GetEntries();
+       AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
+       AliInfo(Form("          %d DP values collected",entries));
+
+}
+
+//---------------------------------------------------------------
+void AliTPCDataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y)
+{
+// create TGraph to be filled with DP values
+
+       TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y);
+
+       gr->GetXaxis()->SetTimeDisplay(1);
+       gr->SetTitle(fAliasNames[i].Data());
+
+       AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast()));
+
+
+}
+
+//---------------------------------------------------------------
+void AliTPCDataDCS::Draw(const Option_t* /*option*/)
+{
+// Draw all histos and graphs
+
+  if(!fIsProcessed) return;
+
+  TCanvas *ch;
+  TString canvasHistoName="Histos";
+  ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);
+  ch->Divide(2,2);
+  ch->cd(1);
+  fHv[0]->Draw();
+  ch->cd(2);
+  fHv[1]->Draw();
+  ch->cd(3);
+  fHv[2]->Draw();
+
+
+  if(fGraphs.GetEntries() == 0) return;
+
+  TCanvas *cg;
+  TString canvasGraphName="Graphs";
+  cg=new TCanvas(canvasGraphName,canvasGraphName,40,40,600,600);
+  cg->Divide(2,2);
+  cg->cd(1);
+  ((TGraph*) fGraphs.UncheckedAt(0))->Draw("alp");
+
+  cg->cd(2);
+  ((TGraph*) fGraphs.UncheckedAt(1))->Draw("alp");
+  cg->cd(3);
+  ((TGraph*) fGraphs.UncheckedAt(2))->Draw("alp");
+
+  if(fFunc){
+       cg->cd(4);
+       fFunc->Draw("l");
+  }
+
+}
+
diff --git a/SHUTTLE/test/AliTPCDataDCS.h b/SHUTTLE/test/AliTPCDataDCS.h
new file mode 100644 (file)
index 0000000..51f2251
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef ALITPCDATADCS_H
+#define ALITPCDATADCS_H
+
+#include <TMap.h>
+#include <TClonesArray.h>
+#include <TH2F.h>
+#include <TGraph.h>
+#include <TF1.h>
+
+//
+// This is an example of a container class
+// of the data retreieved from the DCS archive DB.
+// It is called by the detector's Preprocessor and
+// it is stored in the CDB.
+//
+
+class AliTPCDataDCS : public TObject {
+public:
+       enum {kNAliases=6, kNHistos=3, kNGraphs=3, kNFunctions=2};
+       enum {kHvMin=0, kHvMax=500};
+
+       AliTPCDataDCS();
+       AliTPCDataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime);
+       ~AliTPCDataDCS();
+
+       void SetRun(Int_t run) {fRun = run;}
+       void SetStartTime(Int_t startTime) {fStartTime = startTime;}
+       void SetEndTime(Int_t endTime) {fEndTime = endTime;}
+       Int_t GetRun() {return fRun;}
+       Int_t GetStartTime() {return fStartTime;}
+       Int_t GetEndTime() {return fEndTime;}
+
+       void ProcessData(TMap& aliasMap);
+
+       const char* GetAliasName(UInt_t pos)
+                       {return pos<kNAliases ? fAliasNames[pos].Data() : 0;}
+       const TH1F* GetHisto(UInt_t pos)
+                       {return pos<kNHistos ? fHv[pos] : 0;}
+
+       Float_t GetMean(UInt_t pos) {return pos<kNHistos ? fMean[pos] : 0;}
+       Float_t GetWidth(UInt_t pos) {return pos<kNHistos ? fWidth[pos] : 0;}
+
+       const TGraph* GetGraph(UInt_t pos)
+                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos)) : 0;}
+
+       const TF1* GetFunction() {return fFunc;}
+
+       Double_t Eval(int pos, Double_t time)
+                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos))->Eval(time) : -1;}
+
+       void Draw(const Option_t* option);
+
+
+private:
+       void Init();
+       void Introduce(UInt_t numAlias, const TObjArray* aliasArr);
+       void CreateGraph(int i, int dim, const Double_t *x, const Double_t *y);
+
+       Int_t fRun;             // run number
+       UInt_t fStartTime;      // run start time
+       UInt_t fEndTime;        // run end time
+
+       Float_t fMean[kNHistos];        // array of histos' mean values
+       Float_t fWidth[kNHistos];       // array of histos' widths
+
+       TString fAliasNames[kNAliases]; // array of DCS alias names
+       TH1F *fHv[kNHistos];            // array of histos
+       TClonesArray fGraphs;           // array of TGraphs
+       TF1 *fFunc;                     // fit function
+
+       Bool_t fIsProcessed;            // End-of-process flag
+
+       ClassDef(AliTPCDataDCS, 2);
+};
+
+#endif
index 30dfeaf..7658857 100644 (file)
@@ -11,5 +11,6 @@
 #pragma link C++ class TestServer;
 #pragma link C++ class TestITSPreprocessor;
 #pragma link C++ class TestTPCPreprocessor;
+#pragma link C++ class AliTPCDataDCS;
 
 #endif
index 5e89dd2..4afcac8 100644 (file)
@@ -2,8 +2,7 @@
 include ../../build/Makefile.$(ALICE_TARGET)
 
 
-CLASSES = TestServer.cxx TestITSPreprocessor.cxx TestTPCPreprocessor.cxx
-
+CLASSES = TestServer.cxx TestITSPreprocessor.cxx TestTPCPreprocessor.cxx AliTPCDataDCS.cxx
 DICT = DictTest.cxx
 
 HEADERS := $(patsubst %.cxx,%.h,$(CLASSES))
@@ -13,10 +12,10 @@ SRCS = $(CLASSES) $(DICT)
 OBJS := $(patsubst %.cxx,.obj/%.o,$(SRCS))
 DEPS := $(patsubst .obj/%.o,.dep/%.d,$(OBJS))
 
-INCDIR = -I$(shell root-config --incdir) -I../ -I../../include -I../../TPC
+INCDIR = -I$(shell root-config --incdir) -I../ -I../../include 
 CXXFLAGS += $(INCDIR)
 LIBDIR = $(shell root-config --libdir)
-LIBS = $(shell root-config --libs)
+
 
 SHARED = -shared
 
diff --git a/SHUTTLE/test/TestClientAlbe.C b/SHUTTLE/test/TestClientAlbe.C
new file mode 100644 (file)
index 0000000..9d709b8
--- /dev/null
@@ -0,0 +1,117 @@
+Int_t GetValues(const char* host, Int_t port, const char* request,
+       Long_t startTime, Long_t endTime) 
+{
+
+       AliDCSClient client(host, port, 1000, 5);
+
+       Int_t result;
+
+       TTimeStamp currentTime;
+       TMap values;
+
+       TString rString(request);
+
+       TObjArray* requests = rString.Tokenize(",");
+
+       cout<<"Requests: "<<requests->GetEntries()<<endl;
+
+       TStopwatch sw;
+       sw.Start();
+
+       if (requests->GetEntries() > 1) {
+               
+               TIter iter(requests);
+               TObjString* aString;
+               while ((aString = (TObjString*) iter.Next())) {
+                       values.Add(new TObjString(aString->String()), NULL);
+               }       
+               
+               result = client.GetDPValues(startTime, endTime, values);
+
+       } else {
+               TObjArray* valueSet = new TObjArray();
+               valueSet->SetOwner(1);
+
+               values.Add(new TObjString(request), valueSet);
+
+               result = client.GetAliasValues(request, startTime,
+                               endTime, *valueSet);
+               }
+
+       if (result < 0) {
+               cout<<"Communication failure: "<<
+                       AliDCSClient::GetErrorString(result)<<endl;
+
+               if (result == AliDCSClient::fgkServerError) {
+                       cout<<"Server error code: "<<
+                               client.GetServerErrorCode()<<endl;
+                       cout<<client.GetServerError()<<endl;
+               }
+       }
+       
+       sw.Stop();
+       cout<<"Elapsed time: "<<sw.RealTime()<<endl;
+       if (result > 0) {
+               cout<<"Time per value: "<<sw.RealTime()/result<<endl;
+       }
+       cout<<"Received values: "<<result<<endl;
+
+
+/* 
+       TIter iter(&values);
+       TObjString* aRequest;
+       while ((aRequest = (TObjString*) iter.Next())) {
+
+               TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest);
+               
+               cout<<" '"<<aRequest->String()<<"' values: " 
+                       <<valueSet->GetEntriesFast()<<endl;
+
+               TIter valIter(valueSet);
+               AliDCSValue* aValue;
+               while ((aValue = (AliDCSValue*) valIter.Next())) {
+                       cout<<aValue->ToString()<<endl;
+               } 
+       }
+
+ */
+/*     TFile file("dump.root", "UPDATE");
+       file.WriteTObject(values, "values");
+       file.Close(); */
+
+       values.DeleteAll();
+       delete requests;
+
+       cout<<"All values returned in runrange:  "<<endl;
+       cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl;
+       cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl;
+       
+       return result;
+}
+
+void TestClientAlbe(const char* host, Int_t port, const char* request,
+       UInt_t startShift, UInt_t endShift) {
+
+       gSystem->Load("libSHUTTLE");
+
+//     AliLog::EnableDebug(kFALSE);
+//     AliLog::SetGlobalDebugLevel(3);
+
+       TH1F *histo=new TH1F("h","h",36,-6,25);
+       Int_t result=-1;
+       for(int i=0;i<100;i++){
+
+               TTimeStamp currentTime;
+
+               result=GetValues(host, port, request,
+                       currentTime.GetSec() - startShift, 
+                       currentTime.GetSec() - endShift);
+                       if(result != 22) printf("\n\n\n NO 22!!!!!!!! %d\n\n",result);
+               histo->Fill((Float_t)result);
+               if(i != 99)gSystem->Sleep(10000);
+       }
+
+       cout<<"Client done"<<endl;
+       histo->Draw();
+}
+
diff --git a/SHUTTLE/test/TestClientAlias.C b/SHUTTLE/test/TestClientAlias.C
new file mode 100644 (file)
index 0000000..c717d7c
--- /dev/null
@@ -0,0 +1,105 @@
+void GetValues(const char* host, Int_t port, const char* request,
+       Long_t startTime, Long_t endTime) 
+{
+
+       AliDCSClient client(host, port, 1000, 5);
+
+       Int_t result;
+
+       TTimeStamp currentTime;
+       TMap values;
+
+       TString rString(request);
+
+       TObjArray* requests = rString.Tokenize(",");
+
+       cout<<"Requests: "<<requests->GetEntries()<<endl;
+
+       TStopwatch sw;
+       sw.Start();
+
+       if (requests->GetEntries() > 1) {
+               
+               TIter iter(requests);
+               TObjString* aString;
+               while ((aString = (TObjString*) iter.Next())) {
+                       values.Add(new TObjString(aString->String()), NULL);
+               }       
+               
+               result = client.GetAliasValues(startTime, endTime, values);
+
+       } else {
+               TObjArray* valueSet = new TObjArray();
+               valueSet->SetOwner(1);
+
+               values.Add(new TObjString(request), valueSet);
+
+               result = client.GetAliasValues(request, startTime,
+                               endTime, *valueSet);
+       }
+
+       if (result < 0) {
+               cout<<"Communication failure: "<<
+                       AliDCSClient::GetErrorString(result)<<endl;
+
+               if (result == AliDCSClient::fgkServerError) {
+                       cout<<"Server error code: "<<
+                               client.GetServerErrorCode()<<endl;
+                       cout<<client.GetServerError()<<endl;
+               }
+       }
+       
+       sw.Stop();
+       cout<<"Elapsed time: "<<sw.RealTime()<<endl;
+       if (result > 0) {
+               cout<<"Time per value: "<<sw.RealTime()/result<<endl;
+       }
+       cout<<"Received values: "<<result<<endl;
+
+       TIter iter(&values);
+       TObjString* aRequest;
+       while ((aRequest = (TObjString*) iter.Next())) {
+
+               TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest);
+               
+               cout<<" '"<<aRequest->String()<<"' values: " 
+                       <<valueSet->GetEntriesFast()<<endl;
+
+               TIter valIter(valueSet);
+               AliDCSValue* aValue;
+               while ((aValue = (AliDCSValue*) valIter.Next())) {
+                       cout<<aValue->ToString()<<endl;
+               } 
+       }
+
+/*
+       TFile file("dump.root", "UPDATE");
+       file.cd();
+       valueSet->Write();
+       file.Close(); 
+*/
+
+       values.DeleteAll();
+       delete requests;
+
+       cout<<"All values returned in runrange:  "<<endl;
+       cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl;
+       cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl;
+}
+
+void TestClientAlias(const char* host, Int_t port, const char* request,
+       UInt_t startShift, UInt_t endShift) {
+
+       gSystem->Load("libSHUTTLE");
+
+//     AliLog::EnableDebug(kFALSE);
+//     AliLog::SetGlobalDebugLevel(3);
+
+       TTimeStamp currentTime;
+
+       GetValues(host, port, request,
+               currentTime.GetSec() - startShift, 
+               currentTime.GetSec() - endShift);
+
+       cout<<"Client done"<<endl;
+}
diff --git a/SHUTTLE/test/TestClientDP.C b/SHUTTLE/test/TestClientDP.C
new file mode 100644 (file)
index 0000000..f04e366
--- /dev/null
@@ -0,0 +1,105 @@
+void GetValues(const char* host, Int_t port, const char* request,
+       Long_t startTime, Long_t endTime) 
+{
+
+       AliDCSClient client(host, port, 10000, 5);
+
+       Int_t result;
+
+       TTimeStamp currentTime;
+       TMap values;
+
+       TString rString(request);
+
+       TObjArray* requests = rString.Tokenize(",");
+
+       cout<<"Requests: "<<requests->GetEntries()<<endl;
+
+       TStopwatch sw;
+       sw.Start();
+
+       if (requests->GetEntries() > 1) {
+               
+               TIter iter(requests);
+               TObjString* aString;
+               while ((aString = (TObjString*) iter.Next())) {
+                       values.Add(new TObjString(aString->String()), NULL);
+               }       
+               
+               result = client.GetDPValues(startTime, endTime, values);
+
+       } else {
+               TObjArray* valueSet = new TObjArray();
+               valueSet->SetOwner(1);
+
+               values.Add(new TObjString(request), valueSet);
+
+               result = client.GetDPValues(request, startTime,
+                               endTime, *valueSet);
+       }
+
+       if (result < 0) {
+               cout<<"Communication failure: "<<
+                       AliDCSClient::GetErrorString(result)<<endl;
+
+               if (result == AliDCSClient::fgkServerError) {
+                       cout<<"Server error code: "<<
+                               client.GetServerErrorCode()<<endl;
+                       cout<<client.GetServerError()<<endl;
+               }
+       }
+       
+       sw.Stop();
+       cout<<"Elapsed time: "<<sw.RealTime()<<endl;
+       if (result > 0) {
+               cout<<"Time per value: "<<sw.RealTime()/result<<endl;
+       }
+       cout<<"Received values: "<<result<<endl;
+
+       TIter iter(&values);
+       TObjString* aRequest;
+       while ((aRequest = (TObjString*) iter.Next())) {
+
+               TObjArray* valueSet = (TObjArray*) values.GetValue(aRequest);
+               
+               cout<<" '"<<aRequest->String()<<"' values: " 
+                       <<valueSet->GetEntriesFast()<<endl;
+
+               TIter valIter(valueSet);
+               AliDCSValue* aValue;
+               while ((aValue = (AliDCSValue*) valIter.Next())) {
+                       cout<<aValue->ToString()<<endl;
+               } 
+       }
+
+/*
+       TFile file("dump.root", "UPDATE");
+       file.cd();
+       valueSet->Write();
+       file.Close(); 
+*/
+
+       values.DeleteAll();
+       delete requests;
+
+       cout<<"All values returned in runrange:  "<<endl;
+       cout<<"StartTime: "<<TTimeStamp(startTime).AsString()<<endl;
+       cout<<"EndTime: "<<TTimeStamp(endTime).AsString()<<endl;
+}
+
+void TestClientDP(const char* host, Int_t port, const char* request,
+       UInt_t startShift, UInt_t endShift) {
+
+       gSystem->Load("libSHUTTLE");
+
+//     AliLog::EnableDebug(kFALSE);
+//     AliLog::SetGlobalDebugLevel(3);
+
+       TTimeStamp currentTime;
+
+       GetValues(host, port, request,
+               currentTime.GetSec() - startShift, 
+               currentTime.GetSec() - endShift);
+
+       cout<<"Client done"<<endl;
+}
diff --git a/SHUTTLE/test/TestITSPreProcessor.cxx b/SHUTTLE/test/TestITSPreProcessor.cxx
deleted file mode 100644 (file)
index e1d2f8b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "TestITSPreProcessor.h"
-
-#include "AliCDBMetaData.h"
-#include "AliDCSValue.h"
-#include "AliLog.h"
-
-#include <TTimeStamp.h>
-
-ClassImp(TestITSPreProcessor)
-
-TestITSPreProcessor::TestITSPreProcessor():
-       AliCDBPreProcessor("ITS")
-{
-
-}
-
-void TestITSPreProcessor::Initialize(Int_t run, UInt_t startTime, 
-       UInt_t endTime) 
-{
-
-       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, 
-               TTimeStamp(startTime).AsString(),
-               TTimeStamp(endTime).AsString()));
-}
-
-void TestITSPreProcessor::Finalize() {
-       AliInfo("Finalizing...");
-}
-
-void TestITSPreProcessor::Process(const char* alias, TObjArray& valueSet, 
-       Bool_t hasError)
-{
-       AliInfo(Form("Alias %s, hasError: %d", alias, hasError));       
-
-       TString output;
-       
-       TIter iter(&valueSet);
-       AliDCSValue* aValue;
-       while ((aValue = (AliDCSValue*) iter.Next())) {
-               output += aValue->ToString();
-               output += '\n';
-       }       
-       output += '\n';
-
-       AliInfo(output);
-
-       AliCDBMetaData metaData;
-       metaData.SetComment("This is a test!");
-       
-       Store(alias, &valueSet, &metaData);     
-}
-
diff --git a/SHUTTLE/test/TestITSPreProcessor.h b/SHUTTLE/test/TestITSPreProcessor.h
deleted file mode 100644 (file)
index c57f752..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef TEST_ITS_PRE_PROCESSOR_H
-#define TEST_ITS_PRE_PRECESSOR_H
-
-#include "AliCDBPreProcessor.h"
-
-class TestITSPreProcessor: public AliCDBPreProcessor {
-public:
-       TestITSPreProcessor();
-
-protected:
-
-        virtual void Initialize(Int_t run, UInt_t startTime, 
-                        UInt_t endTime);
-
-        virtual void Finalize();
-
-        virtual void Process(const char* alias, TObjArray& valueSet, 
-                        Bool_t hasError);
-
-       ClassDef(TestITSPreProcessor, 0);
-};
-
-#endif
diff --git a/SHUTTLE/test/TestITSPreprocessor.cxx b/SHUTTLE/test/TestITSPreprocessor.cxx
new file mode 100644 (file)
index 0000000..6bd4f89
--- /dev/null
@@ -0,0 +1,74 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//
+// Example of a Shuttle Preprocessor
+//
+
+#include "TestITSPreprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+
+ClassImp(TestITSPreprocessor)
+
+//________________________________________________________________________________________
+TestITSPreprocessor::TestITSPreprocessor():
+       AliPreprocessor("ITS",0)
+{
+// default constructor - Don't use this!
+
+}
+
+//________________________________________________________________________________________
+TestITSPreprocessor::TestITSPreprocessor(const char* detector, AliShuttleInterface* shuttle):
+       AliPreprocessor(detector,shuttle)
+{
+// constructor - shuttle must be instantiated!
+
+}
+
+//________________________________________________________________________________________
+void TestITSPreprocessor::Initialize(Int_t run, UInt_t startTime,
+       UInt_t endTime) 
+{
+// Initialize preprocessor
+
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run, 
+               TTimeStamp(startTime).AsString(),
+               TTimeStamp(endTime).AsString()));
+}
+
+//________________________________________________________________________________________
+UInt_t TestITSPreprocessor::Process(TMap* valueMap)
+{
+// process data retrieved by the Shuttle
+
+       AliInfo(Form("You're in AliITSPreprocessor::Process!"));
+
+       TIter iter(valueMap);
+       TPair* aPair;
+       while ((aPair = (TPair*) iter.Next())) {
+               aPair->Print();
+       }
+       AliCDBMetaData metaData;
+       metaData.SetComment("This is a test!");
+
+       return Store(valueMap, &metaData);
+}
+
diff --git a/SHUTTLE/test/TestITSPreprocessor.h b/SHUTTLE/test/TestITSPreprocessor.h
new file mode 100644 (file)
index 0000000..456b1be
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef TEST_ITS_PRE_PROCESSOR_H
+#define TEST_ITS_PRE_PRECESSOR_H
+
+#include "AliPreprocessor.h"
+
+//
+// Example of a Shuttle Preprocessor
+//
+
+class TestITSPreprocessor: public AliPreprocessor {
+public:
+       TestITSPreprocessor();
+       TestITSPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+
+protected:
+
+        virtual void Initialize(Int_t run, UInt_t startTime, 
+                        UInt_t endTime);
+
+        virtual UInt_t Process(TMap* valueSet);
+
+       ClassDef(TestITSPreprocessor, 0);
+};
+
+#endif
index 0f57c95..7bdd8a4 100644 (file)
@@ -2,22 +2,17 @@ void TestShuttle() {
 
        gSystem->Load("libSHUTTLE");
         gSystem->Load("libRLDAP");
-
        gSystem->Load("libTest");
 
        AliLog::SetGlobalDebugLevel(1);
 
-        AliShuttleConfig config("pcepalice60.cern.ch", 389,
-                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
+       AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
         config.Print();
 
-       AliCDBStorage* cdbStorage = AliCDBManager::Instance()->
-                       GetStorage("local://~/temp/DCS");
-
-       AliShuttleTrigger trigger(&config, cdbStorage);
+       AliShuttleTrigger trigger(&config);
 
        AliShuttle* shuttle = trigger.GetShuttle();
-       shuttle->RegisterCDBPreProcessor(new TestITSPreProcessor());
+       TestITSPreprocessor *itsPrep = new AliITSPreprocessor("ITS",shuttle);
 
        trigger.CollectNew();
        
index 55d160c..e2c212b 100644 (file)
@@ -2,8 +2,7 @@ void TestShuttleConfig() {
 
        gSystem->Load("libSHUTTLE");
        gSystem->Load("libRLDAP");
-       
-       AliShuttleConfig config("pcepalice60.cern.ch", 389,
-                       "cn=Shuttle,dc=alice,dc=cern,dc=ch", "passhuttle");
+
+       AliShuttleConfig config("pcalice290.cern.ch", 389, "o=alice,dc=cern,dc=ch");
        config.Print();
 }
diff --git a/SHUTTLE/test/TestTPCPreprocessor.cxx b/SHUTTLE/test/TestTPCPreprocessor.cxx
new file mode 100644 (file)
index 0000000..cb67733
--- /dev/null
@@ -0,0 +1,92 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//
+// Example of a Shuttle Preprocessor
+//
+
+#include "TestTPCPreprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TH2F.h>
+
+ClassImp(TestTPCPreprocessor)
+
+//________________________________________________________________________________________
+TestTPCPreprocessor::TestTPCPreprocessor():
+       AliPreprocessor("TPC",0)
+{
+// default constructor - Don't use this!
+
+       fData = 0;
+}
+
+//________________________________________________________________________________________
+TestTPCPreprocessor::TestTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle):
+       AliPreprocessor(detector,shuttle)
+{
+// constructor - shuttle must be instantiated!
+
+       fData = 0;
+
+}
+
+//________________________________________________________________________________________
+TestTPCPreprocessor::~TestTPCPreprocessor()
+{
+// destructor
+
+       delete fData;
+       fData = 0;
+
+}
+
+//________________________________________________________________________________________
+void TestTPCPreprocessor::Initialize(Int_t run, UInt_t startTime,
+       UInt_t endTime)
+{
+// Initialize preprocessor
+
+       fRun=run;
+       fStartTime = startTime;
+       fEndTime = endTime;
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+               TTimeStamp(startTime).AsString(),
+               TTimeStamp(endTime).AsString()));
+
+       fData = new AliTPCDataDCS(fRun, fStartTime, fEndTime);
+}
+
+//________________________________________________________________________________________
+UInt_t TestTPCPreprocessor::Process(TMap* aliasMap)
+{
+// Process data
+
+       fData->ProcessData(*aliasMap);
+       AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Alberto Colla");
+       metaData.SetComment("This preprocessor fills an AliTPCDataDCS object.");
+
+       return Store(fData, &metaData);
+       delete fData;
+       fData = 0;
+}
+
diff --git a/SHUTTLE/test/TestTPCPreprocessor.h b/SHUTTLE/test/TestTPCPreprocessor.h
new file mode 100644 (file)
index 0000000..609fd74
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef TEST_TPC_PRE_PROCESSOR_H
+#define TEST_TPC_PRE_PRECESSOR_H
+
+#include "AliPreprocessor.h"
+#include "AliTPCDataDCS.h"
+
+//
+// Example of a Shuttle Preprocessor
+//
+
+class TestTPCPreprocessor: public AliPreprocessor {
+public:
+
+       TestTPCPreprocessor();
+       TestTPCPreprocessor(const char* detector, AliShuttleInterface* shuttle);
+       ~TestTPCPreprocessor();
+
+protected:
+
+        virtual void Initialize(Int_t run, UInt_t startTime,
+                        UInt_t endTime);
+
+        virtual UInt_t Process(TMap* aliasMap);
+
+private:
+       Int_t fRun;             // Run number
+       Int_t fStartTime;       // Start time
+       Int_t fEndTime;         // End time
+
+       AliTPCDataDCS *fData;   // pointer to the data container and analyzer class
+
+       ClassDef(TestTPCPreprocessor, 0);
+};
+
+#endif