Modified and updated to be used with this latest code.
[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
55 Float_t fCutAmp = baseline + 2.*noise;
56 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
e8189707 57
e8189707 58
59 AliITSDetType *iDetType=ITS->DetType(1);
60 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
61 if (!res1) {
62 res1=new AliITSresponseSDD();
63 ITS->SetResponseModel(1,res1);
64 }
9c712bc6 65 //res1->SetZeroSupp("2D");
66 res1->SetZeroSupp("1D");
67 res1->SetNoiseParam(noise,baseline);
68 res1->SetDo10to8(kTRUE);
e8189707 69 res1->SetMinVal(4);
9c712bc6 70 res1->SetCompressParam(cp);
71 res1->SetDiffCoeff(3.6,40.);
72 res1->SetMagicValue(96.95);
e8189707 73
74 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
75 if (!seg1) {
76 seg1 = new AliITSsegmentationSDD(geom,res1);
77 ITS->SetSegmentationModel(1,seg1);
78 }
79
80 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
9c712bc6 81 sim1->SetDoFFT(1);
82 sim1->SetCheckNoise(kFALSE);
83
e8189707 84 ITS->SetSimulationModel(1,sim1);
85
86
87
88 // SPD
89
90 AliITSDetType *iDetType=ITS->DetType(0);
91 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
92 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
93 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
94 ITS->SetSimulationModel(0,sim0);
95 // test
9c712bc6 96 //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
97 //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
98 //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
e8189707 99 // end test
100
101
102 // SSD
103
104 AliITSDetType *iDetType=ITS->DetType(2);
105 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
106 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
107 res2->SetSigmaSpread(3.,2.);
108 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
109 ITS->SetSimulationModel(2,sim2);
110
111
112//
113// Event Loop
114//
115
116 Int_t nbgr_ev=0;
117
118 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
119 cout << "nev " <<nev<<endl;
120 Int_t nparticles = gAlice->GetEvent(nev);
121 cout << "nparticles " <<nparticles<<endl;
122 if (nev < evNumber1) continue;
123 if (nparticles <= 0) return;
124
9c712bc6 125 Int_t nbgr_ev=0;
126 if(nsignal) nbgr_ev=Int_t(nev/nsignal);
e8189707 127 ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," ");
e8189707 128 } // event loop
129
9c712bc6 130 delete sim0;
131 delete sim1;
132 delete sim2;
133
134
e8189707 135 file->Close();
136}
137
138
139
140
141
142
143
144
145
146
147
148
149
150