// //
// Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //
// Revised: Enrico Fragiacomo, enrico.fragiacomo@ts.infn.it //
+// Revised 23/06/08: Marco Bregant
// //
///////////////////////////////////////////////////////////////////////////
fHwSSD(3.65),
fHlSSD(2.00),
fTanP(0.0275),
-fTanN(0.0075){
+fTanN(0.0075)
+{
//Default constructor
fTanN(cf.fTanN)
{
// Copy constructor
-
}
//______________________________________________________________________
//------------------------------------------------------------
static AliITSRecoParam *repa = NULL;
+
+
if(!repa){
repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam();
if(!repa){
// This function creates ITS clusters from raw data
//------------------------------------------------------------
rawReader->Reset();
- /*
- const UInt_t *evid; evid = rawReader->GetEventId();
- cout<<"Event="<<evid[0]<<endl;
- */
AliITSRawStreamSSD inputSSD(rawReader);
- // rawReader->SelectEquipment(-1,0,15);
FindClustersSSD(&inputSSD,clusters);
}
Int_t strip = input->GetStrip();
if(input->GetSideFlag()) strip=1535-strip;
Int_t signal = input->GetSignal();
- //cout<<ddl<<" "<<ad<<" "<<adc<<" "<<strip<<" "<<signal<<endl;
-
+
if((ddl==iddl)&&(ad==iad)) {n++; matrix[adc][strip] = signal;}
else {oddl=iddl; oad=iad; oadc = adc; ostrip = strip; osignal=signal; iddl=ddl; iad=ad; break;}
if(!next && oddl<0) break;
if(n==0) continue; // first occurence
- n=0; osignal=0;
+ n=0; //osignal=0;
// fill 1Dclusters
for(Int_t iadc=0; iadc<12; iadc++) { // loop over ADC index for ddl=oddl and ad=oad
Int_t iimod = (oad - 1) * 12 + iadc;
Int_t iModule = AliITSRawStreamSSD::GetModuleNumber(oddl,iimod);
if(iModule==-1) continue;
- // cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<endl;
cal = (AliITSCalibrationSSD*)GetResp(iModule);
Bool_t first = 0;
noise = cal->GetNoiseP(istrip); if(noise<1.) signal = 65535;
if(signal<3*noise) signal = 65535; // in case ZS was not done in hw do it now
- //if(cal->IsPChannelBad(istrip)) cout<<iModule<<" "<<istrip<<endl;
- if(cal->IsPChannelBad(istrip)) signal=0;
+ // if(cal->IsPChannelBad(istrip)) signal=0;
if (signal!=65535) {
gain = cal->GetGainP(istrip);
//Split suspiciously big cluster
if (nDigits > 4&&nDigits < 25) {
- cluster.SetY(y/q - 0.25*nDigits);
+ if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+ else cluster.SetY(istrip-1 - 0.25*nDigits);
cluster.SetQ(0.5*q);
if (nClusters[0] == kMax) {
Error("FindClustersSSD", "Too many 1D clusters !");
return;
}
Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++];
- cluster2.SetY(y/q + 0.25*nDigits);
+ if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+ else cluster2.SetY(istrip-1 + 0.25*nDigits);
cluster2.SetQ(0.5*q);
cluster2.SetNd(nDigits);
cluster2.SetLabels(lab);
//Split suspiciously big cluster
if (nDigits > 4&&nDigits < 25) {
- cluster.SetY(y/q - 0.25*nDigits);
+ if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+ else cluster.SetY(istrip-1 - 0.25*nDigits);
cluster.SetQ(0.5*q);
if (nClusters[0] == kMax) {
Error("FindClustersSSD", "Too many 1D clusters !");
return;
}
Ali1Dcluster& cluster2 = clusters1D[0][nClusters[0]++];
- cluster2.SetY(y/q + 0.25*nDigits);
+ if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+ else cluster2.SetY(istrip-1 + 0.25*nDigits);
cluster2.SetQ(0.5*q);
cluster2.SetNd(nDigits);
cluster2.SetLabels(lab);
oldnoise = 0.;
noise = 0.;
Int_t strip=0;
- for(Int_t istrip=768; istrip<1536; istrip++) { // N-side
+ for(Int_t iistrip=768; iistrip<1536; iistrip++) { // N-side
- Int_t signal = TMath::Abs(matrix[iadc][istrip]);
- //cout<<"####"<<" "<<oddl<<" "<<oad<<" "<<iadc<<" "<<istrip<<" "<<signal<<endl;
- strip = 1535-istrip;
+ Int_t signal = TMath::Abs(matrix[iadc][iistrip]);
+ strip = 1535-iistrip;
oldnoise = noise;
noise = cal->GetNoiseN(strip); if(noise<1.) signal=65535;
- if(cal->IsNChannelBad(strip)) signal=0;
+ // if(cal->IsNChannelBad(strip)) signal=0;
if(signal<3*noise) signal = 65535; // in case ZS was not done in hw do it now
if (signal!=65535) {
- // cout<<"ddl="<<oddl<<" ad"<<oad<<" module="<<iModule<<" strip= "<<istrip<<
- // " sig="<<signal<<" "<<cal->GetPedestalN(strip)<<endl;
gain = cal->GetGainN(strip);
signal = (Int_t) ( signal * gain); // signal is corrected for gain
signal = (Int_t) cal->ADCToKeV( signal ); // signal is converted in KeV
//Split suspiciously big cluster
if (nDigits > 4&&nDigits < 25) {
- cluster.SetY(y/q - 0.25*nDigits);
+ if(q!=0) cluster.SetY(y/q - 0.25*nDigits);
+ else cluster.SetY(strip+1 - 0.25*nDigits);
cluster.SetQ(0.5*q);
if (nClusters[1] == kMax) {
Error("FindClustersSSD", "Too many 1D clusters !");
return;
}
Ali1Dcluster& cluster2 = clusters1D[1][nClusters[1]++];
- cluster2.SetY(y/q + 0.25*nDigits);
+ if(q!=0) cluster2.SetY(y/q + 0.25*nDigits);
+ else cluster2.SetY(strip+1 + 0.25*nDigits);
cluster2.SetQ(0.5*q);
cluster2.SetNd(nDigits);
cluster2.SetLabels(lab);
fModule = iModule;
FindClustersSSD(&clusters1D[0][0], nClusters[0],
&clusters1D[1][0], nClusters[1], clusters[iModule]);
- Int_t nClusters = clusters[iModule]->GetEntriesFast();
- nClustersSSD += nClusters;
+ Int_t nClustersn = clusters[iModule]->GetEntriesFast();
+ nClustersSSD += nClustersn;
}
nClusters[0] = nClusters[1] = 0;
// Actual SSD cluster finder
//------------------------------------------------------------
- // Float_t xyz[3];
-
const TGeoHMatrix *mT2L=AliITSgeomTGeo::GetTracking2LocalMatrix(fModule);
TClonesArray &cl=*clusters;
//
- Float_t tanp=fTanP, tann=fTanN;
- if (fModule>fLastSSD1) {tann=fTanP; tanp=fTanN;}
+ // Float_t tanp=fTanP, tann=fTanN;
+ const Float_t kStartXzero=3.64325;
+ const Float_t kDeltaXzero5or6=0.02239;
+ const Float_t kDeltaZ5to6=7.6/7.0;
+
+ Int_t is6=-1;
+
+ if (fModule>fLastSSD1) is6=1;
Int_t idet=fNdet[fModule];
Int_t ncl=0;
+
//
Int_t negativepair[30000];
Int_t cnegative[3000];
for (Int_t i=0;i<30000;i++) {negativepair[i]=0; positivepair[i]=0;}
if ((np*nn) > fgPairsSize) {
+
if (fgPairs) delete [] fgPairs;
fgPairsSize = 4*np*nn;
fgPairs = new Short_t[fgPairsSize];
// find available pairs
//
for (Int_t i=0; i<np; i++) {
- Float_t yp=pos[i].GetY()*fYpitchSSD;
+ Float_t yp=pos[i].GetY();
if ( (pos[i].GetQ()>0) && (pos[i].GetQ()<3) ) continue;
for (Int_t j=0; j<nn; j++) {
if ( (neg[j].GetQ()>0) && (neg[j].GetQ()<3) ) continue;
- Float_t yn=neg[j].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[j].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
if (TMath::Abs(yt)<fHwSSD+0.01)
if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
negativepair[i*10+cnegative[i]] =j; //index
// try to recover points out of but close to the module boundaries
//
for (Int_t i=0; i<np; i++) {
- Float_t yp=pos[i].GetY()*fYpitchSSD;
+ Float_t yp=pos[i].GetY();
if ( (pos[i].GetQ()>0) && (pos[i].GetQ()<3) ) continue;
for (Int_t j=0; j<nn; j++) {
if ( (neg[j].GetQ()>0) && (neg[j].GetQ()<3) ) continue;
// if both 1Dclusters have an other cross continue
if (cpositive[j]&&cnegative[i]) continue;
- Float_t yn=neg[j].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[j].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
if (TMath::Abs(yt)<fHwSSD+0.1)
if (TMath::Abs(zt)<fHlSSD+0.15) {
// tag 1Dcluster (eventually will produce low quality recpoint)
//
// select gold clusters
if ( (cnegative[ip]==1) && cpositive[negativepair[10*ip]]==1){
- Float_t yp=pos[ip].GetY()*fYpitchSSD;
+ Float_t yp=pos[ip].GetY();
Int_t j = negativepair[10*ip];
if( (pos[ip].GetQ()==0) && (neg[j].GetQ() ==0) ) {
ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
// charge matching (note that if posQ or negQ is 0 -> ratio=1 and the following condition is met
- if (TMath::Abs(ratio)>0.33) continue; // note: 0.33=3xsigma_ratio calculated in cosmics tests
+ if (TMath::Abs(ratio)>0.2) continue; // note: 0.2=3xsigma_ratio calculated in cosmics tests
//
- Float_t yn=neg[j].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[j].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
ybest=yt; zbest=zt;
+
+
qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
if( (pos[ip].GetQ()==0)||(neg[ip].GetQ()==0)) qbest*=2; // in case of bad strips on one side keep all charge from the other one
- //cout<<yt<<" "<<zt<<" "<<qbest<<endl;
-
{
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
if (ip2==ip) ip2 = positivepair[10*in+1];
Float_t pcharge = pos[ip].GetQ()+pos[ip2].GetQ();
- if ( (TMath::Abs(pcharge-neg[in].GetQ())<10) && (pcharge!=0) ) { //
+ if ( (TMath::Abs(pcharge-neg[in].GetQ())<30) && (pcharge!=0) ) { //
//
// add first pair
if ( (fgPairs[ip*nn+in]==100)&&(pos[ip].GetQ() ) ) { //
- Float_t yp=pos[ip].GetY()*fYpitchSSD;
- Float_t yn=neg[in].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yp=pos[ip].GetY();
+ Float_t yn=neg[in].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
ybest =yt; zbest=zt;
+
+
qbest =pos[ip].GetQ();
-
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
lp[0]=trk[1];
if(clusters){
cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
-
- // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-
cl2->SetChargeRatio(ratio);
cl2->SetType(5);
fgPairs[ip*nn+in] = 5;
cl2->SetType(6);
fgPairs[ip*nn+in] = 6;
}
- //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver1"<<endl;
fDetTypeRec->AddRecPoint(*cl2);
}
// if (!(cused1[ip2] || cused2[in])){ //
if ( (fgPairs[ip2*nn+in]==100) && (pos[ip2].GetQ()) ) {
- Float_t yp=pos[ip2].GetY()*fYpitchSSD;
- Float_t yn=neg[in].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yp=pos[ip2].GetY();
+ Float_t yn=neg[in].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
ybest =yt; zbest=zt;
+
qbest =pos[ip2].GetQ();
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
if(clusters){
cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
- // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-
cl2->SetChargeRatio(ratio);
cl2->SetType(5);
fgPairs[ip2*nn+in] =5;
fgPairs[ip2*nn+in] =6;
}
- // cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silver2"<<endl;
fDetTypeRec->AddRecPoint(*cl2);
}
ncl++;
Float_t pcharge = neg[jn].GetQ()+neg[jn2].GetQ();
//
- if ( (TMath::Abs(pcharge-pos[ip].GetQ())<10) && // charge matching
+ if ( (TMath::Abs(pcharge-pos[ip].GetQ())<30) && // charge matching
(pcharge!=0) ) { // reject combinations of bad strips
//
// if (!(cused1[ip]||cused2[jn])){
if ( (fgPairs[ip*nn+jn]==100) && (neg[jn].GetQ()) ) { //
- Float_t yn=neg[jn].GetY()*fYpitchSSD;
- Float_t yp=pos[ip].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[jn].GetY();
+ Float_t yp=pos[ip].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
ybest =yt; zbest=zt;
+
+
qbest =neg[jn].GetQ();
+
{
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
if(clusters){
cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
- // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-
cl2->SetChargeRatio(ratio);
cl2->SetType(7);
fgPairs[ip*nn+jn] =7;
cl2->SetType(8);
fgPairs[ip*nn+jn]=8;
}
- //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN1"<<endl;
fDetTypeRec->AddRecPoint(*cl2);
}
// if (!(cused1[ip]||cused2[jn2])){
if ( (fgPairs[ip*nn+jn2]==100)&&(neg[jn2].GetQ() ) ) { //
- Float_t yn=neg[jn2].GetY()*fYpitchSSD;
- Double_t yp=pos[ip].GetY()*fYpitchSSD;
- Double_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Double_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[jn2].GetY();
+ Double_t yp=pos[ip].GetY();
+ Double_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Double_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
ybest =yt; zbest=zt;
+
+
qbest =neg[jn2].GetQ();
+
{
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
if(clusters){
cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
- // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
cl2->SetChargeRatio(ratio);
fgPairs[ip*nn+jn2]=7;
cl2->SetType(8);
fgPairs[ip*nn+jn2]=8;
}
- //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" silverN2"<<endl;
fDetTypeRec->AddRecPoint(*cl2);
}
//
//almost gold clusters
- Float_t yp=pos[ip].GetY()*fYpitchSSD;
- Float_t yn=neg[j].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yp=pos[ip].GetY();
+ Float_t yn=neg[j].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
ybest=yt; zbest=zt;
qbest=0.5*(pos[ip].GetQ()+neg[j].GetQ());
+
{
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
}
//
CheckLabels2(milab);
+ if ((neg[j].GetQ()==0)&&(pos[ip].GetQ()==0)) continue; // reject crosses of bad strips!!
ratio = (pos[ip].GetQ()-neg[j].GetQ())/(pos[ip].GetQ()+neg[j].GetQ());
milab[3]=(((ip<<10) + j)<<10) + idet; // pos|neg|det
Int_t info[3] = {pos[ip].GetNd(),neg[j].GetNd(),fNlayer[fModule]};
AliITSRecPoint * cl2;
if(clusters){
cl2 = new (cl[ncl]) AliITSRecPoint(milab,lp,info);
-
- // cl2-> GetGlobalXYZ(xyz); cout<<"rec "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
-
+
cl2->SetChargeRatio(ratio);
cl2->SetType(10);
fgPairs[ip*nn+j]=10;
cused1[ip]++;
cused2[j]++;
- //cout<<"AliITSClusterFinderV2SSD "<<fModule<<" 2x2"<<endl;
-
fDetTypeRec->AddRecPoint(*cl2);
}
ncl++;
//
for (Int_t i=0; i<np; i++) {
Float_t ybest=1000,zbest=1000,qbest=0;
- Float_t yp=pos[i].GetY()*fYpitchSSD;
+ Float_t yp=pos[i].GetY();
if ((pos[i].GetQ()>0)&&(pos[i].GetQ()<3)) continue;
for (Int_t j=0; j<nn; j++) {
// for (Int_t di = 0;di<cpositive[i];di++){
if (cused2[j]||cused1[i]) continue;
if (fgPairs[i*nn+j]>0 &&fgPairs[i*nn+j]<100) continue;
ratio = (pos[i].GetQ()-neg[j].GetQ())/(pos[i].GetQ()+neg[j].GetQ());
- Float_t yn=neg[j].GetY()*fYpitchSSD;
- Float_t zt=(2*fHlSSD*tanp + yp - yn)/(tann+tanp);
- Float_t yt=yn + tann*zt;
- zt-=fHlSSD; yt-=fHwSSD;
+ Float_t yn=neg[j].GetY();
+
+ Float_t zt=1.9*(yp-yn)/7.0-is6*kDeltaZ5to6;
+ Float_t yt=is6*(kStartXzero-(285*yp + 1045*yn)/140000.0) + kDeltaXzero5or6;
+
if (TMath::Abs(yt)<fHwSSD+0.01)
if (TMath::Abs(zt)<fHlSSD+0.01*(neg[j].GetNd()+pos[i].GetNd())) {
ybest=yt; zbest=zt;
qbest=0.5*(pos[i].GetQ()+neg[j].GetQ());
+
{
Double_t loc[3]={ybest,0.,zbest},trk[3]={0.,0.,0.};
mT2L->MasterToLocal(loc,trk);
}
}
-
-