1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 #include <Riostream.h>
20 #include <TGeometry.h>
21 #include <TLorentzVector.h>
23 #include <TParticle.h>
25 #include <TVirtualMC.h>
26 #include <TPDGCode.h> //for kNuetron
36 #include "AliRICHGeometry.h"
37 #include "AliRICHResponseV0.h"
38 #include "AliRICHSegmentationV1.h"
39 #include "AliRICHv3.h"
41 #include "AliRICHRecHit3D.h"
42 #include "AliRICHRawCluster.h"
43 #include "AliRICHDigit.h"
44 #include "AliRICHRecHit1D.h"
49 //______________________________________________________________
50 // Implementation of the RICH version 3 with azimuthal rotation
53 AliRICHv3::AliRICHv3(const char *sName, const char *sTitle)
54 :AliRICH(sName,sTitle)
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 (???).
60 if(GetDebug())Info("named ctor","Start.");
62 fCkovNumber=fFreonProd=0;
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
68 for (Int_t i=1; i<=kNCH; i++){
69 SetGeometryModel(i,pRICHGeometry);
70 SetSegmentationModel(i,pRICHSegmentation);
71 SetResponseModel(i,pRICHResponse);
72 C(i)->Init(i); // ??? to be removed
74 if(GetDebug())Info("named ctor","Stop.");
75 }//AliRICHv3::ctor(const char *pcName, const char *pcTitle)
77 AliRICHv3::~AliRICHv3()
79 // Dtor deletes RICH models. In future (???) AliRICHChamber will be responsible for that.
80 if(GetDebug()) cout<<ClassName()<<"::dtor()>\n";
83 AliRICHChamber *ch =C(1);
85 delete ch->GetGeometryModel();
86 delete ch->GetResponseModel();
87 delete ch->GetSegmentationModel();
93 void AliRICHv3::CreateGeometry()
95 // Provides geometry structure for simulation (currently GEANT volumes tree)
96 if(GetDebug()) cout<<ClassName()<<"::CreateGeometry()>\n";
98 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
99 AliRICHSegmentationV0* segmentation;
100 AliRICHGeometry* geometry;
101 AliRICHChamber* iChamber;
103 iChamber = &(pRICH->Chamber(0));
104 segmentation=(AliRICHSegmentationV0*) iChamber->GetSegmentationModel();
105 geometry=iChamber->GetGeometryModel();
108 distance = geometry->GetFreonThickness()/2 + geometry->GetQuartzThickness() + geometry->GetGapThickness();
109 geometry->SetRadiatorToPads(distance);
111 //Opaque quartz thickness
112 Float_t oqua_thickness = .5;
116 Float_t csi_width = segmentation->Npx()*segmentation->Dpx() + segmentation->DeadZone();
117 Float_t csi_length = segmentation->Npy()*segmentation->Dpy() + 2*segmentation->DeadZone();
120 Int_t *idtmed = fIdtmed->GetArray()-999;
127 // --- Define the RICH detector
128 // External aluminium box
130 par[1] = 13; //Original Settings
132 gMC->Gsvolu("RICH", "BOX ", idtmed[1009], par, 3);
136 par[1] = 13; //Original Settings
138 gMC->Gsvolu("SRIC", "BOX ", idtmed[1000], par, 3);
140 // Air 2 (cutting the lower part of the box)
143 par[1] = 3; //Original Settings
145 gMC->Gsvolu("AIR2", "BOX ", idtmed[1000], par, 3);
147 // Air 3 (cutting the lower part of the box)
150 par[1] = 3; //Original Settings
152 gMC->Gsvolu("AIR3", "BOX ", idtmed[1000], par, 3);
156 par[1] = .188; //Original Settings
158 gMC->Gsvolu("HONE", "BOX ", idtmed[1001], par, 3);
162 par[1] = .025; //Original Settings
167 gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
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);
175 // Spacers (cylinders)
178 par[2] = geometry->GetFreonThickness()/2;
179 gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);
181 // Feet (freon slabs supports)
186 gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
189 par[0] = geometry->GetQuartzWidth()/2;
191 par[2] = geometry->GetQuartzLength()/2;
192 gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
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);
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);
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);
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);
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);
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);
230 par[0] = csi_width/2;
232 par[2] = csi_length/2;
233 gMC->Gsvolu("CSI ", "BOX ", idtmed[1005], par, 3);
239 gMC->Gsvolu("GRID", "TUBE", idtmed[1006], par, 3);
244 par[0] = csi_width/2;
247 gMC->Gsvolu("WSMe", "BOX ", idtmed[1009], par, 3);
249 // Ceramic pick up (base)
251 par[0] = csi_width/2;
254 gMC->Gsvolu("WSG1", "BOX ", idtmed[1010], par, 3);
256 // Ceramic pick up (head)
258 par[0] = csi_width/2;
261 gMC->Gsvolu("WSG2", "BOX ", idtmed[1010], par, 3);
263 // Aluminium supports for methane and CsI
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);
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);
278 // Aluminium supports for freon
281 par[0] = geometry->GetQuartzWidth()/2;
283 par[2] = (68.35 - geometry->GetQuartzLength()/2)/2;
284 gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);
288 par[0] = (66.3 - geometry->GetQuartzWidth()/2)/2;
290 par[2] = geometry->GetQuartzLength()/2 + 68.35 - geometry->GetQuartzLength()/2;
291 gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);
295 par[0] = csi_width/2;
297 par[2] = csi_length/4 -.5025;
298 gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
301 // Backplane supports
308 gMC->Gsvolu("BACK", "BOX", idtmed[1009], par, 3);
315 gMC->Gsvolu("BKHL", "BOX", idtmed[1000], par, 3);
322 gMC->Gsvolu("BKHS", "BOX", idtmed[1000], par, 3);
324 // Place holes inside backplane support
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");
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");
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");
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");
377 Float_t supp_y = 1.276 - geometry->GetGapThickness()/2- geometry->GetQuartzThickness() -geometry->GetFreonThickness() - .2 + .3; //y position of freon supports
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");
384 AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
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
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
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
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
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
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
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);
431 // Wire support placing
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");
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");
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");
451 // Place chambers into mother volume ALIC
453 Double_t dOffset = geometry->GetOffset() - geometry->GetGapThickness()/2; // distance from center of mother volume ALIC to methane
455 Double_t dAlpha = geometry->GetAlphaAngle(); // angle between centers of chambers - y-z plane
456 Double_t dAlphaRad = dAlpha*kDegrad;
458 Double_t dBeta = geometry->GetBetaAngle(); // angle between center of chambers - y-x plane
459 Double_t dBetaRad = dBeta*kDegrad;
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;
465 TRotMatrix *pRotMatrix; // tmp pointer
467 TVector3 vector(0,dOffset,0); // Position of chamber 2 without rotation
469 // Chamber 0 standalone (no other chambers in this row)
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]);
476 vector.SetXYZ(0,dOffset,0); vector.RotateX(dAlphaRad);
477 vector.RotateZ(-dRotAngleRad);
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);
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());
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]);
489 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad);
490 vector.RotateZ(-dRotAngleRad);
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);
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());
496 // Chamber 2 the top one with no Alpha-Beta rotation
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]);
502 vector.SetXYZ(0,dOffset,0);
503 vector.RotateZ(-dRotAngleRad);
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);
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());
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]);
514 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad);
515 vector.RotateZ(-dRotAngleRad);
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);
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());
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]);
527 vector.SetXYZ(0,dOffset,0); vector.RotateZ(-dBetaRad); vector.RotateX(-dAlphaRad);
528 vector.RotateZ(-dRotAngleRad);
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);
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());
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]);
540 vector.SetXYZ(0,dOffset,0); vector.RotateX(-dAlphaRad);
541 vector.RotateZ(-dRotAngleRad);
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);
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());
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]);
553 vector.SetXYZ(0,dOffset,0); vector.RotateZ(dBetaRad); vector.RotateX(-dAlphaRad);
554 vector.RotateZ(-dRotAngleRad);
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);
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());
561 }//void AliRICHv3::CreateGeometry()
562 //______________________________________________________________________________
563 void AliRICHv3::Init()
564 {//Makes nothing for a while
565 if(GetDebug())Info("Init","Start.");
566 if(GetDebug())Info("Init","Stop.");
568 //______________________________________________________________________________
569 void AliRICHv3::BuildGeometry()
570 {//Provides geometry structure for event display (ROOT TNode tree)
571 if(GetDebug())Info("BuildGeometry","Start.");
573 TNode *node, *subnode, *top;
575 const int kColorRICH = kRed;
577 top=gAlice->GetGeometry()->GetNode("alice");
579 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
580 AliRICHChamber* iChamber;
581 AliRICHGeometry* geometry;
583 iChamber = &(pRICH->Chamber(0));
584 AliRICHSegmentationV1* segmentation=(AliRICHSegmentationV1*) iChamber->GetSegmentationModel();
585 geometry=iChamber->GetGeometryModel();
587 new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
589 Float_t padplane_width = segmentation->GetPadPlaneWidth();
590 Float_t padplane_length = segmentation->GetPadPlaneLength();
593 new TBRIK("PHOTO","PHOTO","void", padplane_width/2,.1,padplane_length/2);
597 node = new TNode("RICH1","RICH1","S_RICH",Chamber(0).GetX(),Chamber(0).GetY(),Chamber(0).GetZ(),"rot993");
598 node->SetLineColor(kColorRICH);
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);
622 node = new TNode("RICH2","RICH2","S_RICH",Chamber(1).GetX(),Chamber(1).GetY(),Chamber(1).GetZ(),"rot994");
623 node->SetLineColor(kColorRICH);
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);
647 node = new TNode("RICH3","RICH3","S_RICH",Chamber(2).GetX(),Chamber(2).GetY(),Chamber(2).GetZ(),"rot995");
648 node->SetLineColor(kColorRICH);
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);
672 node = new TNode("RICH4","RICH4","S_RICH",Chamber(3).GetX(),Chamber(3).GetY(),Chamber(3).GetZ(),"rot996");
673 node->SetLineColor(kColorRICH);
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);
697 node = new TNode("RICH5","RICH5","S_RICH",Chamber(4).GetX(),Chamber(4).GetY(),Chamber(4).GetZ(),"rot997");
698 node->SetLineColor(kColorRICH);
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);
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);
746 node = new TNode("RICH7","RICH7","S_RICH",Chamber(6).GetX(),Chamber(6).GetY(),Chamber(6).GetZ(),"rot999");
747 node->SetLineColor(kColorRICH);
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);
768 if(GetDebug())Info("BuildGeometry","Stop.");
769 }//AliRICHv3::BuildGeometry()
770 //______________________________________________________________________________
771 Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
773 // Rotatation in xy-plane
775 // The resulting rotation matrix is given back in the G3 notation.
776 Double_t* rr = new Double_t[6];
780 for (i = 0; i < 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);
787 for (i = 0; i < 3; i++) {
790 rr[k] = TMath::ACos(m[j+2]) * kRaddeg;
791 rr[k+1] = TMath::ATan2(m[j+1], m[j]) * kRaddeg;
794 }//Double_t* AliRICHv3::RotateXY(const Double_t* r, Double_t a)
795 //______________________________________________________________________________
796 void AliRICHv3::StepManager()
803 static Float_t hits[22];
804 static Float_t ckovData[19];
805 TLorentzVector position;
806 TLorentzVector momentum;
811 Float_t localTheta,localPhi;
813 Float_t destep, step;
816 static Float_t eloss, xhit, yhit, tlength;
817 const Float_t kBig=1.e10;
819 TClonesArray &lhits = *fHits;
820 TParticle *current = (TParticle*)(*gAlice->Particles())[gAlice->GetCurrentTrackNumber()];
822 //if (current->Energy()>1)
825 // Only gas gap inside chamber
826 // Tag chambers and record hits when track enters
829 id=gMC->CurrentVolID(copy);
831 Float_t cherenkovLoss=0;
832 //gAlice->KeepTrack(gAlice->GetCurrentTrackNumber());
834 gMC->TrackPosition(position);
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
843 //ckovData[11] = gAlice->GetCurrentTrackNumber();
845 //printf("\n+++++++++++\nTrack: %d\n++++++++++++\n",gAlice->GetCurrentTrackNumber());
847 //AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH");
849 /********************Store production parameters for Cerenkov photons************************/
850 //is it a Cerenkov photon?
851 if (gMC->TrackPid() == 50000050) {
853 //if (gMC->VolId("GAP ")==gMC->CurrentVolID(copy))
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)
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))
864 if (gMC->IsNewTrack()){ //is it the first step?
865 //printf("I'm in!\n");
866 Int_t mother = current->GetFirstMother();
868 //printf("Second Mother:%d\n",current->GetSecondMother());
870 ckovData[10] = mother;
871 ckovData[11] = gAlice->GetCurrentTrackNumber();
872 ckovData[12] = 1; //Media where photon was produced 1->Freon, 2->Quarz
873 //printf("Produced in FREO\n");
876 //printf("Index: %d\n",fCkovNumber);
877 } //first step question
880 if (gMC->IsNewTrack()){ //is it first step?
881 if (gMC->VolId("QUAR")==gMC->CurrentVolID(copy)) //is it in quarz?
884 //printf("Produced in QUAR\n");
886 } //first step question
888 //printf("Before %d\n",fFreonProd);
889 } //track entering question
891 if (ckovData[12] == 1) //was it produced in Freon?
892 //if (fFreonProd == 1)
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?
900 //printf("Got in META\n");
901 gMC->TrackMomentum(momentum);
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);
915 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
916 //printf("Added One (1)!\n");
917 //printf("Lost one in grid\n");
919 /**********************************************************************************/
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?
926 //printf("Got in CSI\n");
927 gMC->TrackMomentum(momentum);
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);
945 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
947 //printf("Added One (2)!\n");
948 //printf("Lost by Fresnel\n");
950 /**********************************************************************************/
955 /********************Evaluation of losses************************/
956 /******************still in the old fashion**********************/
959 Int_t i1 = gMC->StepProcesses(procs); //number of physics mechanisms acting on the particle
960 for (Int_t i = 0; i < i1; ++i) {
962 if (procs[i] == kPLightReflection) { //was it reflected
964 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
966 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
969 //AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
970 } //reflection question
973 else if (procs[i] == kPLightAbsorption) { //was it absorbed?
974 //printf("Got in absorption\n");
976 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
978 if (gMC->CurrentVolID(copy) == gMC->VolId("QUAR"))
980 if (gMC->CurrentVolID(copy) == gMC->VolId("META"))
982 if (gMC->CurrentVolID(copy) == gMC->VolId("GAP "))
985 if (gMC->CurrentVolID(copy) == gMC->VolId("SRIC"))
989 if (gMC->CurrentVolID(copy) == gMC->VolId("CSI ")) {
993 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
994 //printf("Added One (3)!\n");
995 //printf("Added cerenkov %d\n",fCkovNumber);
996 } //absorption question
999 // Photon goes out of tracking scope
1000 else if (procs[i] == kPStop) { //is it below energy treshold?
1003 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
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
1013 /**************************************End of Production Parameters Storing*********************/
1016 /*******************************Treat photons that hit the CsI (Ckovs and Feedbacks)************/
1018 if (gMC->TrackPid() == 50000050 || gMC->TrackPid() == 50000051) {
1019 //printf("Cerenkov\n");
1021 //if (gMC->TrackPid() == 50000051)
1022 //printf("Tracking a feedback\n");
1024 if (gMC->VolId("CSI ")==gMC->CurrentVolID(copy))
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);
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;
1045 gMC->CurrentVolOffID(2,copy);
1050 gMC->Gmtod(pos,localPos,1);
1052 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1054 gMC->Gmtod(mom,localMom,2);
1056 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1058 gMC->CurrentVolOffID(2,copy);
1062 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1063 //->Sector(localPos[0], localPos[2]);
1064 //printf("Sector:%d\n",sector);
1066 /*if (gMC->TrackPid() == 50000051){
1068 printf("Feedbacks:%d\n",fFeedbacks);
1071 //PH ((AliRICHChamber*) (*fChambers)[idvol])
1072 ((AliRICHChamber*)fChambers->At(idvol))
1073 ->SigGenInit(localPos[0], localPos[2], localPos[1]);
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
1081 ckovData[8] = (Float_t) fNsdigits; // first sdigit
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];
1088 destep = gMC->Edep();
1089 gMC->SetMaxStep(kBig);
1090 cherenkovLoss += destep;
1091 ckovData[7]=cherenkovLoss;
1093 ckovData[17] = Hits2SDigits(localPos[0],localPos[2],cherenkovLoss,idvol,kPhoton);//for photons in CsI
1095 if (fNsdigits > (Int_t)ckovData[8]) {
1096 ckovData[8]= ckovData[8]+1;
1097 ckovData[9]= (Float_t) fNsdigits;
1101 //TClonesArray *Hits = RICH->Hits();
1102 AliRICHhit *mipHit = (AliRICHhit*) (fHits->UncheckedAt(0));
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();
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);
1118 coscerenkov = (mom[0]*mipPx + mom[1]*mipPy + mom[2]*mipPz)/(rt*mipRt);
1124 Float_t cherenkov = TMath::ACos(coscerenkov);
1125 ckovData[18]=cherenkov;
1129 AddHit(gAlice->GetCurrentTrackNumber(),vol,ckovData);
1130 AddCerenkov(gAlice->GetCurrentTrackNumber(),vol,ckovData);
1131 //printf("Added One (5)!\n");
1138 /***********************************************End of photon hits*********************************************/
1141 /**********************************************Charged particles treatment*************************************/
1143 else if (gMC->TrackCharge()){
1145 /*if (gMC->IsTrackEntering())
1147 hits[13]=20;//is track entering?
1149 if (gMC->VolId("FRE1")==gMC->CurrentVolID(copy) || gMC->VolId("FRE2")==gMC->CurrentVolID(copy))
1151 gMC->TrackMomentum(momentum);
1162 if (gMC->VolId("GAP ")== gMC->CurrentVolID(copy)) {//is in GAP?
1163 // Get current particle id (ipart), track position (pos) and momentum (mom)
1165 gMC->CurrentVolOffID(3,copy);
1169 //Int_t sector=((AliRICHChamber*) (*fChambers)[idvol])
1170 //->Sector(localPos[0], localPos[2]);
1171 //printf("Sector:%d\n",sector);
1173 gMC->TrackPosition(position);
1174 gMC->TrackMomentum(momentum);
1183 gMC->Gmtod(pos,localPos,1);
1185 //Chamber(idvol).GlobaltoLocal(pos,localPos);
1187 gMC->Gmtod(mom,localMom,2);
1189 //Chamber(idvol).GlobaltoLocal(mom,localMom);
1191 ipart = gMC->TrackPid();
1193 // momentum loss and steplength in last step
1194 destep = gMC->Edep();
1195 step = gMC->TrackStep();
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;
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;
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
1218 hits[8] = (Float_t) fNsdigits; // first sdigit
1219 hits[9] = -1; // last pad hit
1220 hits[13] = fFreonProd; // did id hit the freon?
1224 hits[18] = 0; // dummy cerenkov angle
1230 Chamber(idvol).LocaltoGlobal(localPos,hits+1);
1233 //To make chamber coordinates x-y had to pass localPos[0], localPos[2]
1236 // Only if not trigger chamber
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]);
1247 // Calculate the charge induced on a pad (disintegration) in case
1249 // Mip left chamber ...
1250 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1251 gMC->SetMaxStep(kBig);
1256 // Only if not trigger chamber
1260 if(gMC->TrackPid() == kNeutron)
1261 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1262 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip); //for MIP
1268 if (fNsdigits > (Int_t)hits[8]) {
1270 hits[9]= (Float_t) fNsdigits;
1274 new(lhits[fNhits++]) AliRICHhit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
1277 // Check additional signal generation conditions
1278 // defined by the segmentation
1279 // model (boundary crossing conditions)
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]);
1284 if(gMC->TrackPid() == kNeutron)
1285 printf("\n\n\n\n\n Neutron Making Pad Hit!!! \n\n\n\n");
1286 hits[17] = Hits2SDigits(xhit,yhit,eloss,idvol,kMip);//for n
1293 // nothing special happened, add up energy loss
1300 /*************************************************End of MIP treatment**************************************/
1301 }//void AliRICHv3::StepManager()
1302 //__________________________________________________________________________________________________
1303 Int_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
1306 Int_t iChamber=kBad,iPadX=kBad,iPadY=kBad,iAdc=kBad,iTrack=kBad;
1307 Float_t list[4][500];
1309 ((AliRICHChamber*)fChambers->At(idvol))->DisIntegration(eloss, xhit, yhit, iNdigits, list, res);
1312 for(Int_t i=0; i<iNdigits; i++) {
1313 if(Int_t(list[0][i]) > 0) {
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);
1323 if(fLoader->TreeS()){
1324 fLoader->TreeS()->Fill();
1325 fLoader->WriteSDigits("OVERWRITE");
1328 }//Int_t AliRICHv3::Hits2SDigits(Float_t xhit,Float_t yhit,Float_t eloss, Int_t idvol, ResponseType res)
1329 //__________________________________________________________________________________________________
1330 void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1333 Int_t NpadX = 162; // number of pads on X
1334 Int_t NpadY = 162; // number of pads on Y
1336 Int_t Pad[162][162];
1337 for (Int_t i=0;i<NpadX;i++) {
1338 for (Int_t j=0;j<NpadY;j++) {
1343 // Create some histograms
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);
1381 // Start loop over events
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;
1388 for (int nev=0; nev<= evNumber2; nev++) {
1389 Int_t nparticles = gAlice->GetEvent(nev);
1392 if (nev < evNumber1) continue;
1393 if (nparticles <= 0) return;
1395 // Get pointers to RICH detector and Hits containers
1397 AliRICH *pRICH = (AliRICH *) gAlice->GetDetector("RICH");
1399 TTree *treeH = TreeH();
1400 Int_t ntracks =(Int_t) treeH->GetEntries();
1402 // Start loop on tracks in the hits containers
1404 for (Int_t track=0; track<ntracks;track++) {
1405 printf ("Processing Track: %d\n",track);
1406 gAlice->ResetHits();
1407 treeH->GetEvent(track);
1409 for(AliRICHhit* mHit=(AliRICHhit*)pRICH->FirstHit(-1);
1411 mHit=(AliRICHhit*)pRICH->NextHit())
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());
1427 TParticle *current = gAlice->Particle(index);
1429 //Float_t energy=current->Energy();
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());
1437 if (TMath::Abs(particle) < 10000000)
1439 hitsTheta->Fill(theta,(float) 1);
1442 if (PTvertex>.5 && PTvertex<=1)
1444 hitsTheta500MeV->Fill(theta,(float) 1);
1446 if (PTvertex>1 && PTvertex<=2)
1448 hitsTheta1GeV->Fill(theta,(float) 1);
1450 if (PTvertex>2 && PTvertex<=3)
1452 hitsTheta2GeV->Fill(theta,(float) 1);
1456 hitsTheta3GeV->Fill(theta,(float) 1);
1465 if (TMath::Abs(particle) < 50000051)
1467 //if (TMath::Abs(particle) == 50000050 || TMath::Abs(particle) == 2112)
1468 if (TMath::Abs(particle) == 2112 || TMath::Abs(particle) == 50000050)
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)
1480 if (current->Energy()>0.001)
1481 highprimaryphotons +=1;
1484 if (TMath::Abs(particle) == 2112)
1487 if (current->Energy()>0.0001)
1491 if (TMath::Abs(particle) < 50000000)
1493 production->Fill(current->Vz(),R,(float) 1);
1495 //mip->Fill(x,y,(float) 1);
1498 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
1502 pionptspectravertex->Fill(PTvertex,(float) 1);
1503 pionptspectrafinal->Fill(PTfinal,(float) 1);
1507 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1508 || TMath::Abs(particle)==311)
1512 kaonptspectravertex->Fill(PTvertex,(float) 1);
1513 kaonptspectrafinal->Fill(PTfinal,(float) 1);
1518 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
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);
1525 pionspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1528 if (TMath::Abs(particle)==211)
1534 if (current->Energy()>1)
1535 highprimarypions +=1;
1539 if (TMath::Abs(particle)==2212)
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);
1546 protonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1549 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
1550 || TMath::Abs(particle)==311)
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);
1557 kaonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1559 if (TMath::Abs(particle)==321)
1565 if (current->Energy()>1)
1566 highprimarykaons +=1;
1570 if (TMath::Abs(particle)==11)
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);
1577 electronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1580 if (particle == -11)
1583 if (TMath::Abs(particle)==13)
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);
1590 muonspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1593 if (TMath::Abs(particle)==2112)
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);
1601 neutronspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1605 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
1607 if (current->Energy()-current->GetCalcMass()>1)
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);
1613 chargedspectra3->Fill(TMath::Log10(current->Energy() - current->GetCalcMass()),(float) 1);
1616 // Fill the histograms
1618 //h->Fill(x,y,(float) 1);
1628 TStyle *mystyle=new TStyle("Plain","mystyle");
1629 mystyle->SetPalette(1,0);
1632 //Create canvases, set the view range, show histograms
1634 TCanvas *c2 = new TCanvas("c2","Angles of incidence",150,150,100,150);
1636 //c2->SetFillColor(42);
1639 hitsTheta500MeV->SetFillColor(5);
1640 hitsTheta500MeV->Draw();
1642 hitsTheta1GeV->SetFillColor(5);
1643 hitsTheta1GeV->Draw();
1645 hitsTheta2GeV->SetFillColor(5);
1646 hitsTheta2GeV->Draw();
1648 hitsTheta3GeV->SetFillColor(5);
1649 hitsTheta3GeV->Draw();
1653 TCanvas *c15 = new TCanvas("c15","Mothers Production Vertices",50,50,600,600);
1655 production->SetFillColor(42);
1656 production->SetXTitle("z (m)");
1657 production->SetYTitle("R (m)");
1660 TCanvas *c10 = new TCanvas("c10","Pt Spectra",50,50,600,700);
1663 pionptspectravertex->SetFillColor(5);
1664 pionptspectravertex->SetXTitle("Pt (GeV)");
1665 pionptspectravertex->Draw();
1667 pionptspectrafinal->SetFillColor(5);
1668 pionptspectrafinal->SetXTitle("Pt (GeV)");
1669 pionptspectrafinal->Draw();
1671 kaonptspectravertex->SetFillColor(5);
1672 kaonptspectravertex->SetXTitle("Pt (GeV)");
1673 kaonptspectravertex->Draw();
1675 kaonptspectrafinal->SetFillColor(5);
1676 kaonptspectrafinal->SetXTitle("Pt (GeV)");
1677 kaonptspectrafinal->Draw();
1680 TCanvas *c16 = new TCanvas("c16","Particles Spectra II",150,150,600,350);
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)");
1692 electronspectra1->Draw();
1693 electronspectra2->Draw("same");
1694 electronspectra3->Draw("same");
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)");
1705 muonspectra1->Draw();
1706 muonspectra2->Draw("same");
1707 muonspectra3->Draw("same");
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)");
1718 //neutronspectra1->Draw();
1719 //neutronspectra2->Draw("same");
1720 //neutronspectra3->Draw("same");
1722 TCanvas *c9 = new TCanvas("c9","Particles Spectra",150,150,600,700);
1723 //TCanvas *c9 = new TCanvas("c9","Pion Spectra",400,10,600,700);
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)");
1734 pionspectra1->Draw();
1735 pionspectra2->Draw("same");
1736 pionspectra3->Draw("same");
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)");
1747 protonspectra1->Draw();
1748 protonspectra2->Draw("same");
1749 protonspectra3->Draw("same");
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)");
1760 kaonspectra1->Draw();
1761 kaonspectra2->Draw("same");
1762 kaonspectra3->Draw("same");
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)");
1773 chargedspectra1->Draw();
1774 chargedspectra2->Draw("same");
1775 chargedspectra3->Draw("same");
1779 printf("*****************************************\n");
1780 printf("* Particle * Counts *\n");
1781 printf("*****************************************\n");
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");
1805 if (gAlice->TreeD())
1807 gAlice->TreeD()->GetEvent(0);
1812 printf("\n*****************************************\n");
1813 printf("* Chamber * Digits * Occupancy *\n");
1814 printf("*****************************************\n");
1816 for (Int_t ich=0;ich<7;ich++)
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);
1825 printf("*****************************************\n");
1826 printf("* Mean occupancy * %3.1f%% *\n",mean*100);
1827 printf("*****************************************\n");
1830 printf("\nEnd of analysis\n");
1832 }//void AliRICHv3::DiagnosticsFE(Int_t evNumber1,Int_t evNumber2)
1833 //__________________________________________________________________________________________________
1834 void AliRICHv3::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
1837 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
1838 AliRICHSegmentationV0* segmentation;
1839 AliRICHChamber* chamber;
1841 chamber = &(pRICH->Chamber(0));
1842 segmentation=(AliRICHSegmentationV0*) chamber->GetSegmentationModel();
1844 Int_t NpadX = segmentation->Npx(); // number of pads on X
1845 Int_t NpadY = segmentation->Npy(); // number of pads on Y
1847 Int_t xmin= -NpadX/2;
1848 Int_t xmax= NpadX/2;
1849 Int_t ymin= -NpadY/2;
1850 Int_t ymax= NpadY/2;
1852 Float_t PTfinal = 0;
1853 Int_t pionCount = 0;
1854 Int_t kaonCount = 0;
1855 Int_t protonCount = 0;
1864 TH2F *hc0 = new TH2F("hc0","Zoom on center of central chamber",150,-25,25,150,-45,5);
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);
1878 printf("Full Event Hits\n");
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);
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);
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);
1937 // Start loop over events
1942 Int_t mothers[80000];
1943 Int_t mothers2[80000];
1951 Float_t chiSquareOmega = 0;
1952 Float_t chiSquareTheta = 0;
1953 Float_t chiSquarePhi = 0;
1955 Float_t recEffEvent = 0;
1956 Float_t recEffTotal = 0;
1958 Float_t trackglob[3];
1959 Float_t trackloc[3];
1962 for (Int_t i=0;i<100;i++) mothers[i]=0;
1964 for (int nev=0; nev<= evNumber2; nev++) {
1965 Int_t nparticles = gAlice->GetEvent(nev);
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;
1975 // Get pointers to RICH detector and Hits containers
1978 TTree *TH = TreeH();
1979 Stat_t ntracks = TH->GetEntries();
1981 // Start loop on tracks in the hits containers
1983 for (Int_t track=0; track<ntracks;track++) {
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);
1993 mHit=(AliRICHhit*)pRICH->NextHit())
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();
2009 if (TMath::Abs(particle) < 10000000)
2011 PTfinal=TMath::Sqrt(px*px + py*py);
2014 chamber = &(pRICH->Chamber(nch-1));
2017 chamber->GlobaltoLocal(trackglob,trackloc);
2019 chamber->LocaltoGlobal(trackloc,trackglob);
2025 hitsX->Fill(x,(float) 1);
2026 hitsY->Fill(y,(float) 1);
2029 TParticle *current = (TParticle*)gAlice->Particle(index);
2031 hitsTheta->Fill(theta,(float) 1);
2033 if (current->GetPdgCode() < 10000000)
2035 mip->Fill(x,y,(float) 1);
2036 hitsPhi->Fill(TMath::Abs(phi),(float) 1);
2039 if (TMath::Abs(particle)==211 || TMath::Abs(particle)==111)
2041 pionspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2043 if (TMath::Abs(particle)==2212)
2045 protonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2047 if (TMath::Abs(particle)==321 || TMath::Abs(particle)==130 || TMath::Abs(particle)==310
2048 || TMath::Abs(particle)==311)
2050 kaonspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2052 if(TMath::Abs(particle)==211 || TMath::Abs(particle)==2212 || TMath::Abs(particle)==321)
2054 if (current->Energy() - current->GetCalcMass()>1)
2055 chargedspectra->Fill(current->Energy() - current->GetCalcMass(),(float) 1);
2057 //printf("Hits:%d\n",hit);
2058 //printf ("Chamber number:%d x:%f y:%f\n",nch,x,y);
2059 // Fill the histograms
2061 h->Fill(x,y,(float) 1);
2066 Int_t ncerenkovs = pRICH->Cerenkovs()->GetEntriesFast();
2067 //if (current->GetPdgCode() < 50000051 && current->GetPdgCode() > 50000040)
2068 //totalphotonsevent->Fill(ncerenkovs,(float) 1);
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
2087 chamber = &(pRICH->Chamber(nchamber-1));
2089 //printf("Nch:%d\n",nch);
2091 chamber->GlobaltoLocal(trackglob,trackloc);
2093 chamber->LocaltoGlobal(trackloc,trackglob);
2096 Float_t cx=trackloc[0];
2097 Float_t cy=trackloc[2];
2099 //printf ("Cerenkov hit number %d/%d, X:%f, Y:%f\n",hit,ncerenkovs,cx,cy);
2102 //printf("Particle:%9d\n",index);
2104 TParticle *current = (TParticle*)gAlice->Particle(index);
2105 Float_t energyckov = current->Energy();
2107 if (current->GetPdgCode() == 50000051)
2111 feedback->Fill(cx,cy,(float) 1);
2115 if (current->GetPdgCode() == 50000050)
2120 phspectra2->Fill(energyckov*1e9,(float) 1);
2125 cerenkov->Fill(cx,cy,(float) 1);
2127 //printf ("Cerenkov hit number %d/%d, X:%d, Y:%d\n",hit,ncerenkovs,cx,cy);
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();
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);
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);
2171 phspectra1->Fill(energyckov*1e9,(float) 1);
2174 for (Int_t nmothers=0;nmothers<=ntracks;nmothers++){
2175 if (cmother == nmothers){
2177 mothers2[cmother]++;
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();
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
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);
2212 padnumber->Fill(mult,(float) 1);
2214 if (mult<4) Clcharge->Fill(qtot,(float) 1);
2222 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2223 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2224 //printf (" nrechits:%d\n",nrechits);
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
2236 Omega1D->Fill(r_omega,(float) 1);
2238 for (Int_t i=0; i<goodPhotons; i++)
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]);
2245 //printf("Omega: %f, Theta: %f, Phi: %f\n",r_omega,r_theta,r_phi);
2250 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2251 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2252 //printf (" nrechits:%d\n",nrechits);
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
2269 //correction to track cerenkov angle
2270 originalOmega = (Float_t) ckovangle->GetMean();
2274 printf("\nMean cerenkov angle: %f\n", originalOmega);
2275 printf("Reconstructed cerenkov angle: %f\n",r_omega);
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);
2283 if(TMath::Abs(omegaError) < 0.015)
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);
2298 recEffEvent = recEffEvent;
2299 recEffTotal += recEffEvent;
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)));
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);
2313 printf("Identified as a PION!\n");
2316 if(kaoncer<r_omega && pioncer>r_omega)
2318 if(kaondist>piondist)
2320 printf("Identified as a PION!\n");
2325 printf("Identified as a KAON!\n");
2329 if(protoncer<r_omega && kaoncer>r_omega)
2331 if(kaondist>protondist)
2333 printf("Identified as a PROTON!\n");
2338 printf("Identified as a KAON!\n");
2342 if(protoncer>r_omega)
2344 printf("Identified as a PROTON!\n");
2348 printf("\nReconstruction efficiency: %5.2f%%\n", recEffEvent*100);
2354 for (Int_t nmothers=0;nmothers<ntracks;nmothers++){
2355 totalphotonstrack->Fill(mothers[nmothers],(float) 1);
2356 mother->Fill(mothers2[nmothers],(float) 1);
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);
2372 gAlice->ResetDigits();
2373 gAlice->TreeD()->GetEvent(0);
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);
2395 for (Int_t ich=0;ich<7;ich++)
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);
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);
2432 for(Int_t i=0;i<99;i++)
2434 omegaE = OriginalOmega->GetBinContent(i);
2437 omegaO = Omega3D->GetBinContent(i);
2438 chiSquareOmega += (TMath::Power(omegaE,2) - TMath::Power(omegaO,2))/omegaO;
2441 thetaE = OriginalTheta->GetBinContent(i);
2444 thetaO = Theta->GetBinContent(i);
2445 chiSquareTheta += (TMath::Power(thetaE,2) - TMath::Power(thetaO,2))/thetaO;
2448 phiE = OriginalPhi->GetBinContent(i);
2451 phiO = Phi->GetBinContent(i);
2452 chiSquarePhi += (TMath::Power(phiE,2) - TMath::Power(phiO,2))/phiO;
2458 printf("\nChi square test values: Omega - %f\n", chiSquareOmega);
2459 printf(" Theta - %f\n", chiSquareTheta);
2460 printf(" Phi - %f\n", chiSquarePhi);
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));
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);
2473 //Create canvases, set the view range, show histograms
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);
2499 TClonesArray *RecHits3D = pRICH->RecHitsAddress3D(2);
2500 Int_t nrechits3D = RecHits3D->GetEntriesFast();
2501 TClonesArray *RecHits1D = pRICH->RecHitsAddress1D(2);
2502 Int_t nrechits1D = RecHits1D->GetEntriesFast();
2508 c1 = new TCanvas("c1","Alice RICH digits",50,50,300,350);
2509 hc0->SetXTitle("ix (npads)");
2512 c2 = new TCanvas("c2","Hits per type",100,100,600,700);
2514 //c4->SetFillColor(42);
2517 feedback->SetXTitle("x (cm)");
2518 feedback->SetYTitle("y (cm)");
2519 feedback->Draw("colz");
2522 //mip->SetFillColor(5);
2523 mip->SetXTitle("x (cm)");
2524 mip->SetYTitle("y (cm)");
2528 //cerenkov->SetFillColor(5);
2529 cerenkov->SetXTitle("x (cm)");
2530 cerenkov->SetYTitle("y (cm)");
2531 cerenkov->Draw("colz");
2534 //h->SetFillColor(5);
2535 h->SetXTitle("x (cm)");
2536 h->SetYTitle("y (cm)");
2539 c3 = new TCanvas("c3","Hits distribution",150,150,600,350);
2541 //c10->SetFillColor(42);
2544 hitsX->SetFillColor(5);
2545 hitsX->SetXTitle("(cm)");
2549 hitsY->SetFillColor(5);
2550 hitsY->SetXTitle("(cm)");
2557 c4 = new TCanvas("c4","Photon Spectra",50,50,600,350);
2561 phspectra2->SetFillColor(5);
2562 phspectra2->SetXTitle("energy (eV)");
2565 phspectra1->SetFillColor(5);
2566 phspectra1->SetXTitle("energy (eV)");
2569 c5 = new TCanvas("c5","Particles Spectra",100,100,600,700);
2573 pionspectra->SetFillColor(5);
2574 pionspectra->SetXTitle("(GeV)");
2575 pionspectra->Draw();
2578 protonspectra->SetFillColor(5);
2579 protonspectra->SetXTitle("(GeV)");
2580 protonspectra->Draw();
2583 kaonspectra->SetFillColor(5);
2584 kaonspectra->SetXTitle("(GeV)");
2585 kaonspectra->Draw();
2588 chargedspectra->SetFillColor(5);
2589 chargedspectra->SetXTitle("(GeV)");
2590 chargedspectra->Draw();
2599 c6=new TCanvas("c6","Clusters Statistics",50,50,600,700);
2603 Clcharge->SetFillColor(5);
2604 Clcharge->SetXTitle("ADC counts");
2607 Clcharge->Fit("expo");
2612 padnumber->SetFillColor(5);
2613 padnumber->SetXTitle("(counts)");
2617 clusev->SetFillColor(5);
2618 clusev->SetXTitle("(counts)");
2621 clusev->Fit("gaus");
2622 //gaus->SetLineColor(2);
2623 //gaus->SetLineWidth(3);
2628 padsmip->SetFillColor(5);
2629 padsmip->SetXTitle("(counts)");
2635 c11 = new TCanvas("c11","Cherenkov per Mip",400,10,600,700);
2636 mother->SetFillColor(5);
2637 mother->SetXTitle("counts");
2641 c7 = new TCanvas("c7","Production Statistics",100,100,600,700);
2643 //c7->SetFillColor(42);
2646 totalphotonsevent->SetFillColor(5);
2647 totalphotonsevent->SetXTitle("Photons (counts)");
2650 totalphotonsevent->Fit("gaus");
2651 //gaus->SetLineColor(2);
2652 //gaus->SetLineWidth(3);
2654 totalphotonsevent->Draw();
2657 photev->SetFillColor(5);
2658 photev->SetXTitle("(counts)");
2661 photev->Fit("gaus");
2662 //gaus->SetLineColor(2);
2663 //gaus->SetLineWidth(3);
2668 feedev->SetFillColor(5);
2669 feedev->SetXTitle("(counts)");
2672 feedev->Fit("gaus");
2677 padsev->SetFillColor(5);
2678 padsev->SetXTitle("(counts)");
2681 padsev->Fit("gaus");
2692 c8 = new TCanvas("c8","3D reconstruction of Phi angle",50,50,300,1050);
2694 //c2->SetFillColor(42);
2699 hitsPhi->SetFillColor(5);
2701 hitsPhi->Fit("gaus");
2706 OriginalPhi->SetFillColor(5);
2708 OriginalPhi->Fit("gaus");
2709 OriginalPhi->Draw();
2713 Phi->SetFillColor(5);
2718 c9 = new TCanvas("c9","3D reconstruction of theta angle",75,75,300,1050);
2723 hitsTheta->SetFillColor(5);
2725 hitsTheta->Fit("gaus");
2730 OriginalTheta->SetFillColor(5);
2732 OriginalTheta->Fit("gaus");
2733 OriginalTheta->Draw();
2737 Theta->SetFillColor(5);
2742 c10 = new TCanvas("c10","3D reconstruction of cherenkov angle",100,100,300,1050);
2747 ckovangle->SetFillColor(5);
2748 ckovangle->SetXTitle("angle (radians)");
2750 ckovangle->Fit("gaus");
2755 OriginalOmega->SetFillColor(5);
2756 OriginalOmega->SetXTitle("angle (radians)");
2758 OriginalOmega->Fit("gaus");
2759 OriginalOmega->Draw();
2763 Omega3D->SetFillColor(5);
2764 Omega3D->SetXTitle("angle (radians)");
2766 Omega3D->Fit("gaus");
2770 c11 = new TCanvas("c11","3D reconstruction of mean radius",125,125,300,700);
2775 radius->SetFillColor(5);
2776 radius->SetXTitle("radius (cm)");
2781 MeanRadius->SetFillColor(5);
2782 MeanRadius->SetXTitle("radius (cm)");
2786 c12 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
2789 identification->SetFillColor(5);
2790 identification->SetXTitle("Momentum (GeV/c)");
2791 identification->SetYTitle("Cherenkov angle (radians)");
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);
2797 identification->Draw();
2799 pionplot->SetLineColor(5);
2800 pionplot->Draw("same");
2802 kaonplot->SetLineColor(4);
2803 kaonplot->Draw("same");
2805 protonplot->SetLineColor(3);
2806 protonplot->Draw("same");
2808 c13 = new TCanvas("c13","Reconstruction Errors",200,200,900,350);
2812 PhiError->SetFillColor(5);
2814 PhiError->Fit("gaus");
2817 ThetaError->SetFillColor(5);
2819 ThetaError->Fit("gaus");
2822 OmegaError->SetFillColor(5);
2823 OmegaError->SetXTitle("angle (radians)");
2825 OmegaError->Fit("gaus");
2832 c9 = new TCanvas("c9","1D Reconstruction",100,100,1100,700);
2834 //c5->SetFillColor(42);
2837 ckovangle->SetFillColor(5);
2838 ckovangle->SetXTitle("angle (radians)");
2842 radius->SetFillColor(5);
2843 radius->SetXTitle("radius (cm)");
2847 hc0->SetXTitle("pads");
2851 Omega1D->SetFillColor(5);
2852 Omega1D->SetXTitle("angle (radians)");
2856 PhotonCer->SetFillColor(5);
2857 PhotonCer->SetXTitle("angle (radians)");
2861 PadsUsed->SetXTitle("pads");
2862 PadsUsed->Draw("box");
2869 printf("Drawing histograms.../n");
2871 c10 = new TCanvas("c10","Alice RICH digits",50,50,1200,700);
2875 hc1->SetXTitle("ix (npads)");
2878 hc2->SetXTitle("ix (npads)");
2881 hc3->SetXTitle("ix (npads)");
2884 hc4->SetXTitle("ix (npads)");
2887 hc5->SetXTitle("ix (npads)");
2890 hc6->SetXTitle("ix (npads)");
2893 hc7->SetXTitle("ix (npads)");
2896 hc0->SetXTitle("ix (npads)");
2898 c11 = new TCanvas("c11","Hits per type",100,100,600,700);
2902 feedback->SetXTitle("x (cm)");
2903 feedback->SetYTitle("y (cm)");
2907 mip->SetXTitle("x (cm)");
2908 mip->SetYTitle("y (cm)");
2912 cerenkov->SetXTitle("x (cm)");
2913 cerenkov->SetYTitle("y (cm)");
2917 h->SetXTitle("x (cm)");
2918 h->SetYTitle("y (cm)");
2921 c12 = new TCanvas("c12","Hits distribution",150,150,600,350);
2925 hitsX->SetFillColor(5);
2926 hitsX->SetXTitle("(cm)");
2930 hitsY->SetFillColor(5);
2931 hitsY->SetXTitle("(cm)");
2939 printf("\nEnd of analysis\n");
2940 printf("**********************************\n");
2941 }//void AliRICHv3::DiagnosticsSE(Int_t diaglevel,Int_t evNumber1,Int_t evNumber2)
2943 //__________________________________________________________________________________________________
2944 void AliRICHv3::MakeBranch(Option_t* option)
2945 {//Create Tree branches for the RICH.
2946 if(GetDebug())Info("MakeBranch","Start with option= %s.",option);
2948 const Int_t kBufferSize = 4000;
2949 char branchname[20];
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");
2959 if(!fHits) fHits=new TClonesArray("AliRICHhit",1000 );
2960 if(!fCerenkovs) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
2961 MakeBranchInTree(TreeH(),"RICHCerenkov", &fCerenkovs, kBufferSize, 0) ;
2963 if(!fSDigits) fSDigits = new TClonesArray("AliRICHdigit",100000);
2964 MakeBranchInTree(TreeH(),"RICHSDigits", &fSDigits, kBufferSize, 0) ;
2966 AliDetector::MakeBranch(option);//this is after cH because we need to guarantee that fHits array is created
2968 if(cS&&fLoader->TreeS()){
2969 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
2970 MakeBranchInTree(fLoader->TreeS(),"RICH",&fSDigits,kBufferSize,0) ;
2974 if (cD&&fLoader->TreeD()){
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);
2981 for (i=0; i<kNCH ;i++)
2983 sprintf(branchname,"%sDigits%d",GetName(),i+1);
2984 MakeBranchInTree(fLoader->TreeD(),branchname, &((*fDchambers)[i]), kBufferSize, 0);
2988 if (cR&&gAlice->TreeR()){//one branch for raw clusters per chamber
2990 if (fRawClusters == 0x0 )
2992 fRawClusters = new TObjArray(kNCH);
2993 for (i=0; i<kNCH ;i++)
2995 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
2999 if (fRecHits1D == 0x0)
3001 fRecHits1D = new TObjArray(kNCH);
3002 for (i=0; i<kNCH ;i++)
3004 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3008 if (fRecHits3D == 0x0)
3010 fRecHits3D = new TObjArray(kNCH);
3011 for (i=0; i<kNCH ;i++)
3013 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
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);
3025 }//if (cR && gAlice->TreeR())
3026 if(GetDebug())Info("MakeBranch","Stop.");
3028 //______________________________________________________________________________
3029 void AliRICHv3::SetTreeAddress()
3030 {//Set branch address for the Hits and Digits Tree.
3031 if(GetDebug())Info("SetTreeAddress","Start.");
3033 char branchname[20];
3038 TTree *treeH = fLoader->TreeH();
3039 TTree *treeD = fLoader->TreeD();
3040 TTree *treeR = fLoader->TreeR();
3041 TTree *treeS = fLoader->TreeS();
3044 if(GetDebug())Info("SetTreeAddress","tree H is requested.");
3045 if(fHits==0x0) fHits=new TClonesArray("AliRICHhit",1000);
3047 branch = treeH->GetBranch("RICHCerenkov");
3049 if (fCerenkovs == 0x0) fCerenkovs = new TClonesArray("AliRICHCerenkov",1000);
3050 branch->SetAddress(&fCerenkovs);
3053 branch = treeH->GetBranch("RICHSDigits");
3056 if (fSDigits == 0x0) fSDigits = new TClonesArray("AliRICHdigit",100000);
3057 branch->SetAddress(&fSDigits);
3061 //this is after TreeH because we need to guarantee that fHits array is created
3062 AliDetector::SetTreeAddress();
3065 if(GetDebug())Info("SetTreeAddress","tree S is requested.");
3066 branch = treeS->GetBranch("RICH");
3068 if(!fSDigits) fSDigits=new TClonesArray("AliRICHdigit",100000);
3069 branch->SetAddress(&fSDigits);
3075 if(GetDebug())Info("SetTreeAddress","tree D is requested.");
3077 if (fDchambers == 0x0)
3079 fDchambers = new TObjArray(kNCH);
3080 for (i=0; i<kNCH ;i++)
3082 fDchambers->AddAt(new TClonesArray("AliRICHDigit",10000), i);
3086 for (i=0; i<kNCH; i++) {
3087 sprintf(branchname,"%sDigits%d",GetName(),i+1);
3089 branch = treeD->GetBranch(branchname);
3090 if (branch) branch->SetAddress(&((*fDchambers)[i]));
3096 if(GetDebug())Info("SetTreeAddress","tree R is requested.");
3098 if (fRawClusters == 0x0 )
3100 fRawClusters = new TObjArray(kNCH);
3101 for (i=0; i<kNCH ;i++)
3103 fRawClusters->AddAt(new TClonesArray("AliRICHRawCluster",10000), i);
3107 if (fRecHits1D == 0x0)
3109 fRecHits1D = new TObjArray(kNCH);
3110 for (i=0; i<kNCH ;i++)
3112 fRecHits1D->AddAt(new TClonesArray("AliRICHRecHit1D",1000), i);
3116 if (fRecHits3D == 0x0)
3118 fRecHits3D = new TObjArray(kNCH);
3119 for (i=0; i<kNCH ;i++)
3121 fRecHits3D->AddAt(new TClonesArray("AliRICHRecHit3D",1000), i);
3125 for (i=0; i<kNCH; i++) {
3126 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
3128 branch = treeR->GetBranch(branchname);
3129 if (branch) branch->SetAddress(&((*fRawClusters)[i]));
3133 for (i=0; i<kNCH; i++) {
3134 sprintf(branchname,"%sRecHits1D%d",GetName(),i+1);
3136 branch = treeR->GetBranch(branchname);
3137 if (branch) branch->SetAddress(&((*fRecHits1D)[i]));
3141 for (i=0; i<kNCH; i++) {
3142 sprintf(branchname,"%sRecHits3D%d",GetName(),i+1);
3144 branch = treeR->GetBranch(branchname);
3145 if (branch) branch->SetAddress(&((*fRecHits3D)[i]));
3150 if(GetDebug())Info("SetTreeAddress","Stop.");
3151 }//void AliRICHv3::SetTreeAddress()