1 #include "AliRICHPreprocessor.h" //header
3 #include <AliCDBMetaData.h>
4 #include <AliDCSValue.h>
5 #include <TObjArray.h> //Test()
6 #include <TObjString.h> //Test()
7 #include <AliCDBManager.h> //Test()
8 #include <AliCDBEntry.h> //Test()
9 #include <AliTestShuttle.h> //Test()
10 #include <TRandom.h> //Test()
11 #include <TF1.h> //Process()
12 #include <TGraph.h> //Process()
14 ClassImp(AliRICHPreprocessor)
18 const char *AliRICHPreprocessor::fgkAliasName[AliRICHPreprocessor::fgkNalias]={"HMP_DET/HMP_MP0/HMP_MP0_LIQ_LOOP.actual.sensors.Rad1In_Temp",
19 "HMP_DET/HMP_MP0/HMP_MP0_LIQ_LOOP.actual.sensors.Rad1Out_Temp"};
24 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 void AliRICHPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime)
27 AliPreprocessor::Initialize(run, startTime, endTime);
29 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30 UInt_t AliRICHPreprocessor::Process(TMap* pDcsMap)
33 TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files
35 Log("The following sources produced files with the id MAP");
40 if(!pDcsMap) return 0; //no DCS map provided
42 TObjArray result; result.SetOwner(kTRUE); //result is a array of TF1
45 for(Int_t iAlias=0;iAlias<fgkNalias;iAlias++){//aliases loop
46 TObjArray *pOA=(TObjArray*)pDcsMap->GetValue(fgkAliasName[iAlias]);
47 if(!pOA) continue; //no data points for this alias
48 TF1 *pF1=new TF1("t11","[0]+[1]*x+[2]*sin([3]*x)",0,10);
50 TGraph *pGr=new TGraph; pGr->GetXaxis()->SetTimeDisplay(kTRUE); //tmp graph of sensor data versus time
52 TIter next(pOA); AliDCSValue *pDcsVal; Int_t i=0;
53 while(pDcsVal=(AliDCSValue*)next()) //loop over data points for this sensor and fill the graph
54 pGr->SetPoint(i++,pDcsVal->GetTimeStamp(),pDcsVal->GetSimpleValue().GetFloat());
57 pGr->Fit(pF1); //do fit
62 AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliRICHPreprocessor"); metaData.SetComment("SIMULATED");
64 return Store(&result, &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly
67 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
68 void AliRICHPreprocessor::Test()
71 AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/TestCDB"); // initialize location of CDB
73 AliTestShuttle* pShuttle = new AliTestShuttle();
74 pShuttle->SetDCSInput(SimulateDcsMap()); //DCS map format alias->TObjArray of AliDCSValue
75 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC1", "map1.root"); //????? real gain map
76 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC2", "map2.root"); //how to crrespond LDC id and staff from AliRICHDigit ????
77 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC3", "map3.root");
78 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC4", "map4.root");
79 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC5", "map5.root");
80 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC6", "map6.root");
81 pShuttle->AddInputFile(AliTestShuttle::kDAQ, "RICH", "MAP", "LDC7", "map7.root");
83 AliPreprocessor* pp = new AliRICHPreprocessor(pShuttle); //start test, actual invocation of Process will be done from shuttle
89 //read array of TF1 stored in CDB
90 AliCDBEntry *pEntry=AliCDBManager::Instance()->Get("RICH/SHUTTLE/Data",0);
91 if(!pEntry) Printf("ERROR file is not retrieved!!!");
93 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
94 TMap* AliRICHPreprocessor::SimulateDcsMap()
96 TMap* pDcsMap = new TMap; pDcsMap->SetOwner(1);
98 for(Int_t iAlias=0;iAlias<fgkNalias;iAlias++){//loop on aliases
99 TObjArray* pOA = new TObjArray; pOA->SetOwner(1); //values are supposed to be arranged in TObjArray
100 for (Int_t timeStamp=0;timeStamp<1000;timeStamp+=10) {
101 AliSimpleValue* pSimVal = new AliSimpleValue(Float_t(20*gRandom->Gaus())); //T sensor provides floats
102 AliDCSValue* pDcsVal = new AliDCSValue(*pSimVal, timeStamp);
103 pOA->Add(pDcsVal); //add new data point to array
105 pDcsMap->Add(new TObjString(fgkAliasName[iAlias]),pOA); //add new array of data points to the map
109 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++