1 #include "StFgtClusterPlotter.h"
3 #include "StRoot/StEvent/StFgtCollection.h"
4 #include "StRoot/StEvent/StFgtHitCollection.h"
5 #include "StRoot/StEvent/StFgtHit.h"
6 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
7 #include "StRoot/StEvent/StEvent.h"
8 #include "StRoot/StEvent/StEventInfo.h"
43 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
44 (*outTxtFileP) <<endl<<endl<<
" ------new event: " << eventPtr->info()->id() <<
"----------------------" <<
" running nr: " << runningEvtNr <<
"------" << endl;
45 (*outTxtFileR) <<endl<<endl<<
" ------new event: " << eventPtr->info()->id() <<
"----------------------" <<
" running nr: " << runningEvtNr <<
"------" << endl;
49 cout <<
"in plotter make " << endl;
53 for(
int iDx=0;iDx<kFgtNumDiscs;iDx++)
55 vector<float> vPhi[4];
58 vector<float> vPhiCharge[4];
59 vector<float> vRCharge[4];
63 for( StSPtrVecFgtStripIterator it=strips.getStripVec().begin();it!=strips.getStripVec().end();++it)
71 Short_t quad, disc, strip;
74 Bool_t stripDead=
false;
76 StFgtGeom::decodeGeoId((*it)->getGeoId(),disc, quad, layer, strip);
78 outTxtFile=outTxtFileR;
80 outTxtFile=outTxtFileP;
82 if(((*it)->getGeoId()-prvGeoId)>2 && prvGeoId>=0)
84 (*outTxtFile) <<endl<<endl<<endl;;
87 prvGeoId=(*it)->getGeoId();
88 switch((*it)->getClusterSeedType())
102 case kFgtClusterEndUp:
105 case kFgtClusterEndDown:
109 if(((it-1))>=strips.getStripVec().begin() && (it+1)<strips.getStripVec().end())
111 if((*(it-1))->getClusterSeedType()>kFgtDeadStrip&& (*(it+1))->getClusterSeedType()>kFgtDeadStrip)
123 if((*it)->getClusterSeedType()==kFgtDeadStrip)
127 for( Int_t timebin = 0; timebin < kFgtNumTimeBins-2; ++timebin )
130 (*outTxtFile) << setw(4) <<
" ? "<<
" ";
133 float numSig=(*it)->getAdc(timebin)/(*it)->getPedErr();
135 (*outTxtFile) << setw(4) << (*it)->getAdc(timebin)<<
" ";
137 (*outTxtFile) << setw(4) <<
" . "<<
" ";
140 (*outTxtFile) <<
" : charge: " << (*it)->getCharge()<<
" +- " << (*it)->getChargeUncert() <<
" location: "<<StFgtGeom::encodeGeoName(disc,quad,layer,strip);
141 (*outTxtFile) <<
"/"<<(*it)->getGeoId();
142 (*outTxtFile) <<
" ped: " << (*it)->getPed() <<
" +- " << (*it)->getPedErr();
143 (*outTxtFile) <<
" run evtNr " << runningEvtNr;
145 if((*it)->getClusterSeedType()==kFgtSeedType1)
147 (*outTxtFile) <<
" ---> seed w/ 3 high strips";
149 if((*it)->getClusterSeedType()==kFgtSeedType2)
150 (*outTxtFile) <<
" ---> seed w/ 2 high strips";
151 if((*it)->getClusterSeedType()==kFgtSeedType3)
152 (*outTxtFile) <<
" ---> seed w/ 1 high strip";
154 if((*it)->getClusterSeedType()==kFgtClusterSeedInSeaOfNoise)
155 (*outTxtFile) <<
" ---> seed in too much noise";
157 if((*it)->getClusterSeedType()==kFgtClusterPart)
158 (*outTxtFile) <<
" ---> Part of cluster";
159 if((*it)->getClusterSeedType()==kFgtDeadStrip)
160 (*outTxtFile) <<
" ---> Strip is marked dead";
161 if((*it)->getClusterSeedType()==kFgtClusterEndUp)
162 (*outTxtFile) <<
" ---> End of a cluster";
163 if((*it)->getClusterSeedType()==kFgtClusterEndDown)
164 (*outTxtFile) <<
" ---> Beginning of a cluster";
165 (*outTxtFile) <<endl;
168 cout <<
"trying to get clusters in disc " << iDx << endl;
173 cout <<
"got collection, looking at hits .. " <<endl;
174 const StSPtrVecFgtHit &hitVec=clusterCol->getHitVec();
175 StSPtrVecFgtHitConstIterator hitIter;
176 for(hitIter=hitVec.begin();hitIter != hitVec.end();hitIter++)
178 Int_t iq=(*hitIter)->getQuad();
179 Float_t phi=(*hitIter)->getPositionPhi();
180 Float_t r=(*hitIter)->getPositionR();
181 Int_t geoId=(*hitIter)->getCentralStripGeoId();
182 Float_t charge=(*hitIter)->charge();
183 Float_t chargeErr=(*hitIter)->getChargeUncert();
184 Int_t numStrips=(*hitIter)->getStripWeightMap().size();
186 Short_t quad, disc, strip;
189 Bool_t containsSeed=
false;
191 for(stripWeightMap_t::iterator it=(*hitIter)->getStripWeightMap().begin();it!=(*hitIter)->getStripWeightMap().end();it++)
195 if(it->first->getClusterSeedType()==kFgtSeedType1 || it->first->getClusterSeedType()==kFgtSeedType2 ||it->first->getClusterSeedType()==kFgtSeedType3)
199 charge=it->first->getCharge();
205 for(stripWeightMap_t::iterator it=(*hitIter)->getStripWeightMap().begin();it!=(*hitIter)->getStripWeightMap().end();it++)
207 StFgtGeom::decodeGeoId(it->first->getGeoId(),disc, quad, layer, strip);
208 for( Int_t timebin = 0; timebin < kFgtNumTimeBins-2; ++timebin )
210 float numSig=it->first->getAdc(timebin)/it->first->getPedErr();
221 if(it->first->getClusterSeedType()==kFgtSeedType1)
245 if((*hitIter)->getLayer()==
'R')
247 vR[iq].push_back((*hitIter)->getPositionR());
248 vRCharge[iq].push_back(charge);
252 vPhi[iq].push_back((*hitIter)->getPositionPhi());
253 vPhiCharge[iq].push_back(charge);
256 Short_t tDisc, tQuad,tStrip;
259 StFgtGeom::decodeGeoId(geoId,tDisc,tQuad,tLayer,tStrip);
262 hCChargePosSpacePhi[iDx*kFgtNumQuads+iq]->Fill(phi,charge);
263 hCChargePosSpaceR[iDx*kFgtNumQuads+iq]->Fill(r,charge);
264 hClusSizePhi[iDx*kFgtNumQuads+iq]->Fill(phi,numStrips);
265 hClusSizePhi[iDx*kFgtNumQuads+iq]->Fill(phi,numStrips);
266 hClusSizeR[iDx*kFgtNumQuads+iq]->Fill(r,numStrips);
267 hCChargeElecSpace[iDx*kFgtNumQuads+iq]->Fill(tStrip,charge);
268 hClusSizeElecSpace[iDx*kFgtNumQuads+iq]->Fill(tStrip,numStrips);
272 for(
int iQ=0;iQ<4;iQ++)
275 for(vector<float>::iterator itR=vR[iQ].begin();itR!=vR[iQ].end();itR++)
277 for(vector<float>::iterator itP=vPhi[iQ].begin();itP!=vPhi[iQ].end();itP++)
281 radioPlots[iDx]->Fill(x,y);
284 for(vector<float>::iterator itR=vRCharge[iQ].begin();itR!=vRCharge[iQ].end();itR++)
286 for(vector<float>::iterator itP=vPhiCharge[iQ].begin();itP!=vPhiCharge[iQ].end();itP++)
288 corrPlots[iDx*kFgtNumQuads+iQ]->Fill(*itR,*itP);
294 vPhiCharge[iQ].clear();
295 vRCharge[iQ].clear();
305 StFgtClusterPlotter::StFgtClusterPlotter(
const Char_t* name):runningEvtNr(0)
311 StFgtClusterPlotter::~StFgtClusterPlotter()
319 gStyle->SetPalette(1);
320 cout <<
"cluster plotter finish funciton " <<endl;
322 TCanvas* cChargePhi=
new TCanvas(
"chargePhi",
"chargePhi",850,1100);
323 TCanvas* cChargePhiBig=
new TCanvas(
"chargePhiBig",
"chargePhiBig",850,1100);
324 cChargePhi->SetLogz();
325 cChargePhi->Divide(kFgtNumDiscs,kFgtNumQuads);
326 TCanvas* cChargeR=
new TCanvas(
"chargeR",
"chargeR",850,1100);
327 TCanvas* cChargeRBig=
new TCanvas(
"chargeRBig",
"chargeRBig",850,1100);
329 cChargeR->Divide(kFgtNumDiscs,kFgtNumQuads);
330 TCanvas* cClusSizePhi=
new TCanvas(
"clusSizePhi",
"clusSizePhi",850,1100);
331 TCanvas* cClusSizePhiBig=
new TCanvas(
"clusSizePhiBig",
"clusSizePhiBig",850,1100);
332 cClusSizePhi->Divide(kFgtNumDiscs,kFgtNumQuads);
333 TCanvas* cClusSizeR=
new TCanvas(
"clusSizeR",
"clusSizeR",850,1100);
334 TCanvas* cClusSizeRBig=
new TCanvas(
"clusSizeRBig",
"clusSizeRBig",850,1100);
335 cClusSizeR->Divide(kFgtNumDiscs,kFgtNumQuads);
336 TCanvas* cChargeElecSpace=
new TCanvas(
"cChargeElecSpace",
"cChargeEledId",850,1100);
337 TCanvas* cChargeElecSpaceBig=
new TCanvas(
"cChargeElecSpaceBig",
"cChargeEledIdBig",850,1100);
338 cChargeElecSpace->SetLogz();
339 cChargeElecSpace->Divide(kFgtNumDiscs,kFgtNumQuads);
340 TCanvas* cClusSizeElecSpace=
new TCanvas(
"clusSizeElecSpace",
"clusSizeEledId",850,1100);
341 TCanvas* cClusSizeElecSpaceBig=
new TCanvas(
"clusSizeElecSpaceBig",
"clusSizeEledIdBig",850,1100);
342 cClusSizeElecSpace->Divide(kFgtNumDiscs,kFgtNumQuads);
344 TCanvas* cRadio=
new TCanvas(
"radioPlots",
"radioPlot",1000,1500);
347 TCanvas* cCorr=
new TCanvas(
"correlationPlots",
"correlationPlot",1000,1500);
348 TCanvas* cCorrBig=
new TCanvas(
"correlationPlotsBig",
"correlationPlotBig",1000,1500);
349 cCorr->Divide(kFgtNumDiscs,kFgtNumQuads);
351 for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
353 for(Int_t iQ=0;iQ<kFgtNumQuads;iQ++)
355 cout <<
"drawing disc " << iD <<
" quad " << iQ <<endl;
356 cChargePhi->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
357 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
358 cChargePhiBig->cd()->SetLogz();
359 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
360 cChargePhiBig->Print(
"cChargePhiBig.pdf");
362 cChargeR->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
363 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
365 cChargeRBig->cd()->SetLogz();
366 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
367 cChargeRBig->Print(
"cChargeRBig.pdf");
370 cClusSizePhi->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
371 hClusSizePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
373 cClusSizePhiBig->cd()->SetLogz();
374 hClusSizePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
375 cClusSizePhiBig->Print(
"cClusSizePhiBig.pdf");
377 cClusSizeR->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
378 hClusSizeR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
380 cClusSizeRBig->cd()->SetLogz();
381 hClusSizeR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
382 cClusSizeRBig->Print(
"cClusSizeRBig.pdf");
385 cChargeElecSpace->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
386 hCChargeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
388 cChargeElecSpaceBig->cd()->SetLogz();
389 hCChargeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
390 cChargeElecSpaceBig->Print(
"cChargeElecSpaceBig.pdf");
393 cClusSizeElecSpace->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
394 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
397 cClusSizeElecSpace->cd()->SetLogz();
398 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
399 cClusSizeElecSpaceBig->Print(
"cClusSizeElecCooBig.pdf");
402 cCorr->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
403 corrPlots[iD*kFgtNumQuads+iQ]->Draw(
"colz");
405 cCorrBig->cd()->SetLogz();
406 corrPlots[iD*kFgtNumQuads+iQ]->Draw(
"colz");
407 cCorrBig->Print(
"r_phi_correlationsBig.pdf");
410 cRadio->cd(iD+1)->SetLogz();
411 radioPlots[iD]->Draw(
"colz");
415 cout <<
"saving .." <<endl;
416 cChargePhi->SaveAs(
"cChargePhi.pdf");
417 cChargePhi->SaveAs(
"cChargePhi.png");
419 cChargeR->SaveAs(
"cChargeR.pdf");
420 cChargeR->SaveAs(
"cChargeR.png");
422 cClusSizePhi->SaveAs(
"cClusSizePhi.pdf");
423 cClusSizePhi->SaveAs(
"cClusSizePhi.png");
425 cClusSizeR->SaveAs(
"cClusSizeR.pdf");
426 cClusSizeR->SaveAs(
"cClusSizeR.png");
429 cChargeElecSpace->SaveAs(
"cClusSizeElecSpace.pdf");
430 cChargeElecSpace->SaveAs(
"cClusSizeElecSpace.png");
432 cClusSizeElecSpace->SaveAs(
"cClusSizeElecSpace.pdf");
433 cClusSizeElecSpace->SaveAs(
"cClusSizeElecSpace.png");
435 cRadio->SaveAs(
"radioPlots.png");
436 cRadio->SaveAs(
"radioPlots.pdf");
438 cCorr->SaveAs(
"corrPlots.png");
439 cCorr->SaveAs(
"corrPlots.pdf");
454 myRootFile=
new TFile(
"clusterPlotter.root",
"RECREATE");
458 outTxtFileP=
new ofstream;
459 outTxtFileP->open(
"clustersP.txt");
460 outTxtFileR=
new ofstream;
461 outTxtFileR->open(
"clustersR.txt");
465 hClusterCharge=
new TH1D(
"clusterCharge",
"clusterCharge",100, 0, 1000);
467 hCChargePosSpacePhi=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
468 hCChargePosSpaceR=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
469 hClusSizePhi=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
470 hClusSizeR=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
471 hCChargeElecSpace=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
472 hClusSizeElecSpace=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
474 radioPlots=
new TH2D*[kFgtNumDiscs];
475 corrPlots=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
478 for(
int iD=0;iD<kFgtNumDiscs;iD++)
480 for(
int iQ=0;iQ<kFgtNumQuads;iQ++)
482 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_phi",iD,iQ);
483 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,200,-4,4, 200, 0, 2000);
484 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_R",iD,iQ);
485 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,200,10,35, 200, 0, 2000);
486 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_phi",iD,iQ);
487 hClusSizePhi[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,1000,-4,4, 20, 0, 20);
488 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_R",iD,iQ);
489 hClusSizeR[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,1000,10,35, 20, 0, 20);
490 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_ElecSpace",iD,iQ);
491 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,1000, 20, 0, 20);
492 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_ElecSpace",iD,iQ);
493 hCChargeElecSpace[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,1000, 100, 0, 2000);
494 sprintf(buffer,
"radioDisk%d_Quad_%d",iD,iQ);
495 radioPlots[iD]=
new TH2D(buffer,buffer,100,-50,50,100,-50,50);
496 sprintf(buffer,
"r_phi_ChargeCorr%d_Quad_%d",iD,iQ);
497 corrPlots[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,2000,100,0,2000);