]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/Hshuttle.C
Removing semaphore .done files.
[u/mrichter/AliRoot.git] / HMPID / Hshuttle.C
1 void Hshuttle()
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); 
19       pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad)),pValLst);
20     }//radiators loop
21   }//chambers loop
22   
23   AliTestShuttle::SetOCDBStorage("local://$HOME/tstCDB");  
24   AliCDBManager::Instance()->SetDefaultStorage("local://$HOME/tstCDB"); // initialize location of CDB
25       
26   gSystem->Load("libTestShuttle.so"); 
27   Int_t iRun=1;   
28   AliTestShuttle* pShuttle = new AliTestShuttle(iRun,0,100000);   
29   pShuttle->SetDCSInput(pDcsMap);                                                    //DCS map
30   AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle);                           //actual ipreprocessor is created here
31   pShuttle->Process();                                                               //run SHUTTLE simulator
32   delete pp;
33   
34     
35   AliCDBEntry *pTempEn=AliCDBManager::Instance()->Get("HMPID/DCS/RadTemp",iRun);
36   if(!pTempEn) {Printf("ERROR file is not retrieved!!!");return;}
37
38   TObjArray *pTempLst=(TObjArray*)pTempEn->GetObject(); TF1 *pRad0,*pRad1,*pRad2;  
39   TCanvas *pC=new TCanvas; pC->Divide(3,3);
40   for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
41     if(iCh==6) pC->cd(1);  if(iCh==5) pC->cd(2);                          //this is just to see the input
42     if(iCh==4) pC->cd(4);  if(iCh==3) pC->cd(5);  if(iCh==2) pC->cd(6);
43                            if(iCh==1) pC->cd(8);  if(iCh==0) pC->cd(9); 
44     pMG[iCh]->Draw("ap"); pMG[iCh]->GetXaxis()->SetTimeDisplay(kTRUE);
45     pRad0=(TF1*)pTempLst->At(iCh*3+0); pRad0->Draw("same");
46     pRad1=(TF1*)pTempLst->At(iCh*3+1); pRad1->Draw("same");
47     pRad2=(TF1*)pTempLst->At(iCh*3+2); pRad2->Draw("same");
48   }  
49   
50   AliCDBEntry *pIdxEn=AliCDBManager::Instance()->Get("HMPID/DCS/MeanIdx",iRun);
51   if(!pIdxEn) {Printf("ERROR file is not retrieved!!!");return;}
52
53   TObjArray *pIdxLst=(TObjArray*)pIdxEn->GetObject(); TF1 *pRad0,*pRad1,*pRad2;  
54   TCanvas *pC=new TCanvas("c2","Ref Idx"); pC->Divide(3,3);
55   for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
56     if(iCh==6) pC->cd(1);  if(iCh==5) pC->cd(2);                          //this is just to see the input
57     if(iCh==4) pC->cd(4);  if(iCh==3) pC->cd(5);  if(iCh==2) pC->cd(6);
58                            if(iCh==1) pC->cd(8);  if(iCh==0) pC->cd(9); 
59     pRad0=(TF1*)pIdxLst->At(iCh*3+0); pRad0->Draw();  pRad0->GetXaxis()->SetTimeDisplay(kTRUE); pRad0->GetYaxis()->SetRangeUser(1.28,1.3);
60     pRad1=(TF1*)pIdxLst->At(iCh*3+1); pRad1->Draw("same");
61     pRad2=(TF1*)pIdxLst->At(iCh*3+2); pRad2->Draw("same");
62   }    
63 }//Hshuttle()