FairRoot/PandaRoot
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
PndTrkLegendreSecTask Class Reference

#include <PndTrkLegendreSecTask.h>

Inheritance diagram for PndTrkLegendreSecTask:

Public Member Functions

 PndTrkLegendreSecTask ()
 
 PndTrkLegendreSecTask (int verbose)
 
 ~PndTrkLegendreSecTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void SetParContainers ()
 
void Initialize ()
 
void Reset ()
 
Int_t FillConformalHitList (int isec=-1)
 
void FillLegendreHisto (Int_t mode)
 
void FillLegendreHisto (PndTrkCluster *cluster)
 
PndTrkCluster CreateSttCluster (PndTrkHit *firsthit)
 
Bool_t IsSttAssociate (PndTrkHit *hit1, PndTrkHit *hit2)
 
PndTrkCluster CreateClusterByConfDistance (double fitm, double fitq)
 
PndTrkCluster CreateClusterByRealDistance (double xc0, double yc0, double R0)
 
PndTrkCluster CreateClusterByMixedDistance (double fitm, double fitq)
 
PndTrkCluster CreateClusterByDistance (Int_t mode, double fitm, double fitq)
 
PndTrkCluster CreateSkewHitList (PndTrkTrack *track)
 
void FromConformalToRealTrack (double fitm, double fitp, double &x0, double &y0, double &R)
 
PndTrkCluster CleanUpSkewHitList (PndTrkCluster *skewhitlist)
 
void RegisterTrack (PndTrkTrack *track)
 
void ComputeTraAndRot (PndTrkHit *hit, Double_t &delta, Double_t trasl[2])
 
PndTrkHitFindSttReferenceHit (int isec=-1)
 
PndTrkHitFindMvdPixelReferenceHit ()
 
PndTrkHitFindMvdStripReferenceHit ()
 
PndTrkHitFindMvdReferenceHit ()
 
PndTrkHitFindReferenceHit ()
 
PndTrkCluster Cleanup (PndTrkCluster cluster)
 
void SearchSecondaryTracks ()
 
void SwitchOnDisplay ()
 
void DrawGeometry ()
 
void DrawHits (PndTrkHitList *hitlist)
 
void Refresh ()
 
void RefreshConf ()
 
void DrawGeometryConf (double x1, double y1, double x2, double y2)
 
void DrawConfHit (double x, double y, double r, int marker=2)
 
void LightCluster (PndTrkCluster *cluster)
 
void DrawLegendreHisto ()
 
void RefreshZ ()
 
void DrawZGeometry (int whichone=1, double phimin=0, double phimax=360, double zmin=-43, double zmax=113)
 
void DontUseMvdPix ()
 
void DontUseMvdStr ()
 
void DontUseStt ()
 
Bool_t DoesRealHitBelong (PndTrkHit *hit, double x0, double y0, double R)
 
Bool_t DoesConfHitBelong (PndTrkConformalHit *hit, double fitm, double fitp)
 
void RePrepareLegendre (PndTrkCluster *cluster)
 
void PrepareLegendre ()
 
Int_t ApplyLegendre (double &theta_max, double &r_max)
 
Int_t ApplyLegendre (PndTrkCluster *cluster, double &theta_max, double &r_max)
 
Int_t ExtractLegendre (Int_t mode, double &theta_max, double &r_max)
 
Bool_t ZPhiFit (int iter, PndTrkCluster *cluster, double &fitm, double &fitp)
 
PndTrkClusterCleanupZPhiFit (PndTrkCluster *cluster, double fitm, double fitp)
 
double ComputeZRediduals (PndTrkCluster *cluster, double fitm, double fitp)
 
double CorrectZ (PndTrkCluster *cluster, double deltaz, double fitm, double fitp)
 

Public Attributes

Bool_t fDisplayOn
 
TH2F * hxy
 
TH2F * hxz
 
TH2F * hzphi
 
TCanvas * display
 
TH2F * huv
 

Private Member Functions

 ClassDef (PndTrkLegendreSecTask, 1)
 

Private Attributes

Int_t fNofMvdPixHits
 
Int_t fNofMvdStrHits
 
Int_t fNofSttHits
 
Int_t fNofTriplets
 
Int_t fNofHits
 
TClonesArray * fSttPointArray
 
TClonesArray * fSttHitArray
 
TClonesArray * fMvdPixelHitArray
 
TClonesArray * fMvdStripHitArray
 
TClonesArray * fTrackArray
 
TClonesArray * fTrackCandArray
 
TClonesArray * fTubeArray
 
PndGeoSttParfSttParameters
 
char fSttBranch [200]
 
char fMvdPixelBranch [200]
 
char fMvdStripBranch [200]
 
PndSttMapCreatorfMapper
 
Int_t fEventCounter
 
PndTrkSttHitListstthitlist
 
PndTrkSdsHitListmvdpixhitlist
 
PndTrkSdsHitListmvdstrhitlist
 
Double_t fSttParalDistance
 
Double_t fSttToMvdStripDistance
 
double fDeltaThetaRad
 
PndTrkLegendreTransformlegendre
 
Bool_t fPersistence
 
Bool_t fUseMVDPix
 
Bool_t fUseMVDStr
 
Bool_t fUseSTT
 
Bool_t fSecondary
 
Bool_t fInitDone
 
PndTrkConformalTransformconform
 
PndTrkConformalHitListconformalhitlist
 
PndTrkToolstools
 
PndTrkHitfRefHit
 
Double_t fMvdPix_RealDistLimit
 
Double_t fMvdStr_RealDistLimit
 
Double_t fStt_RealDistLimit
 
Double_t fMvdPix_ConfDistLimit
 
Double_t fMvdStr_ConfDistLimit
 
Double_t fStt_ConfDistLimit
 
std::vector< std::pair< double,
double > > 
fFoundPeaks
 
double fTime
 
TStopwatch * fTimer
 
PndTrkFitterfFitter
 

Detailed Description

Definition at line 35 of file PndTrkLegendreSecTask.h.

Constructor & Destructor Documentation

PndTrkLegendreSecTask::PndTrkLegendreSecTask ( )

Default constructor

Definition at line 54 of file PndTrkLegendreSecTask.cxx.

References fMvdPixelBranch, fMvdStripBranch, fSttBranch, and PndGeoHandling::Instance().

54  : FairTask("secondary track finder", 0), fDisplayOn(kFALSE), fPersistence(kTRUE), fUseMVDPix(kTRUE), fUseMVDStr(kTRUE), fUseSTT(kTRUE), fSecondary(kFALSE), fMvdPix_RealDistLimit(1000), fMvdStr_RealDistLimit(1000), fStt_RealDistLimit(1000), fMvdPix_ConfDistLimit(1000), fMvdStr_ConfDistLimit(1000), fStt_ConfDistLimit(1000), fInitDone(kFALSE) {
55  sprintf(fSttBranch,"STTHit");
56  sprintf(fMvdPixelBranch,"MVDHitsPixel");
57  sprintf(fMvdStripBranch,"MVDHitsStrip");
59 }
static PndGeoHandling * Instance()
PndTrkLegendreSecTask::PndTrkLegendreSecTask ( int  verbose)

Definition at line 61 of file PndTrkLegendreSecTask.cxx.

References fMvdPixelBranch, fMvdStripBranch, fSttBranch, and PndGeoHandling::Instance().

61  : FairTask("secondary track finder", verbose), fDisplayOn(kFALSE), fPersistence(kTRUE), fUseMVDPix(kTRUE), fUseMVDStr(kTRUE), fUseSTT(kTRUE), fSecondary(kFALSE), fMvdPix_RealDistLimit(1000), fMvdStr_RealDistLimit(1000), fStt_RealDistLimit(1000), fMvdPix_ConfDistLimit(1000), fMvdStr_ConfDistLimit(1000), fStt_ConfDistLimit(1000), fInitDone(kFALSE) {
62  sprintf(fSttBranch,"STTHit");
63  sprintf(fMvdPixelBranch,"MVDHitsPixel");
64  sprintf(fMvdStripBranch,"MVDHitsStrip");
66 }
#define verbose
static PndGeoHandling * Instance()
PndTrkLegendreSecTask::~PndTrkLegendreSecTask ( )

Destructor

Definition at line 71 of file PndTrkLegendreSecTask.cxx.

71  {
72 
73 }

Member Function Documentation

Int_t PndTrkLegendreSecTask::ApplyLegendre ( double &  theta_max,
double &  r_max 
)

Definition at line 1879 of file PndTrkLegendreSecTask.cxx.

References ExtractLegendre(), and PrepareLegendre().

Referenced by Exec().

1879  {
1880  PrepareLegendre();
1881  return ExtractLegendre(0, theta_max, r_max);
1882 }
Int_t ExtractLegendre(Int_t mode, double &theta_max, double &r_max)
Int_t PndTrkLegendreSecTask::ApplyLegendre ( PndTrkCluster cluster,
double &  theta_max,
double &  r_max 
)

Definition at line 1884 of file PndTrkLegendreSecTask.cxx.

References ExtractLegendre(), and RePrepareLegendre().

1884  {
1885  RePrepareLegendre(cluster);
1886  return ExtractLegendre(1, theta_max, r_max);
1887 }
Int_t ExtractLegendre(Int_t mode, double &theta_max, double &r_max)
void RePrepareLegendre(PndTrkCluster *cluster)
PndTrkLegendreSecTask::ClassDef ( PndTrkLegendreSecTask  ,
 
)
private
PndTrkCluster PndTrkLegendreSecTask::Cleanup ( PndTrkCluster  cluster)

Definition at line 1969 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), angle, conform, display, Double_t, PndTrkHit::Draw(), fDisplayOn, PndTrkClean::FindMvdLayer(), fSecondary, fTubeArray, PndTrkHit::GetDistance(), PndTrkCluster::GetHit(), PndSttTube::GetLayerID(), PndTrkCluster::GetMvdPixelHitList(), PndTrkCluster::GetMvdStripHitList(), PndSttTube::GetNeighborings(), PndTrkCluster::GetNofHits(), PndTrkConformalTransform::GetRotation(), PndSttTube::GetSectorID(), PndTrkHit::GetSensorID(), PndTrkCluster::GetSttParallelHitList(), PndTrkConformalTransform::GetTranslation(), PndTrkHit::GetTubeID(), hit(), nhit, PndTrkHit::SetSortVariable(), and PndTrkCluster::Sort().

Referenced by Exec().

1969  {
1970 
1971  // CLEANUP
1972  // -------------------------------------------------------
1973  // CleanCluster(cluster);
1974  // cluster->SortMvdPixelByLayerID();
1975  // cluster->SortByLayerID();
1976  PndTrkClean clean;
1977  int leftvotes = 0;
1978  int rightvotes = 0;
1979 
1980  TVector2 trasl = conform->GetTranslation();
1982 
1983  // SET SORT VARIABLE
1984  // MVD PIX PART OF CLUSTER
1985  PndTrkCluster mvdpixcluster = cluster.GetMvdPixelHitList();
1986  for(int ihit = 0; ihit < mvdpixcluster.GetNofHits(); ihit++) {
1987  PndTrkHit *hit = mvdpixcluster.GetHit(ihit);
1988  if(fSecondary) hit->SetSortVariable(hit->GetDistance(TVector3(trasl.X(), trasl.Y(), angle)));
1989  else hit->SetSortVariable(hit->GetDistance(TVector3(0., 0., 0)));
1990  int sensorID = hit->GetSensorID();
1991  int layerID = clean.FindMvdLayer(sensorID);
1992  if(layerID%2 == 0) rightvotes++;
1993  else leftvotes++;
1994  }
1995  // MVD STR PART OF CLUSTER
1996  PndTrkCluster mvdstrcluster = cluster.GetMvdStripHitList();
1997  for(int ihit = 0; ihit < mvdstrcluster.GetNofHits(); ihit++) {
1998  PndTrkHit *hit = mvdstrcluster.GetHit(ihit);
1999  if(fSecondary) hit->SetSortVariable(hit->GetDistance(TVector3(trasl.X(), trasl.Y(), angle)));
2000  else hit->SetSortVariable(hit->GetDistance(TVector3(0., 0., 0)));
2001  int sensorID = hit->GetSensorID();
2002  int layerID = clean.FindMvdLayer(sensorID);
2003  if(layerID%2 == 0) rightvotes++;
2004  else leftvotes++;
2005  }
2006  // STT PARALLEL PART OF CLUSTER
2007  PndTrkCluster sttcluster = cluster.GetSttParallelHitList();
2008  for(int ihit = 0; ihit < sttcluster.GetNofHits(); ihit++) {
2009  PndTrkHit *hit = sttcluster.GetHit(ihit);
2010  int layerID = -999, tubeID = hit->GetTubeID(), sectorID = -999;
2011  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
2012  layerID = tube->GetLayerID();
2013  sectorID = tube->GetSectorID();
2014  if(fSecondary) hit->SetSortVariable(hit->GetDistance(TVector3(trasl.X(), trasl.Y(), angle)));
2015  else hit->SetSortVariable(1000+layerID);
2016  if(sectorID < 3) rightvotes++;
2017  else leftvotes++;
2018  }
2019 
2020  // cout << "VOTES: LEFT " << leftvotes << " RIGHT " << rightvotes << endl;
2021  for(int ihit = 0; ihit < cluster.GetNofHits(); ihit++) {
2022  PndTrkHit *hit = cluster.GetHit(ihit);
2023  // cout << "for sorting " << hit->GetDetectorID () << " " << hit->GetHitID() << " " << hit->GetSortVariable() << endl;
2024  }
2025 
2026  cluster.Sort();
2027  for(int ihit = 0; ihit < cluster.GetNofHits(); ihit++) {
2028  PndTrkHit *hit = cluster.GetHit(ihit);
2029  // cout << "sorted " << hit->GetDetectorID () << " " << hit->GetHitID() << " " << hit->GetSortVariable() << endl;
2030  }
2031 
2032  // cluster.Print();
2033 
2034  // DELETE HITS
2035  PndTrkCluster deletioncluster;
2036 
2037  // LEFT/RIGHT CRITERION ------------------------------------------ NOW OFF
2038  // PIXEL
2039  mvdpixcluster = cluster.GetMvdPixelHitList();
2040  for(int ihit = 0; ihit < mvdpixcluster.GetNofHits(); ihit++) {
2041  PndTrkHit *hit = mvdpixcluster.GetHit(ihit);
2042  int sensorID = hit->GetSensorID();
2043  int layerID = clean.FindMvdLayer(sensorID);
2044  // cout << "pixel sorted " << hit->GetHitID() << " " << hit->GetSortVariable() << " " << sensorID << " " << layerID << endl;
2045 
2046 
2047  if((leftvotes > rightvotes) && (layerID%2 == 0)) {
2048  // deletioncluster.AddHit(hit);
2049  // cout << "pixel DELETED " << hit->GetHitID() << " " << ihit << " " << mvdpixcluster.GetNofHits() << endl;
2050  }
2051  else if((leftvotes < rightvotes) && (layerID%2 != 0)) {
2052  // deletioncluster.AddHit(hit);
2053  // cout << "pixel DELETED " << hit->GetHitID() << " " << ihit << " " << mvdpixcluster.GetNofHits() << endl;
2054  }
2055 
2056  if(fDisplayOn) {
2057  char goOnChar;
2058  display->cd(1);
2059  hit->Draw(kGreen);
2060  display->Update();
2061  display->Modified();
2062  cout << "WAITING" << endl;
2063  cin >> goOnChar;
2064  }
2065  }
2066  // STRIP
2067  mvdstrcluster = cluster.GetMvdStripHitList();
2068  for(int ihit = 0; ihit < mvdstrcluster.GetNofHits(); ihit++) {
2069  PndTrkHit *hit = mvdstrcluster.GetHit(ihit);
2070  int sensorID = hit->GetSensorID();
2071  // cout << "strip sorted " << hit->GetHitID() << " " << hit->GetSortVariable() << " " << sensorID << " " << clean.FindMvdLayer(sensorID) << endl;
2072  int layerID = clean.FindMvdLayer(sensorID);
2073  if((leftvotes > rightvotes) && (layerID%2 == 0)) {
2074  // deletioncluster.AddHit(hit);
2075  // cout << "strip DELETED " << hit->GetHitID() << endl;
2076  }
2077  else if((leftvotes < rightvotes) && (layerID%2 != 0)) {
2078  // deletioncluster.AddHit(hit);
2079  // cout << "strip DELETED " << hit->GetHitID() << endl;
2080  }
2081  if(fDisplayOn) {
2082  char goOnChar;
2083  display->cd(1);
2084  hit->Draw(kBlue);
2085  display->Update();
2086  display->Modified();
2087  // cin >> goOnChar;
2088  }
2089  }
2090 
2091  // STT PARALLEL
2092  sttcluster = cluster.GetSttParallelHitList();
2093  for(int ihit = 0; ihit < sttcluster.GetNofHits(); ihit++) {
2094  PndTrkHit *hit = sttcluster.GetHit(ihit);
2095  int layerID = -999, tubeID = hit->GetTubeID();
2096  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
2097  layerID = tube->GetLayerID();
2098  // cout << "stt sorted " << hit->GetHitID() << " " << hit->GetSortVariable() << " " << tubeID << " " << layerID << endl;
2099 
2100  int sectorID = tube->GetSectorID();
2101 
2102  if((leftvotes > rightvotes) && (sectorID < 3)) {
2103  // deletioncluster.AddHit(hit);
2104  // cout << "stt DELETED " << hit->GetHitID() << " " << sectorID << endl;
2105  }
2106  else if((leftvotes < rightvotes) && (sectorID >= 3)) {
2107  // deletioncluster.AddHit(hit);
2108  // cout << "stt DELETED " << hit->GetHitID() << " " << sectorID << endl;
2109  }
2110  // ~~~~~~~~~~~~~~~~~~ check *******************
2111  else { // NEIGHBORING CRITERION ------------------------------------------------
2112  TArrayI neighboring = tube->GetNeighborings();
2113  // cout << "NEIGHBORING TO TUBE " << tubeID << endl;
2114  // for(int nhit = 0; nhit < neighboring.GetSize(); nhit++) {
2115  // cout << " " << neighboring.At(nhit);
2116  // }
2117  // cout << endl;
2118 
2119  int neighboringcounter = 0;
2120  for(int ohit = 0; ohit < sttcluster.GetNofHits(); ohit++) {
2121  if(ihit == ohit) continue;
2122  PndTrkHit *otherhit = sttcluster.GetHit(ohit);
2123  int otherhitID = otherhit->GetTubeID();
2124 
2125  for(int nhit = 0; nhit < neighboring.GetSize(); nhit++) {
2126  if(otherhitID == neighboring.At(nhit)) neighboringcounter++;
2127  }
2128 
2129  // if(isthere == false)
2130  // {
2131  // deletioncluster.AddHit(hit);
2132  // cout << "stt DELETEDbis " << hit->GetHitID() << " " << sectorID << endl;
2133  // }
2134  }
2135  // cout << "hit " << ihit << " has " << neighboringcounter << " NEIGHBORINS" << endl;
2136 
2137  if(layerID != 0 && layerID != 7 && layerID != 8 && ihit != sttcluster.GetNofHits() - 1 && neighboringcounter == 1) {
2138  // cout << "I SHOULD DELETE THIS" << endl;
2139  // deletioncluster.AddHit(hit);
2140  // OFF FOR NOW: delete if there is just 1 neighboring
2141  // cout << "stt DELETED " << hit->GetHitID() << " " << sectorID << endl;
2142  }
2143 
2144  // ON, delete if there is no neighboring (isolated hit)
2145  if(neighboringcounter == 0) {
2146  // cout << "I WILL DELETE THIS" << endl;
2147  deletioncluster.AddHit(hit);
2148  // cout << "stt DELETED " << hit->GetHitID() << " " << sectorID << endl;
2149  }
2150 
2151  if(fDisplayOn) {
2152  char goOnChar;
2153  display->cd(1);
2154  hit->Draw(kCyan);
2155  display->Update();
2156  display->Modified();
2157  // cin >> goOnChar;
2158  }
2159  }
2160  }
2161 
2162  if(fDisplayOn) {
2163  char goOnChar;
2164  // cin >> goOnChar;
2165  }
2166  // ~~~~~~~~~~~~~~~~~~
2167 
2168 
2169 
2170  // ACTUAL DELETION OF HITS
2171 
2172  PndTrkCluster finalcluster;
2173  for(int ihit = 0; ihit < cluster.GetNofHits(); ihit++) {
2174  PndTrkHit *hit = cluster.GetHit(ihit);
2175  bool stop = false;
2176  for(int jhit = 0; jhit < deletioncluster.GetNofHits(); jhit++) {
2177  PndTrkHit *dhit = deletioncluster.GetHit(jhit);
2178  if(hit == dhit) {
2179  // ********** CHECK ***********
2180  // cout << "trhrow in again" << endl;
2181  // dhit->SetUsedFlag(0);
2182  stop = true;
2183  break;
2184  }
2185  }
2186  if(!stop) finalcluster.AddHit(hit);
2187  }
2188 
2189  return finalcluster;
2190 }
int FindMvdLayer(int sensorID)
void SetSortVariable(Double_t sortvar)
Definition: PndTrkHit.h:44
void AddHit(PndTrkHit *hit)
PndTrkConformalTransform * conform
PndTrkHit * GetHit(int index)
int GetLayerID()
Definition: PndSttTube.cxx:128
Int_t GetSensorID()
Definition: PndTrkHit.h:60
PndTrkCluster GetSttParallelHitList()
Double_t
Double_t GetDistance(PndTrkHit *fromhit)
Definition: PndTrkHit.cxx:83
TArrayI GetNeighborings()
Definition: PndSttTube.cxx:137
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
PndTrkCluster GetMvdPixelHitList()
void Draw(Color_t color)
Definition: PndTrkHit.cxx:109
Double_t angle
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
int GetSectorID()
Definition: PndSttTube.cxx:124
Int_t GetTubeID()
Definition: PndTrkHit.h:61
PndTrkCluster GetMvdStripHitList()
PndTrkCluster PndTrkLegendreSecTask::CleanUpSkewHitList ( PndTrkCluster skewhitlist)

