Adding rekonstruction facilities
Piotr Krzysztof Skowronski
December 1999.
+
+//Piotr Krzysztof Skowronski
+//Warsaw University of Technology
+//skowron@if.pw.edu.pl
+
*/
/*
*/
+#include <iostream.h>
+
+
#include "AliRun.h"
+#include "AliITS.h"
+#include "AliITSdigit.h"
+#include "AliITSRawCluster.h"
+#include "AliITSRecPoint.h"
+#include "AliITSMapA1.h"
#include "AliITSClusterFinderSSD.h"
-
+#include "AliITSclusterSSD.h"
+#include "AliITSpackageSSD.h"
+#include "AliITSsegmentation.h"
+
+const Bool_t AliITSClusterFinderSSD::fgkSIDEP=kTRUE;
+const Bool_t AliITSClusterFinderSSD::fgkSIDEN=kFALSE;
const Int_t debug=0;
AliITSClusterFinderSSD::AliITSClusterFinderSSD(AliITSsegmentation *seg, TClonesArray *digits, TClonesArray *recp)
{
+//Standard constructor
fSegmentation=seg;
fDigits=digits;
fRecPoints=recp;
+ fMap = new AliITSMapA1(fSegmentation,fDigits);
+
fITS=(AliITS*)gAlice->GetModule("ITS");
fClusterP = new TClonesArray ("AliITSclusterSSD",200);
fTanP=TMath::Tan(StereoP);
fTanN=TMath::Tan(StereoN);
+ fPNsignalRatio=7./8.; // warning: hard-wired number
+
}
//-------------------------------------------------------
AliITSClusterFinderSSD::~AliITSClusterFinderSSD() {
-
+// 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
- for(i=0;i<fNClusterP;i++)
+ for (i=0;i<fNClusterP;i++)
{
fClusterP->RemoveAt(i);
}
fNClusterP =0;
- for(i=0;i<fNClusterN;i++)
+ for (i=0;i<fNClusterN;i++)
{
fClusterN->RemoveAt(i);
}
fNClusterN=0;
- for(i=0;i<fNPackages;i++)
+ for (i=0;i<fNPackages;i++)
{
fPackages->RemoveAt(i);
}
//---------------------------------------------
void AliITSClusterFinderSSD::FindRawClusters()
{
-
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
// This function findes out all clusters belonging to one module
// 1. Zeroes all space after previous module reconstruction
// 2. Finds all neighbouring digits
// 5. Creates clusters
InitReconstruction(); //ad. 1
+ fMap->FillMap();
FillDigitsIndex();
SortDigits();
FindNeighbouringDigits(); //ad. 2
ConsumeClusters();
PackagesToPoints(); //ad. 5
ReconstructNotConsumedClusters();
-
+
+ fMap->ClearMap();
}
//-------------------------------------------------
void AliITSClusterFinderSSD::FindNeighbouringDigits()
{
+//If there are any digits on this side, create 1st Cluster,
+// add to it this digit, and increment number of clusters
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
register Int_t i;
- //If there are any digits on this side, create 1st Cluster,
- // add to it this digit, and increment number of clusters
if ((fNDigitsP>0 ) && (fNDigitsN > 0 )) {
dnumber = 1;
dbuffer[0]=lDigitsIndexP[0];
//If next digit is a neighbour of previous, adds to last cluster this digit
- for(i=1; i<fNDigitsP; i++) {
+ for (i=1; i<fNDigitsP; i++) {
//reads new digit
currentstripNo = ((AliITSdigitSSD*)lDigits[lDigitsIndexP[i]])->
GetStripNumber();
== (currentstripNo-1) ) dbuffer[dnumber++]=lDigitsIndexP[i];
else {
//create a new one side cluster
- new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,SIDEP);
+ new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,fgkSIDEP);
dbuffer[0]=lDigitsIndexP[i];
dnumber = 1;
}
} // end loop over fNDigitsP
- new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,SIDEP);
+ new(lClusterP[fNClusterP++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,fgkSIDEP);
//process N side
dnumber = 1;
dbuffer[0]=lDigitsIndexN[0];
//If next digit is a neighbour of previous, adds to last cluster this digit
- for(i=1; i<fNDigitsN; i++) {
+ for (i=1; i<fNDigitsN; i++) {
currentstripNo = ((AliITSdigitSSD*)(lDigits[lDigitsIndexN[i]]))->
GetStripNumber();
if ( (((AliITSdigitSSD*)lDigits[lDigitsIndexN[i-1]])->GetStripNumber())
== (currentstripNo-1) ) dbuffer[dnumber++]=lDigitsIndexN[i];
else {
- new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,SIDEN);
+ new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,fgkSIDEN);
dbuffer[0]=lDigitsIndexN[i];
dnumber = 1;
}
} // end loop over fNDigitsN
- new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,SIDEN);
+ new(lClusterN[fNClusterN++]) AliITSclusterSSD(dnumber,dbuffer,fDigits,fgkSIDEN);
delete [] dbuffer;
} // end condition on NDigits
void AliITSClusterFinderSSD::SeparateOverlappedClusters()
{
-//************************************************
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// overlapped clusters separation
- register Int_t i,j; //iterator
+ register Int_t i; //iterator
Float_t factor=0.75; // How many percent must be lower signal
// on the middle one digit
splitlist = new TArrayI(300);
- for(i=0;i<initPsize;i++)
+ for (i=0;i<initPsize;i++)
{
if (( ((AliITSclusterSSD*)(*fClusterP)[i])->GetNumOfDigits())==1) continue;
if (( ((AliITSclusterSSD*)(*fClusterP)[i])->GetNumOfDigits())==2) continue;
Int_t nj=(((AliITSclusterSSD*)(*fClusterP)[i])->GetNumOfDigits()-1);
- for(j=1; j<nj; j++)
+ for (Int_t j=1; j<nj; j++)
{
signal1=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j);
signal0=((AliITSclusterSSD*)(*fClusterP)[i])->GetDigitSignal(j-1);
}
} // end loop over number of digits
//split this cluster if necessary
- if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,SIDEP);
- numerofsplits=0;
+ if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEP);
+ numerofsplits=0;
//in signed places (splitlist)
} // end loop over clusters on Pside
- for(i=0;i<initNsize;i++) {
+ for (i=0;i<initNsize;i++) {
if (( ((AliITSclusterSSD*)(*fClusterN)[i])->GetNumOfDigits())==1) continue;
if (( ((AliITSclusterSSD*)(*fClusterN)[i])->GetNumOfDigits())==2) continue;
Int_t nj=(((AliITSclusterSSD*)(*fClusterN)[i])->GetNumOfDigits()-1);
- for(j=1; j<nj; j++)
+ for (Int_t j=1; j<nj; j++)
{
signal1=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j);
signal0=((AliITSclusterSSD*)(*fClusterN)[i])->GetDigitSignal(j-1);
(*splitlist)[numerofsplits++]=j;
} // end loop over number of digits
//split this cluster into more clusters
- if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,SIDEN);
+ if(numerofsplits>0) SplitCluster(splitlist,numerofsplits,i,fgkSIDEN);
numerofsplits=0; //in signed places (splitlist)
} // end loop over clusters on Nside
//-------------------------------------------------------
void AliITSClusterFinderSSD::SplitCluster(TArrayI *list, Int_t nsplits, Int_t index, Bool_t side)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
//This function splits one side cluster into more clusters
//number of splits is defined by "nsplits"
//Place of splits are defined in the TArray "list"
// side true means P side
if (side) {
curentcluster =((AliITSclusterSSD*)((*fClusterP)[index])) ;
- for(i = nsplits; i>0 ;i--) {
+ for (i = nsplits; i>0 ;i--) {
NN=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
new ((*fClusterP)[fNClusterP]) AliITSclusterSSD(NN,tmpdigits,fDigits,side);
( (AliITSclusterSSD*)((*fClusterP)[fNClusterP]) )->
} // end loop over nplits
} else {
curentcluster =((AliITSclusterSSD*)((*fClusterN)[index]));
- for(i = nsplits; i>0 ;i--) {
+ for (i = nsplits; i>0 ;i--) {
NN=curentcluster->SplitCluster((*list)[(i-1)],tmpdigits);
new ((*fClusterN)[fNClusterN]) AliITSclusterSSD(NN,tmpdigits,fDigits,side);
((AliITSclusterSSD*)((*fClusterN)[fNClusterN]))->
//-------------------------------------------------
Int_t AliITSClusterFinderSSD::SortDigitsP(Int_t start, Int_t end)
{
+// sort digits on the P side
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
Int_t right;
Int_t left;
Int_t AliITSClusterFinderSSD::SortDigitsN(Int_t start, Int_t end)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// sort digits on the N side
Int_t right;
Int_t left;
//------------------------------------------------
void AliITSClusterFinderSSD::FillDigitsIndex()
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
//Fill the indexes of the clusters belonging to a given ITS module
- //Created by Piotr K. Skowronski, August 7 1999
Int_t PNs=0, NNs=0;
Int_t tmp,bit,k;
AliITSdigitSSD *dig;
- for(i = 0 ; i< N; i++ ) {
+ for ( i = 0 ; i< N; i++ ) {
dig=(AliITSdigitSSD*)fDigits->UncheckedAt(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;k<PNs;k++)
+ for( k=0;k<PNs;k++)
{
if (tmp==PSidx[k])
{
bit=1;
tmp=dig->GetStripNumber();
// same as above
- for(k=0;k<NNs;k++)
+ for( k=0;k<NNs;k++)
{
if (tmp==NSidx[k])
{
}
}
+ delete [] PSidx;
+ delete [] NSidx;
if (debug) cout<<"Digits : P = "<<fNDigitsP<<" N = "<<fNDigitsN<<endl;
void AliITSClusterFinderSSD::SortDigits()
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
-
+// sort digits
Int_t i;
if(fNDigitsP>1)
- for(i=0;i<fNDigitsP-1;i++)
+ for (i=0;i<fNDigitsP-1;i++)
if (SortDigitsP(0,(fNDigitsP-1-i))==0) break;
if(fNDigitsN>1)
- for(i=0;i<fNDigitsN-1;i++)
+ for (i=0;i<fNDigitsN-1;i++)
if(SortDigitsN(0,(fNDigitsN-1-i))==0) break;
}
//----------------------------------------------
void AliITSClusterFinderSSD::FillClIndexArrays(Int_t* arrayP, Int_t *arrayN)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
+// fill cluster index array
register Int_t i;
- for(i=0; i<fNClusterP;i++)
+ for (i=0; i<fNClusterP;i++)
{
arrayP[i]=i;
}
- for(i=0; i<fNClusterN;i++)
+ for (i=0; i<fNClusterN;i++)
{
arrayN[i]=i;
}
//------------------------------------------------------
void AliITSClusterFinderSSD::SortClusters(Int_t* arrayP, Int_t *arrayN)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
+// sort clusters
Int_t i;
if(fNClusterP>1)
- for(i=0;i<fNClusterP-1;i++)
+ for (i=0;i<fNClusterP-1;i++)
if (SortClustersP(0,(fNClusterP-1),arrayP)==0) break;
if(fNClusterN>1)
- for(i=0;i<fNClusterN-1;i++)
+ for (i=0;i<fNClusterN-1;i++)
if (SortClustersN(0,(fNClusterN-1),arrayN)==0) break;
}
//---------------------------------------------------
Int_t AliITSClusterFinderSSD::SortClustersP(Int_t start, Int_t end, Int_t *array)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
+//Sort P side clusters
Int_t right;
//-------------------------------------------------------
Int_t AliITSClusterFinderSSD::SortClustersN(Int_t start, Int_t end, Int_t *array)
{
+//Sort N side clusters
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
Int_t right;
Int_t left;
//-------------------------------------------------------
void AliITSClusterFinderSSD::ClustersToPackages()
{
-
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
+// fill packages
Int_t *oneSclP = new Int_t[fNClusterP]; //I want to have sorted 1 S clusters
Int_t *oneSclN = new Int_t[fNClusterN]; //I can not sort it in TClonesArray
// MB: well, that's not true that one
//cannot sort objects in TClonesArray
- Int_t i,k; //iterator
+ register Int_t i; //iterator
AliITSpackageSSD *currentpkg;
AliITSclusterSSD *currentP;
AliITSclusterSSD *currentN;
currentpkg = (AliITSpackageSSD*)((*fPackages)[0]);
//main loop on sorted P side clusters
- for(i=0;i<fNClusterP;i++) {
+ Int_t k;
+ for (i=0;i<fNClusterP;i++) {
//Take new P side cluster
currentP = GetPSideCluster(oneSclP[i]);
currentN = GetNSideCluster(oneSclN[lastNclIndex]);
}
tmplastNclIndex=lastNclIndex;
//Check if next N side clusters crosses with it too
- for(k=1;k<fSFF+1;k++) {
+ for (Int_t k=1;k<fSFF+1;k++) {
//check if we are not out of array
if ((tmplastNclIndex+k)<fNClusterN) {
fcurrN = GetNSideCluster( oneSclN[tmplastNclIndex+k] );
currentpkg->AddPSideCluster(oneSclP[i]);
//Check, if next N side clusters crosses with it too
tmplastNclIndex=lastNclIndex;
- for(k=1;k<fSFF+1;k++) {
+ for (Int_t k=1;k<fSFF+1;k++) {
//Check if we are not out of array
if ((tmplastNclIndex+k)<fNClusterN) {
fcurrN = GetNSideCluster(oneSclN[tmplastNclIndex+k]);
//-----------------------------------------------
void AliITSClusterFinderSSD::PackagesToPoints()
{
+// find recpoints from packages
register Int_t i;
AliITSpackageSSD *currentpkg;
Int_t clusterIndex;
Bool_t clusterSide;
- for(i=0;i<fNPackages;i++) {
+ for (i=0;i<fNPackages;i++) {
//get pointer to next package
currentpkg = (AliITSpackageSSD*)((*fPackages)[i]);
NumNcl = currentpkg->GetNumOfClustersN();
void AliITSClusterFinderSSD::
ResolveClusterWithOneCross(AliITSpackageSSD *currentpkg, Int_t clusterIndex, Bool_t clSide)
{
+// resolve clusters with one cross
+/*
+
+ie:
+ \ /
+ \ /
+ \/
+ /\
+ / \
+ / \
+ / \
+ / \
+ / \
+*/
+
+
- if (clSide == SIDEP) ResolvePClusterWithOneCross(currentpkg,clusterIndex);
+ if (clSide == fgkSIDEP) ResolvePClusterWithOneCross(currentpkg,clusterIndex);
else ResolveNClusterWithOneCross(currentpkg,clusterIndex);
}
void AliITSClusterFinderSSD::
ResolvePClusterWithOneCross(AliITSpackageSSD *pkg, Int_t clusterIndex)
{
-
+// resolve clusters with one cross on P side
/*
There is cluster (side P) which crosses with only one cluster on the other
side (N)
ns = clusterN->GetTotalSignal();
posClusterN = GetClusterZ(clusterN);
posErrorClusterN = clusterN->GetPositionError();
- pkg->DelCluster(clusterIndex,SIDEP);
- sigClusterN = ps/PNsignalRatio;
+ pkg->DelCluster(clusterIndex,fgkSIDEP);
+ sigClusterN = ps/fPNsignalRatio;
// there is no sonse to check how signal ratio is far from perfect
// matching line if the if below it is true
if (ns < sigClusterN) {
sigClusterN=ns;
- if (debug) cout<<"n1 < p1/PNsignalRatio";
+ if (debug) cout<<"n1 < p1/fPNsignalRatio";
if (debug) cout<<"Attempting to del cluster N "<<clusterIdx<<" ... \n";
- pkg->DelClusterOI(clusterIdx,SIDEN);
+ pkg->DelClusterOI(clusterIdx,fgkSIDEN);
} else {
//Let's see how signal ratio is far from perfect matching line
Chicomb = DistToPML(ps,ns);
if (debug) cout<<"Chic "<<Chicomb<<"\n";
- if (Chicomb > falpha2) {
+ if (Chicomb > fAlpha2) {
//it is near, so we can risk throwing this cluster away too
if (debug) cout<<"Attempting to del cluster N "<<clusterIdx<<"...\n";
- pkg->DelClusterOI(clusterIdx,SIDEN);
+ pkg->DelClusterOI(clusterIdx,fgkSIDEN);
} else {
clusterN->CutTotalSignal(sigClusterN);
if (debug) cout <<"Signal cut |||||||||||||\n";
void AliITSClusterFinderSSD::
ResolveNClusterWithOneCross(AliITSpackageSSD *pkg, Int_t clusterIndex)
{
+// resolve clusters with one cross on N side
+
AliITSclusterSSD * clusterP;
AliITSclusterSSD * clusterN;
ps = clusterP->GetTotalSignal();
posClusterP = GetClusterZ(clusterP);
posErrorClusterP = clusterP->GetPositionError();
- pkg->DelCluster(clusterIndex,SIDEN);
- sigClusterP=ns*PNsignalRatio;
+ pkg->DelCluster(clusterIndex,fgkSIDEN);
+ sigClusterP=ns*fPNsignalRatio;
// there is no sonse to check how signal ratio is far from perfect
// matching line if the if below it is true
if (ps < sigClusterP) {
sigClusterP = ps;
- if (debug) cout<<"ps < ns*PNsignalRatio";
+ if (debug) cout<<"ps < ns*fPNsignalRatio";
if (debug) cout<<"Attempting to del cluster P "<<clusterIdx<<" ... \n";
- pkg->DelClusterOI(clusterIdx,SIDEP);
+ pkg->DelClusterOI(clusterIdx,fgkSIDEP);
} else {
//Let's see how signal ratio is far from perfect matching line
Chicomb = DistToPML(ps,ns);
if (debug) cout<<"Chic "<<Chicomb<<"\n";
- if (Chicomb > falpha2) {
+ if (Chicomb > fAlpha2) {
//it is near, so we can risk frowing this cluster away too
if (debug) cout<<"Attempting to del cluster P "<<clusterIdx<<"...\n";
- pkg->DelClusterOI(clusterIdx,SIDEP);
+ pkg->DelClusterOI(clusterIdx,fgkSIDEP);
} else {
clusterN->CutTotalSignal(sigClusterP);
if (debug) cout <<"Signal cut ------------\n";
Bool_t AliITSClusterFinderSSD::
ResolvePackageBestCombin(AliITSpackageSSD *pkg)
{
+//find best combination
+
if (debug) cout<<"NumNcl==NumPcl ("<<pkg->GetNumOfClustersN()
<<"=="<<pkg->GetNumOfClustersP()<<"); Generating combinations ... \n";
Int_t Ncombin; //Number of combinations
Int_t itera; //iterator
Int_t sizet=1; //size of array to allocate
-
+
Int_t NP = pkg->GetNumOfClustersP();
- for(itera =2; itera <= NP ;itera ++) {
+ for (itera =2; itera <= NP ;itera ++) {
sizet=sizet*itera;
if (sizet > 10000) {
sizet=10000;
}
}
- Int_t** combin = new (Int_t*)[sizet]; //2D array to keep combinations in
+ Int_t** combin = new Int_t*[sizet]; //2D array to keep combinations in
- for(itera =0; itera <sizet;itera++) {
+ for (itera =0; itera <sizet;itera++) {
combin[itera] = new Int_t[NP+1];
}
Int_t bc = GetBestComb(combin,Ncombin,NP,pkg);
if (debug) cout<<" bc "<<bc <<"\n";
- for(itera =0; itera < NP; itera ++) {
+ for (itera =0; itera < NP; itera ++) {
clusterP = pkg->GetPSideCluster(itera);
//carefully here
//becase AliITSclusterSSD::GetCross returns index in
CreateNewRecPoint(clusterP, clusterN, 0.75);
}
- for(itera =0; itera <sizet;itera++) {
+ for (itera =0; itera <sizet;itera++) {
delete [](combin[itera]);
}
delete [] combin;
void AliITSClusterFinderSSD::
ResolveOneBestMatchingPoint(AliITSpackageSSD *pkg)
{
+// find best matching point
Int_t ni, pi;
}
- pkg->DelClusterOI(pi, SIDEP);
- pkg->DelClusterOI(ni, SIDEN);
-
+ pkg->DelClusterOI(pi, fgkSIDEP);
+ pkg->DelClusterOI(ni, fgkSIDEN);
+
if (split) {
if (debug) cout<<"spltting package ...\n";
new ((*fPackages)[fNPackages]) AliITSpackageSSD(fClusterP,fClusterN);
//--------------------------------------------------
void AliITSClusterFinderSSD::ResolveSimplePackage(AliITSpackageSSD *pkg)
{
+// resolve simple package
AliITSclusterSSD * clusterP;
AliITSclusterSSD * clusterN;
//--------------------------------------------------
void AliITSClusterFinderSSD:: ResolvePackageWithOnePSideCluster(AliITSpackageSSD *pkg) {
-
+// resolve P side clusters from packages
/*
\ \ \ /
XPerr = clusterP->GetPositionError();
p1err = clusterP->GetTotalSignalError();
- for(k=0;k<NN;k++) {
+ for (k=0;k<NN;k++) {
SN[k] = pkg->GetNSideCluster(k)->GetTotalSignal();
SNerr[k] = pkg->GetNSideCluster(k)->GetTotalSignalError();
sumsig += SN[k];
}
- for(k=0;k<NN;k++) {
+ for (k=0;k<NN;k++) {
clusterN = pkg->GetNSideCluster(k);
SP[k]= p1*SN[k]/sumsig;
SPerr[k] = p1err*SN[k]/sumsig;
}
+ delete [] XN;
+ delete [] XNerr;
+ delete [] SP;
+ delete [] SN;
+ delete [] SPerr;
+ delete [] SNerr;
+
+
}
//---------------------------------------------------------
void AliITSClusterFinderSSD::ResolvePackageWithOneNSideCluster(AliITSpackageSSD *pkg) {
-
+// resolve N side clusters from packages
/*
\ / / /
n1err=clusterN->GetTotalSignalError();
- for(k=0;k<NP;k++) {
+ for (k=0;k<NP;k++) {
SP[k] = pkg->GetPSideCluster(k)->GetTotalSignal();
sumsig += SP[k];
SPerr[k] = pkg->GetPSideCluster(k)->GetTotalSignalError();
}
- for(k=0;k<NP;k++) {
+ for (k=0;k<NP;k++) {
clusterP = pkg->GetPSideCluster(k);
SN[k]= n1*SP[k]/sumsig;
XP[k]=GetClusterZ(clusterP);
CreateNewRecPoint(XP[k],XPerr[k], XN,XNerr, SP[k]+SN[k], SPerr[k]+SNerr[k],clusterP, clusterN, 1.0);
}
+ delete [] XP;
+ delete [] XPerr;
+ delete [] SP;
+ delete [] SN;
+ delete [] SPerr;
+ delete [] SNerr;
}
void AliITSClusterFinderSSD::
ResolveTwoForTwoPackage(AliITSpackageSSD *pkg)
{
+// resolve 2x2 packages
AliITSclusterSSD *clusterP1 = pkg->GetPSideCluster(0);
AliITSclusterSSD *clusterP2 = pkg->GetPSideCluster(1);
/*Keep only better combinantion */
/*********************************************/
- if (D12 > (falpha3*17.8768)) {
+ if (D12 > (fAlpha3*17.8768)) {
if (debug) cout<<"decided to take only one pair \n";
Chicomb1 = DistToPML(p1sig,n1sig) + DistToPML(p2sig,n2sig);
Chicomb2 = DistToPML(p2sig,n1sig) + DistToPML(p1sig,n2sig);
CreateNewRecPoint(ZposP1,0, ZposN2,0, p1sig+n2sig, p1sigErr+n2sigErr, clusterP1, clusterN2, 0.75);
CreateNewRecPoint(ZposP2,0, ZposN1,0, p2sig+n1sig, p2sigErr+n1sigErr, clusterP2, clusterN1, 0.75);
} //end second combinantion
- //if (D12 > falpha3*17.8768)
+ //if (D12 > fAlpha3*17.8768)
//keep all combinations
} else {
if (debug) cout<<"We decide to take all points\n";
Chicomb1 = DistToPML(p1sig,n1sig) + DistToPML(p2sig,n2sig);
if (debug) cout<<"\nhere can be reconstructed 3 points: chicomb = "<<Chicomb1<<"\n";
- if (Chicomb1<falpha1) {
+ if (Chicomb1<fAlpha1) {
if (debug) cout<<"\nWe decided to take 3rd point";
if (clusterP1->GetCrossNo()==1) {
if (debug) cout<<"... P1 has one cross\n";
- n1sig = p1sig/PNsignalRatio;
- p2sig = n2sig*PNsignalRatio;
+ n1sig = p1sig/fPNsignalRatio;
+ p2sig = n2sig*fPNsignalRatio;
clusterN1->CutTotalSignal(n1sig);
clusterP2->CutTotalSignal(p2sig);
} else {
if (debug) cout<<"... N1 has one cross\n";
- n2sig=p2sig/PNsignalRatio;
- p1sig=n1sig*PNsignalRatio;
+ n2sig=p2sig/fPNsignalRatio;
+ p1sig=n1sig*fPNsignalRatio;
clusterN2->CutTotalSignal(n2sig);
clusterP1->CutTotalSignal(p1sig);
AliITSclusterSSD *clusterP, AliITSclusterSSD *clusterN,
Stat_t prob)
{
+// create the recpoints
const Float_t kdEdXtoQ = 2.778e+8;
const Float_t kconv = 1.0e-4;
Float_t p=P;
Float_t n=N;
+ Int_t stripP, stripN;
+ Int_t sigP, sigN;
+ AliITSdigitSSD *digP, *digN;
if (GetCrossing(P,N)) {
GetCrossingError(dP,dN);
AliITSRawClusterSSD cnew;
printf("multiplicity > 100 - increase the dimension of the arrays %d\n",nstripsP);
nstripsP=100;
}
- Int_t i;
- for(i=0;i<nstripsP;i++) {
+ for(int i=0;i<nstripsP;i++) {
// check if 'clusterP->GetDigitStripNo(i)' returns the digit index
cnew.fIndexMap[i] = clusterP->GetDigitStripNo(i);
}
printf("multiplicity > 100 - increase the dimension of the arrays %d\n",nstripsN);
nstripsN=100;
}
- for(i=0;i<nstripsN;i++) {
+ for(int i=0;i<nstripsN;i++) {
// check if 'clusterN->GetDigitStripNo(i)' returns the digit index
cnew.fIndexMapN[i] = clusterN->GetDigitStripNo(i);
}
cnew.fQErr=dSig;
//cnew.fProbability=(float)prob;
fITS->AddCluster(2,&cnew);
+ fSegmentation->GetPadIxz(P,N,stripP,stripN);
+ digP = (AliITSdigitSSD*)fMap->GetHit(1,stripP);
+ digN = (AliITSdigitSSD*)fMap->GetHit(0,stripN);
+ printf("SSD: digP digN %p %p\n",digP,digN);
+ if(digP) sigP = digP->fSignal;
+ else sigP=0;
+ if(digN) sigN = digN->fSignal;
+ else sigN=0;
+ if (!digP && !digN) {
+ Error("CreateNewRecPoint","cannot find the digit!");
+ return kFALSE;
+ }
// add the rec point info
AliITSRecPoint rnew;
rnew.SetX(P*kconv);
rnew.SetdEdX(Sig/kdEdXtoQ);
rnew.SetSigmaX2( kRMSx* kRMSx);
rnew.SetSigmaZ2( kRMSz* kRMSz);
- rnew.SetProbability((float)prob);
+ //rnew.SetProbability((float)prob);
+ if(sigP > sigN) {
+ rnew.fTracks[0]=digP->fTracks[0];
+ rnew.fTracks[1]=digP->fTracks[1];
+ rnew.fTracks[2]=digP->fTracks[2];
+ //printf("sigP>sigN: %d %d %d\n",digP->fTracks[0],digP->fTracks[1],digP->fTracks[2]);
+ } else {
+ rnew.fTracks[0]=digN->fTracks[0];
+ rnew.fTracks[1]=digN->fTracks[1];
+ rnew.fTracks[2]=digN->fTracks[2];
+ //printf("sigN>sigP: %d %d %d\n",digN->fTracks[0],digN->fTracks[1],digN->fTracks[2]);
+ }
+ //printf("SSD: track1 track2 track3 X Z %d %d %d %f %f\n",rnew.fTracks[0],rnew.fTracks[1],rnew.fTracks[2],P*kconv,N*kconv);
fITS->AddRecPoint(rnew);
/*
// it was
Bool_t AliITSClusterFinderSSD::
CreateNewRecPoint(AliITSclusterSSD *clusterP, AliITSclusterSSD *clusterN, Stat_t prob)
{
+// create recpoints
+
Float_t posClusterP; //Cluster P position in strip coordinates
Float_t posClusterN; //Cluster N position in strip coordinates
//--------------------------------------------------
Bool_t AliITSClusterFinderSSD::IsCrossing(AliITSclusterSSD* p, AliITSclusterSSD* n)
{
+// check for crossings
+
Float_t x = p->GetPosition();
Float_t y = n->GetPosition();
return GetCrossing(x,y);
//----------------------------------------------
Bool_t AliITSClusterFinderSSD::Strip2Local( Float_t stripP, Float_t stripN, Float_t &Z,Float_t &X)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// convert between strip numbers and local coordinates
/*
Z = (stripN-stripP)*fFactorOne;
X=P;
Z=N;
if (debug) cout<<"P="<<stripP<<" N="<<stripN<<" X = "<<X<<" Z = "<<Z<<"\n";
- if ((Z<2.1)&&(Z>-2.1)&&(X<3.65)&&(X>-3.65)) return true;
- else return false;
+ if ((Z<2.1)&&(Z>-2.1)&&(X<3.65)&&(X>-3.65)) return kTRUE;
+ else return kFALSE;
}
//-----------------------------------------------------------
Float_t AliITSClusterFinderSSD::GetClusterZ(AliITSclusterSSD* clust)
{
+// get Z coordinate of the cluster
return clust->GetPosition();
Int_t AliITSClusterFinderSSD::GetBestComb
(Int_t** comb,Int_t Ncomb, Int_t Ncl, AliITSpackageSSD * pkg)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
//returns index of best combination in "comb"
//comb : sets of combinations
// in given combination on place "n" is index of
Float_t chi;
Float_t ps, ns; //signal of P cluster and N cluster
- Int_t i,j;
- for(i=0;i<Ncomb;i++)
+ for (Int_t i=0;i<Ncomb;i++)
{
chi=0;
- for(j=0;j<Ncl;j++)
+ for (Int_t j=0;j<Ncl;j++)
{
ps = pkg->GetPSideCluster(j)->GetTotalSignal(); //carrefully here, different functions
ns = GetNSideCluster(comb[i][j])->GetTotalSignal();
void AliITSClusterFinderSSD::GetBestMatchingPoint
(Int_t & ip, Int_t & in, AliITSpackageSSD* pkg )
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// find the best matching point
if (debug) pkg->PrintClusters();
bestchi=DistToPML( pkg->GetPSideCluster(0)->GetTotalSignal(),
pkg->GetNSideCluster(0)->GetTotalSignal() );
- Int_t i,j;
- for(i = 0; i< pkg->GetNumOfClustersP(); i++)
+ for (Int_t i = 0; i< pkg->GetNumOfClustersP(); i++)
{
p = pkg->GetPSideClusterIdx(i);
nc=curPcl->GetCrossNo();
ps=curPcl->GetTotalSignal();
- for(j = 0; j< nc; j++)
+ for (Int_t j = 0; j< nc; j++)
{
n=curPcl->GetCross(j);
curNcl= GetNSideCluster(n);
//------------------------------------------------------
void AliITSClusterFinderSSD::CalcStepFactor(Float_t Psteo, Float_t Nsteo )
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// calculate the step factor for matching clusters
// 95 is the pitch, 4000 - dimension along z ?
//-----------------------------------------------------------
AliITSclusterSSD* AliITSClusterFinderSSD::GetPSideCluster(Int_t idx)
{
+// get P side clusters
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-
if((idx<0)||(idx>=fNClusterP))
//-------------------------------------------------------
AliITSclusterSSD* AliITSClusterFinderSSD::GetNSideCluster(Int_t idx)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// get N side clusters
if((idx<0)||(idx>=fNClusterN))
{
//--------------------------------------------------------
AliITSclusterSSD* AliITSClusterFinderSSD::GetCluster(Int_t idx, Bool_t side)
{
-
-
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
+// Get cluster
return (side) ? GetPSideCluster(idx) : GetNSideCluster(idx);
}
//--------------------------------------------------------
void AliITSClusterFinderSSD::ConsumeClusters()
{
+// remove clusters from the list of unmatched clusters
- Int_t i;
- for(i=0;i<fNPackages;i++)
+ for ( Int_t i=0;i<fNPackages;i++)
{
((AliITSpackageSSD*)((*fPackages)[i]))->ConsumeClusters();
}
//--------------------------------------------------------
void AliITSClusterFinderSSD::ReconstructNotConsumedClusters()
{
+// reconstruct remaining non-crossing clusters
+
Int_t i;
AliITSclusterSSD *cluster;
Float_t pos;
const Float_t kRMSx = 20.0*kconv; // microns->cm ITS TDR Table 1.3
const Float_t kRMSz = 830.0*kconv; // microns->cm ITS TDR Table 1.3
- for(i=0;i<fNClusterP;i++)
+ Int_t stripP,stripN;
+ AliITSdigitSSD *dig;
+ for (i=0;i<fNClusterP;i++)
{
//printf("P side cluster: cluster number %d\n",i);
cluster = GetPSideCluster(i);
{
sig = cluster->GetTotalSignal();
- sig += sig/PNsignalRatio;
+ sig += sig/fPNsignalRatio;
sigerr = cluster->GetTotalSignalError();
x1 = -Dx/2 + pos *fPitch;
x2 = pos;
z2 = 1;
GetCrossing (x2,z2);
+ fSegmentation->GetPadIxz((x1+x2)/2,(z1+z2)/2,stripP,stripN);
+ dig = (AliITSdigitSSD*)fMap->GetHit(1,stripP);
+ if (!dig) printf("SSD: check the digit! dig %p\n",dig);
+ if(!dig) continue;
AliITSRawClusterSSD cnew;
Int_t nstripsP=cluster->GetNumOfDigits();
cnew.fMultiplicity=nstripsP;
printf("multiplicity > 100 - increase the dimension of the arrays %d\n",nstripsP);
nstripsP=100;
}
- Int_t k;
- for(k=0;k<nstripsP;k++) {
+ for(int k=0;k<nstripsP;k++) {
// check if 'clusterP->GetDigitStripNo(i)' returns
// the digit index and not smth else
cnew.fIndexMap[k] = cluster->GetDigitStripNo(k);
rnew.SetdEdX(sig/kdEdXtoQ);
rnew.SetSigmaX2( kRMSx* kRMSx);
rnew.SetSigmaZ2( kRMSz* kRMSz);
- rnew.SetProbability(0.75);
+ //rnew.SetProbability(0.75);
+ rnew.fTracks[0]=dig->fTracks[0];
+ rnew.fTracks[1]=dig->fTracks[1];
+ rnew.fTracks[2]=dig->fTracks[2];
+ //printf("digP: %d %d %d\n",dig->fTracks[0],dig->fTracks[1],dig->fTracks[2]);
+ //printf("SSD - P : track1 track2 track3 X Z %d %d %d %f %f\n",rnew.fTracks[0],rnew.fTracks[1],rnew.fTracks[2],kconv*(x1+x2)/2,kconv*(z1+z2)/2);
fITS->AddRecPoint(rnew);
/*
fPointsM->AddLast( (TObject*)
}
}
- for(i=0;i<fNClusterN;i++)
+ for (i=0;i<fNClusterN;i++)
{
- // printf("N side cluster: cluster number %d\n",i);
+ //printf("N side cluster: cluster number %d\n",i);
cluster = GetNSideCluster(i);
if (!cluster->IsConsumed())
{
{
sig = cluster->GetTotalSignal();
- sig += sig*PNsignalRatio;
+ sig += sig*fPNsignalRatio;
sigerr = cluster->GetTotalSignalError();
z2 = pos;
GetCrossing (x2,z2);
+ fSegmentation->GetPadIxz((x1+x2)/2,(z1+z2)/2,stripP,stripN);
+ dig = (AliITSdigitSSD*)fMap->GetHit(0,stripN);
+ if (!dig) printf("SSD: check the digit! dig %p\n",dig);
+ if(!dig) continue;
AliITSRawClusterSSD cnew;
Int_t nstripsN=cluster->GetNumOfDigits();
cnew.fMultiplicity=0;
printf("multiplicity > 100 - increase the dimension of the arrays %d\n",nstripsN);
nstripsN=100;
}
- Int_t k;
- for(k=0;k<nstripsN;k++) {
+ for(int k=0;k<nstripsN;k++) {
// check if 'clusterP->GetDigitStripNo(i)' returns
// the digit index and not smth else
cnew.fIndexMapN[k] = cluster->GetDigitStripNo(k);
cnew.fQErr=sigerr;
//cnew.fProbability=0.75;
fITS->AddCluster(2,&cnew);
- // add the rec point info
AliITSRecPoint rnew;
rnew.SetX(kconv*(x1+x2)/2);
rnew.SetZ(kconv*(z1+z2)/2);
rnew.SetdEdX(sig/kdEdXtoQ);
rnew.SetSigmaX2( kRMSx* kRMSx);
rnew.SetSigmaZ2( kRMSz* kRMSz);
- rnew.SetProbability(0.75);
+ //rnew.SetProbability(0.75);
+ rnew.fTracks[0]=dig->fTracks[0];
+ rnew.fTracks[1]=dig->fTracks[1];
+ rnew.fTracks[2]=dig->fTracks[2];
+ //printf("digN: %d %d %d\n",dig->fTracks[0],dig->fTracks[1],dig->fTracks[2]);
+ //printf("SSD -N : track1 track2 track3 X Z %d %d %d %f %f\n",rnew.fTracks[0],rnew.fTracks[1],rnew.fTracks[2],kconv*(x1+x2)/2,kconv*(z1+z2)/2);
fITS->AddRecPoint(rnew);
/*
fPointsM->AddLast( (TObject*)
Bool_t AliITSClusterFinderSSD::GetCrossing (Float_t &P, Float_t &N)
{
+// get crossing
Float_t Dx = fSegmentation->Dx();
Float_t Dz = fSegmentation->Dz();
void AliITSClusterFinderSSD::GetCrossingError(Float_t& dP, Float_t& dN)
{
+// get crossing error
+
Float_t dz, dx;
dz = TMath::Abs(( dP + dN )*fPitch/(fTanP + fTanN) );
dN = dz;
dP = dx;
}
-
-