]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PMD/AliPMDRootDataRead.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / PMD / AliPMDRootDataRead.C
CommitLineData
9f35f7b3 1// To read PMD raw root data and fetch the adc value for each cell
722ccc67 2void AliPMDRootDataRead(Int_t NEVT = 10)
1f86361b 3{
1f86361b 4 TObjArray pmdddlcont;
722ccc67 5
6 gBenchmark->Start("");
2c08d1c1 7 gStyle->SetOptStat(0);
8
17de6334 9 TFile *pedfile = new TFile("PMD_PED.root");
10
11 if(!pedfile)
12 {
13 printf("ERROR --- NO PEDESTAL (PMD_PED.root) FILE IS FOUND IN THE CURRENT DIRECTORY--- STOP GAIN DA\n");
14 return -3;
15 }
16
17
18 Float_t fPedMeanRMS[2][24][48][96];
19
20 for(Int_t i = 0; i < 2; i++)
21 {
22 for(Int_t j = 0; j < 24; j++)
23 {
24 for(Int_t k = 0; k < 48; k++)
25 {
26 for(Int_t l = 0; l < 96; l++)
27 {
28 fPedMeanRMS[i][j][k][l] = 0.;
29 }
30 }
31 }
32 }
33
34 Int_t det, sm, row, col;
35 Float_t mean, rms;
36
37 TTree *ped =(TTree*)pedfile->Get("ped");
38
39 ped->SetBranchAddress("det",&det);
40 ped->SetBranchAddress("sm",&sm);
41 ped->SetBranchAddress("row",&row);
42 ped->SetBranchAddress("col",&col);
43 ped->SetBranchAddress("mean",&mean);
44 ped->SetBranchAddress("rms",&rms);
45
46 Int_t nentries = (Int_t)ped->GetEntries();
47
48 for (Int_t ient = 0; ient < nentries; ient++)
49 {
50 ped->GetEntry(ient);
51 fPedMeanRMS[det][sm][row][col] = mean + 10.*rms;
52 //printf("Mean= %f, RMS= %f, PedMeanRMS=%f\n",mean,rms,fPedMeanRMS[det][sm][row][col]);
53
54 }
55
56
57 pedfile->Close();
58 delete pedfile;
59 pedfile = 0x0;
60
61
722ccc67 62
63 Int_t xpad, ypad;
64 Float_t xx, yy;
65
66 AliPMDUtility cc;
67 TH2F *h2 = new TH2F("h2","Y vs. X",200,-100.,100.,200,-100.,100.);
68
17de6334 69 TH1F *h1 = new TH1F("h1","",200,0.,200.);
70
722ccc67 71
72 for(Int_t ievt=3; ievt < NEVT; ievt++)
73 {
9f35f7b3 74
17de6334 75 AliRawReaderRoot reader("08000042184000.10.root",ievt);
1f86361b 76
17de6334 77 cout<<" Processing Event No : "<<ievt<<endl;
722ccc67 78
1f86361b 79 AliPMDRawStream stream(&reader);
722ccc67 80
81 Int_t iddl = -1;
17de6334 82
722ccc67 83 while((iddl = stream.DdlData(&pmdddlcont)) >= 0)
84 {
17de6334 85
1f86361b 86 Int_t ientries = pmdddlcont.GetEntries();
722ccc67 87
88 //cout << "iddl = " << iddl << " ientries = " << ientries << endl;
89
1f86361b 90 for (Int_t ient = 0; ient < ientries; ient++)
91 {
92 AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
93
17de6334 94 det = pmdddl->GetDetector();
1f86361b 95 Int_t smn = pmdddl->GetSMN();
17de6334 96 Int_t mcm = pmdddl->GetMCM();
97 Int_t pbus = pmdddl->GetPatchBusId();
1f86361b 98 //Int_t chno = pmdddl->GetChannel();
17de6334 99
100 row = pmdddl->GetRow();
101 col = pmdddl->GetColumn();
1f86361b 102 Int_t sig = pmdddl->GetSignal();
722ccc67 103
17de6334 104 if(mcm == 0) continue;
105
106 Int_t sig1 = sig - (Int_t)fPedMeanRMS[det][smn][row][col];
107
108
109 if (sig1 > 0)
110 sig = sig1;
111 else
112 sig = 0;
113
114 if (ievt == 159 && sig > 0) cout << row << " " << col << " " << sig << endl;
722ccc67 115
116
117 if(smn <12)
118 {
119 xpad = col;
120 ypad = row;
121 }
122 else if(smn >=12 && smn < 24)
123 {
124 xpad = row;
125 ypad = col;
126 }
127
128 if (det == 0)
129 {
130 cc.RectGeomCellPos(smn,xpad,ypad,xx,yy);
17de6334 131 h2->Fill(xx,yy,sig);
132 h1->Fill(sig);
722ccc67 133 }
9f35f7b3 134
1f86361b 135 }
722ccc67 136
17de6334 137 pmdddlcont.Delete();
1f86361b 138 }
722ccc67 139
17de6334 140
722ccc67 141 h2->Draw();
17de6334 142
143
144
145 }
146
147
148
149 cc.SetWriteModule(1);
150 cc.DrawPMDModule();
722ccc67 151 gBenchmark->Show("");
152
153
154}