Definition at line 1591 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), display, DrawZGeometry(), fabs(), fDisplayOn, PndTrkCluster::GetHit(), PndTrkSkewHit::GetIntersection1(), PndTrkSkewHit::GetIntersection2(), PndTrkCluster::GetNofHits(), PndTrkSkewHit::GetPhi1(), PndTrkSkewHit::GetPhi2(), hzphi, PndTrkHit::SetSortVariable(), and PndTrkCluster::Sort().

Referenced by Exec().

1591  {
1592 
1593 
1594  // 6. FIRST CLEANING of the track skewed associations
1595  // find most probable z - CHECK what happens if a track is very fwd peaked?
1596  // TRY WITH DELTA z = COST
1597  // cout << "##################### FIND MOST PROBABLE Z" << endl;
1598  double phimin = 400, phimax = -1, zmin = 1000, zmax = -1;
1599 
1600  for(int ihit = 0; ihit < skewhitlist->GetNofHits(); ihit++) {
1601  PndTrkSkewHit *skewhit = (PndTrkSkewHit*) skewhitlist->GetHit(ihit);
1602  if(!skewhit) continue;
1603  TVector3 fin_intersection1 = skewhit->GetIntersection1();
1604  TVector3 fin_intersection2 = skewhit->GetIntersection2();
1605 
1606  double phi1 = skewhit->GetPhi1();
1607  double phi2 = skewhit->GetPhi2();
1608 
1609  if(phi1 < phimin) phimin = phi1;
1610  if(phi2 < phimin) phimin = phi2;
1611  if(fin_intersection1.Z() < zmin) zmin = fin_intersection1.Z();
1612  if(fin_intersection2.Z() < zmin) zmin = fin_intersection2.Z();
1613 
1614  if(phi1 > phimax) phimax = phi1;
1615  if(phi2 > phimax) phimax = phi2;
1616  if(fin_intersection1.Z() > zmax) zmax = fin_intersection1.Z();
1617  if(fin_intersection2.Z() > zmax) zmax = fin_intersection2.Z();
1618  // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ CHECK
1619  }
1620  // cout << "PHI: " << phimin << " " << phimax << endl;
1621  // cout << "Z : " << zmin << " " << zmax << endl;
1622 
1623  // DISPLAY ----------------------------
1624  if(fDisplayOn) {
1625  char goOnChar;
1626  display->cd(4);
1627  phimin -= 30;
1628  phimax += 30;
1629  zmin -= 13;
1630  zmax += 13;
1631  DrawZGeometry(2, phimin, phimax, zmin, zmax);
1632  hzphi->SetXTitle("#phi");
1633  hzphi->SetYTitle("#z");
1634  hzphi->Draw();
1635  display->Update();
1636  display->Modified();
1637 
1638 
1639  for(int ihit = 0; ihit < skewhitlist->GetNofHits(); ihit++) {
1640  PndTrkSkewHit *skewhit = (PndTrkSkewHit*) skewhitlist->GetHit(ihit);
1641  if(!skewhit) continue;
1642 
1643  TVector3 fin_intersection1 = skewhit->GetIntersection1();
1644  TVector3 fin_intersection2 = skewhit->GetIntersection2();
1645 
1646  double phi1 = skewhit->GetPhi1();
1647  double phi2 = skewhit->GetPhi2();
1648 
1649  TLine *linezphi = new TLine(phi1, fin_intersection1.Z(), phi2, fin_intersection2.Z());
1650  // TLine *linezphi = new TLine(fin_intersection1.Z(), phi1, fin_intersection2.Z(), phi2);
1651  linezphi->SetLineStyle(1);
1652  linezphi->Draw("SAME");
1653 
1654  TMarker *mrkzphi1 = new TMarker(phi1, fin_intersection1.Z(), 20);
1655  // TMarker *mrkzphi1 = new TMarker(fin_intersection1.Z(), phi1, 20);
1656 
1657  mrkzphi1->SetMarkerColor(kBlue - 9);
1658  mrkzphi1->Draw("SAME");
1659 
1660  TMarker *mrkzphi2 = new TMarker(phi2, fin_intersection2.Z(), 20);
1661  // TMarker *mrkzphi2 = new TMarker(fin_intersection2.Z(), phi2, 20);
1662  mrkzphi2->SetMarkerColor(kMagenta - 7);
1663  mrkzphi2->Draw("SAME");
1664  }
1665  display->Update();
1666  display->Modified();
1667  // cin >> goOnChar;
1668  }
1669  // DISPLAY ----------------------------
1670 
1671  TH1F hz("hz", "z", (zmax - zmin)/10., zmin, zmax); // CHECK
1672  for(int ihit = 0; ihit < skewhitlist->GetNofHits(); ihit++) {
1673  PndTrkSkewHit *skewhit = (PndTrkSkewHit*) skewhitlist->GetHit(ihit);
1674  if(!skewhit) continue;
1675  TVector3 fin_intersection1 = skewhit->GetIntersection1();
1676  TVector3 fin_intersection2 = skewhit->GetIntersection2();
1677  hz.Fill(fin_intersection1.Z());
1678  hz.Fill(fin_intersection2.Z());
1679  }
1680  int maxbinz = hz.GetMaximumBin();
1681  double mostprobZ = hz.GetBinCenter(maxbinz);
1682  // cout << mostprobZ << endl;
1683 
1684  // delete hits too far away ..........
1685  // cout << "##################### DELETE HITS" << endl;
1686  PndTrkCluster tmpskewhitlist;
1687  for(int ihit = 0; ihit < skewhitlist->GetNofHits(); ihit++) {
1688  PndTrkSkewHit *skewhit = (PndTrkSkewHit*) skewhitlist->GetHit(ihit);
1689  if(!skewhit) continue;
1690  TVector3 fin_intersection1 = skewhit->GetIntersection1();
1691  TVector3 fin_intersection2 = skewhit->GetIntersection2();
1692  double phi1 = skewhit->GetPhi1();
1693  double phi2 = skewhit->GetPhi2();
1694 
1695  if(fabs(fin_intersection1.Z() - mostprobZ) > 30. && fabs(fin_intersection2.Z() - mostprobZ) > 30.) {
1696  // cout << "THROW AWAY " << ihit << " " << fabs(fin_intersection1.Z() - mostprobZ) << " " << fabs(fin_intersection2.Z() - mostprobZ) << endl;
1697  continue;
1698  }
1699  skewhit->SetSortVariable((phi1 + phi2)/2.);
1700  tmpskewhitlist.AddHit(skewhit);
1701  }
1702  tmpskewhitlist.Sort();
1703  return tmpskewhitlist;
1704 }
Double_t GetPhi1()
Definition: PndTrkSkewHit.h:37
void SetSortVariable(Double_t sortvar)
Definition: PndTrkHit.h:44
void AddHit(PndTrkHit *hit)
TVector3 GetIntersection2()
Definition: PndTrkSkewHit.h:35
PndTrkHit * GetHit(int index)
Double_t GetPhi2()
Definition: PndTrkSkewHit.h:38
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void DrawZGeometry(int whichone=1, double phimin=0, double phimax=360, double zmin=-43, double zmax=113)
TVector3 GetIntersection1()
Definition: PndTrkSkewHit.h:34
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
PndTrkCluster * PndTrkLegendreSecTask::CleanupZPhiFit ( PndTrkCluster cluster,
double  fitm,
double  fitp 
)

Definition at line 2193 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), fabs(), fMvdPixelBranch, fMvdStripBranch, fSttBranch, PndTrkHit::GetDetectorID(), PndTrkCluster::GetHit(), PndTrkCluster::GetNofHits(), PndTrkHit::GetPhi(), PndTrkHit::GetPosition(), hit(), PndTrkHit::IsSttParallel(), phi, and sqrt().

Referenced by Exec().

2193  {
2194 
2195  PndTrkCluster *cleancluster = new PndTrkCluster();
2196  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
2197  PndTrkHit *hit = cluster->GetHit(ihit);
2198  if(hit->IsSttParallel()) {
2199  cleancluster->AddHit(hit);
2200  continue; // CHECK IsSttParrallel will be changed
2201  }
2202 
2203  TVector3 position = hit->GetPosition();
2204  double phi = hit->GetPhi();
2205 
2206  // d = | m x - y + p | / sqrt(m**2 + 1)
2207  double distance = fabs(fitm * phi - position.Z() + fitp )/sqrt(fitm * fitm + 1);
2208  // cout << "distance " << hit->GetHitID() << " " << distance << endl;
2209 
2210  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch) || hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
2211  if(distance < 1) cleancluster->AddHit(hit);
2212  }
2213  else if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
2214  if(distance < 5) cleancluster->AddHit(hit);
2215  }
2216  }
2217  // cout << "cleancluster " << cleancluster->GetNofHits () << endl;
2218  return cleancluster;
2219 }
Double_t GetPhi()
Definition: PndTrkHit.h:67
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
TVector3 GetPosition()
Definition: PndTrkHit.h:62
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
void PndTrkLegendreSecTask::ComputeTraAndRot ( PndTrkHit hit,
Double_t delta,
Double_t  trasl[2] 
)

Definition at line 1841 of file PndTrkLegendreSecTask.cxx.

References PndTrkHit::GetPosition().

Referenced by Exec().

1841  {
1842 
1843  trasl[0] = hit->GetPosition().X();
1844  trasl[1] = hit->GetPosition().Y();
1845 
1846  delta = 0.; // TMath::ATan2(hit->GetPosition().Y() - 0., hit->GetPosition().X() - 0.); // CHECK
1847 
1848 }
TVector3 GetPosition()
Definition: PndTrkHit.h:62
double PndTrkLegendreSecTask::ComputeZRediduals ( PndTrkCluster cluster,
double  fitm,
double  fitp 
)

Definition at line 2309 of file PndTrkLegendreSecTask.cxx.

References display, fDisplayOn, fSttBranch, PndTrkHit::GetDetectorID(), PndTrkCluster::GetHit(), PndTrkCluster::GetNofHits(), PndTrkHit::GetPhi(), PndTrkHit::GetPosition(), hit(), PndTrkHit::IsSttParallel(), and phi.

2309  {
2310 
2311  TH1F hresiduals("hresiduals", "residuals in z", 20, -5, 5);
2312 
2313  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
2314  PndTrkHit *hit = cluster->GetHit(ihit);
2315 
2316  if(hit->GetDetectorID() != FairRootManager::Instance()->GetBranchId(fSttBranch)) continue;
2317  if(hit->IsSttParallel()) continue;
2318 
2319  TVector3 position = hit->GetPosition();
2320  double phi = hit->GetPhi();
2321 
2322 
2323  double distance = fitm * phi + fitp - position.Z();
2324 
2325  hresiduals.Fill(distance);
2326  }
2327 
2328  if(fDisplayOn) {
2329  display->cd(4);
2330  char goOnChar;
2331  cout << "residuals";
2332  cin >> goOnChar;
2333  hresiduals.Draw();
2334  display->Update();
2335  display->Modified();
2336  cin >> goOnChar;
2337  }
2338  return hresiduals.GetMean();
2339 }
Double_t GetPhi()
Definition: PndTrkHit.h:67
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
TVector3 GetPosition()
Definition: PndTrkHit.h:62
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
double PndTrkLegendreSecTask::CorrectZ ( PndTrkCluster cluster,
double  deltaz,
double  fitm,
double  fitp 
)

Definition at line 2341 of file PndTrkLegendreSecTask.cxx.

References display, Double_t, fDisplayOn, fSttBranch, fTubeArray, PndTrkHit::GetDetectorID(), PndSttTube::GetHalfLength(), PndTrkCluster::GetHit(), PndTrkCluster::GetNofHits(), PndSttTube::GetPosition(), PndTrkHit::GetPosition(), PndTrkHit::GetTubeID(), PndSttTube::GetWireDirection(), hit(), PndTrkHit::IsSttParallel(), m, p, and PndTrkHit::SetPosition().

2341  {
2342 
2343  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
2344  PndTrkHit *hit = cluster->GetHit(ihit);
2345 
2346  if(hit->GetDetectorID() != FairRootManager::Instance()->GetBranchId(fSttBranch)) continue;
2347  if(hit->IsSttParallel()) continue;
2348 
2349  TVector3 position = hit->GetPosition();
2350  double newz = position.Z() - deltaz;
2351 
2352 
2353  int tubeID = hit->GetTubeID();
2354  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
2355 
2356  TVector3 wireDirection = tube->GetWireDirection();
2357  Double_t halflength = tube->GetHalfLength();
2358 
2359  TVector3 first = tube->GetPosition() + wireDirection * halflength; // CHECK
2360  TVector3 second = tube->GetPosition() - wireDirection * halflength; // CHECK
2361 
2362  double m, p;
2363  double newx = position.X();
2364  double newy = position.Y();
2365  if((second.X() - first.X()) != 0) {
2366  m = (second.Z() - first.Z())/(second.X() - first.X());
2367  p = position.Z() - m * position.X();
2368  newx = (newz - p)/m;
2369  }
2370 
2371  if((second.Y() - first.Y()) != 0) {
2372 
2373  m = (second.Z() - first.Z())/(second.Y() - first.Y());
2374  p = position.Z() - m * position.Y();
2375  newy = (newz - p)/m;
2376  }
2377 
2378  hit->SetPosition(TVector3(newx, newy, newz));
2379 
2380  if(fDisplayOn) {
2381  display->cd(1);
2382  char goOnChar;
2383  cout << endl;
2384  cout << "SEE IT" ;
2385  TMarker *mrk = new TMarker(newx, newy, 6);
2386  mrk->SetMarkerColor(kOrange);
2387  mrk->Draw("SAME");
2388  display->Update();
2389  display->Modified();
2390 
2391  cout << "old " << position.X() << " " << position.Y() << " " << position.Z() << endl;
2392  cout << "new " << newx << " " << newy << " " << newz << endl;
2393 
2394  cin >> goOnChar;
2395  }
2396 
2397  }
2398 }
__m128 m
Definition: P4_F32vec4.h:28
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
Double_t p
Definition: anasim.C:58
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
Double_t
TVector3 GetPosition()
Definition: PndTrkHit.h:62
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
void SetPosition(TVector3 pos)
Definition: PndTrkHit.h:47
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Int_t GetTubeID()
Definition: PndTrkHit.h:61
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
PndTrkCluster PndTrkLegendreSecTask::CreateClusterByConfDistance ( double  fitm,
double  fitq 
)

Definition at line 813 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), Bool_t, conformalhitlist, display, fDisplayOn, fMvdPixelBranch, fMvdStripBranch, fSttBranch, PndTrkConformalHit::GetDetectorID(), PndTrkConformalHit::GetDistanceFromTrack(), PndTrkHitList::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetHitID(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), mvdpixhitlist, mvdstrhitlist, and stthitlist.

