From: kkanaki Date: Mon, 15 Mar 2010 09:42:40 +0000 (+0000) Subject: - fixed ownership of arrays X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=a00412ee997c242c72ed51eed5c1c27a46a84129;p=u%2Fmrichter%2FAliRoot.git - fixed ownership of arrays - cleanup of debug messages --- diff --git a/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.cxx b/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.cxx index 07967e62be4..2d560ced37f 100644 --- a/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.cxx +++ b/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.cxx @@ -58,8 +58,9 @@ ClassImp(AliHLTTPCCalibSeedMakerComponent) //ROOT macro for the implementation o AliHLTTPCCalibSeedMakerComponent::AliHLTTPCCalibSeedMakerComponent() : - fTPCGeomParam(0), - fSeedArray(0) + fTPCGeomParam(0) + ,fSeedArray(0) + ,fOffClusterArray(0) { // see header file for class documentation // or @@ -122,7 +123,10 @@ int AliHLTTPCCalibSeedMakerComponent::DoInit( int /*argc*/, const char** /*argv* if(!fTPCGeomParam) HLTError("TPC Parameters are not loaded."); fSeedArray = new TClonesArray("AliTPCseed"); - fSeedArray->SetOwner(kTRUE); + + fOffClusterArray = new TObjArray(); + //fOffClusterArray->SetOwner(kTRUE); + return 0; } // end DoInit() @@ -130,8 +134,10 @@ int AliHLTTPCCalibSeedMakerComponent::DoInit( int /*argc*/, const char** /*argv* int AliHLTTPCCalibSeedMakerComponent::DoDeinit() { // see header file for class documentation - if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = NULL; - if(fSeedArray) {fSeedArray->Clear(); delete fSeedArray; } fSeedArray = NULL; + if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = NULL; + if(fSeedArray) delete fSeedArray; fSeedArray = NULL; + if(fOffClusterArray) delete fOffClusterArray; fOffClusterArray = NULL; + return 0; } @@ -179,19 +185,8 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /* HLTDebug("Total space points: %d", totalSpacePoints); //------------------ Access to track data blocks --------------------// - - TObjArray *offClusterArray = new TObjArray; - //offClusterArray->SetOwner(kTRUE); - offClusterArray->Clear(); - - - if(!fSeedArray){ - for(Int_t i=0; iGetEntriesFast(); i++){ - if(fSeedArray->At(i) != NULL) fSeedArray->At(i)->Delete(); - } - fSeedArray->Clear(); - } - + + fSeedArray->Clear(); for(iter = GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){ if(iter->fDataType != (kAliHLTDataTypeTrack|kAliHLTDataOriginTPC)) continue; @@ -225,9 +220,15 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /* Double_t angle = fTPCGeomParam->GetInnerAngle(); const UInt_t *hitnum = element->GetPoints(); // store the clusters on each track in an array and loop over them - + +// for(Int_t i=0; iGetEntriesFast(); i++){ +// if(fOffClusterArray->At(i) != NULL) fOffClusterArray->At(i)->Delete(); +// } + fOffClusterArray->Clear(); + for(UInt_t i=0; iGetNumberOfPoints(); i++){ - + + // the id of the cluster contains information about the slice and partition it belongs to // as well as its index (pos) @@ -258,20 +259,19 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /* HLTDebug("slice %d, partition :%d, sector row: %d", sliceTrack, patchTrack, (fClustersArray[sliceTrack][patchTrack])[pos].fPadRow); - // convert the HLT clusters to AliTPCclusterMI - AliHLTTPCOfflineCluster pConv; - AliTPCclusterMI *offClus = pConv.ConvertHLTToOffline((fClustersArray[sliceTrack][patchTrack])[pos]); - offClus->SetDetector(sector); - usedSpacePoints++; - - offClusterArray->Add(offClus); - - rieman.AddPoint( offClus->GetX(),offClus->GetY(),offClus->GetZ(),TMath::Sqrt(offClus->GetSigmaY2()),TMath::Sqrt(offClus->GetSigmaZ2()) ); - alpha = 0.5*angle+angle*(sector%18); //sector rotation angle + // convert the HLT clusters to AliTPCclusterMI + AliHLTTPCOfflineCluster pConv; + AliTPCclusterMI *offClus = pConv.ConvertHLTToOffline((fClustersArray[sliceTrack][patchTrack])[pos]); + offClus->SetDetector(sector); + fOffClusterArray->Add(offClus); + + rieman.AddPoint( offClus->GetX(), offClus->GetY(), offClus->GetZ(),TMath::Sqrt(offClus->GetSigmaY2()),TMath::Sqrt(offClus->GetSigmaZ2()) ); + alpha = 0.5*angle+angle*(sector%18); //sector rotation angle // HLTInfo("detector: %d, row: %d, xrow[row]: %f", sector, offClus->GetRow(), xrow[offClus->GetRow()]); - } // end of cluster loop + usedSpacePoints++; + } // end of cluster loop // creation of AliTPCseed by means of a Riemann fit rieman.Update(); @@ -282,16 +282,14 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /* dynamic_cast(fSeedArray->At(nTracks))->SetLabel(element->GetID()); // set up of the cluster pointers inside the seed - for(Int_t j=0; jGetEntries(); j++){ - AliTPCclusterMI *cl = (AliTPCclusterMI*)offClusterArray->At(j); - //if(cl) seed->SetClusterPointer(cl->GetRow(),cl); - if(cl) dynamic_cast(fSeedArray->At(nTracks))->SetClusterPointer(cl->GetRow(),cl); - } - - - - offClusterArray->Clear(); - //HLTDebug("External track parameters: seed: 0x%08x, xmin: %f, alpha: %f, param[0]: %f, cov[0]: %f", seed, xmin, alpha, param[0], cov[0]); + for( Int_t j=0; j(fOffClusterArray->At(j)); + if(cl) dynamic_cast(fSeedArray->At(nTracks))->SetClusterPointer(cl->GetRow(), cl); + } + + //printf("kelly seed calib dedx: %f, P: %f\n", dynamic_cast(fSeedArray->At(nTracks))->CookdEdx(0.02,0.6), dynamic_cast(fSeedArray->At(nTracks))->P()); + + HLTDebug("External track parameters: seed: 0x%08x, xmin: %f, alpha: %f, param[0]: %f, cov[0]: %f", dynamic_cast(fSeedArray->At(nTracks)), xmin, alpha, param[0], cov[0]); nTracks++; }// end of vector track loop @@ -299,11 +297,8 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /* HLTDebug("Used space points: %d", usedSpacePoints); HLTDebug("Number of entries in fSeedArray: %d", fSeedArray->GetEntries()); - - if(offClusterArray) delete offClusterArray; - offClusterArray = NULL; - + PushBack((TObject*)fSeedArray, kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC, 0x0); - + return 0; } // end DoEvent() diff --git a/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.h b/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.h index 5d917319c35..8e966ab5627 100644 --- a/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.h +++ b/HLT/TPCLib/calibration/AliHLTTPCCalibSeedMakerComponent.h @@ -78,9 +78,9 @@ class AliHLTTPCCalibSeedMakerComponent : public AliHLTProcessor { AliHLTTPCSpacePointData *fClustersArray[36][6]; //! transient UInt_t fNSpacePoints[36][6]; //! transient TClonesArray *fSeedArray; - //TObjArray *fSeedArray; + TObjArray *fOffClusterArray; - ClassDef(AliHLTTPCCalibSeedMakerComponent, 2) + ClassDef(AliHLTTPCCalibSeedMakerComponent, 3) }; #endif