]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHv3.cxx
all old staff moved to v3
[u/mrichter/AliRoot.git] / RICH / AliRICHv3.cxx
CommitLineData
9123a941 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
9d6c0962 16
7118aef0 17#include <Riostream.h>
9123a941 18
88cb7938 19#include <TBRIK.h>
20#include <TGeometry.h>
9d6c0962 21#include <TLorentzVector.h>
88cb7938 22#include <TNode.h>
9d6c0962 23#include <TParticle.h>
88cb7938 24#include <TVector3.h>
25#include <TVirtualMC.h>
cd1cf354 26#include <TPDGCode.h> //for kNuetron
c021cb15 27#include <TCanvas.h>
28#include <TF1.h>
29#include <TH1.h>
30#include <TH2.h>
31#include <TStyle.h>
9d6c0962 32
88cb7938 33#include "AliConst.h"
34#include "AliMagF.h"
35#include "AliPDG.h"
ae714751 36#include "AliRICHGeometry.h"
88cb7938 37#include "AliRICHResponseV0.h"
38#include "AliRICHSegmentationV1.h"
39#include "AliRICHv3.h"
40#include "AliRun.h"
c021cb15 41#include "AliRICHRecHit3D.h"
42#include "AliRICHRawCluster.h"
43#include "AliRICHDigit.h"
44#include "AliRICHRecHit1D.h"
45
ae714751 46
9d6c0962 47ClassImp(AliRICHv3)
ae714751 48
9d6c0962 49//______________________________________________________________
50// Implementation of the RICH version 3 with azimuthal rotation
9123a941 51
9123a941 52
9d6c0962 53AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
54 :AliRICH(sName,sTitle)
9123a941 55{
9d6c0962 56// The named ctor currently creates a single copy of
57// AliRICHGeometry AliRICHSegmentationV1 AliRICHResponseV0
58// and initialises the corresponding models of all 7 chambers with these stuctures.
59// Note: all chambers share the single copy of models. MUST be changed later (???).
cd1cf354 60 if(GetDebug())Info("named ctor","Start.");
9123a941 61
cd1cf354 62 fCkovNumber=fFreonProd=0;
ae714751 63
9d6c0962 64 AliRICHGeometry *pRICHGeometry =new AliRICHGeometry; // ??? to be moved to AlRICHChamber::named ctor
65 AliRICHSegmentationV1 *pRICHSegmentation=new AliRICHSegmentationV1; // ??? to be moved to AlRICHChamber::named ctor
66 AliRICHResponseV0 *pRICHResponse =new AliRICHResponseV0; // ??? to be moved to AlRICHChamber::named ctor
ae714751 67
c021cb15 68 for (Int_t i=1; i<=kNCH; i++){
ae714751 69 SetGeometryModel(i,pRICHGeometry);
70 SetSegmentationModel(i,pRICHSegmentation);
71 SetResponseModel(i,pRICHResponse);
c021cb15 72 C(i)->Init(i); // ??? to be removed
9123a941 73 }
cd1cf354 74 if(GetDebug())Info("named ctor","Stop.");
9123a941 75}//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
76
9d6c0962 77AliRICHv3::~AliRICHv3()
78{
79// Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
cd1cf354 80 if(GetDebug()) cout<<ClassName()<<"::dtor()>\n";
9d6c0962 81
00ec1fc7 82 if(fChambers) {
c021cb15 83 AliRICHChamber *ch =C(1);
00ec1fc7 84 if(ch) {
85 delete ch->GetGeometryModel();
86 delete ch->GetResponseModel();
87 delete ch->GetSegmentationModel();
88 }
89 }
9d6c0962 90}//AliRICHv3::dtor()
91
9123a941 92
93void AliRICHv3::CreateGeometry()
94{
9d6c0962 95// Provides geometry structure for simulation (currently GEANT volumes tree)
cd1cf354 96 if(GetDebug()) cout<<ClassName()<<"::CreateGeometry()>\n";
9123a941 97
98 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
99 AliRICHSegmentationV0* segmentation;
100 AliRICHGeometry* geometry;
101 AliRICHChamber* iChamber;
102
103 iChamber = &(pRICH->Chamber(0));
cc23c5c6 104 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
9123a941 105 geometry=iChamber->GetGeometryModel();
106
107 Float_t distance;
108 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
109 geometry->SetRadiatorToPads(distance);
110
111 //Opaque quartz thickness
112 Float_t oqua_thickness = .5;
113 //CsI dimensions
114
115
116 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
117 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
118
119
120 Int_t *idtmed = fIdtmed->GetArray()-999;
121
122 Int_t i;
123 Float_t zs;
124 Int_t idrotm[1099];
125 Float_t par[3];
126
127 // --- Define the RICH detector
128 // External aluminium box
129 par[0] = 68.8;
130 par[1] = 13; //Original Settings
131 par[2] = 70.86;
132 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
133
134 // Air
135 par[0] = 66.3;
136 par[1] = 13; //Original Settings
137 par[2] = 68.35;
138 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
139
140 // Air 2 (cutting the lower part of the box)
141
142 par[0] = 1.25;
143 par[1] = 3; //Original Settings
144 par[2] = 70.86;
145 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
146
147 // Air 3 (cutting the lower part of the box)
148
149 par[0] = 66.3;
150 par[1] = 3; //Original Settings
151 par[2] = 1.2505;
152 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
153
154 // Honeycomb
155 par[0] = 66.3;
156 par[1] = .188; //Original Settings
157 par[2] = 68.35;
158 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
159
160 // Aluminium sheet
161 par[0] = 66.3;
162 par[1] = .025; //Original Settings
163 par[2] = 68.35;
164 /*par[0] = 66.5;
165 par[1] = .025;
166 par[2] = 63.1;*/
167 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
168
169 // Quartz
170 par[0] = geometry->GetQuartzWidth()/2;
171 par[1] = geometry->GetQuartzThickness()/2;
172 par[2] = geometry->GetQuartzLength()/2;
173 gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
174
175 // Spacers (cylinders)
176 par[0] = 0.;
177 par[1] = .5;
178 par[2] = geometry->GetFreonThickness()/2;
179 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
180
181 // Feet (freon slabs supports)
182
183 par[0] = .7;
184 par[1] = .3;
185 par[2] = 1.9;
186 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
187
188 // Opaque quartz
189 par[0] = geometry->GetQuartzWidth()/2;
190 par[1] = .2;
191 par[2] = geometry->GetQuartzLength()/2;
192 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
193
194 // Frame of opaque quartz
195 par[0] = geometry->GetOuterFreonWidth()/2;
196 par[1] = geometry->GetFreonThickness()/2;
197 par[2] = geometry->GetOuterFreonLength()/2;
198 gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
199
200 par[0] = geometry->GetInnerFreonWidth()/2;
201 par[1] = geometry->GetFreonThickness()/2;
202 par[2] = geometry->GetInnerFreonLength()/2;
203 gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
204
205
206 // Freon
207 par[0] = geometry->GetOuterFreonWidth()/2 - oqua_thickness;
208 par[1] = geometry->GetFreonThickness()/2;
209 par[2] = geometry->GetOuterFreonLength()/2 - 2*oqua_thickness;
210 gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
211
212 par[0] = geometry->GetInnerFreonWidth()/2 - oqua_thickness;
213 par[1] = geometry->GetFreonThickness()/2;
214 par[2] = geometry->GetInnerFreonLength()/2 - 2*oqua_thickness;
215 gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);
216
217 // Methane
218 par[0] = csi_width/2;
219 par[1] = geometry->GetGapThickness()/2;
220 par[2] = csi_length/2;
221 gMC->Gsvolu("META", "BOX ", idtmed[1004], par, 3);
222
223 // Methane gap
224 par[0] = csi_width/2;
225 par[1] = geometry->GetProximityGapThickness()/2;
226 par[2] = csi_length/2;
227 gMC->Gsvolu("GAP ", "BOX ", idtmed[1008], par, 3);
228
229 // CsI photocathode
230 par[0] = csi_width/2;
231 par[1] = .25;
232 par[2] = csi_length/2;
233 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
234
235 // Anode grid
236 par[0] = 0.;
237 par[1] = .001;
238 par[2] = 20.;
239 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
240
241 // Wire supports
242 // Bar of metal
243
244 par[0] = csi_width/2;
245 par[1] = 1.05;
246 par[2] = 1.05;
247 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
248
249 // Ceramic pick up (base)
250
251 par[0] = csi_width/2;
252 par[1] = .25;
253 par[2] = 1.05;
254 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
255
256 // Ceramic pick up (head)
257
258 par[0] = csi_width/2;
259 par[1] = .1;
260 par[2] = .1;
261 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
262
263 // Aluminium supports for methane and CsI
264 // Short bar
265
266 par[0] = csi_width/2;
267 par[1] = geometry->GetGapThickness()/2 + .25;
268 par[2] = (68.35 - csi_length/2)/2;
269 gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
270
271 // Long bar
272
273 par[0] = (66.3 - csi_width/2)/2;
274 par[1] = geometry->GetGapThickness()/2 + .25;
275 par[2] = csi_length/2 + 68.35 - csi_length/2;
276 gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
277
278 // Aluminium supports for freon
279 // Short bar
280
281 par[0] = geometry->GetQuartzWidth()/2;
282 par[1] = .3;
283 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
284 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
285
286 // Long bar
287
288 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
289 par[1] = .3;
290 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
291 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
292
293 // PCB backplane
294
295 par[0] = csi_width/2;
296 par[1] = .25;
297 par[2] = csi_length/4 -.5025;
298 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
299
300
301 // Backplane supports
302
303 // Aluminium slab
304
305 par[0] = 33.15;
306 par[1] = 2;
307 par[2] = 21.65;
308 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
309
310 // Big hole
311
312 par[0] = 9.05;
313 par[1] = 2;
314 par[2] = 4.4625;
315 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
316
317 // Small hole
318
319 par[0] = 5.7;
320 par[1] = 2;
321 par[2] = 4.4625;
322 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
323
324 // Place holes inside backplane support
325
326 gMC->Gspos("BKHS", 1, "BACK", .8 + 5.7,0., .6 + 4.4625, 0, "ONLY");
327 gMC->Gspos("BKHS", 2, "BACK", -.8 - 5.7,0., .6 + 4.4625, 0, "ONLY");
328 gMC->Gspos("BKHS", 3, "BACK", .8 + 5.7,0., -.6 - 4.4625, 0, "ONLY");
329 gMC->Gspos("BKHS", 4, "BACK", -.8 - 5.7,0., -.6 - 4.4625, 0, "ONLY");
330 gMC->Gspos("BKHS", 5, "BACK", .8 + 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
331 gMC->Gspos("BKHS", 6, "BACK", -.8 - 5.7,0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
332 gMC->Gspos("BKHS", 7, "BACK", .8 + 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
333 gMC->Gspos("BKHS", 8, "BACK", -.8 - 5.7,0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
334 gMC->Gspos("BKHL", 1, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., .6 + 4.4625, 0, "ONLY");
335 gMC->Gspos("BKHL", 2, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 4.4625, 0, "ONLY");
336 gMC->Gspos("BKHL", 3, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 4.4625, 0, "ONLY");
337 gMC->Gspos("BKHL", 4, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 4.4625, 0, "ONLY");
338 gMC->Gspos("BKHL", 5, "BACK", .8 + 11.4+ 1.6 + 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
339 gMC->Gspos("BKHL", 6, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., .6 + 8.925 + 1.2 + 4.4625, 0, "ONLY");
340 gMC->Gspos("BKHL", 7, "BACK", .8 + 11.4 + 1.6 + 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
341 gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
342
343
344
345 // --- Places the detectors defined with GSVOLU
346 // Place material inside RICH
347 gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
348 gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
349 gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
350 gMC->Gspos("AIR3", 1, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
351 gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 68.35 + 1.25, 0, "ONLY");
352
353
354 gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
355 gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
356 gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
357 gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
358 gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
359 gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
360 gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, 36.9, 0, "ONLY");
361 gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
362 gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
363 gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
364 gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .4 - .3, -36.9, 0, "ONLY");
365 gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()- .2, 0., 0, "ONLY");
366
367 // Supports placing
368
369 // Methane supports
370 gMC->Gspos("SMLG", 1, "SRIC", csi_width/2 + (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
371 gMC->Gspos("SMLG", 2, "SRIC", - csi_width/2 - (66.3 - csi_width/2)/2, 1.276 + .25, 0., 0, "ONLY");
372 gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, csi_length/2 + (68.35 - csi_length/2)/2, 0, "ONLY");
373 gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - csi_length/2 - (68.35 - csi_length/2)/2, 0, "ONLY");
374
375 //Freon supports
376
377 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
378
379 gMC->Gspos("SFLG", 1, "SRIC", geometry->GetQuartzWidth()/2 + (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
380 gMC->Gspos("SFLG", 2, "SRIC", - geometry->GetQuartzWidth()/2 - (66.3 - geometry->GetQuartzWidth()/2)/2, supp_y, 0., 0, "ONLY");
381 gMC->Gspos("SFSH", 1, "SRIC", 0., supp_y, geometry->GetQuartzLength()/2 + (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
382 gMC->Gspos("SFSH", 2, "SRIC", 0., supp_y, - geometry->GetQuartzLength()/2 - (68.35 - geometry->GetQuartzLength()/2)/2, 0, "ONLY");
383
384 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
385
386
387 Int_t nspacers = 30;
388
389 for (i = 0; i < nspacers/3; i++) {
390 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
391 gMC->Gspos("SPAC", i, "FRE1", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
392 }
393
394 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
395 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
396 gMC->Gspos("SPAC", i, "FRE1", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
397 }
398
399 for (i = (nspacers*2)/3; i < nspacers; ++i) {
400 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
401 gMC->Gspos("SPAC", i, "FRE1", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
402 }
403
404 for (i = 0; i < nspacers/3; i++) {
405 zs = -11.6/2 + (TMath::Abs(nspacers/6) - i) * 12.2;
406 gMC->Gspos("SPAC", i, "FRE2", 10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
407 }
408
409 for (i = nspacers/3; i < (nspacers*2)/3; i++) {
410 zs = -11.6/2 + (nspacers/3 + TMath::Abs(nspacers/6) - i) * 12.2;
411 gMC->Gspos("SPAC", i, "FRE2", 0, 0., zs, idrotm[1019], "ONLY"); //Original settings
412 }
413
414 for (i = (nspacers*2)/3; i < nspacers; ++i) {
415 zs = -11.6/2 + ((nspacers*2)/3 + TMath::Abs(nspacers/6) - i) * 12.2;
416 gMC->Gspos("SPAC", i, "FRE2", -10.5, 0., zs, idrotm[1019], "ONLY"); //Original settings
417 }
418
419
420 gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
421 gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
422 gMC->Gspos("OQF1", 1, "SRIC", geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2 + 2, 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
423 gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings
424 gMC->Gspos("OQF1", 3, "SRIC", - (geometry->GetOuterFreonWidth()/2 + geometry->GetInnerFreonWidth()/2) - 2, 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness() - geometry->GetFreonThickness()/2, 0., 0, "ONLY"); //Original settings (-31.3)
425 gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - geometry->GetGapThickness()/2 - geometry->GetQuartzThickness()/2, 0., 0, "ONLY");
426 gMC->Gspos("GAP ", 1, "META", 0., geometry->GetGapThickness()/2 - geometry->GetProximityGapThickness()/2 - 0.0001, 0., 0, "ONLY");
427 gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
428 gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + geometry->GetGapThickness()/2 + .25, 0., 0, "ONLY");
429 printf("CSI pos: %f\n",1.276 + geometry->GetGapThickness()/2 + .25);
430
431 // Wire support placing
432
433 gMC->Gspos("WSG2", 1, "GAP ", 0., geometry->GetProximityGapThickness()/2 - .1, 0., 0, "ONLY");
434 gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
435 gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
436
437 // Backplane placing
438
439 gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
440 gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
441 gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
442 gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
443 gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
444 gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + geometry->GetGapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
445
446 // PCB placing
447
448 gMC->Gspos("PCB ", 1, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, csi_width/4 + .5025 + 2.5, 0, "ONLY");
449 gMC->Gspos("PCB ", 2, "SRIC ", 0., 1.276 + geometry->GetGapThickness()/2 + .5 + 1.05, -csi_width/4 - .5025 - 2.5, 0, "ONLY");
450
451// Place chambers into mother volume ALIC
452
9d6c0962 453 Double_t dOffset = geometry->GetOffset() - geometry->GetGapThickness()/2; // distance from center of mother volume ALIC to methane
454
455 Double_t dAlpha = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
456 Double_t dAlphaRad = dAlpha*kDegrad;
457
458 Double_t dBeta = geometry->GetBetaAngle(); // angle between center of chambers - y-x plane
459 Double_t dBetaRad = dBeta*kDegrad;
460
461 Double_t dRotAngle = geometry->GetRotationAngle(); // the whole RICH is to be rotated in x-y plane + means clockwise rotation
462 Double_t dRotAngleRad = dRotAngle*kDegrad;
9d6c0962 463
4b7382d1 464
9d6c0962 465 TRotMatrix *pRotMatrix; // tmp pointer
466
467 TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
468
9123a941 469// Chamber 0 standalone (no other chambers in this row)
4b7382d1 470 pRotMatrix = new TRotMatrix("rot993","rot993", 0., 0., 0.,0.,0.,0.);
471 const Double_t* r = pRotMatrix->SetAngles(90., 0., 90.-dAlpha , 90., dAlpha, -90.);
472 Double_t* rr = RotateXY(r, -dRotAngleRad);
473 AliMatrix(idrotm[1000], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
474 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9123a941 475
9d6c0962 476 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
477 vector.RotateZ(-dRotAngleRad);
9123a941 478
9d6c0962 479 gMC->Gspos("RICH",1,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1000], "ONLY");
480 Chamber(0).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 481 if(GetDebug()) Info("CreateGeometry 0","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
482 if(GetDebug()) Info("CreateGeometry 0","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 483// Chamber 1
4b7382d1 484 pRotMatrix = new TRotMatrix("rot994","rot994", 0., 0., 0.,0.,0.,0.);
485 r = pRotMatrix->SetAngles(90., -dBeta, 90., 90.-dBeta, 0., 0.);
486 rr = RotateXY(r, -dRotAngleRad);
487 AliMatrix(idrotm[1001], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
488 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 489 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
490 vector.RotateZ(-dRotAngleRad);
9123a941 491
9d6c0962 492 gMC->Gspos("RICH",2,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1001], "ONLY");
493 Chamber(1).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 494 if(GetDebug()) Info("CreateGeometry 1","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
495 if(GetDebug()) Info("CreateGeometry 1","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 496// Chamber 2 the top one with no Alpha-Beta rotation
4b7382d1 497 pRotMatrix = new TRotMatrix("rot995","rot995", 0., 0., 0.,0.,0.,0.);
498 r = pRotMatrix->SetAngles(90., 0., 90., 90., 0., 0.);
499 rr = RotateXY(r, -dRotAngleRad);
500 AliMatrix(idrotm[1002], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
501 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 502 vector.SetXYZ(0,dOffset,0);
503 vector.RotateZ(-dRotAngleRad);
9d6c0962 504 gMC->Gspos("RICH",3,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1002], "ONLY");
505 Chamber(2).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 506 if(GetDebug()) Info("CreateGeometry 2","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
507 if(GetDebug()) Info("CreateGeometry 2","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 508// Chamber 3
4b7382d1 509 pRotMatrix = new TRotMatrix("rot996","rot996", 0., 0., 0.,0.,0.,0.);
510 r = pRotMatrix->SetAngles(90., dBeta, 90., 90.+dBeta, 0., 0.);
511 rr = RotateXY(r, -dRotAngleRad);
512 AliMatrix(idrotm[1003], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
513 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 514 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
515 vector.RotateZ(-dRotAngleRad);
9123a941 516
9d6c0962 517 gMC->Gspos("RICH",4,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1003], "ONLY");
518 Chamber(3).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 519 if(GetDebug()) Info("CreateGeometry 3","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
520 if(GetDebug()) Info("CreateGeometry 3","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 521// Chamber 4
4b7382d1 522 pRotMatrix = new TRotMatrix("rot997","rot997", 0., 0., 0.,0.,0.,0.);
523 r = pRotMatrix->SetAngles(90., 360.-dBeta, 108.2, 90.-dBeta, 18.2, 90.-dBeta);
524 rr = RotateXY(r, -dRotAngleRad);
525 AliMatrix(idrotm[1004], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
526 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 527 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
528 vector.RotateZ(-dRotAngleRad);
9123a941 529
9d6c0962 530 gMC->Gspos("RICH",5,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1004], "ONLY");
531 Chamber(4).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 532 if(GetDebug()) Info("CreateGeometry 4","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
533 if(GetDebug()) Info("CreateGeometry 4","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 534// Chamber 5
4b7382d1 535 pRotMatrix = new TRotMatrix("rot998","rot998", 0., 0., 0.,0.,0.,0.);
536 r = pRotMatrix->SetAngles(90., 0., 90.+dAlpha, 90., dAlpha, 90.);
537 rr = RotateXY(r, -dRotAngleRad);
538 AliMatrix(idrotm[1005], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
539 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
9d6c0962 540 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
541 vector.RotateZ(-dRotAngleRad);
542
543 gMC->Gspos("RICH",6,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1005], "ONLY");
544 Chamber(5).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 545 if(GetDebug()) Info("CreateGeometry 5","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
546 if(GetDebug()) Info("CreateGeometry 5","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
4b7382d1 547// Chamber 6
548 pRotMatrix = new TRotMatrix("rot999","rot999", 0., 0., 0.,0.,0.,0.);
549 r = pRotMatrix->SetAngles(90., dBeta, 108.2, 90.+dBeta, 18.2, 90.+dBeta);
550 rr = RotateXY(r, -dRotAngleRad);
551 AliMatrix(idrotm[1006], rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
552 pRotMatrix->SetAngles(rr[0], rr[1], rr[2], rr[3], rr[4], rr[5]);
698656f6 553 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
9d6c0962 554 vector.RotateZ(-dRotAngleRad);
555
556 gMC->Gspos("RICH",7,"ALIC",vector.X(),vector.Y(),vector.Z(),idrotm[1006], "ONLY");
557 Chamber(6).SetChamberTransform(vector.X(),vector.Y(),vector.Z(),pRotMatrix);
e1826cc2 558 if(GetDebug()) Info("CreateGeometry 6","%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f",rr[0],rr[1],rr[2],rr[3],rr[4],rr[5]);
559 if(GetDebug()) Info("CreateGeometry 6","x=%8.3f y=%8.3f z=%8.3f",vector.X(),vector.Y(),vector.Z());
9123a941 560
561}//void AliRICHv3::CreateGeometry()
e1826cc2 562//______________________________________________________________________________
9123a941 563void AliRICHv3::Init()
cd1cf354 564{//Makes nothing for a while
565 if(GetDebug())Info("Init","Start.");
566 if(GetDebug())Info("Init","Stop.");
9123a941 567}
e1826cc2 568//______________________________________________________________________________
9123a941 569void AliRICHv3::BuildGeometry()
cd1cf354 570{//Provides geometry structure for event display (ROOT TNode tree)
571 if(GetDebug())Info("BuildGeometry","Start.");
9123a941 572
573 TNode *node, *subnode, *top;
574
575 const int kColorRICH = kRed;
576 //
577 top=gAlice->GetGeometry()->GetNode("alice");
578
579 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
9123a941 580 AliRICHChamber* iChamber;
581 AliRICHGeometry* geometry;
582
583 iChamber = &(pRICH->Chamber(0));
cc23c5c6 584 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel();
9123a941 585 geometry=iChamber->GetGeometryModel();
586
587 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
588
589 Float_t padplane_width = segmentation->GetPadPlaneWidth();
590 Float_t padplane_length = segmentation->GetPadPlaneLength();
591
592
593 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
594
595// Chamber 0
596 top->cd();
597 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
598 node->SetLineColor(kColorRICH);
599 node->cd();
600 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
601 subnode->SetLineColor(kGreen);
602 fNodes->Add(subnode);
603 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
604 subnode->SetLineColor(kGreen);
605 fNodes->Add(subnode);
606 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
607 subnode->SetLineColor(kGreen);
608 fNodes->Add(subnode);
609 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
610 subnode->SetLineColor(kGreen);
611 fNodes->Add(subnode);
612 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
613 subnode->SetLineColor(kGreen);
614 fNodes->Add(subnode);
615 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
616 subnode->SetLineColor(kGreen);
617 fNodes->Add(subnode);
618 fNodes->Add(node);
619
620// Chamber 1
621 top->cd();
622 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
623 node->SetLineColor(kColorRICH);
624 node->cd();
625 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
626 subnode->SetLineColor(kGreen);
627 fNodes->Add(subnode);
628 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
629 subnode->SetLineColor(kGreen);
630 fNodes->Add(subnode);
631 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
632 subnode->SetLineColor(kGreen);
633 fNodes->Add(subnode);
634 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
635 subnode->SetLineColor(kGreen);
636 fNodes->Add(subnode);
637 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
638 subnode->SetLineColor(kGreen);
639 fNodes->Add(subnode);
640 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
641 subnode->SetLineColor(kGreen);
642 fNodes->Add(subnode);
643 fNodes->Add(node);
644
645// Chamber 2
646 top->cd();
647 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
648 node->SetLineColor(kColorRICH);
649 node->cd();
650 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
651 subnode->SetLineColor(kGreen);
652 fNodes->Add(subnode);
653 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
654 subnode->SetLineColor(kGreen);
655 fNodes->Add(subnode);
656 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
657 subnode->SetLineColor(kGreen);
658 fNodes->Add(subnode);
659 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
660 subnode->SetLineColor(kGreen);
661 fNodes->Add(subnode);
662 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
663 subnode->SetLineColor(kGreen);
664 fNodes->Add(subnode);
665 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
666 subnode->SetLineColor(kGreen);
667 fNodes->Add(subnode);
668 fNodes->Add(node);
669
670// Chamber 3
671 top->cd();
672 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
673 node->SetLineColor(kColorRICH);
674 node->cd();
675 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
676 subnode->SetLineColor(kGreen);
677 fNodes->Add(subnode);
678 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
679 subnode->SetLineColor(kGreen);
680 fNodes->Add(subnode);
681 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
682 subnode->SetLineColor(kGreen);
683 fNodes->Add(subnode);
684 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
685 subnode->SetLineColor(kGreen);
686 fNodes->Add(subnode);
687 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
688 subnode->SetLineColor(kGreen);
689 fNodes->Add(subnode);
690 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
691 subnode->SetLineColor(kGreen);
692 fNodes->Add(subnode);
693 fNodes->Add(node);
694
695// Chamber 4
696 top->cd();
697 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
698 node->SetLineColor(kColorRICH);
699 node->cd();
700 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
701 subnode->SetLineColor(kGreen);
702 fNodes->Add(subnode);
703 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
704 subnode->SetLineColor(kGreen);
705 fNodes->Add(subnode);
706 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
707 subnode->SetLineColor(kGreen);
708 fNodes->Add(subnode);
709 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
710 subnode->SetLineColor(kGreen);
711 fNodes->Add(subnode);
712 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
713 subnode->SetLineColor(kGreen);
714 fNodes->Add(subnode);
715 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
716 subnode->SetLineColor(kGreen);
717 fNodes->Add(subnode);
718 fNodes->Add(node);
719
720// Chamber 5
721 top->cd();
722 node = new TNode("RICH6","RICH6","S_RICH",Chamber(5).GetX(),Chamber(5).GetY(),Chamber(5).GetZ(),"rot998");
723 node->SetLineColor(kColorRICH);
724 fNodes->Add(node);node->cd();
725 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
726 subnode->SetLineColor(kGreen);
727 fNodes->Add(subnode);
728 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
729 subnode->SetLineColor(kGreen);
730 fNodes->Add(subnode);
731 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
732 subnode->SetLineColor(kGreen);
733 fNodes->Add(subnode);
734 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
735 subnode->SetLineColor(kGreen);
736 fNodes->Add(subnode);
737 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
738 subnode->SetLineColor(kGreen);
739 fNodes->Add(subnode);
740 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
741 subnode->SetLineColor(kGreen);
742 fNodes->Add(subnode);
743
744// Chamber 6
745 top->cd();
746 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
747 node->SetLineColor(kColorRICH);
748 node->cd();
749 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
750 subnode->SetLineColor(kGreen);
751 fNodes->Add(subnode);
752 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,padplane_length/2 + segmentation->DeadZone()/2,"");
753 subnode->SetLineColor(kGreen);
754 fNodes->Add(subnode);
755 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,padplane_length/2 + segmentation->DeadZone()/2,"");
756 subnode->SetLineColor(kGreen);
757 fNodes->Add(subnode);
758 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",padplane_width + segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
759 subnode->SetLineColor(kGreen);
760 fNodes->Add(subnode);
761 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-padplane_length/2 - segmentation->DeadZone()/2,"");
762 subnode->SetLineColor(kGreen);
763 fNodes->Add(subnode);
764 subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-padplane_width - segmentation->DeadZone(),5,-padplane_length/2 - segmentation->DeadZone()/2,"");
765 subnode->SetLineColor(kGreen);
766 fNodes->Add(subnode);
767 fNodes->Add(node);
cd1cf354 768 if(GetDebug())Info("BuildGeometry","Stop.");
9123a941 769}//AliRICHv3::BuildGeometry()
e1826cc2 770//______________________________________________________________________________
4b7382d1 771Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
772{
773 // Rotatation in xy-plane
774 // by angle a
775 // The resulting rotation matrix is given back in the G3 notation.
776 Double_t* rr = new Double_t[6];
777 Double_t m[9];
778 Int_t i,j,k;
779
780 for (i = 0; i < 3; i++) {
781 j = 3*i;
782 m[j] = r[j] * TMath::Cos(a) - r[j+1] * TMath::Sin(a);
783 m[j+1] = r[j] * TMath::Sin(a) + r[j+1] * TMath::Cos(a);
784 m[j+2] = r[j+2];
785 }
786
787 for (i = 0; i < 3; i++) {
788 j = 3*i;
789 k = 2*i;
790 rr[k] = TMath::ACos(m[j+2]) * kRaddeg;
791 rr[k+1] = TMath::ATan2(m[j+1], m[j]) * kRaddeg;
792 }
793 return rr;
e1826cc2 794}//Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
cd1cf354 795//______________________________________________________________________________
796void AliRICHv3::StepManager()
797{//Full Step Manager
798
799 Int_t copy, id;
800 static Int_t idvol;
801 static Int_t vol[2];
802 Int_t ipart;
803 static Float_t hits[22];
804 static Float_t ckovData[19];
805 TLorentzVector position;
806 TLorentzVector momentum;
807 Float_t pos[3];
808 Float_t mom[4];
809 Float_t localPos[3];
810 Float_t localMom[4];
811 Float_t localTheta,localPhi;
812 Float_t theta,phi;
813 Float_t destep, step;
814 Double_t ranf[2];
cd1cf354 815 Float_t coscerenkov;
816 static Float_t eloss, xhit, yhit, tlength;
817 const Float_t kBig=1.e10;
818
819 TClonesArray &lhits = *fHits;
642f15cf 820 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->GetCurrentTrackNumber()];
cd1cf354 821
822 //if (current->Energy()>1)
823 //{
824
825 // Only gas gap inside chamber
826 // Tag chambers and record hits when track enters
827
828
829 id=gMC->CurrentVolID(copy);
830 idvol = copy-1;
831 Float_t cherenkovLoss=0;
642f15cf 832 //gAlice->KeepTrack(gAlice->GetCurrentTrackNumber());
cd1cf354 833
834 gMC->TrackPosition(position);
835 pos[0]=position(0);
836 pos[1]=position(1);
837 pos[2]=position(2);
838 //bzero((char *)ckovData,sizeof(ckovData)*19);
839 ckovData[1] = pos[0]; // X-position for hit
840 ckovData[2] = pos[1]; // Y-position for hit
841 ckovData[3] = pos[2]; // Z-position for hit
842 ckovData[6] = 0; // dummy track length
642f15cf 843 //ckovData[11] = gAlice->GetCurrentTrackNumber();
cd1cf354 844
642f15cf 845 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->GetCurrentTrackNumber());
cd1cf354 846
847 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
848
849 /********************Store production parameters for Cerenkov photons************************/
850//is it a Cerenkov photon?
851 if (gMC->TrackPid() == 50000050) {
852
853 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
854 //{
855 Float_t ckovEnergy = current->Energy();
856 //energy interval for tracking
857 if (ckovEnergy > 5.6e-09 && ckovEnergy < 7.8e-09 )
858 //if (ckovEnergy > 0)
859 {
860 if (gMC->IsTrackEntering()){ //is track entering?
861 //printf("Track entered (1)\n");
862 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
863 { //is it in freo?
864 if (gMC->IsNewTrack()){ //is it the first step?
865 //printf("I'm in!\n");
866 Int_t mother = current->GetFirstMother();
867
868 //printf("Second Mother:%d\n",current->GetSecondMother());
869
870 ckovData[10] = mother;
642f15cf 871 ckovData[11] = gAlice->GetCurrentTrackNumber();
cd1cf354 872 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
873 //printf("Produced in FREO\n");
874 fCkovNumber++;
875 fFreonProd=1;
876 //printf("Index: %d\n",fCkovNumber);
877 } //first step question
878 } //freo question
879
880 if (gMC->IsNewTrack()){ //is it first step?
881 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
882 {
883 ckovData[12] = 2;
884 //printf("Produced in QUAR\n");
885 } //quarz question
886 } //first step question
887
888 //printf("Before %d\n",fFreonProd);
889 } //track entering question
890
891 if (ckovData[12] == 1) //was it produced in Freon?
892 //if (fFreonProd == 1)
893 {
894 if (gMC->IsTrackEntering()){ //is track entering?
895 //printf("Track entered (2)\n");
896 //printf("Current volume (should be META): %s\n",gMC->CurrentVolName());
897 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("META"),gMC->CurrentVolID(copy));
898 if (gMC->VolId("META")==gMC->CurrentVolID(copy)) //is it in gap?
899 {
900 //printf("Got in META\n");
901 gMC->TrackMomentum(momentum);
902 mom[0]=momentum(0);
903 mom[1]=momentum(1);
904 mom[2]=momentum(2);
905 mom[3]=momentum(3);
906
907 gMC->Gmtod(mom,localMom,2);
908 Float_t cophi = TMath::Cos(TMath::ATan2(localMom[0], localMom[1]));
909 Float_t t = (1. - .025 / cophi) * (1. - .05 / cophi);
910 /**************** Photons lost in second grid have to be calculated by hand************/
911 gMC->GetRandom()->RndmArray(1,ranf);
912 if (ranf[0] > t) {
913 gMC->StopTrack();
914 ckovData[13] = 5;
642f15cf 915 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 916 //printf("Added One (1)!\n");
917 //printf("Lost one in grid\n");
918 }
919 /**********************************************************************************/
920 } //gap
921
922 //printf("Current volume (should be CSI) (1): %s\n",gMC->CurrentVolName());
923 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
924 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy)) //is it in csi?
925 {
926 //printf("Got in CSI\n");
927 gMC->TrackMomentum(momentum);
928 mom[0]=momentum(0);
929 mom[1]=momentum(1);
930 mom[2]=momentum(2);
931 mom[3]=momentum(3);
932
933 gMC->Gmtod(mom,localMom,2);
934 /********* Photons lost by Fresnel reflection have to be calculated by hand********/
935 /***********************Cerenkov phtons (always polarised)*************************/
936 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
937 Double_t localRt = TMath::Sqrt(localTc);
938 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])));
939 Double_t cotheta = TMath::Abs(cos(localTheta));
940 Float_t t = Fresnel(ckovEnergy*1e9,cotheta,1);
941 gMC->GetRandom()->RndmArray(1,ranf);
942 if (ranf[0] < t) {
943 gMC->StopTrack();
944 ckovData[13] = 6;
642f15cf 945 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 946
947 //printf("Added One (2)!\n");
948 //printf("Lost by Fresnel\n");
949 }
950 /**********************************************************************************/
951 }
952 } //track entering?
953
954
955 /********************Evaluation of losses************************/
956 /******************still in the old fashion**********************/
957
958 TArrayI procs;
959 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
960 for (Int_t i = 0; i < i1; ++i) {
961 // Reflection loss
962 if (procs[i] == kPLightReflection) { //was it reflected
963 ckovData[13]=10;
964 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
965 ckovData[13]=1;
966 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
967 ckovData[13]=2;
968 //gMC->StopTrack();
642f15cf 969 //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 970 } //reflection question
971
972 // Absorption loss
973 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
974 //printf("Got in absorption\n");
975 ckovData[13]=20;
976 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
977 ckovData[13]=11;
978 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
979 ckovData[13]=12;
980 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
981 ckovData[13]=13;
982 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
983 ckovData[13]=13;
984
985 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
986 ckovData[13]=15;
987
988 // CsI inefficiency
989 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
990 ckovData[13]=16;
991 }
992 gMC->StopTrack();
642f15cf 993 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 994 //printf("Added One (3)!\n");
995 //printf("Added cerenkov %d\n",fCkovNumber);
996 } //absorption question
997
998
999 // Photon goes out of tracking scope
1000 else if (procs[i] == kPStop) { //is it below energy treshold?
1001 ckovData[13]=21;
1002 gMC->StopTrack();
642f15cf 1003 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 1004 //printf("Added One (4)!\n");
1005 } // energy treshold question
1006 } //number of mechanisms cycle
1007 /**********************End of evaluation************************/
1008 } //freon production question
1009 } //energy interval question
1010 //}//inside the proximity gap question
1011 } //cerenkov photon question
1012
1013 /**************************************End of Production Parameters Storing*********************/
1014
1015
1016 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1017
1018 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1019 //printf("Cerenkov\n");
1020
1021 //if (gMC->TrackPid() == 50000051)
1022 //printf("Tracking a feedback\n");
1023
1024 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
1025 {
1026 //printf("Current volume (should be CSI) (2): %s\n",gMC->CurrentVolName());
1027 //printf("VolId: %d, CurrentVolID: %d\n",gMC->VolId("CSI "),gMC->CurrentVolID(copy));
1028 //printf("Got in CSI\n");
1029 //printf("Tracking a %d\n",gMC->TrackPid());
1030 if (gMC->Edep() > 0.){
1031 gMC->TrackPosition(position);
1032 gMC->TrackMomentum(momentum);
1033 pos[0]=position(0);
1034 pos[1]=position(1);
1035 pos[2]=position(2);
1036 mom[0]=momentum(0);
1037 mom[1]=momentum(1);
1038 mom[2]=momentum(2);
1039 mom[3]=momentum(3);
1040 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1041 Double_t rt = TMath::Sqrt(tc);
1042 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1043 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1044
1045 gMC->CurrentVolOffID(2,copy);
1046 vol[0]=copy;
1047 idvol=vol[0]-1;
1048
1049
1050 gMC->Gmtod(pos,localPos,1);
1051
1052 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1053
1054 gMC->Gmtod(mom,localMom,2);
1055
1056 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1057
1058 gMC->CurrentVolOffID(2,copy);
1059 vol[0]=copy;
1060 idvol=vol[0]-1;
1061
1062 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1063 //->Sector(localPos[0], localPos[2]);
1064 //printf("Sector:%d\n",sector);
1065
1066 /*if (gMC->TrackPid() == 50000051){
1067 fFeedbacks++;
1068 printf("Feedbacks:%d\n",fFeedbacks);
1069 }*/
1070
1071 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1072 ((AliRICHChamber*)fChambers->At(idvol))
1073 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1074 if(idvol<kNCH) {
1075 ckovData[0] = gMC->TrackPid(); // particle type
1076 ckovData[1] = pos[0]; // X-position for hit
1077 ckovData[2] = pos[1]; // Y-position for hit
1078 ckovData[3] = pos[2]; // Z-position for hit
1079 ckovData[4] = theta; // theta angle of incidence
1080 ckovData[5] = phi; // phi angle of incidence
853634d3 1081 ckovData[8] = (Float_t) fNsdigits; // first sdigit
cd1cf354 1082 ckovData[9] = -1; // last pad hit
1083 ckovData[13] = 4; // photon was detected
1084 ckovData[14] = mom[0];
1085 ckovData[15] = mom[1];
1086 ckovData[16] = mom[2];
1087
1088 destep = gMC->Edep();
1089 gMC->SetMaxStep(kBig);
1090 cherenkovLoss += destep;
1091 ckovData[7]=cherenkovLoss;
1092
c021cb15 1093 ckovData[17] = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kPhoton);//for photons in CsI
cd1cf354 1094
853634d3 1095 if (fNsdigits > (Int_t)ckovData[8]) {
cd1cf354 1096 ckovData[8]= ckovData[8]+1;
853634d3 1097 ckovData[9]= (Float_t) fNsdigits;
cd1cf354 1098 }
1099
cd1cf354 1100
1101 //TClonesArray *Hits = RICH->Hits();
853634d3 1102 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
cd1cf354 1103 if (mipHit)
1104 {
1105 mom[0] = current->Px();
1106 mom[1] = current->Py();
1107 mom[2] = current->Pz();
1108 Float_t mipPx = mipHit->MomX();
1109 Float_t mipPy = mipHit->MomY();
1110 Float_t mipPz = mipHit->MomZ();
1111
1112 Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
1113 Float_t rt = TMath::Sqrt(r);
1114 Float_t mipR = mipPx*mipPx + mipPy*mipPy + mipPz*mipPz;
1115 Float_t mipRt = TMath::Sqrt(mipR);
1116 if ((rt*mipRt) > 0)
1117 {
1118 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1119 }
1120 else
1121 {
1122 coscerenkov = 0;
1123 }
1124 Float_t cherenkov = TMath::ACos(coscerenkov);
1125 ckovData[18]=cherenkov;
1126 }
1127 //if (sector != -1)
1128 //{
642f15cf 1129 AddHit(gAlice->GetCurrentTrackNumber(),vol,ckovData);
1130 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
cd1cf354 1131 //printf("Added One (5)!\n");
1132 //}
1133 }
1134 }
1135 }
1136 }
1137
1138 /***********************************************End of photon hits*********************************************/
1139
1140
1141 /**********************************************Charged particles treatment*************************************/
1142
dfa42ff8 1143 else if (gMC->TrackCharge()){
cd1cf354 1144//If MIP
1145 /*if (gMC->IsTrackEntering())
1146 {
1147 hits[13]=20;//is track entering?
1148 }*/
1149 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1150 {
1151 gMC->TrackMomentum(momentum);
1152 mom[0]=momentum(0);
1153 mom[1]=momentum(1);
1154 mom[2]=momentum(2);
1155 mom[3]=momentum(3);
1156 hits [19] = mom[0];
1157 hits [20] = mom[1];
1158 hits [21] = mom[2];
1159 fFreonProd=1;
1160 }
1161
dfa42ff8 1162 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {//is in GAP?
cd1cf354 1163// Get current particle id (ipart), track position (pos) and momentum (mom)
1164
1165 gMC->CurrentVolOffID(3,copy);
1166 vol[0]=copy;
1167 idvol=vol[0]-1;
1168
1169 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1170 //->Sector(localPos[0], localPos[2]);
1171 //printf("Sector:%d\n",sector);
1172
1173 gMC->TrackPosition(position);
1174 gMC->TrackMomentum(momentum);
1175 pos[0]=position(0);
1176 pos[1]=position(1);
1177 pos[2]=position(2);
1178 mom[0]=momentum(0);
1179 mom[1]=momentum(1);
1180 mom[2]=momentum(2);
1181 mom[3]=momentum(3);
1182
1183 gMC->Gmtod(pos,localPos,1);
1184
1185 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1186
1187 gMC->Gmtod(mom,localMom,2);
1188
1189 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1190
1191 ipart = gMC->TrackPid();
1192 //
1193 // momentum loss and steplength in last step
1194 destep = gMC->Edep();
1195 step = gMC->TrackStep();
1196
1197 //
1198 // record hits when track enters ...
1199 if( gMC->IsTrackEntering()) {
1200// gMC->SetMaxStep(fMaxStepGas);
1201 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1202 Double_t rt = TMath::Sqrt(tc);
1203 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1204 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1205
1206
1207 Double_t localTc = localMom[0]*localMom[0]+localMom[2]*localMom[2];
1208 Double_t localRt = TMath::Sqrt(localTc);
1209 localTheta = Float_t(TMath::ATan2(localRt,Double_t(localMom[1])))*kRaddeg;
1210 localPhi = Float_t(TMath::ATan2(Double_t(localMom[2]),Double_t(localMom[0])))*kRaddeg;
1211
1212 hits[0] = Float_t(ipart); // particle type
1213 hits[1] = localPos[0]; // X-position for hit
1214 hits[2] = localPos[1]; // Y-position for hit
1215 hits[3] = localPos[2]; // Z-position for hit
1216 hits[4] = localTheta; // theta angle of incidence
1217 hits[5] = localPhi; // phi angle of incidence
853634d3 1218 hits[8] = (Float_t) fNsdigits; // first sdigit
cd1cf354 1219 hits[9] = -1; // last pad hit
1220 hits[13] = fFreonProd; // did id hit the freon?
1221 hits[14] = mom[0];
1222 hits[15] = mom[1];
1223 hits[16] = mom[2];
1224 hits[18] = 0; // dummy cerenkov angle
1225
1226 tlength = 0;
1227 eloss = 0;
1228 fFreonProd = 0;
1229
1230 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1231
1232
1233 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1234 xhit = localPos[0];
1235 yhit = localPos[2];
1236 // Only if not trigger chamber
1237 if(idvol<kNCH) {
1238 //
1239 // Initialize hit position (cursor) in the segmentation model
1240 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1241 ((AliRICHChamber*)fChambers->At(idvol))
1242 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
1243 }
1244 }
1245
1246 //
1247 // Calculate the charge induced on a pad (disintegration) in case
1248 //
1249 // Mip left chamber ...
1250 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1251 gMC->SetMaxStep(kBig);
1252 eloss += destep;
1253 tlength += step;
1254
1255
1256 // Only if not trigger chamber
1257 if(idvol<kNCH) {
1258 if (eloss > 0)
1259 {
1260 if(gMC->TrackPid() == kNeutron)
1261 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
dfa42ff8 1262 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip); //for MIP
cd1cf354 1263 }
1264 }
1265
1266 hits[6]=tlength;
1267 hits[7]=eloss;
853634d3 1268 if (fNsdigits > (Int_t)hits[8]) {
cd1cf354 1269 hits[8]= hits[8]+1;
853634d3 1270 hits[9]= (Float_t) fNsdigits;
cd1cf354 1271 }
1272
1273 //if(sector !=-1)
853634d3 1274 new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
cd1cf354 1275 eloss = 0;
1276 //
1277 // Check additional signal generation conditions
1278 // defined by the segmentation
1279 // model (boundary crossing conditions)
dfa42ff8 1280 }else if(((AliRICHChamber*)fChambers->At(idvol))->SigGenCond(localPos[0], localPos[2], localPos[1])){
1281 ((AliRICHChamber*)fChambers->At(idvol))->SigGenInit(localPos[0], localPos[2], localPos[1]);
cd1cf354 1282 if (eloss > 0)
1283 {
1284 if(gMC->TrackPid() == kNeutron)
1285 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
dfa42ff8 1286 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);//for n
cd1cf354 1287 }
1288 xhit = localPos[0];
1289 yhit = localPos[2];
1290 eloss = destep;
1291 tlength += step ;
1292 //
1293 // nothing special happened, add up energy loss
1294 } else {
1295 eloss += destep;
1296 tlength += step ;
1297 }
dfa42ff8 1298 }//is in GAP?
1299 }//is MIP?
cd1cf354 1300 /*************************************************End of MIP treatment**************************************/
1301}//void AliRICHv3::StepManager()
c021cb15 1302//__________________________________________________________________________________________________
1303Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
1304{//calls the charge disintegration method of the current chamber and adds all generated sdigits to the list of digits
1305
1306 Int_t iChamber=kBad,iPadX=kBad,iPadY=kBad,iAdc=kBad,iTrack=kBad;
1307 Float_t list[4][500];
1308 Int_t iNdigits;
1309 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits, list, res);
1310 Int_t ic=0;
1311
1312 for(Int_t i=0; i<iNdigits; i++) {
1313 if(Int_t(list[0][i]) > 0) {
1314 ic++;
1315 iAdc = Int_t(list[0][i]);
1316 iPadX = Int_t(list[1][i]);
1317 iPadY = Int_t(list[2][i]);
1318 iChamber = Int_t(list[3][i]);
1319 AddSDigit(iChamber,iPadX,iPadY,iAdc,iTrack);
1320 }
1321 }
1322
1323 if(fLoader->TreeS()){
1324 fLoader->TreeS()->Fill();
1325 fLoader->WriteSDigits("OVERWRITE");
1326 }
1327 return iNdigits;
1328}//Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
1329//__________________________________________________________________________________________________
1330void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1331{
1332
1333 Int_t NpadX = 162; // number of pads on X
1334 Int_t NpadY = 162; // number of pads on Y
1335
1336 Int_t Pad[162][162];
1337 for (Int_t i=0;i<NpadX;i++) {
1338 for (Int_t j=0;j<NpadY;j++) {
1339 Pad[i][j]=0;
1340 }
1341 }
1342
1343 // Create some histograms
1344
1345 TH1F *pionspectra1 = new TH1F("pionspectra1","Pion Spectra",200,-4,2);
1346 TH1F *pionspectra2 = new TH1F("pionspectra2","Pion Spectra",200,-4,2);
1347 TH1F *pionspectra3 = new TH1F("pionspectra3","Pion Spectra",200,-4,2);
1348 TH1F *protonspectra1 = new TH1F("protonspectra1","Proton Spectra",200,-4,2);
1349 TH1F *protonspectra2 = new TH1F("protonspectra2","Proton Spectra",200,-4,2);
1350 TH1F *protonspectra3 = new TH1F("protonspectra3","Proton Spectra",200,-4,2);
1351 TH1F *kaonspectra1 = new TH1F("kaonspectra1","Kaon Spectra",100,-4,2);
1352 TH1F *kaonspectra2 = new TH1F("kaonspectra2","Kaon Spectra",100,-4,2);
1353 TH1F *kaonspectra3 = new TH1F("kaonspectra3","Kaon Spectra",100,-4,2);
1354 TH1F *electronspectra1 = new TH1F("electronspectra1","Electron Spectra",100,-4,2);
1355 TH1F *electronspectra2 = new TH1F("electronspectra2","Electron Spectra",100,-4,2);
1356 TH1F *electronspectra3 = new TH1F("electronspectra3","Electron Spectra",100,-4,2);
1357 TH1F *muonspectra1 = new TH1F("muonspectra1","Muon Spectra",100,-4,2);
1358 TH1F *muonspectra2 = new TH1F("muonspectra2","Muon Spectra",100,-4,2);
1359 TH1F *muonspectra3 = new TH1F("muonspectra3","Muon Spectra",100,-4,2);
1360 TH1F *neutronspectra1 = new TH1F("neutronspectra1","Neutron Spectra",100,-4,2);
1361 TH1F *neutronspectra2 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
1362 TH1F *neutronspectra3 = new TH1F("neutronspectra2","Neutron Spectra",100,-4,2);
1363 TH1F *chargedspectra1 = new TH1F("chargedspectra1","Charged particles above 1 GeV Spectra",100,-1,3);
1364 TH1F *chargedspectra2 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
1365 TH1F *chargedspectra3 = new TH1F("chargedspectra2","Charged particles above 1 GeV Spectra",100,-1,3);
1366 TH1F *pionptspectrafinal = new TH1F("pionptspectrafinal","Primary Pions Transverse Momenta at HMPID",20,0,5);
1367 TH1F *pionptspectravertex = new TH1F("pionptspectravertex","Primary Pions Transverse Momenta at vertex",20,0,5);
1368 TH1F *kaonptspectrafinal = new TH1F("kaonptspectrafinal","Primary Kaons Transverse Momenta at HMPID",20,0,5);
1369 TH1F *kaonptspectravertex = new TH1F("kaonptspectravertex","Primary Kaons Transverse Momenta at vertex",20,0,5);
1370 //TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",100,-180,180);
1371 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of Theta angle of incidence, all tracks",100,0,50);
1372 TH1F *hitsTheta500MeV = new TH1F("hitsTheta500MeV","Distribution of Theta angle of incidence, 0.5-1 GeV primary tracks",100,0,50);
1373 TH1F *hitsTheta1GeV = new TH1F("hitsTheta1GeV","Distribution of Theta angle of incidence, 1-2 GeV primary tracks",100,0,50);
1374 TH1F *hitsTheta2GeV = new TH1F("hitsTheta2GeV","Distribution of Theta angle of incidence, 2-3 GeV primary tracks",100,0,50);
1375 TH1F *hitsTheta3GeV = new TH1F("hitsTheta3GeV","Distribution of Theta angle of incidence, >3 GeV primary tracks",100,0,50);
1376 TH2F *production = new TH2F("production","Mother production vertices",100,-300,300,100,0,600);
1377
1378
1379
1380
1381// Start loop over events
1382
1383 Int_t pion=0, kaon=0, proton=0, electron=0, positron=0, neutron=0, highneutrons=0, muon=0;
1384 Int_t chargedpions=0,primarypions=0,highprimarypions=0,chargedkaons=0,primarykaons=0,highprimarykaons=0;
1385 Int_t photons=0, primaryphotons=0, highprimaryphotons=0;
1386 TRandom* random=0;
1387
1388 for (int nev=0; nev<= evNumber2; nev++) {
1389 Int_t nparticles = gAlice->GetEvent(nev);
1390
1391
1392 if (nev < evNumber1) continue;
1393 if (nparticles <= 0) return;
1394
1395// Get pointers to RICH detector and Hits containers
1396
1397 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
1398
1399 TTree *treeH = TreeH();
1400 Int_t ntracks =(Int_t) treeH->GetEntries();
1401
1402// Start loop on tracks in the hits containers
1403
1404 for (Int_t track=0; track<ntracks;track++) {
1405 printf ("Processing Track: %d\n",track);
1406 gAlice->ResetHits();
1407 treeH->GetEvent(track);
1408
1409 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
1410 mHit;
1411 mHit=(AliRICHhit*)pRICH->NextHit())
1412 {
1413 //Int_t nch = mHit->fChamber; // chamber number
1414 //Float_t x = mHit->X(); // x-pos of hit
1415 //Float_t y = mHit->Z(); // y-pos
1416 //Float_t z = mHit->Y();
1417 //Float_t phi = mHit->Phi(); //Phi angle of incidence
1418 Float_t theta = mHit->Theta(); //Theta angle of incidence
1419 Float_t px = mHit->MomX();
1420 Float_t py = mHit->MomY();
1421 Int_t index = mHit->Track();
1422 Int_t particle = (Int_t)(mHit->Particle());
1423 Float_t R;
1424 Float_t PTfinal;
1425 Float_t PTvertex;
1426
1427 TParticle *current = gAlice->Particle(index);
1428
1429 //Float_t energy=current->Energy();
1430
1431 R=TMath::Sqrt(current->Vx()*current->Vx() + current->Vy()*current->Vy());
1432 PTfinal=TMath::Sqrt(px*px + py*py);
1433 PTvertex=TMath::Sqrt(current->Px()*current->Px() + current->Py()*current->Py());
1434
1435
1436
1437 if (TMath::Abs(particle) < 10000000)
1438 {
1439 hitsTheta->Fill(theta,(float) 1);
1440 if (R<5)
1441 {
1442 if (PTvertex>.5 && PTvertex<=1)
1443 {
1444 hitsTheta500MeV->Fill(theta,(float) 1);
1445 }
1446 if (PTvertex>1 && PTvertex<=2)
1447 {
1448 hitsTheta1GeV->Fill(theta,(float) 1);
1449 }
1450 if (PTvertex>2 && PTvertex<=3)
1451 {
1452 hitsTheta2GeV->Fill(theta,(float) 1);
1453 }
1454 if (PTvertex>3)
1455 {
1456 hitsTheta3GeV->Fill(theta,(float) 1);
1457 }
1458 }
1459
1460 }
1461
1462 //if (nch == 3)
1463 //{
1464
1465 if (TMath::Abs(particle) < 50000051)
1466 {
1467 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
1468 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
1469 {
1470 //gMC->Rndm(&random, 1);
1471 if (random->Rndm() < .1)
1472 production->Fill(current->Vz(),R,(float) 1);
1473 if (TMath::Abs(particle) == 50000050)
1474 //if (TMath::Abs(particle) > 50000000)
1475 {
1476 photons +=1;
1477 if (R<5)
1478 {
1479 primaryphotons +=1;
1480 if (current->Energy()>0.001)
1481 highprimaryphotons +=1;
1482 }
1483 }
1484 if (TMath::Abs(particle) == 2112)
1485 {
1486 neutron +=1;
1487 if (current->Energy()>0.0001)
1488 highneutrons +=1;
1489 }
1490 }
1491 if (TMath::Abs(particle) < 50000000)
1492 {
1493 production->Fill(current->Vz(),R,(float) 1);
1494 }
1495 //mip->Fill(x,y,(float) 1);
1496 }
1497
1498 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1499 {
1500 if (R<5)
1501 {
1502 pionptspectravertex->Fill(PTvertex,(float) 1);
1503 pionptspectrafinal->Fill(PTfinal,(float) 1);
1504 }
1505 }
1506
1507 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1508 || TMath::Abs(particle)==311)
1509 {
1510 if (R<5)
1511 {
1512 kaonptspectravertex->Fill(PTvertex,(float) 1);
1513 kaonptspectrafinal->Fill(PTfinal,(float) 1);
1514 }
1515 }
1516
1517
1518 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1519 {
1520 pionspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1521 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1522 pionspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1523 if (R>250 && R<450)
1524 {
1525 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1526 }
1527 pion +=1;
1528 if (TMath::Abs(particle)==211)
1529 {
1530 chargedpions +=1;
1531 if (R<5)
1532 {
1533 primarypions +=1;
1534 if (current->Energy()>1)
1535 highprimarypions +=1;
1536 }
1537 }
1538 }
1539 if (TMath::Abs(particle)==2212)
1540 {
1541 protonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1542 //ptspectra->Fill(Pt,(float) 1);
1543 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1544 protonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1545 if (R>250 && R<450)
1546 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1547 proton +=1;
1548 }
1549 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1550 || TMath::Abs(particle)==311)
1551 {
1552 kaonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1553 //ptspectra->Fill(Pt,(float) 1);
1554 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1555 kaonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1556 if (R>250 && R<450)
1557 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1558 kaon +=1;
1559 if (TMath::Abs(particle)==321)
1560 {
1561 chargedkaons +=1;
1562 if (R<5)
1563 {
1564 primarykaons +=1;
1565 if (current->Energy()>1)
1566 highprimarykaons +=1;
1567 }
1568 }
1569 }
1570 if (TMath::Abs(particle)==11)
1571 {
1572 electronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1573 //ptspectra->Fill(Pt,(float) 1);
1574 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1575 electronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1576 if (R>250 && R<450)
1577 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1578 if (particle == 11)
1579 electron +=1;
1580 if (particle == -11)
1581 positron +=1;
1582 }
1583 if (TMath::Abs(particle)==13)
1584 {
1585 muonspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1586 //ptspectra->Fill(Pt,(float) 1);
1587 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1588 muonspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1589 if (R>250 && R<450)
1590 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1591 muon +=1;
1592 }
1593 if (TMath::Abs(particle)==2112)
1594 {
1595 neutronspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1596 //ptspectra->Fill(Pt,(float) 1);
1597 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1598 neutronspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1599 if (R>250 && R<450)
1600 {
1601 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1602 }
1603 neutron +=1;
1604 }
1605 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
1606 {
1607 if (current->Energy()-current->GetCalcMass()>1)
1608 {
1609 chargedspectra1->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1610 if (current->Vx()>5 && current->Vy()>5 && current->Vz()>5)
1611 chargedspectra2->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1612 if (R>250 && R<450)
1613 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1614 }
1615 }
1616 // Fill the histograms
1617 //Nh1+=nhits;
1618 //h->Fill(x,y,(float) 1);
1619 //}
1620 //}
1621 }
1622
1623 }
1624
1625 }
1626 // }
1627
1628 TStyle *mystyle=new TStyle("Plain","mystyle");
1629 mystyle->SetPalette(1,0);
1630 mystyle->cd();
1631
1632 //Create canvases, set the view range, show histograms
1633
1634 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
1635 c2->Divide(2,2);
1636 //c2->SetFillColor(42);
1637
1638 c2->cd(1);
1639 hitsTheta500MeV->SetFillColor(5);
1640 hitsTheta500MeV->Draw();
1641 c2->cd(2);
1642 hitsTheta1GeV->SetFillColor(5);
1643 hitsTheta1GeV->Draw();
1644 c2->cd(3);
1645 hitsTheta2GeV->SetFillColor(5);
1646 hitsTheta2GeV->Draw();
1647 c2->cd(4);
1648 hitsTheta3GeV->SetFillColor(5);
1649 hitsTheta3GeV->Draw();
1650
1651
1652
1653 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
1654 c15->cd();
1655 production->SetFillColor(42);
1656 production->SetXTitle("z (m)");
1657 production->SetYTitle("R (m)");
1658 production->Draw();
1659
1660 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
1661 c10->Divide(2,2);
1662 c10->cd(1);
1663 pionptspectravertex->SetFillColor(5);
1664 pionptspectravertex->SetXTitle("Pt (GeV)");
1665 pionptspectravertex->Draw();
1666 c10->cd(2);
1667 pionptspectrafinal->SetFillColor(5);
1668 pionptspectrafinal->SetXTitle("Pt (GeV)");
1669 pionptspectrafinal->Draw();
1670 c10->cd(3);
1671 kaonptspectravertex->SetFillColor(5);
1672 kaonptspectravertex->SetXTitle("Pt (GeV)");
1673 kaonptspectravertex->Draw();
1674 c10->cd(4);
1675 kaonptspectrafinal->SetFillColor(5);
1676 kaonptspectrafinal->SetXTitle("Pt (GeV)");
1677 kaonptspectrafinal->Draw();
1678
1679
1680 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
1681 c16->Divide(2,1);
1682
1683 c16->cd(1);
1684 //TCanvas *c13 = new TCanvas("c13","Electron Spectra",400,10,600,700);
1685 electronspectra1->SetFillColor(5);
1686 electronspectra1->SetXTitle("log(GeV)");
1687 electronspectra2->SetFillColor(46);
1688 electronspectra2->SetXTitle("log(GeV)");
1689 electronspectra3->SetFillColor(10);
1690 electronspectra3->SetXTitle("log(GeV)");
1691 //c13->SetLogx();
1692 electronspectra1->Draw();
1693 electronspectra2->Draw("same");
1694 electronspectra3->Draw("same");
1695
1696 c16->cd(2);
1697 //TCanvas *c14 = new TCanvas("c14","Muon Spectra",400,10,600,700);
1698 muonspectra1->SetFillColor(5);
1699 muonspectra1->SetXTitle("log(GeV)");
1700 muonspectra2->SetFillColor(46);
1701 muonspectra2->SetXTitle("log(GeV)");
1702 muonspectra3->SetFillColor(10);
1703 muonspectra3->SetXTitle("log(GeV)");
1704 //c14->SetLogx();
1705 muonspectra1->Draw();
1706 muonspectra2->Draw("same");
1707 muonspectra3->Draw("same");
1708
1709 //c16->cd(3);
1710 //TCanvas *c16 = new TCanvas("c16","Neutron Spectra",400,10,600,700);
1711 //neutronspectra1->SetFillColor(42);
1712 //neutronspectra1->SetXTitle("log(GeV)");
1713 //neutronspectra2->SetFillColor(46);
1714 //neutronspectra2->SetXTitle("log(GeV)");
1715 //neutronspectra3->SetFillColor(10);
1716 //neutronspectra3->SetXTitle("log(GeV)");
1717 //c16->SetLogx();
1718 //neutronspectra1->Draw();
1719 //neutronspectra2->Draw("same");
1720 //neutronspectra3->Draw("same");
1721
1722 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
1723 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
1724 c9->Divide(2,2);
1725
1726 c9->cd(1);
1727 pionspectra1->SetFillColor(5);
1728 pionspectra1->SetXTitle("log(GeV)");
1729 pionspectra2->SetFillColor(46);
1730 pionspectra2->SetXTitle("log(GeV)");
1731 pionspectra3->SetFillColor(10);
1732 pionspectra3->SetXTitle("log(GeV)");
1733 //c9->SetLogx();
1734 pionspectra1->Draw();
1735 pionspectra2->Draw("same");
1736 pionspectra3->Draw("same");
1737
1738 c9->cd(2);
1739 //TCanvas *c10 = new TCanvas("c10","Proton Spectra",400,10,600,700);
1740 protonspectra1->SetFillColor(5);
1741 protonspectra1->SetXTitle("log(GeV)");
1742 protonspectra2->SetFillColor(46);
1743 protonspectra2->SetXTitle("log(GeV)");
1744 protonspectra3->SetFillColor(10);
1745 protonspectra3->SetXTitle("log(GeV)");
1746 //c10->SetLogx();
1747 protonspectra1->Draw();
1748 protonspectra2->Draw("same");
1749 protonspectra3->Draw("same");
1750
1751 c9->cd(3);
1752 //TCanvas *c11 = new TCanvas("c11","Kaon Spectra",400,10,600,700);
1753 kaonspectra1->SetFillColor(5);
1754 kaonspectra1->SetXTitle("log(GeV)");
1755 kaonspectra2->SetFillColor(46);
1756 kaonspectra2->SetXTitle("log(GeV)");
1757 kaonspectra3->SetFillColor(10);
1758 kaonspectra3->SetXTitle("log(GeV)");
1759 //c11->SetLogx();
1760 kaonspectra1->Draw();
1761 kaonspectra2->Draw("same");
1762 kaonspectra3->Draw("same");
1763
1764 c9->cd(4);
1765 //TCanvas *c12 = new TCanvas("c12","Charged Particles Spectra",400,10,600,700);
1766 chargedspectra1->SetFillColor(5);
1767 chargedspectra1->SetXTitle("log(GeV)");
1768 chargedspectra2->SetFillColor(46);
1769 chargedspectra2->SetXTitle("log(GeV)");
1770 chargedspectra3->SetFillColor(10);
1771 chargedspectra3->SetXTitle("log(GeV)");
1772 //c12->SetLogx();
1773 chargedspectra1->Draw();
1774 chargedspectra2->Draw("same");
1775 chargedspectra3->Draw("same");
1776
1777
1778
1779 printf("*****************************************\n");
1780 printf("* Particle * Counts *\n");
1781 printf("*****************************************\n");
1782
1783 printf("* Pions: * %4d *\n",pion);
1784 printf("* Charged Pions: * %4d *\n",chargedpions);
1785 printf("* Primary Pions: * %4d *\n",primarypions);
1786 printf("* Primary Pions (p>1GeV/c): * %4d *\n",highprimarypions);
1787 printf("* Kaons: * %4d *\n",kaon);
1788 printf("* Charged Kaons: * %4d *\n",chargedkaons);
1789 printf("* Primary Kaons: * %4d *\n",primarykaons);
1790 printf("* Primary Kaons (p>1GeV/c): * %4d *\n",highprimarykaons);
1791 printf("* Muons: * %4d *\n",muon);
1792 printf("* Electrons: * %4d *\n",electron);
1793 printf("* Positrons: * %4d *\n",positron);
1794 printf("* Protons: * %4d *\n",proton);
1795 printf("* All Charged: * %4d *\n",(chargedpions+chargedkaons+muon+electron+positron+proton));
1796 printf("*****************************************\n");
1797 //printf("* Photons: * %3.1f *\n",photons);
1798 //printf("* Primary Photons: * %3.1f *\n",primaryphotons);
1799 //printf("* Primary Photons (p>1MeV/c):* %3.1f *\n",highprimaryphotons);
1800 //printf("*****************************************\n");
1801 //printf("* Neutrons: * %3.1f *\n",neutron);
1802 //printf("* Neutrons (p>100keV/c): * %3.1f *\n",highneutrons);
1803 //printf("*****************************************\n");
1804
1805 if (gAlice->TreeD())
1806 {
1807 gAlice->TreeD()->GetEvent(0);
1808
1809 Float_t occ[7];
1810 Float_t sum=0;
1811 Float_t mean=0;
1812 printf("\n*****************************************\n");
1813 printf("* Chamber * Digits * Occupancy *\n");
1814 printf("*****************************************\n");
1815
1816 for (Int_t ich=0;ich<7;ich++)
1817 {
1818 TClonesArray *Digits = DigitsAddress(ich); // Raw clusters branch
1819 Int_t ndigits = Digits->GetEntriesFast();
1820 occ[ich] = Float_t(ndigits)/(160*144);
1821 sum += Float_t(ndigits)/(160*144);
1822 printf("* %d * %d * %3.1f%% *\n",ich,ndigits,occ[ich]*100);
1823 }
1824 mean = sum/7;
1825 printf("*****************************************\n");
1826 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
1827 printf("*****************************************\n");
1828 }
1829
1830 printf("\nEnd of analysis\n");
1831
1832}//void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1833//__________________________________________________________________________________________________
1834void AliRICHv3::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
1835{
1836
1837AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1838 AliRICHSegmentationV0* segmentation;
1839 AliRICHChamber* chamber;
1840
1841 chamber = &(pRICH->Chamber(0));
1842 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
1843
1844 Int_t NpadX = segmentation->Npx(); // number of pads on X
1845 Int_t NpadY = segmentation->Npy(); // number of pads on Y
1846
1847 Int_t xmin= -NpadX/2;
1848 Int_t xmax= NpadX/2;
1849 Int_t ymin= -NpadY/2;
1850 Int_t ymax= NpadY/2;
1851
1852 Float_t PTfinal = 0;
1853 Int_t pionCount = 0;
1854 Int_t kaonCount = 0;
1855 Int_t protonCount = 0;
1856
1857 TH2F *feedback = 0;
1858 TH2F *mip = 0;
1859 TH2F *cerenkov = 0;
1860 TH2F *h = 0;
1861 TH1F *hitsX = 0;
1862 TH1F *hitsY = 0;
1863
1864 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
1865
1866 if (diaglevel == 1)
1867 {
1868 printf("Single Ring Hits\n");
1869 feedback = new TH2F("feedback","Feedback hit distribution",150,-20,20,150,-35,5);
1870 mip = new TH2F("mip","Mip hit distribution",150,-20,20,150,-35,5);
1871 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-20,20,150,-35,5);
1872 h = new TH2F("h","Detector hit distribution",150,-20,20,150,-35,5);
1873 hitsX = new TH1F("hitsX","Distribution of hits along x-axis",150,-50,50);
1874 hitsY = new TH1F("hitsY","Distribution of hits along z-axis",150,-50,50);
1875 }
1876 else
1877 {
1878 printf("Full Event Hits\n");
1879
1880 feedback = new TH2F("feedback","Feedback hit distribution",150,-300,300,150,-300,300);
1881 mip = new TH2F("mip","Mip hit distribution",150,-300,300,150,-300,300);
1882 cerenkov = new TH2F("cerenkov","Cerenkov hit distribution",150,-300,300,150,-300,300);
1883 h = new TH2F("h","Detector hit distribution",150,-300,300,150,-300,300);
1884 hitsX = new TH1F("digitsX","Distribution of hits along x-axis",200,-300,300);
1885 hitsY = new TH1F("digitsY","Distribution of hits along z-axis",200,-300,300);
1886 }
1887
1888
1889
1890 TH2F *hc1 = new TH2F("hc1","Chamber 1 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1891 TH2F *hc2 = new TH2F("hc2","Chamber 2 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1892 TH2F *hc3 = new TH2F("hc3","Chamber 3 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1893 TH2F *hc4 = new TH2F("hc4","Chamber 4 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1894 TH2F *hc5 = new TH2F("hc5","Chamber 5 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1895 TH2F *hc6 = new TH2F("hc6","Chamber 6 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1896 TH2F *hc7 = new TH2F("hc7","Chamber 7 signal distribution",NpadX,xmin,xmax,NpadY,ymin,ymax);
1897
1898 TH1F *Clcharge = new TH1F("Clcharge","Cluster Charge Distribution",500,0.,500.);
1899 TH1F *ckovangle = new TH1F("ckovangle","Cerenkov angle per photon",100,.35,.8);
1900 TH1F *hckphi = new TH1F("hckphi","Cerenkov phi angle per photon",620,-3.1,3.1);
1901 TH1F *mother = new TH1F("mother","Cerenkovs per Mip",75,0.,75.);
1902 TH1F *radius = new TH1F("radius","Mean distance to Mip",100,0.,20.);
1903 TH1F *phspectra1 = new TH1F("phspectra1","Detected Photon Spectra",200,5.,10.);
1904 TH1F *phspectra2 = new TH1F("phspectra2","Produced Photon Spectra",200,5.,10.);
1905 TH1F *totalphotonstrack = new TH1F("totalphotonstrack","Produced Photons per Mip",100,200,700.);
1906 TH1F *totalphotonsevent = new TH1F("totalphotonsevent","Produced Photons per Mip",100,200,700.);
1907 //TH1F *feedbacks = new TH1F("feedbacks","Produced Feedbacks per Mip",50,0.5,50.);
1908 TH1F *padnumber = new TH1F("padnumber","Number of pads per cluster",50,-0.5,50.);
1909 TH1F *padsev = new TH1F("padsev","Number of pads hit per MIP",50,0.5,100.);
1910 TH1F *clusev = new TH1F("clusev","Number of clusters per MIP",50,0.5,50.);
1911 TH1F *photev = new TH1F("photev","Number of detected photons per MIP",50,0.5,50.);
1912 TH1F *feedev = new TH1F("feedev","Number of feedbacks per MIP",50,0.5,50.);
1913 TH1F *padsmip = new TH1F("padsmip","Number of pads per event inside MIP region",50,0.5,50.);
1914 TH1F *padscl = new TH1F("padscl","Number of pads per event from cluster count",50,0.5,100.);
1915 TH1F *pionspectra = new TH1F("pionspectra","Pion Spectra",200,.5,10.);
1916 TH1F *protonspectra = new TH1F("protonspectra","Proton Spectra",200,.5,10.);
1917 TH1F *kaonspectra = new TH1F("kaonspectra","Kaon Spectra",100,.5,10.);
1918 TH1F *chargedspectra = new TH1F("chargedspectra","Charged particles above 1 GeV Spectra",100,.5,10.);
1919 TH1F *hitsPhi = new TH1F("hitsPhi","Distribution of phi angle of incidence",50,0,360);
1920 TH1F *hitsTheta = new TH1F("hitsTheta","Distribution of theta angle of incidence",50,0,15);
1921 TH1F *Omega1D = new TH1F("omega","Reconstructed Cerenkov angle per track",50,.5,1);
1922 TH1F *Theta = new TH1F("theta","Reconstructed theta incidence angle per track",100,0,15);
1923 TH1F *Phi = new TH1F("phi","Reconstructed phi incidence per track",100,0,360);
1924 TH1F *Omega3D = new TH1F("omega","Reconstructed Cerenkov angle per track",100,.35,.8);
1925 TH1F *PhotonCer = new TH1F("photoncer","Reconstructed Cerenkov angle per photon",100,.35,.8);
1926 TH2F *PadsUsed = new TH2F("padsused","Pads Used for Reconstruction",100,-30,30,100,-30,30);
1927 TH1F *MeanRadius = new TH1F("radius","Mean Radius for reconstructed track",100,0.,20.);
1928 TH2F *identification = new TH2F("identification","Particle Identification",100,1,5,100,0,.8);
1929 TH1F *OriginalOmega = new TH1F("Original Omega","Cerenkov angle per track",100,.35,.8);
1930 TH1F *OriginalPhi = new TH1F("Original Phi","Distribution of phi angle of incidence per track",100,0,360);
1931 TH1F *OriginalTheta = new TH1F("Original Theta","Distribution of theta angle per track",100,0,15);
1932 TH1F *OmegaError = new TH1F("Omega Error","Difference between original an reconstructed cerenkov angle",100,0,.2);
1933 TH1F *PhiError = new TH1F("Phi Error","Difference between original an reconstructed phi angle",100,0,360);
1934 TH1F *ThetaError = new TH1F("Theta Error","Difference between original an reconstructed phi angle",100,0,15);
1935
1936
1937// Start loop over events
1938
1939 Int_t Nh=0;
1940 Int_t pads=0;
1941 Int_t Nh1=0;
1942 Int_t mothers[80000];
1943 Int_t mothers2[80000];
1944 Float_t mom[3];
1945 Int_t nraw=0;
1946 Int_t phot=0;
1947 Int_t feed=0;
1948 Int_t padmip=0;
1949 Float_t x=0,y=0;
1950
1951 Float_t chiSquareOmega = 0;
1952 Float_t chiSquareTheta = 0;
1953 Float_t chiSquarePhi = 0;
1954
1955 Float_t recEffEvent = 0;
1956 Float_t recEffTotal = 0;
1957
1958 Float_t trackglob[3];
1959 Float_t trackloc[3];
1960
1961
1962 for (Int_t i=0;i<100;i++) mothers[i]=0;
1963
1964 for (int nev=0; nev<= evNumber2; nev++) {
1965 Int_t nparticles = gAlice->GetEvent(nev);
1966
1967
1968 //cout<<"nev "<<nev<<endl;
1969 printf ("\n**********************************\nProcessing Event: %d\n",nev);
1970 //cout<<"nparticles "<<nparticles<<endl;
1971 printf ("Particles : %d\n\n",nparticles);
1972 if (nev < evNumber1) continue;
1973 if (nparticles <= 0) return;
1974
1975// Get pointers to RICH detector and Hits containers
1976
1977
1978 TTree *TH = TreeH();
1979 Stat_t ntracks = TH->GetEntries();
1980
1981 // Start loop on tracks in the hits containers
1982 //Int_t Nc=0;
1983 for (Int_t track=0; track<ntracks;track++) {
1984
1985 printf ("\nProcessing Track: %d\n",track);
1986 gAlice->ResetHits();
1987 TH->GetEvent(track);
1988 Int_t nhits = pRICH->Hits()->GetEntriesFast();
1989 if (nhits) Nh+=nhits;
1990 printf("Hits : %d\n",nhits);
1991 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
1992 mHit;
1993 mHit=(AliRICHhit*)pRICH->NextHit())
1994 {
1995 Int_t nch = mHit->Chamber(); // chamber number
1996 trackglob[0] = mHit->X(); // x-pos of hit
1997 trackglob[1] = mHit->Y();
1998 trackglob[2] = mHit->Z(); // y-pos of hit
1999 //x = mHit->X(); // x-pos of hit
2000 //y = mHit->Z(); // y-pos
2001 Float_t phi = mHit->Phi(); //Phi angle of incidence
2002 Float_t theta = mHit->Theta(); //Theta angle of incidence
2003 Int_t index = mHit->Track();
2004 Int_t particle = (Int_t)(mHit->Particle());
2005 //Int_t freon = (Int_t)(mHit->fLoss);
2006 Float_t px = mHit->MomX();
2007 Float_t py = mHit->MomY();
2008
2009 if (TMath::Abs(particle) < 10000000)
2010 {
2011 PTfinal=TMath::Sqrt(px*px + py*py);
2012 }
2013
2014 chamber = &(pRICH->Chamber(nch-1));
2015
2016
2017 chamber->GlobaltoLocal(trackglob,trackloc);
2018
2019 chamber->LocaltoGlobal(trackloc,trackglob);
2020
2021
2022 x=trackloc[0];
2023 y=trackloc[2];
2024
2025 hitsX->Fill(x,(float) 1);
2026 hitsY->Fill(y,(float) 1);
2027
2028
2029 TParticle *current = (TParticle*)gAlice->Particle(index);
2030
2031 hitsTheta->Fill(theta,(float) 1);
2032
2033 if (current->GetPdgCode() < 10000000)
2034 {
2035 mip->Fill(x,y,(float) 1);
2036 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
2037 }
2038
2039 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2040 {
2041 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2042 }
2043 if (TMath::Abs(particle)==2212)
2044 {
2045 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2046 }
2047 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2048 || TMath::Abs(particle)==311)
2049 {
2050 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2051 }
2052 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
2053 {
2054 if (current->Energy() - current->GetCalcMass()>1)
2055 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2056 }
2057 //printf("Hits:%d\n",hit);
2058 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
2059 // Fill the histograms
2060 Nh1+=nhits;
2061 h->Fill(x,y,(float) 1);
2062 //}
2063 //}
2064 }
2065
2066 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
2067 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
2068 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
2069
2070 if (ncerenkovs) {
2071 printf("Cerenkovs : %d\n",ncerenkovs);
2072 totalphotonsevent->Fill(ncerenkovs,(float) 1);
2073 for (Int_t hit=0;hit<ncerenkovs;hit++) {
2074 AliRICHCerenkov* cHit = (AliRICHCerenkov*) pRICH->Cerenkovs()->UncheckedAt(hit);
2075 Int_t nchamber = cHit->fChamber; // chamber number
2076 Int_t index = cHit->Track();
2077 //Int_t pindex = (Int_t)(cHit->fIndex);
2078 trackglob[0] = cHit->X(); // x-pos of hit
2079 trackglob[1] = cHit->Y();
2080 trackglob[2] = cHit->Z(); // y-pos of hit
2081 //Float_t cx = cHit->X(); // x-position
2082 //Float_t cy = cHit->Z(); // y-position
2083 Int_t cmother = cHit->fCMother; // Index of mother particle
2084 Int_t closs = (Int_t)(cHit->fLoss); // How did the particle get lost?
2085 Float_t cherenkov = cHit->fCerenkovAngle; //production cerenkov angle
2086
2087 chamber = &(pRICH->Chamber(nchamber-1));
2088
2089 //printf("Nch:%d\n",nch);
2090
2091 chamber->GlobaltoLocal(trackglob,trackloc);
2092
2093 chamber->LocaltoGlobal(trackloc,trackglob);
2094
2095
2096 Float_t cx=trackloc[0];
2097 Float_t cy=trackloc[2];
2098
2099 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
2100
2101
2102 //printf("Particle:%9d\n",index);
2103
2104 TParticle *current = (TParticle*)gAlice->Particle(index);
2105 Float_t energyckov = current->Energy();
2106
2107 if (current->GetPdgCode() == 50000051)
2108 {
2109 if (closs==4)
2110 {
2111 feedback->Fill(cx,cy,(float) 1);
2112 feed++;
2113 }
2114 }
2115 if (current->GetPdgCode() == 50000050)
2116 {
2117
2118 if (closs !=4)
2119 {
2120 phspectra2->Fill(energyckov*1e9,(float) 1);
2121 }
2122
2123 if (closs==4)
2124 {
2125 cerenkov->Fill(cx,cy,(float) 1);
2126
2127 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
2128
2129 //TParticle *MIP = (TParticle*)gAlice->Particle(cmother);
2130 AliRICHhit* mipHit = (AliRICHhit*) pRICH->Hits()->UncheckedAt(0);
2131 mom[0] = current->Px();
2132 mom[1] = current->Py();
2133 mom[2] = current->Pz();
2134 //mom[0] = cHit->fMomX;
2135 // mom[1] = cHit->fMomZ;
2136 //mom[2] = cHit->fMomY;
2137 //Float_t energymip = MIP->Energy();
2138 //Float_t Mip_px = mipHit->fMomFreoX;
2139 //Float_t Mip_py = mipHit->fMomFreoY;
2140 //Float_t Mip_pz = mipHit->fMomFreoZ;
2141 //Float_t Mip_px = MIP->Px();
2142 //Float_t Mip_py = MIP->Py();
2143 //Float_t Mip_pz = MIP->Pz();
2144
2145
2146
2147 //Float_t r = mom[0]*mom[0] + mom[1]*mom[1] + mom[2]*mom[2];
2148 //Float_t rt = TMath::Sqrt(r);
2149 //Float_t Mip_r = Mip_px*Mip_px + Mip_py*Mip_py + Mip_pz*Mip_pz;
2150 //Float_t Mip_rt = TMath::Sqrt(Mip_r);
2151 //Float_t coscerenkov = (mom[0]*Mip_px + mom[1]*Mip_py + mom[2]*Mip_pz)/(rt*Mip_rt+0.0000001);
2152 //Float_t cherenkov = TMath::ACos(coscerenkov);
2153 ckovangle->Fill(cherenkov,(float) 1); //Cerenkov angle calculus
2154 //printf("Cherenkov: %f\n",cherenkov);
2155 Float_t ckphi=TMath::ATan2(mom[0], mom[2]);
2156 hckphi->Fill(ckphi,(float) 1);
2157
2158
2159 //Float_t mix = MIP->Vx();
2160 //Float_t miy = MIP->Vy();
2161 Float_t mx = mipHit->X();
2162 Float_t my = mipHit->Z();
2163 //printf("FX %e, FY %e, VX %e, VY %e\n",cx,cy,mx,my);
2164 Float_t dx = trackglob[0] - mx;
2165 Float_t dy = trackglob[2] - my;
2166 //printf("Dx:%f, Dy:%f\n",dx,dy);
2167 Float_t final_radius = TMath::Sqrt(dx*dx+dy*dy);
2168 //printf("Final radius:%f\n",final_radius);
2169 radius->Fill(final_radius,(float) 1);
2170
2171 phspectra1->Fill(energyckov*1e9,(float) 1);
2172 phot++;
2173 }
2174 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
2175 if (cmother == nmothers){
2176 if (closs == 4)
2177 mothers2[cmother]++;
2178 mothers[cmother]++;
2179 }
2180 }
2181 }
2182 }
2183 }
2184
2185
2186 if(gAlice->TreeR())
2187 {
2188 Int_t nent=(Int_t)gAlice->TreeR()->GetEntries();
2189 gAlice->TreeR()->GetEvent(nent-1);
2190 TClonesArray *Rawclusters = pRICH->RawClustAddress(2); // Raw clusters branch
2191 //printf ("Rawclusters:%p",Rawclusters);
2192 Int_t nrawclusters = Rawclusters->GetEntriesFast();
2193
2194 if (nrawclusters) {
2195 printf("Raw Clusters : %d\n",nrawclusters);
2196 for (Int_t hit=0;hit<nrawclusters;hit++) {
2197 AliRICHRawCluster* rcHit = (AliRICHRawCluster*) pRICH->RawClustAddress(2)->UncheckedAt(hit);
2198 //Int_t nchamber = rcHit->fChamber; // chamber number
2199 //Int_t nhit = cHit->fHitNumber; // hit number
2200 Int_t qtot = rcHit->fQ; // charge
2201 Float_t fx = rcHit->fX; // x-position
2202 Float_t fy = rcHit->fY; // y-position
2203 //Int_t type = rcHit->fCtype; // cluster type ?
2204 Int_t mult = rcHit->fMultiplicity; // How many pads form the cluster
2205 pads += mult;
2206 if (qtot > 0) {
2207 //printf ("fx: %d, fy: %d\n",fx,fy);
2208 if (fx>(x-4) && fx<(x+4) && fy>(y-4) && fy<(y+4)) {
2209 //printf("There %d \n",mult);
2210 padmip+=mult;
2211 } else {
2212 padnumber->Fill(mult,(float) 1);
2213 nraw++;
2214 if (mult<4) Clcharge->Fill(qtot,(float) 1);
2215 }
2216
2217 }
2218 }
2219 }
2220
2221
2222 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2223 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2224 //printf (" nrechits:%d\n",nrechits);
2225
2226 if(nrechits1D)
2227 {
2228 for (Int_t hit=0;hit<nrechits1D;hit++) {
2229 AliRICHRecHit1D* recHit1D = (AliRICHRecHit1D*) pRICH->RecHitsAddress1D(2)->UncheckedAt(hit);
2230 Float_t r_omega = recHit1D->fOmega; // Cerenkov angle
2231 Float_t *cer_pho = recHit1D->fCerPerPhoton; // Cerenkov angle per photon
2232 Int_t *padsx = recHit1D->fPadsUsedX; // Pads Used fo reconstruction (x)
2233 Int_t *padsy = recHit1D->fPadsUsedY; // Pads Used fo reconstruction (y)
2234 Int_t goodPhotons = recHit1D->fGoodPhotons; // Number of pads used for reconstruction
2235
2236 Omega1D->Fill(r_omega,(float) 1);
2237
2238 for (Int_t i=0; i<goodPhotons; i++)
2239 {
2240 PhotonCer->Fill(cer_pho[i],(float) 1);
2241 PadsUsed->Fill(padsx[i],padsy[i],1);
2242 //printf("Angle:%f, pad: %d %d\n",cer_pho[i],padsx[i],padsy[i]);
2243 }
2244
2245 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
2246 }
2247 }
2248
2249
2250 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2251 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2252 //printf (" nrechits:%d\n",nrechits);
2253
2254 if(nrechits3D)
2255 {
2256 recEffEvent = 0;
2257
2258 //for (Int_t hit=0;hit<nrechits3D;hit++) {
2259 AliRICHRecHit3D* recHit3D = (AliRICHRecHit3D*) pRICH->RecHitsAddress3D(2)->UncheckedAt(track);
2260 Float_t r_omega = recHit3D->fOmega; // Cerenkov angle
2261 Float_t r_theta = recHit3D->fTheta; // Theta angle of incidence
2262 Float_t r_phi = recHit3D->fPhi; // Phi angle if incidence
2263 Float_t meanradius = recHit3D->fMeanRadius; // Mean radius for reconstructed point
2264 Float_t originalOmega = recHit3D->fOriginalOmega; // Real Cerenkov angle
2265 Float_t originalTheta = recHit3D->fOriginalTheta; // Real incidence angle
2266 Float_t originalPhi = recHit3D->fOriginalPhi; // Real azimuthal angle
2267
2268
2269 //correction to track cerenkov angle
2270 originalOmega = (Float_t) ckovangle->GetMean();
2271
2272 if(diaglevel == 4)
2273 {
2274 printf("\nMean cerenkov angle: %f\n", originalOmega);
2275 printf("Reconstructed cerenkov angle: %f\n",r_omega);
2276 }
2277
2278 Float_t omegaError = TMath::Abs(originalOmega - r_omega);
2279 Float_t thetaError = TMath::Abs(originalTheta - r_theta);
2280 Float_t phiError = TMath::Abs(originalPhi - r_phi);
2281
2282
2283 if(TMath::Abs(omegaError) < 0.015)
2284 recEffEvent += 1;
2285
2286 Omega3D->Fill(r_omega,(float) 1);
2287 Theta->Fill(r_theta*180/TMath::Pi(),(float) 1);
2288 Phi->Fill(r_phi*180/TMath::Pi()-180,(float) 1);
2289 MeanRadius->Fill(meanradius,(float) 1);
2290 identification->Fill(PTfinal, r_omega,1);
2291 OriginalOmega->Fill(originalOmega, (float) 1);
2292 OriginalTheta->Fill(originalTheta, (float) 1);
2293 OriginalPhi->Fill(TMath::Abs(originalPhi), (float) 1);
2294 OmegaError->Fill(omegaError, (float) 1);
2295 ThetaError->Fill(thetaError, (float) 1);
2296 PhiError->Fill(phiError, (float) 1);
2297
2298 recEffEvent = recEffEvent;
2299 recEffTotal += recEffEvent;
2300
2301 Float_t pioncer = acos(sqrt((.139*.139+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2302 Float_t kaoncer = acos(sqrt((.439*.439+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2303 Float_t protoncer = acos(sqrt((.938*.938+PTfinal*PTfinal)/(PTfinal*PTfinal*1.285*1.285)));
2304
2305 Float_t piondist = TMath::Abs(r_omega - pioncer);
2306 Float_t kaondist = TMath::Abs(r_omega - kaoncer);
2307 Float_t protondist = TMath::Abs(r_omega - protoncer);
2308
2309 if(diaglevel == 4)
2310 {
2311 if(pioncer<r_omega)
2312 {
2313 printf("Identified as a PION!\n");
2314 pionCount += 1;
2315 }
2316 if(kaoncer<r_omega && pioncer>r_omega)
2317 {
2318 if(kaondist>piondist)
2319 {
2320 printf("Identified as a PION!\n");
2321 pionCount += 1;
2322 }
2323 else
2324 {
2325 printf("Identified as a KAON!\n");
2326 kaonCount += 1;
2327 }
2328 } }
2329 if(protoncer<r_omega && kaoncer>r_omega)
2330 {
2331 if(kaondist>protondist)
2332 {
2333 printf("Identified as a PROTON!\n");
2334 protonCount += 1;
2335 }
2336 else
2337 {
2338 printf("Identified as a KAON!\n");
2339 pionCount += 1;
2340 }
2341 }
2342 if(protoncer>r_omega)
2343 {
2344 printf("Identified as a PROTON!\n");
2345 protonCount += 1;
2346 }
2347
2348 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
2349 }
2350 }
2351 }
2352
2353
2354 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
2355 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
2356 mother->Fill(mothers2[nmothers],(float) 1);
2357 }
2358
2359 clusev->Fill(nraw,(float) 1);
2360 photev->Fill(phot,(float) 1);
2361 feedev->Fill(feed,(float) 1);
2362 padsmip->Fill(padmip,(float) 1);
2363 padscl->Fill(pads,(float) 1);
2364 phot = 0;
2365 feed = 0;
2366 pads = 0;
2367 nraw=0;
2368 padmip=0;
2369
2370
2371
2372 gAlice->ResetDigits();
2373 gAlice->TreeD()->GetEvent(0);
2374
2375 if (diaglevel < 4)
2376 {
2377
2378
2379 TClonesArray *Digits = pRICH->DigitsAddress(2);
2380 Int_t ndigits = Digits->GetEntriesFast();
2381 printf("Digits : %d\n",ndigits);
2382 padsev->Fill(ndigits,(float) 1);
2383 for (Int_t hit=0;hit<ndigits;hit++) {
2384 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
2385 Int_t qtot = dHit->Signal(); // charge
2386 Int_t ipx = dHit->PadX(); // pad number on X
2387 Int_t ipy = dHit->PadY(); // pad number on Y
2388 //printf("%d, %d\n",ipx,ipy);
2389 if( ipx<=100 && ipy <=100) hc0->Fill(ipx,ipy,(float) qtot);
2390 }
2391 }
2392
2393 if (diaglevel == 5)
2394 {
2395 for (Int_t ich=0;ich<7;ich++)
2396 {
2397 TClonesArray *Digits = pRICH->DigitsAddress(ich); // Raw clusters branch
2398 Int_t ndigits = Digits->GetEntriesFast();
2399 //printf("Digits:%d\n",ndigits);
2400 padsev->Fill(ndigits,(float) 1);
2401 if (ndigits) {
2402 for (Int_t hit=0;hit<ndigits;hit++) {
2403 AliRICHDigit* dHit = (AliRICHDigit*) Digits->UncheckedAt(hit);
2404 Int_t qtot = dHit->Signal(); // charge
2405 Int_t ipx = dHit->PadX(); // pad number on X
2406 Int_t ipy = dHit->PadY(); // pad number on Y
2407 if( ipx<=100 && ipy <=100 && ich==2) hc0->Fill(ipx,ipy,(float) qtot);
2408 if( ipx<=162 && ipy <=162 && ich==0) hc1->Fill(ipx,ipy,(float) qtot);
2409 if( ipx<=162 && ipy <=162 && ich==1) hc2->Fill(ipx,ipy,(float) qtot);
2410 if( ipx<=162 && ipy <=162 && ich==2) hc3->Fill(ipx,ipy,(float) qtot);
2411 if( ipx<=162 && ipy <=162 && ich==3) hc4->Fill(ipx,ipy,(float) qtot);
2412 if( ipx<=162 && ipy <=162 && ich==4) hc5->Fill(ipx,ipy,(float) qtot);
2413 if( ipx<=162 && ipy <=162 && ich==5) hc6->Fill(ipx,ipy,(float) qtot);
2414 if( ipx<=162 && ipy <=162 && ich==6) hc7->Fill(ipx,ipy,(float) qtot);
2415 }
2416 }
2417 }
2418 }
2419 }
2420
2421 if(diaglevel == 4)
2422 {
2423
2424 Stat_t omegaE;
2425 Stat_t thetaE;
2426 Stat_t phiE;
2427
2428 Stat_t omegaO;
2429 Stat_t thetaO;
2430 Stat_t phiO;
2431
2432 for(Int_t i=0;i<99;i++)
2433 {
2434 omegaE = OriginalOmega->GetBinContent(i);
2435 if(omegaE != 0)
2436 {
2437 omegaO = Omega3D->GetBinContent(i);
2438 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
2439 }
2440
2441 thetaE = OriginalTheta->GetBinContent(i);
2442 if(thetaE != 0)
2443 {
2444 thetaO = Theta->GetBinContent(i);
2445 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
2446 }
2447
2448 phiE = OriginalPhi->GetBinContent(i);
2449 if(phiE != 0)
2450 {
2451 phiO = Phi->GetBinContent(i);
2452 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
2453 }
2454 }
2455
2456
2457
2458 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
2459 printf(" Theta - %f\n", chiSquareTheta);
2460 printf(" Phi - %f\n", chiSquarePhi);
2461
2462 printf("\nKolmogorov test values: Omega - %5.4f\n", Omega3D->KolmogorovTest(OriginalOmega));
2463 printf(" Theta - %5.4f\n", Theta->KolmogorovTest(OriginalTheta));
2464 printf(" Phi - %5.4f\n", Phi->KolmogorovTest(OriginalPhi));
2465
2466 recEffTotal = recEffTotal/evNumber2;
2467 printf("\nTotal reconstruction efficiency: %5.2f%%\n", recEffTotal*100);
2468 printf("\n Pions: %d\n Kaons: %d\n Protons:%d\n",pionCount, kaonCount, protonCount);
2469
2470 }
2471
2472
2473 //Create canvases, set the view range, show histograms
2474
2475 TCanvas *c1 = 0;
2476 TCanvas *c2 = 0;
2477 TCanvas *c3 = 0;
2478 TCanvas *c4 = 0;
2479 TCanvas *c5 = 0;
2480 TCanvas *c6 = 0;
2481 TCanvas *c7 = 0;
2482 TCanvas *c8 = 0;
2483 TCanvas *c9 = 0;
2484 TCanvas *c10 = 0;
2485 TCanvas *c11 = 0;
2486 TCanvas *c12 = 0;
2487 TCanvas *c13 = 0;
2488
2489
2490 TStyle *mystyle=new TStyle("Plain","mystyle");
2491 mystyle->SetPalette(1,0);
2492 mystyle->SetFuncColor(2);
2493 mystyle->SetDrawBorder(0);
2494 mystyle->SetTitleBorderSize(0);
2495 mystyle->SetOptFit(1111);
2496 mystyle->cd();
2497
2498
2499 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2500 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2501 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2502 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2503
2504 switch(diaglevel)
2505 {
2506 case 1:
2507
2508 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
2509 hc0->SetXTitle("ix (npads)");
2510 hc0->Draw("colz");
2511
2512 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
2513 c2->Divide(2,2);
2514 //c4->SetFillColor(42);
2515
2516 c2->cd(1);
2517 feedback->SetXTitle("x (cm)");
2518 feedback->SetYTitle("y (cm)");
2519 feedback->Draw("colz");
2520
2521 c2->cd(2);
2522 //mip->SetFillColor(5);
2523 mip->SetXTitle("x (cm)");
2524 mip->SetYTitle("y (cm)");
2525 mip->Draw("colz");
2526
2527 c2->cd(3);
2528 //cerenkov->SetFillColor(5);
2529 cerenkov->SetXTitle("x (cm)");
2530 cerenkov->SetYTitle("y (cm)");
2531 cerenkov->Draw("colz");
2532
2533 c2->cd(4);
2534 //h->SetFillColor(5);
2535 h->SetXTitle("x (cm)");
2536 h->SetYTitle("y (cm)");
2537 h->Draw("colz");
2538
2539 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
2540 c3->Divide(2,1);
2541 //c10->SetFillColor(42);
2542
2543 c3->cd(1);
2544 hitsX->SetFillColor(5);
2545 hitsX->SetXTitle("(cm)");
2546 hitsX->Draw();
2547
2548 c3->cd(2);
2549 hitsY->SetFillColor(5);
2550 hitsY->SetXTitle("(cm)");
2551 hitsY->Draw();
2552
2553
2554 break;
2555 case 2:
2556
2557 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
2558 c4->Divide(2,1);
2559
2560 c4->cd(1);
2561 phspectra2->SetFillColor(5);
2562 phspectra2->SetXTitle("energy (eV)");
2563 phspectra2->Draw();
2564 c4->cd(2);
2565 phspectra1->SetFillColor(5);
2566 phspectra1->SetXTitle("energy (eV)");
2567 phspectra1->Draw();
2568
2569 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
2570 c5->Divide(2,2);
2571
2572 c5->cd(1);
2573 pionspectra->SetFillColor(5);
2574 pionspectra->SetXTitle("(GeV)");
2575 pionspectra->Draw();
2576
2577 c5->cd(2);
2578 protonspectra->SetFillColor(5);
2579 protonspectra->SetXTitle("(GeV)");
2580 protonspectra->Draw();
2581
2582 c5->cd(3);
2583 kaonspectra->SetFillColor(5);
2584 kaonspectra->SetXTitle("(GeV)");
2585 kaonspectra->Draw();
2586
2587 c5->cd(4);
2588 chargedspectra->SetFillColor(5);
2589 chargedspectra->SetXTitle("(GeV)");
2590 chargedspectra->Draw();
2591
2592 break;
2593
2594 case 3:
2595
2596
2597 if(gAlice->TreeR())
2598 {
2599 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
2600 c6->Divide(2,2);
2601
2602 c6->cd(1);
2603 Clcharge->SetFillColor(5);
2604 Clcharge->SetXTitle("ADC counts");
2605 if (evNumber2>10)
2606 {
2607 Clcharge->Fit("expo");
2608 }
2609 Clcharge->Draw();
2610
2611 c6->cd(2);
2612 padnumber->SetFillColor(5);
2613 padnumber->SetXTitle("(counts)");
2614 padnumber->Draw();
2615
2616 c6->cd(3);
2617 clusev->SetFillColor(5);
2618 clusev->SetXTitle("(counts)");
2619 if (evNumber2>10)
2620 {
2621 clusev->Fit("gaus");
2622 //gaus->SetLineColor(2);
2623 //gaus->SetLineWidth(3);
2624 }
2625 clusev->Draw();
2626
2627 c6->cd(4);
2628 padsmip->SetFillColor(5);
2629 padsmip->SetXTitle("(counts)");
2630 padsmip->Draw();
2631 }
2632
2633 if(evNumber2<1)
2634 {
2635 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
2636 mother->SetFillColor(5);
2637 mother->SetXTitle("counts");
2638 mother->Draw();
2639 }
2640
2641 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
2642 c7->Divide(2,2);
2643 //c7->SetFillColor(42);
2644
2645 c7->cd(1);
2646 totalphotonsevent->SetFillColor(5);
2647 totalphotonsevent->SetXTitle("Photons (counts)");
2648 if (evNumber2>10)
2649 {
2650 totalphotonsevent->Fit("gaus");
2651 //gaus->SetLineColor(2);
2652 //gaus->SetLineWidth(3);
2653 }
2654 totalphotonsevent->Draw();
2655
2656 c7->cd(2);
2657 photev->SetFillColor(5);
2658 photev->SetXTitle("(counts)");
2659 if (evNumber2>10)
2660 {
2661 photev->Fit("gaus");
2662 //gaus->SetLineColor(2);
2663 //gaus->SetLineWidth(3);
2664 }
2665 photev->Draw();
2666
2667 c7->cd(3);
2668 feedev->SetFillColor(5);
2669 feedev->SetXTitle("(counts)");
2670 if (evNumber2>10)
2671 {
2672 feedev->Fit("gaus");
2673 }
2674 feedev->Draw();
2675
2676 c7->cd(4);
2677 padsev->SetFillColor(5);
2678 padsev->SetXTitle("(counts)");
2679 if (evNumber2>10)
2680 {
2681 padsev->Fit("gaus");
2682 }
2683 padsev->Draw();
2684
2685 break;
2686
2687 case 4:
2688
2689
2690 if(nrechits3D)
2691 {
2692 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
2693 c8->Divide(1,3);
2694 //c2->SetFillColor(42);
2695
2696
2697 // data per hit
2698 c8->cd(1);
2699 hitsPhi->SetFillColor(5);
2700 if (evNumber2>10)
2701 hitsPhi->Fit("gaus");
2702 hitsPhi->Draw();
2703
2704 //data per track
2705 c8->cd(2);
2706 OriginalPhi->SetFillColor(5);
2707 if (evNumber2>10)
2708 OriginalPhi->Fit("gaus");
2709 OriginalPhi->Draw();
2710
2711 //recontructed data
2712 c8->cd(3);
2713 Phi->SetFillColor(5);
2714 if (evNumber2>10)
2715 Phi->Fit("gaus");
2716 Phi->Draw();
2717
2718 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
2719 c9->Divide(1,3);
2720
2721 // data per hit
2722 c9->cd(1);
2723 hitsTheta->SetFillColor(5);
2724 if (evNumber2>10)
2725 hitsTheta->Fit("gaus");
2726 hitsTheta->Draw();
2727
2728 //data per track
2729 c9->cd(2);
2730 OriginalTheta->SetFillColor(5);
2731 if (evNumber2>10)
2732 OriginalTheta->Fit("gaus");
2733 OriginalTheta->Draw();
2734
2735 //recontructed data
2736 c9->cd(3);
2737 Theta->SetFillColor(5);
2738 if (evNumber2>10)
2739 Theta->Fit("gaus");
2740 Theta->Draw();
2741
2742 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
2743 c10->Divide(1,3);
2744
2745 // data per hit
2746 c10->cd(1);
2747 ckovangle->SetFillColor(5);
2748 ckovangle->SetXTitle("angle (radians)");
2749 if (evNumber2>10)
2750 ckovangle->Fit("gaus");
2751 ckovangle->Draw();
2752
2753 //data per track
2754 c10->cd(2);
2755 OriginalOmega->SetFillColor(5);
2756 OriginalOmega->SetXTitle("angle (radians)");
2757 if (evNumber2>10)
2758 OriginalOmega->Fit("gaus");
2759 OriginalOmega->Draw();
2760
2761 //recontructed data
2762 c10->cd(3);
2763 Omega3D->SetFillColor(5);
2764 Omega3D->SetXTitle("angle (radians)");
2765 if (evNumber2>10)
2766 Omega3D->Fit("gaus");
2767 Omega3D->Draw();
2768
2769
2770 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
2771 c11->Divide(1,2);
2772
2773 // data per hit
2774 c11->cd(1);
2775 radius->SetFillColor(5);
2776 radius->SetXTitle("radius (cm)");
2777 radius->Draw();
2778
2779 //recontructed data
2780 c11->cd(2);
2781 MeanRadius->SetFillColor(5);
2782 MeanRadius->SetXTitle("radius (cm)");
2783 MeanRadius->Draw();
2784
2785
2786 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
2787
2788 c12->cd(1);
2789 identification->SetFillColor(5);
2790 identification->SetXTitle("Momentum (GeV/c)");
2791 identification->SetYTitle("Cherenkov angle (radians)");
2792
2793 TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
2794 TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
2795 TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
2796
2797 identification->Draw();
2798
2799 pionplot->SetLineColor(5);
2800 pionplot->Draw("same");
2801
2802 kaonplot->SetLineColor(4);
2803 kaonplot->Draw("same");
2804
2805 protonplot->SetLineColor(3);
2806 protonplot->Draw("same");
2807
2808 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
2809 c13->Divide(3,1);
2810
2811 c13->cd(1);
2812 PhiError->SetFillColor(5);
2813 if (evNumber2>10)
2814 PhiError->Fit("gaus");
2815 PhiError->Draw();
2816 c13->cd(2);
2817 ThetaError->SetFillColor(5);
2818 if (evNumber2>10)
2819 ThetaError->Fit("gaus");
2820 ThetaError->Draw();
2821 c13->cd(3);
2822 OmegaError->SetFillColor(5);
2823 OmegaError->SetXTitle("angle (radians)");
2824 if (evNumber2>10)
2825 OmegaError->Fit("gaus");
2826 OmegaError->Draw();
2827
2828 }
2829
2830 if(nrechits1D)
2831 {
2832 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
2833 c9->Divide(3,2);
2834 //c5->SetFillColor(42);
2835
2836 c9->cd(1);
2837 ckovangle->SetFillColor(5);
2838 ckovangle->SetXTitle("angle (radians)");
2839 ckovangle->Draw();
2840
2841 c9->cd(2);
2842 radius->SetFillColor(5);
2843 radius->SetXTitle("radius (cm)");
2844 radius->Draw();
2845
2846 c9->cd(3);
2847 hc0->SetXTitle("pads");
2848 hc0->Draw("box");
2849
2850 c9->cd(5);
2851 Omega1D->SetFillColor(5);
2852 Omega1D->SetXTitle("angle (radians)");
2853 Omega1D->Draw();
2854
2855 c9->cd(4);
2856 PhotonCer->SetFillColor(5);
2857 PhotonCer->SetXTitle("angle (radians)");
2858 PhotonCer->Draw();
2859
2860 c9->cd(6);
2861 PadsUsed->SetXTitle("pads");
2862 PadsUsed->Draw("box");
2863 }
2864
2865 break;
2866
2867 case 5:
2868
2869 printf("Drawing histograms.../n");
2870
2871 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
2872 c1->Divide(4,2);
2873
2874 c10->cd(1);
2875 hc1->SetXTitle("ix (npads)");
2876 hc1->Draw("box");
2877 c10->cd(2);
2878 hc2->SetXTitle("ix (npads)");
2879 hc2->Draw("box");
2880 c10->cd(3);
2881 hc3->SetXTitle("ix (npads)");
2882 hc3->Draw("box");
2883 c10->cd(4);
2884 hc4->SetXTitle("ix (npads)");
2885 hc4->Draw("box");
2886 c10->cd(5);
2887 hc5->SetXTitle("ix (npads)");
2888 hc5->Draw("box");
2889 c10->cd(6);
2890 hc6->SetXTitle("ix (npads)");
2891 hc6->Draw("box");
2892 c10->cd(7);
2893 hc7->SetXTitle("ix (npads)");
2894 hc7->Draw("box");
2895 c10->cd(8);
2896 hc0->SetXTitle("ix (npads)");
2897 hc0->Draw("box");
2898 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
2899 c11->Divide(2,2);
2900
2901 c11->cd(1);
2902 feedback->SetXTitle("x (cm)");
2903 feedback->SetYTitle("y (cm)");
2904 feedback->Draw();
2905
2906 c11->cd(2);
2907 mip->SetXTitle("x (cm)");
2908 mip->SetYTitle("y (cm)");
2909 mip->Draw();
2910
2911 c11->cd(3);
2912 cerenkov->SetXTitle("x (cm)");
2913 cerenkov->SetYTitle("y (cm)");
2914 cerenkov->Draw();
2915
2916 c11->cd(4);
2917 h->SetXTitle("x (cm)");
2918 h->SetYTitle("y (cm)");
2919 h->Draw();
2920
2921 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
2922 c12->Divide(2,1);
2923
2924 c12->cd(1);
2925 hitsX->SetFillColor(5);
2926 hitsX->SetXTitle("(cm)");
2927 hitsX->Draw();
2928
2929 c12->cd(2);
2930 hitsY->SetFillColor(5);
2931 hitsY->SetXTitle("(cm)");
2932 hitsY->Draw();
2933
2934 break;
2935
2936 }
2937
2938
2939 printf("\nEnd of analysis\n");
2940 printf("**********************************\n");
2941}//void AliRICHv3::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
2942
2943//__________________________________________________________________________________________________
2944void AliRICHv3::MakeBranch(Option_t* option)
2945{//Create Tree branches for the RICH.
2946 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
2947
2948 const Int_t kBufferSize = 4000;
2949 char branchname[20];
2950
2951
2952 const char *cH = strstr(option,"H");
2953 const char *cD = strstr(option,"D");
2954 const char *cR = strstr(option,"R");
2955 const char *cS = strstr(option,"S");
2956
2957
2958 if(cH&&TreeH()){
2959 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
2960 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
2961 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
2962
2963 if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
2964 MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
2965 }
2966 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
2967
2968 if(cS&&fLoader->TreeS()){
2969 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
2970 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
2971 }
2972
2973 int i;
2974 if (cD&&fLoader->TreeD()){
2975 if(!fDchambers){
2976 fDchambers=new TObjArray(kNCH); // one branch for digits per chamber
2977 for(i=0;i<kNCH;i++){
2978 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
2979 }
2980 }
2981 for (i=0; i<kNCH ;i++)
2982 {
2983 sprintf(branchname,"%sDigits%d",GetName(),i+1);
2984 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
2985 }
2986 }
2987
2988 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
2989 Int_t i;
2990 if (fRawClusters == 0x0 )
2991 {
2992 fRawClusters = new TObjArray(kNCH);
2993 for (i=0; i<kNCH ;i++)
2994 {
2995 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
2996 }
2997 }
2998
2999 if (fRecHits1D == 0x0)
3000 {
3001 fRecHits1D = new TObjArray(kNCH);
3002 for (i=0; i<kNCH ;i++)
3003 {
3004 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3005 }
3006 }
3007
3008 if (fRecHits3D == 0x0)
3009 {
3010 fRecHits3D = new TObjArray(kNCH);
3011 for (i=0; i<kNCH ;i++)
3012 {
3013 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
3014 }
3015 }
3016
3017 for (i=0; i<kNCH ;i++){
3018 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
3019 MakeBranchInTree(gAlice->TreeR(),branchname, &((*fRawClusters)[i]), kBufferSize, 0);
3020 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
3021 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits1D)[i]), kBufferSize, 0);
3022 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
3023 MakeBranchInTree(fLoader->TreeR(),branchname, &((*fRecHits3D)[i]), kBufferSize, 0);
3024 }
3025 }//if (cR && gAlice->TreeR())
3026 if(GetDebug())Info("MakeBranch","Stop.");
3027}
3028//______________________________________________________________________________
3029void AliRICHv3::SetTreeAddress()
3030{//Set branch address for the Hits and Digits Tree.
3031 if(GetDebug())Info("SetTreeAddress","Start.");
3032
3033 char branchname[20];
3034 Int_t i;
3035
3036
3037 TBranch *branch;
3038 TTree *treeH = fLoader->TreeH();
3039 TTree *treeD = fLoader->TreeD();
3040 TTree *treeR = fLoader->TreeR();
3041 TTree *treeS = fLoader->TreeS();
3042
3043 if(treeH){
3044 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
3045 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
3046
3047 branch = treeH->GetBranch("RICHCerenkov");
3048 if(branch){
3049 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
3050 branch->SetAddress(&fCerenkovs);
3051 }
3052
3053 branch = treeH->GetBranch("RICHSDigits");
3054 if (branch)
3055 {
3056 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
3057 branch->SetAddress(&fSDigits);
3058 }
3059 }//if(treeH)
3060
3061 //this is after TreeH because we need to guarantee that fHits array is created
3062 AliDetector::SetTreeAddress();
3063
3064 if(treeS){
3065 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
3066 branch = treeS->GetBranch("RICH");
3067 if(branch){
3068 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
3069 branch->SetAddress(&fSDigits);
3070 }
3071 }
3072
3073
3074 if(treeD){
3075 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
3076
3077 if (fDchambers == 0x0)
3078 {
3079 fDchambers = new TObjArray(kNCH);
3080 for (i=0; i<kNCH ;i++)
3081 {
3082 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
3083 }
3084 }
3085
3086 for (i=0; i<kNCH; i++) {
3087 sprintf(branchname,"%sDigits%d",GetName(),i+1);
3088 if (fDchambers) {
3089 branch = treeD->GetBranch(branchname);
3090 if (branch) branch->SetAddress(&((*fDchambers)[i]));
3091 }
3092 }
3093 }
3094
3095 if(treeR){
3096 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
3097
3098 if (fRawClusters == 0x0 )
3099 {
3100 fRawClusters = new TObjArray(kNCH);
3101 for (i=0; i<kNCH ;i++)
3102 {
3103 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
3104 }
3105 }
3106
3107 if (fRecHits1D == 0x0)
3108 {
3109 fRecHits1D = new TObjArray(kNCH);
3110 for (i=0; i<kNCH ;i++)
3111 {
3112 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3113 }
3114 }
3115
3116 if (fRecHits3D == 0x0)
3117 {
3118 fRecHits3D = new TObjArray(kNCH);
3119 for (i=0; i<kNCH ;i++)
3120 {
3121 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
3122 }
3123 }
3124
3125 for (i=0; i<kNCH; i++) {
3126 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
3127 if (fRawClusters) {
3128 branch = treeR->GetBranch(branchname);
3129 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
3130 }
3131 }
3132
3133 for (i=0; i<kNCH; i++) {
3134 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
3135 if (fRecHits1D) {
3136 branch = treeR->GetBranch(branchname);
3137 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
3138 }
3139 }
3140
3141 for (i=0; i<kNCH; i++) {
3142 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
3143 if (fRecHits3D) {
3144 branch = treeR->GetBranch(branchname);
3145 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
3146 }
3147 }
3148
3149 }//if(treeR)
3150 if(GetDebug())Info("SetTreeAddress","Stop.");
3151}//void AliRICHv3::SetTreeAddress()