813  {
814 
815  PndTrkCluster cluster;
816  // ADD HIT IN CONFORMAL PLANE WITH DISTANCE CRITERION
817  // cost x + sint y - r = 0 -> |cost x0 + sint y0 - r|
818  // cout << "CONFORMALHITLIST " << conformalhitlist->GetNofHits() << endl;
819  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
821  double dist = chit->GetDistanceFromTrack(fitm, fitq);
822  int hitID = chit->GetHitID();
823  int detID = chit->GetDetectorID();
824 
825  // CHECK limits
826  double distlimit = 0;
827  if(detID == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) distlimit = 0.003;
828  else if(detID == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) distlimit = 0.003;
829  else if(detID == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
830  if(chit->GetIsochrone() > 1.e-4) distlimit = 6 * chit->GetIsochrone();
831  else distlimit = 0.001;
832  }
833  // ---------------------------
834  Bool_t accept = kFALSE;
835 
836 
837  if(dist < distlimit) {
838  if(fDisplayOn) {
839  if(chit->GetIsochrone() > 0) {
840  TArc *arc = new TArc(chit->GetU(), chit->GetV(), chit->GetIsochrone());
841  arc->SetFillStyle(0);
842  arc->SetLineColor(5);
843  display->cd(2);
844  arc->Draw("SAME");
845  }
846  else {
847  TMarker *mrk;
848  if(detID == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) mrk = new TMarker(chit->GetU(), chit->GetV(), 21);
849  else if(detID == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) mrk = new TMarker(chit->GetU(), chit->GetV(), 25);
850  mrk->SetMarkerColor(5);
851  display->cd(2);
852  mrk->Draw("SAME");
853  }
854  }
855 
856  PndTrkHit *hit;
857  if(detID == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) {
858  hit = mvdpixhitlist->GetHit(hitID);
859  }
860  else if(detID == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
861  hit = mvdstrhitlist->GetHit(hitID);
862  }
863  else if(detID == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
864  hit = stthitlist->GetHit(hitID);
865  }
866 
867  // ********** CHECK ***********
868  // if you put "is used" the efficiency beecomes much lower!
869  // DO NOT: if(!hit->IsUsed())
870  cluster.AddHit(hit);
871  accept = kTRUE;
872 
873  }
874 
875  // else cout << "DISCARDED " << hitID << " " << detID << " " << dist << " " << distlimit << endl;
876  }
877 
878  return cluster;
879 }
PndTrkConformalHitList * conformalhitlist
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
PndTrkSdsHitList * mvdstrhitlist
PndTrkConformalHit * GetHit(int index)
double GetDistanceFromTrack(double fitm, double fitp)
PndTrkSttHitList * stthitlist
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
PndTrkSdsHitList * mvdpixhitlist
PndTrkCluster PndTrkLegendreSecTask::CreateClusterByDistance ( Int_t  mode,
double  fitm,
double  fitq 
)

Definition at line 1074 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), Bool_t, conformalhitlist, display, DoesConfHitBelong(), DoesRealHitBelong(), Double_t, fDisplayOn, fMvdPixelBranch, fMvdStripBranch, fRefHit, FromConformalToRealTrack(), fSttBranch, PndTrkHit::GetDetectorID(), PndTrkConformalHit::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkHit::GetPosition(), hit(), R, x0, and y0.

Referenced by Exec().

1074  {
1075  PndTrkCluster cluster;
1076 
1077  // mode: -------------------------------------------
1078  // 0 all conformal: pix conf - str conf - stt conf
1079  // 1 all real: pix real - str real - stt real
1080  // 2 mix: pix real - str real - stt conf
1081  // --------------------------------------------------
1082  Double_t x0, y0, R;
1083  FromConformalToRealTrack(fitm, fitp, x0, y0, R);
1084 
1085  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
1087  PndTrkHit *hit = chit->GetHit();
1088  Bool_t accept = kFALSE;
1089 
1090  if(hit == fRefHit) accept = DoesRealHitBelong(hit, x0, y0, R);
1091  else {
1092  if(mode == 0) accept = DoesConfHitBelong(chit, fitm, fitp);
1093  else if(mode == 1) accept = DoesRealHitBelong(hit, x0, y0, R);
1094  else if(mode == 2) {
1095  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) accept = DoesConfHitBelong(chit, fitm, fitp);
1096  else accept = DoesRealHitBelong(hit, x0, y0, R);
1097  }
1098  }
1099 
1100  if(accept == kTRUE && fDisplayOn) {
1101  display->cd(1);
1102  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
1103  TArc *arc = new TArc(hit->GetPosition().X(), hit->GetPosition().Y(), hit->GetIsochrone());
1104  arc->SetFillStyle(0);
1105  arc->SetLineColor(5);
1106  arc->Draw("SAME");
1107  }
1108  else {
1109  TMarker *mrk;
1110  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 21);
1111  else if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 25);
1112  mrk->SetMarkerColor(5);
1113  mrk->Draw("SAME");
1114  }
1115  }
1116 
1117  // ********** CHECK ***********
1118  // if you put "is used" the efficiency beecomes much lower!
1119  // DO NOT: if(!hit->IsUsed())
1120  if(accept == kTRUE) {
1121  // cout << "ADDING TO CLUSTER" << endl;
1122  cluster.AddHit(hit);
1123  }
1124  }
1125  return cluster;
1126 }
Double_t x0
Definition: checkhelixhit.C:70
Bool_t DoesRealHitBelong(PndTrkHit *hit, double x0, double y0, double R)
Bool_t DoesConfHitBelong(PndTrkConformalHit *hit, double fitm, double fitp)
PndTrkConformalHitList * conformalhitlist
void AddHit(PndTrkHit *hit)
Int_t mode
Definition: autocutx.C:47
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
Double_t
PndTrkConformalHit * GetHit(int index)
Double_t y0
Definition: checkhelixhit.C:71
TVector3 GetPosition()
Definition: PndTrkHit.h:62
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Double_t R
Definition: checkhelixhit.C:61
PndTrkCluster PndTrkLegendreSecTask::CreateClusterByMixedDistance ( double  fitm,
double  fitq 
)

Definition at line 948 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), conformalhitlist, display, Double_t, fDisplayOn, FromConformalToRealTrack(), fSttBranch, PndTrkConformalHitList::GetConformalTransform(), PndTrkConformalHit::GetDetectorID(), PndTrkConformalHit::GetDistanceFromTrack(), PndTrkHitList::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetHitID(), PndTrkConformalHit::GetIsochrone(), PndTrkHitList::GetNofHits(), PndTrkConformalHitList::GetNofHits(), PndTrkHit::GetPosition(), PndTrkConformalTransform::GetRotation(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), PndTrkHit::GetXYDistanceFromTrack(), hit(), mvdpixhitlist, mvdstrhitlist, and stthitlist.

948  {
949 
950  PndTrkCluster cluster;
952  // CHECK
953  // ADD HIT IN MIXED MODE REAL P. FOR MVD & CONFORMAL P. FOR STT,
954  // WITH DISTANCE CRITERION
955  // real: fabs(R - sqrt((xc - x)**2 + (yc - y)**2)) < distlim
956  // cofn: cost x + sint y - r = 0 -> |cost x0 + sint y0 - r|
957 
958  // CHECK if this needs to be kept --> change xc0 to xc etc
959  // center and radius
960  Double_t xc0, yc0, R0;
961  FromConformalToRealTrack(fitm, fitq, xc0, yc0, R0);
962  // .........................................................
963  if(fDisplayOn) {
964  TArc *arc = new TArc(xc0, yc0, R0);
965  arc->SetFillStyle(0);
966  arc->SetLineColor(5);
967  display->cd(1);
968  arc->Draw("SAME");
969  }
970  for(int ihit = 0; ihit < mvdpixhitlist->GetNofHits(); ihit++) {
971  PndTrkHit *hit = mvdpixhitlist->GetHit(ihit);
972  double dist = hit->GetXYDistanceFromTrack(xc0, yc0, R0);
973  // CHECK limits
974  double distlimit = 0.5;
975  if(dist < distlimit) {
976  cluster.AddHit(hit);
977  if(fDisplayOn) {
978  TMarker *mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 21);
979  mrk->SetMarkerColor(5);
980  display->cd(1);
981  mrk->Draw("SAME");
982  }
983  }
984  }
985  for(int ihit = 0; ihit < mvdstrhitlist->GetNofHits(); ihit++) {
986  PndTrkHit *hit = mvdstrhitlist->GetHit(ihit);
987  double dist = hit->GetXYDistanceFromTrack(xc0, yc0, R0);
988  // CHECK limits
989  double distlimit = 0.5;
990  if(dist < distlimit){
991  cluster.AddHit(hit);
992  if(fDisplayOn) {
993  TMarker *mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 25);
994  mrk->SetMarkerColor(5);
995  display->cd(1);
996  mrk->Draw("SAME");
997  }
998  }
999  }
1000 
1001  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
1003  double dist = chit->GetDistanceFromTrack(fitm, fitq);
1004 
1005  int hitID = chit->GetHitID();
1006  int detID = chit->GetDetectorID();
1007 
1008  // CHECK limits
1009  if(detID != FairRootManager::Instance()->GetBranchId(fSttBranch)) continue;
1010  double distlimit = 0;
1011  if(chit->GetIsochrone() > 1.e-4) distlimit = 6 * chit->GetIsochrone();
1012  else distlimit = 0.001;
1013  // ---------------------------
1014 
1015  if(dist < distlimit) {
1016 
1017  // cout << "ADDED " << hitID << " " << detID << " " << dist << " " << distlimit << endl;
1018 
1019  if(fDisplayOn) {
1020  TArc *arc = new TArc(chit->GetU(), chit->GetV(), chit->GetIsochrone());
1021  arc->SetFillStyle(0);
1022  arc->SetLineColor(5);
1023  display->cd(2);
1024  arc->Draw("SAME");
1025  }
1026 
1027  PndTrkHit *hit = stthitlist->GetHit(hitID);
1028 
1029  // ********** CHECK ***********
1030  // if you put "is used" the efficiency beecomes much lower!
1031  // DO NOT: if(!hit->IsUsed())
1032  cluster.AddHit(hit);
1033  }
1034  }
1035  return cluster;
1036 }
PndTrkConformalHitList * conformalhitlist
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
PndTrkSdsHitList * mvdstrhitlist
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
Double_t
PndTrkConformalHit * GetHit(int index)
TVector3 GetPosition()
Definition: PndTrkHit.h:62
double GetDistanceFromTrack(double fitm, double fitp)
PndTrkSttHitList * stthitlist
Double_t GetXYDistanceFromTrack(double x0, double y0, double R)
Definition: PndTrkHit.cxx:105
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
PndTrkConformalTransform * GetConformalTransform()
PndTrkSdsHitList * mvdpixhitlist
PndTrkCluster PndTrkLegendreSecTask::CreateClusterByRealDistance ( double  xc0,
double  yc0,
double  R0 
)

Definition at line 881 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), display, fDisplayOn, PndTrkHitList::GetHit(), PndTrkHit::GetIsochrone(), PndTrkHitList::GetNofHits(), PndTrkHit::GetPosition(), PndTrkHit::GetXYDistanceFromTrack(), hit(), PndTrkHit::IsSttSkew(), mvdpixhitlist, mvdstrhitlist, and stthitlist.

881  {
882  // ADD HIT IN REAL PLANE WITH DISTANCE CRITERION
883  // sqrt((xc - x)**2 + (yc - y)**2) < distlim
884  PndTrkCluster cluster;
885 
886  // .........................................................
887  if(fDisplayOn) {
888  TArc *arc = new TArc(xc0, yc0, R0);
889  arc->SetFillStyle(0);
890  arc->SetLineColor(5);
891  display->cd(1);
892  arc->Draw("SAME");
893  }
894  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
895  PndTrkHit *hit = stthitlist->GetHit(ihit);
896  if(hit->IsSttSkew()) continue;
897  double dist = hit->GetXYDistanceFromTrack(xc0, yc0, R0);
898  // cout << ihit << " dist " << dist << endl;
899  // CHECK limits
900  double distlimit = 1.5 * 0.5;
901  if(dist < distlimit){
902  // cout << "TRACK " << xc0 << " " << yc0 << " " << R0 << endl;
903  // cout << "ADD HIT " << dist << " " << distlimit << " " << hit->GetHitID() << endl;
904  cluster.AddHit(hit);
905  if(fDisplayOn) {
906  TArc *arc = new TArc(hit->GetPosition().X(), hit->GetPosition().Y(), hit->GetIsochrone());
907  arc->SetFillStyle(0);
908  arc->SetLineColor(5);
909  display->cd(1);
910  arc->Draw("SAME");
911  }
912  }
913  }
914  for(int ihit = 0; ihit < mvdpixhitlist->GetNofHits(); ihit++) {
915  PndTrkHit *hit = mvdpixhitlist->GetHit(ihit);
916  double dist = hit->GetXYDistanceFromTrack(xc0, yc0, R0);
917  // CHECK limits
918  double distlimit = 0.5;
919  if(dist < distlimit) {
920  cluster.AddHit(hit);
921  if(fDisplayOn) {
922  TMarker *mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 21);
923  mrk->SetMarkerColor(5);
924  display->cd(1);
925  mrk->Draw("SAME");
926  }
927  }
928  }
929  for(int ihit = 0; ihit < mvdstrhitlist->GetNofHits(); ihit++) {
930  PndTrkHit *hit = mvdstrhitlist->GetHit(ihit);
931  double dist = hit->GetXYDistanceFromTrack(xc0, yc0, R0);
932  // CHECK limits
933  double distlimit = 0.5;
934  if(dist < distlimit){
935  cluster.AddHit(hit);
936  if(fDisplayOn) {
937  TMarker *mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 25);
938  mrk->SetMarkerColor(5);
939  display->cd(1);
940  mrk->Draw("SAME");
941  }
942  }
943  }
944  return cluster;
945 
946 }
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
PndTrkSdsHitList * mvdstrhitlist
TVector3 GetPosition()
Definition: PndTrkHit.h:62
PndTrkSttHitList * stthitlist
Double_t GetXYDistanceFromTrack(double x0, double y0, double R)
Definition: PndTrkHit.cxx:105
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
PndTrkSdsHitList * mvdpixhitlist
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
PndTrkCluster PndTrkLegendreSecTask::CreateSkewHitList ( PndTrkTrack track)

Definition at line 1338 of file PndTrkLegendreSecTask.cxx.

References a, PndTrkCluster::AddHit(), b, PndTrkTrack::ComputePhi(), PndTrkTools::ComputeSegmentCircleIntersection(), PndTrkTools::ComputeTangentInPoint(), CAMath::Cos(), display, Double_t, DrawZGeometry(), dx, dy, fDisplayOn, fTubeArray, PndTrkTrack::GetCenter(), PndSttTube::GetHalfLength(), PndTrkHitList::GetHit(), PndTrkHit::GetIsochrone(), PndTrkHitList::GetNofHits(), PndSttTube::GetPosition(), PndTrkTrack::GetRadius(), PndTrkHit::GetTubeID(), PndSttTube::GetWireDirection(), hit(), PndTrkHit::IsSttSkew(), Pi, R, RefreshZ(), CAMath::Sin(), SKEW_ANGLE, CAMath::Sqrt(), stthitlist, t, tools, X, Y, and y0.

Referenced by Exec().

