LCOV - code coverage report
Current view: top level - ITSMFT/MFT/MFTbase - AliMFTLadder.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 82 3.7 %
Date: 2016-06-14 17:26:59 Functions: 3 12 25.0 %

          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             : /// \class AliMFTLadder
      20             : ///
      21             : /// Ladder Builder
      22             : ///
      23             : // author Raphael Tieulent <raphael.tieulent@cern.ch>
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include "TGeoMatrix.h"
      27             : #include "TGeoManager.h"
      28             : #include "TGeoBBox.h"
      29             : #include "TGeoTube.h"
      30             : 
      31             : #include "AliLog.h"
      32             : 
      33             : #include "AliMFTLadderSegmentation.h"
      34             : #include "AliMFTChipSegmentation.h"
      35             : #include "AliMFTFlex.h"
      36             : #include "AliMFTChip.h"
      37             : #include "AliMFTLadder.h"
      38             : #include "AliMFTConstants.h"
      39             : #include "AliMFTGeometry.h"
      40             : #include "TGeoCompositeShape.h"
      41             : #include "TGeoBoolNode.h"
      42             : 
      43             : /// \cond CLASSIMP
      44          14 : ClassImp(AliMFTLadder);
      45             : /// \endcond
      46             : 
      47             : // Units are cm
      48          14 : const Double_t AliMFTLadder::kLadderDeltaY = AliMFTGeometry::kSensorHeight + 2.*AliMFTGeometry::kSensorTopOffset;
      49          14 : const Double_t AliMFTLadder::kLadderDeltaZ = AliMFTGeometry::kFlexThickness + AliMFTGeometry::kSensorThickness; // TODO: Adjust that value when adding glue layer
      50             : 
      51             : //=============================================================================================
      52             : /// \brief Default constructor
      53             : 
      54             : AliMFTLadder::AliMFTLadder():
      55           0 : TNamed(), fMFTFlex(NULL){
      56             :   
      57             :   
      58           0 : }
      59             : //=============================================================================================
      60             : /// \brief Constructor
      61           0 : AliMFTLadder::AliMFTLadder(AliMFTLadderSegmentation *segmentation):TNamed(segmentation->GetName(),segmentation->GetName()),fSegmentation(segmentation), fMFTFlex(NULL)
      62           0 : {
      63           0 :   AliDebug(1, Form("Creating : %s", GetName()));
      64           0 :   fLadderVolume = new TGeoVolumeAssembly(GetName());
      65             :   
      66             : 
      67           0 : }
      68             : 
      69             : 
      70             : //=============================================================================================
      71             : 
      72           0 : AliMFTLadder::~AliMFTLadder() {
      73           0 :   delete fMFTFlex;
      74             :   
      75           0 : }
      76             : 
      77             : //=============================================================================================
      78             : /// \brief Build the ladder
      79             : TGeoVolume * AliMFTLadder::CreateVolume() {
      80             : 
      81           0 :   Int_t nChips = fSegmentation->GetNSensors();
      82             : 
      83             :   // Create the flex
      84           0 :   fMFTFlex = new AliMFTFlex(fSegmentation);         
      85           0 :   Double_t kFlexLength = nChips*(AliMFTGeometry::kSensorLength+AliMFTGeometry::kSensorInterspace)+AliMFTGeometry::kLadderOffsetToEnd + AliMFTGeometry::kSensorSideOffset;
      86           0 :   Double_t kShiftY = 2*AliMFTGeometry::kSensorTopOffset+AliMFTGeometry::kSensorHeight-AliMFTGeometry::kFlexHeight/2; // strange
      87           0 :   TGeoVolumeAssembly * flexVol = fMFTFlex->MakeFlex(fSegmentation->GetNSensors(), kFlexLength);                               
      88           0 :   fLadderVolume->AddNode(flexVol, 1, new TGeoTranslation(kFlexLength/2+AliMFTGeometry::kSensorSideOffset/2, kShiftY, AliMFTGeometry::kFlexThickness/2));     
      89             : 
      90             :   // Create the CMOS Sensors
      91           0 :   CreateSensors();
      92             : 
      93           0 :   return fLadderVolume;
      94             :   
      95           0 : }
      96             : 
      97             : 
      98             : 
      99             : //=============================================================================================
     100             : /// \brief Build the sensors
     101             : void AliMFTLadder::CreateSensors() {
     102             :   // Create Shapes
     103             :   
     104             :   // The sensor part
     105           0 :   TGeoBBox *sensor = new TGeoBBox(AliMFTGeometry::kSensorLength/2., AliMFTGeometry::kSensorActiveHeight/2., AliMFTGeometry::kSensorThickness/2.);
     106             :   
     107             :   // The readout part
     108           0 :   TGeoBBox *readout = new TGeoBBox(AliMFTGeometry::kSensorLength/2.,(AliMFTGeometry::kSensorHeight-AliMFTGeometry::kSensorActiveHeight)/2.,  AliMFTGeometry::kSensorThickness/2.);
     109             :   
     110             :   // Get Mediums
     111           0 :   TGeoMedium *medSensorSi  = gGeoManager->GetMedium("MFT_Si$");
     112           0 :   TGeoMedium *medReadoutSi = gGeoManager->GetMedium("MFT_Readout$");
     113           0 :   TGeoMedium *medAir  = gGeoManager->GetMedium("MFT_Air$");
     114           0 :   TGeoMedium *kMedGlue = gGeoManager->GetMedium("MFT_Epoxy$");  // we assume epoxy glue, the silicone glue has to be defined
     115             : 
     116             :   
     117           0 :   AliMFTGeometry * mftGeom = AliMFTGeometry::Instance();
     118             :   
     119           0 :   TString namePrefix = Form("MFT_S_%d_%d_%d",
     120           0 :                                     mftGeom->GetHalfMFTID(fSegmentation->GetUniqueID()),
     121           0 :                                     mftGeom->GetHalfDiskID(fSegmentation->GetUniqueID()),
     122           0 :                                     mftGeom->GetLadderID(fSegmentation->GetUniqueID()) );
     123             :   
     124           0 :   TGeoVolume * chipVol = gGeoManager->MakeBox(namePrefix.Data(), medAir,AliMFTGeometry::kSensorLength/2.,AliMFTGeometry::kSensorHeight/2.,  AliMFTGeometry::kSensorThickness/2. );
     125           0 :   TGeoVolume * glue = gGeoManager->MakeBox(namePrefix.Data(), kMedGlue, (AliMFTGeometry::kSensorLength-AliMFTGeometry::kGlueEdge)/2., 
     126           0 :                                            (AliMFTGeometry::kSensorHeight-AliMFTGeometry::kGlueEdge)/2., AliMFTGeometry::kGlueThickness/2.);
     127           0 :   glue->SetVisibility(kTRUE);
     128           0 :   glue->SetLineColor(kRed-10);
     129           0 :   glue->SetLineWidth(1);
     130           0 :   glue->SetFillColor(glue->GetLineColor());
     131           0 :   glue->SetFillStyle(4000); // 0% transparent
     132             : 
     133             :   // Create Volumes
     134             :   // Chip Volume
     135           0 :   chipVol->SetVisibility(kTRUE);
     136             : 
     137             :   // The sensor Volume
     138           0 :   TGeoVolume *sensorVol = new TGeoVolume("MFTSensor", sensor, medSensorSi);
     139           0 :   sensorVol->SetVisibility(kTRUE);
     140           0 :   sensorVol->SetLineColor(kGreen+1);
     141           0 :   sensorVol->SetLineWidth(1);
     142           0 :   sensorVol->SetFillColor(sensorVol->GetLineColor());
     143           0 :   sensorVol->SetFillStyle(4000); // 0% transparent
     144           0 :   if(!mftGeom->GetSensorVolumeID()){
     145           0 :     mftGeom->SetSensorVolumeID(sensorVol->GetNumber());
     146           0 :   } else if (mftGeom->GetSensorVolumeID() != sensorVol->GetNumber()){
     147           0 :     AliFatal(Form("Different Sensor VOLUME ID in TGeo !!!!"));
     148             :   }
     149             :   
     150             :   // The Readout Volume
     151           0 :   TGeoVolume *readoutVol = new TGeoVolume("Readout", readout, medReadoutSi);
     152           0 :   readoutVol->SetVisibility(kTRUE);
     153           0 :   readoutVol->SetLineColor(kRed-6);
     154           0 :   readoutVol->SetLineWidth(1);
     155           0 :   readoutVol->SetFillColor(readoutVol->GetLineColor());
     156           0 :   readoutVol->SetFillStyle(4000); // 0% transparent
     157             : 
     158             :   // Building up the chip
     159           0 :   chipVol->AddNode(readoutVol, 1, new TGeoTranslation(0.,-AliMFTGeometry::kSensorHeight/2.+readout->GetDY(),  0.));
     160           0 :   chipVol->AddNode(sensorVol, 1, new TGeoTranslation( 0., AliMFTGeometry::kSensorHeight/2.-sensor->GetDY(),0.));
     161             : 
     162           0 :   for (int ichip =0; ichip<fSegmentation->GetNSensors(); ichip++) {
     163           0 :     AliMFTChipSegmentation * chipSeg = fSegmentation->GetSensor(ichip);
     164           0 :     TGeoCombiTrans * chipPos = chipSeg->GetTransformation();
     165           0 :     TGeoCombiTrans * chipPosGlue = chipSeg->GetTransformation();
     166             :     // Position of the center on the chip in the chip coordinate system
     167           0 :     Double_t pos[3] ={AliMFTGeometry::kSensorLength/2., AliMFTGeometry::kSensorHeight/2., AliMFTGeometry::kSensorThickness/2. - AliMFTGeometry::kGlueThickness};
     168           0 :     Double_t posglue[3] ={AliMFTGeometry::kSensorLength/2., AliMFTGeometry::kSensorHeight/2., AliMFTGeometry::kGlueThickness/2-AliMFTGeometry::kSensorThickness};
     169           0 :     Double_t master[3];
     170           0 :     Double_t masterglue[3];
     171           0 :     chipPos->LocalToMaster(pos, master);
     172           0 :     chipPosGlue->LocalToMaster(posglue, masterglue);
     173             :     
     174           0 :     TGeoBBox* shape = (TGeoBBox*)fLadderVolume->GetShape();
     175           0 :     master[0] -= shape->GetDX();
     176           0 :     master[1] -= shape->GetDY();
     177           0 :     master[2] -= shape->GetDZ();
     178             : 
     179           0 :     masterglue[0] -= shape->GetDX();
     180           0 :     masterglue[1] -= shape->GetDY();
     181           0 :     masterglue[2] -= shape->GetDZ();
     182             : 
     183           0 :     AliDebug(1,Form("Adding Chip %s_%d ",namePrefix.Data(),ichip));
     184           0 :     fLadderVolume->AddNode(chipVol, ichip, new TGeoTranslation(master[0],master[1],master[2]));
     185           0 :     fLadderVolume->AddNode(glue, ichip, new TGeoTranslation(masterglue[0],masterglue[1],masterglue[2]));
     186             : 
     187           0 :   }
     188             : 
     189           0 : }

Generated by: LCOV version 1.11