LCOV - code coverage report
Current view: top level - ITSMFT/MFT/MFTbase - AliMFTSegmentation.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 56 1.8 %
Date: 2016-06-14 17:26:59 Functions: 1 11 9.1 %

          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 AliMFTSegmentation
      20             : ///
      21             : /// Class for the virtual segmentation of the ALICE Muon Forward Tracker
      22             : ///
      23             : // author Raphael Tieulent <raphael.tieulent@cern.ch>
      24             : //-----------------------------------------------------------------------------
      25             : 
      26             : #include "TXMLEngine.h"
      27             : #include "TClonesArray.h"
      28             : 
      29             : #include "AliLog.h"
      30             : 
      31             : #include "AliMFTLadderSegmentation.h"
      32             : #include "AliMFTHalfDiskSegmentation.h"
      33             : #include "AliMFTHalfSegmentation.h"
      34             : #include "AliMFTSegmentation.h"
      35             : 
      36             : /// \cond CLASSIMP
      37          14 : ClassImp(AliMFTSegmentation);
      38             : /// \endcond
      39             : 
      40             : //=====================================================================================================================
      41             : /// Default constructor
      42             : 
      43             : AliMFTSegmentation::AliMFTSegmentation():
      44           0 :   TNamed(),
      45           0 :   fMFTHalves(NULL)
      46           0 : { 
      47             : 
      48             : 
      49           0 : }
      50             : 
      51             : //=====================================================================================================================
      52             : /// \brief Constructor
      53             : /// \param nameGeomFile Char_t * : name of the XML geometry file.
      54             : /// By default it is : $ALICE_ROOT/ITSMFT/MFT/data/AliMFTGeometry.xml
      55             : 
      56             : AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile): 
      57           0 :   TNamed(),
      58           0 :   fMFTHalves(NULL)
      59           0 : { 
      60           0 :   AliInfo("Creating MFT Virtual Segmentation");
      61             : 
      62             :   // constructor
      63             :   
      64           0 :   fMFTHalves = new TClonesArray("AliMFTHalfSegmentation", 2);
      65           0 :   fMFTHalves -> SetOwner(kTRUE);
      66             : 
      67           0 :   AliMFTHalfSegmentation *halfBottom = new AliMFTHalfSegmentation(nameGeomFile, kBottom);
      68           0 :   AliMFTHalfSegmentation *halfTop    = new AliMFTHalfSegmentation(nameGeomFile, kTop);
      69             : 
      70           0 :   new ((*fMFTHalves)[kBottom]) AliMFTHalfSegmentation(*halfBottom);
      71           0 :   new ((*fMFTHalves)[kTop])    AliMFTHalfSegmentation(*halfTop);
      72             : 
      73           0 :   delete halfBottom;
      74           0 :   delete halfTop;
      75             : 
      76           0 :   AliDebug(1,"MFT segmentation set!\n");
      77             : 
      78           0 : }
      79             : 
      80             : //=====================================================================================================================
      81             : 
      82           0 : AliMFTSegmentation::~AliMFTSegmentation() {
      83             : 
      84           0 :   if (fMFTHalves) fMFTHalves->Delete();
      85           0 :   delete fMFTHalves; 
      86             :   
      87           0 : }
      88             : 
      89             : //=====================================================================================================================
      90             : ///Clear the TClonesArray holding the AliMFTHalfSegmentation objects
      91             : 
      92             : void AliMFTSegmentation::Clear(const Option_t* /*opt*/) {
      93             : 
      94           0 :   if (fMFTHalves) fMFTHalves->Delete();
      95           0 :   delete fMFTHalves; 
      96           0 :   fMFTHalves = NULL;
      97             :   
      98           0 : }
      99             : 
     100             : //=====================================================================================================================
     101             : /// Returns the pixel ID corresponding to a hit at (x,y,z) in the ALICE global frame
     102             : ///
     103             : /// \param [in] xHit Double_t : x Position of the Hit
     104             : /// \param [in] yHit Double_t : y Position of the Hit
     105             : /// \param [in] zHit Double_t : z Position of the Hit
     106             : /// \param [in] sensor Int_t : Sensor ID in which the hit occured
     107             : /// \param [in] ladder Int_t : Ladder ID holding the sensor
     108             : /// \param [in] disk Int_t : Half-Disk ID holding the ladder
     109             : /// \param [in] half Int_t : Half-MFT  ID holding the half-disk
     110             : ///
     111             : /// \param [out] xPixel Int_t : x position of the pixel hit on the sensor matrix
     112             : /// \param [out] yPixel Int_t : y position of the pixel hit on the sensor matrix
     113             : /// \retval <kTRUE> if hit into the active part of the sensor
     114             : /// \retval <kFALSE> if hit outside the active part
     115             : //
     116             : Bool_t AliMFTSegmentation::Hit2PixelID(Double_t xHit, Double_t yHit, Double_t zHit, Int_t half, Int_t disk, Int_t ladder, Int_t sensor, Int_t &xPixel, Int_t &yPixel){
     117             : 
     118           0 :   Double_t master[3] = {xHit, yHit, zHit};
     119           0 :   Double_t local[3];
     120           0 :   AliMFTHalfSegmentation * halfSeg = ((AliMFTHalfSegmentation*)fMFTHalves->At(half));
     121           0 :   if(!halfSeg) return kFALSE;
     122           0 :   AliMFTHalfDiskSegmentation * diskSeg = halfSeg->GetHalfDisk(disk);
     123           0 :   if(!diskSeg) return kFALSE;
     124           0 :   AliMFTLadderSegmentation * ladderSeg = diskSeg->GetLadder(ladder);
     125           0 :   if(!ladderSeg) return kFALSE;
     126           0 :   AliMFTChipSegmentation * chipSeg = ladderSeg->GetSensor(sensor);
     127           0 :   if(!chipSeg) return kFALSE;
     128             : 
     129           0 :   AliDebug(2,Form(" ->  Global %f %f %f",master[0],master[1],master[2]));
     130           0 :   halfSeg->GetTransformation()->MasterToLocal(master, local);
     131             : //  AliDebug(2,Form(" ->  Half %f %f %f",local[0],local[1],local[2]));
     132           0 :   for (int i=0; i<3; i++) master[i] = local[i];
     133           0 :   diskSeg->GetTransformation()->MasterToLocal(master, local);
     134             : //  AliDebug(2,Form(" ->  Disk %f %f %f",local[0],local[1],local[2]));
     135           0 :   for (int i=0; i<3; i++) master[i] = local[i];
     136           0 :   ladderSeg->GetTransformation()->MasterToLocal(master, local);
     137             : //  AliDebug(2,Form(" ->  Ladder %f %f %f",local[0],local[1],local[2]));
     138           0 :   for (int i=0; i<3; i++) master[i] = local[i];
     139           0 :   chipSeg->GetTransformation()->MasterToLocal(master, local);
     140           0 :   AliDebug(2,Form(" ->  Chip Pos %f %f %f",local[0],local[1],local[2]));
     141             :   
     142             :   
     143           0 :    return (chipSeg->Hit2PixelID(local[0], local[1], xPixel, yPixel));
     144             : 
     145           0 : }
     146             : //=====================================================================================================================
     147             : /// Returns the local ID of the sensor on the entire disk specified
     148             : ///
     149             : /// \param sensor Int_t : Sensor ID
     150             : /// \param ladder Int_t : Ladder ID holding the Sensor
     151             : /// \param disk Int_t : Half-Disk ID holding the Sensor
     152             : /// \param half Int_t : Half-MFT  ID holding the Sensor
     153             : ///
     154             : /// \return A fixed number that represents the ID of the sensor on the disk. It goes from 0 to the max number of sensor on the disk
     155             : 
     156             : Int_t AliMFTSegmentation::GetDetElemLocalID(Int_t half, Int_t disk, Int_t ladder, Int_t sensor) const {
     157             : 
     158             :   Int_t localId =0;
     159             :   
     160             :   
     161           0 :   if (half==1) localId += GetHalf(0)->GetHalfDisk(disk)->GetNChips();
     162             :   
     163           0 :   for (int iLad=0; iLad<GetHalf(half)->GetHalfDisk(disk)->GetNLadders(); iLad++) {
     164           0 :     if (iLad<ladder) localId += GetHalf(half)->GetHalfDisk(disk)->GetLadder(iLad)->GetNSensors();
     165             :     else{
     166           0 :       for (int iSens=0; iSens<GetHalf(half)->GetHalfDisk(disk)->GetLadder(iLad)->GetNSensors(); iSens++) {
     167           0 :         if(iSens==sensor) return localId;
     168           0 :         localId++;
     169             :      }
     170             :     }
     171             :   }
     172           0 :   return -1;
     173           0 : }

Generated by: LCOV version 1.11