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 : // $Id$
16 :
17 : //-----------------------------------------------------------------------------
18 : /// \class AliMFTLadderSegmentation
19 : ///
20 : /// Description of the virtual segmentation of a ladder
21 : ///
22 : // author Raphael Tieulent <raphael.tieulent@cern.ch>
23 : //-----------------------------------------------------------------------------
24 :
25 : #include "AliLog.h"
26 : #include "AliMFTConstants.h"
27 : #include "AliMFTLadderSegmentation.h"
28 : #include "AliMFTGeometry.h"
29 :
30 : /// \cond CLASSIMP
31 14 : ClassImp(AliMFTLadderSegmentation);
32 : /// \endcond
33 :
34 : //====================================================================================================================================================
35 : /// Default constructor
36 :
37 : AliMFTLadderSegmentation::AliMFTLadderSegmentation():
38 0 : AliMFTVSegmentation(),
39 0 : fChips(NULL)
40 0 : {
41 :
42 :
43 0 : }
44 :
45 : //====================================================================================================================================================
46 : /// Constructor
47 : /// \param [in] uniqueID UInt_t: Unique ID of the Ladder to build
48 : AliMFTLadderSegmentation::AliMFTLadderSegmentation(UInt_t uniqueID):
49 0 : AliMFTVSegmentation(),
50 0 : fChips(NULL)
51 0 : {
52 0 : SetUniqueID(uniqueID);
53 :
54 0 : AliMFTGeometry * mftGeom = AliMFTGeometry::Instance();
55 :
56 0 : SetName(Form("MFT_L_%d_%d_%d",
57 0 : mftGeom->GetHalfMFTID(GetUniqueID()),
58 0 : mftGeom->GetHalfDiskID(GetUniqueID()),
59 0 : mftGeom->GetLadderID(GetUniqueID()) ));
60 :
61 : // constructor
62 :
63 0 : }
64 :
65 : //====================================================================================================================================================
66 : /// Copy Constructor
67 : AliMFTLadderSegmentation::AliMFTLadderSegmentation(const AliMFTLadderSegmentation& ladder):
68 0 : AliMFTVSegmentation(ladder),
69 0 : fNSensors(ladder.fNSensors)
70 0 : {
71 : // copy constructor
72 :
73 0 : if (ladder.fChips) fChips = new TClonesArray(*(ladder.fChips));
74 0 : else fChips = new TClonesArray("AliMFTChipSegmentation",fNSensors);
75 :
76 0 : fChips -> SetOwner(kTRUE);
77 :
78 :
79 0 : }
80 :
81 : //====================================================================================================================================================
82 :
83 : AliMFTLadderSegmentation& AliMFTLadderSegmentation::operator=(const AliMFTLadderSegmentation& ladder) {
84 :
85 : // Assignment operator
86 :
87 : // check assignement to self
88 0 : if (this != &ladder) {
89 :
90 : // base class assignement
91 0 : TNamed::operator=(ladder);
92 :
93 : // clear memory
94 0 : Clear("");
95 :
96 0 : if (ladder.fChips) fChips = new TClonesArray(*(ladder.fChips));
97 0 : else fChips = new TClonesArray("AliMFTChipSegmentation",fNSensors);
98 0 : fChips -> SetOwner(kTRUE);
99 :
100 0 : }
101 :
102 0 : return *this;
103 :
104 0 : }
105 :
106 : //====================================================================================================================================================
107 : /// Creates the Sensors Segmentation array on the Ladder
108 : void AliMFTLadderSegmentation::CreateSensors() {
109 :
110 0 : if (!fChips) {
111 0 : fChips = new TClonesArray("AliMFTChipSegmentation",fNSensors);
112 0 : fChips -> SetOwner(kTRUE);
113 0 : }
114 :
115 0 : AliMFTGeometry * mftGeom = AliMFTGeometry::Instance();
116 :
117 0 : for (Int_t iSensor=0; iSensor<fNSensors; iSensor++) {
118 0 : UInt_t sensorUniqueID = mftGeom->GetObjectID(AliMFTGeometry::kSensorType,
119 0 : mftGeom->GetHalfMFTID(GetUniqueID()),
120 0 : mftGeom->GetHalfDiskID(GetUniqueID()),
121 0 : mftGeom->GetLadderID(GetUniqueID()),
122 : iSensor);
123 :
124 0 : AliMFTChipSegmentation *chip = new AliMFTChipSegmentation(sensorUniqueID);
125 :
126 0 : new ((*fChips)[iSensor]) AliMFTChipSegmentation(*chip);
127 0 : delete chip;
128 : }
129 :
130 0 : }
131 :
132 :
133 : //====================================================================================================================================================
134 : /// Returns pointer to a sensor segmentation
135 : /// \param [in] sensorID Int_t: ID of the sensor on the ladder
136 : AliMFTChipSegmentation* AliMFTLadderSegmentation::GetSensor(Int_t sensorID) const {
137 :
138 0 : if (sensorID<0 || sensorID>=fNSensors) return NULL;
139 :
140 0 : AliMFTChipSegmentation *chip = (AliMFTChipSegmentation*) fChips->At(sensorID);
141 :
142 : return chip;
143 :
144 0 : }
145 :
146 :
147 : //==================================================================================================================
148 : /// Print out Ladder information (position, orientation, # of sensors)
149 : /// \param [in] opt "s" or "sensor" -> The individual sensor information will be printed out as well
150 : void AliMFTLadderSegmentation::Print(Option_t* opt){
151 :
152 0 : AliInfo(Form("Ladder %s (Unique ID = %d)",GetName(),GetUniqueID()));
153 0 : GetTransformation()->Print();
154 0 : AliInfo(Form("N Sensors = %d",GetNSensors()));
155 0 : if(opt && (strstr(opt,"sensor")||strstr(opt,"s"))){
156 0 : for (int i=0; i<GetNSensors(); i++) GetSensor(i)->Print("");
157 :
158 0 : }
159 :
160 0 : }
161 :
|