fSClusters(0),
fNTracklets(0),
fNSingleCluster(0),
+fNSingleClusterSPD2(0),
fDPhiWindow(0),
fDThetaWindow(0),
fPhiShift(0),
fCreateClustersCopy(0),
fClustersLoaded(0),
fRecoDone(0),
+ fBuildRefs(kTRUE),
+ fStoreSPD2SingleCl(kFALSE),
fSPDSeg()
{
// default c-tor
fClArr[i] = 0;
for (int j=0;j<2;j++) fUsedClusLay[i][j] = 0;
fDetectorIndexClustersLay[i] = 0;
+ fClusterCopyIndex[i] = 0;
fOverlapFlagClustersLay[i] = 0;
fNClustersLay[i] = 0;
fClustersLay[i] = 0;
SetHistOn();
- if(AliITSReconstructor::GetRecoParam()) {
+ if (AliITSReconstructor::GetRecoParam()) {
SetPhiWindow(AliITSReconstructor::GetRecoParam()->GetTrackleterPhiWindow());
SetThetaWindow(AliITSReconstructor::GetRecoParam()->GetTrackleterThetaWindow());
SetPhiShift(AliITSReconstructor::GetRecoParam()->GetTrackleterPhiShift());
SetPhiRotationAngle(AliITSReconstructor::GetRecoParam()->GetTrackleterPhiRotationAngle());
SetNStdDev(AliITSReconstructor::GetRecoParam()->GetTrackleterNStdDevCut());
SetScaleDThetaBySin2T(AliITSReconstructor::GetRecoParam()->GetTrackleterScaleDThetaBySin2T());
+ SetBuildRefs(AliITSReconstructor::GetRecoParam()->GetTrackleterBuildCl2TrkRefs());
+ SetStoreSPD2SingleCl(AliITSReconstructor::GetRecoParam()->GetTrackleterStoreSPD2SingleCl());
//
SetCutPxDrSPDin(AliITSReconstructor::GetRecoParam()->GetMultCutPxDrSPDin());
SetCutPxDrSPDout(AliITSReconstructor::GetRecoParam()->GetMultCutPxDrSPDout());
fSClusters(0),
fNTracklets(0),
fNSingleCluster(0),
+fNSingleClusterSPD2(0),
fDPhiWindow(0),
fDThetaWindow(0),
fPhiShift(0),
fCreateClustersCopy(0),
fClustersLoaded(0),
fRecoDone(0),
+fBuildRefs(kTRUE),
+fStoreSPD2SingleCl(kFALSE),
fSPDSeg()
{
// Copy constructor :!!! RS ATTENTION: old c-tor reassigned the pointers instead of creating a new copy -> would crash on delete
for (int i=0;i<2;i++) {
delete[] fClustersLay[i];
delete[] fDetectorIndexClustersLay[i];
+ delete[] fClusterCopyIndex[i];
delete[] fOverlapFlagClustersLay[i];
delete fClArr[i];
for (int j=0;j<2;j++) delete fUsedClusLay[i][j];
fNClustersLay[1] = 0;
fNTracklets = 0;
fNSingleCluster = 0;
+ fNSingleClusterSPD2 = 0;
//
fESDEvent = esd;
fTreeRP = treeRP;
vtx = 0;
}
if(vtx){
- float vtxf[3] = {vtx->GetX(),vtx->GetY(),vtx->GetZ()};
+ float vtxf[3] = {static_cast<float>(vtx->GetX()),static_cast<float>(vtx->GetY()),static_cast<float>(vtx->GetZ())};
FindTracklets(vtxf);
}
else {
fNClustersLay[1] = 0;
fNTracklets = 0;
fNSingleCluster = 0;
+ fNSingleClusterSPD2 = 0;
//
if (!clusterTree) { AliError(" Invalid ITS cluster tree !\n"); return; }
//
fNClustersLay[1] = 0;
fNTracklets = 0;
fNSingleCluster = 0;
+ fNSingleClusterSPD2 = 0;
//
if (!clusterTree) { AliError(" Invalid ITS cluster tree !\n"); return; }
if (!clusterTreeMix) { AliError(" Invalid ITS cluster tree 2nd event !\n"); return; }
// Step2: store tracklets; remove used clusters
for (Int_t iC2=0; iC2<fNClustersLay[1]; iC2++) StoreTrackletForL2Cluster(iC2);
//
- // store unused single clusters of L1
+ // store unused single clusters of L1 (optionally for L2 too)
StoreL1Singles();
//
AliDebug(1,Form("%d tracklets found", fNTracklets));
}
//
fMult = new AliMultiplicity(fNTracklets,fNSingleCluster,fNFiredChips[0],fNFiredChips[1],fastOrFiredMap);
- fMult->SetMultTrackRefs(kTRUE);
+ fMult->SetMultTrackRefs( fBuildRefs );
+ fMult->SetSPD2SinglesStored(fStoreSPD2SingleCl);
+ fMult->SetNumberOfSingleClustersSPD2(fNSingleClusterSPD2);
// store some details of reco:
fMult->SetScaleDThetaBySin2T(fScaleDTBySin2T);
fMult->SetDPhiWindow2(fDPhiWindow2);
//
UInt_t shared[100];
AliRefArray *refs[2][2] = {{0,0},{0,0}};
- for (int il=2;il--;)
- for (int it=2;it--;) // tracklet_clusters->track references to stor
- if (fStoreRefs[il][it]) refs[il][it] = new AliRefArray(fNTracklets,0);
+ if (fBuildRefs) {
+ for (int il=2;il--;)
+ for (int it=2;it--;) // tracklet_clusters->track references to stor
+ if (fStoreRefs[il][it]) refs[il][it] = new AliRefArray(fNTracklets,0);
+ }
//
for (int i=fNTracklets;i--;) {
float* tlInfo = fTracklets[i];
fMult->SetTrackletData(i,tlInfo);
+ //
+ if (!fBuildRefs) continue; // do we need references?
for (int itp=0;itp<2;itp++) {
for (int ilr=0;ilr<2;ilr++) {
if (!fStoreRefs[ilr][itp]) continue; // nothing to store
}
}
}
- fMult->AttachTracklet2TrackRefs(refs[0][0],refs[0][1],refs[1][0],refs[1][1]);
+ if (fBuildRefs) fMult->AttachTracklet2TrackRefs(refs[0][0],refs[0][1],refs[1][0],refs[1][1]);
//
AliRefArray *refsc[2] = {0,0};
- for (int it=2;it--;) if (fStoreRefs[0][it]) refsc[it] = new AliRefArray(fNClustersLay[0]);
+ if (fBuildRefs) for (int it=2;it--;) if (fStoreRefs[0][it]) refsc[it] = new AliRefArray(fNClustersLay[0]);
for (int i=fNSingleCluster;i--;) {
float* clInfo = fSClusters[i];
fMult->SetSingleClusterData(i,clInfo);
+ //
+ if (!fBuildRefs) continue; // do we need references?
+ int ilr = i>=(fNSingleCluster-fNSingleClusterSPD2) ? 1:0;
int clID = int(clInfo[kSCID]);
for (int itp=0;itp<2;itp++) {
- if (!fStoreRefs[0][itp]) continue;
- int nref = fUsedClusLay[0][itp]->GetReferences(clID,shared,100);
+ if (!fStoreRefs[ilr][itp]) continue;
+ int nref = fUsedClusLay[ilr][itp]->GetReferences(clID,shared,100);
if (!nref) continue;
else if (nref==1) refsc[itp]->AddReference(i,shared[0]);
else refsc[itp]->AddReferences(i,shared,nref);
}
}
- fMult->AttachCluster2TrackRefs(refsc[0],refsc[1]);
+ //
+ if (fBuildRefs) fMult->AttachCluster2TrackRefs(refsc[0],refsc[1]);
fMult->CompactBits();
//
}
memset(fTracklets,0,nmaxT*sizeof(Float_t*));
//
if (fSClusters) delete[] fSClusters;
- fSClusters = new Float_t*[fNClustersLay[0]];
- memset(fSClusters,0,fNClustersLay[0]*sizeof(Float_t*));
+ int nSlots = GetStoreSPD2SingleCl() ? fNClustersLay[0]+fNClustersLay[1] : fNClustersLay[0];
+ fSClusters = new Float_t*[nSlots];
+ memset(fSClusters,0,nSlots*sizeof(Float_t*));
//
AliDebug(1,Form("(clusters in layer 1 : %d, layer 2: %d)",fNClustersLay[0],fNClustersLay[1]));
AliDebug(1,Form("(cluster-fired chips in layer 1 : %d, layer 2: %d)",fNFiredChips[0],fNFiredChips[1]));
branch = itsClusterTree->GetBranch("ITSRecPoints");
branch->SetAddress(&itsClusters);
if (!fClArr[il]) fClArr[il] = new TClonesArray("AliITSRecPoint",100);
+ delete[] fClusterCopyIndex[il];
}
//
// count clusters
Float_t* clustersLay = new Float_t[nclLayer*kClNPar];
Int_t* detectorIndexClustersLay = new Int_t[nclLayer];
Bool_t* overlapFlagClustersLay = new Bool_t[nclLayer];
+ if (fCreateClustersCopy) fClusterCopyIndex[il] = new Int_t[nclLayer];
//
for (int ic=0;ic<nclLayer;ic++) {
AliITSRecPoint* cluster = (AliITSRecPoint*)clArr[index[ic]];
detectorIndexClustersLay[ic] = cluster->GetDetectorIndex();
overlapFlagClustersLay[ic] = kFALSE;
for (Int_t i=3;i--;) clPar[kClMC0+i] = cluster->GetLabel(i);
+ if (fCreateClustersCopy) fClusterCopyIndex[il][ic] = index[ic];
}
clArr.Clear();
delete[] z;
if (fDetectorIndexClustersLay[il]) delete[] fDetectorIndexClustersLay[il];
fDetectorIndexClustersLay[il] = detectorIndexClustersLay;
//
- for (int it=0;it<2;it++) {
- if (fUsedClusLay[il][it]) delete fUsedClusLay[il][it];
- fUsedClusLay[il][it] = new AliRefArray(nclLayer);
+ if (fBuildRefs) {
+ for (int it=0;it<2;it++) {
+ if (fUsedClusLay[il][it]) delete fUsedClusLay[il][it];
+ fUsedClusLay[il][it] = new AliRefArray(nclLayer);
+ }
}
//
if (fClustersLay[il]) delete[] fClustersLay[il];
// number of clusters in each chip of the current module
Int_t nClustersInChip[5] = {0,0,0,0,0};
Int_t layer = 0;
+ Int_t ladder=0;
+ Int_t det=0;
+ AliITSgeomTGeo::GetModuleId(iIts,layer,ladder,det);
+ --layer; // layer is from 1 to 6 in AliITSgeomTGeo, but from 0 to 5 here
+ if(layer<0 || layer >1)continue;
// loop over clusters
while(nClusters--) {
AliITSRecPoint* cluster = (AliITSRecPoint*)itsClusters->UncheckedAt(nClusters);
-
- layer = cluster->GetLayer();
- if (layer>1) continue;
-
+
// find the chip for the current cluster
Float_t locz = cluster->GetDetLocalZ();
Int_t iChip = fSPDSeg.GetChipFromLocal(0,locz);
{
// Flags clusters in the overlapping regions
Float_t distClSameMod=0.;
- Float_t distClSameModMin=0.;
- Int_t iClOverlap =0;
Float_t meanRadiusLay1 = 3.99335; // average radius inner layer
Float_t meanRadiusLay2 = 7.37935; // average radius outer layer;
distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
if (distClSameMod<=1.) fOverlapFlagClustersLay[0][iiC1]=kTRUE;
-// if (distClSameMod<=1.) {
-// if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
-// distClSameModMin=distClSameMod;
-// iClOverlap=iiC1;
-// }
-// }
-
-
} // end adjacent modules
}
} // end Loop on inner layer clusters
-// if (distClSameModMin!=0.) fOverlapFlagClustersLay[0][iClOverlap]=kTRUE;
distClSameMod=0.;
- distClSameModMin=0.;
- iClOverlap =0;
// Loop on outer layer clusters
for (Int_t iiC2=0; iiC2<fNClustersLay[1]; iiC2++) {
if (!fOverlapFlagClustersLay[1][iiC2]) {
distClSameMod = TMath::Sqrt(TMath::Power(deZproj/fZetaOverlapCut,2)+TMath::Power(dePhi/fPhiOverlapCut,2));
if (distClSameMod<=1.) fOverlapFlagClustersLay[1][iiC2]=kTRUE;
-// if (distClSameMod<=1.) {
-// if (distClSameModMin==0. || distClSameMod<distClSameModMin) {
-// distClSameModMin=distClSameMod;
-// iClOverlap=iiC2;
-// }
-// }
-
} // end adjacent modules
}
} // end Loop on outer layer clusters
-// if (distClSameModMin!=0.) fOverlapFlagClustersLay[1][iClOverlap]=kTRUE;
-
}
//____________________________________________________________________
}
}
//
+ if (GetStoreSPD2SingleCl()) {
+ for (Int_t iC2=0; iC2<fNClustersLay[1]; iC2++) {
+ if (fPartners[iC2]<0 || (fOverlapFlagClustersLay[0][fPartners[iC2]] || fOverlapFlagClustersLay[1][iC2])) {
+ float* clPar2 = GetClusterLayer2(iC2);
+ fSClusters[fNSingleCluster] = new Float_t[kClNPar];
+ fSClusters[fNSingleCluster][kSCTh] = clPar2[kClTh];
+ fSClusters[fNSingleCluster][kSCPh] = clPar2[kClPh];
+ fSClusters[fNSingleCluster][kSCLab] = clPar2[kClMC0];
+ fSClusters[fNSingleCluster][kSCID] = iC2;
+ AliDebug(1,Form(" Adding a single cluster %d (cluster %d of layer 2)",
+ fNSingleCluster, iC2));
+ fNSingleCluster++;
+ fNSingleClusterSPD2++;
+ }
+ }
+ }
+ //
}
//____________________________________________________________________
// Flag the clusters used by ESD tracks
// Flag primary tracks to be used for multiplicity counting
//
- if (!fESDEvent) return;
+ if (!fESDEvent || !fBuildRefs) return;
AliESDVertex* vtx = (AliESDVertex*)fESDEvent->GetPrimaryVertexTracks();
if (!vtx || vtx->GetNContributors()<1) vtx = (AliESDVertex*)fESDEvent->GetPrimaryVertexSPD();
if (!vtx || vtx->GetNContributors()<1) {
pid[AliPID::kElectron]>fCutMinElectronProbESD;
//
}
+
+//____________________________________________________________________
+AliITSRecPoint* AliITSMultReconstructor::GetRecPoint(Int_t lr, Int_t n) const
+{
+ // return a cluster of lr corresponding to orderer cluster index n
+ if (fClArr[lr] && fClusterCopyIndex[lr] && n<fNClustersLay[lr])
+ return (AliITSRecPoint*) fClArr[lr]->At(fClusterCopyIndex[lr][n]);
+ else {
+ AliError("To access the clusters SetCreateClustersCopy should have been called");
+ return 0;
+ }
+}