for (Int_t iPlane=0; iPlane<fNMaxPlanes; iPlane++) fClustersPerPlane[iPlane] = NULL;
fDigitsInCluster = new TClonesArray("AliMFTDigit", fNMaxDigitsPerCluster);
+ fDigitsInCluster -> SetOwner(kTRUE);
}
//====================================================================================================================================================
AliMFTClusterFinder::~AliMFTClusterFinder() {
-
+
AliDebug(1, "Deleting AliMFTClusterFinder...");
+
+ for (Int_t iPlane=0; iPlane<fNMaxPlanes; iPlane++) {
+ if (fClustersPerPlane[iPlane]) fClustersPerPlane[iPlane]->Delete(); delete fClustersPerPlane[iPlane]; fClustersPerPlane[iPlane] = 0x0;
+ }
+ if (fDigitsInCluster) fDigitsInCluster->Delete(); delete fDigitsInCluster; fDigitsInCluster = NULL;
+ delete fSegmentation; fSegmentation=NULL;
+
+ AliDebug(1, "... done!");
+
+}
- for (Int_t iPlane=0; iPlane<fNMaxPlanes; iPlane++) delete fClustersPerPlane[iPlane];
+//====================================================================================================================================================
+void AliMFTClusterFinder::Clear(const Option_t* /*opt*/) {
+
+ AliDebug(1, "Clearing AliMFTClusterFinder...");
+
+ for (Int_t iPlane=0; iPlane<fNMaxPlanes; iPlane++) {
+ if(fClustersPerPlane[iPlane]) fClustersPerPlane[iPlane]->Clear("C");
+ }
+ if(fDigitsInCluster) fDigitsInCluster->Clear("C");
+ fSegmentation->Clear("C");
+
AliDebug(1, "... done!");
-
+
}
//====================================================================================================================================================
-void AliMFTClusterFinder::Init(Char_t *nameGeomFile) {
+void AliMFTClusterFinder::Init(const Char_t *nameGeomFile) {
fSegmentation = new AliMFTSegmentation(nameGeomFile);
fNPlanes = fSegmentation -> GetNPlanes();
AliDebug(1, "Starting Event...");
for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
- fClustersPerPlane[iPlane]->Clear();
+ fClustersPerPlane[iPlane]->Delete();
}
AliDebug(1, "... done!");
StartEvent();
Bool_t isDigAvailableForNewCluster = kTRUE;
+ TClonesArray *myDigitList = 0;
+
for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
AliDebug(1, Form("Plane %02d", iPlane));
- TClonesArray *myDigitList = (TClonesArray*) pDigitList->At(iPlane);
+ myDigitList = (TClonesArray*) pDigitList->At(iPlane);
AliDebug(1, Form("myDigitList->GetEntries() = %d", myDigitList->GetEntries()));
myDigitList->Compress();
iDig--;
new ((*fClustersPerPlane[iPlane])[fClustersPerPlane[iPlane]->GetEntries()]) AliMFTCluster(*newCluster);
+ delete newCluster;
}
} // end of cycle over the digits
AliDebug(1, Form("Found %d clusters in plane %02d", fClustersPerPlane[iPlane]->GetEntries(), iPlane));
+ myDigitList -> Delete();
+
} // end of cycle over the planes
}
if (treeCluster) {
for(Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
AliDebug(1, Form("Setting Branch Plane_%02d for treeCluster",iPlane));
- TBranch *branch = treeCluster->GetBranch(Form("Plane_%02d",iPlane));
- if (branch) continue;
+ if (treeCluster->GetBranch(Form("Plane_%02d",iPlane))) continue;
AliDebug(1, Form("Branch Plane_%02d does not exist, creating!",iPlane));
- branch = treeCluster->Branch(Form("Plane_%02d",iPlane), &(fClustersPerPlane[iPlane]));
+ treeCluster->Branch(Form("Plane_%02d",iPlane), &(fClustersPerPlane[iPlane]));
}
}
for(Int_t iPlane=0; iPlane<fNPlanes; iPlane++) {
AliDebug(1, Form("plane %02d", iPlane));
fClustersPerPlane[iPlane] = new TClonesArray("AliMFTCluster");
+ fClustersPerPlane[iPlane] -> SetOwner(kTRUE);
+
}
}