X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSClusterFinderSSD.cxx;h=f7224f82a08be3c769e935f9ed83df2ae63dc9e2;hb=5e5bc8f189477e8c7b3595e8c9180f73438b44b2;hp=9a4ba32ee0df4ceb827c8f01dd952d2fc238652a;hpb=aacedc3e54091806a9c6d356fd7f582df59fd73f;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSClusterFinderSSD.cxx b/ITS/AliITSClusterFinderSSD.cxx index 9a4ba32ee0d..f7224f82a08 100644 --- a/ITS/AliITSClusterFinderSSD.cxx +++ b/ITS/AliITSClusterFinderSSD.cxx @@ -18,33 +18,37 @@ // * period of March - June 2001 * // **************************************************************************/ // -#include +//#include #include -#include "AliRun.h" -#include "AliITS.h" -#include "AliITSdigitSSD.h" + +//#include "AliRun.h" +//#include "AliITS.h" +#include "AliITSClusterFinderSSD.h" +#include "AliITSDetTypeRec.h" +#include "AliITSMapA1.h" #include "AliITSRawClusterSSD.h" #include "AliITSRecPoint.h" -#include "AliITSMapA1.h" -#include "AliITSClusterFinderSSD.h" +#include "AliITSdigitSSD.h" #include "AliITSclusterSSD.h" #include "AliITSpackageSSD.h" -#include "AliITSresponseSSD.h" #include "AliITSsegmentationSSD.h" -#include "AliITSgeom.h" +//#include "AliITSgeom.h" +#include "AliITSCalibrationSSD.h" +#include "AliLog.h" const Bool_t AliITSClusterFinderSSD::fgkSIDEP=kTRUE; const Bool_t AliITSClusterFinderSSD::fgkSIDEN=kFALSE; +const Int_t AliITSClusterFinderSSD::fgkNoiseThreshold=5; +//const Int_t debug=0; ClassImp(AliITSClusterFinderSSD) - -//____________________________________________________________________ -// -// Constructor -//______________________________________________________________________ -AliITSClusterFinderSSD::AliITSClusterFinderSSD(): + + //____________________________________________________________________ + // + // Constructor + //______________________________________________________________________ + AliITSClusterFinderSSD::AliITSClusterFinderSSD(): AliITSClusterFinder(), -fITS(0), fClusterP(0), fNClusterP(0), fClusterN(0), @@ -63,11 +67,11 @@ fSFF(0), fSFB(0){ //Default constructor } + //______________________________________________________________________ -AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg, +AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp, TClonesArray *digits): -AliITSClusterFinder(seg,0), -fITS(0), +AliITSClusterFinder(dettyp,digits), fClusterP(0), fNClusterP(0), fClusterN(0), @@ -88,25 +92,23 @@ fSFB(0){ SetDigits(digits); SetMap(new AliITSMapA1(GetSeg(),Digits())); - fITS = (AliITS*)gAlice->GetModule("ITS"); - fClusterP = new TClonesArray ("AliITSclusterSSD",200); + fClusterP = new TClonesArray ("AliITSclusterSSD",200); fNClusterP = 0; - fClusterN = new TClonesArray ("AliITSclusterSSD",200); + fClusterN = new TClonesArray ("AliITSclusterSSD",200); fNClusterN = 0; - fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages + fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages fNPackages = 0; - fDigitsIndexP = new TArrayI(300); + fDigitsIndexP = new TArrayI(800); fNDigitsP = 0; - fDigitsIndexN = new TArrayI(300); + fDigitsIndexN = new TArrayI(800); fNDigitsN = 0; fPitch = GetSeg()->Dpx(0); fPNsignalRatio= 7./8.; // warning: hard-wired number } -//______________________________________________________________________} -AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg, - AliITSresponse *res): -AliITSClusterFinder(seg,res), -fITS(0), + +//______________________________________________________________________ +AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSDetTypeRec* dettyp): +AliITSClusterFinder(dettyp), fClusterP(0), fNClusterP(0), fClusterN(0), @@ -125,37 +127,37 @@ fSFF(0), fSFB(0){ //Standard constructor - fITS = (AliITS*)gAlice->GetModule("ITS"); - fClusterP = new TClonesArray ("AliITSclusterSSD",200); + fClusterP = new TClonesArray ("AliITSclusterSSD",200); fNClusterP = 0; - fClusterN = new TClonesArray ("AliITSclusterSSD",200); + fClusterN = new TClonesArray ("AliITSclusterSSD",200); fNClusterN = 0; - fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages + fPackages = new TClonesArray ("AliITSpackageSSD",200); //packages fNPackages = 0; - fDigitsIndexP = new TArrayI(300); + fDigitsIndexP = new TArrayI(800); fNDigitsP = 0; - fDigitsIndexN = new TArrayI(300); + fDigitsIndexN = new TArrayI(800); fNDigitsN = 0; fPitch = GetSeg()->Dpx(0); fPNsignalRatio= 7./8.; // warning: hard-wired number } + //______________________________________________________________________ AliITSClusterFinderSSD::~AliITSClusterFinderSSD(){ - // Default destructor - - fITS = 0; - delete fClusterP; - delete fClusterN; - delete fPackages; - delete fDigitsIndexP; - delete fDigitsIndexN; + // Default destructor + + delete fClusterP; + delete fClusterN; + delete fPackages; + delete fDigitsIndexP; + delete fDigitsIndexN; + delete fMap; } //______________________________________________________________________ void AliITSClusterFinderSSD::InitReconstruction(){ - // initialization of the cluster finder - - register Int_t i; //iterator - + // initialization of the cluster finder + + register Int_t i; //iterator + for (i=0;iRemoveAt(i); fNClusterP =0; for (i=0;iRemoveAt(i); @@ -165,106 +167,240 @@ void AliITSClusterFinderSSD::InitReconstruction(){ fNDigitsP = 0; fNDigitsN = 0; Float_t stereoP,stereoN; - GetSeg()->Angles(stereoP,stereoN); - CalcStepFactor(stereoP,stereoN); - if(GetDebug(1)) cout<<"fSFF = "<Angles(stereoP,stereoN); + GetSeg()->Angles(stereoP,stereoN); + CalcStepFactor(stereoP,stereoN); + // if (debug) cout<<"fSFF = "<GetITSgeom(); - - SetModule(module); - geom->GetModuleId(GetModule(),lay, lad, detect); - if ( lay == 6 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(6); - if ( lay == 5 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(5); - - InitReconstruction(); //ad. 1 - Map()->FillMap(); - FillDigitsIndex(); - SortDigits(); - FindNeighbouringDigits(); //ad. 2 - //SeparateOverlappedClusters(); //ad. 3 - ClustersToPackages(); //ad. 4 - Map()->ClearMap(); + // This function findes out all clusters belonging to one module + // 1. Zeroes all space after previous module reconstruction + // 2. Finds all neighbouring digits, create clusters + // 3. If necesery, resolves for each group of neighbouring digits + // how many clusters creates it. + // 4. Colculate the x and z coordinate + Int_t lay, lad, detect; + + //cout<<"clusterfinder: this is module "<GetITSgeom(); + + if(!fDetTypeRec->GetITSgeom()) { + Error("FindRawClusters","ITS geom is null!"); + return; + } + + SetModule(module); + fDetTypeRec->GetITSgeom()->GetModuleId(GetModule(),lay, lad, detect); + // geom->GetModuleId(module,lay, lad, detect); + + //cout<<"layer = "<SetLayer(6); + if ( lay == 5 ) ((AliITSsegmentationSSD*)GetSeg())->SetLayer(5); + + + InitReconstruction(); //ad. 1 + fMap->FillMap(); + + FillDigitsIndex(); + if ( (fNDigitsP==0 ) || (fNDigitsN == 0 )) return; + + SortDigits(); + FindNeighbouringDigits(module); //ad. 2 + + //SeparateOverlappedClusters(); //ad. 3 + ClustersToPackages(); //ad. 4 + + fMap->ClearMap(); + } //______________________________________________________________________ -void AliITSClusterFinderSSD::FindNeighbouringDigits(){ +void AliITSClusterFinderSSD::FindNeighbouringDigits(Int_t module){ //If there are any digits on this side, create 1st Cluster, // add to it this digit, and increment number of clusters - register Int_t i; - if ((fNDigitsP>0 ) && (fNDigitsN > 0 )) { - Int_t currentstripNo; - Int_t *dbuffer = new Int_t [300]; //buffer for strip numbers - Int_t dnumber; //curent number of digits in buffer - TArrayI &lDigitsIndexP = *fDigitsIndexP; - TArrayI &lDigitsIndexN = *fDigitsIndexN; - TObjArray &lDigits = *(Digits()); - TClonesArray &lClusterP = *fClusterP; - TClonesArray &lClusterN = *fClusterN; - //process P side + register Int_t i,j; + Int_t flag=0; + + //if ( (fNDigitsP==0 ) || (fNDigitsN == 0 )) return; + + Int_t currentstripNo; + Int_t *dbuffer = new Int_t [800]; //buffer for strip numbers + Int_t dnumber; //curent number of digits in buffer + + TArrayI &lDigitsIndexP = *fDigitsIndexP; + TArrayI &lDigitsIndexN = *fDigitsIndexN; + + TObjArray &lDigits = *(Digits()); + + TClonesArray &lClusterP = *fClusterP; + TClonesArray &lClusterN = *fClusterN; + + //process P side + dnumber = 1; + dbuffer[0]=lDigitsIndexP[0]; + + //If next digit is a neigh. of previous, adds to last clust. this digit + /* + cout<<"----------------------------------------------------------------"<GetStripNumber()<<" "<< + ((AliITSdigitSSD*)lDigits[lDigitsIndexP[0]])->GetSignal()<GetStripNumber(); + // cout<<" "<GetSignal()<GetStripNumber()) == (currentstripNo-1) ) + dbuffer[dnumber++]=lDigitsIndexP[i]; + + else{ + + // check signal + for(j=0;jGetSignal()) + > fgkNoiseThreshold* ((AliITSCalibrationSSD*)GetResp(module))-> + GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) ) + flag+=1; + + } + + //if(flag==dnumber) { + if(flag>0) { + //create a new one side cluster + + // cout<<" new cluster with "< - GetStripNumber(); - //check if it is a neighbour of a previous one - if((((AliITSdigitSSD*)lDigits[lDigitsIndexP[i-1]])-> - GetStripNumber()) - == (currentstripNo-1) ) dbuffer[dnumber++]=lDigitsIndexP[i]; - else{ - //create a new one side cluster - new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer, - Digits(), - fgkSIDEP); - dbuffer[0]=lDigitsIndexP[i]; - dnumber = 1; - } // end if else - } // end loop over fNDigitsP - new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer, - Digits(),fgkSIDEP); - //process N side - //for comments, see above + + } // end if else + + } // end loop over fNDigitsP + + // check signal + for(j=0;jGetSignal()) + > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))-> + GetNoiseP( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) ) + flag+=1; + + } + + //if(flag==dnumber) { + if(flag>0) { + //create a new one side cluster + + // cout<<" new cluster with "<GetStripNumber()<<" "<< + // ((AliITSdigitSSD*)lDigits[lDigitsIndexN[0]])->GetSignal()<GetStripNumber(); + // cout<<" "<GetSignal()<GetStripNumber()) == (currentstripNo-1) ) + dbuffer[dnumber++]=lDigitsIndexN[i]; + + else { + + // check signal + for(j=0;jGetSignal()) + > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))-> + GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) ) + flag+=1; + + } + + //if(flag==dnumber) { + if(flag>0) { + //create a new one side cluster + + // cout<<" new cluster with "< - GetStripNumber(); - if ( (((AliITSdigitSSD*)lDigits[lDigitsIndexN[i-1]])-> - GetStripNumber()) - == (currentstripNo-1) ) dbuffer[dnumber++]=lDigitsIndexN[i]; - else { - new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer, - Digits(), - fgkSIDEN); - dbuffer[0]=lDigitsIndexN[i]; - dnumber = 1; - } // end if else - } // end loop over fNDigitsN - new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer, - Digits(),fgkSIDEN); - delete [] dbuffer; - - } // end condition on NDigits - - if (GetDebug(1)) cout<<"\n Found clusters: fNClusterP = "<GetSignal()) + > fgkNoiseThreshold*((AliITSCalibrationSSD*)GetResp(module))-> + GetNoiseN( ((AliITSdigitSSD*)lDigits[dbuffer[j]])->GetStripNumber()) ) + flag+=1; + + } + + //if(flag==dnumber) { + if(flag>0) { + //create a new one side cluster + + // cout<<" new cluster with "< @@ -400,79 +536,55 @@ Int_t AliITSClusterFinderSSD::SortDigitsN(Int_t start, Int_t end){ Int_t left; if (start != (end - 1)){ - left=this->SortDigitsN(start,(start+end)/2); - right=this->SortDigitsN((start+end)/2,end); - return (left || right); + left=this->SortDigitsN(start,(start+end)/2); + right=this->SortDigitsN((start+end)/2,end); + return (left || right); }else{ - left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))-> - GetStripNumber(); - right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))-> - GetStripNumber(); - if ( left > right ){ - Int_t tmp = (*fDigitsIndexN)[start]; - (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end]; - (*fDigitsIndexN)[end]=tmp; - return 1; - }else return 0; + left =((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[start]]))-> + GetStripNumber(); + right=((AliITSdigitSSD*)((*(Digits()))[(*fDigitsIndexN)[end]]))-> + GetStripNumber(); + if ( left > right ){ + Int_t tmp = (*fDigitsIndexN)[start]; + (*fDigitsIndexN)[start]=(*fDigitsIndexN)[end]; + (*fDigitsIndexN)[end]=tmp; + return 1; + }else return 0; } // end if } //______________________________________________________________________ void AliITSClusterFinderSSD::FillDigitsIndex(){ //Fill the indexes of the clusters belonging to a given ITS module - Int_t pns=0, nns=0; - Int_t tmp,bit,k; + Int_t noentries; Int_t i; + Int_t gain=0; + Int_t signal=0; - noentries = NDigits(); + noentries = fDigits->GetEntriesFast(); - Int_t* psidx = new Int_t [noentries*sizeof(Int_t)]; - Int_t* nsidx = new Int_t [noentries*sizeof(Int_t)]; if (fDigitsIndexP==NULL) fDigitsIndexP = new TArrayI(noentries); if (fDigitsIndexN==NULL) fDigitsIndexN = new TArrayI(noentries); AliITSdigitSSD *dig; for ( i = 0 ; i< noentries; i++ ) { - dig = (AliITSdigitSSD*)GetDigit(i); - if(dig->IsSideP()) { - bit=1; - tmp=dig->GetStripNumber(); - // I find this totally unnecessary - it's just a - // CPU consuming double check - for( k=0;kAddAt(i,fNDigitsP++); - psidx[pns++]=tmp; - } // end if bit - } else { - bit=1; - tmp=dig->GetStripNumber(); - // same as above - for( k=0;kAddAt(i,fNDigitsN++); - nsidx[nns++] =tmp; - } // end if bit - } // end if + + dig = (AliITSdigitSSD*)GetDigit(i); + + gain=(Int_t) ((AliITSCalibrationSSD*)GetResp(fModule))->GetGainP(dig->GetStripNumber()); + signal=gain*dig->GetSignal(); + dig->SetSignal(signal); + + if(dig->IsSideP()) fDigitsIndexP->AddAt(i,fNDigitsP++); + else fDigitsIndexN->AddAt(i,fNDigitsN++); + } // end for i + + // delete [] psidx; + //delete [] nsidx; - delete [] psidx; - delete [] nsidx; - - if(GetDebug(1)) cout<<"Digits: P = "<SigN) { + signal = SigP; + dedx = SigP*kADCtoKeV; + }else{ + signal = SigN; + dedx = SigN*kADCtoKeV; + } // end if SigP>SigN + tr = (Int_t*) clusterP->GetTracks(n); + ntracks = clusterP->GetNTracks(); + + //cnew.SetDigitsClusterP(clusterP); + //cnew.SetDigitsClusterN(clusterN); + + cnew.SetSignalP(SigP); + cnew.SetSignalN(SigN); + cnew.SetMultiplicity(nstripsP); + cnew.SetMultN(nstripsN); + cnew.SetQErr(TMath::Abs(SigP-SigN)); + cnew.SetNTrack(ntracks); + //cnew.SetMeanNoiseP(meannoiseP); + //cnew.SetMeanNoiseN(meannoiseN); + fDetTypeRec->AddCluster(2,&cnew); + //fITS->AddCluster(2,&cnew); + //AliITSRecPoint rnew; + Int_t lab[4] = {tr[0],tr[1],tr[2],ind}; + Float_t hit[5] = {P*kconv,N*kconv,kRMSx*kRMSx,kRMSz*kRMSz,signal}; + Int_t info[3] = {nstripsP,nstripsN,lyr}; + + AliITSRecPoint rnew(lab,hit,info,kTRUE); + rnew.SetdEdX(dedx); + + fDetTypeRec->AddRecPoint(rnew); + // fITS->AddRecPoint(rnew); + return kTRUE; } // end if return kFALSE; } //______________________________________________________________________ -void AliITSClusterFinderSSD::CalcStepFactor(Double_t Psteo, Double_t Nsteo){ +void AliITSClusterFinderSSD::CalcStepFactor(Float_t Psteo, Float_t Nsteo){ // calculate the step factor for matching clusters // 95 is the pitch, 4000 - dimension along z ? - Double_t dz=GetSeg()->Dz(); + //Float_t dz=fSegmentation->Dz(); + Float_t dz=GetSeg()->Dz(); fSFF = ( (Int_t) (Psteo*dz/fPitch ) );// +1; fSFB = ( (Int_t) (Nsteo*dz/fPitch ) );// +1; @@ -665,10 +791,10 @@ AliITSclusterSSD* AliITSClusterFinderSSD::GetPSideCluster(Int_t idx){ // get P side clusters if((idx<0)||(idx>=fNClusterP)){ - Info("GetPSideCluster","0=fNClusterN)){ - Info("GetNSideCluster","0= %d out of range",idx,fNClusterN); - return 0; + printf("AliITSClusterFinderSSD::GetNSideCluster: index out of range\n"); + return 0; }else{ - return (AliITSclusterSSD*)((*fClusterN)[idx]); + return (AliITSclusterSSD*)((*fClusterN)[idx]); } // end if } //______________________________________________________________________ -Bool_t AliITSClusterFinderSSD::GetCrossing (Double_t &P, Double_t &N){ +AliITSclusterSSD* AliITSClusterFinderSSD::GetCluster(Int_t idx, Bool_t side){ + // Get cluster + + return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx); +} +//______________________________________________________________________ +Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N){ // get crossing // This function was rivised and changed by Boris Batiounia in March 2001 - Double_t dx = GetSeg()->Dx(); // detector size in x direction, microns - Double_t dz = GetSeg()->Dz(); // detector size in z direction, microns - Double_t xL; // x local coordinate - Double_t zL; // z local coordinate - Double_t x; // x = xL + dx/2 - Double_t z; // z = zL + dz/2 - Double_t xP; // x coordinate in the P side from the first P strip - Double_t xN; // x coordinate in the N side from the first N strip + Float_t dx = GetSeg()->Dx(); // detector size in x direction, microns + Float_t dz = GetSeg()->Dz(); // detector size in z direction, microns + //Float_t dx = fSegmentation->Dx(); // detector size in x direction, microns + //Float_t dz = fSegmentation->Dz(); // detector size in z direction, microns + //cout<Angles(stereoP,stereoN); GetSeg()->Angles(stereoP,stereoN); + + //cout<