1 #include "StFgtAVEfficiencyMaker.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"
9 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
20 #include "StRoot/StFgtUtil/geometry/StFgtGeom.h"
22 #include "StRoot/StEvent/StEvent.h"
23 #include "StRoot/StEvent/StFgtCollection.h"
29 Double_t getRPhiRatio(StSPtrVecFgtHitConstIterator hitIterBegin, StSPtrVecFgtHitConstIterator hitIterEnd)
31 Short_t quad, disc, strip;
36 StSPtrVecFgtHitConstIterator hitIter=hitIterBegin;
37 for(;hitIter!=hitIterEnd;hitIter++)
39 StFgtGeom::decodeGeoId((*hitIter)->getCentralStripGeoId(),disc, quad, layer, strip);
47 return (numR-numPhi)/((Double_t)(numR+numPhi));
60 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
63 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
67 mFgtCollectionPtr = 0;
70 mFgtCollectionPtr=eventPtr->fgtCollection();
73 if( !mFgtCollectionPtr) {
74 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
90 Double_t ratio=getRPhiRatio(tmpClusterCol->getHitVec().begin(),tmpClusterCol->getHitVec().end());
91 rPhiRatioPlots[i]->Fill(ratio);
95 const StSPtrVecFgtHit &hitVecD1=clusterColD1->getHitVec();
96 const StSPtrVecFgtHit &hitVecD6=clusterColD6->getHitVec();
99 set<Int_t> usedPoints;
100 Double_t D1Pos=StFgtGeom::getDiscZ(0);
101 Double_t D6Pos=StFgtGeom::getDiscZ(5);
102 Double_t zArm=D6Pos-D1Pos;
103 StSPtrVecFgtHitConstIterator hitIterD1,hitIterD6, hitIterD1R, hitIterD6R, hitIter, hitIter2;
105 for(hitIterD1=hitVecD1.begin();hitIterD1 != hitVecD1.end();hitIterD1++)
107 Short_t quad, disc, strip;
109 StFgtGeom::decodeGeoId((*hitIterD1)->getCentralStripGeoId(),disc, quad, layer, strip);
116 for(hitIterD1=hitVecD6.begin();hitIterD1 != hitVecD6.end();hitIterD1++)
118 Short_t quad, disc, strip;
120 StFgtGeom::decodeGeoId((*hitIterD1)->getCentralStripGeoId(),disc, quad, layer, strip);
128 for(
int iSeed1=0;iSeed1<5;iSeed1++)
130 for(
int iSeed2=iSeed1+1;iSeed2<6;iSeed2++)
134 const StSPtrVecFgtHit &hitVecSeed1=clusterColSeed1->getHitVec();
135 const StSPtrVecFgtHit &hitVecSeed2=clusterColSeed2->getHitVec();
136 D1Pos=StFgtGeom::getDiscZ(iSeed1);
137 D6Pos=StFgtGeom::getDiscZ(iSeed2);
142 for(hitIterD1=hitVecSeed1.begin();hitIterD1 != hitVecSeed1.end();hitIterD1++)
144 Short_t quad, disc, strip;
146 StFgtGeom::decodeGeoId((*hitIterD1)->getCentralStripGeoId(),disc, quad, layer, strip);
152 Int_t geoIdD1=(*hitIterD1)->getCentralStripGeoId();
153 StFgtGeom::decodeGeoId(geoIdD1,disc, quad, layer, strip);
157 Float_t phiD1=(*hitIterD1)->getPositionPhi();
158 for(hitIterD1R=hitVecSeed1.begin();hitIterD1R != hitVecSeed1.end();hitIterD1R++)
160 Int_t geoIdR=(*hitIterD1R)->getCentralStripGeoId();
161 StFgtGeom::decodeGeoId(geoIdR,disc, quad, layer, strip);
165 Float_t rD1=(*hitIterD1R)->getPositionR();
166 Float_t xD1=rD1*cos(phiD1);
167 Float_t yD1=rD1*sin(phiD1);
168 for(hitIterD6=hitVecSeed2.begin();hitIterD6 != hitVecSeed2.end();hitIterD6++)
170 Int_t geoIdD6=(*hitIterD6)->getCentralStripGeoId();
171 StFgtGeom::decodeGeoId(geoIdD6,disc, quad, layer, strip);
174 Float_t phiD6=(*hitIterD6)->getPositionPhi();
175 for(hitIterD6R=hitVecSeed2.begin();hitIterD6R != hitVecSeed2.end();hitIterD6R++)
177 Int_t geoIdR=(*hitIterD6R)->getCentralStripGeoId();
178 StFgtGeom::decodeGeoId(geoIdR,disc, quad, layer, strip);
182 Float_t rD6=(*hitIterD6R)->getPositionR();
183 Double_t xD6=rD6*cos(phiD6);
184 Double_t yD6=rD6*sin(phiD6);
187 vector< pair<Int_t,Double_t> > v_x;
188 vector< pair<Int_t,Double_t> > v_y;
189 vector< pair<Int_t,Double_t> > v_r;
191 vector< pair<Int_t,Double_t> > v_xFail;
192 vector< pair<Int_t,Double_t> > v_yFail;
193 vector< pair<Int_t,Double_t> > v_rFail;
195 vector< pair< Int_t, Double_t> > v_rCharge;
196 vector< pair< Int_t, Double_t> > v_phiCharge;
198 vector<Int_t> v_clusterSizeR;
199 vector<Int_t> v_clusterSizePhi;
201 vector<Int_t> v_geoIDsR;
202 vector<Int_t> v_geoIDsPhi;
208 Double_t xIpExp=xD1+(xD6-xD1)*(-D1Pos)/zArm;
209 Double_t yIpExp=yD1+(yD6-yD1)*(-D1Pos)/zArm;
211 Double_t zIpExpX0=(D6Pos-(xD6/xD1)*D1Pos)*1/(1-xD6/xD1);
213 Double_t zIpExpY0=(D6Pos-yD6/yD1*D1Pos)*1/(1-yD6/yD1);
216 for(
int iD=0;iD<6;iD++)
218 if(iD==iSeed1 || iD==iSeed2)
224 Double_t diskZ=StFgtGeom::getDiscZ(iD);
227 Double_t xPosExp=xD1+(xD6-xD1)*(diskZ-D1Pos)/zArm;
228 Double_t yPosExp=yD1+(yD6-yD1)*(diskZ-D1Pos)/zArm;
229 Double_t rPosExp=rD1+(rD6-rD1)*(diskZ-D1Pos)/zArm;
237 const StSPtrVecFgtHit &hitVec=clusterCol->getHitVec();
239 for(hitIter=hitVec.begin();hitIter!=hitVec.end();hitIter++)
242 Int_t geoIdPhi=(*hitIter)->getCentralStripGeoId();
243 StFgtGeom::decodeGeoId(geoIdPhi,disc, quad, layer, strip);
244 if(usedPoints.find(geoIdPhi)!=usedPoints.end())
248 Float_t phi=(*hitIter)->getPositionPhi();
249 Double_t phiCharge=(*hitIter)->charge();
250 Int_t clusterSizePhi=(*hitIter)->getStripWeightMap().size();
251 for(hitIter2=hitVec.begin();hitIter2!=hitVec.end();hitIter2++)
253 Int_t geoIdR=(*hitIter2)->getCentralStripGeoId();
254 StFgtGeom::decodeGeoId(geoIdR,disc, quad, layer, strip);
255 if(usedPoints.find(geoIdR)!=usedPoints.end())
259 Float_t r=(*hitIter2)->getPositionR();
260 Double_t rCharge=(*hitIter2)->charge();
261 Int_t clusterSizeR=(*hitIter2)->getStripWeightMap().size();
263 if(fabs(r-rPosExp)<0.5)
267 v_r.push_back(pair<Int_t,Double_t> (iD,r));
273 if(fabs(x-xPosExp) < 0.5 && fabs(y-yPosExp)<0.5)
277 v_x.push_back(pair<Int_t,Double_t>(iD,x));
278 v_y.push_back(pair<Int_t,Double_t>(iD,y));
279 v_rCharge.push_back(pair<Int_t, Double_t>(iD,rCharge));
280 v_phiCharge.push_back(pair<Int_t, Double_t>(iD,phiCharge));
282 v_geoIDsPhi.push_back(geoIdPhi);
283 v_geoIDsR.push_back(geoIdR);
285 v_clusterSizeR.push_back(clusterSizeR);
286 v_clusterSizePhi.push_back(clusterSizePhi);
296 v_xFail.push_back(pair<Int_t,Double_t>(iD,xPosExp));
297 v_yFail.push_back(pair<Int_t,Double_t>(iD,yPosExp));
304 v_rFail.push_back(pair<Int_t, Double_t>(iD,rPosExp));
312 hIp->Fill(xIpExp,yIpExp);
313 hIpZAtX0->Fill(zIpExpX0);
314 hIpZAtY0->Fill(zIpExpY0);
320 if(iFound>=2 && fabs(zIpExpX0)<100 && fabs(zIpExpY0)<100)
322 if(v_x.size()>iFound)
324 cout<<
"more hits than disks hit!!!" <<endl;
325 cout <<
" vx_size: " << v_x.size() <<
" ifound: " << iFound <<endl;
331 for(
int i=0;i<v_x.size();i++)
333 usedPoints.insert(v_geoIDsPhi[i]);
334 usedPoints.insert(v_geoIDsR[i]);
335 Int_t disk=v_x[i].first;
336 Double_t x=v_x[i].second;
337 Double_t y=v_y[i].second;
338 Double_t rCharge=v_rCharge[i].second;
339 Double_t phiCharge=v_phiCharge[i].second;
341 radioPlotsEff[disk]->Fill(x,y);
342 chargeCorr[disk]->Fill(rCharge,phiCharge);
343 h_clusterSizeR[disk]->Fill(v_clusterSizeR[i]);
344 h_clusterSizePhi[disk]->Fill(v_clusterSizePhi[i]);
345 h_clusterChargeR[disk]->Fill(rCharge);
346 h_clusterChargePhi[disk]->Fill(phiCharge);
348 for(
int i=0;i<v_xFail.size();i++)
350 Int_t disk=v_xFail[i].first;
351 Double_t x=v_xFail[i].second;
352 Double_t y=v_yFail[i].second;
354 radioPlotsNonEff[disk]->Fill(x,y);
362 if(v_r.size()>iFound)
368 for(
int i=0;i<v_r.size();i++)
370 Int_t disk=v_r[i].first;
371 Double_t r=v_r[i].second;
375 for(
int i=0;i<v_rFail.size();i++)
377 Int_t disk=v_rFail[i].first;
378 Double_t r=v_rFail[i].second;
380 rNonEff[disk]->Fill(r);
409 StFgtAVEfficiencyMaker::StFgtAVEfficiencyMaker(
const Char_t* name):
StMaker( name ),runningEvtNr(0),hitCounter(0),hitCounterR(0)
411 cout <<
"AVE constructor!!" <<endl;
415 StFgtAVEfficiencyMaker::~StFgtAVEfficiencyMaker()
423 gStyle->SetPalette(1);
424 cout <<
"cluster plotter finish funciton " <<endl;
427 TCanvas* cRadio=
new TCanvas(
"radioPlots",
"radioPlot",1000,1500);
428 TCanvas* cRadioHits=
new TCanvas(
"radioPlotsHits",
"radioPlotHits",1000,1500);
429 TCanvas* cRadioNonHits=
new TCanvas(
"radioPlotsNonHits",
"radioPlotNonHits",1000,1500);
431 cRadioHits->Divide(2,3);
432 cRadioNonHits->Divide(2,3);
433 TCanvas* cRPRatio=
new TCanvas(
"rPhiRatio",
"rPhiRatios",1000,1500);
434 cRPRatio->Divide(2,3);
436 TCanvas* cREff=
new TCanvas(
"crEff",
"crEff",1000,1500);
440 for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
443 cRadioHits->cd(iD+1);
444 radioPlotsEff[iD]->Draw(
"colz");
445 cRadioNonHits->cd(iD+1);
446 radioPlotsNonEff[iD]->Draw(
"colz");
449 cRadioHits->SaveAs(
"radioPlotsHits.png");
450 cRadioNonHits->SaveAs(
"radioPlotsNonHits.png");
453 TCanvas* cClusterSizeR=
new TCanvas(
"clusterSizeR",
"clusterSizeR",1000,1500);
454 cClusterSizeR->Divide(2,3);
455 TCanvas* cClusterSizePhi=
new TCanvas(
"clusterSizePhi",
"clusterSizePhi",1000,1500);
456 cClusterSizePhi->Divide(2,3);
457 TCanvas* cChargeCorr=
new TCanvas(
"chargeCorr",
"chargeCorr",1000,1500);
458 cChargeCorr->Divide(2,3);
460 TCanvas* cClusterChargePhi=
new TCanvas(
"clusterChargePhi",
"clusterChargePhi",1000,1500);
461 cClusterChargePhi->Divide(2,3);
462 TCanvas* cClusterChargeR=
new TCanvas(
"clusterChargeR",
"clusterChargeR",1000,1500);
463 cClusterChargeR->Divide(2,3);
467 cIPProj.SaveAs(
"ipProj.png");
470 cIPProj.SaveAs(
"ipProjAtX0.png");
473 cIPProj.SaveAs(
"ipProjAtY0.png");
476 for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
478 cClusterSizeR->cd(iD+1);
479 h_clusterSizeR[iD]->Draw();
480 cClusterSizePhi->cd(iD+1);
481 h_clusterSizePhi[iD]->Draw();
482 cChargeCorr->cd(iD+1);
483 chargeCorr[iD]->Draw(
"colz");
485 cClusterChargeR->cd(iD+1);
486 h_clusterChargeR[iD]->Draw();
487 cClusterChargePhi->cd(iD+1);
488 h_clusterChargePhi[iD]->Draw();
491 cClusterSizeR->SaveAs(
"clusterSizeR.png");
492 cClusterSizePhi->SaveAs(
"clusterSizePhi.png");
493 cChargeCorr->SaveAs(
"chargeCorrelation.png");
495 cClusterChargeR->SaveAs(
"clusterChargeR.png");
496 cClusterChargePhi->SaveAs(
"clusterChargePhi.png");
498 cout <<
"saving .." <<endl;
500 for(Int_t iD=0;iD<kFgtNumDiscs;iD++)
504 TH2D* tmpAllCounts=(TH2D*)radioPlotsEff[iD]->
Clone(
"tmp");
505 radioPlotsEff[iD]->Add(radioPlotsNonEff[iD]);
507 for(
int nx=0;nx<radioPlotsEff[iD]->GetNbinsX();nx++)
509 for(
int ny=0;ny<radioPlotsEff[iD]->GetNbinsY();ny++)
511 Double_t denom=radioPlotsEff[iD]->GetBinContent(nx,ny);
513 radioPlotsEff[iD]->SetBinContent(nx,ny,tmpAllCounts->GetBinContent(nx,ny)/denom);
515 radioPlotsEff[iD]->SetBinContent(nx,ny,0.0);
519 radioPlotsEff[iD]->Draw(
"colz");
520 TArc *innerArc =
new TArc(0,0,103.5+11.5,0.0,90.0);
521 TArc *outerArc =
new TArc(0,0,394.0-11.5,0.0,90.0);
522 TLine *left =
new TLine( 11.5, 103.5+11.5, 11.5, 394.0-11.5 );
523 TLine *right =
new TLine( 103.5+11.5, 11.5, 394.0-11.5, 11.5 );
524 TLine *center =
new TLine(
525 (103.5+11.5)*cos( 0.785398163 ),
526 (103.5+11.5)*sin( 0.785398163 ),
527 (394.0-11.5)*cos( 0.785398163 ),
528 (394.0-11.5)*sin( 0.785398163 )
530 TLine *weird =
new TLine(
531 (394.0-11.5)*cos( 0.190240888 ),
532 (394.0-11.5)*sin( 0.190240888 ),
533 (394.0-11.5)*cos( 0.891863248 ),
534 (394.0-11.5)*sin( 0.891863248 )
536 innerArc->SetFillStyle(0);
537 outerArc->SetFillStyle(0);
538 innerArc->SetLineWidth(2);
539 outerArc->SetLineWidth(2);
540 left->SetLineWidth(2);
541 right->SetLineWidth(2);
542 center->SetLineWidth(2);
543 weird->SetLineWidth(2);
544 outerArc->Draw(
"only");
545 innerArc->Draw(
"only");
556 rPhiRatioPlots[iD]->Draw();
559 TH1D* tmpR=(TH1D*)rEff[iD]->
Clone(
"tmpR");
560 rEff[iD]->Add(rNonEff[iD]);
561 for(
int nx=0;nx<rEff[iD]->GetNbinsX();nx++)
563 Double_t denom=rEff[iD]->GetBinContent(nx);
565 rEff[iD]->SetBinContent(nx,tmpR->GetBinContent(nx)/denom);
567 rEff[iD]->SetBinContent(nx,0.0);
571 cRadio->SaveAs(
"radioPlotsEff.png");
572 cRadio->SaveAs(
"radioPlotsEff.pdf");
575 cREff->SaveAs(
"rEff.png");
576 cREff->SaveAs(
"rEff.pdf");
578 cRPRatio->SaveAs(
"rpRatio.png");
579 cRPRatio->SaveAs(
"rpRatio.pdf");
581 cout <<
"returning after finish" <<endl;
591 cout <<
"AVE!!" <<endl;
592 myRootFile=
new TFile(
"clusterEff.root",
"RECREATE");
601 radioPlotsEff=
new TH2D*[kFgtNumDiscs];
602 radioPlotsNonEff=
new TH2D*[kFgtNumDiscs];
603 rPhiRatioPlots=
new TH1D*[kFgtNumDiscs];
604 rEff=
new TH1D*[kFgtNumDiscs];
605 rNonEff=
new TH1D*[kFgtNumDiscs];
608 chargeCorr=
new TH2D*[kFgtNumDiscs];
609 h_clusterSizeR=
new TH1D*[kFgtNumDiscs];
610 h_clusterSizePhi=
new TH1D*[kFgtNumDiscs];
612 h_clusterChargeR=
new TH1D*[kFgtNumDiscs];
613 h_clusterChargePhi=
new TH1D*[kFgtNumDiscs];
616 hIp=
new TH2D(
"Proj_to_IP",
"Proj_to_Ip",50,-100,100,50,-100,100);
617 hIpZAtX0=
new TH1D(
"Proj_to_IPAtX0",
"Proj_toIPAtX0",50,-100,100);
618 hIpZAtY0=
new TH1D(
"Proj_to_IPAtY0",
"Proj_toIPAtY0",50,-100,100);
620 for(
int iD=0;iD<kFgtNumDiscs;iD++)
624 sprintf(buffer,
"radioDiskEff_%d",iD);
625 radioPlotsEff[iD]=
new TH2D(buffer,buffer,20,-50,50,20,-50,50);
628 sprintf(buffer,
"rEff_%d",iD);
629 rEff[iD]=
new TH1D(buffer,buffer,100,0,50);
630 sprintf(buffer,
"rNonEff_%d",iD);
631 rNonEff[iD]=
new TH1D(buffer,buffer,100,0,50);
632 sprintf(buffer,
"clusterSizeR_Disk_%d",iD);
633 h_clusterSizeR[iD]=
new TH1D(buffer,buffer,20,0,20);
634 sprintf(buffer,
"clusterSizePhi_Disk_%d",iD);
635 h_clusterSizePhi[iD]=
new TH1D(buffer,buffer,20,0,20);
636 sprintf(buffer,
"clusterChargeR_Disk_%d",iD);
637 h_clusterChargeR[iD]=
new TH1D(buffer,buffer,100,0,50000);
638 sprintf(buffer,
"clusterChargePhi_Disk_%d",iD);
639 h_clusterChargePhi[iD]=
new TH1D(buffer,buffer,100,0,50000);
641 for(
int nx=0;nx<radioPlotsEff[iD]->GetNbinsX();nx++)
643 for(
int ny=0;ny<radioPlotsEff[iD]->GetNbinsY();ny++)
649 sprintf(buffer,
"r_phi_ChargeCorrelationInDisk_%d",iD);
650 chargeCorr[iD]=
new TH2D(buffer,buffer,50,0,50000,50,0,50000);
651 sprintf(buffer,
"radioDiskNonEff_%d",iD);
652 radioPlotsNonEff[iD]=
new TH2D(buffer,buffer,20,-50,50,20,-50,50);
653 for(
int nx=0;nx<rEff[iD]->GetNbinsX();nx++)
658 sprintf(buffer,
"rPhiRatio_%d",iD);
659 rPhiRatioPlots[iD]=
new TH1D(buffer,buffer,100,-2,10);
virtual TObject * Clone(const char *newname="") const
the custom implementation fo the TObject::Clone