1338  {
1339 
1340  double xc = track->GetCenter().X();
1341  double yc = track->GetCenter().Y();
1342  double R = track->GetRadius();
1343  PndTrkCluster skewhitlist;
1344 
1345  double phimin = 400, phimax = -1, zmin = 1000, zmax = -1;
1346  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1347  PndTrkHit *hit = stthitlist->GetHit(ihit);
1348  // if(hit->IsUsed()) {
1349  // cout << "already used IV" << endl;
1350  // continue;
1351  // }
1352  if(hit->IsSttSkew() == kFALSE) continue;
1353 
1354  int tubeID = hit->GetTubeID();
1355  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
1356 
1357  TVector3 wireDirection = tube->GetWireDirection();
1358  Double_t halflength = tube->GetHalfLength();
1359 
1360  TVector3 first = tube->GetPosition() + wireDirection * halflength; // CHECK
1361  TVector3 second = tube->GetPosition() - wireDirection * halflength; // CHECK
1362  // if(fDisplayOn) {
1363  // char goOnChar;
1364  // display->cd(1);
1365  // TLine *l = new TLine(first.X(), first.Y(), second.X(), second.Y());
1366  // l->SetLineColor(kBlue);
1367  // l->Draw("SAME");
1368  // display->Update();
1369  // display->Modified();
1370  // cin >> goOnChar;
1371  // }
1372  double m1 = (first - second).Y()/(first - second).X();
1373  double q1 = first.Y() - m1 * first.X();
1374 
1375  // 1. compute intersection between the track circle and the wire
1376  TVector2 intersection1, intersection2;
1377  Int_t nofintersections = tools->ComputeSegmentCircleIntersection(TVector2(first.X(), first.Y()), TVector2(second.X(), second.Y()), xc, yc, R, intersection1, intersection2);
1378 
1379  if(nofintersections == 0) continue;
1380  if(nofintersections >= 2) {
1381  cout << "ERROR: MORE THAN 1 INTERSECTION!!" << endl;
1382  continue; // CHECK
1383  }
1384 
1385  if(fDisplayOn) {
1386  char goOnChar;
1387  display->cd(1);
1388  TLine *l = new TLine(first.X(), first.Y(), second.X(), second.Y());
1389  l->SetLineColor(kBlue);
1390  l->Draw("SAME");
1391 
1392  TMarker *mrk = new TMarker(intersection1.X(), intersection1.Y(), 20);
1393  mrk->SetMarkerColor(kBlue);
1394  mrk->Draw("SAME");
1395 
1396  display->Update();
1397  display->Modified();
1398 
1399 
1400  // cin >> goOnChar;
1401  }
1402 
1403 
1404  // 2. find the tangent to the track in the intersection point
1405  // tangent approximation
1406  TVector2 tangent = tools->ComputeTangentInPoint(xc, yc, intersection1);
1407 
1408  // 3. rotate clockwise the tangent/point/(wire, not explicitely)
1409  // in order to have the wire parallel to the x axis;
1410  // then translate everything to have the wire ON the x axis
1411  double beta = wireDirection.Phi();
1412  if(beta < 0) beta += TMath::Pi();
1413  // ... rotate the tangent
1414  double rtx = TMath::Cos(beta) * tangent.X() + TMath::Sin(beta) * tangent.Y();
1415  double rty = TMath::Cos(beta) * tangent.Y() - TMath::Sin(beta) * tangent.X();
1416  TVector2 rottangent(rtx, rty);
1417  rottangent = rottangent.Unit();
1418  // ... rotate the point
1419  double rx = TMath::Cos(beta) * intersection1.X() + TMath::Sin(beta) * intersection1.Y();
1420  double ry = TMath::Cos(beta) * intersection1.Y() - TMath::Sin(beta) * intersection1.X();
1421 
1422  // translation
1423  Double_t deltay = ry;
1424  rty -= deltay;
1425  ry -= deltay;
1426 
1427  // rotm, rotp
1428  Double_t rotm = rottangent.Y()/rottangent.X();
1429  Double_t rotp = ry - rotm * rx;
1430 
1431  // ellipsis
1432  double a = hit->GetIsochrone() * TMath::Cos(SKEW_ANGLE); // CHECK skew angle hard coded
1433  double b = hit->GetIsochrone();
1434 
1435  // center of ellipsis
1436  Double_t x0a, x0b, y0;
1437  y0 = 0.;
1438  x0a = (-rotp + TMath::Sqrt(b * b + a * a * rotm * rotm)) / rotm;
1439  x0b = (-rotp - TMath::Sqrt(b * b + a * a * rotm * rotm)) / rotm;
1440 
1441  // intersection point
1442  double intxa = (x0a * b * b - rotm * rotp * a * a) / (b * b + rotm * rotm * a * a);
1443  double intya = rotm * intxa + rotp;
1444  double intxb = (x0b * b * b - rotm * rotp * a * a) / (b * b + rotm * rotm * a * a);
1445  double intyb = rotm * intxb + rotp;
1446 
1447  // 4. retraslate/rerotate all back to the original plane
1448  // retranslate
1449  y0 += deltay;
1450  intya += deltay;
1451  intyb += deltay;
1452 
1453  // rerotate
1454  double x0anew = TMath::Cos(beta) * x0a - TMath::Sin(beta) * y0;
1455  double y0anew = TMath::Cos(beta) * y0 + TMath::Sin(beta) * x0a;
1456  double x0bnew = TMath::Cos(beta) * x0b - TMath::Sin(beta) * y0;
1457  double y0bnew = TMath::Cos(beta) * y0 + TMath::Sin(beta) * x0b;
1458 
1459  double intxanew = TMath::Cos(beta) * intxa - TMath::Sin(beta) * intya;
1460  double intyanew = TMath::Cos(beta) * intya + TMath::Sin(beta) * intxa;
1461  double intxbnew = TMath::Cos(beta) * intxb - TMath::Sin(beta) * intyb;
1462  double intybnew = TMath::Cos(beta) * intyb + TMath::Sin(beta) * intxb;
1463 
1464  intxa = intxanew;
1465  intya = intyanew;
1466  intxb = intxbnew;
1467  intyb = intybnew;
1468 
1469  // now we have x0a, y0a, center of the 1st ellipse
1470  // and x0b, y0b, center of the 2nd ellipse
1471  x0a = x0anew;
1472  double y0a = y0anew;
1473  x0b = x0bnew;
1474  double y0b = y0bnew;
1475 
1476  if(fDisplayOn) {
1477  char goOnChar;
1478  display->cd(1);
1479 
1480  TEllipse *ell1 = new TEllipse(x0a, y0a, a, b, 0, 360, -beta);
1481  ell1->SetFillStyle(0);
1482  ell1->SetLineColor(4);
1483  ell1->Draw("SAME");
1484  TEllipse *ell2 = new TEllipse(x0b, y0b, a, b, 0, 360, -beta);
1485  ell2->SetFillStyle(0);
1486  ell2->SetLineColor(6);
1487  ell2->Draw("SAME");
1488 
1489  TMarker *mrkinta = new TMarker(intxa, intya, 20);
1490  mrkinta->SetMarkerColor(4);
1491  mrkinta->Draw("SAME");
1492  TMarker *mrkintb = new TMarker(intxb, intyb, 20);
1493  mrkintb->SetMarkerColor(6);
1494  mrkintb->Draw("SAME");
1495  // cin >> goOnChar;
1496  }
1497 
1498  // 5. calculate z coordinate for each intersection
1499 
1500  // calculate z0a, z0b of the center of the ellipse
1501  Double_t t = ((x0a + y0a) - (first.X() + first.Y())) / ((second.X() - first.X()) + (second.Y() - first.Y()));
1502  Double_t z0a = first.Z() + (second.Z() - first.Z()) * t;
1503  // cout << "0 : calculate t, z0a " << t << " " << z0a << endl;
1504 
1505  t = ((x0b + y0b) - (first.X() + first.Y())) / ((second.X() - first.X()) + (second.Y() - first.Y()));
1506  Double_t z0b = first.Z() + (second.Z() - first.Z()) * t;
1507 
1508  TVector3 center1(x0a, y0a, z0a);
1509  TVector3 center2(x0b, y0b, z0b);
1510  if(fDisplayOn) {
1511  char goOnChar;
1512  display->cd(3);
1513  // cout << "COMPUTE Z COORDINATE" << endl;
1514  RefreshZ();
1515  DrawZGeometry();
1516  TLine *linezx = new TLine(first.X(), first.Z(), second.X(), second.Z());
1517  linezx->Draw("SAME");
1518  TMarker *mrkza = new TMarker(x0a, z0a, 20);
1519  mrkza->SetMarkerColor(4);
1520  mrkza->Draw("SAME");
1521  TMarker *mrkzb = new TMarker(x0b, z0b, 20);
1522  mrkzb->SetMarkerColor(6);
1523  mrkzb->Draw("SAME");
1524  // cin >> goOnChar;
1525  }
1526 
1527  // calculate the z of the intersection ON the ellipse (CHECK this step calculations!)
1528  double dx = intxa - x0a;
1529  double dy = intya - y0a;
1530  TVector3 dxdy(dx, dy, 0.0);
1531 
1532  TVector3 tfirst = first + dxdy;
1533  TVector3 tsecond = second + dxdy;
1534 
1535  t = ((intxa + intya) - (tfirst.X() + tfirst.Y())) / ((tsecond.X() - tfirst.X()) + (tsecond.Y() - tfirst.Y()));
1536  double intza = tfirst.Z() + (tsecond.Z() - tfirst.Z()) * t;
1537  if(fDisplayOn) {
1538  char goOnChar;
1539  display->cd(3);
1540  TLine *linezx1 = new TLine(tfirst.X(), tfirst.Z(), tsecond.X(), tsecond.Z());
1541  linezx1->SetLineStyle(1);
1542  linezx1->Draw("SAME");
1543  TMarker *mrkza1 = new TMarker(intxa, intza, 20);
1544  mrkza1->SetMarkerColor(kBlue - 9);
1545  mrkza1->Draw("SAME");
1546  // cin >> goOnChar;
1547  }
1548 
1549  tfirst = first - dxdy;
1550  tsecond = second - dxdy;
1551 
1552  t = ((intxb + intyb) - (tfirst.X() + tfirst.Y())) / ((tsecond.X() - tfirst.X()) + (tsecond.Y() - tfirst.Y()));
1553  double intzb = tfirst.Z() + (tsecond.Z() - tfirst.Z()) * t;
1554 
1555  TVector3 fin_intersection1(intxa, intya, intza);
1556  TVector3 fin_intersection2(intxb, intyb, intzb);
1557 
1558  if(fDisplayOn) {
1559  char goOnChar;
1560  display->cd(3);
1561  TLine *linezx2 = new TLine(tfirst.X(), tfirst.Z(), tsecond.X(), tsecond.Z());
1562  linezx2->SetLineStyle(1);
1563  linezx2->Draw("SAME");
1564  TMarker *mrkzb1 = new TMarker(intxb, intzb, 20);
1565  mrkzb1->SetMarkerColor(kMagenta - 7);
1566  mrkzb1->Draw("SAME");
1567  // cin >> goOnChar;
1568  }
1569  // int1.SetXYZ(intxa, intya, intza);
1570  // int2.SetXYZ(intxb, intyb, intzb);
1571  // errz = fabs(intza - intzb)/2. ;
1572 
1573  // CHECK to be changed
1574  int trackID = 1;
1575  double phi1 = track->ComputePhi(fin_intersection1);
1576  double phi2 = track->ComputePhi(fin_intersection2);
1577 
1578  PndTrkSkewHit *skewhit = new PndTrkSkewHit(*hit, trackID, center1, fin_intersection1, phi1, center2, fin_intersection2, phi2, a, b, -1, beta);
1579  // skewhit->Print();
1580  skewhitlist.AddHit(skewhit);
1581 
1582 
1583  }
1584  // cout << "PHI: " << phimin << " " << phimax << endl;
1585  // cout << "Z : " << zmin << " " << zmax << endl;
1586 
1587 
1588  return skewhitlist;
1589 }
double dy
Double_t GetRadius()
Definition: PndTrkTrack.h:43
TTree * b
Double_t GetHalfLength()
Definition: PndSttTube.cxx:99
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
static T Sin(const T &x)
Definition: PndCAMath.h:42
void AddHit(PndTrkHit *hit)
double Y
Definition: anaLmdDigi.C:68
static T Cos(const T &x)
Definition: PndCAMath.h:43
PndTrkHit * GetHit(int index)
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
Double_t ComputePhi(TVector3 hit)
Int_t a
Definition: anaLmdDigi.C:126
Double_t
Double_t y0
Definition: checkhelixhit.C:71
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
TVector2 ComputeTangentInPoint(double xc, double yc, TVector2 point)
void DrawZGeometry(int whichone=1, double phimin=0, double phimax=360, double zmin=-43, double zmax=113)
PndTrkSttHitList * stthitlist
double dx
double X
Definition: anaLmdDigi.C:68
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t ComputeSegmentCircleIntersection(TVector2 ex1, TVector2 ex2, double xc, double yc, double R, TVector2 &intersection1, TVector2 &intersection2)
Definition: PndTrkTools.cxx:77
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
TTree * t
Definition: bump_analys.C:13
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Double_t Pi
#define SKEW_ANGLE
Int_t GetTubeID()
Definition: PndTrkHit.h:61
Double_t R
Definition: checkhelixhit.C:61
TVector3 GetWireDirection()
Definition: PndSttTube.cxx:107
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
PndTrkCluster PndTrkLegendreSecTask::CreateSttCluster ( PndTrkHit firsthit)

THE PROCEDURE

2) LOOP (int hit2) on all the hits a) consider only the ones in region iregion

2) LOOP (int hit3) on all the hits IN THE CLUSTER a) IF the hit2 you are considering in the region IS the one in the cluster (hit3), continue. ELSE try to associate it to one of the hits in the cluster (IsSttAssociate) b) if IsSttAssociate is true, add the hit2 to the cluster too.

Definition at line 1262 of file PndTrkLegendreSecTask.cxx.

References PndTrkCluster::AddHit(), Bool_t, PndTrkCluster::DeleteAllHits(), PndTrkHitList::GetHit(), PndTrkCluster::GetHit(), PndTrkHit::GetIRegion(), PndTrkHitList::GetNofHits(), PndTrkCluster::GetNofHits(), hit(), PndTrkHit::IsRegion(), IsSttAssociate(), PndTrkHit::IsUsed(), PndTrkCluster::SetIRegion(), stthitlist, and mrfdata_8b_error::success.

1262  {
1263 
1264 
1280  PndTrkCluster cluster;
1281  cluster.AddHit(firsthit);
1282  cluster.SetIRegion(firsthit->GetIRegion());
1283 
1284  // 2) LOOP on all the hits
1285  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1286  PndTrkHit *hit = stthitlist->GetHit(ihit);
1287 
1288  if(hit->IsUsed()) {
1289  // cout << "already used IV" << endl;
1290  continue;
1291  }
1292  if(!hit->IsRegion(firsthit->GetIRegion())) continue;
1293  // cout << ihit << " " << cluster.GetNofHits() << endl;
1294  // 3) LOOP (int hit3) on all the hits IN THE CLUSTER
1295  for(int jhit = 0; jhit < cluster.GetNofHits(); jhit++) {
1296  PndTrkHit *clushit = cluster.GetHit(jhit);
1297 
1298 
1299  if(*hit == *clushit) {
1300  continue;
1301  }
1302 
1303  Bool_t success = IsSttAssociate(hit, clushit);
1304  // cout << "success " << success << endl;
1305  if(!success) continue;
1306 
1307  cluster.AddHit(hit);
1308  break;
1309  }
1310  }
1311 
1312  if(cluster.GetNofHits() < 2) for(int ihit = 0; ihit < cluster.GetNofHits(); ihit++) cluster.DeleteAllHits();
1313  return cluster;
1314 }
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
void SetIRegion(int iregion)
Definition: PndTrkCluster.h:46
PndTrkHit * GetHit(int index)
Int_t GetIRegion()
Definition: PndTrkHit.h:64
Bool_t IsUsed()
Definition: PndTrkHit.h:58
PndTrkSttHitList * stthitlist
Bool_t IsSttAssociate(PndTrkHit *hit1, PndTrkHit *hit2)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Bool_t IsRegion(Int_t iregion)
Definition: PndTrkHit.h:65
Bool_t PndTrkLegendreSecTask::DoesConfHitBelong ( PndTrkConformalHit hit,
double  fitm,
double  fitp 
)

Definition at line 1055 of file PndTrkLegendreSecTask.cxx.

References fMvdPix_ConfDistLimit, fMvdPixelBranch, fMvdStr_ConfDistLimit, fMvdStripBranch, fStt_ConfDistLimit, fSttBranch, PndTrkConformalHit::GetDetectorID(), PndTrkConformalHit::GetDistanceFromTrack(), and PndTrkConformalHit::GetIsochrone().

Referenced by CreateClusterByDistance().

1055  {
1056  double dist = chit->GetDistanceFromTrack(fitm, fitp);
1057  int detID = chit->GetDetectorID();
1058  if(detID == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) {
1059  if(dist < fMvdPix_ConfDistLimit) return kTRUE;
1060  }
1061  else if(detID == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
1062  if(dist < fMvdStr_ConfDistLimit) return kTRUE;
1063  }
1064  else if(detID == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
1065  if(chit->GetIsochrone() > 1.e-4) {
1066  if(dist < (6 * chit->GetIsochrone())) return kTRUE;
1067  }
1068  else if(dist < fStt_ConfDistLimit) return kTRUE;
1069  }
1070 
1071  return kFALSE;
1072 }
Bool_t PndTrkLegendreSecTask::DoesRealHitBelong ( PndTrkHit hit,
double  x0,
double  y0,
double  R 
)

Definition at line 1039 of file PndTrkLegendreSecTask.cxx.

References fMvdPix_RealDistLimit, fMvdPixelBranch, fMvdStr_RealDistLimit, fMvdStripBranch, fStt_RealDistLimit, fSttBranch, PndTrkHit::GetDetectorID(), and PndTrkHit::GetXYDistanceFromTrack().

Referenced by CreateClusterByDistance().

1039  {
1040  double dist = hit->GetXYDistanceFromTrack(x0, y0, R);
1041  int detID = hit->GetDetectorID();
1042  if(detID == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch)) {
1043  if(dist < fMvdPix_RealDistLimit) return kTRUE;
1044  }
1045  else if(detID == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
1046  if(dist < fMvdStr_RealDistLimit) return kTRUE;
1047  }
1048  else if(detID == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
1049  if(dist < fStt_RealDistLimit) return kTRUE;
1050  }
1051  return kFALSE;
1052 }
Double_t x0
Definition: checkhelixhit.C:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
Double_t y0
Definition: checkhelixhit.C:71
Double_t GetXYDistanceFromTrack(double x0, double y0, double R)
Definition: PndTrkHit.cxx:105
Double_t R
Definition: checkhelixhit.C:61
void PndTrkLegendreSecTask::DontUseMvdPix ( )
inline

Definition at line 108 of file PndTrkLegendreSecTask.h.

References fUseMVDPix.

108 { fUseMVDPix = kFALSE; }
void PndTrkLegendreSecTask::DontUseMvdStr ( )
inline

Definition at line 109 of file PndTrkLegendreSecTask.h.

References fUseMVDStr.

109 { fUseMVDStr = kFALSE; }
void PndTrkLegendreSecTask::DontUseStt ( )
inline

Definition at line 110 of file PndTrkLegendreSecTask.h.

References fUseSTT.

110 { fUseSTT = kFALSE; }
void PndTrkLegendreSecTask::DrawConfHit ( double  x,
double  y,
double  r,
int  marker = 2 
)

Definition at line 1247 of file PndTrkLegendreSecTask.cxx.

References display.

Referenced by FillLegendreHisto().

1247  {
1248  display->cd(2);
1249  if(r >= 0) {
1250  TArc *arc = new TArc(u, v, r);
1251  arc->SetFillStyle(0);
1252  arc->Draw("SAME");
1253  }
1254  else {
1255  TMarker *mrk = new TMarker(u, v, marker);
1256  mrk->Draw("SAME");
1257  }
1258  // display->Update();
1259  // display->Modified();
1260 }
double r
Definition: RiemannTest.C:14
__m128 v
Definition: P4_F32vec4.h:4
void PndTrkLegendreSecTask::DrawGeometry ( )

Definition at line 1144 of file PndTrkLegendreSecTask.cxx.

References display, and hxy.

Referenced by Refresh().

1144  {
1145  if(hxy == NULL) hxy = new TH2F("hxy", "xy plane", 100, -43, 43, 100, -43, 43);
1146  else hxy->Reset();
1147  display->cd(1);
1148  hxy->Draw();
1149  display->Update();
1150  display->Modified();
1151 
1152 }
void PndTrkLegendreSecTask::DrawGeometryConf ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 1202 of file PndTrkLegendreSecTask.cxx.

References display, and huv.

Referenced by PrepareLegendre(), and RePrepareLegendre().

1202  {
1203  // CHECK
1204  char goOnChar;
1205  // cout << "DRAWING GEOMETRY CONF" << endl;
1206  // cin >> goOnChar;
1207 
1208  // CHECK previous calculations, now not used;
1209  if(huv == NULL) huv = new TH2F("huv", "uv plane", 100, x1, y1, 100, x2, y2);
1210  else {
1211  huv->Reset();
1212  huv->GetXaxis()->SetLimits(x1, y1);
1213  huv->GetYaxis()->SetLimits(x2, y2);
1214  }
1215  display->cd(2);
1216  huv->Draw();
1217  display->Update();
1218  display->Modified();
1219 
1220 }
void PndTrkLegendreSecTask::DrawHits ( PndTrkHitList hitlist)

Definition at line 1196 of file PndTrkLegendreSecTask.cxx.

References display, and PndTrkHitList::Draw().

Referenced by Refresh().

1196  {
1197  display->cd(1);
1198  hitlist->Draw();
1199  display->Update();
1200  display->Modified();
1201 }
void Draw(Color_t color=kBlack)
void PndTrkLegendreSecTask::DrawLegendreHisto ( )

Definition at line 1223 of file PndTrkLegendreSecTask.cxx.

References display, PndTrkLegendreTransform::Draw(), and legendre.

