@@ -54,9 +54,9 @@ GeometryTGeo::GeometryTGeo(bool build, int loadTrans) : DetMatrixCache(detectors
5454void GeometryTGeo::Build (int loadTrans)
5555{
5656 // /// current geometry organization:
57- // /// total elements = 44 = 8 layers ML+OT + 4 petal cases * (3 layers + 6 disks)
57+ // /// total elements = 258 = x staves * 8 layers ML+OT + 4 petal cases * (3 layers + 6 disks)
5858 // /// indexing from 0 to 35: VD petals -> layers -> disks
59- // /// indexing from 36 to 43 : MLOT layers
59+ // /// indexing from 36 to 257 : MLOT staves
6060
6161 if (isBuilt ()) {
6262 LOGP (warning, " Already built" );
@@ -99,13 +99,14 @@ void GeometryTGeo::Build(int loadTrans)
9999
100100 // / filling the information for the MLOT
101101 for (int i = 0 ; i < mNumberOfLayersMLOT ; i++) {
102- mNumberOfChipsPerLayerMLOT [i] = 1 ; // / for the moment, considering 1 layer = 1 chip. TODO: do first 1 stave = 1 chip and then add the final segmentation
102+ mNumberOfChipsPerLayerMLOT [i] = extractNumberOfStavesMLOT (i) ; // for the moment, considering 1 stave = 1 chip. TODO: add the final segmentation in chips
103103 numberOfChipsTotal += mNumberOfChipsPerLayerMLOT [i];
104104 mLastChipIndex [i + mNumberOfPetalsVD ] = numberOfChipsTotal - 1 ;
105105 mLastChipIndexMLOT [i] = numberOfChipsTotal - 1 ;
106106 }
107107
108- setSize (mNumberOfLayersMLOT + mNumberOfActivePartsVD ); // / temporary, number of chips = number of layers and active parts
108+ // setSize(mNumberOfLayersMLOT + mNumberOfActivePartsVD); /// temporary, number of chips = number of layers and active parts
109+ setSize (numberOfChipsTotal); // / temporary, number of chips = number of staves and active parts
109110 fillMatrixCache (loadTrans);
110111}
111112
@@ -143,14 +144,35 @@ int GeometryTGeo::getLayer(int index) const
143144{
144145 int subDetID = getSubDetID (index);
145146 int petalcase = getPetalCase (index);
147+ int lay = 0 ;
146148
147149 if (subDetID == 0 ) { // / VD
148150 if (index % mNumberOfChipsPerPetalVD [petalcase] >= mNumberOfLayersVD ) {
149151 return -1 ; // / disks
150152 }
151- return index % mNumberOfChipsPerPetalVD [petalcase];
153+ lay = index % mNumberOfChipsPerPetalVD [petalcase];
154+ // return index % mNumberOfChipsPerPetalVD[petalcase];
152155 } else if (subDetID == 1 ) { // / MLOT
153- return index % (mNumberOfLayersVD + mNumberOfLayersMLOT );
156+ while (index > mLastChipIndex [lay]) {
157+ lay++;
158+ }
159+ return lay - mNumberOfPetalsVD ; // / numeration of MLOT layesrs starting from 1
160+ }
161+ return -1 ; // / -1 if not found
162+ }
163+ // __________________________________________________________________________
164+ int GeometryTGeo::getStave (int index) const
165+ {
166+ int subDetID = getSubDetID (index);
167+ int lay = getLayer (index);
168+ int petalcase = getPetalCase (index);
169+
170+ if (subDetID == 0 ) { // / VD
171+ return -1 ;
172+ } else if (subDetID == 1 ) { // / MLOT
173+ int lay = getLayer (index);
174+ index -= getFirstChipIndex (lay, petalcase, subDetID);
175+ return index; // / ||||
154176 }
155177 return -1 ; // / not found
156178}
@@ -176,21 +198,20 @@ TString GeometryTGeo::getMatrixPath(int index) const
176198{
177199
178200 // int lay, hba, stav, sstav, mod, chipInMod;
179- int petalcase, disk, lay, subDetID ; // / TODO: add staves in a second step
201+ int subDetID, petalcase, disk, lay, stave ; // / TODO: add chips in a second step
180202 subDetID = getSubDetID (index);
181203 petalcase = getPetalCase (index);
182204 lay = getLayer (index);
183205 disk = getDisk (index);
206+ stave = getStave (index);
184207
185- std::cout << " \n index = " << index << std::endl;
208+ // std::cout << "\nindex = " << index << std::endl;
186209 // std::cout << "subDetID = " << subDetID << std::endl;
187210 // std::cout << "petalcase = " << petalcase << std::endl;
188211 // std::cout << "layer = " << lay << std::endl;
189212 // std::cout << "disk = " << disk << std::endl;
190-
191- // lay = getLayer(index); /// questo non va bene credo perchè è troppo generale, farlo che deve andare dopo il dìsubDetID
192-
193- // int wrID = mLayerToWrapper[lay];
213+ // std::cout << "first chip index = " << getFirstChipIndex(lay, petalcase, subDetID) << std::endl;
214+ // std::cout << "stave = " << stave << std::endl;
194215
195216 // TString path = Form("/cave_1/barrel_1/%s_2/", GeometryTGeo::getTRKVolPattern());
196217 TString path = " /cave_1/barrel_1/TRKV_2/TRKLayer0_1/TRKStave0_1/TRKChip0_1/TRKSensor0_1/" ; // / dummy path, to be replaced
@@ -301,7 +322,7 @@ void GeometryTGeo::fillMatrixCache(int mask)
301322 auto & cacheL2G = getCacheL2G ();
302323 cacheL2G.setSize (mSize );
303324
304- for (int i = 0 ; i < mSize ; i++) { // / here get the matrices for det ID between 0 and 43 (mSize = 44 at the moment)
325+ for (int i = 0 ; i < mSize ; i++) { // / here get the matrices for det ID between 0 and 257 (mSize = 258 at the moment)
305326 TGeoHMatrix* hm = extractMatrixSensor (i);
306327 cacheL2G.setMatrix (Mat3D (*hm), i);
307328 }
@@ -424,7 +445,7 @@ int GeometryTGeo::extractNumberOfActivePartsVD() const
424445// __________________________________________________________________________
425446int GeometryTGeo::extractNumberOfDisksVD () const
426447{
427- // The number of active parts returned here is 6
448+ // The number of disks returned here is 6
428449 int numberOfDisks = 0 ;
429450
430451 TGeoVolume* vdV = gGeoManager ->GetVolume (getTRKVolPattern ());
@@ -555,8 +576,8 @@ int GeometryTGeo::extractNumberOfStavesMLOT(int lay) const
555576
556577 // Loop on all layV nodes, count Layer volumes by checking names
557578 TObjArray* nodes = layV->GetNodes ();
558- std::cout << " Printing nodes for layer " << lay << std::endl;
559- nodes->Print ();
579+ // std::cout << "Printing nodes for layer " << lay << std::endl;
580+ // nodes->Print();
560581 int nNodes = nodes->GetEntriesFast ();
561582
562583 for (int j = 0 ; j < nNodes; j++) {
0 commit comments