10 #include <TPolyLine.h>
14 #include "StFgtClustFindMaker.h"
15 #include "StFgtSlowSimuMaker.h"
24 memset(hA,0,
sizeof(hA));
26 mRnd =
new TRandom3();
32 par_clusterMinAmpl=0.0;
33 par_stripNoiseSigma=0.0 ;
41 for(i=0;i<kFgtMxDisk;i++) {
42 mRadClustList[i].clear();
43 mPhiClustList[i].clear();
49 StFgtClustFindMaker::~StFgtClustFindMaker(){
56 StFgtClustFindMaker::saveHisto(TString fname){
57 TString outName=fname+
".hist.root";
58 TFile f( outName,
"recreate");
60 printf(
"%d histos are written to '%s' ...\n",HList->GetEntries(),outName.Data());
73 LOG_INFO<<
"::Finish() \n"<< endm;
86 LOG_INFO <<
"::Make() inpEve="<< mInpEve<<endm;
90 printf(
" INPUT: strips\n disk Rad: #strip -> #clust Phi: #strip -> #clust \n");
93 for(
int iDisk=0;iDisk<kFgtMxDisk;iDisk++) {
94 int nRCl=findClust1D(ssMk->mRadAdcList[iDisk],mRadClustList[iDisk]);
95 int nPCl=findClust1D(ssMk->mPhiAdcList[iDisk],mPhiClustList[iDisk]);
97 printf(
"disk=%d %d -->%d %d -->%d \n",iDisk+1,ssMk->mRadAdcList[iDisk].size(),nRCl,ssMk->mPhiAdcList[iDisk].size(),nPCl);
103 int nRQuad[kFgtMxQuad]; memset(nRQuad,0,
sizeof(nRQuad));
105 if(mRadClustList[iDisk].size() > 0) {
106 if(mRadClustList[iDisk][mRadClustList[iDisk].size()-1].fBin_mean >
107 geom->radStripLOCId_number() * kFgtMxQuad - 1) {
108 cout <<
"A Rad cluster deleted with fBin_mean = " <<
109 mRadClustList[iDisk][mRadClustList[iDisk].size()-1].fBin_mean << endl;
111 mRadClustList[iDisk].erase(mRadClustList[iDisk].end());
115 for(i=0; i<mRadClustList[iDisk].size(); i++) {
117 cl->position=geom->stripID2Rxy(cl->fBin_mean);
118 int iRadID=(int) cl->fBin_mean;
119 cl->iQuad=iRadID / geom->radStripLOCId_number();
120 printf(
"icl=%d rRad=%.3f totAmpl=%.1f totStrip=%d\n",i,cl->position,cl->totAmpl,cl->nbin);
122 if(cl->iQuad >= 0 && cl->iQuad < kFgtMxQuad) {
124 hA[5]->Fill(cl->peakAmpl);
125 hA[7]->Fill(cl->nbin);
126 hA[9]->Fill(cl->peakAmpl/cl->totAmpl);
129 cout <<
"ClusterFinder (Rad) error: iQuad = " << cl->iQuad << endl;
134 int nPQuad[kFgtMxQuad]; memset(nPQuad,0,
sizeof(nPQuad));
136 if(mPhiClustList[iDisk].size() > 0) {
137 if(mPhiClustList[iDisk][mPhiClustList[iDisk].size()-1].fBin_mean >
138 geom->phiStripLOCId_number() * kFgtMxQuad - 1 ) {
139 cout <<
"A Phi cluster deleted with fBin_mean = " <<
140 mPhiClustList[iDisk][mPhiClustList[iDisk].size()-1].fBin_mean << endl;
142 mPhiClustList[iDisk].erase(mPhiClustList[iDisk].end());
146 for(i=0; i<mPhiClustList[iDisk].size(); i++) {
148 cl->position=geom->stripID2PhiLab(cl->fBin_mean);
149 int iPhiID=(int) cl->fBin_mean;
150 cl->iQuad=iPhiID / geom->phiStripLOCId_number();
151 printf(
"icl=%d rPhi/deg=%.3f totAmpl=%.1f totStrip=%d\n",i,cl->position/3.1417*180.,cl->totAmpl,cl->nbin);
152 if(cl->iQuad >= 0 && cl->iQuad < kFgtMxQuad) {
155 hA[6]->Fill(cl->peakAmpl);
156 hA[8]->Fill(cl->nbin);
157 hA[10]->Fill(cl->peakAmpl/cl->totAmpl);
160 cout <<
"ClusterFinder (Phi) error: iQuad = " << cl->iQuad << endl;
165 hA[0]->Fill(20*iDisk+0,nRCl);
166 hA[0]->Fill(20*iDisk+1,nPCl);
168 for(j=0;j<kFgtMxQuad;j++) {
169 hA[1]->Fill(nRQuad[j]);
170 hA[2]->Fill(nPQuad[j]);
171 hA[3]->Fill(nRQuad[j],nPQuad[j]);
172 cout <<
"iquad nRQuad, nPQuad = " << j <<
" " << nRQuad[j]
173 <<
" " << nPQuad[j] << endl;
187 StFgtClustFindMaker::Init(){
188 LOG_INFO<<
"::Init() "<< endm;
192 LOG_INFO<<Form(
"::Init params minPeakWidth=%d, minPeakSepar=%d (# of strips), seedStripThres=%.1f a.u., clusterMinAmpl=%.1f a.u., stripNoiseSigma=%.1f a.u.",par_cl_width,par_bx_valley,par_seedStripThres,par_clusterMinAmpl,par_stripNoiseSigma)<< endm;
193 assert(par_clusterMinAmpl>=0);
194 assert(par_stripNoiseSigma>=0);
196 hA[0]=
new TH1F(
"cl_Stat1D",
"Found 1D clusters, odd=Rad, even=Phi; x=20*disk",180, -0.5,179.5);
198 hA[1]=
new TH1F(
"cl_rMul",
"Mult Rad-clusters, 1D , any disks; multiplicity/Quad/event",6,0.5,6.5);
199 hA[2]=
new TH1F(
"cl_pMul",
"Mult Phi-clusters, 1D , any disks; multiplicity/Quad/event",6,0.5,6.5);
200 hA[3]=
new TH2F(
"cl_rpMul",
"Mult per quadrant, 2x1D, any disks;Phi-Rad multiplicity/Quad/event; rad-mult",6,0.5,6.5,6,0.5,6.5);
203 hA[5]=
new TH1F(
"cl_RmxAmp",
" Rad-strips 1D clust ; Max strip Amplitude (a.u.)",100,0,1000);
204 hA[6]=
new TH1F(
"cl_PmxAmp",
" phi-strips 1D clust ; Max strip Amplitude (a.u.)",100,0,1000);
206 hA[7]=
new TH1F(
"cl_Rwid",
" Rad-strips 1D clust ;total cluster width ",10,0.5,10.5);
207 hA[8]=
new TH1F(
"cl_Pwid",
" Phi-strips 1D clust ;total cluster width ",20,0.5,20.5);
209 hA[9] =
new TH1F(
"cl_Rpf",
" Rad-strips 1D clust ; fraction of peak strip energy ",50,0.,1.);
210 hA[10]=
new TH1F(
"cl_Ppf",
" Phi-strips 1D clust ; fraction of peak strip energy ",50,0.,1.);
215 if(hA[i]) HList->Add(hA[i]);
217 return StMaker::Init();
224 StFgtClustFindMaker::findClust1D(vector<fgt_strip> &sL, vector<fgt_cluster1D> &clL) {
226 if(sL.size()<=0)
return 0;
231 int bx0=-999,bx1=bx0;
232 double sum=0, sumx=0, peakA=0;
233 for(UInt_t i=0;i<sL.size();i++) {
234 assert(sL[i].
id>=bx1);
235 if(sL[i].
id>=bx1+par_bx_valley) {
237 if(nbin>=par_cl_width && peakA>par_seedStripThres) {
238 if(par_stripNoiseSigma>0) {
241 for(k=bx0-1;k<=bx1+1;k++){
242 double rndAdc=mRnd->Gaus(0,par_stripNoiseSigma);
244 sumx+=rndAdc*(k+0.5);
249 if(sum > par_clusterMinAmpl) {
252 cl.fBin_mean=sumx/sum;
255 printf(
"add cl=%d fBin=%.3f, sum=%.1f peakA=%.1f width=%d\n",clL.size(),cl.fBin_mean,sum,peakA,nbin);
263 sumx+=sL[i].adc*(sL[i].id+0.5);
264 if(peakA<sL[i].adc) peakA=sL[i].adc;
virtual void Clear(Option_t *option="")
User defined functions.
virtual void Clear(Option_t *option="")
User defined functions.