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 **************************************************************************/
18 Revision 1.13 1999/11/01 20:41:57 fca
19 Added protections against using the wrong version of FRAME
21 Revision 1.12 1999/10/22 08:04:14 fca
22 Correct improper use of negative parameters
24 Revision 1.11 1999/10/16 19:30:05 fca
25 Corrected Rotation Matrix and CVS log
27 Revision 1.10 1999/10/15 15:35:20 fca
28 New version for frame1099 with and without holes
30 Revision 1.9 1999/09/29 09:24:33 fca
31 Introduction of the Copyright and cvs Log
35 ///////////////////////////////////////////////////////////////////////////////
37 // Time Of Flight: design of C.Williams FCA //
38 // This class contains the functions for version 1 of the Time Of Flight //
41 // VERSION WITH 5 MODULES AND TILTED STRIPS
43 // WITH HOLES FOR PHOS AND HMPID inside the
44 // SPACE FRAME WITH HOLES
52 // University of Salerno - Italy
57 <img src="picts/AliTOFv0Class.gif">
61 ///////////////////////////////////////////////////////////////////////////////
72 //_____________________________________________________________________________
76 // Default constructor
80 //_____________________________________________________________________________
81 AliTOFv0::AliTOFv0(const char *name, const char *title)
85 // Standard constructor
89 //_____________________________________________________________________________
90 void AliTOFv0::CreateGeometry()
93 // Create geometry for Time Of Flight version 0
97 <img src="picts/AliTOFv0.gif">
101 // Creates common geometry
103 AliTOF::CreateGeometry();
106 //_____________________________________________________________________________
107 void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
108 Float_t zlen2, Float_t zlen3, Float_t ztof0)
111 // Definition of the Time Of Fligh Resistive Plate Chambers
112 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
119 Int_t *idtmed = fIdtmed->GetArray()-499;
125 gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
127 gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
129 gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
132 // Positioning of modules
136 Float_t zcor1 = ztof0 - zlen1/2;
137 Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
140 AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
141 AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
142 gMC->Gspos("FTO1", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
143 gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
145 gMC->Gspos("FTO1", 1, "BTO2", 0, zcoor, 0, idrotm[0], "ONLY");
147 gMC->Gspos("FTO1", 1, "BTO3", 0, zcoor, 0, idrotm[0], "ONLY");
149 gMC->Gspos("FTO2", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
150 gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
152 gMC->Gspos("FTO2", 0, "BTO2", 0, zcoor, 0, idrotm[0], "ONLY");
154 gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
156 // Subtraction the distance to TOF module boundaries
159 Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
161 xFLT = xtof -(.5 +.5)*2;
167 // Sizes of MRPC pads
169 Float_t yPad = 0.505;
171 // Large not sensitive volumes with CO2
175 cout <<"************************* TOF geometry **************************"<<endl;
177 par[2] = (zFLT1 / 2.);
178 gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
179 gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
181 par[2] = (zFLT2 / 2.);
182 gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
183 gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
185 par[2] = (zFLT3 / 2.);
186 gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
187 gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
189 ////////// Layers before detector ////////////////////
191 // Alluminium layer in front 1.0 mm thick at the beginning
195 ycoor = -yFLT/2 + par[1];
196 gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
197 gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
198 gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
199 gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
200 gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium
201 gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
203 // Honeycomb layer (1cm of special polyethilene)
204 ycoor = ycoor + par[1];
208 ycoor = ycoor + par[1];
209 gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
210 gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
211 gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
212 gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
213 gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
214 gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
216 ///////////////// Detector itself //////////////////////
218 const Float_t StripWidth = 7.81;//cm
219 const Float_t DeadBound = 1.;//cm non-sensitive between the pad edge and the boundary of the strip
220 const Int_t nx = 40; // number of pads along x
221 const Int_t nz = 2; // number of pads along z
222 const Float_t Gap=4.; //cm distance between the strip axis
223 const Float_t Space = 5.5; //cm distance from the front plate of the box
226 zSenStrip = StripWidth-2*DeadBound;//cm
230 par[2] = StripWidth/2.;
232 // Glass Layer of detector
233 gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
235 // Freon for non-sesitive boundaries
239 gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
240 gMC->Gspos("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
241 // Mylar for non-sesitive boundaries
243 gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3);
244 gMC->Gspos("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
246 // Mylar for outer layers
248 ycoor = -yPad/2.+par[1];
249 gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
250 gMC->Gspos("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
251 gMC->Gspos("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
257 gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
258 gMC->Gspos("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
259 gMC->Gspos("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
261 // Freon sensitive layer
264 par[2] = zSenStrip/2.;
265 gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
266 gMC->Gspos("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
268 // Pad definition x & z
269 gMC->Gsdvn("FLZ","FCFC", nz, 3);
270 gMC->Gsdvn("FLX","FLZ" , nx, 1);
272 //// Positioning the Strips (FSTR) in the FLT volumes /////
276 Float_t t = zFLT1+zFLT2+zFLT3/2.+7.*2.5;//Half Width of Barrel
284 Int_t UpDown=-1; // UpDown=-1 -> Upper strip, UpDown=+1 -> Lower strip
289 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
290 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90.,ang, 90.);
291 ycoor = -14.5+ Space; //2 cm over front plate
292 ycoor += (1-(UpDown+1)/2)*Gap;
293 gMC->Gspos("FSTR",j ,"FLT3",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
294 gMC->Gspos("FSTR",j+1,"FLT3",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
297 zcoor=zcoor-(zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
298 UpDown*= -1; // Alternate strips
301 } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+zFLT2+7*2.5);
303 ycoor = -29./2.+ Space; //2 cm over front plate
307 ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
308 Offset = StripWidth*TMath::Cos(ang)/2;
312 // UpDown has not to be reinitialized, so that the arrangement of the strips can continue coherently
315 ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
317 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
318 ycoor = -29./2.+ Space ; //2 cm over front plate
319 ycoor += (1-(UpDown+1)/2)*Gap;
320 zcoor = zpos+(zFLT3/2.+7+zFLT2/2); // Moves to the system of the centre of the modulus FLT2
321 gMC->Gspos("FSTR",i, "FLT2", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
323 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+UpDown*Gap*TMath::Tan(ang)-(zSenStrip/2)/TMath::Cos(ang);
324 last = StripWidth*TMath::Cos(ang)/2;
327 } while (zpos-(StripWidth/2)*TMath::Cos(ang)>-t+zFLT1+7);
331 ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
332 Offset = StripWidth*TMath::Cos(ang)/2.;
336 ycoor= -29./2.+Space+Gap/2;
339 ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
341 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
343 zcoor = zpos+(zFLT1/2+zFLT2+zFLT3/2+7.*2.);
344 gMC->Gspos("FSTR",i, "FLT1", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
346 zpos = zpos - zSenStrip/TMath::Cos(ang);
347 last = StripWidth*TMath::Cos(ang)/2.;
348 } while (zpos>-t+7.+last);
350 printf("#######################################################\n");
351 printf(" Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
352 ang = atan(zpos/sqrt(2*t*t-zpos*zpos));
353 zpos = zpos - zSenStrip/TMath::Cos(ang);
354 printf("NEXT Distance from the bound of the FLT3: %f cm \n", t+zpos-(zSenStrip/2)/TMath::Cos(ang));
355 printf("#######################################################\n");
357 ////////// Layers after detector /////////////////
359 // Honeycomb layer after (3cm)
361 Float_t OverSpace = Space + 7.3;
362 /// StripWidth*TMath::Sin(ang) + 1.3;
367 ycoor = -yFLT/2 + OverSpace + par[1];
368 gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
369 gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
370 gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
371 gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
372 gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
373 gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
375 // Electronics (Cu) after
378 par[1] = 1.43*0.05 / 2.; // 5% of X0
381 gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
382 gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
383 gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
384 gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
385 gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
386 gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
388 // Cooling water after
391 par[1] = 36.1*0.02 / 2.; // 2% of X0
394 gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
395 gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
396 gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
397 gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
398 gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
399 gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
401 //back plate honycomb (2cm)
405 ycoor = yFLT/2 - par[1];
406 gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
407 gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
408 gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
409 gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
410 gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
411 gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
414 //_____________________________________________________________________________
415 void AliTOFv0::DrawModule()
418 // Draw a shaded view of the Time Of Flight version 1
420 // Set everything unseen
421 gMC->Gsatt("*", "seen", -1);
423 // Set ALIC mother transparent
424 gMC->Gsatt("ALIC","SEEN",0);
426 // Set the volumes visible
427 gMC->Gsatt("ALIC","SEEN",0);
428 gMC->Gsatt("FBAR","SEEN",1);
429 gMC->Gsatt("FTO1","SEEN",1);
430 gMC->Gsatt("FTO2","SEEN",1);
431 gMC->Gsatt("FTO3","SEEN",1);
432 gMC->Gsatt("FBT1","SEEN",1);
433 gMC->Gsatt("FBT2","SEEN",1);
434 gMC->Gsatt("FBT3","SEEN",1);
435 gMC->Gsatt("FDT1","SEEN",1);
436 gMC->Gsatt("FDT2","SEEN",1);
437 gMC->Gsatt("FDT3","SEEN",1);
438 gMC->Gsatt("FLT1","SEEN",1);
439 gMC->Gsatt("FLT2","SEEN",1);
440 gMC->Gsatt("FLT3","SEEN",1);
441 gMC->Gsatt("FPL1","SEEN",1);
442 gMC->Gsatt("FPL2","SEEN",1);
443 gMC->Gsatt("FPL3","SEEN",1);
444 gMC->Gsatt("FLD1","SEEN",1);
445 gMC->Gsatt("FLD2","SEEN",1);
446 gMC->Gsatt("FLD3","SEEN",1);
447 gMC->Gsatt("FLZ1","SEEN",1);
448 gMC->Gsatt("FLZ2","SEEN",1);
449 gMC->Gsatt("FLZ3","SEEN",1);
450 gMC->Gsatt("FLX1","SEEN",1);
451 gMC->Gsatt("FLX2","SEEN",1);
452 gMC->Gsatt("FLX3","SEEN",1);
453 gMC->Gsatt("FPA0","SEEN",1);
455 gMC->Gdopt("hide", "on");
456 gMC->Gdopt("shad", "on");
457 gMC->Gsatt("*", "fill", 7);
458 gMC->SetClipBox(".");
459 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
461 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
462 gMC->Gdhead(1111, "Time Of Flight");
463 gMC->Gdman(18, 4, "MAN");
464 gMC->Gdopt("hide","off");
467 //_____________________________________________________________________________
468 void AliTOFv0::CreateMaterials()
471 // Define materials for the Time Of Flight
473 AliTOF::CreateMaterials();
476 //_____________________________________________________________________________
477 void AliTOFv0::Init()
480 // Initialise the detector after the geometry has been defined
482 printf("**************************************"
484 "**************************************\n");
485 printf("\n Version 0 of TOF initialing, "
486 "with openings for PHOS and RICH\n\n");
491 // Check that FRAME is there otherwise we have no place where to
493 AliModule* FRAME=gAlice->GetModule("FRAME");
495 Error("Ctor","TOF needs FRAME to be present\n");
498 if(FRAME->IsVersion()!=0) {
499 Error("Ctor","FRAME version 0 needed with this version of TOF\n");
503 fIdFTO2=gMC->VolId("FTO2");
504 fIdFTO3=gMC->VolId("FTO3");
505 fIdFLT1=gMC->VolId("FLT1");
506 fIdFLT2=gMC->VolId("FLT2");
507 fIdFLT3=gMC->VolId("FLT3");
509 printf("**************************************"
511 "**************************************\n");
514 //_____________________________________________________________________________
515 void AliTOFv0::StepManager()
518 // Procedure called at each step in the Time Of Flight
520 TLorentzVector mom, pos;
521 Float_t hits[8],rho,phi,phid,z;
522 Int_t sector, plate, pad_x, pad_z, strip;
523 Int_t copy, pad_z_id, pad_x_id, strip_id, i;
524 Int_t *idtmed = fIdtmed->GetArray()-499;
527 if(gMC->GetMedium()==idtmed[513] &&
528 gMC->IsTrackEntering() && gMC->TrackCharge()
529 && gMC->CurrentVolID(copy)==fIdSens)
531 TClonesArray &lhits = *fHits;
533 //_________getting information about hit volumes_____________
535 pad_z_id=gMC->CurrentVolOffID(2,copy);
538 pad_x_id=gMC->CurrentVolOffID(1,copy);
541 strip_id=gMC->CurrentVolOffID(5,copy);
544 pad_z = (strip-1)*2+pad_z;
546 gMC->TrackPosition(pos);
547 gMC->TrackMomentum(mom);
549 rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
550 phi = TMath::ACos(pos[0]/rho);
551 Float_t as = TMath::ASin(pos[1]/rho);
552 if (as<0) phi = 2*3.141592654-phi;
556 if (z<= 62. && z>=-62.) plate = 3;
557 if (z<= 216. && z>62.) plate = 4;
558 if (z>=-216. && z<-62.) plate = 2;
559 if (z>216.) plate = 5;
560 if (z<-216.) plate = 1;
563 sector = Int_t (phid/20.);
566 Double_t ptot=mom.Rho();
567 Double_t norm=1/ptot;
570 hits[i+3]=mom[i]*norm;
574 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),sector, plate, pad_x, pad_z, hits);