3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no>
4 //*-- Copyright © ASV
5 // changes done by Constantin Loizides <mailto:loizides@ikf.physik.uni-frankfurt.de>
7 #include "AliL3StandardIncludes.h"
12 #include <AliTPCParamSR.h>
13 #include <AliTPCPRF2D.h>
14 #include <AliTPCRF1D.h>
16 #include <TUnixSystem.h>
17 #include <TTimeStamp.h>
20 #include "AliL3Logging.h"
21 #include "AliL3Transform.h"
23 /** \class AliL3Transform
25 //_____________________________________________________________
28 // Transformation class for ALICE TPC.
30 // Class which contains all detector specific parameters for the TPC,
31 // and different useful functions for coordinate transforms.
33 // The class is completely static, which means that no object needs
34 // to be instantiated. Function calls should then be done like, e.g.:
36 // Double_t eta = AliL3Transform::GetEta(xyz);
38 // IMPORTANT: If used as is, default detector parameters will be used,
39 // and you really have to make sure that these correspond to
40 // the AliROOT version you are currently working on!!
41 // You should therefore always initialize the parameters by
43 // AliL3Transform::Init(path);
45 // where path is a char*, giving the path to where file containing
46 // the detector parameter is located. This file should be called
47 // "l3transform.config", and can be created with the function MakeInitFile.
49 // You can also force reading the parameters from a AliTPCParam object
50 // by setting the flag;
52 // AliL3Transform::Init(path,kTRUE);
54 // where path is a char*
55 // either providing the rootfile containing the geometry or
56 // the path to the rootfile which should then be called alirunfile.root.
57 // Note that for both cases you have to
58 // compile with USEPACKAGE=ALIROOT set (see level3code/Makefile.conf).
62 ClassImp(AliL3Transform)
64 // Defined by HLT group
65 Int_t AliL3Transform::fRows[6][2] = {{0,29},{30,62},{63,90},{91,116},{117,139},{140,158}}; //Defined by us and GSI
66 Int_t AliL3Transform::fNRows[6] = {30,33,28,26,23,19}; //Defined by us and GSI
67 Double_t AliL3Transform::fAnodeWireSpacing = 0.25; //Taken from the TDR
69 // The following definition is generated by Make_Init macro in exa
70 const Double_t AliL3Transform::fBFACT = 0.0029980;
71 Double_t AliL3Transform::fBField = 0.2;
72 Int_t AliL3Transform::fVersion = 0;
73 Int_t AliL3Transform::fNPatches = 6;
74 Int_t AliL3Transform::fBFieldFactor = 1 ;
75 Int_t AliL3Transform::fNTimeBins = 446 ;
76 Int_t AliL3Transform::fNRowLow = 63 ;
77 Int_t AliL3Transform::fNRowUp = 96 ;
78 Int_t AliL3Transform::fNRowUp1 = 64 ;
79 Int_t AliL3Transform::fNRowUp2 = 32 ;
80 Int_t AliL3Transform::fNSectorLow = 36 ;
81 Int_t AliL3Transform::fNSectorUp = 36 ;
82 Int_t AliL3Transform::fNSector = 72 ;
83 Double_t AliL3Transform::fPadPitchWidthLow = 0.400000 ;
84 Double_t AliL3Transform::fPadPitchWidthUp = 0.600000 ;
85 Double_t AliL3Transform::fZWidth = 0.56599998474121093750 ;
86 Double_t AliL3Transform::fZSigma = 0.22880849748219134199 ;
87 Double_t AliL3Transform::fZLength = 250.00000000000000000000 ;
88 Double_t AliL3Transform::fZOffset = 0.68642549244657402596 ;
89 Double_t AliL3Transform::fDiffT = 0.02199999988079071045 ;
90 Double_t AliL3Transform::fDiffL = 0.02199999988079071045 ;
91 Double_t AliL3Transform::fInnerPadLength = 0.750000 ;
92 Double_t AliL3Transform::fOuter1PadLength = 1.000000 ;
93 Double_t AliL3Transform::fOuter2PadLength = 1.500000 ;
94 Double_t AliL3Transform::fInnerPRFSigma = 0.20381128787994384766 ;
95 Double_t AliL3Transform::fOuter1PRFSigma = 0.29932481050491333008 ;
96 Double_t AliL3Transform::fOuter2PRFSigma = 0.29932320117950439453 ;
97 Double_t AliL3Transform::fTimeSigma = 0.22880862653255462646 ;
98 Int_t AliL3Transform::fNSlice = 36 ;
99 Int_t AliL3Transform::fNRow = 159 ;
100 Double_t AliL3Transform::fNRotShift = 0.5 ;
101 Double_t AliL3Transform::fPi = 3.141592653589793 ;
102 Double_t AliL3Transform::fX[159] = {85.194999694824219,
263 Int_t AliL3Transform::fNPads[159] = {67,
424 Bool_t AliL3Transform::Init(Char_t* path,Bool_t UseAliTPCParam)
426 //Overwrite the parameters with values stored in file "l3transform.config" in path.
427 //If file does not exist, old default values will be used.
428 //If flag UseAliTPCParam is set, the parameters will be read from the the rootfile
429 //which then has to be called path/digitfile.root
432 LOG(AliL3Log::kWarning,"AliL3Transform::Init","Init values")
433 <<"You are initializing the parameters more than once; check your code please! "<<fVersion<<ENDLOG;
437 return ReadInit(path);
440 Char_t *pathname=new Char_t[1024];
441 strcpy(pathname,path);
442 strcat(pathname,"/l3transform.config");
444 FILE *fptr=fopen(pathname,"r");
446 LOG(AliL3Log::kWarning,"AliL3Transform::Init","File Open")
447 <<"Pointer to Config File \""<<pathname<<"\" 0x0!"<<ENDLOG;
451 Char_t d1[250], d2[100], d3[100];
456 fscanf(fptr,"%s",d1);
458 if(strcmp(d1,"fBFieldFactor")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fBFieldFactor=(Int_t)dummy;fBField=fBFieldFactor*0.2;}
459 else if(strcmp(d1,"fNTimeBins")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNTimeBins=(Int_t)dummy;}
460 else if(strcmp(d1,"fNRowLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowLow=(Int_t)dummy;}
462 LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow")
463 <<"Number of inner PadRows should be 63! Check and fgrep the code for 63 to see the consequences of this major change!"<<ENDLOG;
464 else if(strcmp(d1,"fNRowUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp=(Int_t)dummy;}
465 else if(strcmp(d1,"fNRowUp1")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp1=(Int_t)dummy;}
466 else if(strcmp(d1,"fNRowUp2")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp2=(Int_t)dummy;}
467 else if(strcmp(d1,"fNSectorLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorLow=(Int_t)dummy;}
468 else if(strcmp(d1,"fNSectorUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorUp=(Int_t)dummy;}
469 else if(strcmp(d1,"fNSector")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSector=(Int_t)dummy;}
470 else if(strcmp(d1,"fPadPitchWidthLow")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthLow=(Double_t)ddummy;}
471 else if(strcmp(d1,"fPadPitchWidthUp")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthUp=(Double_t)ddummy;}
472 else if(strcmp(d1,"fZWidth")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZWidth=(Double_t)ddummy;}
473 else if(strcmp(d1,"fZSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZSigma=(Double_t)ddummy;}
474 else if(strcmp(d1,"fZLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZLength=(Double_t)ddummy;}
475 else if(strcmp(d1,"fZOffset")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZOffset=(Double_t)ddummy;}
476 else if(strcmp(d1,"fNSlice")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSlice=(Int_t)dummy;}
477 else if(strcmp(d1,"fDiffT")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffT=(Double_t)ddummy;}
478 else if(strcmp(d1,"fDiffL")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffL=(Double_t)ddummy;}
479 else if(strcmp(d1,"fInnerPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPadLength=(Double_t)ddummy;}
480 else if(strcmp(d1,"fOuter1PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PadLength=(Double_t)ddummy;}
481 else if(strcmp(d1,"fOuter2PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PadLength=(Double_t)ddummy;}
482 else if(strcmp(d1,"fInnerPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPRFSigma=(Double_t)ddummy;}
483 else if(strcmp(d1,"fOuter1PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PRFSigma=(Double_t)ddummy;}
484 else if(strcmp(d1,"fOuter2PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PRFSigma=(Double_t)ddummy;}
485 else if(strcmp(d1,"fTimeSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fTimeSigma=(Double_t)ddummy;}
486 else if(strcmp(d1,"fNRow")==0){
487 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRow=(Int_t)dummy;
489 LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow")<<"Number of PadRows should be 159! Check and fgrep the code for 159 to see the consequences of this major change!"<<ENDLOG;
492 else if(strcmp(d1,"fNRotShift")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fNRotShift=(Double_t)ddummy;}
493 else if(strcmp(d1,"fPi")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPi=(Double_t)ddummy;}
494 else if(strcmp(d1,"fX[0]")==0){
495 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fX[0]=(Double_t)ddummy;
496 for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fX[i]=(Double_t)ddummy;}
498 else if(strcmp(d1,"fNPads[0]")==0){
499 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNPads[0]=(Int_t)dummy;
500 for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fNPads[i]=(Int_t)dummy;}
506 fVersion++; //new version
511 Bool_t AliL3Transform::ReadInit(Char_t *path)
513 //Read all the parameters from a aliroot file, and store it in a temporary
514 //file which is read by Init. Use this if you want to read the parameters from
515 //the rootfile "every" time.
518 LOG(AliL3Log::kError,"AliL3Transform::ReadInit","Version")
519 <<"You have to compile with use_aliroot flag in order to read from AliROOT file"<<ENDLOG;
522 Char_t filename[1024];
523 //first test whether provided path is the rootfile itself
524 TFile *rootfile = TFile::Open(path);
525 if(!rootfile) //ok assume its path to file
527 sprintf(filename,"%s/alirunfile.root",path); //create rootfile name
530 sprintf(filename,"%s",path); //path contains itself the rootfile name
532 //finally make dummy init file /tmp/l3transform.config
533 if(MakeInitFile(filename,"/tmp/"))
535 Bool_t ret=Init("/tmp/");
536 //Move the temp file to /tmp/l3transform.config-"time in seconds"
539 sprintf(filename,"/tmp/l3transform.config-%ld",(long)time.GetSec());
540 sys.Rename("/tmp/l3transform.config",filename);
548 Bool_t AliL3Transform::MakeInitFile(Char_t *filename,Char_t *path)
550 //Get the parameters from rootfile, and store it on the file "l3transform.config"
551 //which is being read by Init.
554 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","Version")
555 <<"You have to compile with use_aliroot flag in order to use this function"<<ENDLOG;
558 TFile *rootfile = TFile::Open(filename);
561 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
562 <<"Could not open file: "<<filename<<ENDLOG;
565 AliRun *gAlice = (AliRun*)rootfile->Get("gAlice");
568 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
569 <<"No gAlice in file: "<<filename<<ENDLOG;
572 AliTPCParamSR *param=(AliTPCParamSR*)rootfile->Get(GetParamName());
575 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
576 <<"No TPC parameters found"<<ENDLOG;
580 AliTPCPRF2D * prfinner = new AliTPCPRF2D;
581 AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
582 AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
583 AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
584 rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
585 rf->SetOffset(3*param->GetZSigma());
588 TDirectory *savedir=gDirectory;
589 TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
590 if (!prf_file->IsOpen())
592 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
593 <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG;
596 prfinner->Read("prf_07504_Gati_056068_d02");
597 prfouter1->Read("prf_10006_Gati_047051_d03");
598 prfouter2->Read("prf_15006_Gati_047051_d03");
602 param->SetInnerPRF(prfinner);
603 param->SetOuter1PRF(prfouter1);
604 param->SetOuter2PRF(prfouter2);
605 param->SetTimeRF(rf);
607 Int_t nTimeBins = param->GetMaxTBin()+1;
608 Int_t nRowLow = param->GetNRowLow();
609 Int_t nRowUp = param->GetNRowUp();
610 Int_t nRowUp1 = param->GetNRowUp1();
611 Int_t nRowUp2 = param->GetNRowUp2();
612 Int_t nRow= fNRowLow + fNRowUp;
613 Int_t nSectorLow = param->GetNInnerSector();
614 Int_t nSectorUp = param->GetNOuterSector();
615 Int_t nSector = fNSectorLow + fNSectorUp;
618 sprintf(tofile,"%s/l3transform.config",path);
619 FILE *f = fopen(tofile,"w");
620 fprintf(f,"void AliL3Transform::Init(){\n");
622 fprintf(f," fBFieldFactor = %d ;\n",(Int_t)gAlice->Field()->Factor());
623 fprintf(f," //sector:\n");
624 fprintf(f," fNTimeBins = %d ;\n",nTimeBins);
625 fprintf(f," fNRowLow = %d ;\n",nRowLow);
626 fprintf(f," fNRowUp = %d ;\n",nRowUp);
627 fprintf(f," fNRowUp1 = %d ;\n",nRowUp1);
628 fprintf(f," fNRowUp2 = %d ;\n",nRowUp2);
629 fprintf(f," fNSectorLow = %d ;\n",nSectorLow);
630 fprintf(f," fNSectorUp = %d ;\n",nSectorUp);
631 fprintf(f," fNSector = %d ;\n",nSector);
632 fprintf(f," fPadPitchWidthLow = %f ;\n",param->GetInnerPadPitchWidth());
633 fprintf(f," fPadPitchWidthUp = %f ;\n",param->GetOuterPadPitchWidth());
634 fprintf(f," fZWidth = %.20f ;\n",param->GetZWidth());
635 fprintf(f," fZSigma = %.20f ;\n",param->GetZSigma());
636 fprintf(f," fZLength = %.20f ;\n",param->GetZLength());
637 fprintf(f," fZOffset = %.20f ;\n",param->GetZOffset());
638 fprintf(f," fDiffT = %.20f ;\n",param->GetDiffT());
639 fprintf(f," fDiffL = %.20f ;\n",param->GetDiffL());
640 fprintf(f," fInnerPadLength = %f ;\n",param->GetInnerPadLength());
641 fprintf(f," fOuter1PadLength = %f ;\n",param->GetOuter1PadLength());
642 fprintf(f," fOuter2PadLength = %f ;\n",param->GetOuter2PadLength());
643 fprintf(f," fInnerPRFSigma = %.20f ;\n",param->GetInnerPRF()->GetSigmaX());
644 fprintf(f," fOuter1PRFSigma = %.20f ;\n",param->GetOuter1PRF()->GetSigmaX());
645 fprintf(f," fOuter2PRFSigma = %.20f ;\n",param->GetOuter2PRF()->GetSigmaX());
647 fprintf(f," fTimeSigma = %.20f ;\n",param->GetTimeRF()->GetSigma());
649 fprintf(f,"\n //slices:\n");
650 fprintf(f," fNSlice = %d ;\n",nSectorLow);
651 fprintf(f," fNRow = %d ;\n",nRow);
653 //rotation shift put in by hand -> Constantin
654 fprintf(f," fNRotShift = 0.5 ;\n");
656 fprintf(f," fPi = %.15f ;\n",TMath::Pi());
658 for(Int_t i=0;i<nRow;i++){
660 if( i < nRowLow){sec =0;row =i;}
661 else{sec = nSectorLow;row =i-nRowLow;}
662 fprintf(f," fX[%d] = %3.15f ;\n",i,param->GetPadRowRadii(sec,row));
664 for(Int_t i=0;i<nRow;i++){
666 if( i < nRowLow){sec =0;row =i;}
667 else{sec = nSectorLow;row =i-nRowLow;}
668 fprintf(f," fNPads[%d] = %d ;\n",i,param->GetNPads(sec,row));
678 Double_t AliL3Transform::GetPadLength(Int_t padrow)
682 if(padrow < fNRowLow)
683 return fInnerPadLength;
684 if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1)
685 return fOuter1PadLength;
686 if(padrow >= fNRowLow + fNRowUp1 - 1)
687 return fOuter2PadLength;
689 return -1.0; //should never happen
692 Double_t AliL3Transform::GetPRFSigma(Int_t padrow)
696 if(padrow < fNRowLow)
697 return fInnerPRFSigma;
698 if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1)
699 return fOuter1PRFSigma;
700 if(padrow >= fNRowLow + fNRowUp1 - 1)
701 return fOuter2PRFSigma;
703 return -1.; //should never happen
706 Double_t AliL3Transform::GetEta(Float_t *xyz)
708 Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
709 Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2]));
713 void AliL3Transform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz)
715 rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
716 rpe[1] = atan2(xyz[1],xyz[0]);
717 rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2]));
720 Double_t AliL3Transform::GetEta(Int_t padrow,Int_t pad,Int_t time)
724 Slice2Sector(0,padrow,sector,row);
725 Raw2Local(xyz,sector,row,pad,time);
730 Double_t AliL3Transform::GetPhi(Float_t *xyz)
732 Double_t phi = atan2(xyz[1],xyz[0]);
733 //if(phi<0) phi=phi+2*TMath::Pi();
737 Bool_t AliL3Transform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row)
739 if(slicerow<0&&slicerow>=fNRow) return kFALSE;
740 if(slice<0||slice>=fNSlice) return kFALSE;
742 if(slicerow<fNRowLow){
747 sector = slice+fNSlice;
748 row = slicerow-fNRowLow;
753 Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t sector)
755 if(sector<0||sector>=fNSector) return kFALSE;
756 if(sector<fNSectorLow) slice = sector;
757 else slice = sector - fNSectorLow;
761 Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t & slicerow,Int_t sector, Int_t row)
763 if(sector<0||sector>=fNSector||row<0) return kFALSE;
764 if(sector<fNSectorLow){
765 if(row>=fNRowLow) return kFALSE;
770 if(row>=fNRowUp) return kFALSE;
771 slice = sector - fNSectorLow;
772 slicerow = row + fNRowLow;
777 Double_t AliL3Transform::Row2X(Int_t slicerow){
778 if(slicerow<0||slicerow>=fNRow) return 0;
782 void AliL3Transform::Local2Global(Float_t *xyz,Int_t slice)
784 //Transformation to global coordinate system
788 cs = cos( (2*fPi/18) * (slice+fNRotShift) );
789 sn = sin( (2*fPi/18) * (slice+fNRotShift) );
792 xyz[2]=xyz[2];//global z=local z
795 void AliL3Transform::Local2GlobalAngle(Float_t *angle,Int_t slice){
796 angle[0] = fmod(angle[0]+(slice+fNRotShift)*(2*fPi/18),2*fPi);
799 void AliL3Transform::Global2LocalAngle(Float_t *angle,Int_t slice){
800 angle[0] = angle[0]-(slice+fNRotShift)*(2*fPi/18);
801 if(angle[0]<0) angle[0]+=2*fPi;
804 void AliL3Transform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
806 //Transformation from rawdata to local coordinate system
808 Int_t slice,slicerow;
809 Sector2Slice(slice, slicerow, sector, row);
812 xyz[0]=Row2X(slicerow);
815 Int_t npads= fNPads[slicerow];
816 if(sector<fNSectorLow)
817 xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthLow;
819 xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthUp;
821 //Z-Value (remember PULSA Delay)
822 //xyz[2]=fZWidth*time-3.*fZSigma;
823 xyz[2]=fZWidth*time-fZOffset;
825 xyz[2]=fZLength-xyz[2];
827 xyz[2]=xyz[2]-fZLength;
831 void AliL3Transform::Local2Global(Float_t *xyz,Int_t sector,Int_t row)
833 //Transformation to global coordinate system
834 Int_t slice,slicerow;
835 Sector2Slice(slice, slicerow, sector, row);
836 Float_t r=Row2X(slicerow);
837 Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) );
838 Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) );
840 xyz[0]=r*cs-xyz[1]*sn;
841 xyz[1]=r*sn+xyz[1]*cs;
842 xyz[2]=xyz[2];//global z=local z
845 Double_t AliL3Transform::GetMaxY(Int_t slicerow)
848 if(slicerow < fNRowLow)
849 return fPadPitchWidthLow*fNPads[slicerow]/2;
852 return fPadPitchWidthUp*fNPads[slicerow]/2;
856 void AliL3Transform::Global2Local(Float_t *xyz,Int_t sector,Bool_t isSlice)
861 Sector2Slice(slice, sector);
864 Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) );
865 Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) );
866 Float_t x1 = xyz[0]*cs + xyz[1]*sn;
867 Float_t y1 = -xyz[0]*sn + xyz[1]*cs;
872 void AliL3Transform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
874 //Transformation from raw to global coordinates
876 Raw2Local(xyz,sector,row,pad,time);
877 Local2Global(xyz,sector,row);
880 void AliL3Transform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row)
882 //Transformation from local coordinates to raw
884 Int_t slice,slicerow;
885 Sector2Slice(slice, slicerow, sector, row);
887 if(sector<fNSectorLow)
888 xyz[1]=xyz[1]/fPadPitchWidthLow+0.5*(fNPads[slicerow]-1);
890 xyz[1]=xyz[1]/fPadPitchWidthUp+0.5*(fNPads[slicerow]-1);
892 Int_t nis=fNSectorLow;
893 Int_t nos=fNSectorUp;
895 if ((sector<nis/2) || ((sector-nis)<nos/2)) sign=1;
896 xyz[2]=fZLength-sign*xyz[2];
897 xyz[2]=(xyz[2]+fZOffset)/fZWidth;
901 void AliL3Transform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row)
903 //Transformation from global coordinates to raw.
905 Global2Local(xyz,sector);
906 Local2Raw(xyz,sector,row);