X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSClusterFinderSDD.cxx;h=de10ca30076d00db33114c88a6512b61ac870d7b;hb=62bdc654ba1174f485e4626a8aa0ac0e6dd3f4c8;hp=7256e198f62106e3ae184b14229de3be2654c523;hpb=d2f55a221d7219c098055810b41496c204004f0c;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSClusterFinderSDD.cxx b/ITS/AliITSClusterFinderSDD.cxx index 7256e198f62..de10ca30076 100644 --- a/ITS/AliITSClusterFinderSDD.cxx +++ b/ITS/AliITSClusterFinderSDD.cxx @@ -14,189 +14,24 @@ **************************************************************************/ /* $Id$ - $Log$ - Revision 1.38 2005/02/15 13:39:35 masera - V2 clusterer moved to the standard framework. V2 clusters and recpoints are still different objects for the moment - - Revision 1.37 2004/06/10 21:00:24 nilsen - Modifications associated with remerging the Ba/Sa and Dubna pixel simulations, - some cleaning of general code (including coding convensions), and adding some - protections associated with SetDefaults/SetDefaultSimulations which should help - with the Test beam simulations. Details below. The default SPD simulation for - the general ITS runs/geometry is still the Ba/Sa, but for the Test beam - geometries this has been changed to the merged versions. - File: AliITS.cxx Modified - File: AliITS.h Modified - In lined many one-two line functions. Added some protection to - SetDefaults(), SetDefaultSimulation(), and SetDefaultClusterFinders(), - such that they should now even work when only one detector type has - been defined (as it should be for the test beams...). Some mostly - cosmetic issues associated with getting branch names for digits. And - Generally some cleaning up of the code. - File: AliITSClusterFinder.cxx Modified - File: AliITSClusterFinder.h Modified - Did some additional consolidation of data into the base class, added - TClonesArray *fClusters, a fDebug, and fModule variables. Otherwise - some cosmetic and coding conversion changes. - File: AliITSClusterFinderSDD.cxx Modified - File: AliITSClusterFinderSDD.h Modified - Changes to be consistent with the modified base class, and cosmetic - and coding conversion changes. - File: AliITSClusterFinderSPD.cxx Modified - File: AliITSClusterFinderSPD.h Modified - Changes to be consistent with the modified base class, and cosmetic - and coding conversion changes. - File: AliITSClusterFinderSPDdubna.h Removed - File: AliITSClusterFinderSPDdubna.cxx Removed - Since we have ClusterFinderSPD and V2 and this version isn't being - maintained, it is being retired. - File: AliITSClusterFinderSSD.cxx Modified - File: AliITSClusterFinderSSD.h Modified - Changes to be consistent with the modified base class, and cosmetic - and coding conversion changes. - File: AliITSDetType.cxx Modified - File: AliITSDetType.h Modified - Added a new class variable to indicate what the detector type is - AliITSDetector fDetType; values of kSPD, kSDD, kSSD, .... Otherwise - cosmetic and Coding convention changes. - File: AliITSLoader.cxx Modified - File: AliITSLoader.h Modified - Some changes which are not complete. The idea is to be able to get, - simply via one call, a specific hit, Sdigit, digit, RecPoint,... - without all of the usual over head of initializing TClonesArrays setting - branch addresses and the like. Work is far form ready. - File: AliITSdcsSSD.cxx Modified - Some nearly cosmetic changes necessary due to changes to response and - segmentation class'. - File: AliITSgeom.h Modified - In the definition of AliITSDetector type, added kND=-1, no detector - defined. Expect to use it later(?). - File: AliITSresponse.h Modified - Basically cosmetic. Mostly changing Float_t to Double_t. - File: AliITSresponseSDD.cxx Modified - File: AliITSresponseSDD.h Modified - Basically the cosmetic and Float_t to Double_t - File: AliITSresponseSPD.cxx Modified - File: AliITSresponseSPD.h Modified - Mostly Float_t to Double_t and added in the IsPixelDead function for - the dubna version (otherwise the merging had been done). - File: AliITSresponseSPDdubna.h Removed - File: AliITSresponseSPDdubna.cxx Removed - We should be able to remove this class now. AliITSresponseSPD is now - used for both the Bari-Salerno and the dubna models. - File: AliITSresponseSSD.cxx Modified - File: AliITSresponseSSD.h Modified - Float_t to Double_t changes. - File: AliITSsegmentation.h Modified - Made LocaltoDet return a Bool_t. Now if the x,z location is outside - of the volume, it returns kFALSE. see below. - File: AliITSsegmentationSDD.cxx Modified - File: AliITSsegmentationSDD.h Modified - Made LocaltoDet return a Bool_t. Now if the x,z location is outside - of the volume, it returns kFALSE. - File: AliITSsegmentationSPD.cxx Modified - File: AliITSsegmentationSPD.h Modified - Made LocaltoDet return a Bool_t. Now if the x,z location is outside - of the volume, it returns kFALSE. - File: AliITSsegmentationSSD.cxx Modified - File: AliITSsegmentationSSD.h Modified - Made LocaltoDet return a Bool_t. Now if the x,z location is outside - of the volume, it returns kFALSE. see below. - File: AliITSsimulation.cxx Modified - File: AliITSsimulation.h Modified - Added fDebug variable, new Constructor for use below. Cosmetic and - coding convention changes - File: AliITSsimulationSDD.cxx Modified - File: AliITSsimulationSDD.h Modified - Added new Constructor, removed redundant variables and Cosmetic and - coding convention changes. - File: AliITSsimulationSPD.cxx Modified - File: AliITSsimulationSPD.h Modified - Removed some dead code, made changes as needed by the changes above - (response and segmentation classes...). a few cosmetic and coding - convention changes. - File: AliITSsimulationSPDdubna.cxx Modified - File: AliITSsimulationSPDdubna.h Modified - New merged version, implemented new and old coupling with switch, - coding convention and similar changes. (found 1 bugs, missing - ! in front of if(mod-LineSegmentL(....,). - File: AliITSsimulationSSD.cxx Modified - File: AliITSsimulationSSD.h Modified - removed redundant variables with base class. Fixed for coding - convention and other cosmetic changes. - File: AliITSvSDD03.cxx Modified - File: AliITSvSPD02.cxx Modified - File: AliITSvSSD03.cxx Modified - These two have their private versions of SetDefaults and - SetDefaultSimulation which have been similarly protected as in AliITS.cxx - File: ITSLinkDef.h Modified - File: libITS.pkg Modified - Versions which include v11 geometry and other private changes - - Revision 1.36 2004/01/27 16:12:03 masera - Coding conventions for AliITSdigitXXX classes and AliITSTrackerV1 - - Revision 1.35 2003/11/10 16:33:50 masera - Changes to obey our coding conventions - - Revision 1.34 2003/09/11 13:48:52 masera - Data members of AliITSdigit classes defined as protected (They were public) - - Revision 1.33 2003/07/21 14:20:51 masera - Fix to track labes in SDD Rec-points - - Revision 1.31.2.1 2003/07/16 13:18:04 masera - Proper fix to track labels associated to SDD rec-points - - Revision 1.31 2003/05/19 14:44:41 masera - Fix to track labels associated to SDD rec-points - - Revision 1.30 2003/03/03 16:34:35 masera - Corrections to comply with coding conventions - - Revision 1.29 2002/10/25 18:54:22 barbera - Various improvements and updates from B.S.Nilsen and T. Virgili - - Revision 1.28 2002/10/22 14:45:29 alibrary - Introducing Riostream.h - - Revision 1.27 2002/10/14 14:57:00 hristov - Merging the VirtualMC branch to the main development branch (HEAD) - - Revision 1.23.4.2 2002/10/14 13:14:07 hristov - Updating VirtualMC to v3-09-02 - - Revision 1.26 2002/09/09 17:23:28 nilsen - Minor changes in support of changes to AliITSdigitS?D class'. - - Revision 1.25 2002/05/10 22:29:40 nilsen - Change my Massimo Masera in the default constructor to bring things into - compliance. - - Revision 1.24 2002/04/24 22:02:31 nilsen - New SDigits and Digits routines, and related changes, (including new - noise values). - */ /////////////////////////////////////////////////////////////////////////// // Cluster finder // // for Silicon // // Drift Detector // ////////////////////////////////////////////////////////////////////////// -#include -#include -#include #include "AliITSClusterFinderSDD.h" #include "AliITSMapA1.h" -#include "AliITS.h" -#include "AliITSdigitSDD.h" #include "AliITSRawClusterSDD.h" #include "AliITSRecPoint.h" +#include "AliITSdigitSDD.h" +#include "AliITSDetTypeRec.h" +#include "AliITSCalibrationSDD.h" #include "AliITSsegmentationSDD.h" -#include "AliITSresponseSDD.h" -#include "AliRun.h" +#include "AliITSgeom.h" +#include "AliLog.h" ClassImp(AliITSClusterFinderSDD) @@ -215,11 +50,10 @@ fMaxNCells(0){ // default constructor } //______________________________________________________________________ -AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSsegmentation *seg, - AliITSresponse *response, +AliITSClusterFinderSDD::AliITSClusterFinderSDD(AliITSDetTypeRec* dettyp, TClonesArray *digits, TClonesArray *recp): -AliITSClusterFinder(seg,response), +AliITSClusterFinder(dettyp), fNclusters(0), fDAnode(0.0), fDTime(0.0), @@ -233,12 +67,10 @@ fMaxNCells(0){ SetDigits(digits); SetClusters(recp); - SetCutAmplitude(); + SetCutAmplitude(fDetTypeRec->GetITSgeom()->GetStartSDD()); SetDAnode(); SetDTime(); - SetMinPeak((Int_t)(((AliITSresponseSDD*)GetResp())-> - GetNoiseAfterElectronics()*5)); - // SetMinPeak(); + SetMinPeak((Int_t)((AliITSCalibrationSDD*)GetResp(fDetTypeRec->GetITSgeom()->GetStartSDD()))->GetNoiseAfterElectronics(0)*5); SetMinNCells(); SetMaxNCells(); SetTimeCorr(); @@ -246,13 +78,24 @@ fMaxNCells(0){ SetMap(new AliITSMapA1(GetSeg(),Digits(),fCutAmplitude)); } //______________________________________________________________________ -void AliITSClusterFinderSDD::SetCutAmplitude(Double_t nsigma){ +void AliITSClusterFinderSDD::SetCutAmplitude(Int_t mod,Double_t nsigma){ // set the signal threshold for cluster finder - Double_t baseline,noise,noiseAfterEl; + Double_t baseline,noiseAfterEl; - GetResp()->GetNoiseParam(noise,baseline); - noiseAfterEl = ((AliITSresponseSDD*)GetResp())->GetNoiseAfterElectronics(); - fCutAmplitude = (Int_t)((baseline + nsigma*noiseAfterEl)); + AliITSresponseSDD* res = (AliITSresponseSDD*)((AliITSCalibrationSDD*)GetResp(mod))->GetResponse(); + const char *option=res->ZeroSuppOption(); + Int_t nanodes = GetResp(mod)->Wings()*GetResp(mod)->Channels()*GetResp(mod)->Chips(); + fCutAmplitude.Set(nanodes); + for(Int_t ian=0;ianGetNoiseAfterElectronics(ian); + if((strstr(option,"1D")) || (strstr(option,"2D"))){ + fCutAmplitude[ian] = (Int_t)(nsigma*noiseAfterEl); + } + else{ + baseline=GetResp(mod)->GetBaseline(ian); + fCutAmplitude[ian] = (Int_t)((baseline + nsigma*noiseAfterEl)); + } + } } //______________________________________________________________________ void AliITSClusterFinderSDD::Find1DClusters(){ @@ -265,17 +108,15 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Int_t dummy = 0; Double_t fTimeStep = GetSeg()->Dpx(dummy); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz(dummy); + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); + AliITSresponseSDD* res = (AliITSresponseSDD*)((AliITSCalibrationSDD*)GetResp(fModule))->GetResponse(); + const char *option=res->ZeroSuppOption(); // map the signal Map()->ClearMap(); - Map()->SetThreshold(fCutAmplitude); - Map()->FillMap(); - - Double_t noise; - Double_t baseline; - GetResp()->GetNoiseParam(noise,baseline); + Map()->SetThresholdArr(fCutAmplitude); + Map()->FillMap2(); Int_t nofFoundClusters = 0; Int_t i; @@ -298,7 +139,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ } // anodes for(k=0;k=fMaxNofSamples) break; fadc=(float)Map()->GetSignal(idx,id); if(fadc > fadcmax) { fadcmax = fadc; imax = id;} - if(fadc > (float)fCutAmplitude)lthrt++; + if(fadc > (float)fCutAmplitude[idx])lthrt++; if(dfadc[k][id] > dfadcmax) { dfadcmax = dfadc[k][id]; imaxd = id; @@ -340,7 +181,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ if(tstart+ij > 255) { tstop = 255; break; } fadc=(float)Map()->GetSignal(idx,tstart+ij); if((dfadc[k][tstart+ij] < dfadcmin) && - (fadc > fCutAmplitude)) { + (fadc > fCutAmplitude[idx])) { tstop = tstart+ij+5; if(tstop > 255) tstop = 255; dfadcmin = dfadc[k][it+ij]; @@ -353,12 +194,14 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Int_t clusterMult = 0; Double_t clusterPeakAmplitude = 0.; Int_t its,peakpos = -1; - Double_t n, baseline; - GetResp()->GetNoiseParam(n,baseline); - for(its=tstart; its<=tstop; its++) { + + for(its=tstart; its<=tstop; its++) { fadc=(float)Map()->GetSignal(idx,its); - if(fadc>baseline) fadc -= baseline; - else fadc = 0.; + if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ + Double_t baseline=GetResp(fModule)->GetBaseline(idx); + if(fadc>baseline) fadc -= baseline; + else fadc = 0.; + } clusterCharge += fadc; // as a matter of fact we should take the peak // pos before FFT @@ -383,7 +226,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ Double_t clusteranodePath = (clusterAnode - fNofAnodes/2)* anodePitch; - Double_t clusterDriftPath = clusterTime*fDriftSpeed; + Double_t clusterDriftPath = (Double_t)cal->GetDriftPath(clusterTime,clusteranodePath); clusterDriftPath = fSddLength-clusterDriftPath; if(clusterCharge <= 0.) break; AliITSRawClusterSDD clust(j+1,//i @@ -395,7 +238,7 @@ void AliITSClusterFinderSDD::Find1DClusters(){ clusteranodePath, //f clusterMult, //i 0,0,0,0,0,0,0);//7*i - fITS->AddCluster(1,&clust); + fDetTypeRec->AddCluster(1,&clust); it = tstop; } // ilcl it++; @@ -418,20 +261,20 @@ void AliITSClusterFinderSDD::Find1DClustersE(){ Int_t dummy=0; Double_t fTimeStep = GetSeg()->Dpx( dummy ); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz( dummy ); - Double_t n, baseline; - GetResp()->GetNoiseParam( n, baseline ); - // map the signal + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); Map()->ClearMap(); - Map()->SetThreshold( fCutAmplitude ); - Map()->FillMap(); - + Map()->SetThresholdArr( fCutAmplitude ); + Map()->FillMap2(); + + AliITSresponseSDD* res = (AliITSresponseSDD*)cal->GetResponse(); + const char *option=res->ZeroSuppOption(); + Int_t nClu = 0; // cout << "Search cluster... "<< endl; for( Int_t j=0; j<2; j++ ){ for( Int_t k=0; k baseline ) fadc -= baseline; - else fadc=0.; + if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ + Double_t baseline=GetResp(fModule)->GetBaseline(idx); + if( fadc > baseline ) fadc -= baseline; + else fadc=0.; + } charge += fadc; time += fadc*l; if( fadc > fmax ){ @@ -481,15 +327,16 @@ void AliITSClusterFinderSDD::Find1DClustersE(){ // time = lmax*fTimeStep; // ns if( time > fTimeCorr ) time -= fTimeCorr; // ns Double_t anodePath =(anode-fNofAnodes/2)*anodePitch; - Double_t driftPath = time*fDriftSpeed; + + Double_t driftPath = (Double_t)cal->GetDriftPath(time,anode); driftPath = fSddLength-driftPath; AliITSRawClusterSDD clust(j+1,anode,time,charge, fmax, peakpos,0.,0., driftPath,anodePath, nTsteps,start,stop, start, stop, 1, k, k ); - fITS->AddCluster( 1, &clust ); - if(GetDebug(5)) clust.PrintInfo(); + fDetTypeRec->AddCluster( 1, &clust ); + if(AliDebugLevel()>=5) clust.PrintInfo(); nClu++; } // end if nTsteps on = kFALSE; @@ -498,7 +345,7 @@ void AliITSClusterFinderSDD::Find1DClustersE(){ } // samples } // anodes } // wings - if(GetDebug(3)) cout << "# Rawclusters " << nClu << endl; + AliDebug(3,Form("# Rawclusters %d",nClu)); return; } //_______________________________________________________________________ @@ -582,7 +429,7 @@ void AliITSClusterFinderSDD::PeakFunc( Int_t xdim, Int_t zdim, Double_t *par, // par[i+2] = zpos // par[i+3] = tau // par[i+4] = sigma. - Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA + Int_t electronics = GetResp(fModule)->GetElectronics(); // 1 = PASCAL, 2 = OLA const Int_t knParam = 5; Int_t npeak = (Int_t)par[0]; @@ -649,8 +496,8 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param, delta = steprm[k]; d1 = delta; // ENSURE THAT STEP SIZE IS SENSIBLY LARGER THAN MACHINE ROUND OFF - if( fabs( p1 ) > 1.0E-6 ) - if ( fabs( delta/p1 ) < 1.0E-4 ) delta = p1/1000; + if( TMath::Abs( p1 ) > 1.0E-6 ) + if ( TMath::Abs( delta/p1 ) < 1.0E-4 ) delta = p1/1000; else delta = (Double_t)1.0E-4; // EVALUATE CHI-SQUARED AT FIRST TWO SEARCH POINTS PeakFunc( xdim, zdim, param, speFit ); @@ -687,10 +534,10 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param, if( param[k] <= 20 ) param[k] = fMinPeak; break; case 1 : - if( fabs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; + if( TMath::Abs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; break; case 2 : - if( fabs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; + if( TMath::Abs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; break; case 3 : if( param[k] < .5 ) param[k] = .5; @@ -717,8 +564,8 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param, //--IN CASE OF NEARLY EQUAL CHI-SQUARED AND TOO SMALL STEP SIZE PREVENT // ERRONEOUS EVALUATION OF PARABOLA MINIMUM //---NEXT TWO LINES CAN BE OMITTED FOR HIGHER PRECISION MACHINES - //dp = (Double_t) max (fabs(p3-p2), fabs(p2-p1)); - //if( fabs( p2-p0 ) > dp ) p0 = p2; + //dp = (Double_t) max (TMath::Abs(p3-p2), TMath::Abs(p2-p1)); + //if( TMath::Abs( p2-p0 ) > dp ) p0 = p2; param[k] = p0; // Constrain paramiters Int_t kpos = (k-1) % knParam; @@ -727,10 +574,10 @@ void AliITSClusterFinderSDD::Minim( Int_t xdim, Int_t zdim, Double_t *param, if( param[k] <= 20 ) param[k] = fMinPeak; break; case 1 : - if( fabs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; + if( TMath::Abs( param[k] - prm0[k] ) > 1.5 ) param[k] = prm0[k]; break; case 2 : - if( fabs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; + if( TMath::Abs( param[k] - prm0[k] ) > 1. ) param[k] = prm0[k]; break; case 3 : if( param[k] < .5 ) param[k] = .5; @@ -793,7 +640,7 @@ Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim, iterNum++; chi0 = chi1; Minim( xdim, zdim, param, prm0, step, &chi1, spe, speFit ); - reldif = ( chi1 > 0 ) ? ((Double_t) fabs( chi1-chi0)/chi1 ) : 0; + reldif = ( chi1 > 0 ) ? ((Double_t) TMath::Abs( chi1-chi0)/chi1 ) : 0; // EXIT conditions if( reldif < (float) kchilmt ){ *chir = (chi1>0) ? (float) TMath::Sqrt (chi1/degFree) :0; @@ -833,7 +680,7 @@ Int_t AliITSClusterFinderSDD::NoLinearFit( Int_t xdim, Int_t zdim, if ((double)a < 1.0E-6) prmin = 0; else prmin = (float) (0.5*b/a); dp = 5*(tmp2-tmp0); - if( fabs(prmin-tmp2) > fabs(dp) ) prmin = tmp2+dp; + if( TMath::Abs(prmin-tmp2) > TMath::Abs(dp) ) prmin = tmp2+dp; param[k] = prmin; step[k] = dp/10; // OPTIMIZE SEARCH STEP } // end for k @@ -861,11 +708,12 @@ void AliITSClusterFinderSDD::ResolveClusters(){ Int_t dummy=0; Double_t fTimeStep = GetSeg()->Dpx( dummy ); Double_t fSddLength = GetSeg()->Dx(); - Double_t fDriftSpeed = GetResp()->DriftSpeed(); Double_t anodePitch = GetSeg()->Dpz( dummy ); - Double_t n, baseline; - GetResp()->GetNoiseParam( n, baseline ); - Int_t electronics = GetResp()->Electronics(); // 1 = PASCAL, 2 = OLA + Int_t electronics =GetResp(fModule)->GetElectronics(); // 1 = PASCAL, 2 = OLA + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); + AliITSresponseSDD* res = (AliITSresponseSDD*)cal->GetResponse(); + const char *option=res->ZeroSuppOption(); + for( Int_t j=0; jGetSignal( ianode, itime ); - if( fadc > baseline ) fadc -= (Double_t)baseline; - else fadc = 0.; + Double_t fadc = Map()->GetSignal( ianode, itime ); + if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ + Double_t baseline=GetResp(fModule)->GetBaseline(ianode); + if( fadc > baseline ) fadc -= (Double_t)baseline; + else fadc = 0.; + } Int_t index = (itime-tstart+1)*zdim+(ianode-astart+1); sp[index] = fadc; } // time loop @@ -983,21 +834,25 @@ void AliITSClusterFinderSDD::ResolveClusters(){ if( peakpos < 0 ) { //Warning("ResolveClusters", // "Digit not found for cluster"); - //if(GetDebug(3)) clusterI.PrintInfo(); + //if(AliDebugLevel()>=3) clusterI.PrintInfo(); continue; } - clusterI.SetPeakPos( peakpos ); - Double_t driftPath = fSddLength - newiTimef * fDriftSpeed; + clusterI.SetPeakPos( peakpos ); + Float_t dp = cal->GetDriftPath(newiTimef,newAnodef); + Double_t driftPath = fSddLength - (Double_t)dp; Double_t sign = ( wing == 1 ) ? -1. : 1.; - clusterI.SetX( driftPath*sign * 0.0001 ); - clusterI.SetZ( anodePath * 0.0001 ); + Double_t xcoord = driftPath*sign * 0.0001; + Double_t zcoord = anodePath * 0.0001; + CorrectPosition(zcoord,xcoord); + clusterI.SetX( xcoord ); + clusterI.SetZ( zcoord ); clusterI.SetAnode( newAnodef ); clusterI.SetTime( newiTimef ); clusterI.SetAsigma( sigma[i]*anodePitch ); clusterI.SetTsigma( tau[i]*fTimeStep ); clusterI.SetQ( integral[i] ); - fITS->AddCluster( 1, &clusterI ); + fDetTypeRec->AddCluster( 1, &clusterI ); } // end for i Clusters()->RemoveAt( j ); delete [] par; @@ -1038,10 +893,10 @@ void AliITSClusterFinderSDD::GroupClusters(){ if(clusterI->T() < fTimeStep*10) fDAnode = 1.5; // TB 1. Bool_t pair = clusterI->Brother(clusterJ,fDAnode,fDTime); if(!pair) continue; - if(GetDebug(4)){ + if(AliDebugLevel()>=4){ clusterI->PrintInfo(); clusterJ->PrintInfo(); - } // end if GetDebug + } // end if AliDebugLevel clusterI->Add(clusterJ); label[j] = 1; Clusters()->RemoveAt(j); @@ -1081,7 +936,7 @@ void AliITSClusterFinderSDD::SelectClusters(){ } //______________________________________________________________________ -void AliITSClusterFinderSDD::GetRecPoints(){ +void AliITSClusterFinderSDD::GetRecPoints(AliITSCalibrationSDD* cal){ // get rec points // get number of clusters for this module @@ -1089,12 +944,21 @@ void AliITSClusterFinderSDD::GetRecPoints(){ nofClusters -= fNclusters; const Double_t kconvGeV = 1.e-6; // GeV -> KeV const Double_t kconv = 1.0e-4; + const Double_t kcmToMicrons = 10000.; const Double_t kRMSx = 38.0*kconv; // microns->cm ITS TDR Table 1.3 const Double_t kRMSz = 28.0*kconv; // microns->cm ITS TDR Table 1.3 + Int_t nAnodes=GetSeg()->NpzHalf(); Int_t i; Int_t ix, iz, idx=-1; AliITSdigitSDD *dig=0; Int_t ndigits=NDigits(); + + Int_t lay,lad,det; + fDetTypeRec->GetITSgeom()->GetModuleId(fModule,lay,lad,det); + Int_t ind=(lad-1)*fDetTypeRec->GetITSgeom()->GetNdetectors(lay)+(det-1); + Int_t lyr=(lay-1); + + for(i=0; iGetPadIxz(clusterI->X(),clusterI->Z(),ix,iz); + Float_t xMicrons=clusterI->X()*kcmToMicrons; + Float_t zMicrons=clusterI->Z()*kcmToMicrons; + Float_t zAnode=zMicrons/GetSeg()->Dpz(0)+nAnodes/2; + Float_t driftSpeed=cal->GetDriftSpeedAtAnode(zAnode); + Float_t driftPath=GetSeg()->Dx()-TMath::Abs(xMicrons); + ix=1+(Int_t)(driftPath/driftSpeed/GetSeg()->Dpx(0)); + iz=1+(Int_t)zAnode; + if(xMicrons>0) iz+=nAnodes; dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix-1); // if null try neighbours if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix); if (!dig) dig = (AliITSdigitSDD*)Map()->GetHit(iz-1,ix+1); if (!dig) printf("SDD: cannot assign the track number!\n"); } // end if !dig - AliITSRecPoint rnew; - rnew.SetX(clusterI->X()); - rnew.SetZ(clusterI->Z()); - rnew.SetQ(clusterI->Q()); // in KeV - should be ADC - rnew.SetdEdX(kconvGeV*clusterI->Q()); - rnew.SetSigmaX2(kRMSx*kRMSx); - rnew.SetSigmaZ2(kRMSz*kRMSz); - if(dig) rnew.fTracks[0]=dig->GetTrack(0); - if(dig) rnew.fTracks[1]=dig->GetTrack(1); - if(dig) rnew.fTracks[2]=dig->GetTrack(2); + Int_t lab[4] = {-3141593,-3141593,-3141593,ind}; + if (dig) { + lab[0] = dig->GetTrack(0); + lab[1] = dig->GetTrack(1); + lab[2] = dig->GetTrack(2); + } + Float_t hit[5] = {clusterI->X(),clusterI->Z(),kRMSx*kRMSx,kRMSz*kRMSz,clusterI->Q()}; + Int_t info[3] = {0,0,lyr}; - fITS->AddRecPoint(rnew); + AliITSRecPoint rnew(lab,hit,info,kTRUE); + rnew.SetdEdX(kconvGeV*clusterI->Q()); + + fDetTypeRec->AddRecPoint(rnew); } // I clusters // Map()->ClearMap(); } @@ -1132,11 +1004,19 @@ void AliITSClusterFinderSDD::FindRawClusters(Int_t mod){ // find raw clusters SetModule(mod); + SetCutAmplitude(mod); + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(mod); + Int_t nanodes=GetSeg()->Npz(); + Int_t noise=0; + for(Int_t i=0;iGetNoiseAfterElectronics(i); + } + SetMinPeak((noise/nanodes)*5); Find1DClustersE(); GroupClusters(); SelectClusters(); ResolveClusters(); - GetRecPoints(); + GetRecPoints(cal); } //_______________________________________________________________________ void AliITSClusterFinderSDD::PrintStatus() const{ @@ -1149,10 +1029,35 @@ void AliITSClusterFinderSDD::PrintStatus() const{ cout << "Anode Tolerance: " << fDAnode << endl; cout << "Time Tolerance: " << fDTime << endl; cout << "Time correction (electronics): " << fTimeCorr << endl; - cout << "Cut Amplitude (threshold): " << fCutAmplitude << endl; + cout << "Cut Amplitude (threshold): " << fCutAmplitude[0] << endl; cout << "Minimum Amplitude: " << fMinPeak << endl; cout << "Minimum Charge: " << fMinCharge << endl; cout << "Minimum number of cells/clusters: " << fMinNCells << endl; cout << "Maximum number of cells/clusters: " << fMaxNCells << endl; cout << "**************************************************" << endl; } + +//_________________________________________________________________________ +void AliITSClusterFinderSDD::CorrectPosition(Double_t &z, Double_t&y){ + //correction of coordinates using the maps stored in the DB + + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); + static const Int_t nbint = cal->GetMapTimeNBin(); + static const Int_t nbina = cal->Chips()*cal->Channels(); + Float_t stepa = (GetSeg()->Dpz(0))/10000.; //anode pitch in cm + Float_t stept = (GetSeg()->Dx()/cal->GetMapTimeNBin()/2.)/10.; + + Int_t bint = TMath::Abs((Int_t)(y/stept)); + if(y>=0) bint+=(Int_t)(nbint/2.); + if(bint>nbint) AliError("Wrong bin number!"); + + Int_t bina = TMath::Abs((Int_t)(z/stepa)); + if(z>=0) bina+=(Int_t)(nbina/2.); + if(bina>nbina) AliError("Wrong bin number!"); + + Double_t devz = (Double_t)cal->GetMapACell(bina,bint)/10000.; + Double_t devx = (Double_t)cal->GetMapTCell(bina,bint)/10000.; + z+=devz; + y+=devx; + +}