From: hristov Date: Fri, 18 Jun 2010 15:32:28 +0000 (+0000) Subject: Fixes for report #68312: Improper usage of TClonesArrays in ITS X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=01ef1bd446eccc961da25099a569486cacd722d7;p=u%2Fmrichter%2FAliRoot.git Fixes for report #68312: Improper usage of TClonesArrays in ITS --- diff --git a/HLT/ITS/AliHLTITSClusterFinderComponent.cxx b/HLT/ITS/AliHLTITSClusterFinderComponent.cxx index b6593f3043f..8a25cb4542f 100644 --- a/HLT/ITS/AliHLTITSClusterFinderComponent.cxx +++ b/HLT/ITS/AliHLTITSClusterFinderComponent.cxx @@ -41,6 +41,7 @@ using namespace std; #include "AliHLTITSClusterFinderSPD.h" #include "AliHLTITSClusterFinderSSD.h" #include "TMap.h" +#include "AliITSRecPointContainer.h" #include #include @@ -61,7 +62,6 @@ AliHLTITSClusterFinderComponent::AliHLTITSClusterFinderComponent(int mode) fNModules(0), fId(0), fNddl(0), - fClusters(NULL), fRawReader(NULL), fDettype(NULL), fgeom(NULL), @@ -70,6 +70,9 @@ AliHLTITSClusterFinderComponent::AliHLTITSClusterFinderComponent(int mode) fSSD(NULL), tD(NULL), tR(NULL), + fSPDNModules(0), + fSDDNModules(0), + fSSDNModules(0), fclusters(), fBenchmark(GetComponentID()) { @@ -282,12 +285,25 @@ Int_t AliHLTITSClusterFinderComponent::DoInit( int argc, const char** argv ) { fgeom = fgeomInit->CreateAliITSgeom(); fNModules = fgeom->GetIndexMax(); - - fClusters = new TClonesArray*[fNModules]; - for (Int_t iModule = 0; iModule < fNModules; iModule++) { - fClusters[iModule] = NULL; - } - + Int_t modperlay[6]; + for(Int_t i=0;i<6;i++)modperlay[i]=AliITSgeomTGeo::GetNDetectors(1+i)*AliITSgeomTGeo::GetNLadders(1+i); + fSPDNModules=modperlay[0]+modperlay[1]; + fSDDNModules=modperlay[2]+modperlay[3]; + fSSDNModules=modperlay[4]+modperlay[5]; + + if(fModeSwitch==kClusterFinderSPD) { + fFirstModule=0; + fLastModule=fSPDNModules; + } + else if(fModeSwitch==kClusterFinderSDD) { + fFirstModule=fSPDNModules; + fLastModule=fFirstModule + fSDDNModules; + } + else if(fModeSwitch==kClusterFinderSSD) { + fFirstModule=fSPDNModules + fSDDNModules; + fLastModule=fFirstModule + fSSDNModules; + } + //set dettype fDettype = new AliITSDetTypeRec(); fDettype->SetITSgeom(fgeom); @@ -334,14 +350,6 @@ Int_t AliHLTITSClusterFinderComponent::DoDeinit() { delete fSSD; fSSD = 0; - for (Int_t iModule = 0; iModule < fNModules; iModule++) { - if(fClusters[iModule] != NULL){ - fClusters[iModule]->Delete(); - delete fClusters[iModule]; - } - fClusters[iModule] = NULL; - } - fUseOfflineFinder = 0; return 0; @@ -458,7 +466,15 @@ int AliHLTITSClusterFinderComponent::DoEvent } } else{ - + + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); + + if(fUseOfflineFinder){ + if(fModeSwitch==kClusterFinderSPD){rpc->ResetSPD();} + if(fModeSwitch==kClusterFinderSSD){rpc->ResetSSD();} + } + if(fModeSwitch==kClusterFinderSDD){rpc->ResetSDD();} + // -- Loop over blocks for( const AliHLTComponentBlockData* iter = GetFirstInputBlock(fInputDataType); iter != NULL; iter = GetNextInputBlock() ) { @@ -500,21 +516,28 @@ int AliHLTITSClusterFinderComponent::DoEvent if(fModeSwitch==kClusterFinderSPD && !fUseOfflineFinder){ fSPD->RawdataToClusters( fRawReader, fclusters ); } else if(fModeSwitch==kClusterFinderSSD && !fUseOfflineFinder){ fSSD->RawdataToClusters( fclusters ); } else{ - if(fModeSwitch==kClusterFinderSPD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SPD");} - if(fModeSwitch==kClusterFinderSSD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SSD");} - if(fModeSwitch==kClusterFinderSDD) {fDettype->DigitsToRecPoints(fRawReader,fClusters,"SDD");} - for(int i=0;iGetEntriesFast();j++){ - AliITSRecPoint *recpoint = (AliITSRecPoint*) (fClusters[i]->At(j)); + if(fModeSwitch==kClusterFinderSPD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,"SPD");} + if(fModeSwitch==kClusterFinderSSD && fUseOfflineFinder) {fDettype->DigitsToRecPoints(fRawReader,"SSD");} + if(fModeSwitch==kClusterFinderSDD) {fDettype->DigitsToRecPoints(fRawReader,"SDD");} + //AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); + TClonesArray* clusters = NULL; + for(int i=fFirstModule;iUncheckedGetClusters(i); + if(clusters != NULL){ + for(int j=0;jGetEntriesFast();j++){ + AliITSRecPoint *recpoint = (AliITSRecPoint*) (clusters->At(j)); fclusters.push_back(*recpoint); } - fClusters[i]->Delete(); - delete fClusters[i]; } - fClusters[i] = NULL; } } + + if(fUseOfflineFinder){ + if(fModeSwitch==kClusterFinderSPD){rpc->ResetSPD();} + if(fModeSwitch==kClusterFinderSSD){rpc->ResetSSD();} + } + if(fModeSwitch==kClusterFinderSDD){rpc->ResetSDD();} + fBenchmark.Stop(1); fRawReader->ClearBuffers(); diff --git a/HLT/ITS/AliHLTITSClusterFinderComponent.h b/HLT/ITS/AliHLTITSClusterFinderComponent.h index d4dffc5d65a..6efc42271ed 100644 --- a/HLT/ITS/AliHLTITSClusterFinderComponent.h +++ b/HLT/ITS/AliHLTITSClusterFinderComponent.h @@ -201,8 +201,6 @@ class AliHLTITSClusterFinderComponent : public AliHLTProcessor Int_t fId; // ddl offset Int_t fNddl; // number of ddl's - TClonesArray** fClusters; //!transient - /** the reader object for data decoding */ AliRawReaderMemory* fRawReader; //!transient @@ -216,6 +214,13 @@ class AliHLTITSClusterFinderComponent : public AliHLTProcessor TTree *tD; //!transient TTree *tR; //!transient + Int_t fSPDNModules; //!transient + Int_t fSDDNModules; //!transient + Int_t fSSDNModules; //!transient + + Int_t fFirstModule; //!transient + Int_t fLastModule; //!transient + std::vector fclusters; //!transient AliHLTComponentBenchmark fBenchmark;// benchmark diff --git a/ITS/AliITSClusterFinder.h b/ITS/AliITSClusterFinder.h index 2ccbaa5a449..db36088727c 100644 --- a/ITS/AliITSClusterFinder.h +++ b/ITS/AliITSClusterFinder.h @@ -35,7 +35,7 @@ class AliITSClusterFinder :public TObject{ // // Do the Reconstruction. virtual void FindRawClusters(Int_t /*mod*/)=0; // Finds cluster of digits. - virtual void RawdataToClusters(AliRawReader* /*rawReader*/,TClonesArray** /*clusters*/) { + virtual void RawdataToClusters(AliRawReader* /*rawReader*/) { AliError("Method not implemented in this class "); } diff --git a/ITS/AliITSClusterFinderV2SDD.cxx b/ITS/AliITSClusterFinderV2SDD.cxx index 616932b6779..8d065dfd218 100644 --- a/ITS/AliITSClusterFinderV2SDD.cxx +++ b/ITS/AliITSClusterFinderV2SDD.cxx @@ -28,6 +28,7 @@ #include #include "AliITSClusterFinderV2SDD.h" #include "AliITSRecPoint.h" +#include "AliITSRecPointContainer.h" #include "AliITSDetTypeRec.h" #include "AliRawReader.h" #include "AliITSRawStreamSDD.h" @@ -316,7 +317,7 @@ FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2], } //______________________________________________________________________ -void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){ +void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader){ //------------------------------------------------------------ // This function creates ITS clusters from raw data //------------------------------------------------------------ @@ -343,16 +344,16 @@ void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClones } } } - FindClustersSDD(inputSDD,clusters); + FindClustersSDD(inputSDD); delete inputSDD; } -void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, - TClonesArray** clusters) +void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input) { //------------------------------------------------------------ // Actual SDD cluster finder for raw data //------------------------------------------------------------ + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); Int_t nClustersSDD = 0; AliBin *bins[2]; TBits* anodeFired[2]; @@ -385,13 +386,13 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, for(Int_t iMod=0; iMod=0){ fModule = vectModId[iMod]; - clusters[fModule] = new TClonesArray("AliITSRecPoint"); + TClonesArray* clusters = rpc->UncheckedGetClusters(fModule); bins[0]=fDDLBins[iMod*2]; // first hybrid of the module bins[1]=fDDLBins[iMod*2+1]; // second hybrid of the module anodeFired[0]=ddlAnodeFired[iMod*2]; anodeFired[1]=ddlAnodeFired[iMod*2+1]; - FindClustersSDD(bins, anodeFired, NULL, clusters[fModule],jitter); - Int_t nClusters = clusters[fModule]->GetEntriesFast(); + FindClustersSDD(bins, anodeFired, NULL, clusters,jitter); + Int_t nClusters = clusters->GetEntriesFast(); nClustersSDD += nClusters; vectModId[iMod]=-1; } diff --git a/ITS/AliITSClusterFinderV2SDD.h b/ITS/AliITSClusterFinderV2SDD.h index 2cf9d1cc08a..8ed101b66e5 100644 --- a/ITS/AliITSClusterFinderV2SDD.h +++ b/ITS/AliITSClusterFinderV2SDD.h @@ -24,7 +24,7 @@ public: AliITSClusterFinderV2SDD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SDD(); virtual void FindRawClusters(Int_t mod); - virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); + virtual void RawdataToClusters(AliRawReader* rawReader); void SetPeakSelection(Float_t looseCut=15., Float_t tightCut=30., Float_t maxTime=2000.){ fCutOnPeakLoose=looseCut; fCutOnPeakTight=tightCut; @@ -43,7 +43,7 @@ public: void FindClustersSDD(AliBin* bins[2], TBits* anodeFired[2], TClonesArray *dig, TClonesArray *clusters=0x0, Int_t jitter=0); - void FindClustersSDD(AliITSRawStream* input,TClonesArray** clusters); + void FindClustersSDD(AliITSRawStream* input); virtual AliITSCalibrationSDD* GetResp(Int_t mod)const{ return (AliITSCalibrationSDD*) fDetTypeRec->GetCalibrationModel(mod);} virtual AliITSsegmentationSDD* GetSeg()const{ diff --git a/ITS/AliITSClusterFinderV2SPD.cxx b/ITS/AliITSClusterFinderV2SPD.cxx index 5dd8cc274d8..75e1dac7962 100644 --- a/ITS/AliITSClusterFinderV2SPD.cxx +++ b/ITS/AliITSClusterFinderV2SPD.cxx @@ -32,6 +32,7 @@ #include #include "AliITSdigitSPD.h" #include "AliITSFOSignalsSPD.h" +#include "AliITSRecPointContainer.h" ClassImp(AliITSClusterFinderV2SPD) @@ -73,13 +74,13 @@ void AliITSClusterFinderV2SPD::FindRawClusters(Int_t mod){ } //__________________________________________________________________________ -void AliITSClusterFinderV2SPD::RawdataToClusters(AliRawReader* rawReader, TClonesArray** clusters){ +void AliITSClusterFinderV2SPD::RawdataToClusters(AliRawReader* rawReader){ //------------------------------------------------------------ // This function creates ITS clusters from raw data //------------------------------------------------------------ rawReader->Reset(); AliITSRawStreamSPD inputSPD(rawReader); - FindClustersSPD(&inputSPD, clusters); + FindClustersSPD(&inputSPD); } //__________________________________________________________________________ @@ -273,14 +274,14 @@ Int_t AliITSClusterFinderV2SPD::ClustersSPD(AliBin* bins, TClonesArray* digits,T } //__________________________________________________________________________ -void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input, - TClonesArray** clusters) +void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input) { //------------------------------------------------------------ // SPD cluster finder for raw data (this method is called once per event) // Now also fills fast-or fired map //------------------------------------------------------------ - + + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); Int_t nClustersSPD = 0; Int_t kNzBins = fNzSPD + 2; Int_t kNyBins = fNySPD + 2; @@ -297,8 +298,8 @@ void AliITSClusterFinderV2SPD::FindClustersSPD(AliITSRawStreamSPD* input, // when all data from a module was read, search for clusters if (bins) { - clusters[iModule] = new TClonesArray("AliITSRecPoint"); - Int_t nClusters = ClustersSPD(bins,0,clusters[iModule],kMaxBin,kNzBins,iModule,kTRUE); + TClonesArray* clusters = rpc->UncheckedGetClusters(iModule); + Int_t nClusters = ClustersSPD(bins,0,clusters,kMaxBin,kNzBins,iModule,kTRUE); nClustersSPD += nClusters; bins = NULL; } diff --git a/ITS/AliITSClusterFinderV2SPD.h b/ITS/AliITSClusterFinderV2SPD.h index e027d28f47d..2416476c774 100644 --- a/ITS/AliITSClusterFinderV2SPD.h +++ b/ITS/AliITSClusterFinderV2SPD.h @@ -21,13 +21,13 @@ public: AliITSClusterFinderV2SPD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SPD(){;} virtual void FindRawClusters(Int_t mod); - virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); + virtual void RawdataToClusters(AliRawReader* rawReader); protected: void FindClustersSPD(TClonesArray *digits); - void FindClustersSPD(AliITSRawStreamSPD* input,TClonesArray** clusters); + void FindClustersSPD(AliITSRawStreamSPD* input); Int_t ClustersSPD(AliBin* bins, TClonesArray* digits,TClonesArray* clusters,Int_t maxBins, Int_t nzbins,Int_t iModule,Bool_t rawdata=kFALSE); Int_t fLastSPD1; //index of the last SPD1 detector diff --git a/ITS/AliITSClusterFinderV2SSD.cxx b/ITS/AliITSClusterFinderV2SSD.cxx index 9d7d60a239a..3c71ad378e6 100644 --- a/ITS/AliITSClusterFinderV2SSD.cxx +++ b/ITS/AliITSClusterFinderV2SSD.cxx @@ -29,6 +29,7 @@ #include "AliITSClusterFinderV2SSD.h" #include "AliITSRecPoint.h" +#include "AliITSRecPointContainer.h" #include "AliITSgeomTGeo.h" #include "AliITSDetTypeRec.h" #include "AliRawReader.h" @@ -356,24 +357,24 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(TClonesArray *alldigits) { } -void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters){ +void AliITSClusterFinderV2SSD::RawdataToClusters(AliRawReader* rawReader){ //------------------------------------------------------------ // This function creates ITS clusters from raw data //------------------------------------------------------------ rawReader->Reset(); AliITSRawStreamSSD inputSSD(rawReader); - FindClustersSSD(&inputSSD,clusters); + FindClustersSSD(&inputSSD); } -void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input, - TClonesArray** clusters) +void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input) { //------------------------------------------------------------ // Actual SSD cluster finder for raw data //------------------------------------------------------------ + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); static AliITSRecoParam *repa = NULL; if(!repa){ repa = (AliITSRecoParam*) AliITSReconstructor::GetRecoParam(); @@ -712,13 +713,12 @@ void AliITSClusterFinderV2SSD::FindClustersSSD(AliITSRawStreamSSD* input, } // create recpoints - if((nClusters[0])&&(nClusters[1])) { - - clusters[iModule] = new TClonesArray("AliITSRecPoint"); + if((nClusters[0])&&(nClusters[1])) { fModule = iModule; + TClonesArray* clusters = rpc->UncheckedGetClusters(fModule); FindClustersSSD(&clusters1D[0][0], nClusters[0], - &clusters1D[1][0], nClusters[1], clusters[iModule]); - Int_t nClustersn = clusters[iModule]->GetEntriesFast(); + &clusters1D[1][0], nClusters[1], clusters); + Int_t nClustersn = clusters->GetEntriesFast(); nClustersSSD += nClustersn; } diff --git a/ITS/AliITSClusterFinderV2SSD.h b/ITS/AliITSClusterFinderV2SSD.h index f1f737a647c..ab9a39f8d7f 100644 --- a/ITS/AliITSClusterFinderV2SSD.h +++ b/ITS/AliITSClusterFinderV2SSD.h @@ -28,7 +28,7 @@ public: AliITSClusterFinderV2SSD(AliITSDetTypeRec* dettyp); virtual ~AliITSClusterFinderV2SSD(){;} virtual void FindRawClusters(Int_t mod); - virtual void RawdataToClusters(AliRawReader* rawReader,TClonesArray** clusters); + virtual void RawdataToClusters(AliRawReader* rawReader); protected: AliITSClusterFinderV2SSD(const AliITSClusterFinderV2SSD& cf); AliITSClusterFinderV2SSD& operator=(const AliITSClusterFinderV2SSD& cf ); @@ -37,7 +37,7 @@ public: Ali1Dcluster* pos, Int_t np, TClonesArray *clusters=0x0); - void FindClustersSSD(AliITSRawStreamSSD* input,TClonesArray** clusters); + void FindClustersSSD(AliITSRawStreamSSD* input); virtual AliITSCalibrationSSD* GetResp(Int_t mod)const{ return (AliITSCalibrationSSD*) fDetTypeRec->GetCalibrationModel(mod);} diff --git a/ITS/AliITSDetTypeRec.cxx b/ITS/AliITSDetTypeRec.cxx index 13b02e3c6de..44a42ff8d93 100644 --- a/ITS/AliITSDetTypeRec.cxx +++ b/ITS/AliITSDetTypeRec.cxx @@ -932,38 +932,49 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Op strstr(opt,"SSD")}; Int_t id=0; - + /* TClonesArray *array=new TClonesArray("AliITSRecPoint",1000); TBranch *branch = treeR->Branch("ITSRecPoints",&array); delete array; - TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()]; for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) { clusters[iModule] = NULL; } - - DigitsToRecPoints(rawReader,clusters,opt); + */ + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); + rpc->FullReset(); + TClonesArray* array = rpc->UncheckedGetClusters(0); + TBranch *branch = treeR->Branch("ITSRecPoints",&array); + DigitsToRecPoints(rawReader,opt); Int_t nClusters =0; - TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint"); + // TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint"); for(Int_t iModule=0;iModuleGetIndexMax();iModule++){ id = GetITSgeom()->GetModuleType(iModule); if (!all && !det[id]) continue; - array = clusters[iModule]; + array = rpc->UncheckedGetClusters(iModule); if(!array){ AliDebug(1,Form("data for module %d missing!",iModule)); - array = emptyArray; + // array = emptyArray; } branch->SetAddress(&array); treeR->Fill(); nClusters+=array->GetEntriesFast(); - + /* if (array != emptyArray) { array->Delete(); delete array; } + */ + } + // delete emptyArray; + printf("=============== +++++++++++++++++ ===================\n"); + for(Int_t iModule=0;iModuleGetIndexMax();iModule++){ + array = rpc->UncheckedGetClusters(iModule); + Int_t number = array->GetEntries(); + if(number>0)printf("Module %d has %d clusters\n",iModule,number); } - delete emptyArray; + rpc->FullReset(); AliITSRecPointContainer* rpcont = AliITSRecPointContainer::Instance(); Int_t nClu[6]; @@ -971,17 +982,24 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Op for(Int_t iLay=2; iLay<=6; iLay++) nClu[iLay-1]=rpcont->GetNClustersInLayerFast(iLay); AliInfo(Form("Number of RecPoints in ITS Layers = %d %d %d %d %d %d, Total = %d", nClu[0],nClu[1],nClu[2],nClu[3],nClu[4],nClu[5],nClusters)); - delete[] clusters; + + printf("=============== SECOND +++++++++++++++++ ===================\n"); + for(Int_t iModule=0;iModuleGetIndexMax();iModule++){ + array = rpc->UncheckedGetClusters(iModule); + Int_t number = array->GetEntries(); + if(number>0)printf("Module %d has %d clusters\n",iModule,number); + } + + // delete[] clusters; } //______________________________________________________________________ -void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** clusters,Option_t *opt){ +void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,Option_t *opt){ // cluster finding and reconstruction of space points // the condition below will disappear when the geom class will be // initialized for all versions - for the moment it is only for v5 ! // 7 is the SDD beam test version // Inputs: // AliRawReader *rawReader Pointer to the raw-data reader - // TClonesArray **clusters Clusters Array // Outputs: // none. // Return: @@ -1002,14 +1020,14 @@ void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** if (!rec) AliFatal("The reconstruction class was not instantiated"); rec->SetDetTypeRec(this); - rec->RawdataToClusters(rawReader,clusters); + rec->RawdataToClusters(rawReader); } // Remove PIT in-active chips from Fast-OR fired map if (all || det[0]) { // SPD present RemoveFastOrFiredInActive(); // here removing bits which have no associated clusters - if(clusters) RemoveFastOrFiredFromDead(GetFiredChipMap(clusters)); + RemoveFastOrFiredFromDead(GetFiredChipMap()); } } @@ -1101,12 +1119,14 @@ void AliITSDetTypeRec::RemoveFastOrFiredInActive() { } } //______________________________________________________________________ -TBits AliITSDetTypeRec::GetFiredChipMap(TClonesArray **clusters) const { +TBits AliITSDetTypeRec::GetFiredChipMap() const { // // TBits of the fired chips // + AliITSRecPointContainer* rpc = AliITSRecPointContainer::Instance(); + TBits isfiredchip(1200); AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)GetSegmentationModel(0); @@ -1117,29 +1137,29 @@ TBits AliITSDetTypeRec::GetFiredChipMap(TClonesArray **clusters) const { for(Int_t imod =0; imod < fgkDefaultNModulesSPD; imod++){ - TClonesArray *array = clusters[imod]; - if(!array) continue; - Int_t nCluster = array->GetEntriesFast(); + TClonesArray *array = rpc->UncheckedGetClusters(imod); + if(!array) continue; + Int_t nCluster = array->GetEntriesFast(); - while(nCluster--) { - AliITSRecPoint* cluster = (AliITSRecPoint*)array->UncheckedAt(nCluster); + while(nCluster--) { + AliITSRecPoint* cluster = (AliITSRecPoint*)array->UncheckedAt(nCluster); if (cluster->GetLayer()>1)continue; - Float_t local[3]={-1,-1}; - local[1]=cluster->GetDetLocalX(); - local[0]=cluster->GetDetLocalZ(); - - Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod); - Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod); - Int_t row, col; - segSPD->LocalToDet(0.5,local[0],row,col); - Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col); - Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip); - isfiredchip.SetBitNumber(chipkey,kTRUE); - } + Float_t local[3]={-1,-1}; + local[1]=cluster->GetDetLocalX(); + local[0]=cluster->GetDetLocalZ(); + + Int_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(imod); + Int_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(imod); + Int_t row, col; + segSPD->LocalToDet(0.5,local[0],row,col); + Int_t chip = AliITSRawStreamSPD::GetOnlineChipFromOffline(imod,col); + Int_t chipkey = AliITSRawStreamSPD::GetOfflineChipKeyFromOnline(eq,hs,chip); + isfiredchip.SetBitNumber(chipkey,kTRUE); + } - } + } - return isfiredchip; + return isfiredchip; } //______________________________________________________________________ diff --git a/ITS/AliITSDetTypeRec.h b/ITS/AliITSDetTypeRec.h index 40fb6b054de..f80f83dbec8 100644 --- a/ITS/AliITSDetTypeRec.h +++ b/ITS/AliITSDetTypeRec.h @@ -91,12 +91,12 @@ class AliITSDetTypeRec : public TObject { void MakeBranchRF(TTree *treeR){MakeBranchR(treeR,"Fast");} void DigitsToRecPoints(TTree *treeD,TTree *treeR,Int_t lastEntry,Option_t *det, Int_t optCluFind=0); void DigitsToRecPoints(AliRawReader* rawReader,TTree *treeR,Option_t *det="All"); - void DigitsToRecPoints(AliRawReader* rawReader,TClonesArray** clusters,Option_t *opt); + void DigitsToRecPoints(AliRawReader* rawReader,Option_t *opt); void SetFastOrFiredMapOnline(UInt_t eq, UInt_t hs, UInt_t chip); void SetFastOrFiredMap(UInt_t chipKey){fFastOrFiredMap.SetBitNumber(chipKey);} TBits GetFastOrFiredMap() const {return fFastOrFiredMap;} - TBits GetFiredChipMap(TClonesArray **clusters) const; // (using SPD RecPoints) + TBits GetFiredChipMap() const; // (using SPD RecPoints) TBits GetFiredChipMap(TTree *treeR) const; // (using SPD RecPoints) void ResetFastOrFiredMap(){fFastOrFiredMap.ResetAllBits();} void RemoveFastOrFiredInActive(); // (using Trigger Conditions) diff --git a/ITS/AliITSRecPointContainer.cxx b/ITS/AliITSRecPointContainer.cxx index e4b8143ef64..e2180111b60 100644 --- a/ITS/AliITSRecPointContainer.cxx +++ b/ITS/AliITSRecPointContainer.cxx @@ -247,9 +247,44 @@ AliITSRecPointContainer* AliITSRecPointContainer::Instance(const AliITSRecoParam //______________________________________________________________________ void AliITSRecPointContainer::Reset(){ // Resets the status of the object - for(Int_t i=0;iClear(); - } + ClearClus(0,fgkNModules); fDet=""; for(Int_t i=0;i<6;i++)fNClusters[i]=0; } +//______________________________________________________________________ +void AliITSRecPointContainer::ResetSPD(){ + // Resets only the entries in fArray concerning SPD + // This method should be used with care only when the filling + // of the container is not done from the RP TTree. + fCurrentEve = -1000; // protection: if FetchClusters method will be used + // after this call, an ccess to the RP TTree will + // be forced + ClearClus(0,fSPDNModules); +} + +//______________________________________________________________________ +void AliITSRecPointContainer::ResetSDD(){ + // Resets only the entries in fArray concerning SDD + // This method should be used with care only when the filling + // of the container is not done from the RP TTree. + fCurrentEve = -1000; // protection: if FetchClusters method will be used + // after this call, an ccess to the RP TTree will + // be forced + Int_t first = fSPDNModules; + Int_t last = first + fSDDNModules; + ClearClus(first,last); +} + +//______________________________________________________________________ +void AliITSRecPointContainer::ResetSSD(){ + // Resets only the entries in fArray concerning SSD + // This method should be used with care only when the filling + // of the container is not done from the RP TTree. + fCurrentEve = -1000; // protection: if FetchClusters method will be used + // after this call, an ccess to the RP TTree will + // be forced + Int_t first = fSPDNModules + fSDDNModules; + Int_t last = first + fSSDNModules; + ClearClus(first,last); +} + diff --git a/ITS/AliITSRecPointContainer.h b/ITS/AliITSRecPointContainer.h index 1a493ef03ba..c80bbfe06ce 100644 --- a/ITS/AliITSRecPointContainer.h +++ b/ITS/AliITSRecPointContainer.h @@ -36,6 +36,10 @@ class AliITSRecPointContainer : public TObject { // In the following two methods: 1<=lay<=6 (i.e. layers numbered from 1) UInt_t GetNClustersInLayer(Int_t lay, TTree* tR, Int_t eventN=-1); UInt_t GetNClustersInLayerFast(Int_t lay) const; + void FullReset(){fCurrentEve=-1000; Reset();} + void ResetSPD(); // clears only SPD parts - see implementation for usage + void ResetSDD(); // clears only SPD parts - see implementation for usage + void ResetSSD(); // clears only SPD parts - see implementation for usage private: // methods @@ -45,6 +49,10 @@ class AliITSRecPointContainer : public TObject { Bool_t CheckBoundaries(Int_t i)const { return (i>=0 && iClear(); + } //Data members static AliITSRecPointContainer* fgInstance; //! AliITSRecPointContainer // singleton