Referenced by ExtractLegendre().

1223  {
1224  display->cd(3);
1225  legendre->Draw();
1226  display->Update();
1227  display->Modified();
1228 }
PndTrkLegendreTransform * legendre
void PndTrkLegendreSecTask::DrawZGeometry ( int  whichone = 1,
double  phimin = 0,
double  phimax = 360,
double  zmin = -43,
double  zmax = 113 
)

Definition at line 1154 of file PndTrkLegendreSecTask.cxx.

References display, hxz, and hzphi.

Referenced by CleanUpSkewHitList(), CreateSkewHitList(), Exec(), and ZPhiFit().

1155 {
1156  if(hxz == NULL) hxz = new TH2F("hxz", "xz plane", 100, -43, 43, 100, -43, 113);
1157  else hxz->Reset();
1158  display->cd(3);
1159  hxz->Draw();
1160  if(whichone == 2) {
1161  if(hzphi == NULL) hzphi = new TH2F("hzphi", "z - phi plane", phimax - phimin, phimin, phimax, zmax - zmin, zmin, zmax);
1162  else {
1163  hzphi->Reset();
1164  hzphi->GetXaxis()->SetLimits(phimin, phimax);
1165  hzphi->GetYaxis()->SetLimits(zmin, zmax);
1166  }
1167  display->cd(4);
1168  hzphi->Draw();
1169  }
1170  display->Update();
1171  display->Modified();
1172 
1173 }
void PndTrkLegendreSecTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 195 of file PndTrkLegendreSecTask.cxx.

References PndTrkClusterList::AddCluster(), PndTrkCluster::AddHit(), ApplyLegendre(), Bool_t, Cleanup(), CleanUpSkewHitList(), CleanupZPhiFit(), PndTrkTrack::ComputeCharge(), PndTrkTrack::ComputePhi(), ComputeTraAndRot(), conform, conformalhitlist, CreateClusterByDistance(), CreateSkewHitList(), display, PndTrkCluster::DoesContain(), Double_t, PndTrkTrack::Draw(), PndTrkHit::Draw(), PndTrkSttHitList::DrawSector(), DrawZGeometry(), PndTrkLegendreTransform::ExtractLegendreSingleLineParameters(), fabs(), fDisplayOn, fEventCounter, fFitter, FillConformalHitList(), FindSttReferenceHit(), fMvdPixelBranch, fMvdPixelHitArray, fMvdStripBranch, fMvdStripHitArray, fRefHit, FromConformalToRealTrack(), fSecondary, fSttBranch, fSttHitArray, fTime, fTimer, fTrackArray, fTrackCandArray, fVerbose, PndTrkTrack::GetCharge(), PndTrkTrack::GetCluster(), PndTrkConformalTransform::GetConformalHit(), PndTrkConformalTransform::GetConformalSttHit(), PndTrkHit::GetDetectorID(), PndTrkCluster::GetHit(), PndTrkSkewHit::GetIntersection1(), PndTrkSkewHit::GetIntersection2(), PndTrkConformalHit::GetIsochrone(), PndTrkCluster::GetNofHits(), PndTrkSttHitList::GetNofHitsInSector(), PndTrkSkewHit::GetPhi1(), PndTrkSkewHit::GetPhi2(), PndTrkHit::GetPosition(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), hzphi, Initialize(), isec, legendre, LightCluster(), phi, Pi, PndTrkSttHitList::PrintSector(), R, Refresh(), RefreshZ(), RegisterTrack(), PndTrkCluster::Replace(), PndTrkFitter::Reset(), Reset(), PndTrkConformalTransform::SetOrigin(), PndTrkHit::SetPhi(), PndTrkFitter::SetPointToFit(), PndTrkHit::SetPosition(), PndTrkHit::SetSortVariable(), PndTrkTrack::SetTanL(), PndTrkTrack::SetZ0(), sigma, PndTrkCluster::Sort(), CAMath::Sqrt(), PndTrkFitter::StraightLineFit(), stthitlist, track, Z, and ZPhiFit().

195  {
196  fTrackArray->Delete();
197  fTrackCandArray->Delete();
198  if(fVerbose > 0) cout << "*********************** " << fEventCounter << " ***********************" << endl;
199  // CHECK delete this ---
200  // if(fEventCounter == 126 || fEventCounter == 526) {
201  // fEventCounter++;
202  // return;
203  // }
204  // ---
205  fEventCounter++;
206 
207  // CHECK : it may happen that the hit of a track generate more than one track; e.g.
208  // some of them are associated together to form a track, some are left out. If later the left outs
209  // result in a new peak, this new peak will have also the old, already used hits, associated to it.
210  // This happens since the used hits do not enter the new legendre transform, but can be associated
211  // to the found cluster with the distance criterion. In this way the final cluster, which then is
212  // fitted again with the mvd in the legendre plane, will give an existing peak.
213 
214  // This results in an infinite loop ---> FIX IT! (how: timeout? better hit-to-cluster association?
215  // forbidden peak positions in legendre transform?)
216 
217  // CHECK THIS!
218  if(fSttHitArray->GetEntriesFast() < 3) {
219  // Reset();
220  return;
221  }
222 
223  Initialize();
224  if(fVerbose > 1) {
225  cout << "number of stt hits " << fSttHitArray->GetEntriesFast() << endl;
226  cout << "number of mvdpix hits " << fMvdPixelHitArray->GetEntriesFast() << endl;
227  cout << "number of mvdstr hits " << fMvdStripHitArray->GetEntriesFast() << endl;
228  }
229 
230  PndTrkClusterList *clusterlist = new PndTrkClusterList();
231 
232  for(int isec = 0; isec < 6; isec++) {
233  if(stthitlist->GetNofHitsInSector(isec) == 0) continue;
235  if(fDisplayOn) {
236  Refresh();
237  char goOnChar;
238  // cout << "Start?";
239  // cin >> goOnChar;
240  display->Update();
241  display->Modified();
242  cout << " STARTING" << endl;
243 
244 
245 
246 
247  cin >> goOnChar;
248  stthitlist->DrawSector(isec, kGreen);
250  display->Update();
251  display->Modified();
252  cout << " STARTING" << endl;
253 
254 
255 
256 
257  }
258 
259  // translation and rotation - CHECK no rotation now
260  Double_t delta = 0, trasl[2] = {0., 0.};
261  if(!fSecondary) {
262  conform->SetOrigin(trasl[0], trasl[1], delta);
263  Int_t nchits = FillConformalHitList(isec);
264  // if(nchits == 0) return; // CHECK
265  // cout << nchits << " " << trasl[0] << " " << trasl[1] << " " << delta << endl;
266  }
267 
268  int maxpeak = 1000;
269  int ipeak = 0;
270 // PndTrkClusterList *clusterlist = new PndTrkClusterList();
271  std::vector< std::pair<double, double> > foundpeaks;
272 
273 
274  // LOOP OVER PEAKS UNTILL ITS HEIGHT IS <= 3
275  fTimer = new TStopwatch();
276  fTimer->Start();
277  fTime = 0;
278  while(maxpeak > 3) {
279 
280  // TIME
281  if(fDisplayOn == kFALSE) {
282  fTimer->Stop();
283  fTime += fTimer->RealTime();
284  if(fTime > 1.5) {
285  if(fVerbose > 0) cerr << fTime << endl;
286  // Reset(); // CHECK
287  break; // return; // CHECK
288  }
289  fTimer->Start();
290  }
291  //
292 
293  if(fSecondary) {
294 
295  // translation and rotation - CHECK
297  if(fVerbose > 1) cout << "refhit " << fRefHit << endl;
298  if(fRefHit == NULL) {
299  // Reset(); // CHECK
300  break; // return; // CHECK
301  }
302  ComputeTraAndRot(fRefHit, delta, trasl);
303  conform->SetOrigin(trasl[0], trasl[1], delta);
304  Int_t nchits = FillConformalHitList(isec);
305  // if(nchits == 0) return; // CHECK
306  if(fVerbose > 1) cout << nchits << " " << trasl[0] << " " << trasl[1] << " " << delta << endl;
307  }
308 
309  PndTrkCluster cluster;
310 
311  if(fDisplayOn) {
312  Refresh();
313  char goOnChar;
314  cout << endl;
315  cout << "Next peak? ";
316  cin >> goOnChar;
317  display->Update();
318  display->Modified();
319  }
320 
321  if(fVerbose > 1) cout << "@@@@ PEAK No. " << ipeak << " @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
322  ipeak++;
323 
324  // APPLY LEGENDRE TO STT ALONE
325  // -------------------------------------------------------
326 
327  double theta_max, r_max;
328  maxpeak = ApplyLegendre(theta_max, r_max);
329  if(maxpeak <= 3) break;
330 
331  double fitm, fitq;
333 
334  // ADD HITS TO CLUSTER: PIXEL, STRIP AND STT PARALLEL
335  // -------------------------------------------------------
336  // method of hit-to-track association:
337  // 0 conformal: mvd and stt in conformal plane
338  // 1 real: mvd and stt in real plane
339  // 2 mixed: mvd in real/stt in conformal plane
340  int method = 0;
341  cluster = CreateClusterByDistance(method, fitm, fitq);
342 
343  // APPLY LEGENDRE TO CLUSTER + MVD
344  // -------------------------------------------------------
345 
346  maxpeak = ApplyLegendre(&cluster, theta_max, r_max);
347 
348 
349  // CLEANUP
350  // -------------------------------------------------------
351  PndTrkCluster cleancluster = Cleanup(cluster);
352  cluster = cleancluster;
353 
354 
355  // FIT WITH LEAST SQUARE STRAIGHT LINE
356  // -------------------------------------------------------
357 
358 
359  double fitm2, fitq2;
360  fFitter->Reset();
361 
362  for(int ihit = 0; ihit < cluster.GetNofHits(); ihit++)
363  {
364  PndTrkHit *hit = cluster.GetHit(ihit);
365  double conformal[3];
366 
367  PndTrkConformalHit *chit = NULL;
368  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) chit = conform->GetConformalSttHit(hit);
369  else chit = conform->GetConformalHit(hit);
370 
371  double xi1 = chit->GetU() + fitm * chit->GetIsochrone()/ TMath::Sqrt(fitm * fitm + 1);
372  double yi1 = chit->GetV() - chit->GetIsochrone() / TMath::Sqrt(fitm * fitm + 1);
373 
374  double xi2 = chit->GetU() - fitm * chit->GetIsochrone() / TMath::Sqrt(fitm * fitm + 1);
375  double yi2 = chit->GetV() + chit->GetIsochrone()/ TMath::Sqrt(fitm * fitm + 1);
376 
377  double xi = 0, yi = 0;
378 
379  fabs(yi1 - (fitm * xi1 + fitq)) < fabs(yi2 - (fitm * xi2 + fitq)) ? (yi = yi1, xi = xi1) : (yi = yi2, xi = xi2);
380 
381  double sigma = chit->GetIsochrone();
382  fFitter->SetPointToFit(xi, yi, sigma);
383 
384  if(fDisplayOn) {
385  display->cd(2);
386  TMarker *mrk = new TMarker(xi, yi, 6);
387  mrk->Draw("SAME");
388  }
389  }
390 
391  fFitter->StraightLineFit(fitm2, fitq2);
392 
393 
394  if(fDisplayOn) {
395  char goOnChar;
396  display->cd(2);
397  TLine *line = new TLine(-0.07, fitq + fitm * (-0.07), 0.07, fitq + fitm * (0.07));
398  line->Draw("SAME");
399  TLine *line2 = new TLine(-0.07, fitq2 + fitm2 * (-0.07), 0.07, fitq2 + fitm2 * (0.07));
400  line2->SetLineColor(2);
401  line2->Draw("SAME");
402 
403  display->Update();
404  display->Modified();
405  // cin >> goOnChar;
406  }
407 
408  fitm = fitm2;
409  fitq = fitq2;
410 
411 
412 
413 
414  // -------------------------------------------------------
415  if(cluster.GetNofHits() > 3) {
416  if(fVerbose > 1) cout << "ADDING CLUSTER WITH " << cluster.GetNofHits() << " hits " << endl;
417  clusterlist->AddCluster(&cluster);
418  }
419  else {
420  maxpeak = -1;
421  if(fVerbose > 1) cout << "MAXPEAK " << maxpeak << endl;
422  continue;
423  }
424  if(fDisplayOn) {
425  char goOnChar;
426  display->cd(1);
427  LightCluster(&cluster);
428  cout << "waiting 2 " << endl;
429  cin >> goOnChar;
430  }
431 
432  // center and radius
433  Double_t xc, yc, R;
434  FromConformalToRealTrack(fitm, fitq, xc, yc, R);
435  if(fVerbose > 1) cout << "XR, YC, R: " << xc << " " << yc << " " << R << endl;
436 
437  PndTrkTrack *track = new PndTrkTrack(&cluster, xc, yc, R);
438 
439  if(fDisplayOn) {
440  display->cd(1);
441  track->Draw(kRed);
442  display->Update();
443  display->Modified();
444  char goOnChar;
445  cout << "waiting 3 " << endl;
446  cin >> goOnChar;
447  }
448 
449 
450  // SKEWED ASSOCIATION ********* CHECK *********
451  // -------------------------------------------------------
452  if(fVerbose > 1) cout << "%%%%%%%%%%%%%%%%%%%% ZFINDER %%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
453 
454  if(fDisplayOn) {
455  RefreshZ();
456  DrawZGeometry(2);
457  }
458  PndTrkCluster skewhitlist = CreateSkewHitList(track);
459  skewhitlist = CleanUpSkewHitList(&skewhitlist);
460 
461  int iz = -1, jz = -1;
462  // cout << "##################### CHOOSE Z" << endl;
463 
464  // 7. select which intersection is the most likely and add it to z fitting
465  fFitter->Reset();
466  for(int ihit = 0; ihit < skewhitlist.GetNofHits() - 1; ihit++) {
467  PndTrkSkewHit *skewhit1 = (PndTrkSkewHit*) skewhitlist.GetHit(ihit);
468  if(!skewhit1) continue;
469  TVector3 fin_intersection1[2] = {skewhit1->GetIntersection1(), skewhit1->GetIntersection2()};
470  double phi1[2] = {skewhit1->GetPhi1(), skewhit1->GetPhi2()};
471 
472  int jhit = ihit + 1;
473  PndTrkSkewHit *skewhit2 = (PndTrkSkewHit*) skewhitlist.GetHit(jhit);
474  if(!skewhit2) continue;
475  TVector3 fin_intersection2[2] = {skewhit2->GetIntersection1(), skewhit2->GetIntersection2()};
476  double phi2[2] = {skewhit2->GetPhi1(), skewhit2->GetPhi2()};
477 
478  // cout << "start from " << ihit << " " << jhit << ": " << iz << " " << jz << endl;
479  if(jz != -1) {
480  iz = jz;
481  double distance = fabs(fin_intersection1[iz].Z() - fin_intersection2[0].Z());
482  jz = 0;
483  // 11 22
484  fabs(fin_intersection1[iz].Z() - fin_intersection2[1].Z()) < distance ? (distance = fabs(fin_intersection1[iz].Z() - fin_intersection2[1].Z()), jz = 1) : distance;
485  }
486  else {
487  // 11 21
488  double distance = fabs(fin_intersection1[0].Z() - fin_intersection2[0].Z());
489  iz = 0;
490  jz = 0;
491  // 11 22
492  fabs(fin_intersection1[0].Z() - fin_intersection2[1].Z()) < distance ? (distance = fabs(fin_intersection1[0].Z() - fin_intersection2[1].Z()), iz = 0, jz = 1 ): distance;
493  // 12 21
494  fabs(fin_intersection1[1].Z() - fin_intersection2[0].Z()) < distance ? (distance = fabs(fin_intersection1[1].Z() - fin_intersection2[0].Z()), iz = 1, jz = 0) : distance;
495  // 12 22
496  fabs(fin_intersection1[1].Z() - fin_intersection2[1].Z()) < distance ? (distance = fabs(fin_intersection1[1].Z() - fin_intersection2[1].Z()), iz = 1, jz = 1): distance;
497  }
498  // cout << "end with " << ihit << " " << jhit << ": " << iz << " " << jz << endl;
499 
500  fFitter->SetPointToFit(phi1[iz], fin_intersection1[iz].Z(), 1.);// (fin_intersection1[0].Z() + fin_intersection1[1].Z())/2.); // CHECK sigma?
501 
502  // CHECK
503  if(iz == 0) skewhit1->SetPosition(skewhit1->GetIntersection1());
504  else skewhit1->SetPosition(skewhit1->GetIntersection2());
505 
506  // CHECK last point?
507  if(ihit == skewhitlist.GetNofHits() - 2) {
508  fFitter->SetPointToFit(phi2[jz], fin_intersection2[jz].Z(), 1.);// (fin_intersection2[0].Z() + fin_intersection2[1].Z())/2.); // CHECK sigma?
509 
510  // CHECK
511  if(jz == 0) skewhit2->SetPosition(skewhit2->GetIntersection1());
512  else skewhit2->SetPosition(skewhit2->GetIntersection2());
513  }
514 
515 
516  if(fDisplayOn) {
517  char goOnChar;
518  display->cd(4);
519  TMarker *mrkfoundzphi1 = new TMarker(phi1[iz], fin_intersection1[iz].Z(), 20);
520  mrkfoundzphi1->SetMarkerColor(kYellow);
521  mrkfoundzphi1->Draw("SAME");
522 
523  TMarker *mrkfoundzphi2 = new TMarker(phi2[jz], fin_intersection2[jz].Z(), 20);
524  mrkfoundzphi2->SetMarkerColor(kYellow);
525  mrkfoundzphi2->Draw("SAME");
526 
527  display->Update();
528  display->Modified();
529  // cin >> goOnChar;
530  }
531  }
532 
533 
534  // ADD MVD POINTS ==================== RECHECK
535  PndTrkCluster *mvdcluster = track->GetCluster();
536  for(int ihit = 0; ihit < mvdcluster->GetNofHits(); ihit++) {
537  // cout << ihit << " TROVATO " << endl;
538  PndTrkHit *hit = mvdcluster->GetHit(ihit);
539  if(hit->GetDetectorID() != FairRootManager::Instance()->GetBranchId(fMvdPixelBranch) && hit->GetDetectorID() != FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) continue;
540  TVector3 position = hit->GetPosition();
541  double phi = track->ComputePhi(position);
542  hit->SetPhi(phi);
543  // cout << ihit << " TROVATO " << phi << " " << position.Z() << endl;
544 
545  if(fDisplayOn) {
546  char goOnChar;
547  display->cd(4);
548  TMarker *mrkfoundzphi = new TMarker(phi, position.Z(), 21);
549  mrkfoundzphi->SetMarkerColor(kOrange);
550  mrkfoundzphi->Draw("SAME");
551  display->Update();
552  display->Modified();
553  // cin >> goOnChar;
554  }
555  fFitter->SetPointToFit(phi, position.Z(), 0.1); // CHECK ERROR
556  }
557  // ===================================
558 
559 
560  Double_t ml, pl;
561  Bool_t straightlinefit = fFitter->StraightLineFit(ml, pl);
562 
563 
564  // CHECK the following fit: if it fails, put the hits into play again?
565  if(straightlinefit = kTRUE) {
566 
567  if(fDisplayOn) {
568  char goOnChar;
569  display->cd(4);
570  TLine *l222 = new TLine(-1000, -1000 * ml + pl, 1000, 1000 * ml + pl);
571  l222->Draw("SAME");
572  display->cd(3);
573  l222->Draw("SAME");
574  display->Update();
575  display->Modified();
576  // cin >> goOnChar;
577  }
578 
579  PndTrkCluster *trkcluster = track->GetCluster();
580  // 8. last association z --> HIT: fill position and add to cluster ???? CHECK
581  for(int ihit = 0; ihit < skewhitlist.GetNofHits(); ihit++) {
582  PndTrkSkewHit *skewhit = (PndTrkSkewHit*) skewhitlist.GetHit(ihit);
583  if(trkcluster->DoesContain(skewhit) == kTRUE) {
584  trkcluster->Replace(skewhit);
585  }
586  else trkcluster->AddHit(skewhit);
587  TVector3 intersection1 = skewhit->GetIntersection1();
588  double phi1 = track->ComputePhi(intersection1);
589  double calcz1 = ml * phi1 + pl;
590  TVector3 intersection2 = skewhit->GetIntersection2();
591  double phi2 = track->ComputePhi(intersection2);
592  double calcz2 = ml * phi2 + pl;
593 
594  fabs(intersection1.Z() - calcz1) < fabs(intersection2.Z() - calcz2) ? skewhit->SetPosition(intersection1) : skewhit->SetPosition(intersection2);
595 
596  }
597 
598 
599  // 9. add skewedhitlist to cluster of the track
600  // fill the last two (missing) parameters
601  for(int ihit = 0; ihit < trkcluster->GetNofHits(); ihit++) {
602  PndTrkHit *hit = trkcluster->GetHit(ihit);
603  double phi = track->ComputePhi(hit->GetPosition()); // CHECK is it neede to recalculate it?
604  hit->SetSortVariable(phi);
605  hit->SetPhi(phi);
606 
607  }
608  trkcluster->Sort();
609  track->ComputeCharge();
610 
611  // 10. z-phi refit
612  Bool_t zfit = ZPhiFit(0, trkcluster, ml, pl);
613  // cout << "zfit1 on " << trkcluster->GetNofHits() << " hits/ " << zfit << " " << ml << " " << pl << " tanl " << - track->GetCharge() * ml * (180./TMath::Pi())/R << endl;
614 
615  PndTrkCluster *tmpcluster = CleanupZPhiFit(trkcluster, ml, pl);
616  trkcluster = tmpcluster;
617 
618  if(fDisplayOn) {
619  char goOnChar;
620  display->cd(4);
621  DrawZGeometry();
622  hzphi->SetXTitle("#phi");
623  hzphi->SetYTitle("#z");
624  hzphi->Draw();
625  display->Update();
626  display->Modified();
627  }
628 
629  zfit = ZPhiFit(1, trkcluster, ml, pl);
630 
631  // 11. fill the last two (missing) parameters
632 
633  // tanl = -q ml (180/pi) /R: See PndTrkTrack.h for an explanation
634 
635  if(zfit) {
636  track->SetTanL(- track->GetCharge() * ml * (180./TMath::Pi())/R);
637  track->SetZ0(pl);
638  }
639  else { // CHECK put these in default
640  track->SetTanL(-999);
641  track->SetZ0(-999);
642  }
643  // cout << "GET TANL " << ml << " " << R << " " << track->GetTanL() << endl;
644 
645  // test -------------------------------------------------------
646  PndTrkCluster *trkcluster2 = track->GetCluster();
647  // trkcluster2->Print();
648 
649  if(fDisplayOn) {
650  char goOnChar;
651  display->cd(1);
652  Refresh();
653  for(int ihit = 0; ihit < trkcluster2->GetNofHits(); ihit++) {
654  PndTrkHit *hit = trkcluster2->GetHit(ihit);
655  hit->Draw(kMagenta);
656 
657  display->Update();
658  display->Modified();
659  // cin >> goOnChar;
660  }
661  }
662  }
663  else { // CHECK put these in default
664  track->SetTanL(-999);
665  track->SetZ0(-999);
666  }
667  // ------------------------------------------------------- end test
668 
669  // TRANSFORM TO PNDTRACK AND PNDTRACKCAND
670  // -------------------------------------------------------
671  RegisterTrack(track);
672  if(fVerbose > 1) cout << "MAXPEAK " << maxpeak << endl;
673  }
674  if(fDisplayOn) {
675  char goOnChar;
676  display->Update();
677  display->Modified();
678  cout << "Finish? ";
679  cin >> goOnChar;
680  cout << "FINISH" << endl;
681  }
682 }
683  Reset();
684  delete clusterlist;
685 
686 
687  }
PndTrkCluster Cleanup(PndTrkCluster cluster)
int fVerbose
Definition: poormantracks.C:24
void Replace(PndTrkHit *hit)
void LightCluster(PndTrkCluster *cluster)
PndTrkCluster CleanUpSkewHitList(PndTrkCluster *skewhitlist)
Double_t GetPhi1()
Definition: PndTrkSkewHit.h:37
PndRiemannTrack track
Definition: RiemannTest.C:33
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
PndTrkHit * FindSttReferenceHit(int isec=-1)
PndTrkCluster GetCluster()
Definition: PndTrkTrack.h:48
void SetTanL(double tanl)
Definition: PndTrkTrack.h:39
PndTrkCluster CreateClusterByDistance(Int_t mode, double fitm, double fitq)
PndTrkConformalHitList * conformalhitlist
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
void SetPhi(Double_t phi)
Definition: PndTrkHit.h:48
int GetNofHitsInSector(int isec)
void SetSortVariable(Double_t sortvar)
Definition: PndTrkHit.h:44
void AddHit(PndTrkHit *hit)
TVector3 GetIntersection2()
Definition: PndTrkSkewHit.h:35
PndTrkConformalTransform * conform
PndTrkCluster * CleanupZPhiFit(PndTrkCluster *cluster, double fitm, double fitp)
PndTrkHit * GetHit(int index)
void AddCluster(PndTrkCluster *cluster)
void RegisterTrack(PndTrkTrack *track)
Double_t ComputePhi(TVector3 hit)
int isec
Definition: f_Init.h:19
void ComputeCharge()
Int_t GetCharge()
Definition: PndTrkTrack.h:57
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
PndTrkCluster CreateSkewHitList(PndTrkTrack *track)
Double_t GetPhi2()
Definition: PndTrkSkewHit.h:38
Double_t
PndTrkConformalHit GetConformalHit(PndTrkHit *hit)
Int_t ApplyLegendre(double &theta_max, double &r_max)
TVector3 GetPosition()
Definition: PndTrkHit.h:62
void SetPosition(TVector3 pos)
Definition: PndTrkHit.h:47
PndTrkLegendreTransform * legendre
void PrintSector(int isec)
void SetOrigin(double x, double y, double delta)
void Draw(Color_t color=kBlack)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void ExtractLegendreSingleLineParameters(double &slope, double &intercept)
void DrawZGeometry(int whichone=1, double phimin=0, double phimax=360, double zmin=-43, double zmax=113)
PndTrkSttHitList * stthitlist
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
void ComputeTraAndRot(PndTrkHit *hit, Double_t &delta, Double_t trasl[2])
void Draw(Color_t color)
Definition: PndTrkHit.cxx:109
Bool_t DoesContain(PndTrkHit *hit)
TVector3 GetIntersection1()
Definition: PndTrkSkewHit.h:34
Bool_t StraightLineFit(Double_t &fitm, Double_t &fitp)
void SetZ0(double z0)
Definition: PndTrkTrack.h:40
PndTrkConformalHit GetConformalSttHit(PndTrkHit *hit)
double Z
Definition: anaLmdDigi.C:68
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Int_t FillConformalHitList(int isec=-1)
Double_t Pi
Bool_t ZPhiFit(int iter, PndTrkCluster *cluster, double &fitm, double &fitp)
Double_t R
Definition: checkhelixhit.C:61
void SetPointToFit(double x, double y, double sigma)
void DrawSector(int isec, Color_t color=kBlack)
Int_t PndTrkLegendreSecTask::ExtractLegendre ( Int_t  mode,
double &  theta_max,
double &  r_max 
)

