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"
14 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
16 #include "StRoot/StEvent/StEvent.h"
17 #include "StRoot/StEvent/StFgtCollection.h"
46 cout <<
" making cluster plotter " <<endl;
49 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
52 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
56 mFgtCollectionPtr = 0;
59 mFgtCollectionPtr=eventPtr->fgtCollection();
62 if( !mFgtCollectionPtr) {
63 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
70 realEvtNr=eventPtr->info()->id();
73 (*outTxtFileP) <<endl<<endl<<
" ------new event: " << realEvtNr <<
"----------------------" <<
" running nr: " << runningEvtNr <<
"------" << endl;
74 (*outTxtFileR) <<endl<<endl<<
" ------new event: " << realEvtNr <<
"----------------------" <<
" running nr: " << runningEvtNr <<
"------" << endl;
76 cout <<
"in plotter make " << endl;
80 for(
int iDx=0;iDx<kFgtNumDiscs;iDx++)
82 vector<float> vPhi[4];
85 vector<float> vPhiCharge[4];
86 vector<float> vRCharge[4];
90 for( StSPtrVecFgtStripIterator it=strips.getStripVec().begin();it!=strips.getStripVec().end();++it)
98 Short_t quad, disc, strip;
101 Bool_t stripDead=
false;
103 StFgtGeom::decodeGeoId((*it)->getGeoId(),disc, quad, layer, strip);
105 outTxtFile=outTxtFileR;
107 outTxtFile=outTxtFileP;
109 if(((*it)->getGeoId()-prvGeoId)>2 && prvGeoId>=0)
111 (*outTxtFile) <<endl<<endl<<endl;;
114 prvGeoId=(*it)->getGeoId();
115 switch((*it)->getClusterSeedType())
126 case kFgtClusterPart:
129 case kFgtClusterEndUp:
132 case kFgtClusterEndDown:
136 if(((it-1))>=strips.getStripVec().begin() && (it+1)<strips.getStripVec().end())
138 if((*(it-1))->getClusterSeedType()>kFgtDeadStrip&& (*(it+1))->getClusterSeedType()>kFgtDeadStrip)
150 if((*it)->getClusterSeedType()==kFgtDeadStrip)
154 for( Int_t timebin = 0; timebin < kFgtNumTimeBins-2; ++timebin )
157 (*outTxtFile) << setw(4) <<
" ? "<<
" ";
160 float numSig=(*it)->getAdc(timebin)/(*it)->getPedErr();
162 (*outTxtFile) << setw(4) << (*it)->getAdc(timebin)<<
" ";
164 (*outTxtFile) << setw(4) <<
" . "<<
" ";
167 (*outTxtFile) <<
" : charge: " << (*it)->getCharge()<<
" +- " << (*it)->getChargeUncert() <<
" location: "<<StFgtGeom::encodeGeoName(disc,quad,layer,strip);
168 (*outTxtFile) <<
"/"<<(*it)->getGeoId();
169 (*outTxtFile) <<
" ped: " << (*it)->getPed() <<
" +- " << (*it)->getPedErr();
170 (*outTxtFile) <<
" run evtNr " << runningEvtNr;
172 if((*it)->getClusterSeedType()==kFgtSeedType1)
174 (*outTxtFile) <<
" ---> seed w/ 3 high strips";
176 if((*it)->getClusterSeedType()==kFgtSeedType2)
177 (*outTxtFile) <<
" ---> seed w/ 2 high strips";
178 if((*it)->getClusterSeedType()==kFgtSeedType3)
179 (*outTxtFile) <<
" ---> seed w/ 1 high strip";
181 if((*it)->getClusterSeedType()==kFgtClusterSeedInSeaOfNoise)
182 (*outTxtFile) <<
" ---> seed in too much noise";
184 if((*it)->getClusterSeedType()==kFgtClusterPart)
185 (*outTxtFile) <<
" ---> Part of cluster";
186 if((*it)->getClusterSeedType()==kFgtDeadStrip)
187 (*outTxtFile) <<
" ---> Strip is marked dead";
188 if((*it)->getClusterSeedType()==kFgtClusterEndUp)
189 (*outTxtFile) <<
" ---> End of a cluster";
190 if((*it)->getClusterSeedType()==kFgtClusterEndDown)
191 (*outTxtFile) <<
" ---> Beginning of a cluster";
192 (*outTxtFile) <<endl;
195 cout <<
"trying to get clusters in disc " << iDx << endl;
201 const StSPtrVecFgtHit &hitVec=clusterCol->getHitVec();
202 cout <<
"got collection, looking at " << hitVec.size() <<
" hits .. " <<endl;
203 StSPtrVecFgtHitConstIterator hitIter;
204 for(hitIter=hitVec.begin();hitIter != hitVec.end();hitIter++)
206 Int_t iq=(*hitIter)->getQuad();
207 Float_t phi=(*hitIter)->getPositionPhi();
208 Float_t r=(*hitIter)->getPositionR();
209 Int_t geoId=(*hitIter)->getCentralStripGeoId();
210 Float_t charge=(*hitIter)->charge();
211 Float_t chargeErr=(*hitIter)->getChargeUncert();
212 Int_t numStrips=(*hitIter)->getStripWeightMap().size();
214 Short_t quad, disc, strip;
217 Bool_t containsSeed=
false;
219 for(stripWeightMap_t::iterator it=(*hitIter)->getStripWeightMap().begin();it!=(*hitIter)->getStripWeightMap().end();it++)
223 if(it->first->getClusterSeedType()==kFgtSeedType1 || it->first->getClusterSeedType()==kFgtSeedType2 ||it->first->getClusterSeedType()==kFgtSeedType3)
227 charge=it->first->getCharge();
233 for(stripWeightMap_t::iterator it=(*hitIter)->getStripWeightMap().begin();it!=(*hitIter)->getStripWeightMap().end();it++)
235 StFgtGeom::decodeGeoId(it->first->getGeoId(),disc, quad, layer, strip);
236 for( Int_t timebin = 0; timebin < kFgtNumTimeBins-2; ++timebin )
238 float numSig=it->first->getAdc(timebin)/it->first->getPedErr();
249 if(it->first->getClusterSeedType()==kFgtSeedType1)
273 if((*hitIter)->getLayer()==
'R')
275 vR[iq].push_back((*hitIter)->getPositionR());
276 vRCharge[iq].push_back(charge);
280 vPhi[iq].push_back((*hitIter)->getPositionPhi());
281 vPhiCharge[iq].push_back(charge);
284 Short_t tDisc, tQuad,tStrip;
287 StFgtGeom::decodeGeoId(geoId,tDisc,tQuad,tLayer,tStrip);
290 hCChargePosSpacePhi[iDx*kFgtNumQuads+iq]->Fill(phi,charge);
291 hCChargePosSpaceR[iDx*kFgtNumQuads+iq]->Fill(r,charge);
292 hClusSizePhi[iDx*kFgtNumQuads+iq]->Fill(phi,numStrips);
293 hClusSizePhi[iDx*kFgtNumQuads+iq]->Fill(phi,numStrips);
294 hClusSizeR[iDx*kFgtNumQuads+iq]->Fill(r,numStrips);
295 hCChargeElecSpace[iDx*kFgtNumQuads+iq]->Fill(tStrip,charge);
296 hClusSizeElecSpace[iDx*kFgtNumQuads+iq]->Fill(tStrip,numStrips);
300 for(
int iQ=0;iQ<4;iQ++)
303 for(vector<float>::iterator itR=vR[iQ].begin();itR!=vR[iQ].end();itR++)
305 for(vector<float>::iterator itP=vPhi[iQ].begin();itP!=vPhi[iQ].end();itP++)
309 radioPlots[iDx]->Fill(x,y);
312 for(vector<float>::iterator itR=vRCharge[iQ].begin();itR!=vRCharge[iQ].end();itR++)
314 for(vector<float>::iterator itP=vPhiCharge[iQ].begin();itP!=vPhiCharge[iQ].end();itP++)
316 corrPlots[iDx*kFgtNumQuads+iQ]->Fill(*itR,*itP);
322 vPhiCharge[iQ].clear();
323 vRCharge[iQ].clear();
333 StFgtClusterPlotter::StFgtClusterPlotter(
const Char_t* name):
StMaker( name ),runningEvtNr(0)
339 StFgtClusterPlotter::~StFgtClusterPlotter()
347 gStyle->SetPalette(1);
348 cout <<
"cluster plotter finish funciton " <<endl;
350 TCanvas* cChargePhi=
new TCanvas(
"chargePhi",
"chargePhi",850,1100);
351 TCanvas* cChargePhiBig=
new TCanvas(
"chargePhiBig",
"chargePhiBig",850,1100);
352 cChargePhi->SetLogz();
353 cChargePhi->Divide(kFgtNumDiscs,kFgtNumQuads);
354 TCanvas* cChargeR=
new TCanvas(
"chargeR",
"chargeR",850,1100);
355 TCanvas* cChargeRBig=
new TCanvas(
"chargeRBig",
"chargeRBig",850,1100);
357 cChargeR->Divide(kFgtNumDiscs,kFgtNumQuads);
358 TCanvas* cClusSizePhi=
new TCanvas(
"clusSizePhi",
"clusSizePhi",850,1100);
359 TCanvas* cClusSizePhiBig=
new TCanvas(
"clusSizePhiBig",
"clusSizePhiBig",850,1100);
360 cClusSizePhi->Divide(kFgtNumDiscs,kFgtNumQuads);
361 TCanvas* cClusSizeR=
new TCanvas(
"clusSizeR",
"clusSizeR",850,1100);
362 TCanvas* cClusSizeRBig=
new TCanvas(
"clusSizeRBig",
"clusSizeRBig",850,1100);
363 cClusSizeR->Divide(kFgtNumDiscs,kFgtNumQuads);
364 TCanvas* cChargeElecSpace=
new TCanvas(
"cChargeElecSpace",
"cChargeEledId",850,1100);
365 TCanvas* cChargeElecSpaceBig=
new TCanvas(
"cChargeElecSpaceBig",
"cChargeEledIdBig",850,1100);
366 cChargeElecSpace->SetLogz();
367 cChargeElecSpace->Divide(kFgtNumDiscs,kFgtNumQuads);
368 TCanvas* cClusSizeElecSpace=
new TCanvas(
"clusSizeElecSpace",
"clusSizeEledId",850,1100);
369 TCanvas* cClusSizeElecSpaceBig=
new TCanvas(
"clusSizeElecSpaceBig",
"clusSizeEledIdBig",850,1100);
370 cClusSizeElecSpace->Divide(kFgtNumDiscs,kFgtNumQuads);
372 TCanvas* cRadio=
new TCanvas(
"radioPlots",
"radioPlot",1000,1500);
375 TCanvas* cCorr=
new TCanvas(
"correlationPlots",
"correlationPlot",1000,1500);
376 TCanvas* cCorrBig=
new TCanvas(
"correlationPlotsBig",
"correlationPlotBig",1000,1500);
377 cCorr->Divide(kFgtNumDiscs,kFgtNumQuads);
379 for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
381 for(Int_t iQ=0;iQ<kFgtNumQuads;iQ++)
383 cout <<
"drawing disc " << iD <<
" quad " << iQ <<endl;
384 cChargePhi->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
385 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
386 cChargePhiBig->cd()->SetLogz();
387 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
388 cChargePhiBig->Print(
"cChargePhiBig.pdf");
390 cChargeR->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
391 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
393 cChargeRBig->cd()->SetLogz();
394 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
395 cChargeRBig->Print(
"cChargeRBig.pdf");
398 cClusSizePhi->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
399 hClusSizePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
401 cClusSizePhiBig->cd()->SetLogz();
402 hClusSizePhi[iD*kFgtNumQuads+iQ]->Draw(
"colz");
403 cClusSizePhiBig->Print(
"cClusSizePhiBig.pdf");
405 cClusSizeR->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
406 hClusSizeR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
408 cClusSizeRBig->cd()->SetLogz();
409 hClusSizeR[iD*kFgtNumQuads+iQ]->Draw(
"colz");
410 cClusSizeRBig->Print(
"cClusSizeRBig.pdf");
413 cChargeElecSpace->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
414 hCChargeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
416 cChargeElecSpaceBig->cd()->SetLogz();
417 hCChargeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
418 cChargeElecSpaceBig->Print(
"cChargeElecSpaceBig.pdf");
421 cClusSizeElecSpace->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
422 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
425 cClusSizeElecSpace->cd()->SetLogz();
426 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]->Draw(
"colz");
427 cClusSizeElecSpaceBig->Print(
"cClusSizeElecCooBig.pdf");
430 cCorr->cd(iD*kFgtNumQuads+iQ+1)->SetLogz();
431 corrPlots[iD*kFgtNumQuads+iQ]->Draw(
"colz");
433 cCorrBig->cd()->SetLogz();
434 corrPlots[iD*kFgtNumQuads+iQ]->Draw(
"colz");
435 cCorrBig->Print(
"r_phi_correlationsBig.pdf");
438 cRadio->cd(iD+1)->SetLogz();
439 radioPlots[iD]->Draw(
"colz");
443 cout <<
"saving .." <<endl;
444 cChargePhi->SaveAs(
"cChargePhi.pdf");
445 cChargePhi->SaveAs(
"cChargePhi.png");
447 cChargeR->SaveAs(
"cChargeR.pdf");
448 cChargeR->SaveAs(
"cChargeR.png");
450 cClusSizePhi->SaveAs(
"cClusSizePhi.pdf");
451 cClusSizePhi->SaveAs(
"cClusSizePhi.png");
453 cClusSizeR->SaveAs(
"cClusSizeR.pdf");
454 cClusSizeR->SaveAs(
"cClusSizeR.png");
457 cChargeElecSpace->SaveAs(
"cClusSizeElecSpace.pdf");
458 cChargeElecSpace->SaveAs(
"cClusSizeElecSpace.png");
460 cClusSizeElecSpace->SaveAs(
"cClusSizeElecSpace.pdf");
461 cClusSizeElecSpace->SaveAs(
"cClusSizeElecSpace.png");
463 cRadio->SaveAs(
"radioPlots.png");
464 cRadio->SaveAs(
"radioPlots.pdf");
466 cCorr->SaveAs(
"corrPlots.png");
467 cCorr->SaveAs(
"corrPlots.pdf");
482 myRootFile=
new TFile(
"clusterPlotter.root",
"RECREATE");
486 outTxtFileP=
new ofstream;
487 outTxtFileP->open(
"clustersP.txt");
488 outTxtFileR=
new ofstream;
489 outTxtFileR->open(
"clustersR.txt");
493 hClusterCharge=
new TH1D(
"clusterCharge",
"clusterCharge",100, 0, 1000);
495 hCChargePosSpacePhi=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
496 hCChargePosSpaceR=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
497 hClusSizePhi=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
498 hClusSizeR=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
499 hCChargeElecSpace=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
500 hClusSizeElecSpace=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
502 radioPlots=
new TH2D*[kFgtNumDiscs];
503 corrPlots=
new TH2D*[kFgtNumDiscs*kFgtNumQuads];
505 trkRadioPlots=
new TH2D*[kFgtNumDiscs];
506 trkPhiProj=
new TH1D*[kFgtNumDiscs];
510 for(
int iD=0;iD<kFgtNumDiscs;iD++)
512 sprintf(buffer,
"radioDisk%d_",iD);
513 radioPlots[iD]=
new TH2D(buffer,buffer,100,-50,50,100,-50,50);
514 sprintf(buffer,
"trkRadioDisk%d_",iD);
515 trkRadioPlots[iD]=
new TH2D(buffer,buffer,100,-50,50,100,-50,50);
516 sprintf(buffer,
"trkPhiDisk%d_",iD);
517 trkPhiProj[iD]=
new TH1D(buffer,buffer,100,-3.5,3.5);
519 for(
int iQ=0;iQ<kFgtNumQuads;iQ++)
521 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_phi",iD,iQ);
522 hCChargePosSpacePhi[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,200,-4,4, 200, 0, 2000);
523 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_R",iD,iQ);
524 hCChargePosSpaceR[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,200,10,35, 200, 0, 2000);
525 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_phi",iD,iQ);
526 hClusSizePhi[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,1000,-4,4, 20, 0, 20);
527 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_R",iD,iQ);
528 hClusSizeR[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,1000,10,35, 20, 0, 20);
529 sprintf(buffer,
"clusterSizeDisk%d_Quad%d_ElecSpace",iD,iQ);
530 hClusSizeElecSpace[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,1000, 20, 0, 20);
531 sprintf(buffer,
"clusterChargeDisk%d_Quad%d_ElecSpace",iD,iQ);
532 hCChargeElecSpace[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,1000, 100, 0, 2000);
533 sprintf(buffer,
"radioDisk%d_Quad_%d",iD,iQ);
535 sprintf(buffer,
"r_phi_ChargeCorr%d_Quad_%d",iD,iQ);
536 corrPlots[iD*kFgtNumQuads+iQ]=
new TH2D(buffer,buffer,100,0,2000,100,0,2000);