]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSHitsToDigits.C
Update response parameters for SDD and introduce lookup table for signal generation...
[u/mrichter/AliRoot.git] / ITS / ITSHitsToDigits.C
CommitLineData
e8189707 1#include "iostream.h"
2
3void ITSHitsToDigits (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal =25, Int_t size=-1)
4{
5/////////////////////////////////////////////////////////////////////////
6// This macro is a small example of a ROOT macro
7// illustrating how to read the output of GALICE
8// and do some analysis.
9//
10/////////////////////////////////////////////////////////////////////////
11
12// Dynamically link some shared libs
13
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
16 loadlibs();
9c712bc6 17 } else {
18 delete gAlice;
19 gAlice=0;
20 }
e8189707 21
22
23// Connect the Root Galice file containing Geometry, Kine and Hits
24
25 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
26 printf("file %p\n",file);
27 if (file) file->Close();
28 if (!file) file = new TFile("galice.root","UPDATE");
29 file->ls();
30
31 printf ("I'm after Map \n");
32
33// Get AliRun object from file or create it if not on file
34
35 if (!gAlice) {
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
39 }
40 printf ("I'm after gAlice \n");
41
42 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
43 if (!ITS) return;
44
45
46 // Set the simulation models
47
48 AliITSgeom *geom = ITS->GetITSgeom();
49
50 // SDD
51 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
9c712bc6 52 Float_t baseline = 10.;
53 Float_t noise = 1.75;
54
b9381d0c 55
af4af6f5 56 AliITSDetType *iDetType=ITS->DetType(1);
57 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
58 if (!res1) {
59 res1=new AliITSresponseSDD();
60 ITS->SetResponseModel(1,res1);
61 }
b9381d0c 62 res1->SetMagicValue(900.);
63
64 Float_t maxadc = res1->MaxAdc();
6bfd27fa 65 Float_t topValue = res1->MagicValue();
66 Float_t norm = maxadc/topValue;
67
9c712bc6 68 Float_t fCutAmp = baseline + 2.*noise;
6bfd27fa 69 fCutAmp *= norm;
9c712bc6 70 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
b9381d0c 71
9c712bc6 72 //res1->SetZeroSupp("2D");
73 res1->SetZeroSupp("1D");
74 res1->SetNoiseParam(noise,baseline);
75 res1->SetDo10to8(kTRUE);
e8189707 76 res1->SetMinVal(4);
9c712bc6 77 res1->SetCompressParam(cp);
78 res1->SetDiffCoeff(3.6,40.);
e8189707 79
80 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
81 if (!seg1) {
82 seg1 = new AliITSsegmentationSDD(geom,res1);
83 ITS->SetSegmentationModel(1,seg1);
84 }
85
86 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
9c712bc6 87 sim1->SetDoFFT(1);
88 sim1->SetCheckNoise(kFALSE);
89
e8189707 90 ITS->SetSimulationModel(1,sim1);
91
92
93
94 // SPD
95
96 AliITSDetType *iDetType=ITS->DetType(0);
97 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
98 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
99 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
100 ITS->SetSimulationModel(0,sim0);
101 // test
9c712bc6 102 //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
103 //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
104 //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
e8189707 105 // end test
106
107
108 // SSD
109
110 AliITSDetType *iDetType=ITS->DetType(2);
111 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
112 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
113 res2->SetSigmaSpread(3.,2.);
114 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
115 ITS->SetSimulationModel(2,sim2);
116
117
118//
119// Event Loop
120//
121
e8189707 122
a939f834 123 // create the TreeD
124
125 Int_t nparticles=gAlice->GetEvent(0);
126 printf("Create TreeD \n");
629ed79f 127 if(!gAlice->TreeD()) gAlice->MakeTree("D");
a939f834 128 printf("TreeD %p\n",gAlice->TreeD());
129 //make branch
130 ITS->MakeBranch("D");
131
132 Int_t nbgr_ev=0;
e53d0fac 133
134
135 cout<<"Digitizing ITS...\n";
136 TStopwatch timer;
137
e8189707 138 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
139 cout << "nev " <<nev<<endl;
a939f834 140 if(nev>0) {
141 nparticles = gAlice->GetEvent(nev);
142 gAlice->SetEvent(nev);
629ed79f 143 if(!gAlice->TreeD()) gAlice-> MakeTree("D");
a939f834 144 ITS->MakeBranch("D");
145 }
e8189707 146 cout << "nparticles " <<nparticles<<endl;
147 if (nev < evNumber1) continue;
148 if (nparticles <= 0) return;
149
9c712bc6 150 Int_t nbgr_ev=0;
151 if(nsignal) nbgr_ev=Int_t(nev/nsignal);
e53d0fac 152 timer.Start();
e8189707 153 ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," ");
e53d0fac 154 timer.Stop(); timer.Print();
e8189707 155 } // event loop
156
9c712bc6 157 delete sim0;
158 delete sim1;
159 delete sim2;
160
161
e8189707 162 file->Close();
163}
164
165
166
167
168
169
170
171
172
173
174
175
176
177