358 #include "StFtpcTrackMaker.h"
359 #include "StFtpcVertex.hh"
360 #include "StFtpcConfMapper.hh"
361 #include "StFtpcDisplay.hh"
362 #include "StFtpcTrackEvaluator.hh"
363 #include "StFormulary.hh"
364 #include "StFtpcTrackingParams.hh"
365 #include "StFtpcTrackToStEvent.hh"
366 #include "StFtpcClusterMaker/StFtpcClusterDebug.hh"
368 #include "TObjArray.h"
369 #include "TObjectSet.h"
375 #include "TDataSet.h"
376 #include "TDataSetIter.h"
378 #include "StVertexId.h"
379 #include "StFtpcHit.h"
380 #include "StPrimaryVertex.h"
381 #include "StCalibrationVertex.h"
382 #include "StMeasuredPoint.h"
383 #include "StMessMgr.h"
385 #include "tables/St_ffs_gepoint_Table.h"
386 #include "tables/St_g2t_track_Table.h"
405 StFtpcTrackMaker::~StFtpcTrackMaker()
411 Int_t StFtpcTrackMaker::InitRun(Int_t run) {
414 TDataSet *ftpcParsDb = GetInputDB(
"ftpc");
416 LOG_ERROR <<
"StFtpcTrackMaker::Error Getting FTPC parameter database" << endm;
422 TDataSet *ftpcGeometryDb = GetDataBase(
"Geometry/ftpc");
424 if (!ftpcGeometryDb){
425 LOG_ERROR <<
"StFtpcTrackMaker::Error Getting FTPC database: Geometry" << endm;
439 StFtpcTrackingParams::Instance(Debug(),
440 (St_ftpcTrackingPars *)ftpcPars(
"ftpcTrackingPars"),
441 (St_ftpcdEdxPars *)ftpcPars(
"ftpcdEdxPars"),
442 (St_ftpcDimensions *)ftpcGeometry(
"ftpcDimensions"),
443 (St_ftpcPadrowZ *)ftpcGeometry(
"ftpcPadrowZ"));
444 cout<<
"InitRun StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide() = "<<StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()<<endl;
446 if (StFtpcTrackingParams::Instance()->GetReturnCode() > 0) {
447 LOG_ERROR <<
" FATAL error in StFtpcTrackingParams return code = "<< StFtpcTrackingParams::Instance()->GetReturnCode() <<endm;
452 TDataSet *ftpcCalibrationsDb = GetDataBase(
"Calibrations/ftpc");
454 if (!ftpcCalibrationsDb){
455 LOG_ERROR <<
"StFtpcTrackMaker::Error Getting FTPC database: Calibrations" << endm;
462 StFtpcTrackingParams::Instance(kTRUE,
463 (St_ftpcCoordTrans *)ftpcCalibrations(
"ftpcCoordTrans"));
465 if (StFtpcTrackingParams::Instance()->GetReturnCode() > 0) {
466 LOG_ERROR <<
" FATAL error in StFtpcTrackingParams return code = "<< StFtpcTrackingParams::Instance()->GetReturnCode() <<endm;
474 Int_t StFtpcTrackMaker::Init()
488 LOG_INFO <<
"StFtpcTrackMaker entered with m_Mode = "<<
m_Mode <<endm;
493 LOG_INFO <<
"StFtpcTrackMaker running with fdbg option selected" << endm;
494 if (
m_Mode == 3) LOG_INFO <<
"StFtpcTrackMaker running with flaser option selected" << endm;
495 m_vtx_pos =
new TH1F(
"fpt_vtx_pos",
"FTPC estimated vertex position", 800, -400.0, 400.0);
511 if (IAttr(
".histos")) {
513 LOG_INFO <<
"StFtpcTrackMaker running with fgain option selected" <<endm;
514 m_pointFW =
new TH1F(
"NPntFW",
"N points on trk,ftpc west", 8, 4.,12.);
515 m_pointFE =
new TH1F(
"NPntFE",
"N points on trk,ftpc east", 8, 4.,12.);
516 m_ratiomFW =
new TH1F(
"RnmFW",
"ratio Nfit/max pnt, ftpc west", 55, 0., 1.1);
517 m_ratiomFE =
new TH1F(
"RnmFE",
"ratio Nfit/max pnt, ftpc east", 55, 0., 1.1);
518 m_planefF =
new TH1F(
"PlanefF",
"plane of first hit on trk, ftpc",20,0.5,20.5);
519 m_psiFW =
new TH1F(
"PsiFW",
"psi, ftpc west", 90, 0.,360.);
520 m_psiFE =
new TH1F(
"PsiFE",
"psi, ftpc east", 90, 0.,360.);
521 m_xf_yfFW =
new TH2F(
"XfYfFW",
"Y vs X of first hit on trk, ftpcW", 70,-35.,35.,70,-35.,35.);
522 m_xf_yfFE =
new TH2F(
"XfYfFE",
"Y vs X of first hit on trk, ftpcE", 70,-35.,35.,70,-35.,35.);
523 m_good_trk =
new TH2F(
"NtrkGoodF",
"total number tracks found ftpcE vs. ftpcW",150,0.,1500.,150,0.,1500.);
526 m_pnt_padtimeFW =
new TH2F(
"PointPadTimeFtpcW",
"point: #pads vs #timebins of hits, ftpcW",12,0.5,12.5,10,0.5,10.5);
529 m_pnt_padtimeFE =
new TH2F(
"PointPadTimeFtpcE",
"point: #pads vs #timebins of hits, ftpcE",12,0.5,12.5,10,0.5,10.5);
535 m_maxadc_West =
new TH1F(
"fpt_maxadcW",
"FTPCW MaxAdc", 150, 0.5, 150.5);
536 m_maxadc_East =
new TH1F(
"fpt_maxadcE",
"FTPCE MaxAdc", 150, 0.5, 150.5);
538 m_charge_West =
new TH1F(
"fpt_chargeW",
"FTPCW charge", 80, 0.5, 800.5);
539 m_charge_East =
new TH1F(
"fpt_chargeE",
"FTPCE charge", 80, 0.5, 800.5);
541 m_xres =
new TH1F(
"fpt_x_res",
"FTPC x residuals", 100, -0.25, 0.25);
542 m_yres =
new TH1F(
"fpt_y_res",
"FTPC y residuals", 100, -0.25, 0.25);
543 m_rres =
new TH1F(
"fpt_r_res",
"FTPC r residuals", 100, -0.25, 0.25);
544 m_phires =
new TH1F(
"fpt_phi_res",
"FTPC phi residuals", 100, -0.01, 0.01);
546 m_rres_vs_r_east =
new TH2F(
"fpt_r_res_vs_r_east",
"FTPC east r residuals vs. r",
547 100, -0.25, 0.25, 100, 6.5, 31.);
548 m_phires_vs_r_east =
new TH2F(
"fpt_phi_res_vs_r_east",
"FTPC east phi residuals vs. r",
549 100, -0.01, 0.01, 100, 6.5, 31.);
550 m_rres_vs_r_west =
new TH2F(
"fpt_r_res_vs_r_west",
"FTPC west r residuals vs. r",
551 100, -0.25, 0.25, 100, 6.5, 31.);
552 m_phires_vs_r_west =
new TH2F(
"fpt_phi_res_vs_r_west",
"FTPC west phi residuals vs. r",
553 100, -0.01, 0.01, 100, 6.5, 31.);
557 "FTPC east vertex x estimation vs. sector with resp. to TPC vertex",
558 6, 0.5, 6.5, 80, -2., 2.);
560 "FTPC east vertex y estimation vs. sector with resp. to TPC vertex",
561 6, 0.5, 6.5, 80, -2., 2.);
563 "FTPC east vertex z estimation vs. sector with resp. to TPC vertex",
564 6, 0.5, 6.5, 100, -10., 10.);
566 "FTPC west vertex x estimation vs. sector with resp. to TPC vertex",
567 6, 0.5, 6.5, 80, -2., 2.);
569 "FTPC west vertex y estimation vs. sector with resp. to TPC vertex",
570 6, 0.5, 6.5, 80, -2., 2.);
572 "FTPC west vertex z estimation vs. sector with resp. to TPC vertex",
573 6, 0.5, 6.5, 100, -10., 10.);
577 return StMaker::Init();
584 LOG_INFO <<
"Tracking (FTPC) started..." << endm;
588 LOG_WARN <<
"StFtpcTrackMaker::Make(): TObjectSet of ftpc clusters is missing." << endm;
591 TObjArray *ftpcHits = (TObjArray*)objSet->
GetObject();
593 LOG_WARN <<
"No FTPC clusters available!" << endm;
596 Int_t rc = StFtpcTrackingParams::Instance()->GetReturnCode();
598 LOG_ERROR <<
"FTPC Database not available. Return Code = " << rc << endm;
609 if (event->numberOfPrimaryVertices() > 0) {
612 if (Int_t problem = vertex.CheckVertex()) {
619 if (StFtpcTrackingParams::Instance()->MagFieldFactor() == 0.) {
620 tracker.NoFieldTracking();
624 tracker.TwoCycleTracking();
625 LOG_INFO <<
"StFtpcTrackMaker: Using TwoCycleTracking"<<endm;
628 tracker.LaserTracking();
629 LOG_INFO <<
"StFtpcTrackMaker: Using LaserTracking"<<endm;
644 TObjArray *clusters = tracker.GetClusters();
648 for (Int_t i = 0; i < clusters->GetEntriesFast(); i++) {
650 point->TransformFtpc2Global();
651 if (event->ftpcHitCollection()) point->GetStFtpcHit()->update(*point);
655 tracker.GlobalFitAnddEdx();
658 if (tracker.GetNumberOfTracks() >= StFtpcTrackingParams::Instance()->MinNumTracks()) {
662 if (tracker.GetVertexEast()->GetIFlag() == 0) {
663 const StThreeVectorF east(tracker.GetVertexEast()->GetX(), tracker.GetVertexEast()->GetY(), tracker.GetVertexEast()->GetZ());
665 ftpcEastVertex->setPosition(east);
666 ftpcEastVertex->setType(kFtpcEastCalVtxId);
667 event->addCalibrationVertex(ftpcEastVertex);
668 LOG_INFO <<
"Added FTPC East calibration vertex: x = "<<tracker.GetVertexEast()->GetX()<<
" y = "<<tracker.GetVertexEast()->GetY()<<
" z = "<<tracker.GetVertexEast()->GetZ() << endm;
671 if (tracker.GetVertexWest()->GetIFlag() == 0) {
672 StThreeVectorF west(tracker.GetVertexWest()->GetX(), tracker.GetVertexWest()->GetY(), tracker.GetVertexWest()->GetZ());
674 ftpcWestVertex->setPosition(west);
675 ftpcWestVertex->setType(kFtpcWestCalVtxId);
676 event->addCalibrationVertex(ftpcWestVertex);
677 LOG_INFO <<
"Added FTPC West calibration vertex: x = "<<tracker.GetVertexWest()->GetX()<<
" y = "<<tracker.GetVertexWest()->GetY()<<
" z = "<<tracker.GetVertexWest()->GetZ() << endm;
683 trackToStEvent.
FillEvent(event, tracker.GetTracks());
684 tracker.PrimaryFit();
685 trackToStEvent.FillEventPrimaries(event, tracker.GetTracks());
688 LOG_INFO <<
"Total time consumption " << tracker.GetTime() <<
" s." << endm;
689 StFtpcTrackingParams::Instance()->PrintParams();
690 tracker.TrackingInfo();
697 tracker.TrackingInfo();
701 Double_t vertexPos[3];
703 vertexPos[0] = vertex.GetX();
704 vertexPos[1] = vertex.GetY();
705 vertexPos[2] = vertex.GetZ();
706 LOG_INFO<<
"TWOCYCLETRACKING: vertexPos[0] = "<<vertexPos[0]<<
" vertexPos[1] = "<<vertexPos[1]<<
" vertexPos[2] = "<<vertexPos[2]<<endm;
712 LOG_INFO<<
"LASER : No FTPC to global transformation !!!"<<endm;
716 cldebug.filltracktree(tracker.GetTracks(),vertexPos);
763 if (tracker.GetNumberOfTracks() > 0) {
764 MakeHistograms(&tracker);
768 LOG_INFO <<
"Tracking (FTPC) completed." << endm;
776 void StFtpcTrackMaker::MakeHistograms(
StFtpcTracker *tracker)
783 if (tracker->GetVertex()->GetIFlag()) {
788 if (tracker->GetNumberOfTracks() >= StFtpcTrackingParams::Instance()->MinNumTracks()) {
800 if (IAttr(
".histos") && Debug()) {
801 for (Int_t i = 1; i <= 6; i++) {
808 for (Int_t i = 1; i <= 6; i++) {
818 if (IAttr(
".histos")) {
821 for (Int_t t_counter = 0; t_counter < tracker->GetTracks()->GetEntriesFast(); t_counter++) {
824 TObjArray *fhits = (TObjArray*) track->GetHits();
828 Int_t iftpc = (firstPoint->GetDetectorId() == 5) ? 0 : 1;
833 Float_t psi = TMath::ATan2(track->GetPy(), track->GetPx())/degree;
839 m_pointFW->Fill(track->GetNumberOfPoints());
840 m_ratiomFW->Fill(Float_t(track->GetNumberOfPoints())/Float_t(track->GetNMax()));
841 m_xf_yfFW->Fill(firstPoint->GetX(),firstPoint->GetY());
846 m_pointFE->Fill(track->GetNumberOfPoints());
847 m_ratiomFE->Fill(Float_t(track->GetNumberOfPoints())/Float_t(track->GetNMax()));
848 m_xf_yfFE->Fill(firstPoint->GetX(),firstPoint->GetY());
855 for (Int_t h_counter = 0; h_counter < fhits->GetEntriesFast(); h_counter++) {
860 if (mhit->GetUsage()) {
861 m_xres->Fill(mhit->GetXGlobResidual());
862 m_yres->Fill(mhit->GetYGlobResidual());
863 m_rres->Fill(mhit->GetRGlobResidual());
864 m_phires->Fill(mhit->GetPhiGlobResidual());
867 if (mhit->GetPadRow() <= StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()) {
870 m_charge_West->Fill(mhit->GetCharge());
872 if (mhit->GetUsage()) {
878 else if (mhit->GetPadRow() > StFtpcTrackingParams::Instance()->NumberOfPadRowsPerSide()) {
880 m_maxadc_East->Fill(mhit->GetMaxADC());
881 m_charge_East->Fill(mhit->GetCharge());
883 if (mhit->GetUsage()) {
906 Int_t StFtpcTrackMaker::FinishRun(Int_t run)
912 return StMaker::FinishRun(run);
917 void StFtpcTrackMaker::PrintInfo()
921 LOG_INFO <<
"******************************************************************" << endm;
922 LOG_INFO <<
"* $Id: StFtpcTrackMaker.cxx,v 1.93 2012/11/07 23:30:18 fisyak Exp $ *" << endm;
923 LOG_INFO <<
"******************************************************************" << endm;
926 StMaker::PrintInfo();
TH2F * m_vertex_west_x_vs_sector
vertex z estimation east vs sector
TH2F * m_phires_vs_r_west
r residuals vs. r west
StEvent * FillEvent(StEvent *, TObjArray *)
TH1F * m_psiFW
plane of first hit on trk, ftpc
TH2F * m_vertex_west_z_vs_sector
vertex y estimation west vs sector
TH1F * m_ratiomFW
number of points on the track - ftpc east
TH2F * m_good_trk
padlength vs timelength of hits, ftpcE
TH2F * m_phires_vs_r_east
r residuals vs. r east
TH2F * m_vertex_east_y_vs_sector
vertex x estimation east vs sector
TH1F * m_pointFE
number of points on the track - ftpc west
TH2F * m_vertex_east_x_vs_sector
phi residuals vs. r west
TH2F * m_vertex_west_y_vs_sector
vertex x estimation west vs sector
TH2F * m_pnt_padtimeFE
padlength vs timelength of hits, ftpcW
TH1F * m_psiFE
psi reconstructed, ftpc west
TH1F * m_planefF
ratio of n fit pnts over max n pnts - ftpc east
TH1F * m_vtx_pos
tot # tracks ftpcW vs. ftpcE
TH2F * m_xf_yfFW
psi reconstructed, ftpc east
TH2F * m_vertex_east_z_vs_sector
vertex y estimation east vs sector
TH2F * m_rres_vs_r_east
phi residuals
virtual Int_t GetRunNumber() const
Returns the current RunNumber.
TH2F * m_rres_vs_r_west
phi residuals vs. r east
TH2F * m_xf_yfFE
Y vs X of first hit on trk, ftpc west.
TH1F * m_maxadc_West
vertex position
void EstimateVertex(StFtpcVertex *vertex, UChar_t iterations=1)
Vertex estimation with fit tracks for FTPC east and west.
TH2F * m_pnt_padtimeFW
Y vs X of first hit on trk, ftpc east.
TH1F * m_ratiomFE
ratio of n fit pnts over max n pnts - ftpc west
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
TH1F * m_phires
r residuals