diff --git a/src/THcShower.cxx b/src/THcShower.cxx index 051d1df172545ff6f43f68912b4b368c0abc49fe..e30987ab71242ea474de30bd8cf26608f871374f 100644 --- a/src/THcShower.cxx +++ b/src/THcShower.cxx @@ -103,7 +103,8 @@ void THcShower::Setup(const char* name, const char* description) strcat(desc, " Array "); strcat(desc, fLayerNames[fNTotLayers-1]); - fArray = new THcShowerArray(fLayerNames[fNTotLayers-1], desc, fNTotLayers, this); + fArray = new THcShowerArray(fLayerNames[fNTotLayers-1], desc, fNTotLayers, + this); } else { fArray = 0; } @@ -335,15 +336,15 @@ Int_t THcShower::ReadDatabase( const TDatime& date ) cout << " Ymin = " << fvYmin << " Ymax = " << fvYmax << endl; } - //Calibration related parameters (from hcal.param). + //Calibration related parameters (from h(s)cal.param). fNTotBlocks=0; //total number of blocks in the layers for (UInt_t i=0; i<fNLayers; i++) fNTotBlocks += fNBlocks[i]; // Debug output. if (fdbg_init_cal) - cout << " Total number of blocks in the layers of calorimeter: " << dec << fNTotBlocks - << endl; + cout << " Total number of blocks in the layers of calorimeter: " << dec + << fNTotBlocks << endl; //Pedestal limits from hcal.param. fShPosPedLimit = new Int_t [fNTotBlocks]; @@ -619,7 +620,7 @@ Int_t THcShower::Decode( const THaEvData& evdata ) } if(fHasArray) { nexthit = fArray->ProcessHits(fRawHitList, nexthit); - fEtot += fArray->GetEplane(); + fEtot += fArray->GetEarray(); } THcHallCSpectrometer *app = static_cast<THcHallCSpectrometer*>(GetApparatus()); fEtotNorm=fEtot/(app->GetPcentral()); @@ -641,8 +642,6 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) // Fill set of unclustered hits. - // Ignore shower array (SHMS) for now - THcShowerHitSet HitSet; for(UInt_t j=0; j < fNLayers; j++) { @@ -731,6 +730,8 @@ Int_t THcShower::CoarseProcess( TClonesArray& tracks) cout << "---------------------------------------------------------------\n"; } + // Do same for Array. + if(fHasArray) fArray->CoarseProcess(tracks); return 0; @@ -814,13 +815,13 @@ Double_t addEneg(Double_t x, THcShowerHit* h) { } // X coordinate of center of gravity of cluster, calculated as hit energy -// weighted average. Put X out of the calorimeter (-75 cm), if there is no +// weighted average. Put X out of the calorimeter (-100 cm), if there is no // energy deposition in the cluster. // Double_t clX(THcShowerCluster* cluster) { Double_t Etot = accumulate((*cluster).begin(),(*cluster).end(),0.,addE); return (Etot != 0. ? - accumulate((*cluster).begin(),(*cluster).end(),0.,addX)/Etot : -75.); + accumulate((*cluster).begin(),(*cluster).end(),0.,addX)/Etot : -100.); } // Z coordinate of center of gravity of cluster, calculated as a hit energy diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 29e3f482c9e4a65fa57ad3580cadb80aea4b66c5..d787b81955416720ff9fb9600e0c44464e67aa68 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -40,7 +40,7 @@ THcShowerArray::THcShowerArray( const char* name, fADCHits = new TClonesArray("THcSignalHit",100); fLayerNum = layernum; - fClusterList = new THcShowerClusterList; + fClusterList = new THcShowerClusterList; // List of hit clusters } //______________________________________________________________________________ @@ -282,9 +282,6 @@ Int_t THcShowerArray::ReadDatabase( const TDatime& date ) cout << " fMinPeds = " << fMinPeds << endl; - // cout << " Origin of Layer at X = " << fOrigin.X() - // << " Y = " << fOrigin.Y() << " Z = " << fOrigin.Z() << endl; - cout << "---------------------------------------------------------------\n"; } @@ -348,8 +345,12 @@ Int_t THcShowerArray::CoarseProcess( TClonesArray& tracks ) { // Fill set of unclustered shower array hits. + // Reuse hit class pertained to the HMS/SOS type calorimeters. + // Save Y coordinate of the hit in Z parameter of the class. + // Save energy deposition in the module as hit mean energy, do not use + // positive and negative side energies. - THcShowerHitSet HitSet; + THcShowerHitSet HitSet; //set of hits UInt_t k=0; for (UInt_t i=0; i<fNRows; i++) { @@ -386,11 +387,13 @@ Int_t THcShowerArray::CoarseProcess( TClonesArray& tracks ) } } - // Fill list of clusters. + // Cluster hits and fill list of clusters. fParent->ClusterHits(HitSet, fClusterList); - fNclust = (*fClusterList).size(); //number of clusters + fNclust = (*fClusterList).size(); //number of clusters + + //Debug output, print out clustered hits. if (fParent->fdbg_clusters_cal) { @@ -475,7 +478,7 @@ Int_t THcShowerArray::MatchCluster(THaTrack* Track, } - // Match a cluster to the track. + // Match a cluster to the track. Choose closest to the track cluster. Int_t mclust = -1; // The match cluster #, initialize with a bogus value. Double_t Delta = kBig; // Track to cluster distance @@ -485,13 +488,18 @@ Int_t THcShowerArray::MatchCluster(THaTrack* Track, // Since hits and clusters are in reverse order (with respect to Engine), // search backwards to be consistent with Engine. // + // Note: cluster Z coordinate is used here as Y, for Z variable + // of the THcShowerHit class was used to save Y coordinates of hits. + for (Int_t i=fNclust-1; i>-1; i--) { THcShowerCluster* cluster = *(fClusterList->begin()+i); Double_t dx = TMath::Abs( clX(cluster) - XTrFront ); - Double_t dy = TMath::Abs( clZ(cluster) - YTrFront ); - Double_t distance = TMath::Sqrt(dx*dx+dy*dy); + Double_t dy = TMath::Abs( clZ(cluster) - YTrFront ); //cluster Z for Y. + Double_t distance = TMath::Sqrt(dx*dx+dy*dy); //cluster-track dist. + + //Choice of threshold on distance is not unuque. Use the simplest for now. if (distance <= (0.5*(fXStep + fYStep) + fParent->fSlop)) { fNtracks++; @@ -774,7 +782,6 @@ Int_t THcShowerArray::AccumulatePedestals(TClonesArray* rawhits, Int_t nexthit) : hit->GetData(0); - if(adc <= fPedLimit[element]) { fPedSum[element] += adc; fPedSum2[element] += adc*adc; diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index 6f1b4c032efc35c51e51ce33ccff28a6c5a2652a..0b9f81c1431eb39f93cd5f502c0885255d9f6c34 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -59,11 +59,10 @@ public: // Double_t fSpacing; not used - TClonesArray* fParentHitList; + // TClonesArray* fParentHitList; not used - // Return zero for now - Double_t GetEplane() { - return 0.0; + Double_t GetEarray() { + return fEarray; }; // Fiducial volume limits. @@ -126,13 +125,13 @@ protected: //Energy depositions. - Double_t* fE; // [fNelem] energy depositions in the blocks. - Double_t fEarray; // Total Energy deposition in the array. + 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 -Int_t fNclust; // Number of clusters + Int_t fNclust; // Number of hit clusters Int_t fNtracks; // Number of shower tracks, i.e. number of - // cluster-to-track association + // cluster-to-track associations THcShowerClusterList* fClusterList; // List of hit clusters @@ -140,4 +139,5 @@ Int_t fNclust; // Number of clusters virtual Int_t DefineVariables( EMode mode = kDefine ); ClassDef(THcShowerArray,0); // Fly;s Eye calorimeter array }; + #endif diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 313c3cf04ada1630e4161fc9042be6e49ec20e20..a5540fcfbf98c05f3e6250d613f6e865da0c39bb 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -44,7 +44,7 @@ public: // Double_t fSpacing; not used - TClonesArray* fParentHitList; + // TClonesArray* fParentHitList; not used TVector3 GetOrigin() { return fOrigin;