New developments of the analysis framework - selectorised version of the manager...
[u/mrichter/AliRoot.git] / RICH / RichTestShuttle.C
CommitLineData
37522ef0 1void RichTestShuttle()
2{
3// this macro is to simulate the functionality of SHUTTLE.
4// Here the list of DCS aliases is created and packed in TMap of structure "alias name" - TObjArray of AliDCSValue
5 TMultiGraph *pMG[7]; for(Int_t i=0;i<7;i++) {pMG[i]=new TMultiGraph; pMG[i]->SetTitle("T,grad C;time");}
6 TGraph *pGr[21];for(Int_t i=0;i<21;i++){pGr[i]=new TGraph; pGr[i]->SetMarkerStyle(i%3+24); pGr[i]->SetMarkerColor(i%3+2); pMG[i/3]->Add(pGr[i]);}
7 TMap *pDcsMap = new TMap; pDcsMap->SetOwner(1); //DCS archive map
8
9 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
10 for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
11 TObjArray* pValLst = new TObjArray; pValLst->SetOwner(1);
12 Int_t iPoint=0;
13 for (Int_t time=0;time<1000;time+=50) {
14 AliDCSValue* pVal = new AliDCSValue(Float_t(iCh*3+iRad+0.1*gRandom->Gaus()), time); //sample new data point
15 pValLst->Add(pVal); //add it to the list
16 pGr[3*iCh+iRad]->SetPoint(iPoint++,time,pVal->GetFloat()); //and also to the graph
17 }
18 pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad)),pValLst); //add new list to the map
19 }//radiators loop
20 }//chambers loop
21
22
23 AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/tstCDB"); // initialize location of CDB
24
37522ef0 25 gSystem->Load("libTestShuttle.so");
26 Int_t iRun=1;
27 AliTestShuttle* pShuttle = new AliTestShuttle(iRun,0,100000);
28 pShuttle->SetDCSInput(pDcsMap); //DCS map
29 AliPreprocessor* pp = new AliRICHPreprocessor(pShuttle); //actual ipreprocessor is created here
30 pShuttle->Process(); //run SHUTTLE simulator
31 delete pp;
32
33
2da90160 34 AliCDBEntry *pTempEn=AliCDBManager::Instance()->Get("RICH/DCS/RadTemp",iRun);
35 if(!pTempEn) {Printf("ERROR file is not retrieved!!!");return;}
37522ef0 36
2da90160 37 TObjArray *pTempLst=(TObjArray*)pTempEn->GetObject(); TF1 *pRad0,*pRad1,*pRad2;
37522ef0 38 TCanvas *pC=new TCanvas; pC->Divide(3,3);
39 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
40 if(iCh==6) pC->cd(1); if(iCh==5) pC->cd(2); //this is just to see the input
41 if(iCh==4) pC->cd(4); if(iCh==3) pC->cd(5); if(iCh==2) pC->cd(6);
42 if(iCh==1) pC->cd(8); if(iCh==0) pC->cd(9);
43 pMG[iCh]->Draw("ap"); pMG[iCh]->GetXaxis()->SetTimeDisplay(kTRUE);
2da90160 44 pRad0=(TF1*)pTempLst->At(iCh*3+0); pRad0->Draw("same");
45 pRad1=(TF1*)pTempLst->At(iCh*3+1); pRad1->Draw("same");
46 pRad2=(TF1*)pTempLst->At(iCh*3+2); pRad2->Draw("same");
37522ef0 47 }
2da90160 48
49 AliCDBEntry *pIdxEn=AliCDBManager::Instance()->Get("RICH/DCS/MeanIdx",iRun);
50 if(!pIdxEn) {Printf("ERROR file is not retrieved!!!");return;}
51
52 TObjArray *pIdxLst=(TObjArray*)pIdxEn->GetObject(); TF1 *pRad0,*pRad1,*pRad2;
53 TCanvas *pC=new TCanvas("c2","Ref Idx"); pC->Divide(3,3);
54 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
55 if(iCh==6) pC->cd(1); if(iCh==5) pC->cd(2); //this is just to see the input
56 if(iCh==4) pC->cd(4); if(iCh==3) pC->cd(5); if(iCh==2) pC->cd(6);
57 if(iCh==1) pC->cd(8); if(iCh==0) pC->cd(9);
58 pRad0=(TF1*)pIdxLst->At(iCh*3+0); pRad0->Draw(); pRad0->GetXaxis()->SetTimeDisplay(kTRUE); pRad0->GetYaxis()->SetRangeUser(1.28,1.3);
59 pRad1=(TF1*)pIdxLst->At(iCh*3+1); pRad1->Draw("same");
60 pRad2=(TF1*)pIdxLst->At(iCh*3+2); pRad2->Draw("same");
61 }
37522ef0 62}//Test()