57 #include "StFgtCosmicTrackPlots.h"
67 #include "StRoot/StFgtPool/StFgtCosmicTestStandGeom/StFgtCosmicTestStandGeom.h"
68 #include "StRoot/StFgtPool/StFgtCosmicTrackMaker/StFgtCosmicTrackMaker.h"
69 #include "StRoot/StFgtPool/StFgtCosmicTrackMaker/StFgtCosmicTrack.h"
71 #include "StRoot/StEvent/StEvent.h"
72 #include "StRoot/StEvent/StFgtCollection.h"
73 #include "StRoot/StEvent/StFgtHit.h"
74 #include "StRoot/StEvent/StFgtPoint.h"
77 StFgtCosmicTrackPlots::StFgtCosmicTrackPlots(
const Char_t* name,
78 const Char_t* cosmicTrackerName,
81 const Char_t* quadName ) :
82 StMaker( name ), mFgtTrackMakerName( cosmicTrackerName ), mTrackVecPtr( 0 ),
83 mDiscId( discId ), mQuadId( quadId ),
84 mXbins( 200 ), mXmin( -50 ), mXmax( 50 ),
85 mBinFactorX( 1 ), mQuadName( quadName ),
86 mPath(
""), mFileNameBase(
""), mFileNameKey( quadName ) {
89 gROOT->SetStyle(
"Plain");
98 std::cerr <<
"TODO" << endl;
103 StFgtCosmicTrackPlots::~StFgtCosmicTrackPlots(){
146 std::cerr <<
"TODO" << endl;
151 Int_t StFgtCosmicTrackPlots::Init(){
155 TObject *dataMaker = GetMaker( mFgtTrackMakerName.data() );
157 LOG_FATAL <<
"::Init() could not get pointer to a maker with name '" << mFgtTrackMakerName <<
"'" << endm;
165 mTrackVecPtr = &(trackMaker->getCosmicTrackVec());
210 std::string name, nameforhistX, nameforhistY, titleX, titleY;
212 std::stringstream ss;
213 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
219 std::stringstream sx, sy, ss, snx, sny;
220 std::string profTitleX, profTitleY, nameforprofX, nameforprofY;
221 sx <<
"#deltax vs X for Quad " << mQuadName <<
";X cm;#deltax cm";
222 sy <<
"#deltay vs Y for Quad " << mQuadName <<
";Y cm;#deltay cm";
227 profTitleX = sx.str();
228 profTitleY = sy.str();
229 mProfileX =
new TProfile( nameforprofX.data(), profTitleX.data(), 8, 0., 40. );
230 mProfileY =
new TProfile( nameforprofY.data(), profTitleY.data(), 8, 0., 40. );
235 std::string name1D, name1DR, name1DP, title1D, title1DR, title1DP;
237 std::stringstream ss, sr, sp;
238 ss <<
GetName() <<
"_" << mDiscId <<
"_" << mQuadId;
239 sr << ss.str() <<
"_R";
240 sp << ss.str() <<
"_P";
252 std::stringstream ss, sr ,sp;
253 ss <<
" Quad " << mQuadName <<
" clusters";
254 sr << ss.str() <<
" in R; adc sum";
255 sp << ss.str() <<
" in Phi; adc sum";
256 ss <<
" in R & Phi; adc sum";
262 mHist1Dclusters =
new TH1F( name1D.data(), title1D.data(), mXbins/mBinFactorX, mXmin, 8000 );
263 mHist1Dcluster[0] =
new TH1F( name1DR.data(), title1DR.data(), mXbins/mBinFactorX, mXmin, mXmax );
264 mHist1Dcluster[1] =
new TH1F( name1DP.data(), title1DP.data(), mXbins/mBinFactorX, mXmin, mXmax );
269 std::stringstream st, st2, sc, se, s2, snt, snt2, snc, sne, sn2, ss, ssn;
270 std::string nameT, nameT2, nameC, nameE, name2, nameS,
271 titleT, titleT2, titleC, titleE, title2, titleS;
272 st <<
"Reconstructed tracks on Quad " << mQuadName <<
"; cm; cm";
273 snt << name <<
"_tracks";
274 st2 <<
"Reconstructed registered tracks on Quad " << mQuadName <<
"; cm; cm";
275 snt2 << name <<
"_realTracks";
276 se <<
"Efficiency of Quad " << mQuadName <<
"; cm; cm";
277 sne << name <<
"_efficiency";
278 s2 <<
"Cluster points on Quad " << mQuadName
279 <<
" of registered tracks; cm; cm";
280 sn2 << name <<
"_realPoints";
281 sc <<
"Chi2 values on Quad " << mQuadName <<
"; cm; cm";
283 snc << name <<
"_chi2";
284 ss <<
"Cluster points on Quad " << mQuadName <<
"; cm; cm";
285 ssn << name <<
"_points";
304 mHistTracks =
new TH2F( nameT.data(), titleT.data(), mXbins, mXmin, mXmax, mXbins, mXmin, mXmax );
305 mHistRealTracks =
new TH2F( nameT2.data(), titleT2.data(), mXbins,mXmin, mXmax, mXbins, mXmin, mXmax );
306 mHist2Dpoint =
new TH2F( nameS.data(), titleS.data(), mXbins, mXmin, mXmax, mXbins, mXmin, mXmax );
307 mProfileEfficiency =
new TProfile2D( nameE.data(), titleE.data(), mXbins/mBinFactorX, mXmin, mXmax, mXbins/mBinFactorX, mXmin, mXmax );
308 mHist2Dcluster =
new TH2F( name2.data(), title2.data(), mXbins*5, mXmin, mXmax, mXbins*5, mXmin, mXmax );
309 mProfileChi2 =
new TProfile2D( nameC.data(), titleC.data(), mXbins, mXmin, mXmax, mXbins, mXmin, mXmax );
318 for(
int i=0;i<4;i++) {
319 for(
int j=0;j<4;j++) {
320 std::stringstream sx, sy, ss, sn, snx, sny;
325 ss <<
" Quad " << mQuadName <<
" ";
326 if (i==0 && j==0) {ss <<
"X:0-10 Y:0-10;"; sn <<
"_1";}
327 else if (i==0 && j==1) {ss <<
"X:0-10 Y:10-20"; sn <<
"_5";}
328 else if (i==0 && j==2) {ss <<
"X:0-10 Y:20-30"; sn <<
"_9";}
329 else if (i==0 && j==3) {ss <<
"X:0-10 Y:30-40"; sn <<
"_13";}
330 else if (i==1 && j==0) {ss <<
"X:10-20 Y:0-10"; sn <<
"_2";}
331 else if (i==1 && j==1) {ss <<
"X:10-20 Y:10-20"; sn <<
"_6";}
332 else if (i==1 && j==2) {ss <<
"X:10-20 Y:20-30"; sn <<
"-10";}
333 else if (i==1 && j==3) {ss <<
"X:10-20 Y:30-40"; sn <<
"_14";}
334 else if (i==2 && j==0) {ss <<
"X:20-30 Y:0-10"; sn <<
"_3";}
335 else if (i==2 && j==1) {ss <<
"X:20-30 Y:10-20"; sn <<
"_7";}
336 else if (i==2 && j==2) {ss <<
"X:20-30 Y:20-30"; sn <<
"_11";}
337 else if (i==2 && j==3) {ss <<
"X:20-30 Y:30-40"; sn <<
"_15";}
338 else if (i==3 && j==0) {ss <<
"X:30-40 Y:0-10"; sn <<
"_4";}
339 else if (i==3 && j==1) {ss <<
"X:30-40 Y:10-20"; sn <<
"_8";}
340 else if (i==3 && j==2) {ss <<
"X:30-40 Y:20-30"; sn <<
"_12";}
341 else if (i==3 && j==3) {ss <<
"X:30-40 Y:30-40"; sn <<
"_16";}
347 sx << ss.str() <<
";#deltax cm";
348 sy << ss.str() <<
";#deltay cm";
353 mHistX[j][i] =
new TH1F( nameforhistX.data(), titleX.data(), mXbins/mBinFactorX, mXmin, mXmax );
354 mHistY[j][i] =
new TH1F( nameforhistY.data(), titleY.data(), mXbins/mBinFactorX, mXmin, mXmax );
366 eventPtr = (
StEvent*)GetInputDS(
"StEvent");
369 LOG_ERROR <<
"Error getting pointer to StEvent from '" << ClassName() <<
"'" << endm;
376 fgtCollectionPtr=eventPtr->fgtCollection();
379 if( !fgtCollectionPtr) {
380 LOG_ERROR <<
"Error getting pointer to StFgtCollection from '" << ClassName() <<
"'" << endm;
385 Bool_t isTrack =
false;
387 StFgtCosmicTrackVec::iterator trackIter = mTrackVecPtr->begin();
388 for( trackIter = mTrackVecPtr->begin(); trackIter != mTrackVecPtr->end(); ++trackIter ){
391 Float_t a = trackIter->getLineParameterA();
392 Float_t b = trackIter->getLineParameterB();
393 Float_t x_0 = trackIter->getLineParameterX_0();
394 Float_t y_0 = trackIter->getLineParameterY_0();
395 Float_t dX = trackIter->getVarX();
396 Float_t dY = trackIter->getVarY();
397 Float_t chi2 = trackIter->getChiSquare();
398 Float_t hitX = trackIter->getHitX();
399 Float_t hitY = trackIter->getHitY();
400 isTrack = trackIter->getIsTrack();
402 if(mDiscId==0) Z = 30.48;
403 else if(mDiscId==1) Z = 15.24;
404 else if(mDiscId==2) Z = 0.;
406 if(abs(a)>0.5 || abs(b)>0.5)
437 if(region==1) {mHistX[0][0]->Fill(dX); mHistY[0][0]->Fill(dY);}
438 else if(region==2) {mHistX[0][1]->Fill(dX); mHistY[0][1]->Fill(dY);}
439 else if(region==3) {mHistX[0][2]->Fill(dX); mHistY[0][2]->Fill(dY);}
440 else if(region==4) {mHistX[0][3]->Fill(dX); mHistY[0][3]->Fill(dY);}
441 else if(region==5) {mHistX[1][0]->Fill(dX); mHistY[1][0]->Fill(dY);}
442 else if(region==6) {mHistX[1][1]->Fill(dX); mHistY[1][1]->Fill(dY);}
443 else if(region==7) {mHistX[1][2]->Fill(dX); mHistY[1][2]->Fill(dY);}
444 else if(region==8) {mHistX[1][3]->Fill(dX); mHistY[1][3]->Fill(dY);}
445 else if(region==9) {mHistX[2][0]->Fill(dX); mHistY[2][0]->Fill(dY);}
446 else if(region==10) {mHistX[2][1]->Fill(dX); mHistY[2][1]->Fill(dY);}
447 else if(region==11) {mHistX[2][2]->Fill(dX); mHistY[2][2]->Fill(dY);}
448 else if(region==12) {mHistX[2][3]->Fill(dX); mHistY[2][3]->Fill(dY);}
449 else if(region==13) {mHistX[3][0]->Fill(dX); mHistY[3][0]->Fill(dY);}
450 else if(region==14) {mHistX[3][1]->Fill(dX); mHistY[3][1]->Fill(dY);}
451 else if(region==15) {mHistX[3][2]->Fill(dX); mHistY[3][2]->Fill(dY);}
452 else if(region==16) {mHistX[3][3]->Fill(dX); mHistY[3][3]->Fill(dY);}
456 mProfileX->Fill(x,dX);
457 mProfileY->Fill(y,dY);
460 mHistTracks->Fill(x,y);
461 mProfileChi2->Fill(x,y,chi2);
463 mHist2Dpoint->Fill( hitX , hitY );
465 mHist2Dcluster->Fill( hitX , hitY );
466 mHistRealTracks->Fill(x,y);
468 Int_t isTrackInt = 0;
469 if(isTrack) isTrackInt = 1;
470 mProfileEfficiency->Fill(x,y,isTrackInt);
477 hitCollectionPtr = fgtCollectionPtr->getHitCollection( mDiscId );
480 if( hitCollectionPtr ){
481 const StSPtrVecFgtHit &hitVec = hitCollectionPtr->getHitVec();
482 StSPtrVecFgtHitConstIterator hitIter;
486 for( hitIter = hitVec.begin(); hitIter != hitVec.end(); ++hitIter ){
489 if((*hitIter)->charge() < 200 )
continue;
490 haveR=((*hitIter)->getLayer()==
'R');
492 if( haveR ) mHist1Dcluster[0]->Fill( (*hitIter)->charge() );
493 else mHist1Dcluster[1]->Fill( (*hitIter)->charge() );
494 adcSum += (*hitIter)->charge();
496 if(adcSum!=0) mHist1Dclusters->Fill( adcSum );
519 if( !mFileNameBase.empty() ){
522 std::string filename;
524 filename = mPath +
"/";
525 filename += mFileNameBase;
526 if( !mFileNameKey.empty() )
527 filename += std::string(
"." ) + mFileNameKey;
531 gROOT->SetStyle(
"Plain");
532 TCanvas *canX =
new TCanvas(
"fgtTrackQAcanX",
"fgtTrackQAcanX", 900, 400 );
533 gStyle->SetOptStat(0);
534 gStyle->SetOptDate(0);
537 for( Int_t i=3;i>=0;i--) {
538 for( Int_t j=0;j<4;j++) {
540 mHistX[i][j]->Draw();
545 TCanvas *canY =
new TCanvas(
"fgtTrackQAcanY",
"fgtTrackQAcanY", 900, 400 );
546 gStyle->SetOptStat(0);
547 gStyle->SetOptDate(0);
550 for( Int_t i=3;i>=0;i--) {
551 for( Int_t j=0;j<4;j++) {
553 mHistY[i][j]->Draw();
558 TCanvas *can1Dcluster =
new TCanvas(
"fgtTrackQAcan1Dcluster",
"fgtTrackQAcan1Dcluster", 900, 400 );
559 gStyle->SetOptStat(100000);
560 gStyle->SetOptDate(0);
561 can1Dcluster->Divide(2,1);
563 mHist1Dcluster[0]->Draw();
565 mHist1Dcluster[1]->Draw();
567 TCanvas *can1Dclusters =
new TCanvas(
"fgtTrackQAcan1Dclusters",
"fgtTrackQAcan1Dclusters", 900, 400 );
568 gStyle->SetOptStat(100000);
569 gStyle->SetOptDate(0);
570 mHist1Dclusters->Draw();
572 TCanvas *canTrack =
new TCanvas(
"fgtTrackQATrack",
"fgtTrackQATrack", 900, 400 );
573 gStyle->SetOptStat(0);
574 gStyle->SetOptDate(0);
575 gStyle->SetPalette(1);
576 mHistTracks->Draw(
"colz");
578 TCanvas *canRealTrack =
new TCanvas(
"fgtTrackQARealTrack",
"fgtTrackQARealTrack", 900, 400 );
579 gStyle->SetOptStat(0);
580 gStyle->SetOptDate(0);
581 gStyle->SetPalette(1);
582 mHistTracks->Draw(
"colz");
584 TCanvas *canEfficiency =
new TCanvas(
"fgtTrackQAEf",
"fgtTrackQAEf", 900, 400 );
585 gStyle->SetOptStat(0);
586 gStyle->SetOptDate(0);
587 gStyle->SetPalette(1);
588 mProfileEfficiency->Draw(
"colz");
590 TCanvas *can2Dcluster =
new TCanvas(
"fgtTrackQApoint",
"fgtTrackQApoint", 900, 400 );
591 gStyle->SetOptStat(0);
592 gStyle->SetOptDate(0);
593 gStyle->SetPalette(1);
594 mHist2Dcluster->Draw(
"colz");
596 TCanvas *canChi =
new TCanvas(
"fgtTrackQAChi",
"fgtTrackQAChi", 900, 400 );
597 gStyle->SetOptStat(0);
598 gStyle->SetOptDate(0);
599 gStyle->SetPalette(1);
600 mProfileChi2->Draw(
"colz");
602 TCanvas *canX2 =
new TCanvas(
"fgtTrackQAcanX2",
"fgtTrackQAcanX2", 900, 400 );
603 gStyle->SetOptStat(0);
604 gStyle->SetOptDate(0);
607 TCanvas *canY2 =
new TCanvas(
"fgtTrackQAcanY2",
"fgtTrackQAcanY2", 900, 400 );
608 gStyle->SetOptStat(0);
609 gStyle->SetOptDate(0);
613 canX->Print( filename.data() );
614 canY->Print( filename.data() );
615 can1Dcluster->Print( filename.data() );
616 can1Dclusters->Print( filename.data() );
617 canTrack->Print( filename.data() );
618 canRealTrack->Print( filename.data() );
619 canEfficiency->Print( filename.data() );
620 can2Dcluster->Print( filename.data() );
621 canChi->Print( filename.data() );
622 canX2->Print( filename.data() );
623 canY2->Print( filename.data() );
627 delete can1Dclusters;
630 delete canEfficiency;
void Clear(Option_t *opt="")
User defined functions.
virtual const char * GetName() const
special overload