Removing the monitoring policy that requires ALL EOR events - it was hanging DAQ...
[u/mrichter/AliRoot.git] / ITS / ShowDriftSpeedSDD.C
CommitLineData
40b3a8c7 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TFile.h>
3#include <TH1F.h>
4#include <TGraph.h>
5#include <TStyle.h>
6#include <TGrid.h>
7#include <TCanvas.h>
8#include <TLatex.h>
9#include <TObjArray.h>
10#include "AliCDBEntry.h"
11#include "AliITSDriftSpeedArraySDD.h"
12#endif
13
14// Macro to plot the calibration parameters from the OCDB file
15// created from an INJECTOR run (OCDB/ITS/Calib/DriftSpeedSDD)
16// Two methods ShowDriftSpeedSDD:
17// - the first takes the name of the file to be displayed
18// - the second builds the alien path+name from run number and file version
19//
20// Origin: F. Prino (prino@to.infn.it)
21
22void ShowDriftSpeedSDD(Char_t filnam[150]="$ALICE_ROOT/ITS/Calib/DriftSpeedSDD/Run0_9999999_v0_s0.root", Int_t firstmod=0, Int_t lastmod=260){
23 TFile *f= TFile::Open(filnam);
24 AliCDBEntry *ent=(AliCDBEntry*)f->Get("AliCDBEntry");
25 TObjArray *drspSDD = (TObjArray *)ent->GetObject();
26 AliITSDriftSpeedArraySDD *vdriftarr0;
27 AliITSDriftSpeedArraySDD *vdriftarr1;
28 TGraph **gvdr0=new TGraph*[260];
29 TGraph **gvdr1=new TGraph*[260];
30
31 TCanvas *c0=new TCanvas("c0","Module Drift Speed",1100,500);
32
33 TGraph *vvsmod0=new TGraph(0);
34 TGraph *vvsmod1=new TGraph(0);
35 vvsmod0->SetTitle("Drift Speed vs. mod. number");
36 vvsmod1->SetTitle("Drift Speed vs. mod. number");
37 Char_t tit[100];
38 for(Int_t i=firstmod; i<lastmod; i++){
266a4b47 39 Int_t iMod=i+240;
40b3a8c7 40 c0->Clear();
41 c0->Divide(2,1);
42 Int_t i0=2*i;
43 Int_t i1=1+2*i;
44 vdriftarr0=(AliITSDriftSpeedArraySDD*)drspSDD->At(i0);
45 vdriftarr1=(AliITSDriftSpeedArraySDD*)drspSDD->At(i1);
46
47 gvdr0[i]=new TGraph(0);
48 gvdr1[i]=new TGraph(0);
49 gvdr0[i]->SetMarkerStyle(7);
50 gvdr1[i]->SetMarkerStyle(7);
51 gvdr0[i]->SetMinimum(5.);
52 gvdr1[i]->SetMinimum(5.);
53 gvdr0[i]->SetMaximum(9.);
54 gvdr1[i]->SetMaximum(9.);
266a4b47 55 sprintf(tit,"Mod %d\n",iMod);
40b3a8c7 56 gvdr0[i]->SetTitle(tit);
57 gvdr1[i]->SetTitle(tit);
58
59 for(Int_t iAn=0; iAn<256; iAn++){
60 Float_t vel0=0;
61 if(vdriftarr0) vel0=vdriftarr0->GetDriftSpeed(1,iAn);
62 Float_t vel1=0;
63 if(vdriftarr1) vel1=vdriftarr1->GetDriftSpeed(1,iAn);
64 gvdr0[i]->SetPoint(iAn,(Float_t)iAn,vel0);
65 gvdr1[i]->SetPoint(iAn,(Float_t)iAn,vel1);
66 }
266a4b47 67 printf(" Mod. %d \t v(an 128l)= %f",iMod,vdriftarr0->GetDriftSpeed(0,128));
40b3a8c7 68 printf(" \t v(an 128r)= %f\n",vdriftarr1->GetDriftSpeed(0,128));
69 c0->cd(1);
70 gvdr0[i]->Draw("AP");
71 gvdr0[i]->GetXaxis()->SetTitle("Anode");
72 gvdr0[i]->GetYaxis()->SetTitle("Vdrift (#mum/ns)");
73 c0->cd(2);
74 gvdr1[i]->Draw("AP");
75 gvdr1[i]->GetXaxis()->SetTitle("Anode");
76 gvdr1[i]->GetYaxis()->SetTitle("Vdrift (#mum/ns)");
77 c0->Update();
78
79 Float_t vel0=0;
80 if(vdriftarr0) vel0=vdriftarr0->GetDriftSpeed(0,128);
81 Float_t vel1=0;
82 if(vdriftarr1) vel1=vdriftarr1->GetDriftSpeed(0,128);
266a4b47 83 vvsmod0->SetPoint(vvsmod0->GetN(),(Float_t)iMod,vel0);
84 vvsmod1->SetPoint(vvsmod1->GetN(),(Float_t)iMod,vel1);
40b3a8c7 85
86 // getchar();
87 }
88 TCanvas* c2;
89 c2=new TCanvas("c2","",1000,700);
90 vvsmod0->SetMarkerStyle(20);
91 vvsmod0->Draw("AP");
92 vvsmod0->GetXaxis()->SetTitle("Module Number");
93 vvsmod0->GetYaxis()->SetTitle("Vdrift (#mum/ns)");
94 vvsmod1->SetMarkerStyle(21);
95 vvsmod1->SetMarkerColor(2);
96 vvsmod1->Draw("SAMEP");
97 TLatex* tleft=new TLatex(0.7,0.82,"Side 0");
98 tleft->SetNDC();
99 tleft->SetTextColor(1);
100 tleft->Draw();
101 TLatex* tright=new TLatex(0.7,0.75,"Side 1");
102 tright->SetNDC();
103 tright->SetTextColor(2);
104 tright->Draw();
105
106}
107
108
109
266a4b47 110void ShowDriftSpeedSDD(Int_t nrun, Int_t nv, Int_t year=2009){
40b3a8c7 111 TGrid::Connect("alien:",0,0,"t");
112 Char_t filnam[200];
266a4b47 113 sprintf(filnam,"alien:///alice/data/%d/OCDB/ITS/Calib/DriftSpeedSDD/Run%d_999999999_v%d_s0.root",year,nrun,nv);
40b3a8c7 114 printf("Open file: %s\n",filnam);
115 ShowDriftSpeedSDD(filnam,0,260);
116}