1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////
19 // ITS geometry manipulation routines. //
20 // Created April 15 1999. //
22 // By: Bjorn S. Nilsen //
24 // Updated May 27 1999. //
25 // Added Cylindrical random and global based changes. //
26 // Added function PrintComparison. //
27 // Modified and added functions Feb. 7 2006 //
28 ///////////////////////////////////////////////////////////////////////
31 ////////////////////////////////////////////////////////////////////////
32 // The local coordinate system by, default, is show in the following
33 // figures. Also shown are the ladder numbering scheme.
36 <img src="picts/ITS/AliITSgeomMatrix_L1.gif">
39 <font size=+2 color=blue>
40 <p>This shows the relative geometry differences between the ALICE Global
41 coordinate system and the local detector coordinate system.
46 <img src="picts/ITS/its1+2_convention_front_5.gif">
49 <font size=+2 color=blue>
50 <p>This shows the front view of the SPDs and the orientation of the local
51 pixel coordinate system. Note that the inner pixel layer has its y coordinate
52 in the opposite direction from all of the other layers.
57 <img src="picts/ITS/its3+4_convention_front_5.gif">
60 <font size=+2 color=blue>
61 <p>This shows the front view of the SDDs and the orientation of the local
62 pixel coordinate system.
67 <img src="picts/ITS/its5+6_convention_front_5.gif">
70 <font size=+2 color=blue>
71 <p>This shows the front view of the SSDs and the orientation of the local
72 pixel coordinate system.
78 ////////////////////////////////////////////////////////////////////////
80 ////////////////////////////////////////////////////////////////////////
83 // Written by Bjorn S. Nilsen
88 // Transformation version.
90 // Flag to keep track of which transformation
92 // The total number of modules
94 // The number of ITS layers for this geometry. By default this
95 // is 6, but can be modified by the creator function if there are
96 // more layers defined.
99 // A pointer to an array fNlayers long containing the number of
100 // ladders for each layer. This array is typically created and filled
101 // by the AliITSgeom creator function.
104 // A pointer to an array fNlayers long containing the number of
105 // active detector volumes for each ladder. This array is typically
106 // created and filled by the AliITSgeom creator function.
108 // TObjArray fGm containing objects of type AliITSgeomMatrix
109 // A pointer to an array of AliITSgeomMatrix classes. One element
110 // per module (detector) in the ITS. AliITSgeomMatrix basicly contains
111 // all of the necessary information about the detector and it's coordinate
114 // TObjArray fShape containting objects of type AliITSgeom
115 // A pointer to an array of TObjects containing the detailed shape
116 // information for each type of detector used in the ITS. For example
117 // I have created AliITSgeomSPD, AliITSgeomSDD, and
118 // AliITSsegmenttionSSD as example structures, derived from TObjects,
119 // to hold the detector information. I would recommend that one element
120 // in each of these structures, that which describes the shape of the
121 // active volume, be one of the ROOT classes derived from TShape. In this
122 // way it would be easy to have the display program display the correct
123 // active ITS volumes. See the example classes AliITSgeomSPD,
124 // AliITSgeomSDD, and AliITSgeomSSD for a more detailed
126 ////////////////////////////////////////////////////////////////////////
127 #include <Riostream.h>
134 #include "AliITSgeomSPD.h"
135 #include "AliITSgeomSDD.h"
136 #include "AliITSgeomSSD.h"
137 #include "AliITSgeom.h"
142 //______________________________________________________________________
143 AliITSgeom::AliITSgeom():
145 fVersion("GEANT"),// Transformation version.
146 fTrans(0), // Flag to keep track of which transformation
147 fNmodules(0), // The total number of modules
148 fNlayers(0), // The number of layers.
149 fNlad(), //[] Array of the number of ladders/layer(layer)
150 fNdet(), //[] Array of the number of detector/ladder(layer)
151 fGm(0,0), // Structure of translation. and rotation.
152 fShape(0,0) // Array of shapes and detector information.
154 // The default constructor for the AliITSgeom class. It, by default,
155 // sets fNlayers to zero and zeros all pointers.
156 // Do not allocate anything zero everything.
162 // a zeroed AliITSgeom object.
165 fShape.SetOwner(kTRUE);
168 //______________________________________________________________________
169 AliITSgeom::AliITSgeom(Int_t itype,Int_t nlayers,const Int_t *nlads,
170 const Int_t *ndets,Int_t mods):
172 fVersion("GEANT"), // Transformation version.
173 fTrans(itype), // Flag to keep track of which transformation
174 fNmodules(mods), // The total number of modules
175 fNlayers(nlayers), // The number of layers.
176 fNlad(nlayers,nlads),//[] Array of the number of ladders/layer(layer)
177 fNdet(nlayers,ndets),//[] Array of the number of detector/ladder(layer)
178 fGm(mods,0), // Structure of translation. and rotation.
179 fShape(5,0) // Array of shapes and detector information.
181 // A simple constructor to set basic geometry class variables
183 // Int_t itype the type of transformation kept.
184 // bit 0 => Standard GEANT
185 // bit 1 => ITS tracking
186 // bit 2 => A change in the coordinate system has been made.
187 // others are still to be defined as needed.
188 // Int_t nlayers The number of ITS layers also set the size of the arrays
189 // Int_t *nlads an array of the number of ladders for each layer. This
190 // array must be nlayers long.
191 // Int_t *ndets an array of the number of detectors per ladder for each
192 // layer. This array must be nlayers long.
193 // Int_t mods The number of modules. Typically the sum of all the
194 // detectors on every layer and ladder.
198 // A properly inilized AliITSgeom object.
201 fShape.SetOwner(kTRUE);
204 //______________________________________________________________________
205 void AliITSgeom::Init(Int_t itype,Int_t nlayers,const Int_t *nlads,
206 const Int_t *ndets,Int_t mods){
207 // A simple Inilizer to set basic geometry class variables
209 // Int_t itype the type of transformation kept.
210 // bit 0 => Standard GEANT
211 // bit 1 => ITS tracking
212 // bit 2 => A change in the coordinate system has been made.
213 // others are still to be defined as needed.
214 // Int_t nlayers The number of ITS layers also set the size of the arrays
215 // Int_t *nlads an array of the number of ladders for each layer. This
216 // array must be nlayers long.
217 // Int_t *ndets an array of the number of detectors per ladder for each
218 // layer. This array must be nlayers long.
219 // Int_t mods The number of modules. Typically the sum of all the
220 // detectors on every layer and ladder.
224 // A properly inilized AliITSgeom object.
226 fVersion = "GEANT"; // Transformation version.
227 fTrans = itype; // Flag to keep track of which transformation
228 fNmodules = mods; // The total number of modules
229 fNlayers = nlayers; // The number of layers.
230 fNlad.Set(nlayers,nlads);//[] Array of the number of ladders/layer(layer)
231 fNdet.Set(nlayers,ndets);//[] Array of the number of detector/ladder(layer)
233 fGm.Expand(mods); // Structure of translation. and rotation.
236 fShape.Expand(5); // Array of shapes and detector information.
237 fShape.SetOwner(kTRUE);
240 //______________________________________________________________________
241 void AliITSgeom::CreateMatrix(Int_t mod,Int_t lay,Int_t lad,Int_t det,
242 AliITSDetector idet,const Double_t tran[3],
243 const Double_t rot[10]){
244 // Given the translation vector tran[3] and the rotation matrix rot[1],
245 // this function creates and adds to the TObject Array fGm the
246 // AliITSgeomMatrix object.
247 // The rot[10] matrix is set up like:
248 /* / rot[0] rot[1] rot[2] \
249 // | rot[3] rot[4] rot[5] |
250 // \ rot[6] rot[7] rot[8] / if(rot[9]!=0) then the Identity matrix
251 // is used regardless of the values in rot[0]-rot[8].
254 // Int_t mod The module number. The location in TObjArray
255 // Int_t lay The layer where this module is
256 // Int_t lad On which ladder this module is
257 // Int_t det Which detector on this ladder this module is
258 // AliITSDetector idet The type of detector see AliITSgeom.h
259 // Double_t tran[3] The translation vector
260 // Double_t rot[10] The rotation matrix.
266 Double_t r[3][3] = {{1.0,0.0,0.0},{0.0,1.0,0.0},{0.0,0.0,1.0}};
268 if(mod<0||mod>=fGm.GetSize()){
269 Error("CreateMatrix","mod=%d is out of bounds max value=%d",mod,
274 id[0] = lay; id[1] = lad; id[2] = det;
275 if(rot[9]!=0.0) { // null rotation
276 r[0][0] = rot[0]; r[0][1] = rot[1]; r[0][2] = rot[2];
277 r[1][0] = rot[3]; r[1][1] = rot[4]; r[1][2] = rot[5];
278 r[2][0] = rot[6]; r[2][1] = rot[7]; r[2][2] = rot[8];
280 fGm.AddAt(new AliITSgeomMatrix(idet,id,r,tran),mod);
282 //______________________________________________________________________
283 AliITSgeom::~AliITSgeom(){
284 // The destructor for the AliITSgeom class. If the arrays fNlad,
285 // fNdet, or fGm have had memory allocated to them, there pointer values
286 // are non zero, then this memory space is freed and they are set
287 // to zero. In addition, fNlayers is set to zero. The destruction of
288 // TObjArray fShape is, by default, handled by the TObjArray destructor.
298 //______________________________________________________________________
299 void AliITSgeom::ReadNewFile(const char *filename){
300 // It is generally preferred to define the geometry in AliITSgeom
301 // directly from the GEANT geometry, see AliITSvPPRasymm.cxx for
302 // and example. Under some circumstances this may not be possible.
303 // This function will read in a formatted file for all of the
304 // information needed to define the geometry in AliITSgeom.
305 // Unlike the older file format, this file may contain comments
306 // and the order of the data does not need to be completely
307 // respected. A file can be created using the function WriteNewFile
310 // const char *filename The file name of the file to be read in.
316 const char *cmda[]={"Version" ,"fTrans" ,"fNmodules",
317 "fNlayers" ,"fNladers","fNdetectors",
318 "fNDetectorTypes","fShape" ,"Matrix"};
319 Int_t i,j,lNdetTypes,ldet;
321 AliITSgeomMatrix *m=0;
324 Bool_t arrayGm = kFALSE, arrayShape = kFALSE;
326 filtmp = gSystem->ExpandPathName(filename);
327 AliInfo(Form("Reading New .det file %s",filtmp));
328 fp = new ifstream(filtmp,ios::in); // open file to write
329 while(fp->get(c)!=NULL){ // for ever loop
330 if(c==' ') continue; // remove blanks
331 if(c=='\n') continue;
332 if(c=='#' || c=='!') {while(fp->get(c)) if(c=='\n') break; continue;}
335 if(c=='/') {while(fp->get(c)) if(c=='\n') break; continue;}
338 while(fp->get(c)) if(c=='*') break;
348 for(i=0;i<ncmd;i++) if(strcmp(cmd,cmda[i])==0) break;
351 while(isspace(fp->peek())) fp->get(); // skip spaces
352 if(isdigit(fp->peek())){ // new TString
355 for(j=0;j<fVersion.Length();j++) *fp >> fVersion[j];
358 for(j=0;isprint(fp->peek())&&j<20;j++) *fp >> fVersion[j];
367 fGm.Expand(fNmodules);
377 for(j=0;j<fNlayers;j++) *fp >> fNlad[j];
379 case 5: // fNdetectors
380 for(j=0;j<fNlayers;j++) *fp >> fNdet[j];
382 case 6: // fNDetectorTypes
385 fShape.Expand(lNdetTypes);
386 fShape.SetOwner(kTRUE);
391 if(!arrayShape) fShape.Expand(5);
392 fShape.SetOwner(kTRUE);
395 AliITSgeomSPD *spd = new AliITSgeomSPD();
397 ReSetShape(ldet,spd);
399 case kSDD : case kSDDp:{
400 AliITSgeomSDD *sdd = new AliITSgeomSDD();
402 ReSetShape(ldet,sdd);
404 case kSSD : case kSSDp :{
405 AliITSgeomSSD *ssd = new AliITSgeomSSD();
407 ReSetShape(ldet,ssd);
410 AliError(Form("Unknown fShape type number=%d c=%c",ldet,c));
411 while(fp->get(c)) if(c=='\n') break; // skip to end of line.
422 if(ldet<0||ldet>=fGm.GetSize()){
423 Error("ReadNewFile","ldet<0||ldet>=fGm.GetSize()=%d",
428 fGm.AddAt((TObject*)new AliITSgeomMatrix(),ldet);
429 m = (AliITSgeomMatrix*) fGm.At(ldet);
434 AliError(Form("ReadNewFile","Data line i=%d c=%c",i,c));
435 while(fp->get(c)) if(c=='\n') break; // skip this line
443 //______________________________________________________________________
444 void AliITSgeom::WriteNewFile(const char *filename)const{
445 // Writes AliITSgeom, AliITSgeomMatrix, and the defined
446 // AliITSgeomS*D classes to a file in a format that
447 // is more readable and commendable.
449 // const char *filename The file name of the file to be write to.
458 filtmp = gSystem->ExpandPathName(filename);
459 fp = new ofstream(filtmp,ios::out); // open file to write
460 *fp << "//Comment lines begin with two //, one #, or one !" << endl;
461 *fp << "#Blank lines are skipped including /* and */ sections." << endl;
462 *fp << "!and, in principle the order of the lines is not important" <<endl;
463 *fp << "/* In AliITSgeom.h are defined an enumerated type called" << endl;
464 *fp << " AliITSDetectors These are kSPD=" << (Int_t) kSPD ;
465 *fp << ", kSDD=" << (Int_t) kSDD << ", kSSD=" << (Int_t) kSSD;
466 *fp << ", kSSDp=" << (Int_t) kSSDp << ", and kSDDp=" << (Int_t) kSDDp;
468 *fp << "Version "<< fVersion.Length()<<" " << fVersion.Data() << endl;//This should be consistent
469 // with the geometry version.
470 *fp << "fTrans " << fTrans << endl;
471 *fp << "fNmodules " << fNmodules << endl;
472 *fp << "fNlayers " << fNlayers << endl;
474 for(i=0;i<fNlayers;i++) *fp << fNlad[i] << " ";
476 *fp << "fNdetectors ";
477 for(i=0;i<fNlayers;i++) *fp << fNdet[i] << " ";
479 *fp << "fNDetectorTypes " << fShape.GetEntriesFast() << endl;
480 for(i=0;i<fShape.GetEntriesFast();i++){
481 if(!IsShapeDefined(i)) continue; // only print out used shapes.
484 *fp << "fShape " << (Int_t) kSPD << " ";
485 *fp << *((AliITSgeomSPD*)(fShape.At(i)));
488 *fp << "fShape " << (Int_t) kSDD << " ";
489 *fp << *((AliITSgeomSDD*)(fShape.At(i)));
491 case kSSD : case kSSDp :
492 *fp << "fShape " << i << " ";
493 *fp << *((AliITSgeomSSD*)(fShape.At(i)));
496 Error("AliITSgeom::WriteNewFile","Unknown Shape value");
499 for(i=0;i<fNmodules;i++){
500 *fp << "Matrix " << i << " ";
501 *fp << *GetGeomMatrix(i);
503 *fp << "//End of File" << endl;;
508 //______________________________________________________________________
509 AliITSgeom::AliITSgeom(const char *filename):
511 fVersion("test"),// Transformation version.
512 fTrans(0), // Flag to keep track of which transformation
513 fNmodules(0), // The total number of modules
514 fNlayers(0), // The number of layers.
515 fNlad(), // TArrayI of the number of ladders/layer(layer)
516 fNdet(), // TArrayI of the number of detector/ladder(layer)
517 fGm(0,0), // TObjArray Structure of translation. and rotation.
518 fShape(0,0) // TObjArray of detector geom.
520 // The constructor for the AliITSgeom class. All of the data to fill
521 // this structure is read in from the file given my the input filename.
523 // const char *filename The file name of the file to be read in.
527 // An AliITSgeom class initialized from a file.
531 Float_t x,y,z,o,p,q,r,s,t;
532 Double_t rot6[6],tran[3];
533 char buf[200],*buff=0; // input character buffer;
536 filtmp = gSystem->ExpandPathName(filename);
537 Info("AliITSgeom","reading old .det file %s",filtmp);
539 pf = fopen(filtmp,"r");
541 fNlayers = 6; // set default number of ladders
546 // find the number of ladders and detectors in this geometry.
547 for(i=0;i<fNlayers;i++){fNlad[i]=fNdet[i]=0;} // zero out arrays
548 while(fgets(buf,200,pf)!=NULL){ // for ever loop
549 for(i=0;i<200;i++)if(buf[i]!=' '){ // remove blank spaces.
553 // remove blank lines and comments.
554 if(buff[0]=='\n'||buff[0]=='#'||buff[0]=='!'||
555 (buff[0]=='/'&&buff[1]=='/')) continue;
556 if(isalpha(buff[0])) { // must be the new file formated file.
558 ReadNewFile(filename);
560 } // end if isalpha(buff[0])
561 sscanf(buff,"%d %d %d %f %f %f %f %f %f %f %f %f",
562 &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t);
564 if(l<1 || l>fNlayers) {
565 printf("error in file %s layer=%d min. is 1 max is %d Trying new format\n",
566 filename,l,fNlayers);
568 ReadNewFile(filename);
573 if(l<=fNlayers&&fNlad[l-1]<a) fNlad[l-1] = a;
574 if(l<=fNlayers&&fNdet[l-1]<d) fNdet[l-1] = d;
575 } // end while ever loop
579 } // end if lm>fNlayers
580 // counted the number of ladders and detectors now allocate space.
581 fGm.Expand(fNmodules);
583 fShape.SetOwner(kTRUE);
585 // Set up Shapes for a default configuration of 6 layers.
586 fTrans = 0; // standard GEANT global/local coordinate system.
587 // prepare to read in transforms
588 lm = 0; // reuse lm as counter of modules.
589 rewind(pf); // start over reading file
590 while(fgets(buf,200,pf)!=NULL){ // for ever loop
591 for(i=0;i<200;i++)if(buf[i]!=' '){ // remove blank spaces.
595 // remove blank lines and comments.
596 if(buff[0]=='\n'||buff[0]=='#'||buff[0]=='!'||
597 (buff[0]=='/'&&buff[1]=='/')) continue;
598 x = y = z = o = p = q = r = s = t = 0.0;
599 sscanf(buff,"%d %d %d %f %f %f %f %f %f %f %f %f",
600 &l,&a,&d,&x,&y,&z,&o,&p,&q,&r,&s,&t);
601 if(l<1 || l>fNlayers) {
602 Warning("AliITSgeom","error in file %s layer=%d min. is 1 max is %d",
603 filename,l,fNlayers);
606 id[0] = l;id[1] = a;id[2] = d;
607 tran[0] = tran[1] = tran[2] = 0.0;
608 tran[0] = (Double_t)x;tran[1] = (Double_t)y;tran[2] = (Double_t)z;
609 rot6[0] = rot6[1] = rot6[2] = rot6[3] = rot6[4] = rot6[5] =0.0;
610 rot6[0] = (Double_t)o;rot6[1] = (Double_t)p;rot6[2] = (Double_t)q;
611 rot6[3] = (Double_t)r;rot6[4] = (Double_t)s;rot6[5] = (Double_t)t;
612 if(lm<0||lm>=fGm.GetSize()){
613 Error("AliITSgeom(filename)","lm<0||lm>=fGm.GetSize()=%d",
618 case 1: case 2: // layer 1 or2 SPD
619 fGm.AddAt(new AliITSgeomMatrix(rot6,kSPD,id,tran),lm++);
621 case 3: case 4: // layer 3 or 4 SDD
622 fGm.AddAt(new AliITSgeomMatrix(rot6,kSDD,id,tran),lm++);
624 case 5: case 6: // layer 5 or 6 SSD
625 fGm.AddAt(new AliITSgeomMatrix(rot6,kSSD,id,tran),lm++);
628 } // end while ever loop
631 //______________________________________________________________________
632 AliITSgeom::AliITSgeom(const AliITSgeom &source) : TObject(source){
633 // The copy constructor for the AliITSgeom class. It calls the
634 // = operator function. See the = operator function for more details.
636 // AliITSgeom &source The AliITSgeom class with which to make this
643 *this = source; // Just use the = operator for now.
646 //______________________________________________________________________
647 AliITSgeom& AliITSgeom::operator=(const AliITSgeom &source){
648 // The = operator function for the AliITSgeom class. It makes an
649 // independent copy of the class in such a way that any changes made
650 // to the copied class will not affect the source class in any way.
651 // This is required for many ITS alignment studies where the copied
652 // class is then modified by introducing some misalignment.
654 // AliITSgeom &source The AliITSgeom class with which to make this
659 // *this The a new copy of source.
662 if(this == &source) return *this; // don't assign to ones self.
664 // if there is an old structure allocated delete it first.
666 this->fShape.Clear();
668 this->fVersion = source.fVersion;
669 this->fTrans = source.fTrans;
670 this->fNmodules = source.fNmodules;
671 this->fNlayers = source.fNlayers;
672 this->fNlad.Set(fNlayers,source.fNlad.GetArray());
673 this->fNdet.Set(fNlayers,source.fNdet.GetArray());
674 this->fShape.Expand(source.fShape.GetEntriesFast());
675 for(i=0;i<source.fShape.GetEntriesFast();i++)
676 this->fShape.AddAt(new TObject(*(source.fShape.At(i))),i);
677 this->fShape.SetOwner(kTRUE);
678 this->fGm.Expand(this->fNmodules);
679 this->fGm.SetOwner(kTRUE);
680 for(i=0;i<this->fNmodules;i++)
681 if(i<0||i>=fGm.GetSize()){
682 Error("ReadNewFile","i<0||i>=fGm.GetSize()=%d",
686 this->fGm.AddAt(new TObject(*(source.fGm.At(i))),i);
689 //______________________________________________________________________
690 Int_t AliITSgeom::GetModuleIndex(Int_t lay,Int_t lad,Int_t det)const{
691 // This routine computes the module index number from the layer,
692 // ladder, and detector numbers. The number of ladders and detectors
693 // per layer is determined when this geometry package is constructed,
694 // see AliITSgeom(const char *filename) for specifics.
696 // Int_t lay The layer number. Starting from 1.
697 // Int_t lad The ladder number. Starting from 1.
698 // Int_t det The detector number. Starting from 1.
702 // the module index number, starting from zero.
705 i = fNdet[lay-1] * (lad-1) + det - 1;
707 for(k=0;k<lay-1;k++) j += fNdet[k]*fNlad[k];
709 if(i>=fNmodules) return -1;
710 GetGeomMatrix(i)->GetIndex(id);
711 if(id[0]==lay&&id[1]==lad&&id[2]==det) return i;
712 // Array of modules fGm is not in expected order. Search for this index
713 for(i=0;i<fNmodules;i++){
714 GetGeomMatrix(i)->GetIndex(id);
715 if(id[0]==lay&&id[1]==lad&&id[2]==det) return i;
717 // This layer ladder and detector combination does not exist return -1.
720 //______________________________________________________________________
721 void AliITSgeom::GetModuleId(Int_t index,Int_t &lay,Int_t &lad,Int_t &det)const{
722 // This routine computes the layer, ladder and detector number
723 // given the module index number. The number of ladders and detectors
724 // per layer is determined when this geometry package is constructed,
725 // see AliITSgeom(const char *filename) for specifics.
727 // Int_t index The module index number, starting from zero.
729 // Int_t lay The layer number. Starting from 1.
730 // Int_t lad The ladder number. Starting from 1.
731 // Int_t det The detector number. Starting from 1.
735 AliITSgeomMatrix *g = GetGeomMatrix(index);
738 Error("GetModuleId","Can not get GeoMatrix for index = %d",index);
739 lay = -1; lad = -1; det = -1;
742 lay = id[0]; lad = id[1]; det = id[2];
745 // The old way kept for posterity.
749 for(k=0;k<fNlayers;k++){
750 j += fNdet[k]*fNlad[k];
754 i = index -j + fNdet[k]*fNlad[k];
756 for(k=0;k<fNlad[lay-1];k++){
761 det = 1+i-fNdet[lay-1]*k;
765 //______________________________________________________________________
766 Int_t AliITSgeom::GetNDetTypes(Int_t &max)const{
767 // Finds and returns the number of detector types used and the
768 // maximum detector type value. Only counts id >=0 (no undefined
769 // values. See AliITSgeom.h for list of AliITSDetecor enumerated types.
773 // The maximum detector type used
775 // The number of detector types used
779 for(i=0;i<GetIndexMax();i++){
780 id = GetModuleType(i);
783 n = new Int_t[max+1];
784 for(i=0;i<max;i++) n[i] = 0;
785 for(i=0;i<GetIndexMax();i++){
786 id = GetModuleType(i);
787 if(id>-1)n[id]++; // note id=-1 => undefined.
790 for(i=0;i<max;i++) if(n[i]!=0) id++;
794 //______________________________________________________________________
795 Int_t AliITSgeom::GetNDetTypes(TArrayI &maxs,AliITSDetector *types)const{
796 // Finds and returns the number of detector types used and the
797 // number of each detector type. Only counts id >=0 (no undefined
798 // values. See AliITSgeom.h for list of AliITSDetecor enumerated types.
802 // The maximum detector type used
804 // The number of detector types used
808 for(i=0;i<GetIndexMax();i++){
809 id = GetModuleType(i);
812 n = new Int_t[max+1];
813 for(i=0;i<max;i++) n[i] = 0;
814 for(i=0;i<GetIndexMax();i++){
815 id = GetModuleType(i);
816 if(id>-1)n[id]++; // note id=-1 => undefined.
819 for(i=0;i<=max;i++) if(n[i]!=0) id++;
822 for(i=0;i<=max;i++) if(n[i]!=0){
824 types[j++] = (AliITSDetector) i;
825 } // end for i/end if
829 //______________________________________________________________________
830 Int_t AliITSgeom::GetStartDet(Int_t dtype)const{
831 // returns the starting module index value for a give type of detector id.
832 // This assumes that the detector types are different on different layers
833 // and that they are not mixed up.
835 // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD.
839 // the module index for the first occurrence of that detector type.
843 return GetModuleIndex(1,1,1);
846 return GetModuleIndex(3,1,1);
849 return GetModuleIndex(5,1,1);
852 Warning("GetStartDet","undefined detector type %d",dtype);
856 Warning("GetStartDet","undefined detector type %d",dtype);
859 //______________________________________________________________________
860 Int_t AliITSgeom::GetLastDet(Int_t dtype)const{
861 // returns the last module index value for a give type of detector id.
862 // This assumes that the detector types are different on different layers
863 // and that they are not mixed up.
865 // Int_t dtype A detector type number. 0 for SPD, 1 for SDD, and 2 for SSD.
868 // the module index for the last occurrence of that detector type.
881 Warning("GetLastDet","undefined detector type %d",dtype);
885 Warning("GetLastDet","undefined detector type %d",dtype);
888 //______________________________________________________________________
889 void AliITSgeom::PrintComparison(FILE *fp,AliITSgeom *other)const{
890 // This function was primarily created for diagnostic reasons. It
891 // print to a file pointed to by the file pointer fp the difference
892 // between two AliITSgeom classes. The format of the file is basically,
893 // define d? to be the difference between the same element of the two
894 // classes. For example dfrx = this->GetGeomMatrix(i)->frx
895 // - other->GetGeomMatrix(i)->frx.
896 // if(at least one of dfx0, dfy0, dfz0,dfrx,dfry,dfrz are non zero) then
897 // print layer ladder detector dfx0 dfy0 dfz0 dfrx dfry dfrz
898 // if(at least one of the 9 elements of dfr[] are non zero) then print
899 // layer ladder detector dfr[0] dfr[1] dfr[2]
900 // dfr[3] dfr[4] dfr[5]
901 // dfr[6] dfr[7] dfr[8]
902 // Only non zero values are printed to save space. The differences are
903 // typical written to a file because there are usually a lot of numbers
904 // printed out and it is usually easier to read them in some nice editor
905 // rather than zooming quickly past you on a screen. fprintf is used to
906 // do the printing. The fShapeIndex difference is not printed at this time.
908 // FILE *fp A file pointer to an opened file for writing in which
909 // the results of the comparison will be written.
910 // AliITSgeom *other The other AliITSgeom class to which this one is
916 Int_t i,j,idt[3],ido[3];
917 Double_t tt[3],to[3]; // translation
918 Double_t rt[3],ro[3]; // phi in radians
919 Double_t mt[3][3],mo[3][3]; // matrices
920 AliITSgeomMatrix *gt,*go;
923 for(i=0;i<this->fNmodules;i++){
924 gt = this->GetGeomMatrix(i);
925 go = other->GetGeomMatrix(i);
929 for(i=0;i<3;i++) t = t&&idt[i]!=ido[i];
930 if(t) fprintf(fp,"%4.4d %1.1d %2.2d %2.2d %1.1d %2.2d %2.2d\n",i,
931 idt[0],idt[1],idt[2],ido[0],ido[1],ido[2]);
932 gt->GetTranslation(tt);
933 go->GetTranslation(to);
937 for(i=0;i<3;i++) t = t&&tt[i]!=to[i];
938 if(t) fprintf(fp,"%1.1d %2.2d %2.2d dTrans=%f %f %f drot=%f %f %f\n",
939 idt[0],idt[1],idt[2],
940 tt[0]-to[0],tt[1]-to[1],tt[2]-to[2],
941 rt[0]-ro[0],rt[1]-ro[1],rt[2]-ro[2]);
945 for(i=0;i<3;i++)for(j=0;j<3;j++) t = mt[i][j] != mo[i][j];
947 fprintf(fp,"%1.1d %2.2d %2.2d dfr= %e %e %e\n",
948 idt[0],idt[1],idt[2],
949 mt[0][0]-mo[0][0],mt[0][1]-mo[0][1],mt[0][2]-mo[0][2]);
950 fprintf(fp," dfr= %e %e %e\n",
951 mt[1][0]-mo[1][0],mt[1][1]-mo[1][1],mt[1][2]-mo[1][2]);
952 fprintf(fp," dfr= %e %e %e\n",
953 mt[2][0]-mo[2][0],mt[2][1]-mo[2][1],mt[2][2]-mo[2][2]);
958 //______________________________________________________________________
959 void AliITSgeom::PrintData(FILE *fp,Int_t lay,Int_t lad,Int_t det)const{
960 // This function prints out the coordinate transformations for
961 // the particular detector defined by layer, ladder, and detector
962 // to the file pointed to by the File pointer fp. fprintf statements
963 // are used to print out the numbers. The format is
964 // layer ladder detector Trans= fx0 fy0 fz0 rot= frx fry frz
966 // dfr= fr[0] fr[1] fr[2]
967 // dfr= fr[3] fr[4] fr[5]
968 // dfr= fr[6] fr[7] fr[8]
969 // By indicating which detector, some control over the information
970 // is given to the user. The output it written to the file pointed
971 // to by the file pointer fp. This can be set to stdout if you want.
973 // FILE *fp A file pointer to an opened file for writing in which
974 // the results of the comparison will be written.
975 // Int_t lay The layer number. Starting from 1.
976 // Int_t lad The ladder number. Starting from 1.
977 // Int_t det The detector number. Starting from 1.
982 AliITSgeomMatrix *gt;
983 Double_t t[3],r[3],m[3][3];
985 gt = this->GetGeomMatrix(GetModuleIndex(lay,lad,det));
986 gt->GetTranslation(t);
988 fprintf(fp,"%1.1d %2.2d %2.2d Trans=%f %f %f rot=%f %f %f Shape=%d\n",
989 lay,lad,det,t[0],t[1],t[2],r[0],r[1],r[2],
990 gt->GetDetectorIndex());
992 fprintf(fp," dfr= %e %e %e\n",m[0][0],m[0][1],m[0][2]);
993 fprintf(fp," dfr= %e %e %e\n",m[1][0],m[1][1],m[1][2]);
994 fprintf(fp," dfr= %e %e %e\n",m[2][0],m[2][1],m[2][2]);
997 //______________________________________________________________________
998 ofstream & AliITSgeom::PrintGeom(ofstream &rb)const{
999 // Stream out an object of class AliITSgeom to standard output.
1001 // ofstream &rb The output streaming buffer.
1005 // ofstream &rb The output streaming buffer.
1008 rb.setf(ios::scientific);
1009 rb << fTrans << " ";
1010 rb << fNmodules << " ";
1011 rb << fNlayers << " ";
1012 for(i=0;i<fNlayers;i++) rb << fNlad[i] << " ";
1013 for(i=0;i<fNlayers;i++) rb << fNdet[i] << "\n";
1014 for(i=0;i<fNmodules;i++) {
1015 rb <<setprecision(16) << *(GetGeomMatrix(i)) << "\n";
1017 nshapes = fShape.GetEntries();
1018 rb << nshapes <<endl;
1019 for(i=0;i<nshapes;i++) if(fShape.At(i)!=0) switch (i){
1021 rb << kSPD <<","<< (AliITSgeomSPD*)(fShape.At(kSPD));
1024 rb << kSDD <<","<< (AliITSgeomSDD*)(fShape.At(kSDD));
1027 rb << kSSD <<","<< (AliITSgeomSSD*)(fShape.At(kSSD));
1030 rb << kSSDp <<","<< (AliITSgeomSSD*)(fShape.At(kSSDp));
1033 rb << kSDDp <<","<< (AliITSgeomSDD*)(fShape.At(kSDDp));
1035 } // end for i / switch
1038 //______________________________________________________________________
1039 ifstream & AliITSgeom::ReadGeom(ifstream &rb){
1040 // Stream in an object of class AliITSgeom from standard input.
1042 // ifstream &rb The input streaming buffer.
1046 // ifstream &rb The input streaming buffer.
1051 rb >> fTrans >> fNmodules >> fNlayers;
1052 fNlad.Set(fNlayers);
1053 fNdet.Set(fNlayers);
1054 for(i=0;i<fNlayers;i++) rb >> fNlad[i];
1055 for(i=0;i<fNlayers;i++) rb >> fNdet[i];
1056 fGm.Expand(fNmodules);
1057 fGm.SetOwner(kTRUE);
1058 for(i=0;i<fNmodules;i++){
1059 if(i<0||i>=fGm.GetSize()){
1060 Error("ReadGeom","i<0||i>=fGm.GetSize()=%d",
1064 fGm.AddAt(new AliITSgeomMatrix,i);
1065 rb >> *(GetGeomMatrix(i));
1069 fShape.SetOwner(kTRUE);
1070 for(i=0;i<fShape.GetEntries();i++) {
1074 AliITSgeomSPD *s = new AliITSgeomSPD();
1076 fShape.AddAt(s,kSPD);}
1079 AliITSgeomSDD *s = new AliITSgeomSDD();
1081 fShape.AddAt(s,kSDD);}
1084 AliITSgeomSSD *s = new AliITSgeomSSD();
1086 fShape.AddAt(s,kSSD);}
1089 AliITSgeomSSD *s = new AliITSgeomSSD();
1091 fShape.AddAt(s,kSSDp);}
1094 AliITSgeomSDD *s = new AliITSgeomSDD();
1096 fShape.AddAt(s,kSDDp);}
1102 //______________________________________________________________________
1103 // The following routines modify the transformation of "this"
1104 // geometry transformations in a number of different ways.
1105 //______________________________________________________________________
1106 void AliITSgeom::GlobalChange(const Float_t *tran,const Float_t *rot){
1107 // This function performs a Cartesian translation and rotation of
1108 // the full ITS from its default position by an amount determined by
1109 // the three element arrays tran and rot. If every element
1110 // of tran and rot are zero then there is no change made
1111 // the geometry. The change is global in that the exact same translation
1112 // and rotation is done to every detector element in the exact same way.
1113 // The units of the translation are those of the Monte Carlo, usually cm,
1114 // and those of the rotation are in radians. The elements of tran
1115 // are tran[0] = x, tran[1] = y, and tran[2] = z.
1116 // The elements of rot are rot[0] = rx, rot[1] = ry, and
1117 // rot[2] = rz. A change in x will move the hole ITS in the ALICE
1118 // global x direction, the same for a change in y. A change in z will
1119 // result in a translation of the ITS as a hole up or down the beam line.
1120 // A change in the angles will result in the inclination of the ITS with
1121 // respect to the beam line, except for an effective rotation about the
1122 // beam axis which will just rotate the ITS as a hole about the beam axis.
1124 // Float_t *tran A 3 element array representing the global translations.
1125 // the elements are x,y,z in cm.
1126 // Float_t *rot A 3 element array representing the global rotation
1127 // angles about the three axis x,y,z in radians
1134 AliITSgeomMatrix *g;
1136 fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true.
1137 for(i=0;i<fNmodules;i++){
1138 g = this->GetGeomMatrix(i);
1139 g->GetTranslation(t);
1145 g->SetTranslation(t);
1150 //______________________________________________________________________
1151 void AliITSgeom::GlobalCylindericalChange(const Float_t *tran,
1152 const Float_t *rot){
1153 // This function performs a cylindrical translation and rotation of
1154 // each ITS element by a fixed about in radius, rphi, and z from its
1155 // default position by an amount determined by the three element arrays
1156 // tran and rot. If every element of tran and
1157 // rot are zero then there is no change made the geometry. The
1158 // change is global in that the exact same distance change in translation
1159 // and rotation is done to every detector element in the exact same way.
1160 // The units of the translation are those of the Monte Carlo, usually cm,
1161 // and those of the rotation are in radians. The elements of tran
1162 // are tran[0] = r, tran[1] = rphi, and tran[2] = z.
1163 // The elements of rot are rot[0] = rx, rot[1] = ry, and
1164 // rot[2] = rz. A change in r will results in the increase of the
1165 // radius of each layer by the same about. A change in rphi will results in
1166 // the rotation of each layer by a different angle but by the same
1167 // circumferential distance. A change in z will result in a translation
1168 // of the ITS as a hole up or down the beam line. A change in the angles
1169 // will result in the inclination of the ITS with respect to the beam
1170 // line, except for an effective rotation about the beam axis which will
1171 // just rotate the ITS as a hole about the beam axis.
1173 // Float_t *tran A 3 element array representing the global translations.
1174 // the elements are r,theta,z in cm/radians.
1175 // Float_t *rot A 3 element array representing the global rotation
1176 // angles about the three axis x,y,z in radians
1182 Double_t t[3],ro[3],r,r0,phi,rphi;
1183 AliITSgeomMatrix *g;
1185 fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true.
1186 for(i=0;i<fNmodules;i++){
1187 g = this->GetGeomMatrix(i);
1188 g->GetTranslation(t);
1190 r = r0= TMath::Hypot(t[1],t[0]);
1191 phi = TMath::ATan2(t[1],t[0]);
1196 t[0] = r*TMath::Cos(phi);
1197 t[1] = r*TMath::Sin(phi);
1202 g->SetTranslation(t);
1207 //______________________________________________________________________
1208 void AliITSgeom::RandomChange(const Float_t *stran,const Float_t *srot){
1209 // This function performs a Gaussian random displacement and/or
1210 // rotation about the present global position of each active
1211 // volume/detector of the ITS. The sigma of the random displacement
1212 // is determined by the three element array stran, for the
1213 // x y and z translations, and the three element array srot,
1214 // for the three rotation about the axis x y and z.
1216 // Float_t *stran A 3 element array representing the global translations
1217 // variances. The elements are x,y,z in cm.
1218 // Float_t *srot A 3 element array representing the global rotation
1219 // angles variances about the three axis x,y,z in radians.
1226 AliITSgeomMatrix *g;
1228 fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true.
1229 for(i=0;i<fNmodules;i++){
1230 g = this->GetGeomMatrix(i);
1231 g->GetTranslation(t);
1234 t[j] += gRandom->Gaus(0.0,stran[j]);
1235 r[j] += gRandom->Gaus(0.0, srot[j]);
1237 g->SetTranslation(t);
1242 //______________________________________________________________________
1243 void AliITSgeom::RandomCylindericalChange(const Float_t *stran,
1244 const Float_t *srot){
1245 // This function performs a Gaussian random displacement and/or
1246 // rotation about the present global position of each active
1247 // volume/detector of the ITS. The sigma of the random displacement
1248 // is determined by the three element array stran, for the
1249 // r rphi and z translations, and the three element array srot,
1250 // for the three rotation about the axis x y and z. This random change
1251 // in detector position allow for the simulation of a random uncertainty
1252 // in the detector positions of the ITS.
1254 // Float_t *stran A 3 element array representing the global translations
1255 // variances. The elements are r,theta,z in cm/radians.
1256 // Float_t *srot A 3 element array representing the global rotation
1257 // angles variances about the three axis x,y,z in radians.
1263 Double_t t[3],ro[3],r,r0,phi,rphi;
1265 AliITSgeomMatrix *g;
1267 fTrans = (fTrans && 0xfffd) + 2; // set bit 1 true.
1268 for(i=0;i<fNmodules;i++){
1269 g = this->GetGeomMatrix(i);
1270 g->GetTranslation(t);
1272 r = r0= TMath::Hypot(t[1],t[0]);
1273 phi = TMath::ATan2(t[1],t[0]);
1275 r += ran.Gaus(0.0,stran[0]);
1276 rphi += ran.Gaus(0.0,stran[1]);
1278 t[0] = r*TMath::Cos(phi);
1279 t[1] = r*TMath::Sin(phi);
1280 t[2] += ran.Gaus(0.0,stran[2]);
1282 ro[j] += ran.Gaus(0.0, srot[j]);
1284 g->SetTranslation(t);
1289 //______________________________________________________________________
1290 void AliITSgeom::GeantToTracking(const AliITSgeom &source){
1291 // Copy the geometry data but change it to go between the ALICE
1292 // Global coordinate system to that used by the ITS tracking. A slightly
1293 // different coordinate system is used when tracking. This coordinate
1294 // system is only relevant when the geometry represents the cylindrical
1295 // ALICE ITS geometry. For tracking the Z axis is left alone but X-> -Y
1296 // and Y-> X such that X always points out of the ITS cylinder for every
1297 // layer including layer 1 (where the detectors are mounted upside down).
1300 <img src="picts/ITS/AliITSgeomMatrix_T1.gif">
1304 // AliITSgeom &source The AliITSgeom class with which to make this
1310 Int_t i,j,k,l,id[3];
1311 Double_t r0[3][3],r1[3][3];
1312 Double_t a0[3][3] = {{0.,+1.,0.},{-1.,0.,0.},{0.,0.,+1.}};
1313 Double_t a1[3][3] = {{0.,-1.,0.},{+1.,0.,0.},{0.,0.,+1.}};
1315 *this = source; // copy everything
1316 for(i=0;i<GetIndexMax();i++){
1317 GetGeomMatrix(i)->GetIndex(id);
1318 GetGeomMatrix(i)->GetMatrix(r0);
1319 if(id[0]==1){ // Layer 1 is treated different from the others.
1320 for(j=0;j<3;j++) for(k=0;k<3;k++){
1322 for(l=0;l<3;l++) r1[j][k] += a0[j][l]*r0[l][k];
1325 for(j=0;j<3;j++) for(k=0;k<3;k++){
1327 for(l=0;l<3;l++) r1[j][k] += a1[j][l]*r0[l][k];
1330 GetGeomMatrix(i)->SetMatrix(r1);
1332 this->fTrans = (this->fTrans && 0xfffe) + 1; // set bit 0 true.
1335 //______________________________________________________________________
1336 Int_t AliITSgeom::GetNearest(const Double_t g[3],Int_t lay)const{
1337 // Finds the Detector (Module) that is nearest the point g [cm] in
1338 // ALICE Global coordinates. If layer !=0 then the search is restricted
1339 // to Detectors (Modules) in that particular layer.
1341 // Double_t g[3] The ALICE Cartesian global coordinate from which the
1342 // distance is to be calculated with.
1343 // Int_t lay The layer to restrict the search to. If layer=0 then
1344 // all layers are searched. Default is lay=0.
1348 // The module number representing the nearest module.
1350 Double_t d,dn=1.0e10;
1351 Bool_t t=lay!=0; // skip if lay = 0 default value check all layers.
1353 for(i=0;i<fNmodules;i++){
1354 if(t){GetModuleId(i,l,a,e);if(l!=lay) continue;}
1355 if((d=GetGeomMatrix(i)->Distance2(g))<dn){
1362 //______________________________________________________________________
1363 void AliITSgeom::GetNearest27(const Double_t g[3],Int_t n[27],Int_t lay)const{
1364 // Finds 27 Detectors (Modules) that are nearest the point g [cm] in
1365 // ALICE Global coordinates. If layer !=0 then the search is restricted
1366 // to Detectors (Modules) in that particular layer. The number 27 comes
1367 // from including the nearest detector and all those around it (up, down,
1368 // left, right, forwards, backwards, and the corners).
1370 // Double_t g[3] The ALICE Cartesian global coordinate from which the
1371 // distance is to be calculated with.
1372 // Int_t lay The layer to restrict the search to. If layer=0 then
1373 // all layers are searched. Default is lay=0.
1375 // Int_t n[27] The module number representing the nearest 27 modules
1379 Int_t i,l,a,e,in[27]={0,0,0,0,0,0,0,0,0,
1381 0,0,0,0,0,0,0,0,0,};
1382 Double_t d,dn[27]={1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,
1383 1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,
1384 1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,
1385 1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,1.0e10,
1386 1.0e10,1.0e10,1.0e10};
1387 Bool_t t=(lay!=0); // skip if lay = 0 default value check all layers.
1389 for(i=0;i<fNmodules;i++){
1390 if(t){GetModuleId(i,l,a,e);if(l!=lay) continue;}
1392 d = GetGeomMatrix(i)->Distance2(g);
1394 for(e=26;e>a;e--){dn[e] = dn[e-1];in[e] = in[e-1];}
1395 dn[a] = d; in[a] = i;
1399 for(i=0;i<27;i++) n[i] = in[i];
1401 //----------------------------------------------------------------------
1402 Double_t AliITSgeom::GetAverageRadiusOfLayer(Int_t layer,Double_t &range)const{
1403 // Loops over all modules for a given layer and computes the
1404 // average cylindrical radius (about the z axis) and the range of
1405 // radii covered by this layer. Units, [cm] the Alice default unit.
1407 // Int_t layer The layer for which the average radii is to be found
1409 // Double_t &range The range of radii covered by this layer
1411 // The average radii for this layer.
1412 Double_t r=0.0,rmin=1.0e6,rmax=-1.0,rp,t[3],l[3],dl[3];
1413 Int_t n=0,i,j,lay,lad,det;
1414 AliITSDetector idet;
1416 for(i=0;i<GetIndexMax();i++) {
1417 GetModuleId(i,lay,lad,det);
1418 idet = GetModuleType(i);
1419 if(lay!=layer) continue;
1420 dl[0] = dl[1] = dl[2] = 0.0;
1421 if(IsShapeDefined((Int_t)idet)) {
1424 dl[0] = ((AliITSgeomSPD*)GetShape(idet))->GetDx();
1425 dl[1] = ((AliITSgeomSPD*)GetShape(idet))->GetDy();
1426 dl[2] = ((AliITSgeomSPD*)GetShape(idet))->GetDz();
1428 case kSDD: case kSDDp:{
1429 dl[0] = ((AliITSgeomSDD*)GetShape(idet))->GetDx();
1430 dl[1] = ((AliITSgeomSDD*)GetShape(idet))->GetDy();
1431 dl[2] = ((AliITSgeomSDD*)GetShape(idet))->GetDz();
1433 case kSSD: case kSSDp:{
1434 dl[0] = ((AliITSgeomSSD*)GetShape(idet))->GetDx();
1435 dl[1] = ((AliITSgeomSSD*)GetShape(idet))->GetDy();
1436 dl[2] = ((AliITSgeomSSD*)GetShape(idet))->GetDz();
1439 Warning("GetAverageRadiusOfLayer",
1440 "idet=kND undefined detector type");
1444 Warning("GetAverageRadiusOfLayer",
1445 "idet=%d not a defined value",(Int_t)idet);
1454 if(rmin>rp) rmin = rp;
1455 if(rmax<rp) rmax = rp;
1456 for(j=0;j<8;j++){ // loop over the corners
1457 l[0] = dl[0];if(j%2==0) l[0] = -dl[0];
1458 l[1] = dl[1];if(j==2||j==3||j==6||j==7) l[1] = -dl[1];
1459 l[2] = dl[2];if(j>3) l[2] = -dl[2];
1461 rp = TMath::Sqrt(t[0]*t[0]+t[1]*t[1]);
1462 if(rmin>rp) rmin = rp;
1463 if(rmax<rp) rmax = rp;
1467 range = TMath::Max(rmax-r,r-rmin);
1470 //_______________________________________________________________________
1471 void AliITSgeom::DetLToTrackingV2(Int_t md, Float_t xin, Float_t zin, Float_t &yout, Float_t &zout) {
1473 //Conversion from local coordinates on detectors to local
1474 //coordinates used for tracking ("v2")
1475 Float_t x,y,z; Double_t rt[9];GetTrans(md,x,y,z);GetRotMatrix(md,rt);
1476 Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi();
1477 yout=-(-xin+(x*TMath::Cos(al)+y*TMath::Sin(al)));
1478 if(md<(GetModuleIndex(2,1,1)-1))yout*=-1; zout=-zin+(Double_t)z;
1481 //_______________________________________________________________________
1482 void AliITSgeom::TrackingV2ToDetL(Int_t md,Float_t yin,Float_t zin,Float_t &xout,Float_t &zout) {
1483 //Conversion from local coordinates used for tracking ("v2") to
1484 //local detector coordinates
1486 Float_t x,y,z; Double_t rt[9];GetTrans(md,x,y,z);GetRotMatrix(md,rt);
1487 Double_t al=TMath::ATan2(rt[1],rt[0])+TMath::Pi();
1488 xout=yin;if(md<(GetModuleIndex(2,1,1)-1))xout=-xout;
1489 xout+=(x*TMath::Cos(al)+y*TMath::Sin(al));
1490 zout=-zin+(Double_t)z;