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 ///////////////////////////////////////////////////////////////////////////////
20 // ALICE Cosmic Ray Trigger //
22 // This class contains the functions for version 0 of the ALICE Cosmic Ray //
23 // Trigger. This vesion is suposed to work as standalone module //
28 // Arturo Fernandez <afernand@fcfm.buap.mx>
29 // Enrique Gamez <egamez@fcfm.buap.mx>
31 // Universidad Autonoma de Puebla
36 <img src="picts/AliCRTv1Class.gif">
39 <p>The responsible person for this module is
40 <a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
46 ///////////////////////////////////////////////////////////////////////////////
50 #include <TClonesArray.h>
51 #include <TLorentzVector.h>
53 #include <TVirtualMC.h>
58 #include "AliCRThit.h"
59 #include "AliCRTConstants.h"
64 //_____________________________________________________________________________
69 // Default constructor
75 //_____________________________________________________________________________
76 AliCRTv1::AliCRTv1(const char *name, const char *title)
77 : AliCRTv0(name, title)
80 // Standard constructor
84 <img src="picts/AliCRTv1.gif">
87 fIshunt = 1; // All hits are associated with primary particles
89 fHits = new TClonesArray("AliCRThit",400);
90 gAlice->GetMCApp()->AddHitList(fHits);
97 //_____________________________________________________________________________
98 AliCRTv1::AliCRTv1(const AliCRTv1& crt)
107 //_____________________________________________________________________________
108 AliCRTv1::~AliCRTv1()
111 // Default destructor
115 //_____________________________________________________________________________
116 AliCRTv1& AliCRTv1::operator=(const AliCRTv1& crt)
119 // Asingment operator
125 //_____________________________________________________________________________
126 void AliCRTv1::CreateMaterials()
130 // Use the parent class definition of the materials
132 AliCRT::CreateMaterials();
135 //_____________________________________________________________________________
136 void AliCRTv1::CreateGeometry()
139 // Create geometry for the CRT array
142 Int_t idrotm[2499]; // The rotation matrix.
143 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
146 this->CreateShafts();
149 this->CreateMolasse();
151 // Create a big volume with air barrel above the magnet
153 Float_t magnetSides = 3.;
154 Float_t planesPerpendicularToZ = 2.;
156 barrel[1] = 45*magnetSides;
157 barrel[2] = magnetSides;
158 barrel[3] = planesPerpendicularToZ;
160 barrel[5] = AliCRTConstants::fgMagMinRadius;
161 barrel[6] = AliCRTConstants::fgMagMinRadius + 2.; // 2 cm width
162 barrel[7] = -barrel[4];
163 barrel[8] = barrel[5];
164 barrel[9] = barrel[6];
165 gMC->Gsvolu("CRT4", "PGON", idtmed[1112], barrel, 10);
166 gMC->Gspos("CRT4", 1 , "CRT", 0., -30., 0., 0, "ONLY");
170 box[0] = AliCRTConstants::fgSinglePaletteLenght/4;
171 box[1] = AliCRTConstants::fgSinglePaletteHeight/2;
172 box[2] = AliCRTConstants::fgSinglePaletteWidth/2;
173 gMC->Gsvolu("CRT6", "BOX", idtmed[1113], box, 3);
175 // In the right side side of the magnet
176 AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
178 // In the left side side of the magnet
179 //AliMatrix(idrotm[232], 90., 315., 90., 315., 0.0000040, 263.0707092);
180 AliMatrix(idrotm[232], 90, 315, 90, 315, 0, 263);
182 // Now put them into the volume created above
183 // First above the magnet.
184 const Float_t away = (2.*barrel[5]*TMath::Sin(kDegrad*22.5))/4.;
185 const Int_t nModules = 10;
186 for (Int_t i = 0; i < nModules; i++) {
187 Float_t zCoordinate = i*100 - 450;
189 gMC->Gspos("CRT6", i, "CRT4", -away, barrel[5]+1., zCoordinate, 0, "ONLY");
191 gMC->Gspos("CRT6",i+10,"CRT4", away, barrel[5]+1., zCoordinate, 0, "ONLY");
193 // The most away part (left side)
194 gMC->Gspos("CRT6", i+20, "CRT4", 3*away, barrel[5]+21 - away, zCoordinate, idrotm[232], "ONLY");
195 // The inner part (left side)
196 gMC->Gspos("CRT6", i+30, "CRT4", 4*away, barrel[5]+21 - 2*away, zCoordinate, idrotm[232], "ONLY");
198 // The most away part (rigth side)
199 gMC->Gspos("CRT6", i+40, "CRT4", -3*away, barrel[5]+21. - away, zCoordinate, idrotm[231], "ONLY");
200 // The inner part (rigth side)
201 gMC->Gspos("CRT6", i+50, "CRT4", -4*away, barrel[5]+21 - 2*away, zCoordinate, idrotm[231], "ONLY");
204 // Now the magnet doors
206 barrel[1] = 45*magnetSides;
207 barrel[2] = magnetSides;
211 barrel[7] = barrel[4] + 2.;
212 barrel[8] = barrel[5];
213 barrel[9] = barrel[6];
214 gMC->Gsvolu("CRT5", "PGON", idtmed[1111], barrel, 10);
215 gMC->Gspos("CRT5", 1, "CRT", 0., -30., 0., 0, "ONLY");
217 AliMatrix(idrotm[300], 90., 0., 90., 90., 180., 0.);
218 gMC->Gspos("CRT5", 2, "CRT", 0., -30., 0., idrotm[300], "ONLY");
222 //_____________________________________________________________________________
223 void AliCRTv1::CreateMolasse()
228 Int_t idrotm[2499]; // The rotation matrix.
229 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
231 // Exactly above the hall
234 tspar[1] = 1170 + 375;
235 tspar[2] = (1900 + 1150)/2 + 100;
238 gMC->Gsvolu("CMO1", "TUBS", idtmed[1123], tspar, 5);
239 gMC->Gspos("CMO1", 1, "CRT", 0, 500., 1900 - tspar[2] + 400, 0, "MANY");
243 tbox[1] = (4420 - 1670)/2;
244 tbox[2] = (1900 + 1150)/2 + 200;
245 gMC->Gsvolu("CM12", "BOX", idtmed[1123], tbox, 3);
246 gMC->Gspos("CM12",1,"CRT",0, 4420 - tbox[1], 1900 - tbox[2] + 400, 0,"MANY");
248 AliMatrix(idrotm[2003], 0., 0., 90., 0., 90., 90.);
253 tube[2] = (5150 - 1166)/2;
254 gMC->Gsvolu("CMO2", "TUBE", idtmed[1123], tube, 3);
255 gMC->Gspos("CMO2", 1, "CRT", -2100, 4420 - tube[2], 0, idrotm[2003], "MANY");
260 tube[2] = (5150 - 690)/2;
261 gMC->Gsvolu("CMO3", "TUBE", idtmed[1123], tube, 3);
262 gMC->Gspos("CMO3",1,"CRT", 375, 4420 - tube[2], 1900 + 2987.7,idrotm[2003],"MANY");
264 // Behind the PGC2 up to the end of the M. volume.
267 tbox[2] = (12073 - 1900 - 2987.7 - 650)/2.;
268 gMC->Gsvolu("CMO7", "BOX", idtmed[1123], tbox, 3);
269 gMC->Gspos("CMO7", 1, "CRT", 0, 4420 - tbox[1], 1900 + 2987.7 + 650 + tbox[2], 0, "MANY");
271 // Along the PX24 , upper part.
274 tube[2] = 2575 - 1300 + 95;
275 gMC->Gsvolu("CMO4", "TUBE", idtmed[1123], tube, 3);
276 gMC->Gspos("CMO4", 1, "CRT", 0, 404 + 1300 + tube[2], -2300, idrotm[2003], "MANY");
278 // Along the PX24 , lower part
282 tspar[3] = kRaddeg*TMath::ASin(1070./1150.);
283 tspar[4] = 360 - tspar[3];
284 gMC->Gsvolu("CMO5", "TUBS", idtmed[1123], tspar, 5);
285 gMC->Gspos("CMO5", 1, "CRT", 0., 404, -2300, idrotm[2003], "MANY");
290 gMC->Gsvolu("CMO6", "BOX", idtmed[1123], tbox, 3);
291 gMC->Gspos("CMO6", 1, "CRT", 0., 4420 - tbox[1], -3550 - tbox[2], 0, "MANY");
293 // On the right side of th hall
294 tbox[0] = (12073 - 1250)/2;
296 tbox[2] = (8437.7+650)/2;
297 gMC->Gsvolu("CMO8", "BOX", idtmed[1123], tbox, 3);
298 gMC->Gspos("CMO8", 1, "CRT", 1250 + tbox[0], 4420 - tbox[1], -3550 + tbox[2], 0, "MANY");
300 // on the left side of the hall, behind
301 tbox[0] = (12073 - 2755)/2;
303 tbox[2] = (8437.7 + 650)/2.;
304 gMC->Gsvolu("CMO9", "BOX", idtmed[1123], tbox, 3);
305 gMC->Gspos("CMO9", 1, "CRT", -2755 - tbox[0], 4420 - tbox[1], -3550 + tbox[2], 0, "MANY");
307 // Molasse betwen the PX24 & PM25 on the left side.
308 tbox[0] = (2755 - 1250)/2;
310 tbox[2] = (3550 - 555)/2;
311 gMC->Gsvolu("CM10", "BOX", idtmed[1123], tbox, 3);
312 gMC->Gspos("CM10", 1, "CRT", -1250 - tbox[0], 4420 - tbox[1], -tbox[2] - 555, 0, "MANY");
314 // Molasse betwen the PGC2 & PM25 on the left side.
315 tbox[0] = (2755 - 1250)/2;
317 tbox[2] = (1900 + 2987.7 - 555 + 650)/2;
318 gMC->Gsvolu("CM11", "BOX", idtmed[1123], tbox, 3);
319 gMC->Gspos("CM11", 1, "CRT", -1250 - tbox[0], 4420 - tbox[1], 555 + tbox[2], 0, "MANY");
323 //_____________________________________________________________________________
324 void AliCRTv1::CreateShafts()
329 Int_t idrotm[2499]; // The rotation matrix.
330 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
332 // Create a mother volume.
334 //pbox[0] = AliCRTConstants::fgDepth*TMath::Tan(67.5*kDegrad);
336 pbox[1] = AliCRTConstants::fgDepth;
338 gMC->Gsvolu("CRT", "BOX", idtmed[1114], pbox, 3);
339 gMC->Gspos("CRT", 1, "ALIC", 0, 0, 0, 0, "ONLY");
348 gMC->Gsvolu("CHC1", "TUBS", idtmed[1116], ptubs, 5);
349 gMC->Gspos("CHC1", 1, "CRT", 0, 500, 0, 0, "ONLY");
354 AliMatrix(idrotm[2001], 0., 0., 90., 0., 90., 90.);
360 ptubs[3] = kRaddeg*TMath::ASin(1070/ptubs[0]);
361 ptubs[4] = 360 - ptubs[3];
362 gMC->Gsvolu("CSF1", "TUBS", idtmed[1116], ptubs, 5);
363 gMC->Gspos("CSF1", 1, "CRT", 0., 404, -2300, idrotm[2001], "MANY");
368 ptube[2] = 2575 - ptubs[2] + 95;
369 gMC->Gsvolu("CSF2", "TUBE", idtmed[1116], ptube, 3);
370 gMC->Gspos("CSF2", 1, "CRT", 0, 404 + ptubs[2] + ptube[2], -2300, idrotm[2001], "MANY");
372 // Concrete walls along the shaft
376 gMC->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
377 gMC->Gspos("CSW1", 1, "CRT", -290 - pbox[0], 404 - 1300 + pbox[1], -3450 + 210*2, 0, "MANY");
383 gMC->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
384 gMC->Gspos("CSW3", 1, "CRT", 420 - 290 +pbox[0], 404 - 1300 + pbox[1], -3450 + 210*2, 0, "MANY");
390 gMC->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
391 gMC->Gspos("CSW2", 1, "CRT", -290 - pbox[0], 404 - 1300 + pbox[1], -3450 + pbox[2], 0, "MANY");
392 gMC->Gspos("CSW2", 2, "CRT", 420 - 290 + pbox[0], 404 - 1300 + pbox[1], -3450 + pbox[2], 0, "MANY");
398 gMC->Gsvolu("CSP1", "BOX", idtmed[1116], pbox, 3);
399 gMC->Gspos("CSP1", 1, "CRT", 0, 2600 - 700, -1150 - pbox[2], 0, "MANY");
405 gMC->Gsvolu("CSP2", "BOX", idtmed[1116], pbox, 3);
406 gMC->Gspos("CSP2", 1, "CRT", 0, 2950.-700., -3450+pbox[2], 0, "MANY");
412 gMC->Gsvolu("CSP3", "BOX", idtmed[1116], pbox, 3);
413 gMC->Gspos("CSP3", 1, "CRT", 0, 2950.-700., -1150.-210.-pbox[2], 0, "MANY");
419 gMC->Gsvolu("CSP4", "BOX", idtmed[1116], pbox, 3);
420 gMC->Gspos("CSP4", 1, "CRT", 0, 2950 - 700 + 155+pbox[1], -1150 - 210 - pbox[2], 0, "MANY");
426 gMC->Gsvolu("CSP5", "BOX", idtmed[1116], pbox, 3);
427 gMC->Gspos("CSP5", 1, "CRT", 0, 2950 - 700, -3450 + 460 + pbox[2], 0,"MANY");
433 gMC->Gsvolu("CSP6", "BOX", idtmed[1116], pbox, 3);
434 gMC->Gspos("CSP6", 1, "CRT", 1150 - 600 , 2950 - 700, -3450 + 460 + pbox[2], 0, "MANY");
435 gMC->Gspos("CSP6", 2, "CRT", -1150 + 600, 2950 - 700, -3450 + 460 + pbox[2], 0, "MANY");
441 gMC->Gsvolu("CSP7", "BOX", idtmed[1116], pbox, 3);
442 gMC->Gspos("CSP7", 1, "CRT", 850 + pbox[0], 2950 - 700 + 100, -3450 + 460 + pbox[2], 0, "MANY");
443 gMC->Gspos("CSP7", 2, "CRT", -850 - pbox[0], 2950 - 700+ 100, -3450 + 460 + pbox[2], 0, "MANY");
447 ptube[1] = ptube[0] + 100;
448 ptube[2] = (5150 - 1166)/2;
449 gMC->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
450 gMC->Gspos("CSF3", 1, "CRT", -2100, AliCRTConstants::fgDepth-ptube[2], 0, idrotm[2001], "MANY");
454 ptube[1] = ptube[0] + 100;
455 ptube[2] = (5150 - 690)/2;
456 gMC->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
457 gMC->Gspos("CSF4", 1, "CRT", 375, AliCRTConstants::fgDepth-ptube[2], 1900 + 2987.7, idrotm[2001], "MANY");
461 //_____________________________________________________________________________
462 void AliCRTv1::DrawDetector()
465 // Draw a shaded view of the L3 magnet
467 //cout << "AliCRTv1::DrawModule() : Drawing the module" << endl;
472 gMC->Gsatt("*", "seen", -1);
473 gMC->Gsatt("alic", "seen", 0);
475 gMC->Gsatt("ALIC","seen",enable);
476 gMC->Gsatt("CRT", "seen",enable);
477 gMC->Gsatt("L3MO","seen", able); // L3 Magnet
478 //gMC->Gsatt("CRT1","seen", able); // Scintillators
479 gMC->Gsatt("CRT4","seen", able); // Scintillators barrel
481 // Draw the molasse volumes
482 gMC->Gsatt("CMO1","seen",enable); // Exactly above the HALL
483 gMC->Gsatt("CMO2","seen",enable); // Molasse, along the PM25
484 gMC->Gsatt("CMO3","seen",enable); // molasse along the PGC2
485 gMC->Gsatt("CMO4","seen",enable); // Molasse, behind the PX24 upper part
486 gMC->Gsatt("CMO5","seen",enable); // molasse behind px24, lower part
487 gMC->Gsatt("CMO6","seen",enable); // behind the PX24
488 gMC->Gsatt("CMO7","seen",enable); // behind the PGC2
489 gMC->Gsatt("CMO8","seen",enable); // on the right side.
490 gMC->Gsatt("CMO9","seen",enable); // on the left side.
491 gMC->Gsatt("CM10","seen",enable); // betwen PX24 & PM25.
492 gMC->Gsatt("CM11","seen",enable); // betwen PGC2 & PM25.
493 gMC->Gsatt("CM12","seen",enable); // box above the hall.
495 gMC->Gdopt("hide", "on");
496 gMC->Gdopt("edge","off");
497 gMC->Gdopt("shad", "on");
498 gMC->Gsatt("*", "fill", 7);
499 gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
501 gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
502 gMC->Gdhead(1111, "View of CRT(ACORDE)");
503 gMC->Gdman(18, 4, "MAN");
508 //_____________________________________________________________________________
509 void AliCRTv1::Init()
512 // Initialise L3 magnet after it has been built
516 printf("\n%s: ",ClassName());
517 for(i=0;i<35;i++) printf("*");
518 printf(" CRTv1_INIT ");
519 for(i=0;i<35;i++) printf("*");
520 printf("\n%s: ",ClassName());
522 // Here the CRTv1 initialisation code (if any!)
523 for(i=0;i<80;i++) printf("*");
529 //____________________________________________________________________________
530 void AliCRTv1::StepManager()
533 // Called for every step in the Cosmic Ray Trigger
540 static Float_t hits[14];
541 static Float_t eloss;
543 if ( gMC->TrackPid() != kMuonMinus ) return;
545 // Only charged tracks
546 if ( !(gMC->TrackCharge()) ) return;
548 if (gMC->IsNewTrack()) {
549 // Reset the deposited energy
553 // Add th energy loss in each step.
554 eloss += gMC->Edep();
556 if ( ( (strcmp(gMC->CurrentVolName(),"CRT4") == 0) || // Magnet
557 (strcmp(gMC->CurrentVolName(),"CRT5") == 0) || // CRT
558 (strcmp(gMC->CurrentVolName(),"CRT6") == 0) || // Magnet Doors
559 (strcmp(gMC->CurrentVolName(),"CSF2") == 0) || // PX24
560 (strcmp(gMC->CurrentVolName(),"CSF3") == 0) || // PM25
561 (strcmp(gMC->CurrentVolName(),"CSF4") == 0) ) // PGC2
562 && gMC->IsTrackEntering() ) {
564 // Get current particle id(ipart),track position (pos) and momentum (mom)
565 gMC->TrackPosition(pos);
566 gMC->TrackMomentum(mom);
567 ipart = gMC->TrackPid();
569 ipart = gMC->TrackPid();
570 hits[0] = (Float_t)ipart; // (fId)
572 hits[1] = pos[0]; // X coordinate (fX)
573 hits[2] = pos[1]; // Y coordinate (fY)
574 hits[3] = pos[2]; // Z coordinate (fZ)
575 hits[4] = mom[0]; // Px (fpxug)
576 hits[5] = mom[1]; // Py (fpyug)
577 hits[6] = mom[2]; // Pz (fpzug)
578 hits[7] = eloss; // Energy loss
581 if ( (strcmp(gMC->CurrentVolName(),"CRT4")==0) ) vol[0] = 1; // Magnet
582 else if ( (strcmp(gMC->CurrentVolName(),"CRT5")==0) ) vol[0] = 2; // CRT
583 else if ( (strcmp(gMC->CurrentVolName(),"CRT6")==0) ) vol[0] = 3; // Doors
584 else if ( (strcmp(gMC->CurrentVolName(),"CSF2")==0) ) vol[0] = 4; // PX24
585 else if ( (strcmp(gMC->CurrentVolName(),"CSF3")==0) ) vol[0] = 5; // PM25
586 else if ( (strcmp(gMC->CurrentVolName(),"CSF4")==0) ) vol[0] = 6; // PGC2
587 else vol[0] = -1;// ?
588 //vol[0] = gMC->GetMedium(); //layer(flay)
590 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
592 // Reset the deposited energy only when you reach the Magnet
593 if ( (strcmp(gMC->CurrentVolName(),"CRT4")==0) ) eloss = 0;
601 //_____________________________________________________________________________
602 void AliCRTv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
607 TClonesArray &lhits = *fHits;
608 new(lhits[fNhits++]) AliCRThit(fIshunt,track,vol,hits);
611 //_____________________________________________________________________________
612 void AliCRTv1::ResetHits()
614 // Reset number of clusters and the cluster array for this detector
615 AliDetector::ResetHits();
618 //_____________________________________________________________________________
619 void AliCRTv1::ResetDigits()
622 // Reset number of digits and the digits array for this detector
623 AliDetector::ResetDigits();
626 //____________________________________________________________________________
627 void AliCRTv1::FinishEvent()