]>
Commit | Line | Data |
---|---|---|
409f8c84 | 1 | #include "iostream.h" |
2 | ||
3 | void ITSHitsToDigitsDubna (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 | } else { | |
18 | delete gAlice; | |
19 | gAlice=0; | |
20 | } | |
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 | |
52 | ||
53 | AliITSDetType *iDetType=ITS->DetType(1); | |
54 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
55 | if (!res1) { | |
56 | res1=new AliITSresponseSDD(); | |
57 | ITS->SetResponseModel(1,res1); | |
58 | } | |
59 | ||
60 | //res1->SetChargeLoss(0.); | |
61 | Float_t baseline; | |
62 | Float_t noise; | |
63 | res1->GetNoiseParam(noise,baseline); | |
64 | Float_t noise_after_el = res1->GetNoiseAfterElectronics(); | |
65 | cout << "noise_after_el: " << noise_after_el << endl; | |
66 | Float_t fCutAmp; | |
67 | fCutAmp = baseline; | |
68 | fCutAmp += (2.*noise_after_el); // noise | |
69 | cout << "Cut amplitude: " << fCutAmp << endl; | |
70 | Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; | |
71 | res1->SetCompressParam(cp); | |
72 | // res1->SetElectronics(2); // 1 = Pascal, 2 = OLA | |
73 | ||
74 | res1->Print(); | |
75 | ||
76 | //cout << "SDD segmentation" << endl; | |
77 | ||
78 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); | |
79 | if (!seg1) { | |
80 | seg1 = new AliITSsegmentationSDD(geom,res1); | |
81 | ITS->SetSegmentationModel(1,seg1); | |
82 | } | |
83 | seg1->Print(); | |
84 | ||
85 | //cout << "SDD segmentation" << endl; | |
86 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
87 | ITS->SetSimulationModel(1,sim1); | |
88 | sim1->Print(); | |
89 | ||
90 | ||
91 | ||
92 | // SPD | |
93 | ||
94 | AliITSDetType *iDetType=ITS->DetType(0); | |
95 | AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); | |
96 | //AliITSresponseSPDdubna *res0 = (AliITSresponseSPDdubna*)iDetType->GetResponseModel(); | |
97 | AliITSresponseSPDdubna *res0 = new AliITSresponseSPDdubna(); | |
98 | ITS->SetResponseModel(0,res0); | |
99 | AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0); | |
100 | ITS->SetSimulationModel(0,sim0); | |
101 | // test | |
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)); | |
105 | // end test | |
106 | ||
107 | ||
108 | // SSD | |
109 | ||
110 | AliITSDetType *iDetType=ITS->DetType(2); | |
111 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); | |
112 | seg2->SetDetSize(72960.,40000.,303.); | |
113 | AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); | |
114 | res2->SetSigmaSpread(3.,2.); | |
115 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
116 | ITS->SetSimulationModel(2,sim2); | |
117 | ||
118 | ||
119 | // | |
120 | // Event Loop | |
121 | // | |
122 | ||
123 | ||
124 | // create the TreeD | |
125 | ||
126 | Int_t nparticles=gAlice->GetEvent(0); | |
127 | printf("Create TreeD \n"); | |
128 | if(!gAlice->TreeD()) gAlice->MakeTree("D"); | |
129 | //make branch | |
130 | ITS->MakeBranch("D"); | |
131 | ||
132 | Int_t nbgr_ev=0; | |
133 | ||
134 | ||
135 | cout<<"Digitizing ITS...\n"; | |
136 | TStopwatch timer; | |
137 | ||
138 | for (Int_t nev=evNumber1; nev<= evNumber2; nev++) { | |
139 | cout << "nev " <<nev<<endl; | |
140 | if(nev>0) { | |
141 | nparticles = gAlice->GetEvent(nev); | |
142 | gAlice->SetEvent(nev); | |
143 | if(!gAlice->TreeD()) gAlice-> MakeTree("D"); | |
144 | ITS->MakeBranch("D"); | |
145 | } | |
146 | cout << "nparticles " <<nparticles<<endl; | |
147 | if (nev < evNumber1) continue; | |
148 | if (nparticles <= 0) return; | |
149 | ||
150 | Int_t nbgr_ev=0; | |
151 | if(nsignal) nbgr_ev=Int_t(nev/nsignal); | |
152 | timer.Start(); | |
153 | ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," "); | |
154 | timer.Stop(); timer.Print(); | |
155 | } // event loop | |
156 | ||
157 | delete sim0; | |
158 | delete sim1; | |
159 | delete sim2; | |
160 | ||
161 | ||
162 | file->Close(); | |
163 | } | |
164 | ||
165 | ||
166 | ||
167 | ||
168 | ||
169 | ||
170 | ||
171 | ||
172 | ||
173 | ||
174 | ||
175 | ||
176 | ||
177 |