diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 394955a115cdd2d153b0f084f92c6134baee91d2..b9ea0ad92b43cdab869143635b543b7d62741cf7 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -697,7 +697,7 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) // Fill list of clusters. - ClusterHits(HitSet); + ClusterHits(HitSet, fClusterList); fNclust = (*fClusterList).size(); //number of clusters @@ -731,15 +731,18 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) cout << "---------------------------------------------------------------\n"; } + if(fHasArray) fArray->CoarseProcess(tracks); + return 0; } //----------------------------------------------------------------------------- -void THcShower::ClusterHits(THcShowerHitSet& HitSet) { +void THcShower::ClusterHits(THcShowerHitSet& HitSet, + THcShowerClusterList* ClusterList) { // Collect hits from the HitSet into the clusters. The resultant clusters - // of hits are saved in the fClusterList. + // of hits are saved in the ClusterList. while (HitSet.size() != 0) { @@ -776,7 +779,7 @@ void THcShower::ClusterHits(THcShowerHitSet& HitSet) { } //while clustered - fClusterList->push_back(cluster); //Put the cluster in the cluster list + ClusterList->push_back(cluster); //Put the cluster in the cluster list } //While hit_list not exhausted diff --git a/src/THcShower.h b/src/THcShower.h index 5419ec279b520be0792fae3886cb0170fe69eeba..a4a74543162f6fae1498845f1eb5941a70d7b330 100644 --- a/src/THcShower.h +++ b/src/THcShower.h @@ -184,7 +184,7 @@ protected: // Cluster to track association method. Int_t MatchCluster(THaTrack*, Double_t&, Double_t&); - void ClusterHits(THcShowerHitSet& HitSet); + void ClusterHits(THcShowerHitSet& HitSet, THcShowerClusterList* ClusterList); friend class THcShowerPlane; //to access debug flags. friend class THcShowerArray; //to access debug flags. diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 0fce28e3dd0cbe3da882ac60e2568cc84bf2f666..fac73bc31373756ad711d4a001ff84e8f020af37 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -39,8 +39,11 @@ THcShowerArray::THcShowerArray( const char* name, { fADCHits = new TClonesArray("THcSignalHit",100); fLayerNum = layernum; + + fClusterList = new THcShowerClusterList; } +//______________________________________________________________________________ THcShowerArray::~THcShowerArray() { // Destructor @@ -299,6 +302,7 @@ Int_t THcShowerArray::DefineVariables( EMode mode ) {"a", "Raw ADC Amplitude", "fA"}, {"p", "Dynamic ADC Pedestal", "fP"}, {"a_p", "Sparsified, ped-subtracted ADC Amplitudes", "fA_p"}, + { "nhits", "Number of hits", "fNhits" }, {"e", "Energy Depositions per block", "fE"}, {"earray", "Energy Deposition in array", "fEarray"}, { 0 } @@ -313,6 +317,15 @@ void THcShowerArray::Clear( Option_t* ) // Clears the hit lists fADCHits->Clear(); + fNhits = 0; + + for (THcShowerClusterListIt i=fClusterList->begin(); i!=fClusterList->end(); + ++i) { + delete *i; + *i = 0; + } + fClusterList->clear(); + } //_____________________________________________________________________________ @@ -327,10 +340,46 @@ Int_t THcShowerArray::Decode( const THaEvData& evdata ) Int_t THcShowerArray::CoarseProcess( TClonesArray& tracks ) { - // Nothing is done here. See ProcessHits method instead. - // + // Fill set of unclustered shower array hits. + + THcShowerHitSet HitSet; - return 0; + UInt_t k=0; + for (UInt_t i=0; i<fNRows; i++) { + for(UInt_t j=0; j < fNColumns; j++) { + + if (fA_p[k] > 0) { //hit + + THcShowerHit* hit = + new THcShowerHit(i, j, fXPos[i][j], fYPos[i][j], fE[k], 0., 0.); + + HitSet.insert(hit); + } + + k++; + } + } + + fNhits = HitSet.size(); + + //Debug output, print out hits before clustering. + + THcShower* fParent = (THcShower*) GetParent(); + + if (fParent->fdbg_clusters_cal) { + cout << "---------------------------------------------------------------\n"; + cout << "Debug output from THcShowerArray::CoarseProcess for " << GetName() + << endl; + + cout << " List of unclustered hits. Total hits: " << fNhits << endl; + THcShowerHitIt it = HitSet.begin(); //<set> version + for (Int_t i=0; i!=fNhits; i++) { + cout << " hit " << i << ": "; + (*(it++))->show(); + } + } + + return 0; } //_____________________________________________________________________________ diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index 2f6b4711ac3918e8b647cb0605abfc62e724b69f..3f39a740da9bae8753e70fdfa198d13403b09ee0 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -119,6 +119,8 @@ protected: Double_t* fE; // [fNelem] energy depositions in the blocks. Double_t fEarray; // Total Energy deposition in the array. + Int_t fNhits; // Total number of hits + THcShowerClusterList* fClusterList; // List of hit clusters virtual Int_t ReadDatabase( const TDatime& date );