Updates concerning the geometry: versioning system, new V11hybrid version, bug fixes...
[u/mrichter/AliRoot.git] / HMPID / Hshuttle.C
CommitLineData
abb5f786 1void Hshuttle(Int_t runTime=1500)
56d2de52 2{// this macro is to simulate the functionality of SHUTTLE.
abb5f786 3 gSystem->Load("libTestShuttle.so");
abb5f786 4 AliTestShuttle::SetMainCDB(TString("local://$HOME"));
5
56d2de52 6 TMap *pDcsMap = new TMap; pDcsMap->SetOwner(1); //DCS archive map
7
8 AliTestShuttle* pShuttle = new AliTestShuttle(0,0,1000000);
9 SimPed(); for(Int_t ldc=1;ldc<=4;ldc++) pShuttle->AddInputFile(AliTestShuttle::kDAQ,"HMP","pedestals",Form("LDC%i",ldc),Form("HmpidPeds%i.tgz",ldc));
10 SimMap(pDcsMap,runTime); pShuttle->SetDCSInput(pDcsMap); //DCS map
11
12 AliPreprocessor* pp = new AliHMPIDPreprocessor(pShuttle); pShuttle->Process(); delete pp; //here goes preprocessor
abb5f786 13
56d2de52 14 TCanvas *c=new TCanvas("cc","ff",600,600); DrawInput(c,pDcsMap); DrawOutput();
abb5f786 15}//Hshuttle()
16//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a0e5c1b9 17void SimPed()
18{
19 ofstream out;
20 for(Int_t ddl=0;ddl<=13;ddl++){
56d2de52 21 out.open(Form("HmpidPedDdl%02i.txt",ddl));
a0e5c1b9 22 out << 3 <<endl;
23 for(Int_t row=1;row<=24;row++)
24 for(Int_t dil=1;dil<=10;dil++)
25 for(Int_t adr=0;adr<=47;adr++){
26 Float_t mean = 150+200*gRandom->Rndm();
27 Float_t sigma = 1+0.2*gRandom->Rndm();
28 Int_t inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma);
56d2de52 29 out << Form("%2i %2i %2i %5.2f %5.2f %x\n",row,dil,adr,mean,sigma,inhard);
a0e5c1b9 30 }
31
32 Printf("file ped %02i created",ddl);
33 out.close();
34 }
56d2de52 35 gSystem->Exec("tar czf HmpidPeds1.tgz HmpidPedDdl00.txt HmpidPedDdl01.txt HmpidPedDdl02.txt HmpidPedDdl03.txt");
36 gSystem->Exec("tar czf HmpidPeds2.tgz HmpidPedDdl04.txt HmpidPedDdl05.txt HmpidPedDdl06.txt HmpidPedDdl07.txt");
37 gSystem->Exec("tar czf HmpidPeds3.tgz HmpidPedDdl08.txt HmpidPedDdl09.txt HmpidPedDdl10.txt HmpidPedDdl11.txt");
38 gSystem->Exec("tar czf HmpidPeds4.tgz HmpidPedDdl12.txt HmpidPedDdl13.txt");
39 gSystem->Exec("rm -rf ped*.txt");
a0e5c1b9 40}
41//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
abb5f786 42void SimMap(TMap *pDcsMap,Int_t runTime=1500)
43{
44 Int_t stepTime=100; //time interval between mesuraments
45 Int_t startTime=0;
46
43480497 47
48 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
abb5f786 49 TObjArray *pP=new TObjArray; pP->SetOwner(1);
50 TObjArray *pHV=new TObjArray; pHV->SetOwner(1);
51 for(Int_t time=0;time<runTime;time+=stepTime) pP->Add(new AliDCSValue((Float_t)1005.0 ,time)); //sample CH4 pressure [mBar]
52 pHV->Add(new AliDCSValue((Float_t)2010.0,time)); //sample chamber HV [V]
56d2de52 53 pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value" ,iCh,iCh,iCh)),pP);
54 pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh)),pHV);
abb5f786 55
43480497 56 for(Int_t iRad=0;iRad<3;iRad++){//radiators loop
abb5f786 57 TObjArray *pT1=new TObjArray; pT1->SetOwner(1);
58 TObjArray *pT2=new TObjArray; pT2->SetOwner(1);
59 for (Int_t time=0;time<runTime;time+=stepTime) pT1->Add(new AliDCSValue(13,time)); //sample inlet temperature Nmean=1.292 @ 13 degrees
60 for (Int_t time=0;time<runTime;time+=stepTime) pT2->Add(new AliDCSValue(13,time)); //sample outlet temperature
56d2de52 61 pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iIn_Temp",iCh,iCh,iRad)) ,pT1);
62 pDcsMap->Add(new TObjString(Form("HMP_DET/HMP_MP%i/HMP_MP%i_LIQ_LOOP.actual.sensors.Rad%iOut_Temp",iCh,iCh,iRad)),pT2);
abb5f786 63 }//radiators loop
43480497 64 }//chambers loop
abb5f786 65}//SimMap()
66//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
abb5f786 67void DrawInput(TCanvas *c,TMap *pDcsMap)
68{
69 c->Divide(3,3);
43480497 70
abb5f786 71 AliDCSValue *pVal; Int_t cnt=0;
72
73 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
74 if(iCh==6) c->cd(1); if(iCh==5) c->cd(2);
75 if(iCh==4) c->cd(4); if(iCh==3) c->cd(5); if(iCh==2) c->cd(6);
76 if(iCh==1) c->cd(8); if(iCh==0) c->cd(9);
77
56d2de52 78 TObjArray *pHV=(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_PW/HMP_MP%i_SEC0/HMP_MP%i_SEC0_HV.actual.vMon",iCh,iCh,iCh,iCh)); //HV
79 TObjArray *pP =(TObjArray*)pDcsMap->GetValue(Form("HMP_DET/HMP_MP%i/HMP_MP%i_GAS/HMP_MP%i_GAS_PMWC.actual.value",iCh,iCh,iCh)); //P
abb5f786 80 TGraph *pGr=new TGraph; pGr->SetMarkerStyle(5);
43480497 81
abb5f786 82 TIter nextp(pP); cnt=0; while((pVal=(AliDCSValue*)nextp())){ pGr->SetPoint(cnt++,pVal->GetTimeStamp(),pVal->GetFloat());}//P
43480497 83
abb5f786 84
85 pGr->Draw("AP");
43480497 86 }
abb5f786 87}
88//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89void DrawOutput()
90{
56d2de52 91 AliCDBManager::Instance()->SetDefaultStorage("local://$HOME"); AliCDBManager::Instance()->SetRun(0);
92 AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre");
93 AliCDBEntry *pNmeanEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Nmean");
94 AliCDBEntry *pDaqSigEnt=AliCDBManager::Instance()->Get("HMPID/Calib/DaqSig");
abb5f786 95
56d2de52 96 if(!pQthreEnt || !pNmeanEnt || !pDaqSigEnt) return;
abb5f786 97
a0e5c1b9 98 TObjArray *pNmean =(TObjArray*)pNmeanEnt ->GetObject();
99 TObjArray *pQthre =(TObjArray*)pQthreEnt ->GetObject();
a0e5c1b9 100 TObjArray *pDaqSig=(TObjArray*)pDaqSigEnt->GetObject();
101
abb5f786 102 TF1 *pRad0,*pRad1,*pRad2;
103 TCanvas *c2=new TCanvas("c2","Nmean"); c2->Divide(3,3);
104
43480497 105
43480497 106 for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
abb5f786 107 if(iCh==6) c2->cd(1); if(iCh==5) c2->cd(2);
108 if(iCh==4) c2->cd(4); if(iCh==3) c2->cd(5); if(iCh==2) c2->cd(6);
109 if(iCh==1) c2->cd(8); if(iCh==0) c2->cd(9);
110
111 TF1 *pRad0=(TF1*)pNmean->At(iCh*3+0); pRad0->Draw(); pRad0->GetXaxis()->SetTimeDisplay(kTRUE); pRad0->GetYaxis()->SetRangeUser(1.28,1.3);
112 TF1 *pRad1=(TF1*)pNmean->At(iCh*3+1); pRad1->Draw("same");
113 TF1 *pRad2=(TF1*)pNmean->At(iCh*3+2); pRad2->Draw("same");
114 }//chambers loop
115}
56d2de52 116//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++