still be found in ITS-working.
+++ /dev/null
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-/* $Id$ */
-/* $Author$ */
-/* $Date$ */
-/* $Name$ */
-/* $Header$ */
-/*
- $Log$
- Revision 1.1.2.3 2000/06/04 16:35:09 nilsen
- One more try to fix log comments.
-
- Revision 1.1.2.2 2000/03/04 23:39:36 nilsen
- Fixed the logs???
- */
-/* Revision 1.1.2.1 2000/03/02 20:12:23 nilsen */
-/* A new class usefull for ITS detector Alignment Studdies */
-/* */
-/* $Revision$ */
-
-// Standard C & C++ libraries
-#include <TObject.h>
-
-// Standard Root Libraries
-#include <TParticle.h>
-
-// ITS libraries
-#include "AliITSgeom.h"
-#include "AliITSAlignmentTrack.h"
-#include "AliITSAlignmentModule.h"
-
-ClassImp(AliITSAlignmentModule)
-
-//______________________________________________________________________
-AliITSAlignmentModule::AliITSAlignmentModule(){
-
- findex = -1;
- flay = -1;
- flad = -1;
- fdet = -1;
- fx0[0] = 0.0;
- fx0[1] = 0.0;
- fx0[2] = 0.0;
- fangles[0] = 0.0;
- fangles[1] = 0.0;
- fangles[2] = 0.0;
- fM[0][0] = 0.0;
- fM[0][1] = 0.0;
- fM[0][2] = 0.0;
- fM[1][0] = 0.0;
- fM[1][1] = 0.0;
- fM[1][2] = 0.0;
- fM[2][0] = 0.0;
- fM[2][1] = 0.0;
- fM[2][2] = 0.0;
- ftrksM =0;
- fChi2 = 0.0;
-}
-//______________________________________________________________________
-AliITSAlignmentModule::AliITSAlignmentModule(Int_t index,AliITSgeom *gm,
- Int_t ntrk,AliITSAlignmentTrack *trk){
- Float_t x,y,z,n;
- Int_t i,j;
-
- findex = index;
- gm->GetModuleId(index,flay,flad,fdet);
- gm->GetRotMatrix(index,(Double_t *) &(fM[0][0]));
- gm->GetTrans(flay,flad,fdet,x,y,z);
- fx0[0] = (Double_t )x;
- fx0[1] = (Double_t )y;
- fx0[2] = (Double_t )z;
- gm->GetAngles(flay,flad,fdet,x,y,z);
- fangles[0] = (Double_t )x;
- fangles[1] = (Double_t )y;
- fangles[2] = (Double_t )z;
- ftrksM = new TObjArray();
- fChi2 = 0.0;
-
- for(i=0;i<ntrk;i++){
- n = 0;
- for(j=0;j<trk[i].GetNumberOfClustersSl();j++){
- if(trk[i].GetIndex(j,index)==findex){
- ftrksM->AddAtFree((TObject *) &trk[i]);
- break; // break out of the j loop
- } // end if
- } // end for j
- } // end for i
-}
-//______________________________________________________________________
-Double_t AliITSAlignmentModule::ComputeChi2(){
- Float_t n;
- Int_t i,j,ntrk,ntr;
-
- ntrk = ftrksM->GetEntriesFast();
- fChi2 = 0.0;
- for(i=0;i<ntrk;i++){
- n = 0;
- ntr =((AliITSAlignmentTrack *)(ftrksM->At(i)))->GetNumberOfClustersSl();
- for(j=0;j<ntr;j++){
- fChi2 += (Double_t) ((AliITSAlignmentTrack *)(ftrksM->At(i)))->
- GetChi2();
- n++;
- } // end for j
- if(n==0){
- fChi2 = -1.0;
- }else{
- fChi2 /= (Double_t) n;
- } // end if n==0
- } // end for i
- return fChi2;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::lnsrch(Int_t npar,Double_t *xold,Double_t fold,
- Double_t *g,Double_t *p,Double_t *x,
- Double_t &f, Double_t stpmax,Int_t &check){
- Double_t ALF = 1.0e-4, TOLX = 1.0E-7;
-
- Int_t i;
- Double_t a,alam,alam2=0.0,alamin,b,disc,f2=0.0,rhs1,rhs2,slope,sum,temp,
- test,tmplam;
-
- check = 0;
- for(sum=0.0,i=0;i<npar;i++) sum += p[i]*p[i];
- sum = TMath::Sqrt(sum);
- if(sum>stpmax) for(i=0;i<npar;i++) p[i] *= stpmax/sum;
- for(slope=0.0,i=0;i<npar;i++) slope += g[i]*p[i];
- if(slope >=0.0) printf("Error: round off problem in lnsrch.\n");
- test = 0.0;
- for(i=0;i<npar;i++){
- temp = TMath::Abs(p[i])/TMath::Max(TMath::Abs(xold[i]),1.0);
- if(temp > test) test = temp;
- } // end for i
- alamin = TOLX/test;
- alam = 1.0;
- for(;;){
- for(i=0;i<npar;i++) x[i] = xold[i] + alam*p[i];
- f = Chi2(x);
- if(alam < alamin){
- for(i=0;i<npar;i++) x[i] = xold[i];
- check = 1;
- return;
- }else if(f <= fold+ALF*alam*slope) return;
- else{
- if(alam == 1.0) tmplam = -slope/(2.0*(f-fold-slope));
- else{
- rhs1 = f-fold-alam*slope;
- rhs2 = f2-fold-alam2*slope;
- a = (rhs1/(alam*alam)-rhs2/(alam2*alam2))/(alam-alam2);
- b = (-alam2*rhs1/(alam*alam)+alam*rhs2/(alam2*alam2))/(alam*alam);
- if(a==0.0) tmplam = -slope/(2.0*b);
- else{
- disc = b*b - 3.0*a*slope;
- if(disc<0.0) tmplam = 0.5*alam;
- else if(b<=0.0) tmplam = (-b+TMath::Sqrt(disc))/(3.0*a);
- else tmplam = -slope/(b+TMath::Sqrt(disc));
- } // end if a == 0.0
- if(tmplam > 0.5*alam) tmplam = 0.5*alam;
- } // end if alam == 1.0
- } // end if alam < alamin
- alam2 = alam;
- f2 = f;
- alam = TMath::Max(tmplam,0.1*alam);
- } // end for ever loop
-
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::MRVMminimization(Int_t npar,Double_t *p,
- Double_t &fret,Double_t gtol,
- Int_t &iter){
- Int_t ITMAX = 200;
- Double_t EPS = 3.0e-8, TOLX = 4.0*EPS, STPMX = 100.0;
-
- Int_t check,i,its,j;
- Double_t den,fac,fad,fae,fp,stpmax,sum=0.0,sumdg,sumxi,temp,test;
- Double_t *dg,*g,*hdg,**hessin,*pnew,*xi;
-
- // allocate space.
- dg = new Double_t[npar];
- g = new Double_t[npar];
- hdg = new Double_t[npar];
- hessin = new Double_t * [npar];
- for(i=0;i<npar;i++) hessin[i] = new Double_t[npar];
- pnew = new Double_t[npar];
- xi = new Double_t[npar];
-
- // init function values
- fp = Chi2(p);
- dChi2(p,g);
-
- for(i=0;i<npar;i++){
- for(j=0;j<npar;j++) hessin[i][j] = 0.0;
- hessin[i][i] = 1.0;
- xi[i] = -g[i];
- sum += p[i]*p[i];
- } // end for i
- stpmax = STPMX*TMath::Max(TMath::Sqrt(sum),(Double_t)(npar+1));
-
- for(its=0;its<ITMAX;its++){
- iter = its;
- lnsrch(npar,p,fp,g,xi,pnew,fret,stpmax,check);
- fp = fret;
- for(i=0;i<npar;i++){
- xi[i] = pnew[i] - p[i];
- p[i] = pnew[i];
- } // end for i
- test = 0.0;
- for(i=0;i<npar;i++){
- temp = TMath::Abs(xi[i])/TMath::Max(TMath::Abs(p[i]),1.0);
- if(temp > test) test = temp;
- } // end for i
- if(test<TOLX) break;
- for(i=0;i<npar;i++) dg[i] = g[i];
- dChi2(p,g);
- test = 0.0;
- den = TMath::Max(fret,1.0);
- for(i=0;i<npar;i++){
- temp = TMath::Abs(g[i])*TMath::Max(TMath::Abs(p[i]),1.0)/den;
- if(temp>test) test=temp;
- } // end for i
- if(test<gtol) break;
- for(i=0;i<npar;i++) dg[i] = g[i] - dg[i];
- for(i=0;i<npar;i++){
- hdg[i] = 0.0;
- for(j=0;j<npar;j++) hdg[i] += hessin[i][j]*dg[j];
- } // end for i
- fac = fae = sumdg = sumxi = 0.0;
- for(i=0;i<npar;i++){
- fac += dg[i]*xi[i];
- fae += dg[i]*hdg[i];
- sumdg += TMath::Sqrt(dg[i]);
- sumxi += TMath::Sqrt(xi[i]);
- } // end for i
- if(fac>TMath::Sqrt(EPS*sumdg*sumxi)){
- fac = 1.0/fac;
- fad = 1.0/fae;
- for(i=0;i<npar;i++) dg[i] = fac*xi[i]-fad*hdg[i];
- for(i=0;i<npar;i++) for(j=i;j<npar;j++){
- hessin[i][j] += fac*xi[i]*xi[j] - fad*hdg[i]*hdg[j] +
- fae*dg[i]*dg[j];
- hessin[j][i] = hessin[i][j];
- } // end for i,j
- } // end if fac>...
- for(i=0;i<npar;i++){
- xi[i] = 0.0;
- for(j=0;j<npar;j++) xi[i] -= hessin[i][j]*g[j];
- } // end for i
- } // end for its
- if(its==ITMAX) printf("Error: too many iterations\n");
- delete[] dg;
- delete[] g;
- delete[] hdg;
- delete[] pnew;
- delete[] xi;
- for(i=0;i<npar;i++) delete[] hessin[i];
- delete[] hessin;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::SetByAngles(Double_t *th){
- Double_t sx,cx,sy,cy,sz,cz;
-
- sx = TMath::Sin(th[0]); cx = TMath::Cos(th[0]);
- sy = TMath::Sin(th[1]); cy = TMath::Cos(th[1]);
- sz = TMath::Sin(th[2]); cz = TMath::Cos(th[2]);
- for(Int_t i=0;i<3;i++) fangles[i] = th[i];
- fM[0][0] = cz*cy;
- fM[0][1] = -cz*sy*sx - sz*cx;
- fM[0][2] = -cz*sy*cx + sz*sx;
- fM[1][0] = sz*cy;
- fM[1][1] = -sz*sy*sx + cz*cx;
- fM[1][2] = -sz*sy*cx - cz*sx;
- fM[2][0] = sy;
- fM[2][1] = cy*sx;
- fM[2][2] = cy*cx;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::dfMdthx(Double_t dfMx[3][3]){
- Double_t sx,cx,sy,cy,sz,cz;
-
- sx = TMath::Sin(fangles[0]); cx = TMath::Cos(fangles[0]);
- sy = TMath::Sin(fangles[1]); cy = TMath::Cos(fangles[1]);
- sz = TMath::Sin(fangles[2]); cz = TMath::Cos(fangles[2]);
- dfMx[0][0] = 0.0;
- dfMx[0][1] = -cz*sy*cx + sz*sx;
- dfMx[0][2] = cz*sy*sx + sz*cx;
- dfMx[1][0] = 0.0;
- dfMx[1][1] = -sz*sy*cx - cz*sx;
- dfMx[1][2] = sz*sy*sx - cz*cx;
- dfMx[2][0] = 0.0;
- dfMx[2][1] = cy*cx;
- dfMx[2][2] = -cy*sx;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::dfMdthy(Double_t dfMx[3][3]){
- Double_t sx,cx,sy,cy,sz,cz;
-
- sx = TMath::Sin(fangles[0]); cx = TMath::Cos(fangles[0]);
- sy = TMath::Sin(fangles[1]); cy = TMath::Cos(fangles[1]);
- sz = TMath::Sin(fangles[2]); cz = TMath::Cos(fangles[2]);
- dfMx[0][0] = -cz*sy;
- dfMx[0][1] = -cz*cy*sx;
- dfMx[0][2] = -cz*cy*cx;
- dfMx[1][0] = -sz*sy;
- dfMx[1][1] = -sz*cy*sx;
- dfMx[1][2] = -sz*cy*cx;
- dfMx[2][0] = cy;
- dfMx[2][1] = -sy*sx;
- dfMx[2][2] = -sy*cx;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::dfMdthz(Double_t dfMx[3][3]){
- Double_t sx,cx,sy,cy,sz,cz;
-
- sx = TMath::Sin(fangles[0]); cx = TMath::Cos(fangles[0]);
- sy = TMath::Sin(fangles[1]); cy = TMath::Cos(fangles[1]);
- sz = TMath::Sin(fangles[2]); cz = TMath::Cos(fangles[2]);
- dfMx[0][0] = -sz*cy;
- dfMx[0][1] = sz*sy*sx - cz*cx;
- dfMx[0][2] = sz*sy*cx + cz*sx;
- dfMx[1][0] = cz*cy;
- dfMx[1][1] = -cz*sy*sx - sz*cx;
- dfMx[1][2] = -cz*sy*cx + sz*sx;
- dfMx[2][0] = 0.0;
- dfMx[2][1] = 0.0;
- dfMx[2][2] = 0.0;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::LtoG(Double_t xl[],Double_t xg[]){
-
- Int_t i;
- for(i=0;i<3;i++) xg[i] = fx0[i];
- for(i=0;i<3;i++)for(Int_t j=0;j<3;j++) xg[i] += fM[j][i]*xl[j];
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::GtoL(Double_t xg[],Double_t xl[]){
- Int_t i;
- for(i=0;i<3;i++) xl[i] = 0.0;
- for(i=0;i<3;i++)for(Int_t j=0;j<3;j++)xl[i]+=fM[i][j]*(xg[j]-fx0[j]);
-}
-//______________________________________________________________________
-Double_t AliITSAlignmentModule::Chi2(Double_t p[]){
- Int_t i,j,k,l,n=0,indx;
- Double_t chi=0.0,xo[3],xi[3],xg[3],Ex[3][3];
- AliITSAlignmentTrack *tr;
-
- for(i=0;i<3;i++) fx0[i] = p[i];
- SetByAngles(&(p[3]));
-
- for(i=0;i<ftrksM->GetEntriesFast();i++) {
- tr = (AliITSAlignmentTrack *)(ftrksM->At(i));
- for(j=0;j<tr->GetNumberOfClustersSl();j++){
- tr->GetIndex(j,indx);
- if(indx==findex){
- n++;
- tr->GetPointG(j,(Double_t *)xi);
- tr->func(xi,xo);
- tr->GetPointL(j,(Double_t *)xi);
- tr->GetErrorG(j,(Double_t **)Ex);
- LtoG(xi,xg);
- for(k=0;k<3;k++)for(l=0;l<3;l++)
- chi += (xg[k] - xo[k])*Ex[k][l]*(xg[l]-xo[l]);
- } // end if indx==findex
- } // end for j
- } // end for i
- if(n<7) return chi;
- return chi/(Double_t)(n-6);
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::dChi2(Double_t p[],Double_t dChi2[]){
- Int_t i,j,k,l,m,n=0,indx;
- Double_t chi[6]={0.0,0.0,0.0,0.0,0.0,0.0},xo[3],xi[3],xg[3],Ex[3][3];
- Double_t dxdp[3][6],fMx[3][3],fMy[3][3],fMz[3][3];
- AliITSAlignmentTrack *tr;
-
- for(i=0;i<3;i++) fx0[i] = p[i];
- SetByAngles(&(p[3]));
- dfMdthx(fMx);
- dfMdthy(fMy);
- dfMdthz(fMz);
- for(i=0;i<3;i++)for(j=0;j<6;j++) dxdp[i][j] = 0.0;
- dxdp[0][0] = 1.0; // dx/dx
- dxdp[1][1] = 1.0; // dy/dy
- dxdp[2][2] = 1.0; // dz/dz
-
- for(i=0;i<ftrksM->GetEntriesFast();i++) {
- tr = (AliITSAlignmentTrack *)(ftrksM->At(i));
- for(j=0;j<tr->GetNumberOfClustersSl();j++){
- tr->GetIndex(j,indx);
- if(indx==findex){
- n++;
- tr->GetPointG(j,(Double_t *)xi);
- tr->func(xi,xo);
- tr->GetPointL(j,(Double_t *)xi);
- tr->GetErrorG(j,(Double_t **)Ex);
- LtoG(xi,xg);
- for(m=0;m<3;m++) for(k=0;k<3;k++){
- dxdp[m][3] += fMx[m][k]*xi[k];
- dxdp[m][4] += fMy[m][k]*xi[k];
- dxdp[m][5] += fMz[m][k]*xi[k];
- } // end for m
- for(m=0;m<6;m++){
- for(k=0;k<3;k++)for(l=0;l<3;l++)
- chi[m] += (xg[k] - xo[k])*Ex[k][l]*dxdp[l][m];
- } // end for m
- } // end if indx==findex
- } // end for j
- } // end for i
- if(n<7) return ;
- for(m=0;m<6;m++) chi[m] /= (Double_t)(n-6);
- return;
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::AlignModule(){
- static Int_t npar=6;
- Int_t iter,i;
- //Double_t p[npar],fret,gtol=1.0E-5;
- Double_t p[6],fret,gtol=1.0E-5;
-
- for(i=0;i<3;i++) {p[i] = fx0[i]; p[i+3] = fangles[i];}
- MRVMminimization(npar,(Double_t *)p,fret,gtol,iter);
- for(i=0;i<3;i++) {fx0[i] = p[i]; fangles[i] = p[i+3];}
- printf("AlignModule #%d:Xt=(%e,%e,%e) cm angles=(%e,%e,%e)rad,"
- " Chi2=%e loops=%d\n",findex,
- fx0[0],fx0[1],fx0[2],fangles[0],fangles[1],fangles[2],fret,iter);
-}
-//______________________________________________________________________
-void AliITSAlignmentModule::Streamer(TBuffer &R__b){
- // Stream an object of class AliITSAlignmentModule.
-
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- TObject::Streamer(R__b);
- R__b >> findex;
- R__b >> flay;
- R__b >> flad;
- R__b >> fdet;
- R__b >> ftrksM;
- R__b >> fChi2;
-// R__b.ReadStaticArray(fx0);
-// R__b.ReadStaticArray((double*)fM);
-// R__b.ReadStaticArray(fangles);
- } else {
- R__b.WriteVersion(AliITSAlignmentModule::IsA());
- TObject::Streamer(R__b);
- R__b << findex;
- R__b << flay;
- R__b << flad;
- R__b << fdet;
- R__b << ftrksM;
- R__b << fChi2;
-// R__b.WriteArray(fx0, 3);
-// R__b.WriteArray((double*)fM, 9);
-// R__b.WriteArray(fangles, 3);
- }
-}
+++ /dev/null
-#ifndef ALIITSALIGNMENTMODULE_H
-#define ALIITSALIGNMENTMODULE_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-/* $Id$ */
-/* $Author$ */
-/* $Date$ */
-/* $Name$ */
-/* $Header$ */
-/*
- $Log$
- Revision 1.1.2.2 2000/03/04 23:39:56 nilsen
- Fixed the logs???
-
- Revision 1.1.2.1 2000/03/02 20:12:57 nilsen
- A new class useful for ITS detector Alignment studdies
-*/
-/* $Revision$ */
-
-// Standard C & C++ libraries
-#include <TObject.h>
-
-// Standard Root Libraries
-#include "TParticle.h"
-
-// ITS libraries
-#include "AliITSgeom.h"
-
-class AliITSAlignmentModule : public TObject{
-///////////////////////////////////////////////////////////////////////////
-// A track class define exclusively for the use in doing ITS detector
-// alignment studdies. Not intended for general use.
-// Author: B. S. Nilsen
-// Date: January 17 2000
-///////////////////////////////////////////////////////////////////////////
-
- protected:
-
- Int_t findex,flay,flad,fdet;
- TObjArray *ftrksM;
- Double_t fChi2;
- Double_t fx0[3],fM[3][3],fangles[3];
-
- public:
-
- AliITSAlignmentModule();
- AliITSAlignmentModule(Int_t index,AliITSgeom *gm,
- Int_t ntrk,AliITSAlignmentTrack *trk);
- virtual ~AliITSAlignmentModule() {;}; // default destructor OK
- Int_t GetIndex(){return findex;}
- void GetId(Int_t &lay,Int_t &lad,Int_t &det){lay=flay;lad=flad;det=fdet;}
- Double_t * GetTranslationVector(){return fx0;}
- Double_t * GetRotationAngles(){return fangles;}
- Double_t ComputeChi2();
- Double_t GetChi2(){return fChi2;}
- void AlignModule();
- void lnsrch(Int_t npar,Double_t *xold,Double_t fold,Double_t *g,
- Double_t *p,Double_t *x,Double_t &f,Double_t stpmax,
- Int_t &check);
- void MRVMminimization(Int_t npar,Double_t *p,Double_t &fret,Double_t gtol,
- Int_t &iter);
- void SetByAngles(Double_t *th);
-
- private:
- void dfMdthx(Double_t dfMx[3][3]);
- void dfMdthy(Double_t dfMx[3][3]);
- void dfMdthz(Double_t dfMx[3][3]);
- void LtoG(Double_t xl[],Double_t xg[]);
- void GtoL(Double_t xg[],Double_t xl[]);
- Double_t Chi2(Double_t p[]);
- void dChi2(Double_t p[],Double_t dChi2[]);
-
-
- ClassDef(AliITSAlignmentModule,1) // Module class for ITS Alignment
-
-
-};
-#endif
+++ /dev/null
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-/* $Id$ */
-/* $Author$ */
-/* $Date$ */
-/* $Name$ */
-/* $Header$ */
-/*
- $Log$
- Revision 1.1.2.2 2000/06/04 16:35:37 nilsen
- One more try to fix log comments.
-
- Revision 1.1.2.1 2000/03/02 20:13:52 nilsen
- A new class useful for ITS detector alignment studdies.
- */
-/* $Revision$ */
-
-// Standard Root Libraries
-#include <TMath.h>
-
-// ITS libraries
-#include "AliITSgeom.h"
-#include "AliITSAlignmentTrack.h"
-#include "AliITSstatistics.h"
-#include "AliITSstatistics2.h"
-
-ClassImp(AliITSAlignmentTrack)
-
-//______________________________________________________________________
-AliITSAlignmentTrack::AliITSAlignmentTrack(){
-
- ftrack=fnclust=0,fnclustMax=0;
- ffunc=-1;
- fclust=0;
- for(Int_t i=0;i<10;i++) fpar[i]=0.0;
- fpx=fpy=fpz=fp=fpt=0.0;
- fChi2=-1.0;
-}
-//______________________________________________________________________
-AliITSAlignmentTrack::~AliITSAlignmentTrack(){
-
- ftrack=fnclust=0,fnclustMax=0;
- ffunc=-1;
- delete[] fclust;
- fclust=0;
- for(Int_t i=0;i<10;i++) fpar[i]=0.0;
- fpx=fpy=fpz=fp=fpt=0.0;
- fChi2=-1.0;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::func0(Double_t *go,Double_t *gi){
- Double_t x,y,z;
-
- x = gi[0];
- y = gi[1];
- z = gi[2];
- x = fpar[0]+fpar[1]*z;
- y = fpar[2]+fpar[3]*z;
- go[0] = x;
- go[1] = y;
- go[2] = z;
- return;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::func1(Double_t *go,Double_t *gi){
- Double_t x,y,z;
-
- x = gi[0];
- y = gi[1];
- z = gi[2];
- x = fpar[0]+fpar[1]*y;
- z = fpar[2]+fpar[3]*y;
- go[0] = x;
- go[1] = y;
- go[2] = z;
- return;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::func2(Double_t *go,Double_t *gi){
- Double_t x,y,z,r,th;
-
- x = gi[0];
- y = gi[1];
- z = gi[2];
- th = TMath::ATan2(y-fpar[1],x-fpar[0]);
- r = TMath::Hypot(x-fpar[0],y-fpar[1]);
- if(th<0.0) th += 2.0*TMath::Pi();
- x = fpar[0]+fpar[2]*TMath::Cos(th);
- y = fpar[1]+fpar[2]*TMath::Sin(th);
- z = fpar[3]+fpar[4]*r;
- go[0] = x;
- go[1] = y;
- go[2] = z;
- return;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::func(Double_t *go,Double_t *gi){
-
- switch (ffunc){
- case 0:
- func0(go,gi);
- return;
- case 1:
- func1(go,gi);
- return;
- case 2:
- func2(go,gi);
- return;
- } // end switch
-}
-//______________________________________________________________________
-Double_t AliITSAlignmentTrack::ComputeChi2(){
- Int_t i,j,k,l;
- Double_t chi2=0.0,go[3],gi[3];
-
- switch (ffunc) {
- case -1:
- return -1.0;
- break;
- case 0:
- for(i=0;i<fnclust;i++){
- for(j=0;j<3;j++)gi[j] = fclust[i].fxg[j];
- func0(go,gi);
- for(k=0;k<2;k++) for(l=0;l<2;l++) {
- //if(k==2 || l==2) continue;
- chi2 += (go[k] - gi[k])*fclust[i].fExg[k][l]*(go[l] - gi[l]);
- } // end for k,l
- } // end for i
- break;
- case 1:
- for(i=0;i<fnclust;i++){
- for(j=0;j<3;j++)gi[j] = fclust[i].fxg[j];
- func1(go,gi);
- for(k=0;k<3;k++) for(l=0;l<3;l++){
- if(k==1 || l==1) continue;
- chi2 += (go[k] - gi[k])*fclust[i].fExg[k][l]*(go[l] - gi[l]);
- } // end for k,l
- } // end for i
- break;
- case 2:
- for(i=0;i<fnclust;i++){
- for(j=0;j<3;j++)gi[j] = fclust[i].fxg[j];
- func0(go,gi);
- for(k=0;k<3;k++) for(l=0;l<3;l++){
- chi2 += (go[k] - gi[k])*fclust[i].fExg[k][l]*(go[l] - gi[l]);
- } // end for k,l
- } // end for i
- break;
- } // end switch
-
- fChi2 = (Float_t) chi2;
-
- return chi2;
-}
-//______________________________________________________________________
-Int_t AliITSAlignmentTrack::FindCircleCenter(Double_t *xc,Double_t *x1,
- Double_t *x2,Double_t *x3){
-////////////////////////////////////////////////////////////////////////
-// This was derived as folows. Given three non-linear points find
-// the circle that is therefor defined by those three non-linar points.
-// Assume that the circle is centers at xc,yc and has a radous R. Then
-// (1) R^2 = (x1-xc)^2 + (y1-yc)^2
-// (2) R^2 = (x2-xc)^2 + (y2-yc)^2
-// (3) R^2 = (x3-xc)^2 + (y3-yc)^2.
-// Now consider the two equations derived from the above
-// (1) - (2) = x1^2 - x2^2 -2xc(x1-x2) + y1^2 - y2y2 -2yc(y1-y2) = 0
-// (1) - (3) = x1^2 - x3^2 -2xc(x1-x3) + y1^2 - y3y2 -2yc(y1-y3) = 0
-// solving these two equations for x0 and y0 gives
-// xc = +{(y1-y2)*(y1-y3)*(y1-y3)+x1*x1*(y1-y3)+x2*x2*(y3-y1)+x3*x3*(y1-y2)}/2d
-// yc = -{(x1-x2)*(x1-x3)*(x1-x3)+y1*y1*(x1-x3)+y2*y2*(x3-x1)+y3*y3*(x1-x2)}/2d
-// with d = (x1-x2)*(y1-y3) - (x1-x3)*(y1-y2)
-////////////////////////////////////////////////////////////////////////
- Double_t d;
-
- d = (x1[0]-x2[0])*(x1[1]-x3[1]) - (x1[0]-x3[0])*(x1[1]-x2[1]);
- if(d==0.0) return 0; // fits to a line!
-
- xc[0] = (x1[1]-x2[1])*(x1[1]-x3[1])*(x1[1]-x3[1])+
- x1[0]*x1[0]*(x1[1]-x3[1])+
- x2[0]*x2[0]*(x3[1]-x1[1])+
- x3[0]*x3[0]*(x1[1]-x2[1]);
- xc[1] = (x1[0]-x2[0])*(x1[0]-x3[0])*(x1[0]-x3[0])+
- x1[1]*x1[1]*(x1[0]-x3[0])+
- x2[1]*x2[1]*(x3[0]-x1[0])+
- x3[1]*x3[1]*(x1[0]-x2[0]);
- xc[0] = +0.5*xc[0]/d;
- xc[1] = -0.5*xc[1]/d;
-
- return 1;
-}
-//______________________________________________________________________
-Int_t AliITSAlignmentTrack::FitTrackToLineG(){
-// Xg = fpar[0] + fpar[1] * Zg
-// Yg = fpar[2] + fpar[3] * Zg;
-// Local Variables
- Int_t i;
- Double_t x,y,z,wx,wy;
- Double_t a,b,c,d;
- AliITSstatistics2 *sx = new AliITSstatistics2(4);
- AliITSstatistics2 *sy = new AliITSstatistics2(4);
- Double_t b0,d0;
-
- fChi2 = -1.0;
- ffunc = 0;
- if(fnclust<3) return -1;
-
- b = (fclust[0].fxg[0]-fclust[fnclust].fxg[0])/
- (fclust[0].fxg[2]-fclust[fnclust].fxg[2]);
- d = (fclust[0].fxg[1]-fclust[fnclust].fxg[1])/
- (fclust[0].fxg[2]-fclust[fnclust].fxg[2]);
- do{
- b0 = b;
- d0 = d;
- for(i=0;i<fnclust;i++){
- sx->Reset();
- sy->Reset();
- x = fclust[i].fxg[0];
- y = fclust[i].fxg[1];
- z = fclust[i].fxg[2];
- wx = 1./(1./fclust[i].fExg[0][0] +
- (1./fclust[i].fExg[2][2])*b0*b0);// 1.0/rms^2
- wy = 1./(1./fclust[i].fExg[1][1] +
- (1./fclust[i].fExg[2][2])*d0*d0);// 1.0/rms^2
- sx->AddValue(x,z,wx);
- sy->AddValue(y,z,wy);
- } // end for i
- fChi2 = sx->FitToLine(a,b);
- fChi2 += sy->FitToLine(c,d);
- //} while(fabs(b0-b)<1.E-5 && fabs(d0-d)<1.E-5);
- } while(TMath::Abs(b0-b)<1.E-5 && TMath::Abs(d0-d)<1.E-5);
- fpar[0] = a;
- fpar[1] = b;
- fpar[2] = c;
- fpar[3] = d;
- return 0;
-}
-//______________________________________________________________________
-Int_t AliITSAlignmentTrack::FitTrackToLineL(AliITSgeom *gm){
-// X = fpar[0] + fpar[1] * y;
-// Z = fpar[2] + fpar[3] * y;
-// in the local coordinate system of the detector fclust[0].findex.
- // Local Variables
- Int_t i,j,k;
- Double_t wx/*,wy*/,wz,Exll[3][3];
- Double_t a,b,c,d;
- Double_t xg[3],xl[3],x2g[3],x2l[3];
- AliITSstatistics2 *Fx = new AliITSstatistics2(2);
- AliITSstatistics2 *Fz = new AliITSstatistics2(2);
-
- fChi2 = -1.0;
- ffunc = 1;
- if(fnclust<3) return -1;
-
- Int_t Npts = fnclust;
- for(i=0;i<Npts;i++){
- for(j=0;j<3;j++)for(k=0;k<3;k++) Exll[j][k] = fclust[i].fExl[j][k];
- for(j=0;j<3;j++){x2l[j] = fclust[i].fxl[j];}
- gm->LtoL(fclust[i].findex,fclust[0].findex,x2l,xl);
- gm->LtoLErrorMatrix(fclust[i].findex,fclust[0].findex,
- (Double_t **) fclust[i].fExl,(Double_t **) Exll);
- wx = Exll[0][0];
- wz = Exll[2][2];
- Fx->AddValue(xl[0],xl[1],wx);
- Fz->AddValue(xl[2],xl[1],wz);
- } // end for i
- fChi2 = Fx->FitToLine(a,b);
- fChi2 += Fz->FitToLine(c,d);
- fpar[0] = a;
- fpar[1] = b;
- fpar[2] = c;
- fpar[3] = d;
- // convert to global if posible.
- xl[0] = a;
- xl[1] = 0.0;
- xl[2] = c;
- x2l[0] = a+b;
- x2l[1] = 1.0;
- x2l[2] = c+d;
- gm->LtoG(fclust[0].findex,xl,xg);
- gm->LtoG(fclust[0].findex,x2l,x2g);
- c = xg[2] - x2g[2];
- if(c!=0.0){
- b = (xg[0] - x2g[0])/c;
- d = (xg[1] - x2g[1])/c;
- a = xg[0] - b*xg[2];
- c = xg[1] - d*xg[2];
- fpar[4] = a;
- fpar[5] = b;
- fpar[6] = c;
- fpar[7] = d;
- }else{
- fpar[4] = 0.0;
- fpar[5] = 0.0;
- fpar[6] = 0.0;
- fpar[7] = 0.0;
- return -1;
- }// end if c!=0.0
- return 0;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::FitToFunction(Int_t n,AliITSgeom *gm){
- Int_t i,j,k,l;
- Double_t r,w,xc[3],x1[3],x2[3],x3[3];
- AliITSstatistics2 *sa = new AliITSstatistics2(4);
- AliITSstatistics2 *sb = new AliITSstatistics2(4);
-
- ffunc = -1;
- if(fnclust<3) return;
-
- switch (n){
- case -1:
- return;
- break;
- case 0:
- ffunc = 0;
- FitTrackToLineG();
- return;
- break;
- case 1:
- ffunc = 1;
- FitTrackToLineL(gm);
- return;
- break;
- case 2:
- ffunc = 2;
- sa->Reset();
- sb->Reset();
- for(i=0;i<fnclust;i++){
- for(l=0;l<3;l++) x1[l] = (Double_t) fclust[i].fxg[l];
- r = TMath::Hypot((Double_t)x1[0],(Double_t)x1[1]);
- w = (Double_t) (fclust[i].fExg[2][2]);
- sb->AddValue((Double_t)fclust[i].fxg[2],r,w);
- if(i<fnclust-2)for(j=i+1;j<fnclust-1;j++)for(k=j+1;k<fnclust;k++){
- for(l=0;l<3;l++) x2[l] = (Double_t) fclust[j].fxg[l];
- for(l=0;l<3;l++) x3[l] = (Double_t) fclust[k].fxg[l];
- w = 0.0;
- w += TMath::Hypot((Double_t)fclust[i].fExg[0][0],
- (Double_t)fclust[i].fExg[1][1]);
- w += TMath::Hypot(w,
- TMath::Hypot((Double_t)fclust[j].fExg[0][0],
- (Double_t)fclust[j].fExg[1][1]));
- w += TMath::Hypot(w,
- TMath::Hypot((Double_t)fclust[k].fExg[0][0],
- (Double_t)fclust[k].fExg[1][1]));
- if(FindCircleCenter(xc,x1,x2,x3)==0){ // Can't find circle
- FitToFunction(1,gm); // fit to line.
- return;
- } // end if
- sa->AddValue(xc[1],xc[0],w);
- } // end for j,k
- } // end for i
- fpar[0] = sa->GetMeanX();
- fpar[1] = sa->GetMeanY();
- fpar[2] = sb->GetMeanX();
- fChi2 = sb->FitToLine(fpar[3],fpar[4]);
- fChi2 = (Float_t) ComputeChi2();
- return;
- break;
- default:
- return;
- break;
- } // end switch
- return;
-}
-//______________________________________________________________________
-void AliITSAlignmentTrack::Streamer(TBuffer &R__b){
- // Stream an object of class AliITSAlignmentTrack.
-
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- TObject::Streamer(R__b);
- R__b >> ftrack;
- R__b >> fnclust;
- R__b >> fnclustMax;
-// R__b >> fclust;
- R__b >> ffunc;
- R__b.ReadStaticArray(fpar);
- R__b >> fChi2;
- R__b >> fpx;
- R__b >> fpy;
- R__b >> fpz;
- R__b >> fp;
- R__b >> fpt;
- } else {
- R__b.WriteVersion(AliITSAlignmentTrack::IsA());
- TObject::Streamer(R__b);
- R__b << ftrack;
- R__b << fnclust;
- R__b << fnclustMax;
-// R__b << fclust;
- R__b << ffunc;
- R__b.WriteArray(fpar, 10);
- R__b << fChi2;
- R__b << fpx;
- R__b << fpy;
- R__b << fpz;
- R__b << fp;
- R__b << fpt;
- }
-}
+++ /dev/null
-#ifndef ALIITSALIGNMENTTRACK_H
-#define ALIITSALIGNMENTTRACK_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-/* $Id$ */
-/* $Author$ */
-/* $Date$ */
-/* $Name$ */
-/* $Header$ */
-/*
- $Log$
- Revision 1.1.2.4 2000/06/04 16:35:24 nilsen
- One more try to fix log comments.
-
- Revision 1.1.2.3 2000/03/12 16:05:55 nilsen
- Fixed but in $Log$
- Fixed but in Revision 1.1.2.4 2000/06/04 16:35:24 nilsen
- Fixed but in One more try to fix log comments.
- Fixed but in, hopefully.
-
- Revision 1.1.2.2 2000/03/04 23:40:19 nilsen
- Fixed the logs???
-
- Revision 1.1.2.1 2000/03/02 20:14:25 nilsen
- A new class useful for ITS detector alignment studdies.
-*/
-/* $Revision$ */
-
-// Standard C & C++ libraries
-
-// Standard Root Libraries
-#include <TObject.h>
-#include <TParticle.h>
-
-// ITS libraries
-#include "AliITSgeom.h"
-
-struct TClustAl_sl{
- Int_t findex;
- Float_t fxg[3],fExg[3][3];
- Float_t fxl[3],fExl[3][3];
-};
-
-
-
-class AliITSAlignmentTrack : public TObject{
-///////////////////////////////////////////////////////////////////////////
-// A track class define exclusively for the use in doing ITS detector
-// alignment studdies. Not intended for general use.
-// Author: B. S. Nilsen
-// Date: January 17 2000
-///////////////////////////////////////////////////////////////////////////
-
- protected:
-
- Int_t ftrack,fnclust,fnclustMax;
- TClustAl_sl *fclust;
- Int_t ffunc;
- Double_t fpar[10];
- Float_t fChi2;
- Float_t fpx,fpy,fpz,fp,fpt;
- // x=fp[0]+fp[1]*z and y=fp[2]+fp[3]*z : ffunc = 0
- //
- // x=fp[0]+fp[1]*y and z=fp[2]+fp[3]*y : ffunc = 1
- //
- // x=fp[0]+fp[2]*cos(th), y=fp[1]+fp[2]*sin(th),
- // and z=fp[3]+f[4]*th th[i]=atan2(y[i]-y0,x[i]-x0) : ffunc = 2
-
- public:
-
- AliITSAlignmentTrack();
- virtual ~AliITSAlignmentTrack();
-
- void CreatePoints(Int_t n){fclust = new TClustAl_sl[n];fnclustMax=n;
- fnclust=0;for(Int_t j=0;j<fnclustMax;j++)
- for(Int_t i=0;i<3;i++)fclust[j].fxl[i]=fclust[j].fxg[i]=0.0;}
- Int_t AddPointL(Int_t n,Int_t indx,Float_t *lp,Float_t **lep){
- if(n>=fnclustMax)return 0;fclust[n].findex=indx;
- for(Int_t i=0;i<3;i++){fclust[n].fxl[i]=lp[i];for(Int_t j=0;j<3;j++)
- fclust[n].fExl[i][j]=lep[i][j];}return -1;}
- Int_t AddPointLastL(Int_t indx,Float_t *lp,Float_t **lep){
- if(++fnclust>=fnclustMax)return 0;//+first
- fclust[fnclust].findex=indx;
- for(Int_t i=0;i<3;i++){fclust[fnclust].fxl[i]=lp[i];
- for(Int_t j=0;j<3;j++)fclust[fnclust].fExl[i][j]=lep[i][j];
- }return -1;}
- Int_t GetPointL(Int_t n,Float_t *lp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)
- lp[i]=fclust[n].fxl[i];return -1;}
- Int_t GetPointL(Int_t n,Double_t *lp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)
- lp[i]=(Double_t)fclust[n].fxl[i];return -1;}
- Int_t GetPointG(Int_t n,Float_t *gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)
- gp[i]=fclust[n].fxg[i];return -1;}
- Int_t GetPointG(Int_t n,Double_t *gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)
- gp[i]=(Double_t)fclust[n].fxg[i];return -1;}
- Int_t GetErrorG(Int_t n,Float_t **gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++)
- gp[i][j]=fclust[n].fExg[i][j];return -1;}
- Int_t GetErrorG(Int_t n,Double_t **gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++)
- gp[i][j]=(Double_t)fclust[n].fExg[i][j];return -1;}
- Int_t GetErrorL(Int_t n,Float_t **gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++)
- gp[i][j]=fclust[n].fExl[i][j];return -1;}
- Int_t GetErrorL(Int_t n,Double_t **gp){if(n>=fnclustMax)return 0;
- for(Int_t i=0;i<3;i++)for(Int_t j=0;j<3;j++)
- gp[i][j]=(Double_t)fclust[n].fExl[i][j];return -1;}
- Int_t GetIndex(Int_t n,Int_t &indx){if(n>=fnclustMax)return 0;
- indx=fclust[n].findex;return -1;}
-
- void SetGlobalPosition(AliITSgeom *gm){
- for(Int_t i=0;i<fnclust;i++){
- gm->LtoG(fclust[i].findex,fclust[i].fxl,fclust[i].fxg);
- gm->LtoGErrorMatrix(fclust[i].findex,(Double_t **) fclust[i].fExl,
- (Double_t **) fclust[i].fExg);}}
- void SetTrackNumber(Int_t trk) {ftrack=trk;}
- void SetTParticle(TParticle *prt){fpx=prt->Px();fpy=prt->Py();
- fpz=prt->Pz();fp=prt->P();fpt=prt->Pt();}
- void SetPx(Float_t px) {fpx=px;}
- void SetPy(Float_t py) {fpy=py;}
- void SetPz(Float_t pz) {fpz=pz;}
- void SetP(Float_t p) {fp=p;}
- void SetPt(Float_t pt) {fpt=pt;}
- void SetParameter(Int_t n,Double_t a) {if(n>=0&&n<10);fpar[n]=a;}
- void SetChi2(Float_t chi2) {fChi2=chi2;}
- void SetFunctionNumber(Int_t fn) {ffunc = fn;}
-
- Int_t GetTrackNumber() {return ftrack;}
- Int_t GetNumberOfClustersSl() {return fnclust;}
- Float_t GetPx() {return fpx;}
- Float_t GetPy() {return fpy;}
- Float_t GetPz() {return fpz;}
- Float_t GetP() {return fp;}
- Float_t GetPt() {return fpt;}
- Double_t GetParameter(Int_t n) {if(n>=0&&n<10) return fpar[n]; return -1.;}
- Float_t GetChi2() {return fChi2;}
- Int_t GetfunID() {return ffunc;}
-
- void FitToFunction(Int_t n,AliITSgeom *gm);
- void func(Double_t *go,Double_t *gi);
- void func0(Double_t *go,Double_t *gi);
- void func1(Double_t *go,Double_t *gi);
- void func2(Double_t *go,Double_t *gi);
- Int_t FitTrackToLineG();
- Int_t FitTrackToLineL(AliITSgeom *gm);
- Int_t FindCircleCenter(Double_t *xc,Double_t *x1,
- Double_t *x2,Double_t *x3);
-
- private:
- Double_t ComputeChi2();
-
- ClassDef(AliITSAlignmentTrack,1) // Track class for ITS Alignment
-
-};
-#endif
+++ /dev/null
-////////////////////////////////////////////////
-// Track class for set:ITS //
-////////////////////////////////////////////////
-
-
-#include "AliITStrack.h"
-
-ClassImp(AliITStrack)
+++ /dev/null
-#ifndef ITSTRACK_H
-#define ITSTRACK_H
-
-
-////////////////////////////////////////////////////////////////////////
-// Track class for set: ITS //
-////////////////////////////////////////////////////////////////////////
-
-#include <TObject.h>
-
-
-
-//_____________________________________________________________________________
-class AliITStrack : public TObject {
-
-public:
-
- AliITStrack() {}
- AliITStrack(const AliITStrack& t) {}
- virtual ~AliITStrack() {}
-
-
- Bool_t IsSortable() const {return kTRUE;}
-
- ClassDef(AliITStrack,1) // ITS reconstructed tracks
-};
-
-#endif
+++ /dev/null
-/**************************************************************************
- * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * *
- * Author: The ALICE Off-line Project. *
- * Contributors are mentioned in the code where appropriate. *
- * *
- * Permission to use, copy, modify and distribute this software and its *
- * documentation strictly for non-commercial purposes is hereby granted *
- * without fee, provided that the above copyright notice appears in all *
- * copies and that both the copyright notice and this permission notice *
- * appear in the supporting documentation. The authors make no claims *
- * about the suitability of this software for any purpose. It is *
- * provided "as is" without express or implied warranty. *
- **************************************************************************/
-
-/*
-$Log$
-Revision 1.1.2.2 2000/03/02 21:53:36 nilsen
-to make it compatable with the changes in AliRun/AliModule.
-
-Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
- The changes made with this latest inclusion of code is very large.
-Many of the new files were added just in December when P. Cerello added his
-SDD simulations to the distrobutions. Also added are some file of P. Skowronski
-for SSD cluster finding and ghost RecPoints. None of this "new" code has been
-proporly tested. Other code new to this cvs repository is explained in the
-ITS Off-line web page. In general the changes are too large to give a resonable
-discription of them but probably should be taken as the starting point for
-the developement branch (ITS-working).
- B. S. Nilsen
-
-Revision 1.13 1999/10/16 19:49:00 BSN
-$Name$
-$Author$
-$Id$
-*/
-
-///////////////////////////////////////////////////////////////////////////////
-// //
-// Inner Traking System version Test //
-// This class contains the base procedures for the Inner Tracking System //
-// //
-// Authors: R. Barbera, B. S. Nilsen. //
-// version Test //
-// Created October 16 1999. //
-// //
-///////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <TMath.h>
-
-#include "AliRun.h"
-#include "TSystem.h"
-#include "AliITShit.h"
-#include "AliITS.h"
-#include "AliITSvtest.h"
-#include "AliITSgeom.h"
-
-ClassImp(AliITSvtest)
-
-//_____________________________________________________________________________
-AliITSvtest::AliITSvtest() {
- //
- // Standard constructor for the ITS
- //
-/*
- fIdTestN = 6;
- fIdTestName = new TString[fIdTestN];
- fIdTestName[0] = "ITS1";
- fIdTestName[1] = "ITS2";
- fIdTestName[2] = "ITS3";
- fIdTestName[3] = "ITS4";
- fIdTestName[4] = "ITS5";
- fIdTestName[5] = "ITS6";
-*/
-}
-//____________________________________________________________________________
-AliITSvtest::AliITSvtest(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-// Copy Constructor for ITS test version.
-////////////////////////////////////////////////////////////////////////
- if(&source == this) return;
- printf("Not allowed to copy AliITSvtest\n");
- return;
-}
-//_____________________________________________________________________________
-AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-// Assignment operator for the ITS version 1.
-////////////////////////////////////////////////////////////////////////
- if(&source == this) return *this;
- printf("Not allowed to copy AliITSvtest\n");
- return *this;
-}
-//_____________________________________________________________________________
-AliITSvtest::~AliITSvtest() {
- //
- // Standard destructor for the ITS
- //
- delete [] fIdTestName;
-}
-//_____________________________________________________________________________
-AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
- const char *name, const char *title)
- : AliITS(name, title){
- //
- // Standard constructor for the ITS
- //
- fIdTestN = 6;
- fIdTestName = new TString[fIdTestN];
- fIdTestName[0] = "ITS1";
- fIdTestName[1] = "ITS2";
- fIdTestName[2] = "ITS3";
- fIdTestName[3] = "ITS4";
- fIdTestName[4] = "ITS5";
- fIdTestName[5] = "ITS6";
-
- fEuclidMaterial = filetme;
- fEuclidGeometry = fileeuc;
-// The .det file for the geometry must have the same name as fileeuc with
-// .euc replaced by .det.
-}
-
-
-//_____________________________________________________________________________
-void AliITSvtest::CreateMaterials(){
- //
- // Read materials for the ITS
- //
- char *filtmp;
-//
- filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
-// FILE *file = fopen(fEuclidMaterial.Data(),"r");
- FILE *file = fopen(filtmp,"r");
- if(file) {
- fclose(file);
-// ReadEuclidMedia(fEuclidMaterial.Data(),this);
- ReadEuclidMedia(filtmp);
- } else {
- Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
-// fEuclidMaterial.Data());
- filtmp);
- exit(1);
- } // end if(file)
-}
-
-//_____________________________________________________________________________
-void AliITSvtest::CreateGeometry(){
-//////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-// Read geometry for the ITS
-//
-
- Int_t size;
- char topvol[5];
- char *filtmp;
-//
- filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
- FILE *file = fopen(filtmp,"r");
- delete [] filtmp;
- if(file) {
- fclose(file);
- printf("Ready to read Euclid geometry file\n");
- ReadEuclid(fEuclidGeometry.Data(),topvol);
- printf("Read in euclid geometries\n");
- } else {
- Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
- fEuclidGeometry.Data());
- exit(1);
- } // end if(file)
- //
- //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
- // invisible
- //
- gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
- //
- //---Outputs the geometry tree in the EUCLID/CAD format
-
- if (fEuclidOut) {
- gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
- } // end if (fEuclidOut)
-
- filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
- size = strlen(filtmp);
- if(size>4){
- filtmp[size-3] = 'd'; // change from .euc to .det
- filtmp[size-2] = 'e';
- filtmp[size-1] = 't';
- file = fopen(filtmp,"r");
- if(file){ // if file exists use it to fill AliITSgeom structure.
- fclose(file);
- printf("ready to read .det file %s\n",filtmp);
- fITSgeom = new AliITSgeom(filtmp);
- }else{
- fITSgeom = 0;
- // fill AliITSgeom structure from geant structure just filled above
- }// end if(file)
- delete [] filtmp;
- }// end if(size>4)
- printf("finished with euclid geometrys\n");
-}
-
-//_____________________________________________________________________________
-void AliITSvtest::Init(){
- //
- // Initialise the ITS after it has been created
- //
- Int_t i;
-
- fIdN = fIdTestN;
- fIdName = new TString[fIdTestN];
- fIdSens = new Int_t[fIdTestN];
- for(i=0;i<fIdTestN;i++) {
- fIdName[i]=fIdTestName[i];
- /*
- l = strlen(fIdTestName[i]);
- fIdName[i] = new char[l+1];
- for(j=0;j<l;j++) fIdName[i][j] = fIdTestName[i][j];
- fIdName[i][l] = '\0'; // Null terminate this string.
- */
- } // end for i
-
- AliITS::Init();
-}
-
-//_____________________________________________________________________________
-void AliITSvtest::StepManager(){
- //
- // Called for every step in the ITS
- //
- Int_t copy, id;
- Int_t copy1,copy2;
- Float_t hits[8];
- Int_t vol[4];
- TLorentzVector position, momentum;
- TClonesArray &lhits = *fHits;
- //
- // Track status
- vol[3] = 0;
- if(gMC->IsTrackInside()) vol[3] += 1;
- if(gMC->IsTrackEntering()) vol[3] += 2;
- if(gMC->IsTrackExiting()) vol[3] += 4;
- if(gMC->IsTrackOut()) vol[3] += 8;
- if(gMC->IsTrackDisappeared()) vol[3] += 16;
- if(gMC->IsTrackStop()) vol[3] += 32;
- if(gMC->IsTrackAlive()) vol[3] += 64;
- //
- // Fill hit structure.
- if(!(gMC->TrackCharge())) return;
- //
- // Only entering charged tracks
- if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
- vol[0] = 1;
- id = gMC->CurrentVolOffID(0,copy);
- //detector copy in the ladder = 1<->4 (ITS1)
- vol[1] = copy;
- gMC->CurrentVolOffID(1,copy1);
- //ladder copy in the module = 1<->2 (I186)
- gMC->CurrentVolOffID(2,copy2);
- //module copy in the layer = 1<->10 (I132)
- vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
- } else if(id == fIdSens[1]){
- vol[0] = 2;
- id = gMC->CurrentVolOffID(0,copy);
- //detector copy in the ladder = 1<->4 (ITS2)
- vol[1] = copy;
- gMC->CurrentVolOffID(1,copy1);
- //ladder copy in the module = 1<->4 (I131)
- gMC->CurrentVolOffID(2,copy2);
- //module copy in the layer = 1<->10 (I132)
- vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
- } else if(id == fIdSens[2]){
- vol[0] = 3;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->12 (I316)
- vol[2] = copy;
- } else if(id == fIdSens[3]){
- vol[0] = 4;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->22 (I417)
- vol[2] = copy;
- }else if(id == fIdSens[4]){
- vol[0] = 5;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->34 (I565)
- vol[2] = copy;
- }else if(id == fIdSens[5]){
- vol[0] = 6;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->38 (I569)
- vol[2] = copy;
- } else {
- return; // not an ITS volume?
- } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
-//
- gMC->TrackPosition(position);
- gMC->TrackMomentum(momentum);
- hits[0]=position[0];
- hits[1]=position[1];
- hits[2]=position[2];
- hits[3]=momentum[0];
- hits[4]=momentum[1];
- hits[5]=momentum[2];
- hits[6]=gMC->Edep();
- hits[7]=gMC->TrackTime();
- // Fill hit structure with this new hit.
- new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
- return;
-}
-//____________________________________________________________________________
-void AliITSvtest::Streamer(TBuffer &R__b)
-{
- // Stream an object of class AliITSvtest.
-
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- AliITS::Streamer(R__b);
- } else {
- R__b.WriteVersion(AliITSvtest::IsA());
- AliITS::Streamer(R__b);
- }
-}
-
+++ /dev/null
-#ifndef ALIITSVTEST_H
-#define ALIITSVTEST_H
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
- * See cxx source for full Copyright notice */
-
-/* $Id$ */
-
-////////////////////////////////////////////////////////////////////////
-// Manager and hits classes for ITS version 5
-////////////////////////////////////////////////////////////////////////
-
-
-#include "AliITS.h"
-
-class AliITSvtest : public AliITS {
-
-public:
- AliITSvtest();
- AliITSvtest(const char *fileeuc,const char *filetme,
- const char *name, const char *title);
- AliITSvtest(const AliITSvtest &source); // copy constructor
- AliITSvtest& operator=(const AliITSvtest &source); // assignment operator
- virtual ~AliITSvtest() ;
- virtual void CreateGeometry();
- virtual void CreateMaterials();
- virtual void Init();
- virtual Int_t IsVersion() const {
- // returns the ITS version number
- return -1;
- }
- virtual void StepManager();
-
-private:
- Int_t fIdTestN; // The number of layers for test geometry version
- // The name of the layers as defined in the Geant tree.
- TString *fIdTestName; // They are the names of the sensitive volumes
-
-
-
- ClassDef(AliITSvtest,1) //Hits manager for ITS test version, Private ITS class for different test geometries
-};
-
-#endif
+++ /dev/null
-void vertexmacro (const char *filename="galice.root",Int_t evNumber=0) {
-/////////////////////////////////////////////////////////////////////////
-// This macro is a small example of a ROOT macro
-// illustrating how to read the output of GALICE
-// and fill some histograms.
-//
-// Root > .L vertexmacro.C //this loads the macro in memory
-// Root > vertexmacro(); //by default process first event
-// Root > vertexmacro("galice.root"); //process file galice.root
-// Root > vertexmacro("galice.root",0); // process first event
-// from galice.root file
-/////////////////////////////////////////////////////////////////////////
-
-
-// Dynamically link some shared libs
- if (gClassTable->GetID("AliRun") < 0) {
- gROOT->LoadMacro("loadlibs.C");
- loadlibs();
- } // end if gClassTable...
-
-
-// Connect the Root Galice file containing Geometry, Kine and Hits
- TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
- if (!file){ file = new TFile(filename);printf("Opening new file\n");}
- printf("Root input file is %s\n",filename);
-
-// Get AliRun object from file or create it if not on file
- if (!gAlice) {
- gAlice = (AliRun*)file->Get("gAlice");
- if (gAlice) printf("AliRun object found on file\n");
- if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
- }
-//
-
- for(Int_t evnt=0;evnt<=evNumber;evnt++){
-
- // define some variables for later use.
- Int_t nparticles = gAlice->GetEvent(evnt);
- if (nparticles <= 0) continue; // get next event
-
- FindVertexs(evnt,1.0,16.82);
-
- } // end for evnt
- return;
-}