LCOV - code coverage report
Current view: top level - ACORDE/ACORDEsim - AliACORDEv0.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 381 0.3 %
Date: 2016-06-14 17:26:59 Functions: 1 16 6.2 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : ///////////////////////////////////////////////////////////////////////////////
      19             : //                                                                           //
      20             : // ALICE Cosmic Ray Trigger                                                  //
      21             : //                                                                           //
      22             : //  This class contains the functions for version 0 of the ALICE Cosmic Ray  //
      23             : //  Trigger. This version will be used to simulation comic rays in alice with//
      24             : //  all the detectors. It include geometry and hits (posicion and momentum)  //
      25             : //                                                                           // 
      26             : //   Author: Enrique Gamez                                                   //
      27             : //                                                                           //
      28             : //                  Send comments to:                                        //
      29             : //      Arturo Fernandez <afernand@fcfm.buap.mx>                             //
      30             : //      Eleazar Cuautle  <ecuautle@nucleares.unam.mx>                        //
      31             : //                                                                           //
      32             : //      Last update: Nov. 17th. 2009                                         //
      33             : //      Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch                  //
      34             : //      FCFM-BUAP, Puebla, Pue. Mexico                                       //
      35             : //                                                                           //
      36             : ///////////////////////////////////////////////////////////////////////////////
      37             : 
      38             : 
      39             : #include "AliACORDEv0.h"
      40             : #include <TClonesArray.h>
      41             : #include <TLorentzVector.h>
      42             : #include <TVirtualMC.h>
      43             : #include <TPDGCode.h>
      44             : 
      45             : 
      46             : #include "AliRun.h"
      47             : #include "AliConst.h"
      48             : #include "AliACORDEhit.h"
      49             : #include "AliACORDEConstants.h"
      50             : #include "AliMC.h"
      51             : #include "AliLog.h"
      52             : 
      53          12 : ClassImp(AliACORDEv0)
      54             :  
      55             : //_____________________________________________________________________________
      56             : AliACORDEv0::AliACORDEv0()
      57           0 :   : AliACORDE()
      58           0 : {
      59             :   //
      60             :   // Default constructor
      61           0 :   fIshunt = 0;
      62           0 :   fHits = 0;
      63             :   //
      64           0 : } 
      65             : //_____________________________________________________________________________
      66             : AliACORDEv0::AliACORDEv0(const char *name, const char *title)
      67           0 :   : AliACORDE(name, title)
      68           0 : {
      69             :   //
      70             :   // Standard constructor
      71             :   //
      72           0 :   fIshunt = 1; // All hits are associated with primary particles 
      73           0 :   fHits =  new TClonesArray("AliACORDEhit",400);
      74           0 :   gAlice->GetMCApp()->AddHitList(fHits);
      75           0 : }
      76             : //_____________________________________________________________________________
      77             : AliACORDEv0::~AliACORDEv0()
      78           0 : {
      79             :   //
      80             :   // Default destructor
      81             :   //
      82           0 : }
      83             : 
      84             : //_____________________________________________________________________________
      85             : void AliACORDEv0::CreateGeometry()
      86             : {
      87           0 :   CreateAcorde();
      88           0 :   if (GetCreateCavern()) CreateCavern();
      89           0 : }
      90             : 
      91             : void AliACORDEv0::CreateCavern()
      92             : {
      93           0 :   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
      94             :     // Create the mother volume, the one which will contain all the material
      95             :   // above the hall.
      96           0 :   Float_t pbox[3];
      97           0 :   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
      98             :   //pbox[0] = 12073;
      99           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth();
     100           0 :   pbox[2] = pbox[0];
     101           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE", "BOX", idtmed[1114], pbox, 3);
     102           0 :   TVirtualMC::GetMC()->Gspos("ACORDE", 1, "ALIC", 0, 0, 0, 0, "ONLY");
     103           0 :   CreateShafts();
     104           0 :   CreateMolasse();
     105           0 : }
     106             : 
     107             : void AliACORDEv0::CreateShafts()
     108             : 
     109             : {
     110             : 
     111             :   //
     112           0 :   Int_t  idrotm[2499];    // The rotation matrix.
     113           0 :   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
     114             : 
     115             :   //
     116             :   // Acces shafts
     117             :   //
     118           0 :   AliMatrix(idrotm[2001], 0, 0, 90, 0, 90, 90);
     119             : 
     120             : 
     121             :   // Create a bing cilinder to hold the main structures in the shaft.
     122             :   //   All the structures relative to the shaft will be put into
     123             :   // this volume.
     124             :   //   This shaft is composed by an open tube down in the hall, and
     125             :   // a cilinder avobe the level of the ceiling.
     126           0 :   Float_t ptube[3];
     127           0 :   ptube[0] = 0;    // inner radius
     128           0 :   ptube[1] = 1250; // outer radius
     129           0 :   ptube[2] = 5150/2; // Half lenght in Z
     130           0 :   TVirtualMC::GetMC()->Gsvolu("CSF1", "TUBE", idtmed[1114], ptube, 3);
     131             : 
     132           0 :   Float_t ptubs[5];
     133             :   // The open section of the PX24
     134           0 :   ptubs[0] = 1150; // Inner radius
     135           0 :   ptubs[1] = 1250; // Outer radius
     136           0 :   ptubs[2] = 1300; // Half length
     137           0 :   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]); // starting angle
     138           0 :   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
     139           0 :   TVirtualMC::GetMC()->Gsvolu("CSF2", "TUBS", idtmed[1116], ptubs, 5);
     140           0 :   TVirtualMC::GetMC()->Gspos("CSF2", 1, "CSF1", 0, 0, -ptube[2] + ptubs[2], 0, "MANY");
     141             : 
     142             :   // The other part of the shaft.
     143           0 :   ptube[0] = ptubs[0]; // Inner radius
     144           0 :   ptube[1] = ptubs[1]; // Outer radius
     145           0 :   ptube[2] = 5150/2 - ptubs[2]; // Half lenght
     146           0 :   TVirtualMC::GetMC()->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
     147           0 :   TVirtualMC::GetMC()->Gspos("CSF3", 1, "CSF1", 0, 0, 5150/2 - ptube[2], 0, "MANY");
     148             : 
     149           0 :   Float_t pbox[3];
     150             :   // Concrete walls along the shaft (next to the elevator.)
     151           0 :   pbox[0] = 480/2;  // Half length in X
     152           0 :   pbox[1] = 120/2;  // Half length in Y
     153           0 :   pbox[2] = 5150/2; // Half length in Z
     154           0 :   TVirtualMC::GetMC()->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
     155           0 :   TVirtualMC::GetMC()->Gspos("CSW1", 1, "CSF1", 820+pbox[0],  150+pbox[1], 0, 0, "MANY");
     156           0 :   TVirtualMC::GetMC()->Gspos("CSW1", 2, "CSF1", 820+pbox[0], -300-pbox[1], 0, 0, "MANY");
     157             : 
     158             :   //
     159           0 :   pbox[0] = 120/2;  // Half length in X
     160           0 :   pbox[1] = 750/2;  // Half length in Y
     161           0 :   pbox[2] = 5150/2; // Half length in Z
     162           0 :   TVirtualMC::GetMC()->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
     163           0 :   TVirtualMC::GetMC()->Gspos("CSW2", 1, "CSF1", 820-60, 150+pbox[1], 0, 0, "MANY");
     164             : 
     165             :   //
     166           0 :   pbox[0] = 120/2;  // Half length in X
     167           0 :   pbox[1] = 600/2;  // Half lenght in Y
     168           0 :   pbox[2] = 5150/2; // Half length in Z
     169           0 :   TVirtualMC::GetMC()->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
     170           0 :   TVirtualMC::GetMC()->Gspos("CSW3", 1, "CSF1", 820-60, -300-pbox[1], 0, 0, "MANY");
     171             : 
     172             :   // Material below the counting rooms.
     173           0 :   pbox[0] = 400/2;
     174           0 :   pbox[1] = 2300/2;
     175           0 :   pbox[2] = 300/2;
     176           0 :   TVirtualMC::GetMC()->Gsvolu("CSW4", "BOX", idtmed[1116], pbox, 3);
     177           0 :   TVirtualMC::GetMC()->Gspos("CSW4",1,"CSF1",2300/2-pbox[0],0,3000-5150/2-pbox[2], 0, "MANY");
     178             : 
     179             :   // Shielding plug.
     180           0 :   pbox[0] = 1400/2;
     181           0 :   pbox[1] = 2300/2;
     182           0 :   pbox[2] = 170/2;
     183           0 :   TVirtualMC::GetMC()->Gsvolu("CSW5", "BOX", idtmed[1116], pbox, 3);
     184           0 :   TVirtualMC::GetMC()->Gspos("CSW5", 1, "CSF1", 0, 0, 3000-5150/2-130, 0, "MANY");
     185             : 
     186             :   // The end of the support for the shielding plug.
     187           0 :   pbox[0] = 170/2;
     188           0 :   pbox[1] = 2300/2;
     189           0 :   pbox[2] = 300/2;
     190           0 :   TVirtualMC::GetMC()->Gsvolu("CSW6", "BOX", idtmed[1116], pbox, 3);
     191           0 :   TVirtualMC::GetMC()->Gspos("CSW6",1,"CSF1",-1400/2-pbox[0],0,3000-5150/2-pbox[2],0,"MANY");
     192             : 
     193             :   // ...
     194           0 :   pbox[0] = 100/2;
     195           0 :   pbox[1] = 2300/2;
     196           0 :   pbox[2] = 450/2;
     197           0 :   TVirtualMC::GetMC()->Gsvolu("CSW7", "BOX", idtmed[1116], pbox, 3);
     198           0 :   TVirtualMC::GetMC()->Gspos("CSW7",1,"CSF1",-1400/2-170-pbox[0],0,3000-5150/2+pbox[2],0,"MANY");
     199             : 
     200             :   // Material close to the pipe.
     201           0 :   pbox[0] = 300/2;
     202           0 :   pbox[1] = 2300/2;
     203           0 :   pbox[2] = 170/2;
     204           0 :   TVirtualMC::GetMC()->Gsvolu("CSW8", "BOX", idtmed[1116], pbox, 3);
     205           0 :   TVirtualMC::GetMC()->Gspos("CSW8",1,"CSF1",-2300/2+pbox[0],0,2500-5150/2,0,"MANY");
     206             : 
     207             :   // Now put the shaft into the mother volume.
     208           0 :   TVirtualMC::GetMC()->Gspos("CSF1", 1, "ACORDE", 0, AliACORDEConstants::Instance()->Depth() - 5150/2, 2300, idrotm[2001], "MANY");
     209             : 
     210             :   // PM25 Access Shaft
     211           0 :   ptube[0] = 910/2;
     212           0 :   ptube[1] = ptube[0] + 100;
     213           0 :   ptube[2] = (5150 - 1166)/2;
     214           0 :   TVirtualMC::GetMC()->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
     215           0 :   TVirtualMC::GetMC()->Gspos("CSF4", 1, "ACORDE", 2100, AliACORDEConstants::Instance()->Depth()-ptube[2], 0, idrotm[2001], "MANY");
     216             : 
     217             :   // PGC2 Access Shaft
     218           0 :   ptube[0] = 1100/2;
     219           0 :   ptube[1] = ptube[0] + 100;
     220           0 :   ptube[2] = (5150 - 690)/2;
     221           0 :   TVirtualMC::GetMC()->Gsvolu("CSF5", "TUBE", idtmed[1116], ptube, 3);
     222           0 :   TVirtualMC::GetMC()->Gspos("CSF5", 1, "ACORDE", -375, AliACORDEConstants::Instance()->Depth()-ptube[2], -1900 - 2987.7, idrotm[2001], "MANY");
     223             : 
     224           0 : }
     225             : 
     226             : 
     227             : void AliACORDEv0::CreateMolasse()
     228             : 
     229             : {
     230             : 
     231             :   //
     232           0 :   Int_t  idrotm[2499];    // The rotation matrix.
     233           0 :   Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
     234             : 
     235             :   Float_t px24radius = 2300/2;
     236             :   Float_t px24X = 0;
     237             :   //Float_t px24Y = ;
     238             :   Float_t px24Z = 2300;
     239             : 
     240             :   Float_t pm25radius = 910/2;
     241             :   Float_t pm25X = 2100;
     242             :   //Float_t pm25Y = ;
     243             :   Float_t pm25Z = 0;
     244             : 
     245             :   Float_t pgc2radius = 1100/2;
     246             :   Float_t pgc2X = -375;
     247             :   //Float_t pgc2Y = ;
     248             :   Float_t pgc2Z = -(1900 + 2987.7);
     249             : 
     250             :   Float_t concreteWidth = 100; // Standard width of the hall walls.
     251             : 
     252             : 
     253             :   // Create a local mother volume.
     254           0 :   Float_t pbox[3];
     255           0 :   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
     256           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     257           0 :   pbox[2] = pbox[0];
     258           0 :   TVirtualMC::GetMC()->Gsvolu("CMO1", "BOX", idtmed[1114], pbox, 3);
     259             : 
     260             :   // Now put the molasse exactly above the hall. OK
     261             :   // Above the ceiling
     262           0 :   Float_t ptubs[5];
     263           0 :   ptubs[0] = 1170;
     264           0 :   ptubs[1] = 2100 - pm25radius;
     265           0 :   ptubs[2] = 1900/2 + px24radius;
     266           0 :   ptubs[3] = 0;
     267           0 :   ptubs[4] = 180;
     268           0 :   TVirtualMC::GetMC()->Gsvolu("CMO2", "TUBS", idtmed[1123], ptubs, 5);
     269           0 :   TVirtualMC::GetMC()->Gspos("CMO2", 1, "CMO1", 0, 500-AliACORDEConstants::Instance()->Depth()/2, ptubs[2]-1900, 0, "MANY");
     270             : 
     271             :   // Molasse around the RB24/26 Wall. OK
     272           0 :   ptubs[0] = 220 + 1600;
     273           0 :   ptubs[1] = AliACORDEConstants::Instance()->Depth() - ptubs[0];
     274           0 :   ptubs[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
     275           0 :   ptubs[3] = 0;
     276           0 :   ptubs[4] = 180;
     277           0 :   TVirtualMC::GetMC()->Gsvolu("CMO3", "TUBS", idtmed[1123], ptubs, 5);
     278           0 :   TVirtualMC::GetMC()->Gspos("CMO3", 1, "CMO1", 70, 40-AliACORDEConstants::Instance()->Depth()/2, -1900 - ptubs[2], 0, "MANY");
     279             : 
     280             :   // A big block above the RB24/26 wall. OK
     281           0 :   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
     282           0 :   pbox[1] = (AliACORDEConstants::Instance()->Depth() - 220 - 1600)/2;
     283           0 :   pbox[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
     284           0 :   TVirtualMC::GetMC()->Gsvolu("CMO4", "BOX", idtmed[1123], pbox, 3);
     285           0 :   TVirtualMC::GetMC()->Gspos("CMO4", 1, "CMO1", 0, AliACORDEConstants::Instance()->Depth()/2 - pbox[1], -1900 - pbox[2], 0, "MANY");
     286             :   // Small blocks below the volume CMO4 on both sides of the wall RB24/26. OK
     287           0 :   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
     288           0 : ptubs[0])/2;
     289           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2 - pbox[1];
     290           0 :   TVirtualMC::GetMC()->Gsvolu("CM17", "BOX", idtmed[1123], pbox, 3);
     291           0 :   TVirtualMC::GetMC()->Gspos("CM17", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
     292           0 :   TVirtualMC::GetMC()->Gspos("CM17", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0], -AliACORDEConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
     293             : 
     294             :   // And a big block of molasse above the hall up to the surface. OK
     295           0 :   pbox[0] = pm25X - pm25radius;
     296           0 :   pbox[1] = (AliACORDEConstants::Instance()->Depth()-500-1170)/2;
     297           0 :   pbox[2] = (1900 + 1150)/2;
     298           0 :   TVirtualMC::GetMC()->Gsvolu("CMO5", "BOX", idtmed[1123], pbox, 3);
     299           0 :   TVirtualMC::GetMC()->Gspos("CMO5", 1, "CMO1", 0,AliACORDEConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900, 0, "MANY");
     300             :   // Small blocks of molasse betwen the blocks CMO2, CMO5 and PM25. Ok
     301           0 :   pbox[0] = (pm25X - pm25radius - 1170)/2;
     302           0 :   pbox[1] = 1000;
     303           0 :   TVirtualMC::GetMC()->Gsvolu("CM16", "BOX", idtmed[1123], pbox, 3);
     304           0 :   TVirtualMC::GetMC()->Gspos("CM16", 1, "CMO1", 1170 + pbox[0], -AliACORDEConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900, 0, "MANY");
     305             : 
     306             :   // Molasse around the shafts.
     307           0 :   AliMatrix(idrotm[2003], 0, 0, 90, 0, 90, 90);
     308             :   // Around the PX24, the open section. OK
     309           0 :   ptubs[0] = px24radius + concreteWidth;
     310           0 :   ptubs[1] = ptubs[0] + 1000;
     311           0 :   ptubs[2] = (2300 - (5150 - AliACORDEConstants::Instance()->Depth()))/2;
     312           0 :   ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]);
     313           0 :   ptubs[4] = 180 -  kRaddeg*TMath::ASin(1070/ptubs[0]);
     314           0 :   TVirtualMC::GetMC()->Gsvolu("CMO6", "TUBS", idtmed[1123], ptubs, 5);
     315           0 :   TVirtualMC::GetMC()->Gspos("CMO6", 1, "CMO1", px24X, ptubs[2] - AliACORDEConstants::Instance()->Depth()/2, px24Z, idrotm[2003], "MANY");
     316             :   // Around the PX24, the closed section. OK
     317           0 :   Float_t ptube[3];
     318           0 :   ptube[0] = px24radius + concreteWidth;
     319           0 :   ptube[1] = ptube[0] + 1000;
     320           0 :   ptube[2] = (5150 - 2300)/2;
     321           0 :   TVirtualMC::GetMC()->Gsvolu("CMO7", "TUBE", idtmed[1123], ptube, 3);
     322           0 :   TVirtualMC::GetMC()->Gspos("CMO7", 1, "CMO1", px24X, AliACORDEConstants::Instance()->Depth()/2 - ptube[2], px24Z, idrotm[2003], "MANY");
     323             : 
     324             :   // Around PM25. OK
     325           0 :   ptube[0] = pm25radius + concreteWidth;
     326           0 :   ptube[1] = ptube[0] + 400;
     327           0 :   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
     328           0 :   TVirtualMC::GetMC()->Gsvolu("CMO8", "TUBE", idtmed[1123], ptube, 3);
     329           0 :   TVirtualMC::GetMC()->Gspos("CMO8", 1, "CMO1", pm25X, 0, pm25Z, idrotm[2003], "MANY");
     330             :   // On both sides of the PM25 along the HALL.
     331           0 :   pbox[0] = (2100 + pm25radius - 1170)/2;
     332           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     333           0 :   pbox[2] = (3*px24radius - pm25radius)/2;
     334           0 :   TVirtualMC::GetMC()->Gsvolu("CM18", "BOX", idtmed[1123], pbox, 3);
     335           0 :   TVirtualMC::GetMC()->Gspos("CM18", 1, "CMO1", 2100, 0, pbox[2] + pm25radius, 0, "MANY");
     336             : 
     337           0 :   pbox[2] = (1900 - pm25radius)/2;
     338           0 :   TVirtualMC::GetMC()->Gsvolu("CM19", "BOX", idtmed[1123], pbox, 3);
     339           0 :   TVirtualMC::GetMC()->Gspos("CM19", 1, "CMO1", 2100, 0, -pbox[2] - pm25radius, 0, "MANY");
     340             : 
     341             :   // Around the PGC2. OK
     342           0 :   ptube[0] = pgc2radius + concreteWidth;
     343           0 :   ptube[1] = 2987.7 - 740;
     344           0 :   ptube[2] = AliACORDEConstants::Instance()->Depth()/2;
     345           0 :   TVirtualMC::GetMC()->Gsvolu("CMO9", "TUBE", idtmed[1123], ptube, 3);
     346           0 :   TVirtualMC::GetMC()->Gspos("CMO9", 1, "CMO1", pgc2X, 0, pgc2Z, idrotm[2003], "MANY");
     347             : 
     348             :   // On both sides of the PGC2.OK
     349           0 :   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
     350           0 : 1100 - 375)/2;
     351           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     352           0 :   pbox[2] = pgc2radius + concreteWidth;
     353           0 :   TVirtualMC::GetMC()->Gsvolu("CM10", "BOX", idtmed[1123], pbox, 3);
     354           0 :   TVirtualMC::GetMC()->Gspos("CM10", 1, "CMO1", AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z, 0, "MANY");
     355           0 :   TVirtualMC::GetMC()->Gspos("CM10", 2, "CMO1", -AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z, 0, "MANY");
     356             : 
     357             :   // big block of molasse behind the PX24. OK
     358           0 :   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
     359           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     360           0 :   pbox[2] = (pbox[0] - (2300 + 1150 + 100))/2;
     361           0 :   TVirtualMC::GetMC()->Gsvolu("CM12", "BOX", idtmed[1123], pbox, 3);
     362           0 :   TVirtualMC::GetMC()->Gspos("CM12", 1, "CMO1", px24X, 0, px24Z + px24radius + concreteWidth + pbox[2], 0, "MANY");
     363             : 
     364             :   // big block of molasse in the opposite side of the PM25. OK
     365           0 :   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
     366           0 : 1150)/2;
     367           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     368           0 :   pbox[2] = (1900 + 2300 + 1150)/2;
     369           0 :   TVirtualMC::GetMC()->Gsvolu("CM13", "BOX", idtmed[1123], pbox, 3);
     370           0 :   TVirtualMC::GetMC()->Gspos("CM13", 1, "CMO1", -1150 - pbox[0], 0, pbox[2] - 1900, 0, "MANY");
     371             : 
     372             :   // big block of molasse behind the PM25. OK
     373           0 :   pbox[0] = (AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) -
     374           0 : (2100 + 910/2 + 100))/2;
     375           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     376           0 :   pbox[2] = (1900 + 2300 + 1150)/2;
     377           0 :   TVirtualMC::GetMC()->Gsvolu("CM14", "BOX", idtmed[1123], pbox, 3);
     378           0 :   TVirtualMC::GetMC()->Gspos("CM14", 1, "CMO1", pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900, 0, "MANY");
     379             : 
     380             :   // big block of molasse behind the PGC2. OK
     381           0 :   pbox[0] = AliACORDEConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
     382           0 :   pbox[1] = AliACORDEConstants::Instance()->Depth()/2;
     383           0 :   pbox[2] = (pbox[0] - (2987.7 + 1900 + 1100/2 + 100))/2;
     384           0 :   TVirtualMC::GetMC()->Gsvolu("CM15", "BOX", idtmed[1123], pbox, 3);
     385           0 :   TVirtualMC::GetMC()->Gspos("CM15", 1, "CMO1", 0, 0, -pbox[0] + pbox[2], 0, "MANY");
     386             : 
     387           0 :   TVirtualMC::GetMC()->Gspos("CMO1",1,"ACORDE",0,AliACORDEConstants::Instance()->Depth()/2,0,0,"MANY");
     388             : 
     389           0 : }
     390             : 
     391             : void AliACORDEv0::CreateAcorde()
     392             : {
     393             :   //
     394             :   // Create geometry for the ACORDE array
     395             :   // done in two main steps
     396             :   //  1.- definition of the modules
     397             :   //  2.- placement of the modules
     398             :   //
     399           0 :   Int_t  idrotm[2499];    // The rotation matrix.
     400           0 :   Int_t* idtmed = fIdtmed->GetArray() - 1099;
     401           0 :   AliACORDEConstants* constants = AliACORDEConstants::Instance();
     402           0 :   Float_t box[3];
     403             :   Float_t placed_at;
     404             :   Float_t placed_at2;
     405             :   Float_t small = 0.05; // to separate slightly some volumes
     406             :                         // by half a mm so that they do not overlap
     407             : 
     408             : 
     409             :   // 1.- Definition of a module
     410             :   // *  ACORDE1 => volume filled with air, representing a module
     411             :   //               it contains all other volumes defining the module
     412             :   //               there are 60 copies of it
     413             :   // *  ACORDE2 => volume defining one scintillator pad
     414             :   //               there are 2 copies of it per module
     415             :   // *  ACORDE3-6 => volumes representing the Al walls of box
     416             :   //               surrounding the plastic
     417             :   //               3: long wall, 2 copies (front, back)
     418             :   //               4: end caps, 2 copies (left, right)
     419             :   //               5: long stripe to model the profile 
     420             :   //                  4 copies (upper front and back, lower)
     421             :   //               6: short stripe to model the profile
     422             :   //                  4 copies (upper left, right; lower)
     423             : 
     424             :   // The full module volume.
     425             :   // This volume will be ocupied by all the material of the module
     426             :   // the scintillators, the aluminium frame, etc.
     427           0 :   box[0] = constants->ModuleLength()/2;
     428           0 :   box[1] = constants->ModuleHeight()/2;
     429           0 :   box[2] = constants->ModuleWidth()/2;
     430           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE1", "BOX", idtmed[1114], box, 3);
     431             : 
     432             :   // The scintillators
     433           0 :   box[0] = constants->PlasticLength()/2;
     434           0 :   box[1] = constants->PlasticHeight()/2;
     435           0 :   box[2] = constants->PlasticWidth()/2;
     436           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE2", "BOX", idtmed[1112], box, 3);
     437             : 
     438             :   // it is important to keep this order for easy assignment of 
     439             :   // a volume to a physical module:
     440           0 :   placed_at = box[1]+constants->ProfileThickness()
     441           0 :     - constants->ModuleHeight()/2+small;
     442           0 :   TVirtualMC::GetMC()->Gspos("ACORDE2", 1, "ACORDE1", 0, placed_at, 0, 0, "MANY");
     443           0 :   placed_at = placed_at + 2.0*box[1]+small;
     444           0 :   TVirtualMC::GetMC()->Gspos("ACORDE2", 2, "ACORDE1", 0, placed_at, 0, 0, "MANY");
     445             : 
     446             : 
     447             :   // The metallic frame: long walls of box
     448             :   // back,front,left,right, defined looking
     449             :   // from the + z diraction into alice; i.e.
     450             :   // back ==> z<0, front ==> z>0
     451             :   // left ==> x<0, right ==> x>0
     452             :   // up ==> increasing y, down ==> decreasing y
     453           0 :   box[0] = constants->ModuleLength()/2;
     454           0 :   box[1] = constants->ModuleHeight()/2;
     455           0 :   box[2] = constants->ProfileThickness()/2.0; 
     456           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE3", "BOX", idtmed[1108], box, 3);
     457             :   // front wall
     458           0 :   placed_at = constants->ModuleWidth()/2-constants->ProfileThickness()/2.0;
     459           0 :   TVirtualMC::GetMC()->Gspos("ACORDE3", 1, "ACORDE1", 0, 0, placed_at, 0, "MANY");
     460             :   // back wall
     461           0 :   TVirtualMC::GetMC()->Gspos("ACORDE3", 2, "ACORDE1", 0, 0, -placed_at , 0, "MANY");
     462             : 
     463             :   // The metallic frame: end caps
     464           0 :   box[0] = constants->ProfileThickness()/2.0;
     465           0 :   box[1] = constants->ModuleHeight()/2;
     466           0 :   box[2] = constants->ModuleWidth()/2;
     467           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE4", "BOX", idtmed[1108], box, 3);
     468             :   // right cap
     469           0 :   placed_at = constants->ModuleLength()/2-constants->ProfileThickness()/2.0;
     470           0 :   TVirtualMC::GetMC()->Gspos("ACORDE4", 1, "ACORDE1", placed_at, 0, 0, 0, "MANY");
     471             :   // left cap
     472           0 :   TVirtualMC::GetMC()->Gspos("ACORDE4", 2, "ACORDE1", -placed_at, 0, 0, 0, "MANY");
     473             : 
     474             :   // The metallic frame: the profile, long stripes
     475           0 :   box[0] = constants->ModuleLength()/2.0;
     476           0 :   box[1] = constants->ProfileThickness()/2;
     477           0 :   box[2] = constants->ProfileWidth()/2;
     478           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE5", "BOX", idtmed[1108], box, 3);
     479             :   // upper front
     480           0 :   placed_at = constants->ModuleHeight()/2-box[1];
     481           0 :   placed_at2 = constants->ModuleWidth()/2-
     482           0 :     constants->ProfileThickness()-box[2];
     483           0 :   TVirtualMC::GetMC()->Gspos("ACORDE5", 1, "ACORDE1",0,placed_at,placed_at2, 0, "MANY");
     484             :   // upper back
     485           0 :   TVirtualMC::GetMC()->Gspos("ACORDE5", 2, "ACORDE1",0,placed_at,-placed_at2, 0, "MANY");
     486             :   // lower front
     487           0 :   TVirtualMC::GetMC()->Gspos("ACORDE5", 3, "ACORDE1",0,-placed_at,placed_at2, 0, "MANY");
     488             :   // lower back
     489           0 :   TVirtualMC::GetMC()->Gspos("ACORDE5", 4, "ACORDE1",0,-placed_at,-placed_at2, 0, "MANY");
     490             : 
     491             :   // The metallic frame: the profile, long stripes
     492           0 :   box[0] = constants->ProfileWidth()/2.0;
     493           0 :   box[1] = constants->ProfileThickness()/2;
     494           0 :   box[2] = constants->ModuleWidth()/2-constants->ProfileWidth();
     495           0 :   TVirtualMC::GetMC()->Gsvolu("ACORDE6", "BOX", idtmed[1108], box, 3);
     496             :   // upper right
     497           0 :   placed_at = constants->ModuleHeight()/2-box[1];
     498           0 :   placed_at2 = constants->ModuleLength()/2-
     499           0 :     constants->ProfileThickness()-box[0];
     500           0 :   TVirtualMC::GetMC()->Gspos("ACORDE6", 1, "ACORDE1",placed_at2,placed_at,0, 0, "MANY");
     501             :   // upper left
     502           0 :   TVirtualMC::GetMC()->Gspos("ACORDE6", 2, "ACORDE1",-placed_at2,placed_at,0, 0, "MANY");
     503             :   // lower right
     504           0 :   TVirtualMC::GetMC()->Gspos("ACORDE6", 3, "ACORDE1",placed_at2,-placed_at,0, 0, "MANY");
     505             :   // lower left
     506           0 :   TVirtualMC::GetMC()->Gspos("ACORDE6", 4, "ACORDE1",-placed_at2,-placed_at,0, 0, "MANY");
     507             : 
     508             :   // End of MODULE definition
     509             : 
     510             :   ////////////////////////////////////////////////////////////////////
     511             :   ////////////////////////////////////////////////////////////////////
     512             : 
     513             :   // 2.- placement of the module
     514             :   // Now put all of them in the right position in 
     515             :   // master volume ALIC
     516             : 
     517             :   // rotation matrices (see Geant manual for conventions)
     518             :   // for columns 4 and 5
     519           0 :   AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
     520             :   // for columns 0 and 1
     521           0 :   AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
     522             : 
     523             :   // place each one of the 6 columns in turn
     524             :   // for the first and the last column the position
     525             :   // of the two last modules depends on the value 
     526             :   // of the fITSGeometry variable
     527             : 
     528             :   // it is important to keep this order because
     529             :   // the copy number defines the module!
     530             : 
     531             :   // first column, except first and last  modules
     532           0 :   for (Int_t copy = 2; copy < 10; copy++)
     533           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
     534           0 :                constants->OldModulePositionX(copy-1),
     535           0 :                constants->OldModulePositionY(copy-1),
     536           0 :                constants->OldModulePositionZ(copy-1),
     537           0 :                idrotm[232], "MANY");
     538             :   // second column
     539           0 :   for (Int_t copy = 11; copy < 21; copy++)
     540           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
     541           0 :                constants->OldModulePositionX(copy-1),
     542           0 :                constants->OldModulePositionY(copy-1),
     543           0 :                constants->OldModulePositionZ(copy-1),
     544           0 :                idrotm[232], "MANY");
     545             :   // third and fourth columns
     546           0 :   for (Int_t copy = 21; copy < 41; copy++)
     547           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
     548           0 :                constants->OldModulePositionX(copy-1),
     549           0 :                constants->OldModulePositionY(copy-1),
     550           0 :                constants->OldModulePositionZ(copy-1),
     551             :                0, "MANY");
     552             :   // fifth column
     553           0 :   for (Int_t copy = 41; copy < 51; copy++)
     554           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
     555           0 :                constants->OldModulePositionX(copy-1),
     556           0 :                constants->OldModulePositionY(copy-1),
     557           0 :                constants->OldModulePositionZ(copy-1),
     558           0 :                idrotm[231], "MANY");
     559             :   // last column, except first and last  modules
     560           0 :   for (Int_t copy = 52; copy < 60; copy++)
     561           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",copy,"ALIC",
     562           0 :                constants->OldModulePositionX(copy-1),
     563           0 :                constants->OldModulePositionY(copy-1),
     564           0 :                constants->OldModulePositionZ(copy-1),
     565           0 :                idrotm[231], "MANY");
     566             :   // the last four modules
     567           0 :   if (Get4CentralModulesGeometry()) {
     568           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",1,"ALIC",
     569           0 :                constants->OldExtraModulePositionX(),
     570           0 :                constants->OldExtraModulePositionY(),
     571           0 :                constants->OldExtraModulePositionZ(0),
     572             :                0, "MANY");  
     573           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",10,"ALIC",
     574           0 :                constants->OldExtraModulePositionX(),
     575           0 :                constants->OldExtraModulePositionY(),
     576           0 :                constants->OldExtraModulePositionZ(1),
     577             :                0, "MANY");  
     578           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",51,"ALIC",
     579           0 :                constants->OldExtraModulePositionX(),
     580           0 :                constants->OldExtraModulePositionY(),
     581           0 :                constants->OldExtraModulePositionZ(2),
     582             :                0, "MANY");  
     583           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",60,"ALIC",
     584           0 :                constants->OldExtraModulePositionX(),
     585           0 :                constants->OldExtraModulePositionY(),
     586           0 :                constants->OldExtraModulePositionZ(3),
     587             :                0, "MANY");  
     588           0 :   } else {
     589           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",1,"ALIC",
     590           0 :                constants->OldModulePositionX(0),
     591           0 :                constants->OldModulePositionY(0),
     592           0 :                constants->OldModulePositionZ(0),
     593           0 :                idrotm[232], "MANY");
     594           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",10,"ALIC",
     595           0 :                constants->OldModulePositionX(9),
     596           0 :                constants->OldModulePositionY(9),
     597           0 :                constants->OldModulePositionZ(9),
     598           0 :                idrotm[232], "MANY");
     599           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",51,"ALIC",
     600           0 :                constants->OldModulePositionX(50),
     601           0 :                constants->OldModulePositionY(50),
     602           0 :                constants->OldModulePositionZ(50),
     603           0 :                idrotm[231], "MANY");
     604           0 :     TVirtualMC::GetMC()->Gspos("ACORDE1",60,"ALIC",
     605           0 :                constants->OldModulePositionX(59),
     606           0 :                constants->OldModulePositionY(59),
     607           0 :                constants->OldModulePositionZ(59),
     608           0 :                idrotm[231], "MANY");
     609             :   } // end if (fITSGeometry)
     610             : 
     611           0 : }
     612             : 
     613             : //____________________________________________________________________________
     614             : 
     615             : void AliACORDEv0::Init()
     616             : {
     617             :   // Initialise L3 magnet after it has been built
     618             :   Int_t i;
     619           0 :   if(AliLog::GetGlobalDebugLevel()>0) {
     620           0 :     printf("\n%s: ",ClassName());
     621           0 :     for(i=0;i<35;i++) printf("*");
     622           0 :     printf(" ACORDEv0_INIT ");
     623           0 :     for(i=0;i<35;i++) printf("*");
     624           0 :     printf("\n%s: ",ClassName());
     625             :     // Here the ACORDEv initialisation code (if any!)
     626           0 :     for(i=0;i<80;i++) printf("*");
     627           0 :     printf("\n");
     628           0 :   }
     629             :  // AliACORDE::Init();  
     630           0 : }
     631             : //____________________________________________________________________________
     632             : void AliACORDEv0::StepManager()
     633             : {
     634             :   //
     635             :   // Called for every step in the Cosmic Ray Trigger
     636             :   //
     637             : 
     638             : 
     639             :   // volume: 
     640             :   //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
     641             :   //  [1] = Plastic number: 0 (down) to 1 (up)
     642             :   static Int_t   vol[2]; 
     643             :   //
     644             :   // hit
     645             :   // [0] = PID
     646             :   // [1-3] = x, y, z 
     647             :   // [4] = time 
     648             :   // [5-7] = px, py, pz
     649             :   // [8] = energy 
     650             :   // [9] = energy loss
     651             :   // [10] = length of track through plastic
     652             :   static Float_t hits[11];
     653             : 
     654             :   // local static variables
     655             :   static Float_t eloss;
     656             :   static Float_t step;
     657             :   // scintillator volume
     658           0 :   static Int_t idScint = TVirtualMC::GetMC()->VolId("ACORDE2");
     659             : 
     660             :   // local variables
     661           0 :   Int_t copy;
     662           0 :   TLorentzVector pos;
     663           0 :   TLorentzVector mom;
     664             : 
     665             :   // only charged tracks
     666           0 :   if ( !TVirtualMC::GetMC()->TrackCharge() || !TVirtualMC::GetMC()->IsTrackAlive() ) return;
     667             : 
     668             :   // only in sensitive material
     669           0 :   if (TVirtualMC::GetMC()->CurrentVolID(copy) == idScint) {
     670           0 :     step  += TVirtualMC::GetMC()->TrackStep();
     671           0 :     eloss += TVirtualMC::GetMC()->Edep();
     672             :     // set all hit variables except eloss which is resetted
     673             :     // set volume variables
     674           0 :     if (TVirtualMC::GetMC()->IsTrackEntering()) {
     675           0 :       eloss = 0.0;
     676           0 :       step = 0.0;
     677           0 :       TVirtualMC::GetMC()->TrackPosition(pos);
     678           0 :       TVirtualMC::GetMC()->TrackMomentum(mom);
     679             :       // hit
     680             :       // [0] = PID
     681             :       // [1-3] = x, y, z 
     682             :       // [4] = time 
     683             :       // [5-7] = px, py, pz
     684             :       // [8] = energy 
     685             :       // [9] = energy loss
     686           0 :       hits[0]  = (Float_t ) TVirtualMC::GetMC()->TrackPid(); 
     687           0 :       hits[1] = pos[0]; 
     688           0 :       hits[2] = pos[1]; 
     689           0 :       hits[3] = pos[2]; 
     690           0 :       hits[4] = TVirtualMC::GetMC()->TrackTime();
     691           0 :       hits[5] = mom[0]; 
     692           0 :       hits[6] = mom[1]; 
     693           0 :       hits[7] = mom[2]; 
     694           0 :       hits[8] = TVirtualMC::GetMC()->Etot();
     695             :       // volume: 
     696             :       //  [0] = module number 1-60 (1==>(0-0), 60 (5-9)
     697             :       //  [1] = Plastic number: 0 (down) to 1 (up)
     698           0 :       Int_t copyPlastic; // plastic: down=1, up=2
     699           0 :       Int_t copyModule; // module: 1-60
     700           0 :       TVirtualMC::GetMC()->CurrentVolID(copyPlastic);
     701           0 :       TVirtualMC::GetMC()->CurrentVolOffID(1, copyModule);
     702             :       // module
     703           0 :       vol[0] = copyModule;
     704             :       // plastic: 0 = down, 1 = up
     705           0 :       vol[1] = copyPlastic;
     706           0 :     } // end if TVirtualMC::GetMC()->IsTrackEntering()
     707             : 
     708             :     // set hit[9] = total energy loss and book hit
     709           0 :     if( TVirtualMC::GetMC()->IsTrackExiting() || 
     710           0 :         TVirtualMC::GetMC()->IsTrackStop() || 
     711           0 :         TVirtualMC::GetMC()->IsTrackDisappeared()){
     712           0 :       hits[9] = eloss;
     713           0 :       hits[10] = step;
     714           0 :       eloss = 0.0;
     715           0 :       step = 0.0;
     716           0 :       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
     717             :     }
     718             :   } // end if in scintillator
     719             : 
     720           0 : }
     721             : 
     722             : //_____________________________________________________________________________
     723             : void AliACORDEv0::AddHit(Int_t track, Int_t *vol, Float_t *hits)
     724             : {
     725             :   //
     726             :   // Add a ACORDE hit
     727             :   //
     728           0 :   TClonesArray &lhits = *fHits;
     729           0 :   new(lhits[fNhits++]) AliACORDEhit(fIshunt,track,vol,hits);
     730           0 : }
     731             : 

Generated by: LCOV version 1.11