Definition at line 1891 of file PndTrkLegendreSecTask.cxx.

References conformalhitlist, PndTrkLegendreTransform::DeleteZoneAroundXYLegendre(), PndTrkLegendreTransform::DeleteZoneAroundXYZoom(), display, DrawLegendreHisto(), PndTrkLegendreTransform::DrawZoom(), PndTrkLegendreTransform::ExtractLegendreMaximum(), PndTrkLegendreTransform::ExtractZoomMaximum(), fDisplayOn, fFoundPeaks, PndTrkLegendreTransform::FillZoomHisto(), fVerbose, PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), legendre, PndTrkLegendreTransform::SetUpZoomHisto(), and tr.

Referenced by ApplyLegendre().

1891  {
1892  if(fDisplayOn) {
1893  char goOnChar;
1894  // cin >> goOnChar;
1896  // cout << "LEGENDRE (nof conf hits = " << conformalhitlist->GetNofHits() << ")" << endl;
1897  display->cd();
1898  // cin >> goOnChar;
1899  display->Update();
1900  display->Modified();
1901  }
1902 
1903  // FIND MAXIMUM IN LEGENDRE HISTO
1904 
1905  // legendre->ApplyThresholdLegendreHisto(0.3);
1906  int maxpeak = legendre->ExtractLegendreMaximum(theta_max, r_max);
1907 
1908  bool alreadythere = false;
1909  if(mode == 0) {
1910 
1911  if(maxpeak <= 3) {
1912  if(fVerbose > 1) cout << "MAXPEAK " << maxpeak << ", BREAK NOW! " << endl;
1913  return maxpeak;
1914  }
1915 
1916  for(int ialready = 0; ialready < fFoundPeaks.size(); ialready++) {
1917  std::pair<double, double> foundthetar = fFoundPeaks.at(ialready);
1918  double foundtheta = foundthetar.first;
1919  double foundr = foundthetar.second;
1920  // IF THIS PEAK WAS ALREADY FOUND, DELETE THE PEAK AND GO ON (TO AVOID INFINITE LOOPS)
1921  if(theta_max == foundtheta && r_max == foundr) {
1922  legendre->DeleteZoneAroundXYLegendre(theta_max, r_max);
1923  maxpeak = legendre->ExtractLegendreMaximum(theta_max, r_max);
1924  alreadythere = true;
1925  if(fVerbose > 0) cout << "OH NO! THIS PEAK IS ALREADY THERE" << endl;
1926  return -1;
1927  }
1928  }
1929 
1930  if(alreadythere == false) {
1931  std::pair<double, double> tr(theta_max, r_max);
1932  fFoundPeaks.push_back(tr);
1933  }
1934  }
1935  // ZOOM LEGENDRE HISTO
1936  legendre->SetUpZoomHisto(theta_max, r_max, 3, 0.005);
1937  // cout << "THETA/R " << theta_max << " " << r_max << " maxpeak " << maxpeak << endl;
1938 
1939  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
1941  legendre->FillZoomHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone());
1942  }
1943 
1944  if(mode == 0 && alreadythere == true) {
1945  cout << "THIS PEAK IS ALREADY THERE" << endl;
1946  legendre->DeleteZoneAroundXYZoom(theta_max, r_max);
1947  }
1948 
1949  int maxpeakzoom = legendre->ExtractZoomMaximum(theta_max, r_max);
1950  // cout << "THETA/R ZOOM " << theta_max << " " << r_max << " maxpeakzoom " << maxpeakzoom << endl;
1951 
1952  if(fDisplayOn) {
1953  char goOnChar;
1954  display->cd(3);
1955  TMarker *mrk = new TMarker(theta_max, r_max, 29);
1956  mrk->Draw("SAME");
1957  display->cd(4);
1958  legendre->DrawZoom();
1959  mrk->Draw("SAME");
1960  display->Update();
1961  display->Modified();
1962  // cin >> goOnChar;
1963  }
1964 
1965  return maxpeak;
1966 }
int fVerbose
Definition: poormantracks.C:24
void SetUpZoomHisto(double theta, double r, double deltatheta, double deltar)
PndTrkConformalHitList * conformalhitlist
void DeleteZoneAroundXYLegendre(double x, double y)
int ExtractLegendreMaximum(double &theta_max, double &r_max)
Int_t mode
Definition: autocutx.C:47
std::vector< std::pair< double, double > > fFoundPeaks
PndTrkConformalHit * GetHit(int index)
int ExtractZoomMaximum(double &theta_max, double &r_max)
void FillZoomHisto(double x, double y, double radius)
PndTrkLegendreTransform * legendre
void DeleteZoneAroundXYZoom(double x, double y)
Int_t PndTrkLegendreSecTask::FillConformalHitList ( int  isec = -1)

Definition at line 716 of file PndTrkLegendreSecTask.cxx.

References PndTrkConformalHitList::AddHit(), conform, conformalhitlist, PndTrkConformalTransform::GetConformalHit(), PndTrkConformalTransform::GetConformalSttHit(), PndTrkHitList::GetHit(), PndTrkSttHitList::GetHitFromSector(), PndTrkHitList::GetNofHits(), PndTrkConformalHitList::GetNofHits(), PndTrkSttHitList::GetNofHitsInSector(), hit(), mvdpixhitlist, mvdstrhitlist, PndTrkConformalHitList::Reset(), PndTrkConformalHitList::SetConformalTransform(), and stthitlist.

Referenced by Exec().

716  {
718 
720 
721  // FILL ONCE FOR ALL THE CONFORMAL HIT LIST
722  for(int jhit = 0; jhit < mvdpixhitlist->GetNofHits(); jhit++) {
723  PndTrkHit *hit = mvdpixhitlist->GetHit(jhit);
725  conformalhitlist->AddHit(chit);
726  }
727  for(int jhit = 0; jhit < mvdstrhitlist->GetNofHits(); jhit++) {
728  PndTrkHit *hit = mvdstrhitlist->GetHit(jhit);
730  conformalhitlist->AddHit(chit);
731  }
732 
733  if(isec == -1) {
734  for(int jhit = 0; jhit < stthitlist->GetNofHits(); jhit++) {
735  PndTrkHit *hit = stthitlist->GetHit(jhit);
736  // if(hit->IsSttSkew()) {
737 // // continue;
738 // PndTrkConformalHit * chit = conform->GetConformalHit(hit);
739 // conformalhitlist->AddHit(chit);
740 // }
741 // else {
742 // PndTrkConformalHit * chit = conform->GetConformalSttHit(hit);
743 // conformalhitlist->AddHit(chit);
744 // }
746  conformalhitlist->AddHit(chit);
747  }
748  }
749  else {
750  for(int jhit = 0; jhit < stthitlist->GetNofHitsInSector(isec); jhit++) {
751  PndTrkHit *hit = stthitlist->GetHitFromSector(jhit, isec);
752  // cout << "fil conformal " << hit->GetHitID() << " " << hit->GetDetectorID() << endl;
753  // if(hit->IsSttSkew()) {
754 // // continue;
755 // PndTrkConformalHit * chit = conform->GetConformalHit(hit);
756 // conformalhitlist->AddHit(chit);
757 // }
758 // else {
759 // PndTrkConformalHit * chit = conform->GetConformalSttHit(hit);
760 // conformalhitlist->AddHit(chit);
761 // }
763  conformalhitlist->AddHit(chit);
764  }
765  }
766 
767 
768  return conformalhitlist->GetNofHits();
769 }
PndTrkConformalHitList * conformalhitlist
int GetNofHitsInSector(int isec)
PndTrkHit * GetHitFromSector(int ihit, int isec)
PndTrkHit * GetHit(int index)
PndTrkConformalTransform * conform
PndTrkSdsHitList * mvdstrhitlist
int isec
Definition: f_Init.h:19
void AddHit(PndTrkConformalHit *chit)
PndTrkConformalHit GetConformalHit(PndTrkHit *hit)
PndTrkSttHitList * stthitlist
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
PndTrkConformalHit GetConformalSttHit(PndTrkHit *hit)
void SetConformalTransform(PndTrkConformalTransform *conformal)
PndTrkSdsHitList * mvdpixhitlist
void PndTrkLegendreSecTask::FillLegendreHisto ( Int_t  mode)

Definition at line 771 of file PndTrkLegendreSecTask.cxx.

References conformalhitlist, DrawConfHit(), fDisplayOn, PndTrkLegendreTransform::FillLegendreHisto(), fSttBranch, PndTrkConformalHit::GetDetectorID(), PndTrkConformalHit::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), PndTrkHit::IsUsed(), and legendre.

Referenced by PrepareLegendre(), and RePrepareLegendre().

772 {
773  // mode 0 STT alone
774  // 1 STT + MVD
775  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
777  if(mode == 0 && chit->GetDetectorID() != FairRootManager::Instance()->GetBranchId(fSttBranch)) continue;
778  PndTrkHit *hit = chit->GetHit();
779  if(hit->IsUsed()) continue;
780  legendre->FillLegendreHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone());
781  if(fDisplayOn) {
782  DrawConfHit(chit->GetU(), chit->GetV(), chit->GetIsochrone());
783  }
784  }
785 }
PndTrkConformalHitList * conformalhitlist
void FillLegendreHisto(double x, double y, double radius)
Int_t mode
Definition: autocutx.C:47
PndTrkConformalHit * GetHit(int index)
PndTrkLegendreTransform * legendre
Bool_t IsUsed()
Definition: PndTrkHit.h:58
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
void DrawConfHit(double x, double y, double r, int marker=2)
void PndTrkLegendreSecTask::FillLegendreHisto ( PndTrkCluster cluster)

Definition at line 787 of file PndTrkLegendreSecTask.cxx.

References conform, conformalhitlist, DrawConfHit(), fDisplayOn, PndTrkLegendreTransform::FillLegendreHisto(), fSttBranch, PndTrkConformalTransform::GetConformalSttHit(), PndTrkConformalHit::GetDetectorID(), PndTrkConformalHit::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkCluster::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkCluster::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), PndTrkHit::IsUsed(), and legendre.

