]>
Commit | Line | Data |
---|---|---|
f7c046aa | 1 | #include "AliRICHPreprocessor.h" //header |
2 | ||
3 | #include <AliCDBMetaData.h> | |
9de8d990 | 4 | #include <AliDCSValue.h> |
5 | #include <TObjArray.h> //Test() | |
6 | #include <TObjString.h> //Test() | |
7 | #include <AliCDBManager.h> //Test() | |
8 | #include <AliCDBEntry.h> //Test() | |
aebb712c | 9 | //#include <AliTestShuttle.h> //Test() |
9de8d990 | 10 | #include <TRandom.h> //Test() |
11 | #include <TF1.h> //Process() | |
12 | #include <TGraph.h> //Process() | |
13 | ||
14 | ClassImp(AliRICHPreprocessor) | |
15 | ||
16 | ||
17 | ||
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"}; | |
f7c046aa | 20 | |
f7c046aa | 21 | |
f7c046aa | 22 | |
f7c046aa | 23 | |
24 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
25 | void AliRICHPreprocessor::Initialize(Int_t run, UInt_t startTime,UInt_t endTime) | |
26 | { | |
f7c046aa | 27 | AliPreprocessor::Initialize(run, startTime, endTime); |
f7c046aa | 28 | } |
29 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
30 | UInt_t AliRICHPreprocessor::Process(TMap* pDcsMap) | |
31 | { | |
9de8d990 | 32 | // |
33 | TList* list = GetFileSources(kDAQ, "MAP"); //first analyse a set of pedestal files | |
f7c046aa | 34 | if (list){ |
9de8d990 | 35 | Log("The following sources produced files with the id MAP"); |
f7c046aa | 36 | list->Print(); |
37 | delete list; | |
38 | } | |
39 | ||
9de8d990 | 40 | if(!pDcsMap) return 0; //no DCS map provided |
f7c046aa | 41 | |
9de8d990 | 42 | TObjArray result; result.SetOwner(kTRUE); //result is a array of TF1 |
43 | ||
44 | ||
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); | |
49 | ||
50 | TGraph *pGr=new TGraph; pGr->GetXaxis()->SetTimeDisplay(kTRUE); //tmp graph of sensor data versus time | |
f7c046aa | 51 | |
9de8d990 | 52 | TIter next(pOA); AliDCSValue *pDcsVal; Int_t i=0; |
5fad0899 | 53 | while((pDcsVal=(AliDCSValue*)next())) //loop over data points for this sensor and fill the graph |
662593c7 | 54 | pGr->SetPoint(i++,pDcsVal->GetTimeStamp(),pDcsVal->GetFloat()); |
9de8d990 | 55 | |
56 | ||
57 | pGr->Fit(pF1); //do fit | |
58 | delete pGr; | |
59 | result.Add(pF1); | |
60 | } | |
61 | ||
62 | AliCDBMetaData metaData; metaData.SetBeamPeriod(0); metaData.SetResponsible("AliRICHPreprocessor"); metaData.SetComment("SIMULATED"); | |
f7c046aa | 63 | |
420563be | 64 | return Store("DCS", "Data", &result, &metaData); //use AliPreprocessor::Store(), not allowed to use AliCDBManager directly |
9de8d990 | 65 | |
66 | }//Process() | |
67 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
68 | void AliRICHPreprocessor::Test() | |
69 | { | |
70 | ||
71 | AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/TestCDB"); // initialize location of CDB | |
72 | ||
aebb712c | 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"); | |
82 | // | |
83 | // AliPreprocessor* pp = new AliRICHPreprocessor(pShuttle); //start test, actual invocation of Process will be done from shuttle | |
84 | // pShuttle->Process(); | |
85 | // delete pp; | |
9de8d990 | 86 | |
87 | ||
88 | ||
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!!!"); | |
92 | }//Test() | |
93 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
94 | TMap* AliRICHPreprocessor::SimulateDcsMap() | |
95 | { | |
96 | TMap* pDcsMap = new TMap; pDcsMap->SetOwner(1); | |
97 | ||
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) { | |
662593c7 | 101 | Float_t simVal = Float_t(20*gRandom->Gaus()); //T sensor provides floats |
102 | AliDCSValue* pDcsVal = new AliDCSValue(simVal, timeStamp); | |
9de8d990 | 103 | pOA->Add(pDcsVal); //add new data point to array |
104 | } | |
105 | pDcsMap->Add(new TObjString(fgkAliasName[iAlias]),pOA); //add new array of data points to the map | |
106 | }//aliases loop | |
107 | return pDcsMap; | |
108 | } | |
109 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |