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 of these 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::fADCSat = 1023;
99 Int_t AliL3Transform::fNSlice = 36 ;
100 Int_t AliL3Transform::fNRow = 159 ;
101 Double_t AliL3Transform::fNRotShift = 0.5 ;
102 Double_t AliL3Transform::fPi = 3.141592653589793 ;
103 Double_t AliL3Transform::fX[159] = {85.194999694824219,
264 Int_t AliL3Transform::fNPads[159] = {67,
425 Bool_t AliL3Transform::Init(Char_t* path,Bool_t UseAliTPCParam)
427 //Overwrite the parameters with values stored in file "l3transform.config" in path.
428 //If file does not exist, old default values will be used.
429 //If flag UseAliTPCParam is set, the parameters will be read from the the rootfile
430 //which then has to be called path/digitfile.root
433 LOG(AliL3Log::kWarning,"AliL3Transform::Init","Init values")
434 <<"You are initializing the parameters more than once; check your code please! "<<fVersion<<ENDLOG;
438 return ReadInit(path);
441 Char_t *pathname=new Char_t[1024];
442 strcpy(pathname,path);
443 strcat(pathname,"/l3transform.config");
445 FILE *fptr=fopen(pathname,"r");
447 LOG(AliL3Log::kWarning,"AliL3Transform::Init","File Open")
448 <<"Pointer to Config File \""<<pathname<<"\" 0x0!"<<ENDLOG;
452 Char_t d1[250], d2[100], d3[100];
457 fscanf(fptr,"%s",d1);
459 if(strcmp(d1,"fBFieldFactor")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fBFieldFactor=(Int_t)dummy;fBField=fBFieldFactor*0.2;}
460 else if(strcmp(d1,"fNTimeBins")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNTimeBins=(Int_t)dummy;}
461 else if(strcmp(d1,"fNRowLow")==0)
463 fscanf(fptr,"%s %d %s",d2,&dummy,d3);
464 fNRowLow=(Int_t)dummy;
466 LOG(AliL3Log::kError,"AliL3Transform::Init","Overflow")
467 <<"Number of inner PadRows should be 63! Check and fgrep the code for 63 to see the consequences of this major change!"<<ENDLOG;
469 else if(strcmp(d1,"fNRowUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp=(Int_t)dummy;}
470 else if(strcmp(d1,"fNRowUp1")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp1=(Int_t)dummy;}
471 else if(strcmp(d1,"fNRowUp2")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRowUp2=(Int_t)dummy;}
472 else if(strcmp(d1,"fNSectorLow")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorLow=(Int_t)dummy;}
473 else if(strcmp(d1,"fNSectorUp")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSectorUp=(Int_t)dummy;}
474 else if(strcmp(d1,"fNSector")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSector=(Int_t)dummy;}
475 else if(strcmp(d1,"fPadPitchWidthLow")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthLow=(Double_t)ddummy;}
476 else if(strcmp(d1,"fPadPitchWidthUp")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPadPitchWidthUp=(Double_t)ddummy;}
477 else if(strcmp(d1,"fZWidth")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZWidth=(Double_t)ddummy;}
478 else if(strcmp(d1,"fZSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZSigma=(Double_t)ddummy;}
479 else if(strcmp(d1,"fZLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZLength=(Double_t)ddummy;}
480 else if(strcmp(d1,"fZOffset")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fZOffset=(Double_t)ddummy;}
481 else if(strcmp(d1,"fNSlice")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNSlice=(Int_t)dummy;}
482 else if(strcmp(d1,"fDiffT")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffT=(Double_t)ddummy;}
483 else if(strcmp(d1,"fDiffL")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fDiffL=(Double_t)ddummy;}
484 else if(strcmp(d1,"fInnerPadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPadLength=(Double_t)ddummy;}
485 else if(strcmp(d1,"fOuter1PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PadLength=(Double_t)ddummy;}
486 else if(strcmp(d1,"fOuter2PadLength")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PadLength=(Double_t)ddummy;}
487 else if(strcmp(d1,"fInnerPRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fInnerPRFSigma=(Double_t)ddummy;}
488 else if(strcmp(d1,"fOuter1PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter1PRFSigma=(Double_t)ddummy;}
489 else if(strcmp(d1,"fOuter2PRFSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fOuter2PRFSigma=(Double_t)ddummy;}
490 else if(strcmp(d1,"fTimeSigma")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fTimeSigma=(Double_t)ddummy;}
491 else if(strcmp(d1,"fADCSat")==0){fscanf(fptr,"%s %d %s",d2,&dummy,d3);fADCSat=(Int_t)dummy;}
492 else if(strcmp(d1,"fNRow")==0){
493 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNRow=(Int_t)dummy;
495 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;
498 else if(strcmp(d1,"fNRotShift")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fNRotShift=(Double_t)ddummy;}
499 else if(strcmp(d1,"fPi")==0){fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fPi=(Double_t)ddummy;}
500 else if(strcmp(d1,"fX[0]")==0){
501 fscanf(fptr,"%s %lf %s",d2,&ddummy,d3);fX[0]=(Double_t)ddummy;
502 for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %lf %s",d1,d2,&ddummy,d3);fX[i]=(Double_t)ddummy;}
504 else if(strcmp(d1,"fNPads[0]")==0){
505 fscanf(fptr,"%s %d %s",d2,&dummy,d3);fNPads[0]=(Int_t)dummy;
506 for(Int_t i=1;i<fNRow;i++){fscanf(fptr,"%s %s %d %s",d1,d2,&dummy,d3);fNPads[i]=(Int_t)dummy;}
512 fVersion++; //new version
517 Bool_t AliL3Transform::ReadInit(Char_t *path)
519 //Read all the parameters from a aliroot file, and store it in a temporary
520 //file which is read by Init. Use this if you want to read the parameters from
521 //the rootfile "every" time.
524 LOG(AliL3Log::kError,"AliL3Transform::ReadInit","Version")
525 <<"You have to compile with use_aliroot flag in order to read from AliROOT file"<<ENDLOG;
528 Char_t filename[1024];
529 //first test whether provided path is the rootfile itself
530 TFile *rootfile = TFile::Open(path);
531 if(rootfile->IsZombie()) //ok assume its path to file
533 sprintf(filename,"%s/alirunfile.root",path); //create rootfile name
536 sprintf(filename,"%s",path); //path contains itself the rootfile name
538 //finally make dummy init file /tmp/l3transform.config
539 if(MakeInitFile(filename,"/tmp/"))
541 Bool_t ret=Init("/tmp/");
542 //Move the temp file to /tmp/l3transform.config-"time in seconds"
544 sprintf(filename,"/tmp/l3transform.config-%ld",(long)time.GetSec());
545 gSystem->Rename("/tmp/l3transform.config",filename);
553 Bool_t AliL3Transform::MakeInitFile(Char_t *filename,Char_t *path)
555 //Get the parameters from rootfile, and store it on the file "l3transform.config"
556 //which is being read by Init.
559 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","Version")
560 <<"You have to compile with use_aliroot flag in order to use this function"<<ENDLOG;
563 TFile *rootfile = TFile::Open(filename);
566 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
567 <<"Could not open file: "<<filename<<ENDLOG;
570 AliRun *gAlice = (AliRun*)rootfile->Get("gAlice");
573 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
574 <<"No gAlice in file: "<<filename<<ENDLOG;
577 AliTPCParamSR *param=(AliTPCParamSR*)rootfile->Get(GetParamName());
580 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
581 <<"No TPC parameters found"<<ENDLOG;
585 AliTPCPRF2D * prfinner = new AliTPCPRF2D;
586 AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
587 AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
588 AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
589 rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
590 rf->SetOffset(3*param->GetZSigma());
593 TDirectory *savedir=gDirectory;
594 TFile *prf_file = TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
595 if (!prf_file->IsOpen())
597 LOG(AliL3Log::kError,"AliL3Transform::MakeInitFile","File")
598 <<"Can't open $ALICE_ROOT/TPC/AliTPCprf2d.root !"<<ENDLOG;
601 prfinner ->Read("prf_07504_Gati_056068_d02");
602 prfouter1->Read("prf_10006_Gati_047051_d03");
603 prfouter2->Read("prf_15006_Gati_047051_d03");
607 param->SetInnerPRF(prfinner);
608 param->SetOuter1PRF(prfouter1);
609 param->SetOuter2PRF(prfouter2);
610 param->SetTimeRF(rf);
612 Int_t nTimeBins = param->GetMaxTBin()+1;
613 Int_t nRowLow = param->GetNRowLow();
614 Int_t nRowUp = param->GetNRowUp();
615 Int_t nRowUp1 = param->GetNRowUp1();
616 Int_t nRowUp2 = param->GetNRowUp2();
617 Int_t nRow= fNRowLow + fNRowUp;
618 Int_t nSectorLow = param->GetNInnerSector();
619 Int_t nSectorUp = param->GetNOuterSector();
620 Int_t nSector = fNSectorLow + fNSectorUp;
623 sprintf(tofile,"%s/l3transform.config",path);
624 FILE *f = fopen(tofile,"w");
625 fprintf(f,"void AliL3Transform::Init(){\n");
627 fprintf(f," fBFieldFactor = %d ;\n",(Int_t)gAlice->Field()->Factor());
628 fprintf(f," //sector:\n");
629 fprintf(f," fNTimeBins = %d ;\n",nTimeBins);
630 fprintf(f," fNRowLow = %d ;\n",nRowLow);
631 fprintf(f," fNRowUp = %d ;\n",nRowUp);
632 fprintf(f," fNRowUp1 = %d ;\n",nRowUp1);
633 fprintf(f," fNRowUp2 = %d ;\n",nRowUp2);
634 fprintf(f," fNSectorLow = %d ;\n",nSectorLow);
635 fprintf(f," fNSectorUp = %d ;\n",nSectorUp);
636 fprintf(f," fNSector = %d ;\n",nSector);
637 fprintf(f," fPadPitchWidthLow = %f ;\n",param->GetInnerPadPitchWidth());
638 fprintf(f," fPadPitchWidthUp = %f ;\n",param->GetOuterPadPitchWidth());
639 fprintf(f," fZWidth = %.20f ;\n",param->GetZWidth());
640 fprintf(f," fZSigma = %.20f ;\n",param->GetZSigma());
641 fprintf(f," fZLength = %.20f ;\n",param->GetZLength());
642 fprintf(f," fZOffset = %.20f ;\n",param->GetZOffset());
643 fprintf(f," fDiffT = %.20f ;\n",param->GetDiffT());
644 fprintf(f," fDiffL = %.20f ;\n",param->GetDiffL());
645 fprintf(f," fInnerPadLength = %f ;\n",param->GetInnerPadLength());
646 fprintf(f," fOuter1PadLength = %f ;\n",param->GetOuter1PadLength());
647 fprintf(f," fOuter2PadLength = %f ;\n",param->GetOuter2PadLength());
648 fprintf(f," fInnerPRFSigma = %.20f ;\n",param->GetInnerPRF()->GetSigmaX());
649 fprintf(f," fOuter1PRFSigma = %.20f ;\n",param->GetOuter1PRF()->GetSigmaX());
650 fprintf(f," fOuter2PRFSigma = %.20f ;\n",param->GetOuter2PRF()->GetSigmaX());
652 fprintf(f," fTimeSigma = %.20f ;\n",param->GetTimeRF()->GetSigma());
653 fprintf(f," fADCSat = %d ;\n",param->GetADCSat());
655 fprintf(f,"\n //slices:\n");
656 fprintf(f," fNSlice = %d ;\n",nSectorLow);
657 fprintf(f," fNRow = %d ;\n",nRow);
659 //rotation shift put in by hand -> Constantin
660 fprintf(f," fNRotShift = 0.5 ;\n");
662 fprintf(f," fPi = %.15f ;\n",TMath::Pi());
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," fX[%d] = %3.15f ;\n",i,param->GetPadRowRadii(sec,row));
670 for(Int_t i=0;i<nRow;i++){
672 if( i < nRowLow){sec =0;row =i;}
673 else{sec = nSectorLow;row =i-nRowLow;}
674 fprintf(f," fNPads[%d] = %d ;\n",i,param->GetNPads(sec,row));
684 Int_t AliL3Transform::GetFirstRow(Int_t patch)
688 else if(patch < -1 || patch >= 6)
690 cerr<<"AliL3Transform::GetFirstRow() : Wrong patch "<<patch<<endl;
694 return fRows[patch][0];
697 Int_t AliL3Transform::GetLastRow(Int_t patch)
701 else if(patch < -1 || patch >= 6)
703 cerr<<"AliL3Transform::GetLastRow() : Wrong patch "<<patch<<endl;
707 return fRows[patch][1];
710 Int_t AliL3Transform::GetNRows(Int_t patch)
714 else if(patch < -1 || patch >= 6)
716 cerr<<"AliL3Transform::GetNRows() : Wrong patch "<<patch<<endl;
720 return fNRows[patch];
723 Double_t AliL3Transform::GetPadLength(Int_t padrow)
727 if(padrow < fNRowLow)
728 return fInnerPadLength;
729 if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1)
730 return fOuter1PadLength;
731 if(padrow >= fNRowLow + fNRowUp1 - 1)
732 return fOuter2PadLength;
734 return -1.0; //should never happen
737 Double_t AliL3Transform::GetPRFSigma(Int_t padrow)
741 if(padrow < fNRowLow)
742 return fInnerPRFSigma;
743 if(padrow >= fNRowLow && padrow < fNRowLow + fNRowUp1 - 1)
744 return fOuter1PRFSigma;
745 if(padrow >= fNRowLow + fNRowUp1 - 1)
746 return fOuter2PRFSigma;
748 return -1.; //should never happen
751 Double_t AliL3Transform::GetEta(Float_t *xyz)
753 Double_t r3 = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
754 Double_t eta = 0.5 * log((r3+xyz[2])/(r3-xyz[2]));
758 void AliL3Transform::XYZtoRPhiEta(Float_t *rpe, Float_t *xyz)
760 rpe[0] = sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]+xyz[2]*xyz[2]);
761 rpe[1] = atan2(xyz[1],xyz[0]);
762 rpe[2] = 0.5 * log((rpe[0]+xyz[2])/(rpe[0]-xyz[2]));
765 Double_t AliL3Transform::GetEta(Int_t padrow,Int_t pad,Int_t time)
769 Slice2Sector(0,padrow,sector,row);
770 Raw2Local(xyz,sector,row,pad,time);
775 Double_t AliL3Transform::GetPhi(Float_t *xyz)
777 Double_t phi = atan2(xyz[1],xyz[0]);
778 //if(phi<0) phi=phi+2*TMath::Pi();
782 Bool_t AliL3Transform::Slice2Sector(Int_t slice, Int_t slicerow, Int_t & sector, Int_t &row)
784 if(slicerow<0&&slicerow>=fNRow) return kFALSE;
785 if(slice<0||slice>=fNSlice) return kFALSE;
787 if(slicerow<fNRowLow){
792 sector = slice+fNSlice;
793 row = slicerow-fNRowLow;
798 Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t sector)
800 if(sector<0||sector>=fNSector) return kFALSE;
801 if(sector<fNSectorLow) slice = sector;
802 else slice = sector - fNSectorLow;
806 Bool_t AliL3Transform::Sector2Slice(Int_t & slice, Int_t & slicerow,Int_t sector, Int_t row)
808 if(sector<0||sector>=fNSector||row<0) return kFALSE;
809 if(sector<fNSectorLow){
810 if(row>=fNRowLow) return kFALSE;
815 if(row>=fNRowUp) return kFALSE;
816 slice = sector - fNSectorLow;
817 slicerow = row + fNRowLow;
822 Double_t AliL3Transform::Row2X(Int_t slicerow){
823 if(slicerow<0||slicerow>=fNRow) return 0;
827 void AliL3Transform::Local2Global(Float_t *xyz,Int_t slice)
829 //Transformation to global coordinate system
833 cs = cos( (2*fPi/18) * (slice+fNRotShift) );
834 sn = sin( (2*fPi/18) * (slice+fNRotShift) );
837 xyz[2]=xyz[2];//global z=local z
840 void AliL3Transform::Local2GlobalAngle(Float_t *angle,Int_t slice){
841 angle[0] = fmod(angle[0]+(slice+fNRotShift)*(2*fPi/18),2*fPi);
844 void AliL3Transform::Global2LocalAngle(Float_t *angle,Int_t slice){
845 angle[0] = angle[0]-(slice+fNRotShift)*(2*fPi/18);
846 if(angle[0]<0) angle[0]+=2*fPi;
849 void AliL3Transform::Raw2Local(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
851 //Transformation from rawdata to local coordinate system
853 Int_t slice,slicerow;
854 Sector2Slice(slice, slicerow, sector, row);
857 xyz[0]=Row2X(slicerow);
860 Int_t npads= fNPads[slicerow];
861 if(sector<fNSectorLow)
862 xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthLow;
864 xyz[1]=(pad-0.5*(npads-1))*fPadPitchWidthUp;
866 //Z-Value (remember PULSA Delay)
867 //xyz[2]=fZWidth*time-3.*fZSigma;
868 xyz[2]=fZWidth*time-fZOffset;
870 xyz[2]=fZLength-xyz[2];
872 xyz[2]=xyz[2]-fZLength;
876 void AliL3Transform::Local2Global(Float_t *xyz,Int_t sector,Int_t row)
878 //Transformation to global coordinate system
879 Int_t slice,slicerow;
880 Sector2Slice(slice, slicerow, sector, row);
881 Float_t r=Row2X(slicerow);
882 Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) );
883 Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) );
885 xyz[0]=r*cs-xyz[1]*sn;
886 xyz[1]=r*sn+xyz[1]*cs;
887 xyz[2]=xyz[2];//global z=local z
890 Double_t AliL3Transform::GetMaxY(Int_t slicerow)
893 if(slicerow < fNRowLow)
894 return fPadPitchWidthLow*fNPads[slicerow]/2;
897 return fPadPitchWidthUp*fNPads[slicerow]/2;
901 void AliL3Transform::Global2Local(Float_t *xyz,Int_t sector,Bool_t isSlice)
906 Sector2Slice(slice, sector);
909 Float_t cs = cos( (2*fPi/18) * (slice+fNRotShift) );
910 Float_t sn = sin( (2*fPi/18) * (slice+fNRotShift) );
911 Float_t x1 = xyz[0]*cs + xyz[1]*sn;
912 Float_t y1 = -xyz[0]*sn + xyz[1]*cs;
917 void AliL3Transform::Raw2Global(Float_t *xyz,Int_t sector,Int_t row,Float_t pad,Float_t time)
919 //Transformation from raw to global coordinates
921 Raw2Local(xyz,sector,row,pad,time);
922 Local2Global(xyz,sector,row);
925 void AliL3Transform::Local2Raw(Float_t *xyz,Int_t sector,Int_t row)
927 //Transformation from local coordinates to raw
929 Int_t slice,slicerow;
930 Sector2Slice(slice, slicerow, sector, row);
932 if(sector<fNSectorLow)
933 xyz[1]=xyz[1]/fPadPitchWidthLow+0.5*(fNPads[slicerow]-1);
935 xyz[1]=xyz[1]/fPadPitchWidthUp+0.5*(fNPads[slicerow]-1);
938 //Int_t nis=fNSectorLow;
939 //Int_t nos=fNSectorUp;
940 //if ((sector<nis/2) || ((sector-nis)<nos/2)) sign=1;
942 if(slice < 18) sign = 1;
943 xyz[2]=fZLength-sign*xyz[2];
944 xyz[2]=(xyz[2]+fZOffset)/fZWidth;
948 void AliL3Transform::Global2Raw(Float_t *xyz,Int_t sector,Int_t row)
950 //Transformation from global coordinates to raw.
952 Global2Local(xyz,sector);
953 Local2Raw(xyz,sector,row);