788 {
789  // ---------------------------------------------------------------
790  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
791  PndTrkHit *hit = cluster->GetHit(ihit);
792  double conformal[3];
794  legendre->FillLegendreHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone());
795  // conformalhitlist->AddHit(chit);
796  }
797 
798  // add mvd hits to stt cluster
799  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
801  if(chit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) continue;
802  PndTrkHit *hit = chit->GetHit();
803  if(hit->IsUsed()) continue;
804  legendre->FillLegendreHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone());
805  if(fDisplayOn) {
806  DrawConfHit(chit->GetU(), chit->GetV(), chit->GetIsochrone());
807  }
808  }
809 }
PndTrkConformalHitList * conformalhitlist
void FillLegendreHisto(double x, double y, double radius)
PndTrkConformalTransform * conform
PndTrkHit * GetHit(int index)
PndTrkConformalHit * GetHit(int index)
PndTrkLegendreTransform * legendre
Bool_t IsUsed()
Definition: PndTrkHit.h:58
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
PndTrkConformalHit GetConformalSttHit(PndTrkHit *hit)
void DrawConfHit(double x, double y, double r, int marker=2)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
PndTrkHit * PndTrkLegendreSecTask::FindMvdPixelReferenceHit ( )

Definition at line 1776 of file PndTrkLegendreSecTask.cxx.

References fVerbose, PndTrkHitList::GetHit(), PndTrkHit::GetHitID(), PndTrkHitList::GetNofHits(), hit(), PndTrkHit::IsUsed(), and mvdpixhitlist.

Referenced by FindMvdReferenceHit().

1777  {
1778  if(mvdpixhitlist->GetNofHits() == 0) return NULL;
1779  // loop on mvd pix hits
1780  int tmphitid = -1;
1781  PndTrkHit *refhit = NULL;
1782  for(int jhit = 0; jhit < mvdpixhitlist->GetNofHits(); jhit++) {
1783  PndTrkHit *hit = mvdpixhitlist->GetHit(jhit);
1784  if(hit->IsUsed()) {
1785  if(fVerbose > 1) cout << "already used V" << endl;
1786  continue;
1787  }
1788  tmphitid = jhit;
1789  break;
1790  }
1791  if(tmphitid == -1) return NULL;
1792  refhit = mvdpixhitlist->GetHit(tmphitid);
1793  if(fVerbose > 1) cout << "MVD PIXEL REFERENCE HIT " << refhit->GetHitID() << endl;
1794  return refhit;
1795 }
int fVerbose
Definition: poormantracks.C:24
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
Bool_t IsUsed()
Definition: PndTrkHit.h:58
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
PndTrkSdsHitList * mvdpixhitlist
PndTrkHit * PndTrkLegendreSecTask::FindMvdReferenceHit ( )

Definition at line 1818 of file PndTrkLegendreSecTask.cxx.

References FindMvdPixelReferenceHit(), and FindMvdStripReferenceHit().

Referenced by FindReferenceHit().

1819 {
1820  PndTrkHit *refhit = NULL;
1821  refhit = FindMvdStripReferenceHit();
1822  // refhit = FindMvdPixelReferenceHit();
1823  if(refhit != NULL) return refhit;
1824  // refhit = FindMvdStripReferenceHit();
1826  return refhit;
1827 }
PndTrkHit * PndTrkLegendreSecTask::FindMvdStripReferenceHit ( )

Definition at line 1797 of file PndTrkLegendreSecTask.cxx.

References fVerbose, PndTrkHitList::GetHit(), PndTrkHit::GetHitID(), PndTrkHitList::GetNofHits(), hit(), PndTrkHit::IsUsed(), and mvdstrhitlist.

Referenced by FindMvdReferenceHit().

1798 {
1799  if(mvdstrhitlist->GetNofHits() == 0) return NULL;
1800  // loop on mvd str hits
1801  int tmphitid = -1;
1802  PndTrkHit *refhit = NULL;
1803  for(int jhit = 0; jhit < mvdstrhitlist->GetNofHits(); jhit++) {
1804  PndTrkHit *hit = mvdstrhitlist->GetHit(jhit);
1805  if(hit->IsUsed()) {
1806  if(fVerbose > 1) cout << "already used V" << endl;
1807  continue;
1808  }
1809  tmphitid = jhit;
1810  break;
1811  }
1812  if(tmphitid == -1) return NULL;
1813  refhit = mvdstrhitlist->GetHit(tmphitid);
1814  if(fVerbose > 1) cout << "MVD STRIP REFERENCE HIT " << refhit->GetHitID() << endl;
1815  return refhit;
1816 }
int fVerbose
Definition: poormantracks.C:24
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
PndTrkSdsHitList * mvdstrhitlist
Bool_t IsUsed()
Definition: PndTrkHit.h:58
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
PndTrkHit * PndTrkLegendreSecTask::FindReferenceHit ( )

Definition at line 1829 of file PndTrkLegendreSecTask.cxx.

References FindMvdReferenceHit(), and FindSttReferenceHit().

1830 {
1831  PndTrkHit *refhit = NULL;
1832  // refhit = FindMvdReferenceHit();
1833  refhit = FindSttReferenceHit();
1834  if(refhit != NULL) return refhit;
1835  // refhit = FindSttReferenceHit();
1837 
1838  return refhit;
1839 }
PndTrkHit * FindSttReferenceHit(int isec=-1)
PndTrkHit * PndTrkLegendreSecTask::FindSttReferenceHit ( int  isec = -1)

Definition at line 1742 of file PndTrkLegendreSecTask.cxx.

References Double_t, fVerbose, PndTrkHitList::GetHit(), PndTrkSttHitList::GetHitFromSector(), PndTrkHit::GetIsochrone(), PndTrkHitList::GetNofHits(), PndTrkSttHitList::GetNofHitsInSector(), hit(), PndTrkHit::IsSttSkew(), PndTrkHit::IsUsed(), and stthitlist.

Referenced by Exec(), and FindReferenceHit().

1742  {
1743  int ntot = 0;
1744  if(isec == -1) ntot = stthitlist->GetNofHits();
1745  else ntot = stthitlist->GetNofHitsInSector(isec);
1746 
1747  if(ntot == 0) return NULL;
1748 
1749 
1750  int tmphitid = -1;
1751  Double_t tmpiso = 1.;
1752  PndTrkHit *refhit = NULL;
1753  for(int jhit = 0; jhit < ntot; jhit++) {
1754  PndTrkHit *hit = NULL;
1755  if(isec == -1) hit = stthitlist->GetHit(jhit);
1756  else hit = stthitlist->GetHitFromSector(jhit, isec);
1757 
1758  if(hit->IsUsed()) {
1759  if(fVerbose > 1) cout << "STT hit " << jhit << "already used " << endl;
1760  continue; }
1761  if(hit->IsSttSkew()) continue;
1762  if(hit->GetIsochrone() < tmpiso) {
1763  tmphitid = jhit;
1764  tmpiso = hit->GetIsochrone();
1765  refhit = hit;
1766  }
1767  }
1768  if(tmphitid == -1) return NULL;
1769 
1770  // PndTrkHit *refhit = &thishitlist[tmphitid];
1771  if(fVerbose > 1) cout << "STT REFERENCE HIT " << tmphitid << " " << refhit->GetIsochrone() << endl;
1772  return refhit;
1773 
1774 }
int fVerbose
Definition: poormantracks.C:24
int GetNofHitsInSector(int isec)
PndTrkHit * GetHitFromSector(int ihit, int isec)
PndTrkHit * GetHit(int index)
int isec
Definition: f_Init.h:19
Double_t
Bool_t IsUsed()
Definition: PndTrkHit.h:58
PndTrkSttHitList * stthitlist
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
void PndTrkLegendreSecTask::FromConformalToRealTrack ( double  fitm,
double  fitp,
double &  x0,
double &  y0,
double &  R 
)

Definition at line 1128 of file PndTrkLegendreSecTask.cxx.

References conformalhitlist, CAMath::Cos(), Double_t, PndTrkConformalHitList::GetConformalTransform(), PndTrkConformalTransform::GetRotation(), PndTrkConformalTransform::GetTranslation(), CAMath::Sin(), and sqrt().

Referenced by CreateClusterByDistance(), CreateClusterByMixedDistance(), and Exec().

1128  {
1129  // CHECK if this needs to be kept --> change xc0 to xc etc
1130  // center and radius
1131  Double_t xcrot0, ycrot0;
1132  ycrot0 = 1 / (2 * fitp);
1133  xcrot0 = - fitm * ycrot0;
1134  R = sqrt(xcrot0 * xcrot0 + ycrot0 * ycrot0);
1135  // re-rotation and re-traslation of xc and yc
1136  // rotation
1139  // traslation
1142 }
Double_t x0
Definition: checkhelixhit.C:70
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
static T Sin(const T &x)
Definition: PndCAMath.h:42
PndTrkConformalHitList * conformalhitlist
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double_t
Double_t y0
Definition: checkhelixhit.C:71
PndTrkConformalTransform * GetConformalTransform()
Double_t R
Definition: checkhelixhit.C:61
InitStatus PndTrkLegendreSecTask::Init ( )
virtual

Virtual method Init

Definition at line 79 of file PndTrkLegendreSecTask.cxx.

References conform, display, fDisplayOn, fEventCounter, fFitter, PndSttMapCreator::FillTubeArray(), fMapper, fMvdPix_ConfDistLimit, fMvdPix_RealDistLimit, fMvdPixelBranch, fMvdPixelHitArray, fMvdStr_ConfDistLimit, fMvdStr_RealDistLimit, fMvdStripBranch, fMvdStripHitArray, fPersistence, fSecondary, fStt_ConfDistLimit, fStt_RealDistLimit, fSttBranch, fSttHitArray, fSttParameters, fTrackArray, fTrackCandArray, fTubeArray, fVerbose, legendre, PndTrkLegendreTransform::SetUpLegendreHisto(), PndTrkLegendreTransform::SetUpZoomHisto(), and tools.

79  {
80 
81  fEventCounter = 0;
82 
83  fMvdPix_RealDistLimit = 0.5; // CHECK limits
84  fMvdStr_RealDistLimit = 0.5; // CHECK limits
85  fStt_RealDistLimit = 1.5 * 0.5; // CHECK limits
86  fMvdPix_ConfDistLimit = 0.003; // CHECK limits
87  fMvdStr_ConfDistLimit = 0.003; // CHECK limits
88  fStt_ConfDistLimit = 0.001; // CHECK limits
89  if(fSecondary) {
90  fMvdPix_ConfDistLimit = 0.007; // CHECK limits
91  fMvdStr_ConfDistLimit = 0.007; // CHECK limits
92  }
93 
94 
95  // Get RootManager
96  FairRootManager* ioman = FairRootManager::Instance();
97  if ( ! ioman ) {
98  cout << "-E- PndTrkLegendreSecTask::Init: "
99  << "RootManager not instantiated, return!" << endl;
100  return kFATAL;
101  }
102 
103  // -- HITS -------------------------------------------------
104  //
105  // STT
106  fSttHitArray = (TClonesArray*) ioman->GetObject(fSttBranch);
107  if ( ! fSttHitArray ) {
108  cout << "-W- PndTrkLegendreSecTask::Init: "
109  << "No STTHit array, return!" << endl;
110  return kERROR;
111  }
112  //
113  // MVD PIXEL
114  fMvdPixelHitArray = (TClonesArray*) ioman->GetObject(fMvdPixelBranch);
115  if ( !fMvdPixelHitArray){
116  std::cout << "-W- PndTrkLegendreSecTask::Init: " << "No MVD Pixel hitArray, return!" << std::endl;
117  return kERROR;
118  }
119  //
120  // MVD STRIP
121  fMvdStripHitArray = (TClonesArray*) ioman->GetObject(fMvdStripBranch);
122  if ( !fMvdStripHitArray){
123  std::cout << "-W- PndTrkLegendreSecTask::Init: " << "No MVD Strip hitArray, return!" << std::endl;
124  return kERROR;
125  }
126 
127  fTrackArray = new TClonesArray("PndTrack");
128  fTrackCandArray = new TClonesArray("PndTrackCand");
129  ioman->Register("Track", "pr", fTrackArray, fPersistence); // CHECK
130  ioman->Register("TrackCand", "pr", fTrackCandArray, fPersistence); // CHECK
131 
132 
133  // ---------------------------------------- maps of STT tubes
136  // ---------------------------------------------------- end map
137 
138  if(fDisplayOn) {
139  display = new TCanvas("display", "display", 0, 0, 800, 800); // CHECK
140  display->Divide(2, 2);
141  }
142 
144  if(fSecondary) legendre->SetUpLegendreHisto(180, 0, 180, 1000, -1., 1.);
147 
149 
150  tools = new PndTrkTools();
152 
153  return kSUCCESS;
154 
155 }
int fVerbose
Definition: poormantracks.C:24
void SetUpZoomHisto(double theta, double r, double deltatheta, double deltar)
PndSttMapCreator * fMapper
PndTrkConformalTransform * conform
TClonesArray * FillTubeArray()
PndTrkLegendreTransform * legendre
void PndTrkLegendreSecTask::Initialize ( )

Definition at line 167 of file PndTrkLegendreSecTask.cxx.

References PndTrkHitList::AddTCA(), fFoundPeaks, fInitDone, fMvdPixelBranch, fMvdPixelHitArray, fMvdStripBranch, fMvdStripHitArray, fSttBranch, fSttHitArray, fTubeArray, fUseMVDPix, fUseMVDStr, fUseSTT, PndTrkSttHitList::Instanciate(), PndTrkSdsHitList::InstanciatePixel(), PndTrkSdsHitList::InstanciateStrip(), MVDPIXEL, mvdpixhitlist, mvdstrhitlist, MVDSTRIP, and stthitlist.

Referenced by Exec().

167  {
168 
172 
173  if(fUseSTT) {
174  stthitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fSttBranch), fSttHitArray);
176  }
177 
178  if(fUseMVDPix) {
179  mvdpixhitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fMvdPixelBranch), fMvdPixelHitArray);
181  }
182 
183  if(fUseMVDStr) {
184  mvdstrhitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fMvdStripBranch), fMvdStripHitArray);
186  }
187 
188 // conformalhitlist = new PndTrkConformalHitList();
189  fFoundPeaks.clear();
190 
191  fInitDone = kTRUE;
192  // stthitlist->PrintSectors();
193 }
void AddTCA(Int_t detID, TClonesArray *array)
PndTrkSttHitList * Instanciate()
PndTrkSdsHitList * mvdstrhitlist
std::vector< std::pair< double, double > > fFoundPeaks
#define MVDSTRIP
PndTrkSdsHitList * InstanciateStrip()
PndTrkSttHitList * stthitlist
#define MVDPIXEL
PndTrkSdsHitList * mvdpixhitlist
PndTrkSdsHitList * InstanciatePixel()
Bool_t PndTrkLegendreSecTask::IsSttAssociate ( PndTrkHit hit1,
PndTrkHit hit2 
)

Definition at line 1316 of file PndTrkLegendreSecTask.cxx.

References PndTrkHit::GetXYDistance(), and STTPARALDISTANCE.

Referenced by CreateSttCluster().

1316  {
1317 
1318  double distance = hit1->GetXYDistance(hit2); // ComputeDistance(hit1, hit2);
1319 
1320  if(distance < STTPARALDISTANCE) {
1321  // cout << "distance " << distance << endl;
1322  return kTRUE;
1323  }
1324  return kFALSE;
1325 
1326 }
#define STTPARALDISTANCE
Double_t GetXYDistance(PndTrkHit *fromhit)
Definition: PndTrkHit.cxx:94
void PndTrkLegendreSecTask::LightCluster ( PndTrkCluster cluster)

Definition at line 1328 of file PndTrkLegendreSecTask.cxx.

References display, PndTrkCluster::LightUp(), and Refresh().

Referenced by Exec().

1328  {
1329 
1330  // cout << "LIGHT UP" << endl;
1331  Refresh();
1332  cluster->LightUp();
1333  display->Update();
1334  display->Modified();
1335 }
void PndTrkLegendreSecTask::PrepareLegendre ( )

Definition at line 1865 of file PndTrkLegendreSecTask.cxx.

References DrawGeometryConf(), fDisplayOn, FillLegendreHisto(), fSecondary, fVerbose, legendre, RefreshConf(), and PndTrkLegendreTransform::ResetLegendreHisto().

Referenced by ApplyLegendre().

1865  {
1866 
1867  // cout << "RESETTING LEGENDRE HISTO" << endl;
1869 
1870  if(fDisplayOn) {
1871  RefreshConf();
1872  if(fSecondary) DrawGeometryConf(-1., 1., -1., 1.);
1873  else DrawGeometryConf(-0.07, 0.07, -0.07, 0.07);
1874  }
1875  if(fVerbose > 1) cout << "%%%%%%%%%%%%%%%%%%%% XY FINDER %%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
1876  FillLegendreHisto(0);
1877 }
int fVerbose
Definition: poormantracks.C:24
void DrawGeometryConf(double x1, double y1, double x2, double y2)
PndTrkLegendreTransform * legendre
void FillLegendreHisto(Int_t mode)
void PndTrkLegendreSecTask::Refresh ( )

Definition at line 1179 of file PndTrkLegendreSecTask.cxx.

References DrawGeometry(), DrawHits(), fVerbose, mvdpixhitlist, mvdstrhitlist, and stthitlist.

Referenced by Exec(), LightCluster(), and RegisterTrack().

1179  {
1180  // CHECK
1181  char goOnChar;
1182  // cout << "Refresh?" << endl;
1183  // cin >> goOnChar;
1184  // cout << "REFRESHING" << endl;
1185  DrawGeometry();
1186  if(fVerbose) cout << "Refresh stt" << endl;
1188  if(fVerbose) cout << "Refresh pixel" << endl;
1190  if(fVerbose) cout << "Refresh strip" << endl;
1192  if(fVerbose) cout << "Refresh stop" << endl;
1193 
1194 }
int fVerbose
Definition: poormantracks.C:24
void DrawHits(PndTrkHitList *hitlist)
PndTrkSdsHitList * mvdstrhitlist
PndTrkSttHitList * stthitlist
PndTrkSdsHitList * mvdpixhitlist
void PndTrkLegendreSecTask::RefreshConf ( )

Definition at line 1230 of file PndTrkLegendreSecTask.cxx.

Referenced by PrepareLegendre(), and RePrepareLegendre().

