AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFTHalfDiskSegmentation.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 #include "TClonesArray.h"
26 
27 #include "AliLog.h"
28 #include "AliMFTConstants.h"
30 #include "AliMFTGeometry.h"
31 
35 
36 
37 //====================================================================================================================================================
41  fNLadders(0),
42  fLadders(NULL)
43 {
44 
45 
46 }
47 
48 //====================================================================================================================================================
53  fNLadders(0),
54  fLadders(NULL)
55 {
56 
57  // constructor
58  SetUniqueID(uniqueID);
59 
60  AliDebug(1,Form("Start Creating Half-Disk UniqueID = %d",GetUniqueID()));
61 
63 
64  SetName(Form("MFT_D_%d_%d",mftGeom->GetHalfMFTID(GetUniqueID()), mftGeom->GetHalfDiskID(GetUniqueID()) ));
65 
66  fLadders = new TClonesArray("AliMFTLadderSegmentation");
67  fLadders -> SetOwner(kTRUE);
68 
69 
70 
71 }
72 
73 //====================================================================================================================================================
76  AliMFTVSegmentation(input),
77  fNLadders(input.fNLadders)
78 {
79 
80  // copy constructor
81  if(input.fLadders) fLadders = new TClonesArray(*(input.fLadders));
82  else fLadders = new TClonesArray("AliMFTLadderSegmentation");
83  fLadders -> SetOwner(kTRUE);
84 
85 }
86 
87 //====================================================================================================================================================
88 
90 
91  Clear("");
92 
93 }
94 
95 //====================================================================================================================================================
97 
98 void AliMFTHalfDiskSegmentation::Clear(const Option_t* /*opt*/) {
99 
100  if (fLadders) fLadders->Delete();
101  delete fLadders;
102  fLadders = NULL;
103 
104 }
105 
106 
107 //====================================================================================================================================================
109 void AliMFTHalfDiskSegmentation::CreateLadders(TXMLEngine* xml, XMLNodePointer_t node)
110 {
111  Int_t iladder;
112  Int_t nsensor;
113  Double_t pos[3];
114  Double_t ang[3]={0.,0.,0.};
115 
116  TString nodeName = xml->GetNodeName(node);
117  if (!nodeName.CompareTo("ladder")) {
118  XMLAttrPointer_t attr = xml->GetFirstAttr(node);
119  while (attr!=0) {
120  TString attrName = xml->GetAttrName(attr);
121  TString attrVal = xml->GetAttrValue(attr);
122  if(!attrName.CompareTo("iladder")){
123  iladder = attrVal.Atoi();
124  if (iladder>=GetNLadders() || iladder<0) {
125  AliFatal(Form(" Wrong Ladder number : %d ",iladder));
126  }
127 
128  } else
129  if(!attrName.CompareTo("nsensor")){
130  nsensor = attrVal.Atoi();
131  } else
132  if(!attrName.CompareTo("xpos")){
133  pos[0] = attrVal.Atof();
134  } else
135  if(!attrName.CompareTo("ypos")){
136  pos[1] = attrVal.Atof();
137  } else
138  if(!attrName.CompareTo("zpos")){
139  pos[2] = attrVal.Atof();
140  } else
141  if(!attrName.CompareTo("phi")){
142  ang[0] = attrVal.Atof();
143  } else
144  if(!attrName.CompareTo("theta")){
145  ang[1] = attrVal.Atof();
146  } else
147  if(!attrName.CompareTo("psi")){
148  ang[2] = attrVal.Atof();
149  } else{
150  AliError(Form(" Unknwon Attribute name %s ",xml->GetAttrName(attr)));
151  }
152 
153  attr = xml->GetNextAttr(attr);
154  }
155 
156  Int_t plane = -1;
157  Int_t ladderID=iladder;
158  if( iladder < GetNLadders()/2) {
159  plane = 0;
160  } else {
161  plane = 1;
162  // ladderID -= GetNLadders()/2;
163  }
164 
165 // if ((plane==0 && pos[2]<0.) || (plane==1 && pos[2]>0.))
166 // AliFatal(Form(" Wrong Z Position or ladder number ??? : z= %f ladder id = %d",pos[2],ladderID));
167 
169 
170  UInt_t ladderUniqueID = mftGeom->GetObjectID(AliMFTGeometry::kLadderType,
171  mftGeom->GetHalfMFTID(GetUniqueID()),
172  mftGeom->GetHalfDiskID(GetUniqueID()),
173  ladderID);
174 
175 // UInt_t ladderUniqueID = (AliMFTGeometry::kLadderType<<13) + (((GetUniqueID()>>9) & 0xF)<<9) + (plane<<8) + (ladderID<<3);
176 
177 
178  AliMFTLadderSegmentation * ladder = new AliMFTLadderSegmentation(ladderUniqueID);
179  ladder->SetNSensors(nsensor);
180  ladder->SetPosition(pos);
181  ladder->SetRotationAngles(ang);
182 
185  // Find the position of the corner of the flex which is the ladder corrdinate system center.
186 
190  Double_t master[3];
191  ladder->GetTransformation()->LocalToMaster(pos, master);
192  ladder->SetPosition(master);
193  AliDebug(2,Form("Creating Ladder %2d with %d Sensors at the position (%.2f,%.2f,%.2f) with angles (%.2f,%.2f,%.2f) and ID = %d",iladder,nsensor,master[0],master[1],master[2],ang[0],ang[1],ang[2], ladderUniqueID ) );
194 
195 
196  ladder->CreateSensors();
197 
198  new ((*fLadders)[iladder]) AliMFTLadderSegmentation(*ladder);
199  delete ladder;
200 
201  //GetLadder(iladder)->Print();
202 
203 
204  }
205 
206  // display all child nodes
207  XMLNodePointer_t child = xml->GetChild(node);
208  while (child!=0) {
209  CreateLadders(xml, child);
210  child = xml->GetNext(child);
211  }
212 }
213 
214 
215 
216 //==================================================================================================================
219 
220  Int_t nChips = 0;
221 
222  for (Int_t iLadder=0; iLadder<fLadders->GetEntries(); iLadder++) {
223 
225  nChips += ladder -> GetNSensors();
226 
227  }
228 
229  return nChips;
230 
231 }
232 
233 //==================================================================================================================
236 
238 
239  AliInfo(Form("Half-Disk %s (Unique ID = %d)",GetName(),GetUniqueID()));
240  GetTransformation()->Print();
241  AliInfo(Form("N Ladders = %d",fNLadders));
242  if(opt && (strstr(opt,"ladder")||strstr(opt,"l"))){
243  for (int i=0; i<GetNLadders(); i++) GetLadder(i)->Print(opt);
244 
245  }
246 }
Class for the description of the structure a Half-Disk.
Int_t fNLadders
Number of ladder holded by the half-disk.
virtual void Clear(const Option_t *)
Clear the TClonesArray holding the ladder segmentations.
virtual void Print(Option_t *opt="")
TGeoCombiTrans * GetTransformation() const
Returns the Transformation Combining a Rotation followed by a Translation.
static const Double_t kFlexThickness
Flex Thickness.
UInt_t GetObjectID(ObjectTypes type, Int_t half=0, Int_t disk=0, Int_t ladder=0, Int_t chip=0) const
Returns the object Unique ID.
Abstract base class for MFT Segmentation description.
static const Double_t kSensorThickness
CMOS Sensor Thickness.
AliMFTLadderSegmentation * GetLadder(Int_t iLadder)
Returns pointer to the ladder segmentation object.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
static const Double_t kSensorSideOffset
Offset of sensor compare to ladder edge (close to the beam pipe)
Int_t GetNLadders() const
Get the number of Ladder on the Half-Disk.
void CreateSensors()
Creates the Sensors Segmentation array on the Ladder.
void SetNSensors(Int_t val)
Set number of Sensor on the ladder.
static AliMFTGeometry * Instance()
Retuns MFT Geometry singleton object.
virtual void Print(Option_t *opt="")
Description of the virtual segmentation of a ladder.
void CreateLadders(TXMLEngine *xml, XMLNodePointer_t node)
Creates the Ladders on this half-Disk based on the information contained in the XML file...
void SetRotationAngles(const Double_t *ang)
Set The rotation angles. Unit is [deg].
Int_t GetHalfMFTID(UInt_t uniqueID) const
Returns Half-MFT ID based on Unique ID provided.
Int_t GetHalfDiskID(UInt_t uniqueID) const
Returns Half-Disk ID based on Unique ID provided.
void SetPosition(const Double_t *pos)
Set Position of the Element. Unit is [cm].
static const Double_t kSensorTopOffset
Offset of sensor compare to ladder top edge.
TClonesArray * fLadders
Array of pointer to AliMFTLadderSegmentation.
static const Double_t kSensorHeight
CMOS Sensor Height.
Class Handling both Virutal Segmentation and Real Volumes.
AliMFTHalfDiskSegmentation()
Default constructor.
Int_t GetNChips()
Returns the number of sensors on the Half-Disk.