]>
Commit | Line | Data |
---|---|---|
e8189707 | 1 | #include "iostream.h" |
2 | ||
3 | void 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(); | |
17 | } | |
18 | ||
19 | ||
20 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
21 | ||
22 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); | |
23 | printf("file %p\n",file); | |
24 | if (file) file->Close(); | |
25 | if (!file) file = new TFile("galice.root","UPDATE"); | |
26 | file->ls(); | |
27 | ||
28 | printf ("I'm after Map \n"); | |
29 | ||
30 | // Get AliRun object from file or create it if not on file | |
31 | ||
32 | if (!gAlice) { | |
33 | gAlice = (AliRun*)file->Get("gAlice"); | |
34 | if (gAlice) printf("AliRun object found on file\n"); | |
35 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
36 | } | |
37 | printf ("I'm after gAlice \n"); | |
38 | ||
39 | AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); | |
40 | if (!ITS) return; | |
41 | ||
42 | ||
43 | // Set the simulation models | |
44 | ||
45 | AliITSgeom *geom = ITS->GetITSgeom(); | |
46 | ||
47 | // SDD | |
48 | // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance | |
49 | ||
50 | Int_t cp[8]={0,0,0,0,0,0,0,0}; | |
51 | ||
52 | AliITSDetType *iDetType=ITS->DetType(1); | |
53 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
54 | if (!res1) { | |
55 | res1=new AliITSresponseSDD(); | |
56 | ITS->SetResponseModel(1,res1); | |
57 | } | |
58 | res1->SetZeroSupp("2D"); | |
59 | //res1->SetZeroSupp("1D"); | |
60 | res1->SetNoiseParam(0.,0.); | |
61 | res1->SetCompressParam(cp); | |
62 | res1->SetMinVal(4); | |
63 | ||
64 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); | |
65 | if (!seg1) { | |
66 | seg1 = new AliITSsegmentationSDD(geom,res1); | |
67 | ITS->SetSegmentationModel(1,seg1); | |
68 | } | |
69 | ||
70 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
71 | ITS->SetSimulationModel(1,sim1); | |
72 | ||
73 | ||
74 | ||
75 | // SPD | |
76 | ||
77 | AliITSDetType *iDetType=ITS->DetType(0); | |
78 | AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); | |
79 | AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel(); | |
80 | AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); | |
81 | ITS->SetSimulationModel(0,sim0); | |
82 | // test | |
83 | printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); | |
84 | printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); | |
85 | printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); | |
86 | // end test | |
87 | ||
88 | ||
89 | // SSD | |
90 | ||
91 | AliITSDetType *iDetType=ITS->DetType(2); | |
92 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); | |
93 | AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); | |
94 | res2->SetSigmaSpread(3.,2.); | |
95 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
96 | ITS->SetSimulationModel(2,sim2); | |
97 | ||
98 | ||
99 | // | |
100 | // Event Loop | |
101 | // | |
102 | ||
103 | Int_t nbgr_ev=0; | |
104 | ||
105 | for (Int_t nev=evNumber1; nev<= evNumber2; nev++) { | |
106 | cout << "nev " <<nev<<endl; | |
107 | Int_t nparticles = gAlice->GetEvent(nev); | |
108 | cout << "nparticles " <<nparticles<<endl; | |
109 | if (nev < evNumber1) continue; | |
110 | if (nparticles <= 0) return; | |
111 | ||
112 | Int_t nbgr_ev=Int_t(nev/nsignal); | |
113 | //printf("nbgr_ev %d\n",nbgr_ev); | |
114 | ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," "); | |
115 | //ITS->HitsToDigits(nev,nbgr_ev,size," ","SDD"," "); | |
116 | } // event loop | |
117 | ||
118 | file->Close(); | |
119 | } | |
120 | ||
121 | ||
122 | ||
123 | ||
124 | ||
125 | ||
126 | ||
127 | ||
128 | ||
129 | ||
130 | ||
131 | ||
132 | ||
133 |