1230  { // CHECK delete
1231  // CHECK
1232  char goOnChar;
1233  // cout << "RefreshConf?" << endl;
1234  // cin >> goOnChar;
1235  // cout << "REFRESHING CONF" << endl;
1236 }
void PndTrkLegendreSecTask::RefreshZ ( )

Definition at line 1238 of file PndTrkLegendreSecTask.cxx.

Referenced by CreateSkewHitList(), and Exec().

1238  { // CHECK delete
1239  // CHECK
1240  char goOnChar;
1241  // cout << "RefreshZ?" << endl;
1242  // cin >> goOnChar;
1243  // cout << "REFRESHING Z" << endl;
1244 }
void PndTrkLegendreSecTask::RegisterTrack ( PndTrkTrack track)

Definition at line 1708 of file PndTrkLegendreSecTask.cxx.

References PndTrkTrack::ConvertToPndTrack(), display, PndTrkTrack::Draw(), fDisplayOn, fTrackArray, fTrackCandArray, fVerbose, PndTrkTrack::GetCenter(), PndTrkTrack::GetCharge(), PndTrack::GetParamFirst(), PndTrack::GetParamLast(), PndTrkTrack::GetRadius(), PndTrkTrack::GetTanL(), PndTrack::GetTrackCand(), PndTrkTrack::GetZ0(), and Refresh().

Referenced by Exec().

1708  {
1709  PndTrack *finaltrack = track->ConvertToPndTrack();
1710 
1711  TClonesArray& clref1 = *fTrackArray;
1712  Int_t size = clref1.GetEntriesFast();
1713  PndTrack *outputtrack = new(clref1[size]) PndTrack(finaltrack->GetParamFirst(), finaltrack->GetParamLast(), finaltrack->GetTrackCand());
1714 
1715  TClonesArray& clref2 = *fTrackCandArray;
1716  size = clref2.GetEntriesFast();
1717  PndTrackCand *outputtrackcand = new(clref2[size]) PndTrackCand(finaltrack->GetTrackCand());
1718 
1719  if(fVerbose > 1) {
1720  cout << "MOM FIRST: TOT, PT, PL " << outputtrack->GetParamFirst().GetMomentum().Mag() << " " << outputtrack->GetParamFirst().GetMomentum().Perp() << " " << outputtrack->GetParamFirst().GetMomentum().Z() << endl;
1721  cout << "MOM LAST: TOT, PT, PL " << outputtrack->GetParamLast().GetMomentum().Mag() << " " << outputtrack->GetParamLast().GetMomentum().Perp() << " " << outputtrack->GetParamLast().GetMomentum().Z() << endl;
1722  }
1723  if(fDisplayOn) {
1724  char goOnChar;
1725  display->cd(1);
1726  Refresh();
1727 
1728  track->Draw(kRed);
1729  display->Update();
1730  display->Modified();
1731 
1732  cout << "X, Y, R " << track->GetCenter().X() << " " << track->GetCenter().Y() << " " << track->GetRadius() << endl;
1733  cout << "Z0, TANL " << track->GetZ0() << " " << track->GetTanL() << endl;
1734  cout << "CHARGE " << track->GetCharge() << endl;
1735  // cin >> goOnChar;
1736  }
1737 
1738 }
int fVerbose
Definition: poormantracks.C:24
Double_t GetRadius()
Definition: PndTrkTrack.h:43
PndTrack ConvertToPndTrack()
Double_t GetZ0()
Definition: PndTrkTrack.h:46
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
Int_t GetCharge()
Definition: PndTrkTrack.h:57
PndTrackCand GetTrackCand()
Definition: PndTrack.h:47
FairTrackParP GetParamLast()
Definition: PndTrack.h:50
void Draw(Color_t color=kBlack)
Double_t GetTanL()
Definition: PndTrkTrack.h:45
FairTrackParP GetParamFirst()
Definition: PndTrack.h:49
void PndTrkLegendreSecTask::RePrepareLegendre ( PndTrkCluster cluster)

Definition at line 1851 of file PndTrkLegendreSecTask.cxx.

References DrawGeometryConf(), fDisplayOn, FillLegendreHisto(), fSecondary, legendre, RefreshConf(), and PndTrkLegendreTransform::ResetLegendreHisto().

Referenced by ApplyLegendre().

1851  {
1852 
1853  // cout << "RESETTING LEGENDRE HISTO" << endl;
1855 
1856  if(fDisplayOn) {
1857  RefreshConf();
1858  if(fSecondary) DrawGeometryConf(-1., 1., -1., 1.);
1859  else DrawGeometryConf(-0.07, 0.07, -0.07, 0.07);
1860  }
1861  // cout << "%%%%%%%%%%%%%%%%%%%% XY FINDE %%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
1862  FillLegendreHisto(cluster);
1863 }
void DrawGeometryConf(double x1, double y1, double x2, double y2)
PndTrkLegendreTransform * legendre
void FillLegendreHisto(Int_t mode)
void PndTrkLegendreSecTask::Reset ( )

Definition at line 689 of file PndTrkLegendreSecTask.cxx.

References display, fDisplayOn, fEventCounter, fInitDone, fTime, fTimer, fVerbose, mvdpixhitlist, mvdstrhitlist, and stthitlist.

Referenced by Exec().

690 {
691 
692  if(fDisplayOn) {
693  char goOnChar;
694  display->Update();
695  display->Modified();
696  cout << "Finish? ";
697  cin >> goOnChar;
698  cout << "FINISH" << endl;
699  }
700 
701  if(fInitDone) {
702  if(stthitlist) delete stthitlist;
703  if(mvdpixhitlist) delete mvdpixhitlist;
704  if(mvdstrhitlist) delete mvdstrhitlist;
705  if(fTimer) {
706  fTimer->Stop();
707  fTime += fTimer->RealTime();
708 
709  if(fVerbose > 0) cerr << fEventCounter << " Real time " << fTime << " s" << endl;
710  }
711  }
712 
713  fInitDone = kFALSE;
714 }
int fVerbose
Definition: poormantracks.C:24
PndTrkSdsHitList * mvdstrhitlist
PndTrkSttHitList * stthitlist
PndTrkSdsHitList * mvdpixhitlist
void PndTrkLegendreSecTask::SearchSecondaryTracks ( )
inline

Definition at line 89 of file PndTrkLegendreSecTask.h.

References fSecondary.

89 { fSecondary = kTRUE; }
void PndTrkLegendreSecTask::SetParContainers ( )

Definition at line 159 of file PndTrkLegendreSecTask.cxx.

References fSttParameters, and rtdb.

159  {
160  FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
161  fSttParameters = (PndGeoSttPar*) rtdb->getContainer("PndGeoSttPar");
162 }
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndTrkLegendreSecTask::SwitchOnDisplay ( )
inline

Definition at line 94 of file PndTrkLegendreSecTask.h.

94 { fDisplayOn = kTRUE; }
Bool_t PndTrkLegendreSecTask::ZPhiFit ( int  iter,
PndTrkCluster cluster,
double &  fitm,
double &  fitp 
)

Definition at line 2222 of file PndTrkLegendreSecTask.cxx.

References PndTrkFitter::ConstrainedStraightLineFit(), display, DrawZGeometry(), fDisplayOn, fFitter, fMvdPixelBranch, fMvdStripBranch, fSttBranch, PndTrkHit::GetDetectorID(), PndTrkCluster::GetHit(), PndTrkHit::GetIsochrone(), PndTrkCluster::GetNofHits(), PndTrkHit::GetPhi(), PndTrkHit::GetPosition(), hit(), hzphi, PndTrkHit::IsSttParallel(), phi, PndTrkFitter::Reset(), PndTrkFitter::SetPointToFit(), and PndTrkFitter::StraightLineFit().

Referenced by Exec().

2223 {
2224 
2225  if(iter != 0) {
2226  if(fDisplayOn) {
2227  char goOnChar;
2228  display->cd(3);
2229  DrawZGeometry();
2230  hzphi->SetXTitle("#phi");
2231  hzphi->SetYTitle("#z");
2232  hzphi->Draw();
2233  display->Update();
2234  display->Modified();
2235  }
2236  }
2237 
2238  fFitter->Reset();
2239  PndTrkHit *hit = NULL;
2240  PndTrkHit *refhit = NULL;
2241  double refiso = 1000;
2242  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
2243  hit = cluster->GetHit(ihit);
2244  if(hit->IsSttParallel()) continue; // CHECK IsSttParrallel will be changed
2245 
2246 
2247  TVector3 position = hit->GetPosition();
2248  double phi = hit->GetPhi();
2249  // fFitter->SetPointToFit(phi, position.Z(), 0.1);
2250 
2251  // CHECK refhit stuff
2252  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch) || hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
2253  if(iter != 0) refhit = hit;
2254  fFitter->SetPointToFit(phi, position.Z(), 0.001);
2255  }
2256  else if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
2257  if(iter != 0 && refhit == NULL && hit->GetIsochrone() < refiso) refhit = hit;
2258  fFitter->SetPointToFit(phi, position.Z(), 0.1);
2259  }
2260 
2261  if(fDisplayOn) {
2262  char goOnChar;
2263  if(iter == 0) display->cd(4);
2264  TMarker *mrkfoundzphi = NULL;
2265  if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdPixelBranch) || hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fMvdStripBranch)) {
2266  mrkfoundzphi = new TMarker(phi, position.Z(), 21);
2267  if(iter == 0) mrkfoundzphi->SetMarkerColor(kOrange);
2268  else mrkfoundzphi->SetMarkerColor(4);
2269  }
2270  else if(hit->GetDetectorID() == FairRootManager::Instance()->GetBranchId(fSttBranch)) {
2271  mrkfoundzphi = new TMarker(phi, position.Z(), 20);
2272  if(iter == 0) mrkfoundzphi->SetMarkerColor(kGreen);
2273  else mrkfoundzphi->SetMarkerColor(4);
2274  }
2275  mrkfoundzphi->Draw("SAME");
2276  // display->cd(3);
2277  // mrkfoundzphi->Draw("SAME");
2278 
2279  }
2280  }
2281  // ===================================
2282  bool fit = kFALSE;
2283  if(iter == 0) fit = fFitter->StraightLineFit(fitm, fitp);
2284  else {
2285  if(refhit != NULL) fit = fFitter->ConstrainedStraightLineFit(refhit->GetPhi(), refhit->GetPosition().Z(), fitm, fitp);
2286  else fit = fFitter->StraightLineFit(fitm, fitp);
2287  }
2288 
2289  if(fit) {
2290  if(fDisplayOn) {
2291  char goOnChar;
2292  if(iter != 0) display->cd(4);
2293  TLine *l22 = new TLine(-1000, -1000 * fitm + fitp, 1000, 1000 * fitm + fitp);
2294  if(iter == 0) l22->SetLineColor(3);
2295  else if(iter == 1) l22->SetLineColor(4);
2296  l22->Draw("SAME");
2297  display->cd(3);
2298  l22->Draw("SAME");
2299  display->Update();
2300  display->Modified();
2301  cin >> goOnChar;
2302  }
2303  }
2304  // ++++++++++++++++++++++++++++++++++
2305 
2306  return fit;
2307 }
Double_t GetPhi()
Definition: PndTrkHit.h:67
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
TVector3 GetPosition()
Definition: PndTrkHit.h:62
Bool_t ConstrainedStraightLineFit(Double_t x0, Double_t y0, Double_t &fitm, Double_t &fitp)
void DrawZGeometry(int whichone=1, double phimin=0, double phimax=360, double zmin=-43, double zmax=113)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
Bool_t StraightLineFit(Double_t &fitm, Double_t &fitp)
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
void SetPointToFit(double x, double y, double sigma)

Member Data Documentation

PndTrkConformalTransform* PndTrkLegendreSecTask::conform
private

Definition at line 172 of file PndTrkLegendreSecTask.h.

Referenced by Cleanup(), Exec(), FillConformalHitList(), FillLegendreHisto(), and Init().

PndTrkConformalHitList* PndTrkLegendreSecTask::conformalhitlist
private
TCanvas* PndTrkLegendreSecTask::display
double PndTrkLegendreSecTask::fDeltaThetaRad
private

Definition at line 165 of file PndTrkLegendreSecTask.h.

Bool_t PndTrkLegendreSecTask::fDisplayOn
Int_t PndTrkLegendreSecTask::fEventCounter
private

Definition at line 156 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and Reset().

PndTrkFitter* PndTrkLegendreSecTask::fFitter
private

Definition at line 183 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and ZPhiFit().

std::vector< std::pair<double, double> > PndTrkLegendreSecTask::fFoundPeaks
private

Definition at line 180 of file PndTrkLegendreSecTask.h.

Referenced by ExtractLegendre(), and Initialize().

Bool_t PndTrkLegendreSecTask::fInitDone
private

Definition at line 168 of file PndTrkLegendreSecTask.h.

Referenced by Initialize(), and Reset().

PndSttMapCreator* PndTrkLegendreSecTask::fMapper
private

Definition at line 154 of file PndTrkLegendreSecTask.h.

Referenced by Init().

Double_t PndTrkLegendreSecTask::fMvdPix_ConfDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesConfHitBelong(), and Init().

Double_t PndTrkLegendreSecTask::fMvdPix_RealDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesRealHitBelong(), and Init().

char PndTrkLegendreSecTask::fMvdPixelBranch[200]
private
TClonesArray* PndTrkLegendreSecTask::fMvdPixelHitArray
private

Input array of MvdPixelHitArray

Definition at line 140 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and Initialize().

Double_t PndTrkLegendreSecTask::fMvdStr_ConfDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesConfHitBelong(), and Init().

Double_t PndTrkLegendreSecTask::fMvdStr_RealDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesRealHitBelong(), and Init().

char PndTrkLegendreSecTask::fMvdStripBranch[200]
private
TClonesArray* PndTrkLegendreSecTask::fMvdStripHitArray
private

Input array of MvdStripHitArray

Definition at line 142 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and Initialize().

Int_t PndTrkLegendreSecTask::fNofHits
private

Definition at line 130 of file PndTrkLegendreSecTask.h.

Int_t PndTrkLegendreSecTask::fNofMvdPixHits
private

Definition at line 130 of file PndTrkLegendreSecTask.h.

Int_t PndTrkLegendreSecTask::fNofMvdStrHits
private

Definition at line 130 of file PndTrkLegendreSecTask.h.

Int_t PndTrkLegendreSecTask::fNofSttHits
private

Definition at line 130 of file PndTrkLegendreSecTask.h.

Int_t PndTrkLegendreSecTask::fNofTriplets
private

Definition at line 130 of file PndTrkLegendreSecTask.h.

Bool_t PndTrkLegendreSecTask::fPersistence
private

Definition at line 168 of file PndTrkLegendreSecTask.h.

Referenced by Init().

PndTrkHit* PndTrkLegendreSecTask::fRefHit
private

Definition at line 176 of file PndTrkLegendreSecTask.h.

Referenced by CreateClusterByDistance(), and Exec().

Bool_t PndTrkLegendreSecTask::fSecondary
private
Double_t PndTrkLegendreSecTask::fStt_ConfDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesConfHitBelong(), and Init().

Double_t PndTrkLegendreSecTask::fStt_RealDistLimit
private

Definition at line 178 of file PndTrkLegendreSecTask.h.

Referenced by DoesRealHitBelong(), and Init().

char PndTrkLegendreSecTask::fSttBranch[200]
private
TClonesArray* PndTrkLegendreSecTask::fSttHitArray
private

Input array of PndSttHit

Definition at line 136 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and Initialize().

Double_t PndTrkLegendreSecTask::fSttParalDistance
private

Definition at line 162 of file PndTrkLegendreSecTask.h.

PndGeoSttPar* PndTrkLegendreSecTask::fSttParameters
private

Definition at line 149 of file PndTrkLegendreSecTask.h.

Referenced by Init(), and SetParContainers().

TClonesArray* PndTrkLegendreSecTask::fSttPointArray
private

Input array of PndSttPoints

Definition at line 134 of file PndTrkLegendreSecTask.h.

Double_t PndTrkLegendreSecTask::fSttToMvdStripDistance
private

Definition at line 162 of file PndTrkLegendreSecTask.h.

double PndTrkLegendreSecTask::fTime
private

Definition at line 181 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), and Reset().

TStopwatch* PndTrkLegendreSecTask::fTimer
private

Definition at line 182 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), and Reset().

TClonesArray* PndTrkLegendreSecTask::fTrackArray
private

Definition at line 144 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and RegisterTrack().

TClonesArray * PndTrkLegendreSecTask::fTrackCandArray
private

Definition at line 144 of file PndTrkLegendreSecTask.h.

Referenced by Exec(), Init(), and RegisterTrack().

TClonesArray* PndTrkLegendreSecTask::fTubeArray
private

Definition at line 146 of file PndTrkLegendreSecTask.h.

Referenced by Cleanup(), CorrectZ(), CreateSkewHitList(), Init(), and Initialize().

Bool_t PndTrkLegendreSecTask::fUseMVDPix
private

Definition at line 168 of file PndTrkLegendreSecTask.h.

Referenced by DontUseMvdPix(), and Initialize().

Bool_t PndTrkLegendreSecTask::fUseMVDStr
private

Definition at line 168 of file PndTrkLegendreSecTask.h.

Referenced by DontUseMvdStr(), and Initialize().

Bool_t PndTrkLegendreSecTask::fUseSTT
private

Definition at line 168 of file PndTrkLegendreSecTask.h.

Referenced by DontUseStt(), and Initialize().

TH2F* PndTrkLegendreSecTask::huv

Definition at line 99 of file PndTrkLegendreSecTask.h.

Referenced by DrawGeometryConf().

TH2F* PndTrkLegendreSecTask::hxy

Definition at line 92 of file PndTrkLegendreSecTask.h.

Referenced by DrawGeometry().

TH2F * PndTrkLegendreSecTask::hxz

Definition at line 92 of file PndTrkLegendreSecTask.h.

Referenced by DrawZGeometry().

TH2F * PndTrkLegendreSecTask::hzphi

Definition at line 92 of file PndTrkLegendreSecTask.h.

Referenced by CleanUpSkewHitList(), DrawZGeometry(), Exec(), and ZPhiFit().

PndTrkLegendreTransform* PndTrkLegendreSecTask::legendre
private
PndTrkSdsHitList* PndTrkLegendreSecTask::mvdpixhitlist
private
PndTrkSdsHitList* PndTrkLegendreSecTask::mvdstrhitlist
private
PndTrkSttHitList* PndTrkLegendreSecTask::stthitlist
private
PndTrkTools* PndTrkLegendreSecTask::tools
private

Definition at line 174 of file PndTrkLegendreSecTask.h.

Referenced by CreateSkewHitList(), and Init().


The documentation for this class was generated from the following files: