AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFTSegmentation.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
23 // author Raphael Tieulent <raphael.tieulent@cern.ch>
24 //-----------------------------------------------------------------------------
25 
26 #include "TXMLEngine.h"
27 #include "TClonesArray.h"
28 
29 #include "AliLog.h"
30 
33 #include "AliMFTHalfSegmentation.h"
34 #include "AliMFTSegmentation.h"
35 
39 
40 //=====================================================================================================================
42 
44  TNamed(),
45  fMFTHalves(NULL)
46 {
47 
48 
49 }
50 
51 //=====================================================================================================================
55 
56 AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile):
57  TNamed(),
58  fMFTHalves(NULL)
59 {
60  AliInfo("Creating MFT Virtual Segmentation");
61 
62  // constructor
63 
64  fMFTHalves = new TClonesArray("AliMFTHalfSegmentation", 2);
65  fMFTHalves -> SetOwner(kTRUE);
66 
67  AliMFTHalfSegmentation *halfBottom = new AliMFTHalfSegmentation(nameGeomFile, kBottom);
68  AliMFTHalfSegmentation *halfTop = new AliMFTHalfSegmentation(nameGeomFile, kTop);
69 
70  new ((*fMFTHalves)[kBottom]) AliMFTHalfSegmentation(*halfBottom);
71  new ((*fMFTHalves)[kTop]) AliMFTHalfSegmentation(*halfTop);
72 
73  delete halfBottom;
74  delete halfTop;
75 
76  AliDebug(1,"MFT segmentation set!\n");
77 
78 }
79 
80 //=====================================================================================================================
81 
83 
84  if (fMFTHalves) fMFTHalves->Delete();
85  delete fMFTHalves;
86 
87 }
88 
89 //=====================================================================================================================
91 
92 void AliMFTSegmentation::Clear(const Option_t* /*opt*/) {
93 
94  if (fMFTHalves) fMFTHalves->Delete();
95  delete fMFTHalves;
96  fMFTHalves = NULL;
97 
98 }
99 
100 //=====================================================================================================================
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  Double_t master[3] = {xHit, yHit, zHit};
119  Double_t local[3];
120  AliMFTHalfSegmentation * halfSeg = ((AliMFTHalfSegmentation*)fMFTHalves->At(half));
121  if(!halfSeg) return kFALSE;
122  AliMFTHalfDiskSegmentation * diskSeg = halfSeg->GetHalfDisk(disk);
123  if(!diskSeg) return kFALSE;
124  AliMFTLadderSegmentation * ladderSeg = diskSeg->GetLadder(ladder);
125  if(!ladderSeg) return kFALSE;
126  AliMFTChipSegmentation * chipSeg = ladderSeg->GetSensor(sensor);
127  if(!chipSeg) return kFALSE;
128 
129  AliDebug(2,Form(" -> Global %f %f %f",master[0],master[1],master[2]));
130  halfSeg->GetTransformation()->MasterToLocal(master, local);
131 // AliDebug(2,Form(" -> Half %f %f %f",local[0],local[1],local[2]));
132  for (int i=0; i<3; i++) master[i] = local[i];
133  diskSeg->GetTransformation()->MasterToLocal(master, local);
134 // AliDebug(2,Form(" -> Disk %f %f %f",local[0],local[1],local[2]));
135  for (int i=0; i<3; i++) master[i] = local[i];
136  ladderSeg->GetTransformation()->MasterToLocal(master, local);
137 // AliDebug(2,Form(" -> Ladder %f %f %f",local[0],local[1],local[2]));
138  for (int i=0; i<3; i++) master[i] = local[i];
139  chipSeg->GetTransformation()->MasterToLocal(master, local);
140  AliDebug(2,Form(" -> Chip Pos %f %f %f",local[0],local[1],local[2]));
141 
142 
143  return (chipSeg->Hit2PixelID(local[0], local[1], xPixel, yPixel));
144 
145 }
146 //=====================================================================================================================
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  if (half==1) localId += GetHalf(0)->GetHalfDisk(disk)->GetNChips();
162 
163  for (int iLad=0; iLad<GetHalf(half)->GetHalfDisk(disk)->GetNLadders(); iLad++) {
164  if (iLad<ladder) localId += GetHalf(half)->GetHalfDisk(disk)->GetLadder(iLad)->GetNSensors();
165  else{
166  for (int iSens=0; iSens<GetHalf(half)->GetHalfDisk(disk)->GetLadder(iLad)->GetNSensors(); iSens++) {
167  if(iSens==sensor) return localId;
168  localId++;
169  }
170  }
171  }
172  return -1;
173 }
Class for the description of the structure a Half-Disk.
TGeoCombiTrans * GetTransformation() const
Returns the Transformation Combining a Rotation followed by a Translation.
AliMFTHalfDiskSegmentation * GetHalfDisk(Int_t iDisk) const
Chip Segmentation description.
AliMFTHalfSegmentation * GetHalf(Int_t iHalf) const
Returns pointer to the segmentation of the half-MFT.
virtual void Clear(const Option_t *)
Clear the TClonesArray holding the AliMFTHalfSegmentation objects.
AliMFTLadderSegmentation * GetLadder(Int_t iLadder)
Returns pointer to the ladder segmentation object.
Int_t GetDetElemLocalID(Int_t half, Int_t disk, Int_t ladder, Int_t sensor) const
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t GetNLadders() const
Get the number of Ladder on the Half-Disk.
Int_t GetNSensors() const
Returns number of Sensor on the ladder.
Bool_t 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)
AliMFTChipSegmentation * GetSensor(Int_t sensor) const
TClonesArray * fMFTHalves
Array of pointer to AliMFTHalfSegmentation.
Segmentation class for each half of the ALICE Muon Forward Tracker.
AliMFTSegmentation()
Default constructor.
Description of the virtual segmentation of a ladder.
Class for the virtual segmentation of the ALICE Muon Forward Tracker.
Bool_t Hit2PixelID(Double_t xHit, Double_t yHit, Int_t &xPixel, Int_t &yPixel)
Transform (x,y) Hit coordinate into Pixel ID on the matrix.
return kTRUE
Definition: AliFMDv1.cxx:97
Int_t GetNChips()
Returns the number of sensors on the Half-Disk.