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

#include <PndTrkCombiLegendreTask.h>

Inheritance diagram for PndTrkCombiLegendreTask:

Public Member Functions

 PndTrkCombiLegendreTask ()
 
 PndTrkCombiLegendreTask (int verbose)
 
 ~PndTrkCombiLegendreTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void SetParContainers ()
 
void Initialize ()
 
void Reset ()
 
void SwitchOnDisplay ()
 
void SwitchOnSeeMC ()
 
void DrawGeometry (int cpad=1)
 
void DrawSttGeometry ()
 
void DrawHits (PndTrkHitList *hitlist)
 
void DrawLists ()
 
void DrawNeighborings ()
 
void DrawNeighboringsToHit (PndTrkHit *hit)
 
void Refresh ()
 
void RefreshConf ()
 
void DrawGeometryConf (double x1, double x2, double y1, double y2)
 
void DrawConfHit (double x, double y, double r, int marker=2)
 
void LightCluster (PndTrkCluster *cluster)
 
void DrawLegendreHisto ()
 
void ComputePlaneExtremities (PndTrkCluster *cluster)
 
Int_t FillConformalHitList (PndTrkCluster *cluster)
 
void FillLegendreHisto (PndTrkCluster *cluster)
 
void ComputeTraAndRot (PndTrkHit *hit, Double_t &delta, Double_t trasl[2])
 
PndTrkHitFindSttReferenceHit (int isec=-1)
 
PndTrkHitFindMvdPixelReferenceHit ()
 
PndTrkHitFindMvdStripReferenceHit ()
 
PndTrkHitFindMvdReferenceHit ()
 
PndTrkHitFindReferenceHit ()
 
PndTrkHitFindReferenceHit (PndTrkCluster *cluster, bool keeprefhit)
 
void RePrepareLegendre (PndTrkCluster *cluster)
 
Int_t ApplyLegendre (PndTrkCluster *cluster, double &theta_max, double &r_max)
 
Int_t ExtractLegendre (Int_t mode, double &theta_max, double &r_max)
 
void FromConformalToRealTrack (double fitm, double fitp, double &x0, double &y0, double &R)
 
void FromRealToConformalTrack (double x0, double y0, double R, double &fitm, double &fitp)
 
void SearchSecondaryTracks ()
 
PndTrkClusterList CreateFullClusterization ()
 
PndTrkClusterList CreateFullClusterization2 ()
 
Int_t CountTracksInCluster (PndTrkCluster *cluster, int *noftracksinlayer)
 
Int_t CountTracksInSkewSector (PndTrkCluster *cluster, int *noftracksinlayer)
 
Int_t CountTracksInCluster (PndTrkCluster *cluster, Int_t where, int *noftracksinlayer)
 
Int_t ClusterToConformal (PndTrkCluster *cluster, bool samerefhit)
 
PndTrkTrackLegendreFit (PndTrkCluster *cluster)
 
PndTrkTrackLegendreFitWithRecovering (PndTrkCluster *cluster)
 
PndTrkClusterCreateClusterAroundTrack (PndTrkTrack *track)
 
PndTrkClusterCreateClusterAroundTrack2 (PndTrkTrack *track)
 
PndTrkClusterCreateClusterAroundTrack3 (PndTrkTrack *track)
 
Bool_t DoesBelong (PndTrkHit *hit, double xc, double yc, double R)
 
void AnalyticalFit (PndTrkCluster *cluster, double xc, double yc, double R, double &fitm, double &fitq)
 
void AnalyticalFit2 (PndTrkCluster *cluster, double fitm, double fitp, double &fitm2, double &fip2)
 
void IntersectionFinder (PndTrkHit *hit, double xc, double yc, double R)
 
void IntersectionFinder (PndTrkConformalHit *chit, double fitm, double fitp)
 
Double_t ComputePerpendicularChi2 (PndTrkCluster *cluster, double fitm, double fitp)
 
void FillHitMap ()
 
void FillPeakCouplesHisto (PndTrkCluster *cluster)
 
void FillPeakNeighCouplesHisto (PndTrkCluster *cluster)
 
PndTrkClusterComputeSkewedXYZ (PndTrkCluster *cluster)
 
void CleanTrack (PndTrkTrack *track)
 

Private Member Functions

 ClassDef (PndTrkCombiLegendreTask, 1)
 

Private Attributes

Int_t fNofMvdPixHits
 
Int_t fNofMvdStrHits
 
Int_t fNofSttHits
 
Int_t fNofTriplets
 
Int_t fNofHits
 
TClonesArray * fSttPointArray
 
TClonesArray * fSttHitArray
 
TClonesArray * fMvdPointArray
 
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
 
PndTrkCombiLegendreTransformlegendrecombi
 
Bool_t fPersistence
 
Bool_t fUseMVDPix
 
Bool_t fUseMVDStr
 
Bool_t fUseSTT
 
Bool_t fSecondary
 
Bool_t fInitDone
 
Int_t fRecoverIteration
 
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
 
PndTrkNeighboringMapfHitMap
 
double fUmin
 
double fUmax
 
double fVmin
 
double fVmax
 
double fRmin
 
double fRmax
 
double fThetamin
 
double fThetamax
 
Bool_t fDisplayOn
 
Bool_t fSeeMC
 
TH2F * hxy
 
TH2F * hxz
 
TH2F * hzphi
 
TCanvas * display
 
TH2F * huv
 

Detailed Description

Definition at line 37 of file PndTrkCombiLegendreTask.h.

Constructor & Destructor Documentation

PndTrkCombiLegendreTask::PndTrkCombiLegendreTask ( )

Default constructor

Definition at line 59 of file PndTrkCombiLegendreTask.cxx.

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

59  : 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) , fUmin(-0.07), fUmax(0.07), fVmin(-0.07), fVmax(0.07), fRmin(-1.5), fRmax(1.5), fThetamin(0), fThetamax(180), fSeeMC(kFALSE), fRecoverIteration(-1)
60  {
61  sprintf(fSttBranch,"STTHit");
62  sprintf(fMvdPixelBranch,"MVDHitsPixel");
63  sprintf(fMvdStripBranch,"MVDHitsStrip");
65 }
static PndGeoHandling * Instance()
PndTrkCombiLegendreTask::PndTrkCombiLegendreTask ( int  verbose)

Definition at line 67 of file PndTrkCombiLegendreTask.cxx.

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

67  : 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), fUmin(-0.07), fUmax(0.07), fVmin(-0.07), fVmax(0.07), fRmin(-1.5), fRmax(1.5), fThetamin(0), fThetamax(180), fSeeMC(kFALSE), fRecoverIteration(-1) {
68  sprintf(fSttBranch,"STTHit");
69  sprintf(fMvdPixelBranch,"MVDHitsPixel");
70  sprintf(fMvdStripBranch,"MVDHitsStrip");
72 }
#define verbose
static PndGeoHandling * Instance()
PndTrkCombiLegendreTask::~PndTrkCombiLegendreTask ( )

Destructor

Definition at line 77 of file PndTrkCombiLegendreTask.cxx.

77  {
78 
79 }

Member Function Documentation

void PndTrkCombiLegendreTask::AnalyticalFit ( PndTrkCluster cluster,
double  xc,
double  yc,
double  R,
double &  fitm,
double &  fitq 
)

Definition at line 1940 of file PndTrkCombiLegendreTask.cxx.

References conform, display, fDisplayOn, fFitter, FromConformalToRealTrack(), PndTrkConformalTransform::GetConformalHit(), PndTrkCluster::GetHit(), PndTrkCluster::GetNofHits(), PndTrkConformalHit::GetPosition(), hit(), IntersectionFinder(), PndTrkHit::IsSttParallel(), PndTrkHit::IsSttSkew(), Refresh(), PndTrkFitter::Reset(), PndTrkFitter::SetPointToFit(), sigma, and PndTrkFitter::StraightLineFit().

1940  {
1941 
1942 
1943  // fit with analytical chi2 -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~--
1944  fFitter->Reset();
1945  if(fDisplayOn) {
1946  display->cd(1);
1947  Refresh();
1948  }
1949  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++)
1950  {
1951  PndTrkHit *hit = cluster->GetHit(ihit);
1952  if(hit->IsSttSkew()) continue;
1953  if(hit->IsSttParallel()) IntersectionFinder(hit, xc, yc, R);
1955  double sigma = 0.1; // CHECK
1956  fFitter->SetPointToFit(chit->GetPosition().X(), chit->GetPosition().Y(), sigma);
1957  // cout << "set point to fit " << chit->GetPosition().X() << " " << chit->GetPosition().Y() << endl;
1958  // if(fDisplayOn) {
1959  // display->cd(1);
1960  // TMarker *mrk = new TMarker(hit->GetPosition().X(), hit->GetPosition().Y(), 6);
1961  // mrk->SetMarkerColor(kRed);
1962  // mrk->Draw("SAME");
1963 
1964  // display->cd(2);
1965  // TMarker *mrk2 = new TMarker(chit->GetPosition().X(), chit->GetPosition().Y(), 6);
1966  // mrk2->SetMarkerColor(kRed);
1967  // mrk2->Draw("SAME");
1968 
1969 
1970  // display->Update();
1971  // display->Modified();
1972  // }
1973  }
1974 
1975 
1976  fFitter->StraightLineFit(fitm, fitq);
1977  cout << "previous " << xc << " " << yc << " " << R << endl;
1978  FromConformalToRealTrack(fitm, fitq, xc, yc, R);
1979  cout << "now " << xc << " " << yc << " " << R << endl;
1980 
1981  if(fDisplayOn) {
1982  display->cd(2);
1983  cout << "wanna see the line?" << endl;
1984  TLine *line = new TLine(-10.07, fitq + fitm * (-10.07), 10.07, fitq + fitm * (10.07));
1985  line->SetLineColor(2);
1986  line->Draw("SAME");
1987  char goOnChar;
1988  display->Update();
1989  display->Modified();
1990  cin >> goOnChar;
1991  }
1992 
1993 
1994 
1995 
1996 }
void IntersectionFinder(PndTrkHit *hit, double xc, double yc, double R)
PndTrkConformalTransform * conform
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
PndTrkConformalHit GetConformalHit(PndTrkHit *hit)
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
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)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Double_t R
Definition: checkhelixhit.C:61
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
void SetPointToFit(double x, double y, double sigma)
void PndTrkCombiLegendreTask::AnalyticalFit2 ( PndTrkCluster cluster,
double  fitm,
double  fitp,
double &  fitm2,
double &  fip2 
)

Definition at line 1999 of file PndTrkCombiLegendreTask.cxx.

References conform, counter, display, PndTrkConformalHit::Draw(), fDisplayOn, fFitter, fRefHit, FromConformalToRealTrack(), PndTrkConformalTransform::GetConformalSttHit(), PndTrkCluster::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkCluster::GetNofHits(), PndTrkConformalHit::GetPosition(), hit(), IntersectionFinder(), PndTrkHit::IsSttSkew(), PndTrkConformalTransform::PerformRealTransformation(), R, Refresh(), PndTrkFitter::Reset(), PndTrkFitter::SetPointToFit(), sigma, and PndTrkFitter::StraightLineFit().

Referenced by Exec().

1999  {
2000 
2001 
2002  // fit with analytical chi2 -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~--
2003  fFitter->Reset();
2004  if(fDisplayOn) {
2005  display->cd(1);
2006  Refresh();
2007  }
2008 
2009  int counter = 0;
2010  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++)
2011  {
2012  PndTrkHit *hit = cluster->GetHit(ihit);
2013  if(hit == fRefHit) {
2014  // cout << hit->GetHitID() << " ref hit " << endl;
2015  continue;
2016  }
2017  if(hit->IsSttSkew()) {
2018  // cout << hit->GetHitID() << " skew " << endl;
2019  continue;
2020  }
2021 
2023  if(fDisplayOn) {
2024  display->cd(2);
2025  chit->Draw(1);
2026  }
2027 
2028  IntersectionFinder(chit, fitm, fitp);
2029 
2030 
2031  // PndSttHit *stthit = (PndSttHit*) fSttHitArray->At(hit->GetHitID());
2032  // double isoerr = stthit->GetIsochroneError();
2033 
2034  double sigma = chit->GetIsochrone();
2035  // double sigma = hit->GetIsochrone() * chit->GetPosition().Y(); // * isoerr;
2036 
2037 
2038  fFitter->SetPointToFit(chit->GetPosition().X(), chit->GetPosition().Y(), sigma);
2039  counter++;
2040  // cout << ihit << " set point to fit {" << chit->GetPosition().X() << ", " << chit->GetPosition().Y() << "}" << endl;
2041  // cout << sigma << endl;
2042  // cout << "C iso " << chit->GetIsochrone() << endl;
2043  // cout << hit->GetIsochrone() << endl;
2044 
2045  if(fDisplayOn) {
2046  display->cd(1);
2047  double xreal, yreal, rreal;
2048  conform->PerformRealTransformation(chit->GetPosition().X(), chit->GetPosition().Y(), 0, xreal, yreal, rreal);
2049  TMarker *mrk = new TMarker(xreal, yreal, 6);
2050  mrk->SetMarkerColor(kRed);
2051  mrk->Draw("SAME");
2052 
2053  display->cd(2);
2054  TMarker *mrk2 = new TMarker(chit->GetPosition().X(), chit->GetPosition().Y(), 6);
2055  mrk2->SetMarkerColor(kRed);
2056  mrk2->Draw("SAME");
2057 
2058 
2059 // display->Update();
2060 // display->Modified();
2061  }
2062  }
2063 
2064 
2065  fFitter->StraightLineFit(fitm2, fitp2);
2066 
2067  double xc, yc, R;
2068  FromConformalToRealTrack(fitm, fitp, xc, yc, R);
2069  cout << "previous " << xc << " " << yc << " " << R << "/" << fitm << " " << fitp << endl;
2070  FromConformalToRealTrack(fitm2, fitp2, xc, yc, R);
2071  cout << "now " << xc << " " << yc << " " << R << "/" << fitm2 << " " << fitp2 << endl;
2072 
2073  if(fDisplayOn) {
2074  display->cd(2);
2075  cout << "wanna see the line?" << endl;
2076  TLine *line = new TLine(-10.07, fitp2 + fitm2 * (-10.07), 10.07, fitp2 + fitm2 * (10.07));
2077  line->SetLineColor(2);
2078  line->Draw("SAME");
2079 
2080  display->cd(1);
2081  TArc *aline = new TArc(xc, yc, R);
2082  aline->SetFillStyle(0);
2083  aline->SetLineColor(2);
2084  aline->Draw("SAME");
2085 
2086 
2087  char goOnChar;
2088  display->Update();
2089  display->Modified();
2090  cin >> goOnChar;
2091  }
2092 }
void IntersectionFinder(PndTrkHit *hit, double xc, double yc, double R)
PndTrkConformalTransform * conform
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
PndTrkHit * GetHit(int index)
int counter
Definition: ZeeAnalysis.C:59
void Draw(Color_t color)
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
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)
PndTrkConformalHit GetConformalSttHit(PndTrkHit *hit)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Double_t R
Definition: checkhelixhit.C:61
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
void SetPointToFit(double x, double y, double sigma)
void PerformRealTransformation(double u, double v, double rc, double &x, double &y, double &rd)
Int_t PndTrkCombiLegendreTask::ApplyLegendre ( PndTrkCluster cluster,
double &  theta_max,
double &  r_max 
)
PndTrkCombiLegendreTask::ClassDef ( PndTrkCombiLegendreTask  ,
 
)
private
void PndTrkCombiLegendreTask::CleanTrack ( PndTrkTrack track)

Definition at line 2353 of file PndTrkCombiLegendreTask.cxx.

References CountTracksInCluster(), display, PndTrkTrack::Draw(), fDisplayOn, fTubeArray, PndTrkTrack::GetCluster(), PndTrkCluster::GetHit(), PndTrkHit::GetHitID(), PndSttTube::GetLayerID(), PndTrkCluster::GetNofHits(), PndTrkHit::GetTubeID(), hit(), PndTrkCluster::LightUp(), and Refresh().

Referenced by Exec().

2353  {
2354 
2355  PndTrkCluster * cluster = track->GetCluster();
2356 
2357  if(fDisplayOn) {
2358  char goOnChar;
2359  cin >> goOnChar;
2360  Refresh();
2361  track->Draw();
2362  cluster->LightUp();
2363  display->Update();
2364  display->Modified();
2365  }
2366 
2367 
2368  // 1. count tracks in cluster_from_track
2369  int noftracksinlay[30];
2370  for(int ilay = 0; ilay < 30; ilay++) noftracksinlay[ilay] = 0;
2371  Int_t noftracks = CountTracksInCluster(cluster, noftracksinlay);
2372  cout << " NOF EFFECTIVE TRACKS IN THIS TRACK: " << noftracks << endl;
2373 
2374  int noflayerswith0tracks = 0, noflayerswith1track = 0, noflayerswithmoretracks = 0;
2375  int firstlayid = -1, lastlayid = -1;
2376  for(int ilay = 0; ilay < 30; ilay++) {
2377  // cout << "layer " << ilay << " " << noftracksinlay[ilay] << endl;
2378 
2379  // are there tracks in this layer?
2380  if(noftracksinlay[ilay] != 0) {
2381  if(firstlayid == -1) firstlayid = ilay;
2382  lastlayid = ilay;
2383  if(noftracksinlay[ilay] == 1) noflayerswith1track++;
2384  else noflayerswithmoretracks++;
2385  }
2386  }
2387  noflayerswith0tracks = (lastlayid - firstlayid + 1) - noflayerswith1track - noflayerswithmoretracks;
2388 
2389  cout << "last layer " << lastlayid << " first layer " << firstlayid << endl;
2390  cout << "#layers in range with 0 tracks " << noflayerswith0tracks << "; with 1 track " << noflayerswith1track << "; with more tracks " << noflayerswithmoretracks << endl;
2391 
2392  int classification = -1;
2393  // 0 = fake
2394  // 1 = one-way
2395  // 2 = full circle
2396  noflayerswith0tracks < noflayerswith1track ? classification = 1 : classification = 0;
2397  if(classification == 0) noflayerswith0tracks <= noflayerswithmoretracks ? classification = 2 : classification = 0;
2398  else if(classification == 1) noflayerswith1track <= noflayerswithmoretracks ? classification = 2 : classification = 1;
2399 
2400  switch(classification) {
2401  case 0:
2402  cout << "\033[1;30m THIS TRACK IS FAKE " << noflayerswith0tracks << " " << 100. * noflayerswith0tracks/(lastlayid - firstlayid + 1) << "%\033[0m" << endl; break;
2403  case 1:
2404  cout << "\033[1;30m THIS TRACK IS ONE-WAY " << noflayerswith1track << " " << 100. * noflayerswith1track/(lastlayid - firstlayid + 1) << "%\033[0m" << endl; break;
2405  case 2:
2406  cout << "\033[1;30m THIS IS A FULL CIRCLE " << noflayerswithmoretracks << " " << 100. * noflayerswithmoretracks/(lastlayid - firstlayid + 1) << "%\033[0m" << endl; break;
2407  default:
2408  cout << "\033[1;30m THIS IS NOT CLASSIFIED\033[0m" << endl;
2409  }
2410 
2411 
2412  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
2413  PndTrkHit *hit = cluster->GetHit(ihit);
2414  int hitid = hit->GetHitID();
2415  int tubeid = hit->GetTubeID();
2416  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeid);
2417  int layid = tube->GetLayerID();
2418  if(noftracksinlay[layid] > 2) {
2419  // cout << "hit " << ihit << " hitid " << hitid << " tubeid " << tubeid << " layid " << layid << endl;
2420  if(fDisplayOn) {
2421  display->cd(1);
2422  // hit->DrawTube(kBlue);
2423  // display->Update();
2424  // display->Modified();
2425  }
2426 
2427  }
2428  }
2429 }
PndTrkCluster GetCluster()
Definition: PndTrkTrack.h:48
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
int GetLayerID()
Definition: PndSttTube.cxx:128
void Draw(Color_t color=kBlack)
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
Int_t CountTracksInCluster(PndTrkCluster *cluster, int *noftracksinlayer)
Int_t PndTrkCombiLegendreTask::ClusterToConformal ( PndTrkCluster cluster,
bool  samerefhit 
)

Definition at line 1447 of file PndTrkCombiLegendreTask.cxx.

References ComputeTraAndRot(), conform, conformalhitlist, Double_t, FillConformalHitList(), FindReferenceHit(), fRefHit, fSecondary, PndTrkCluster::GetNofHits(), and PndTrkConformalTransform::SetOrigin().

Referenced by Exec().

1447  {
1448  // ================ --> TO CONFORMAL PLANE
1449  conformalhitlist = new PndTrkConformalHitList(); // CHECK
1450  // translation and rotation
1451  Int_t nchits = 0;
1452  Double_t delta = 0, trasl[2] = {0., 0.};
1453  if(fSecondary) {
1454  // translation and rotation - CHECK
1455  fRefHit = FindReferenceHit(cluster, samerefhit);
1456  cout << " REFERENCE HIT " << fRefHit << " found among " << cluster->GetNofHits() << " hits of cluster " << cluster << endl;
1457  if(fRefHit == NULL) {
1458  // cout << "REFHIT " << fRefHit << endl;
1459  // Reset();
1460  return 0;
1461  }
1462  ComputeTraAndRot(fRefHit, delta, trasl);
1463  }
1464  //
1465  cout << "DELTA " << delta << " TRASL " << trasl[0] << " " << trasl[1] << endl;
1466  conform->SetOrigin(trasl[0], trasl[1], delta);
1467  nchits = FillConformalHitList(cluster);
1468 
1469  return nchits;
1470 }
PndTrkConformalTransform * conform
PndTrkConformalHitList * conformalhitlist
Int_t FillConformalHitList(PndTrkCluster *cluster)
Double_t
void SetOrigin(double x, double y, double delta)
void ComputeTraAndRot(PndTrkHit *hit, Double_t &delta, Double_t trasl[2])
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Double_t PndTrkCombiLegendreTask::ComputePerpendicularChi2 ( PndTrkCluster cluster,
double  fitm,
double  fitp 
)

Definition at line 2097 of file PndTrkCombiLegendreTask.cxx.

References conform, display, PndTrkConformalHit::Draw(), fabs(), fDisplayOn, fRefHit, fSttHitArray, fSttPointArray, PndTrkConformalTransform::GetConformalSttHit(), PndTrkCluster::GetHit(), PndTrkHit::GetHitID(), PndTrkConformalHit::GetIsochrone(), PndTrkHit::GetIsochrone(), PndSttHit::GetIsochroneError(), PndTrkCluster::GetNofHits(), PndTrkConformalHit::GetPosition(), hit(), IntersectionFinder(), PndTrkHit::IsSttSkew(), sigma, and CAMath::Sqrt().

2097  {
2098  double chi2 = 0;
2099  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++)
2100  {
2101  PndTrkHit *hit = cluster->GetHit(ihit);
2102  if(hit == fRefHit) {
2103  // cout << hit->GetHitID() << " ref hit " << endl;
2104  continue;
2105  }
2106  if(hit->IsSttSkew()) {
2107  // cout << hit->GetHitID() << " skew " << endl;
2108  continue;
2109  }
2110 
2112  if(fDisplayOn) {
2113  display->cd(2);
2114  chit->Draw(1);
2115  }
2116 
2117  IntersectionFinder(chit, fitm, fitp);
2118 
2119 
2120  PndSttHit *stthit = (PndSttHit*) fSttHitArray->At(hit->GetHitID());
2121  PndSttPoint *sttpnt = (PndSttPoint*) fSttPointArray->At(stthit->GetRefIndex());
2122  double erriso = stthit->GetIsochroneError();
2123  double der = chit->GetPosition().Y() * chit->GetPosition().Y() + chit->GetPosition().X() * chit->GetPosition().X() - hit->GetIsochrone() * hit->GetIsochrone();
2124  double sigma = der * erriso;
2125 
2126  double distanceperp = fabs(chit->GetPosition().Y() - (chit->GetPosition().X() * fitm + fitp))/TMath::Sqrt(1 + fitm * fitm);
2127  double chi = (distanceperp - chit->GetIsochrone())/sigma;
2128  chi2 += chi * chi;
2129  cout << "=> " << distanceperp << " " << chit->GetIsochrone() << " " << sigma << " " << chi << " " << chi * chi << " " << chi2 << " " << sttpnt->GetTrackID() << endl;
2130  }
2131 
2132  cout << "final chi2 " << chi2 << endl;
2133  // ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2134 
2135  return chi2;
2136 }
void IntersectionFinder(PndTrkHit *hit, double xc, double yc, double R)
PndTrkConformalTransform * conform
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
Double_t sigma[nsteps]
Definition: dedx_bands.C:65
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
void Draw(Color_t color)
Double_t GetIsochroneError() const
Definition: PndSttHit.h:63
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
PndTrkConformalHit GetConformalSttHit(PndTrkHit *hit)
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
void PndTrkCombiLegendreTask::ComputePlaneExtremities ( PndTrkCluster cluster)

Definition at line 904 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCombiLegendreTransform::ComputeThetaR(), conformalhitlist, fabs(), fRmax, fRmin, fUmax, fUmin, fVmax, fVmin, PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), legendrecombi, r, theta, v, and v2.

Referenced by Exec().

904  {
905  fUmin = 1000, fVmin = 1000, fRmin = 1000;
906  fUmax = -1000, fVmax = -1000, fRmax = -1000;
907  double rc_of_min, rc_of_max;
908 
909 
910  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
912  double u = chit->GetU();
913  double v = chit->GetV();
914  double rc = chit->GetIsochrone();
915  u - rc < fUmin ? fUmin = u - rc : fUmin;
916  v - rc < fVmin ? fVmin = v - rc : fVmin;
917  u + rc > fUmax ? fUmax = u + rc : fUmax;
918  v + rc > fVmax ? fVmax = v + rc : fVmax;
919  // cout << "compute plane extremities " << chit->GetHit()->GetHitID() << " " << u << " " << v << " " << u - rc << " " << u + rc << " " << v - rc << " " << v + rc << endl;
920 
921  for(int jhit = ihit + 1; jhit < conformalhitlist->GetNofHits(); jhit++) {
923  double u2 = chit2->GetU();
924  double v2 = chit2->GetV();
925  double rc2 = chit2->GetIsochrone();
926 
927  double theta, r;
928  legendrecombi->ComputeThetaR(u, v, rc, u2, v2, rc2, theta, r);
929 
930  if(r < fRmin) {
931  fRmin = r;
932  rc < rc2 ? rc_of_min = rc : rc_of_min = rc2;
933  }
934  if(r > fRmax) {
935  fRmax = r;
936  rc < rc2 ? rc_of_max = rc2 : rc_of_max = rc;
937  }
938  }
939  }
940 
941  // cout << "u_min " << fUmin << " u_max " << fUmax << endl;
942  // cout << "v_min " << fVmin << " v_max " << fVmax << endl;
943  // cout << "r_min " << fRmin << " r_max " << fRmax << endl;
944  // cout << "theta_min 0 theta_max 180" << endl;
945 
946  // to square the conformal plane
947  double du = fUmax - fUmin;
948  double dv = fVmax - fVmin;
949  double delta = fabs(dv - du)/2.;
950  du < dv ? (fUmin -= delta, fUmax += delta) : (fVmin -= delta, fVmax += delta);
951 
952  // if(fVerbose > 0)
953  {
954  cout << "u_min " << fUmin << " u_max " << fUmax << endl;
955  cout << "v_min " << fVmin << " v_max " << fVmax << endl;
956  cout << "r_min " << fRmin << " r_max " << fRmax << endl;
957  cout << "theta_min 0 theta_max 180" << endl;
958  }
959 
960 }
double r
Definition: RiemannTest.C:14
PndTrkConformalHitList * conformalhitlist
void ComputeThetaR(double x1, double y1, double r1, double x2, double y2, double r2, double &theta, double &r)
__m128 v
Definition: P4_F32vec4.h:4
PndTrkConformalHit * GetHit(int index)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TVector3 v2
Definition: bump_analys.C:40
PndTrkCombiLegendreTransform * legendrecombi
PndTrkCluster * PndTrkCombiLegendreTask::ComputeSkewedXYZ ( PndTrkCluster cluster)
 PndTrkCluster *skewcluster = new PndTrkCluster();

loop on all the hist for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) { PndTrkHit *hit = cluster->GetHit(ihit); if(hit->IsStt() == kFALSE) continue; if(hit->IsSttParallel() == kTRUE) continue;

PndSttTube tube = (PndSttTube) fTubeArray->At(hit->GetTubeID()); int layID = tube->GetLayerID(); if(layID != 8 && layID != 10 && layID != 12 && layID != 14 && layID != 15) continue;

TObjArray *neighs = fHitMap->GetNeighboringsToHit(hit);

TVector3 poca1(-999, -999, -999), poca2; double iso1, iso2;

bool isfound = false; for(int jhit = 0; jhit < neighs->GetEntriesFast(); jhit++) { PndTrkHit hit2 = (PndTrkHit) neighs->At(jhit); PndSttTube tube2 = (PndSttTube) fTubeArray->At(hit2->GetTubeID()); int layID2 = tube2->GetLayerID();

8/10/12/14 seek the pre layer; 15 seeks the post layer if((layID != 15 && layID2 != layID - 1) || (layID == 15 && layID2 != layID + 1)) continue;

if all the "continue" were passed it means we are dealing with two stereo tubes with opposite tilting angle or a parallel + a stereo tube cout << "****************************" << endl; double distance = -999; if(poca1.X() == -999) { isfound = true; tube->GetPoca(tube2, poca1, poca2); iso1 = hit->GetIsochrone(); iso2 = hit2->GetIsochrone(); } else isfound = false; cout << endl;

PndSttHit hitI = (PndSttHit) fSttHitArray->At(hit->GetHitID()); PndSttHit hitII = (PndSttHit) fSttHitArray->At(hit2->GetHitID());

TVector3 pocamiddle; Double_t poca = (fMapper->GetGeometryMap())->CalculateStrawPoca(hitI, hitII, pocamiddle); cout << "distance " << poca << endl;

 if(isfound == true) {
 if(layID != 7 && layID != 15) {
 PndTrkHit *newhit = new PndTrkHit(*hit);
 newhit->SetPosition(poca1);
 newhit->SetRegion(INNER_LEFT); // CHECK to consider this as parallel for the fit in xy
 skewcluster->AddHit(newhit);
 }
 if(layID2 != 7 && layID2 != 15) {
 PndTrkHit *newhit2 = new PndTrkHit(*hit2);
 newhit2->SetPosition(poca2);
 newhit2->SetRegion(INNER_LEFT); // CHECK to consider this as parallel for the fit in xy
 skewcluster->AddHit(newhit2);
 }

 if(fDisplayOn)  {
 cout << " STARTING" << endl;

TMarker *mrkpoca1 = new TMarker(poca1.X(), poca1.Y(), 20); mrkpoca1->SetMarkerSize(0.5); mrkpoca1->Draw("SAME"); TMarker *mrkpoca2 = new TMarker(poca2.X(), poca2.Y(), 20); mrkpoca2->SetMarkerSize(0.5); mrkpoca2->Draw("SAME"); TMarker *mrkpoca = new TMarker(pocamiddle.X(), pocamiddle.Y(), 20); mrkpoca->SetMarkerColor(2); mrkpoca->SetMarkerSize(0.5); mrkpoca->Draw("SAME");

 TArc *mrkpoca1 = new TArc(poca1.X(), poca1.Y(), iso1);
 mrkpoca1->SetFillStyle(0);
 mrkpoca1->Draw("SAME");

 TArc *mrkpoca2 = new TArc(poca2.X(), poca2.Y(), iso2);
 mrkpoca2->SetFillStyle(0);
 mrkpoca2->Draw("SAME");

 display->Update();
 display->Modified();
 }
 }
 }
 }
 return skewcluster;

Definition at line 2258 of file PndTrkCombiLegendreTask.cxx.

2258  {
2350 }
void PndTrkCombiLegendreTask::ComputeTraAndRot ( PndTrkHit hit,
Double_t delta,
Double_t  trasl[2] 
)

Definition at line 894 of file PndTrkCombiLegendreTask.cxx.

References PndTrkHit::GetPosition().

Referenced by ClusterToConformal().

894  {
895 
896  trasl[0] = hit->GetPosition().X();
897  trasl[1] = hit->GetPosition().Y();
898 
899  delta = 0.; // TMath::ATan2(hit->GetPosition().Y() - 0., hit->GetPosition().X() - 0.); // CHECK
900 
901 }
TVector3 GetPosition()
Definition: PndTrkHit.h:62
Int_t PndTrkCombiLegendreTask::CountTracksInCluster ( PndTrkCluster cluster,
int *  noftracksinlayer 
)

Definition at line 1324 of file PndTrkCombiLegendreTask.cxx.

Referenced by CleanTrack(), and CountTracksInSkewSector().

1324  {
1325  return CountTracksInCluster(cluster, 0, noftracksinlayer);
1326 }
Int_t CountTracksInCluster(PndTrkCluster *cluster, int *noftracksinlayer)
Int_t PndTrkCombiLegendreTask::CountTracksInCluster ( PndTrkCluster cluster,
Int_t  where,
int *  noftracksinlayer 
)

int noftracks = nofhitsinlay[tmplayid] - isneigh; if(tmplayid != -1) cout << "CLUSTER CONTAINS @ LAYER " << tmplayid << " ACTUALLY " << nofhitsinlay[tmplayid] << " - " << isneigh << " = " << noftracks << " TRACKS" << endl; if(noftracks > maxnoftracks) maxnoftracks = noftracks;

Definition at line 1333 of file PndTrkCombiLegendreTask.cxx.

References counter, counter1, fTubeArray, PndTrkCluster::GetHit(), PndSttTube::GetLayerID(), PndTrkCluster::GetNofHits(), PndTrkHit::GetTubeID(), hit(), PndSttTube::IsNeighboring(), PndTrkHit::IsSttParallel(), PndTrkHit::SetSortVariable(), and PndTrkCluster::Sort().

1333  {
1334  // where means:
1335  // 0 all: parallel & skewed sectors
1336  // 1: only skewed
1337 
1338  // check how many neighboring tubes each skew
1339  // tube on a layer has on that same layer
1340  // the total number of tubes on a layer minus the number
1341  // of neighboring couples gives the number of tracks:
1342  // example 1 with 3 tracks:
1343  // OOO OO OOO are tube no.: 0 1 2 3 4 5 6 7
1344  // nof tubes on the layer = 8
1345  // calculation of neighborings:
1346  // 0 <--> 1
1347  // 1 <--> 2
1348  // 3 <--> 4
1349  // 5 <--> 6
1350  // 6 <--> 7
1351  // so, nof neigboging couples = 5
1352  // Then: noftubes (8) - nofcouples (5) = 3 tracks !!OK!!
1353  cout << "COUNT TRACKS IN SKEW SECTOR" << endl;
1354  int nofhitsinlay[30]; // CHECK initialize this
1355  for(int ilay = 0; ilay < 30; ilay++) nofhitsinlay[ilay] = 0;
1356 
1357  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1358  PndTrkHit *hit = cluster->GetHit(ihit);
1359  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1360  hit->SetSortVariable(tube->GetLayerID());
1361  nofhitsinlay[tube->GetLayerID()]++;
1362  // cout << "hit " << ihit << " " << tube->GetLayerID() << " " << nofhitsinlay[tube->GetLayerID()] << endl;
1363 
1364  }
1365  cluster->Sort();
1366 
1367  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1368  PndTrkHit *hit = cluster->GetHit(ihit);
1369  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1370  // cout << "SORTED " << ihit << " " << hit->GetHitID() << " " << tube->GetLayerID() << " " << nofhitsinlay[tube->GetLayerID()] << endl;
1371  }
1372 
1373  int maxnoftracks = 1;
1374  int tmplayid = -1;
1375  int counter = 0, counter1 = 0;;
1376  int isneigh = 0;
1377  // loop over cluster hits
1378  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1379  PndTrkHit *hit = cluster->GetHit(ihit);
1380  counter++;
1381 
1382  // which sector?
1383  if(where == 1 && hit->IsSttParallel() == kTRUE) continue;
1384  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1385 
1386  int layid = tube->GetLayerID();
1387  if(nofhitsinlay[layid] <= 1) {
1388  noftracksinlayer[layid] = nofhitsinlay[layid];
1389  continue;
1390  }
1391 
1392  // new layer?
1393  if(layid != tmplayid) {
1399  isneigh = 0;
1400  tmplayid = layid;
1401  counter1 = 0;
1402  // continue; // break;
1403  }
1404  // cout << "hit " << ihit << " on layid " << layid << "/ " << nofhitsinlay[layid] << endl;
1405 
1406  // count processed hits
1407  // in this same layer
1408  counter1++;
1409 
1410  // if it is the last hit ==> all its
1411  // neighborings have already been taken
1412  // into account
1413  if(counter1 == nofhitsinlay[layid]) continue;
1414 
1415  for(int jhit = counter; jhit < counter + nofhitsinlay[layid] - counter1; jhit++) {
1416  PndTrkHit *hit2 = cluster->GetHit(jhit);
1417  int tubeid2 = hit2->GetTubeID();
1418  PndSttTube *tube2 = (PndSttTube*) fTubeArray->At(tubeid2);
1419 
1420 
1421 
1422  if(tube->GetLayerID() != tube2->GetLayerID()) cout << "ERROR" << tube->GetLayerID() << " " << tube2->GetLayerID() << endl;
1423  // cout << "compare " << ihit << "(" << hit->GetHitID() << "- " << hit->GetTubeID() << ") with " << jhit << " (" << hit2->GetHitID() << "- " << tubeid2 << ") from " << counter << " to " << counter + nofhitsinlay[layid] - 1 << endl;
1424  if(tube->IsNeighboring(tubeid2) == kTRUE) {
1425  isneigh++;
1426  // cout << "isneigh " << isneigh << endl;
1427  // // break;
1428  }
1429  }
1430 
1431  // if all the hits in the layer have been processed
1432  if(counter1 == nofhitsinlay[layid] - 1) {
1433  int noftracks = nofhitsinlay[layid] - isneigh;
1434  cout << "CLUSTER CONTAINS @ LAYER " << layid << " ACTUALLY " << nofhitsinlay[layid] << " - " << isneigh << " = " << noftracks << " TRACKS" << endl;
1435  if(noftracks > maxnoftracks) maxnoftracks = noftracks;
1436 
1437  noftracksinlayer[layid] = noftracks;
1438  }
1439 
1440  }
1441 
1442  cout << "THIS CLUSTER HAS A TOTAL OF " << maxnoftracks << " TRACKS" << endl;
1443  return maxnoftracks;
1444 }
void SetSortVariable(Double_t sortvar)
Definition: PndTrkHit.h:44
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
int GetLayerID()
Definition: PndSttTube.cxx:128
Bool_t IsNeighboring(int tubeID)
Definition: PndSttTube.cxx:145
int counter
Definition: ZeeAnalysis.C:59
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
static int counter1
Definition: createSTT.C:27
Int_t PndTrkCombiLegendreTask::CountTracksInSkewSector ( PndTrkCluster cluster,
int *  noftracksinlayer 
)

Definition at line 1329 of file PndTrkCombiLegendreTask.cxx.

References CountTracksInCluster().

Referenced by Exec().

1329  {
1330  return CountTracksInCluster(cluster, 1, noftracksinlayer);
1331 }
Int_t CountTracksInCluster(PndTrkCluster *cluster, int *noftracksinlayer)
PndTrkCluster * PndTrkCombiLegendreTask::CreateClusterAroundTrack ( PndTrkTrack track)

Definition at line 1800 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCluster::AddHit(), display, DoesBelong(), PndTrkCluster::DoesContain(), PndTrkCluster::Draw(), PndTrkHit::DrawTube(), fabs(), fDisplayOn, fTubeArray, PndTrkTrack::GetCenter(), PndTrkTrack::GetCluster(), PndTrkHitList::GetHit(), PndTrkCluster::GetHit(), PndSttTube::GetLayerID(), PndTrkHitList::GetNofHits(), PndTrkCluster::GetNofHits(), PndTrkTrack::GetRadius(), PndSttTube::GetSectorID(), PndTrkHit::GetTubeID(), hit(), R, and stthitlist.

Referenced by Exec().

1800  {
1801 
1802  PndTrkCluster *cluster = track->GetCluster();
1803 
1804  cout << "CREATE CLUSTER AROUND TRACK " << track->GetCluster() << " with hits " << track->GetCluster()->GetNofHits() << endl;
1805 
1806  double R = track->GetRadius();
1807  double xc = track->GetCenter().X();
1808  double yc = track->GetCenter().Y();
1809 
1810  // create cluster depending on fitting
1811  PndTrkCluster *thiscluster = new PndTrkCluster();
1812  int startsecid = 1000, endsecid = -1, startlayid = 1000, endlayid = -1;
1813 
1814 
1815  // ...................................................
1816  // I. clean existing cluster
1817  // add hits within certain rmin & rmax;
1818  // find min/max sec/layer
1819  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1820  PndTrkHit *hit = cluster->GetHit(ihit);
1821  bool doesitbelong = DoesBelong(hit, xc, yc, R);
1822  if(doesitbelong == kTRUE) {
1823  thiscluster->AddHit(hit);
1824  if(fDisplayOn) {
1825  display->cd(1);
1826  hit->DrawTube(kGreen);
1827  }
1828 
1829  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1830 
1831  if(tube->GetLayerID() < startlayid) startlayid = tube->GetLayerID();
1832  if(tube->GetSectorID() < startsecid) startsecid = tube->GetSectorID();
1833  if(tube->GetLayerID() > endlayid) endlayid = tube->GetLayerID();
1834  if(tube->GetSectorID() > endsecid) endsecid = tube->GetSectorID();
1835  }
1836  }
1837 
1838  cout << "START SECTOR " << startsecid << " END SECTOR " << endsecid << endl;
1839  cout << "START LAYER " << startlayid << " END LAYER " << endlayid << endl;
1840 
1841  if(fDisplayOn) {
1842  display->cd(1);
1843  thiscluster->Draw(kRed);
1844  display->Update();
1845  display->Modified();
1846  char goOnChar;
1847  // cout << "want to go to next cluster1?" << endl;
1848  // cin >> goOnChar;
1849  }
1850  // ...................................................
1851  // II. for its not in the cluster
1852  bool select_sec_lay = true;
1853  if((select_sec_lay == true && (startlayid != 0 || endlayid != 23)) || select_sec_lay == false)
1854  {
1855  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1856  PndTrkHit *hit = stthitlist->GetHit(ihit);
1857  if(cluster->DoesContain(hit)) continue;
1858  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1859  bool doesitbelong = DoesBelong(hit, xc, yc, R);
1860  if(doesitbelong == kTRUE) {
1861 
1862  if(select_sec_lay == true) {
1863  if(tube->GetSectorID() == 0 || tube->GetSectorID() == 5) {
1864  if(startsecid != 5 && endsecid != 5 && startsecid != 0 && endsecid != 0) continue;
1865  }
1866  else if(fabs(tube->GetSectorID() - startsecid) > 1 && fabs(tube->GetSectorID() - endsecid) > 1) continue;
1867  if(tube->GetLayerID() > startlayid && tube->GetLayerID() < endlayid) continue;
1868  }
1869 
1870  if(fDisplayOn) {
1871  display->cd(1);
1872  hit->DrawTube(kBlue);
1873  display->Update();
1874  display->Modified();
1875  char goOnChar;
1876  cout << "want to go to next?" << endl;
1877  // cin >> goOnChar;
1878  }
1879 
1880  thiscluster->AddHit(hit);
1881  }
1882  }
1883  }
1884  cout << endl;
1885 
1886  if(fDisplayOn) {
1887  display->cd(1);
1888  thiscluster->Draw(kRed);
1889  display->Update();
1890  display->Modified();
1891  char goOnChar;
1892  // cout << "want to go to next cluster2?" << endl;
1893  // cin >> goOnChar;
1894  }
1895  // ---------------------------
1896 
1897  return thiscluster;
1898 }
Double_t GetRadius()
Definition: PndTrkTrack.h:43
void Draw(Color_t color=kBlack)
PndTrkCluster GetCluster()
Definition: PndTrkTrack.h:48
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
PndTrkHit * GetHit(int index)
int GetLayerID()
Definition: PndSttTube.cxx:128
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void DrawTube(Color_t color)
Definition: PndTrkHit.cxx:178
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
Bool_t DoesContain(PndTrkHit *hit)
Bool_t DoesBelong(PndTrkHit *hit, double xc, double yc, double R)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
int GetSectorID()
Definition: PndSttTube.cxx:124
Int_t GetTubeID()
Definition: PndTrkHit.h:61
Double_t R
Definition: checkhelixhit.C:61
PndTrkCluster * PndTrkCombiLegendreTask::CreateClusterAroundTrack2 ( PndTrkTrack track)

Definition at line 1582 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCluster::AddHit(), PndTrkTools::ComputePocaToPointOnCircle2(), CTOUTRADIUS, display, DoesBelong(), PndTrkCluster::Draw(), PndTrkHit::DrawTube(), fDisplayOn, fTubeArray, PndTrkTrack::GetCenter(), PndTrkHitList::GetHit(), PndTrkCluster::GetHit(), PndSttTube::GetLayerID(), PndTrkHitList::GetNofHits(), PndTrkCluster::GetNofHits(), PndTrkHit::GetPosition(), PndTrkTrack::GetRadius(), PndSttTube::GetSectorID(), PndTrkHit::GetTubeID(), hit(), isec, R, stthitlist, and tools.

Referenced by Exec().

1582  {
1583 
1584  double R = track->GetRadius();
1585  double xc = track->GetCenter().X();
1586  double yc = track->GetCenter().Y();
1587 
1588  // create cluster depending on fitting
1589  PndTrkCluster *thiscluster = new PndTrkCluster();
1590  int startsecid = 1000, endsecid = -1, startlayid = 1000, endlayid = -1;
1591 
1592  // initialization
1593  int nofhitsinsec[6], lowlayinsec[6], uplayinsec[6];
1594  TVector2 lowinsec[6], upinsec[6];
1595  bool sectorsallow[6];
1596  for(int isec = 0; isec < 6; isec++) {
1597  nofhitsinsec[isec] = 0;
1598  lowlayinsec[isec] = 1000;
1599  uplayinsec[isec] = -1;
1600  sectorsallow[isec] = false;
1601  }
1602 
1603  int maxnofhits = -1, maxhitsec = -1;
1604  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1605  PndTrkHit *hit = stthitlist->GetHit(ihit);
1606  bool doesitbelong = DoesBelong(hit, xc, yc, R);
1607  if(doesitbelong == kTRUE) {
1608  thiscluster->AddHit(hit);
1609  if(fDisplayOn) {
1610  display->cd(1);
1611  hit->DrawTube(kGreen);
1612  }
1613 
1614  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1615  int isec = tube->GetSectorID();
1616  int ilay = tube->GetLayerID();
1617 
1618  if(ilay < startlayid) startlayid = ilay;
1619  if(isec < startsecid) startsecid = isec;
1620  if(ilay > endlayid) endlayid = ilay;
1621  if(isec > endsecid) endsecid = isec;
1622  nofhitsinsec[isec]++;
1623  if(maxnofhits < nofhitsinsec[isec]) {
1624  maxnofhits = nofhitsinsec[isec];
1625  maxhitsec = isec;
1626  }
1627  if(ilay < lowlayinsec[isec]) {
1628  lowlayinsec[isec] = ilay;
1629  lowinsec[isec].Set(hit->GetPosition().X(), hit->GetPosition().Y());
1630  }
1631  if(ilay > uplayinsec[isec]) {
1632  uplayinsec[isec] = ilay;
1633  upinsec[isec].Set(hit->GetPosition().X(), hit->GetPosition().Y());
1634  }
1635  }
1636  }
1637 
1638  // ============== CHECK ALLOWED SECTORS ================
1639  sectorsallow[maxhitsec] = true;
1640  for(int isec = maxhitsec + 1; isec <= endsecid; isec++) {
1641  if(nofhitsinsec[isec] != 0) sectorsallow[isec] = true;
1642  else break;
1643  }
1644  for(int isec = maxhitsec - 1; isec >= startsecid; isec--) {
1645  if(nofhitsinsec[isec] != 0) sectorsallow[isec] = true;
1646  else break;
1647  }
1648  if(sectorsallow[0] == true && nofhitsinsec[5] > 0) sectorsallow[5] = true;
1649  if(sectorsallow[5] == true && nofhitsinsec[0] > 0) sectorsallow[0] = true;
1650  // ======================================================
1651 
1652  // I have the center of the track circle (xc, yc) and I want
1653  // the point ON the circle (0, 0, CTOUTRADIUS) closest to it
1654  TVector2 qpoint = tools->ComputePocaToPointOnCircle2(xc, yc, 0, 0, CTOUTRADIUS);
1655  double OQ = qpoint.Mod();
1656  TVector2 center(xc, yc);
1657  double OC = center.Mod();
1658 
1659  // check if there is the intersection
1660  // center of curvature inside OR outside CT
1661  if((OC < CTOUTRADIUS && (OC + R) > CTOUTRADIUS) || (OC > CTOUTRADIUS && (OC - R) < CTOUTRADIUS)) {
1662  double arrow = OC + R - OQ;
1663  cout << "========================> ARROW " << arrow << endl;
1664 
1665  bool sectorsallow2[6];
1666  for(int isec = 0; isec < 6; isec++) { // CHECK hardcoded nof sectors
1667  sectorsallow2[isec] = false;
1668  }
1669 
1670  int nofsteps = endsecid - startsecid;
1671  if(nofsteps == 5) nofsteps++;
1672  int nofstepsup = endsecid - maxhitsec;
1673  int nofstepsdown = maxhitsec - startsecid;
1674  sectorsallow2[maxhitsec] = true;
1675  cout << "nofsteps " << nofsteps << " whose up " << nofstepsup << " and down " << nofstepsdown << endl;
1676 
1677  for(int isec = 0; isec < 6; isec++) {
1678  cout << "preliminary sec " << isec << " " << sectorsallow[isec] << endl;
1679  }
1680  for(int isec = 0; isec < 6; isec++) {
1681  cout << "preliminary sec2 " << isec << " " << sectorsallow2[isec] << endl;
1682  }
1683  for(int isec = 0; isec < nofsteps; isec++) {
1684  int ksec = maxhitsec, jsec;
1685  if(isec < nofstepsup) {
1686  ksec += isec;
1687  if(ksec > 5) ksec -= 6;
1688  jsec = ksec;
1689  jsec++;
1690  if(ksec == 5) jsec = 0;
1691  }
1692  else {
1693  ksec -= (isec - nofstepsup);
1694  if(ksec < 0) ksec += 6;
1695  jsec = ksec;
1696  jsec--;
1697  if(ksec == 0) jsec = 5;
1698  }
1699  cout << "===== ksec " << ksec << " jsec " << jsec << endl;
1700  cout << "sectorsallow2[0]: " << sectorsallow2[0] << endl;
1701 
1702  // cout << "ksec layers " << lowlayinsec[ksec] << " " << uplayinsec[ksec] << endl;
1703  // cout << lowinsec[ksec].Mod() << " " << upinsec[ksec].Mod() << endl;
1704  // cout << lowinsec[ksec].X() << " " << lowinsec[ksec].Y() << endl;
1705  // cout << upinsec[ksec].X() << " " << upinsec[ksec].Y() << endl;
1706  // cout << "jsec layers " << lowlayinsec[jsec] << " " << uplayinsec[jsec] << endl;
1707  // cout << lowinsec[jsec].Mod() << " " << upinsec[jsec].Mod() << endl;
1708  // cout << lowinsec[jsec].X() << " " << lowinsec[jsec].Y() << endl;
1709  // cout << upinsec[jsec].X() << " " << upinsec[jsec].Y() << endl;
1710 
1711  if(sectorsallow[ksec] == true && sectorsallow[jsec] == true) {
1712  cout << "go on " << endl;
1713 
1714  if(upinsec[ksec].Mod() > 39 && upinsec[jsec].Mod() > 39) { // both pieces @ CTOUTRADIUS?
1715  if(arrow < 7.5) {
1716  cout << "BOTH AT OUTER RADIUS" << endl;
1717  sectorsallow2[ksec] = true;
1718  sectorsallow2[jsec] = true;
1719  }
1720  else cout << "WRONG BOTH AT OUTER RADIUS ************* " << upinsec[ksec].Mod() << " " << upinsec[jsec].Mod() << endl;
1721  }
1722  else if(lowinsec[ksec].Mod() < 17 && lowinsec[jsec].Mod() < 17) { // both @ 0
1723  if(arrow < 7.5) {
1724  cout << "BOTH AT INNER RADIUS" << endl;
1725  sectorsallow2[ksec] = true;
1726  sectorsallow2[jsec] = true;
1727  }
1728  else cout << "WRONG BOTH AT INNER RADIUS ************* " << lowinsec[ksec].Mod() << " " << lowinsec[jsec].Mod() << endl;
1729  }
1730  else { // one here/one there
1731  TVector2 lowvec, upvec;
1732  int lowlay, uplay;
1733  (upinsec[ksec] - lowinsec[jsec]).Mod() < (lowinsec[ksec] - upinsec[jsec]).Mod() ? (lowvec = lowinsec[jsec], upvec = upinsec[ksec], lowlay = lowlayinsec[jsec] , uplay = uplayinsec[ksec]) : (upvec = upinsec[jsec], lowvec = lowinsec[ksec], lowlay = lowlayinsec[ksec], uplay = uplayinsec[jsec]);
1734  if((upvec - lowvec).Mod() < 10) {
1735  cout << "ONE HERE / ONE THERE" << endl;
1736  sectorsallow2[ksec] = true;
1737  sectorsallow2[jsec] = true;
1738  }
1739  else {
1740  cout << "WRONG ONE HERE / ONE THERE *************** " << (upvec - lowvec).Mod() << " " << lowlay << " " << uplay << endl;
1741 
1742  }
1743 
1744  }
1745  }
1746 
1747  cout << "@step " << isec << ":";
1748  for(int lsec = 0; lsec < 6; lsec++) cout << " " << sectorsallow2[lsec];
1749  cout << endl;
1750 
1751 
1752 
1753  }
1754  for(int isec = 0; isec < 6; isec++) {
1755  sectorsallow[isec] = sectorsallow2[isec];
1756  cout << "final " << sectorsallow[isec] << endl;
1757  }
1758 
1759  }
1760  else cout << "========================> NO INTERSECTION " << OQ << " " << CTOUTRADIUS << " " << R << endl;
1761 
1762 
1763 
1764 
1765  if(fDisplayOn) {
1766  display->cd(1);
1767  thiscluster->Draw(kRed);
1768  display->Update();
1769  display->Modified();
1770  char goOnChar;
1771  // cout << "want to go to next cluster2?" << endl;
1772  // cin >> goOnChar;
1773  }
1774 
1775  cout << "START SECTOR " << startsecid << " END SECTOR " << endsecid << endl;
1776  cout << "START LAYER " << startlayid << " END LAYER " << endlayid << endl;
1777  cout << "MAX NOF HITS IS " << maxnofhits << "/" << thiscluster->GetNofHits() << " IN SEC " << maxhitsec << endl;
1778  for(int isec = 0; isec < 6; isec++) {
1779  if(nofhitsinsec[isec] > 0) cout << "isec " << isec << " " << nofhitsinsec[isec] << " from lay " << lowlayinsec[isec] << " to lay " << uplayinsec[isec] << " allowed? " << sectorsallow[isec] << endl;
1780  }
1781 
1782 
1783 
1784  PndTrkCluster *thiscluster2 = new PndTrkCluster();
1785  for(int ihit = 0; ihit < thiscluster->GetNofHits(); ihit++) {
1786  PndTrkHit *hit = thiscluster->GetHit(ihit);
1787  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
1788  int isec = tube->GetSectorID();
1789  if(sectorsallow[isec] == true) {
1790  thiscluster2->AddHit(hit);
1791  if(fDisplayOn) {
1792  display->cd(1);
1793  hit->DrawTube(kRed);
1794  }
1795  }
1796  }
1797  return thiscluster2;
1798 }
Double_t GetRadius()
Definition: PndTrkTrack.h:43
void Draw(Color_t color=kBlack)
void AddHit(PndTrkHit *hit)
PndTrkHit * GetHit(int index)
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
PndTrkHit * GetHit(int index)
int GetLayerID()
Definition: PndSttTube.cxx:128
int isec
Definition: f_Init.h:19
TVector2 ComputePocaToPointOnCircle2(double x, double y, double xc, double yc, double R)
Definition: PndTrkTools.cxx:36
TVector3 GetPosition()
Definition: PndTrkHit.h:62
void DrawTube(Color_t color)
Definition: PndTrkHit.cxx:178
#define CTOUTRADIUS
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
Bool_t DoesBelong(PndTrkHit *hit, double xc, double yc, double R)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
int GetSectorID()
Definition: PndSttTube.cxx:124
Int_t GetTubeID()
Definition: PndTrkHit.h:61
Double_t R
Definition: checkhelixhit.C:61
PndTrkCluster * PndTrkCombiLegendreTask::CreateClusterAroundTrack3 ( PndTrkTrack track)

Definition at line 1900 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCluster::AddHit(), display, PndTrkCluster::Draw(), PndTrkHit::DrawTube(), fabs(), fDisplayOn, PndTrkTrack::GetCenter(), PndTrkTrack::GetCluster(), PndTrkCluster::GetHit(), PndTrkCluster::GetNofHits(), PndTrkTrack::GetRadius(), PndTrkHit::GetXYDistance(), hit(), and R.

Referenced by Exec().

1900  {
1901 
1902  PndTrkCluster *cluster = track->GetCluster();
1903 
1904  cout << "CREATE CLUSTER AROUND TRACK " << track->GetCluster() << " with hits " << track->GetCluster()->GetNofHits() << endl;
1905 
1906  double R = track->GetRadius();
1907  double xc = track->GetCenter().X();
1908  double yc = track->GetCenter().Y();
1909 
1910  // create cluster depending on fitting
1911  PndTrkCluster *thiscluster = new PndTrkCluster();
1912  for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1913  PndTrkHit *hit = cluster->GetHit(ihit);
1914  double distance = hit->GetXYDistance(TVector3(xc, yc, 0.));
1915 
1916  double distancefromtrack = fabs(distance - R);
1917  if(distancefromtrack < 1) {
1918  thiscluster->AddHit(hit);
1919  if(fDisplayOn) {
1920  display->cd(1);
1921  hit->DrawTube(kGreen);
1922  }
1923  }
1924  }
1925 
1926  if(fDisplayOn) {
1927  display->cd(1);
1928  thiscluster->Draw(kRed);
1929  display->Update();
1930  display->Modified();
1931  char goOnChar;
1932  // cout << "want to go to next cluster2?" << endl;
1933  // cin >> goOnChar;
1934  }
1935  // ---------------------------
1936 
1937  return thiscluster;
1938 }
Double_t GetRadius()
Definition: PndTrkTrack.h:43
void Draw(Color_t color=kBlack)
PndTrkCluster GetCluster()
Definition: PndTrkTrack.h:48
void AddHit(PndTrkHit *hit)
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
PndTrkHit * GetHit(int index)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void DrawTube(Color_t color)
Definition: PndTrkHit.cxx:178
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 GetXYDistance(PndTrkHit *fromhit)
Definition: PndTrkHit.cxx:94
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Double_t R
Definition: checkhelixhit.C:61
PndTrkClusterList PndTrkCombiLegendreTask::CreateFullClusterization ( )

Definition at line 1215 of file PndTrkCombiLegendreTask.cxx.

References PndTrkClusterList::AddCluster(), PndTrkCluster::AddHit(), PndTrkCluster::DoesContain(), fHitMap, fTubeArray, PndTrkCluster::GetHit(), PndSttTube::GetLayerID(), PndTrkNeighboringMap::GetNeighboringsToHit(), PndTrkCluster::GetNofHits(), PndTrkNeighboringMap::GetSeeds(), PndTrkHit::GetTubeID(), and PndTrkHit::IsUsed().

1215  {
1216  PndTrkClusterList clusterlist;
1217 
1218  // get seeds *********************************************8
1219  TObjArray seeds = fHitMap->GetSeeds();
1220  TObjArray *neighborings = NULL;
1221 
1222  // ----------------- loop over seeds
1223  for(int iseed = 0; iseed < seeds.GetEntriesFast(); iseed++) {
1224  PndTrkCluster *cluster = new PndTrkCluster();
1225  PndTrkHit *seedhit = (PndTrkHit*) seeds.At(iseed);
1226 
1227  // is it already used
1228  if(seedhit->IsUsed() == kTRUE) continue;
1229 
1230  int seedtubeID = seedhit->GetTubeID();
1231  PndSttTube *seedtube = (PndSttTube*) fTubeArray->At(seedtubeID);
1232  int seedlayerID = seedtube->GetLayerID();
1233 
1234  // add hit to cluster
1235  cluster->AddHit(seedhit);
1236 
1237  // if(fDisplayOn) {
1238  // char goOnChar;
1239  // cin >> goOnChar;
1240  // cout << "SEED " << seedtubeID << endl;
1241  // cluster->LightUp();
1242  // display->Update();
1243  // display->Modified();
1244  // }
1245 
1246  // // add cluster to clusterlist
1247  // clusterlist.AddCluster(cluster);
1248 
1249  int nlastadded = 1, addedcounter = 0;
1250  // cout << "nlastadded to " << seedhit->GetHitID() << "(" << seedtubeID << ")" << " " << nlastadded << endl;
1251  // if(nlastadded == 0) continue;
1252  while(nlastadded > 0) {
1253  // loop on the last nlastadded hits to this cluster
1254  // example: add to a 5 hits cluster: 0 1 2 3 4
1255  // the hits no. 5, 6, 7
1256  // --> nlastadded = 3 & nof hits in cluster = 5 + 3 = 8
1257  // 7 6 5 = 8 - 3
1258  // here loop from hit 8 - 1 = 7 to hit 8 - 3 = 5
1259 
1260  addedcounter = 0;
1261 
1262  // cout << "@@@@@@@@@@@@@@@@@ loop on the last " << nlastadded << " hits of cluster" << endl;
1263  // for(int ihit = 0; ihit < cluster->GetNofHits(); ihit++) {
1264  // PndTrkHit *hit = cluster->GetHit(ihit);
1265  // cout << " " << hit->GetHitID() ;
1266  // }
1267  // cout << endl;
1268 
1269 
1270  int nclusterhits = cluster->GetNofHits();
1271  for(int iadded = nclusterhits - 1; iadded >= (nclusterhits - nlastadded); iadded--) {
1272  PndTrkHit *addedhit = cluster->GetHit(iadded);
1273  neighborings = fHitMap->GetNeighboringsToHit(addedhit);
1274  if(neighborings->GetEntriesFast() == 0) continue;
1275  // cout << "hit " << addedhit->GetHitID() << "(" << addedhit->GetTubeID() << ")" << " has " << neighborings->GetEntriesFast() << " neighborigns: " << endl;
1276 
1277  // loop over the neighborings and add them all
1278  for(int ineigh = 0; ineigh < neighborings->GetEntriesFast(); ineigh++)
1279  {
1280  PndTrkHit *neighhit = (PndTrkHit*) neighborings->At(ineigh);
1281  // cout << " " << neighhit->GetHitID() << "(" << neighhit->GetTubeID() << ")";
1282  if(cluster->DoesContain(neighhit) == kTRUE) {
1283  // cout << "UN-ADDED, in cluster already" << endl;
1284  continue;
1285  }
1286  cluster->AddHit(neighhit);
1287  addedcounter++;
1288  // cout << " - ADDED; ";
1289 
1290  // if(fDisplayOn) {
1291  // char goOnChar;
1292  // cin >> goOnChar;
1293  // cluster->LightUp();
1294  // display->Update();
1295  // display->Modified();
1296  // // cin >> goOnChar;
1297  // }
1298 
1299  }
1300 
1301 
1302  }
1303  // cout << endl;
1304  nlastadded = addedcounter;
1305  }
1306  // cout << "NEXT seed " << endl;
1307  // add cluster to clusterlist
1308  if(cluster->GetNofHits() > 3) clusterlist.AddCluster(cluster); // CHECK
1309 
1310  }
1311  return clusterlist;
1312 }
TObjArray GetNeighboringsToHit(PndTrkHit *hit)
void AddHit(PndTrkHit *hit)
PndTrkNeighboringMap * fHitMap
PndTrkHit * GetHit(int index)
void AddCluster(PndTrkCluster *cluster)
int GetLayerID()
Definition: PndSttTube.cxx:128
Bool_t IsUsed()
Definition: PndTrkHit.h:58
Bool_t DoesContain(PndTrkHit *hit)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Int_t GetTubeID()
Definition: PndTrkHit.h:61
PndTrkClusterList PndTrkCombiLegendreTask::CreateFullClusterization2 ( )

PndTrkClusterList clusterlist;

get seeds *********************************************8 TObjArray seeds = fHitMap->GetSeeds(); neighborings = NULL;

Definition at line 1314 of file PndTrkCombiLegendreTask.cxx.

1314  {
1322 }
Bool_t PndTrkCombiLegendreTask::DoesBelong ( PndTrkHit hit,
double  xc,
double  yc,
double  R 
)

if(dist < 5 * hit->GetIsochrone()) { if(distance <= rmax && distance >= rmin) cout << " distance " << distance << " dist " << dist << " " << hit->GetIsochrone() << " "<< sttpnt->GetTrackID() << endl; else cout << "\033[1;31m distance " << distance << " dist " << dist << "\033[0m" << " " << hit->GetIsochrone() << " "<< sttpnt->GetTrackID() << endl; } else if(distance <= rmax && distance >= rmin) cout << "\033[1;33m distance " << distance << " dist " << dist << "\033[0m" << " " << hit->GetIsochrone() << " "<< sttpnt->GetTrackID() << endl;

Definition at line 1550 of file PndTrkCombiLegendreTask.cxx.

References fabs(), fSttHitArray, fSttPointArray, PndTrkHit::GetHitID(), PndTrkHit::GetIsochrone(), PndTrkHit::GetXYDistance(), and PndTrkHit::IsStt().

Referenced by CreateClusterAroundTrack(), and CreateClusterAroundTrack2().

1550  {
1551 
1552  // create cluster depending on fitting
1553  double rmin = R - 1;// R * 0.05; // CHECK value%? // CHECK CAN BE DONE ONCE FOR EACH TRACK
1554  double rmax = R + 1;// R * 0.05; // " "
1555  // cout << "rmin " << rmin << " rmax " << rmax << endl;
1556 
1557  double distance = hit->GetXYDistance(TVector3(xc, yc, 0.));
1558  double dist = fabs(distance - R);
1559 
1560  // ------- to be deleted --- only to check MC truth
1561  if(hit->IsStt()) {
1562  PndSttHit *stthit = (PndSttHit*) fSttHitArray->At(hit->GetHitID());
1563  PndSttPoint *sttpnt = (PndSttPoint*) fSttPointArray->At(stthit->GetRefIndex());
1571  }
1572  // ------------------------------------------------
1573 
1574 
1575 
1576  // if(distance <= rmax && distance >= rmin) {
1577  // if(dist < 5 * hit->GetIsochrone()) {
1578  if((distance <= rmax && distance >= rmin) || (dist < 5 * hit->GetIsochrone())) return kTRUE;
1579  return kFALSE;
1580 }
Int_t GetHitID()
Definition: PndTrkHit.h:56
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
Double_t GetXYDistance(PndTrkHit *fromhit)
Definition: PndTrkHit.cxx:94
Bool_t IsStt()
Definition: PndTrkHit.h:72
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Double_t R
Definition: checkhelixhit.C:61
void PndTrkCombiLegendreTask::DrawConfHit ( double  x,
double  y,
double  r,
int  marker = 2 
)

Definition at line 707 of file PndTrkCombiLegendreTask.cxx.

References display.

707  {
708  display->cd(2);
709  if(r >= 0) {
710  TArc *arc = new TArc(u, v, r);
711  arc->SetFillStyle(0);
712  arc->Draw("SAME");
713  }
714  else {
715  TMarker *mrk = new TMarker(u, v, marker);
716  mrk->Draw("SAME");
717  }
718  // display->Update();
719  // display->Modified();
720 }
double r
Definition: RiemannTest.C:14
__m128 v
Definition: P4_F32vec4.h:4
void PndTrkCombiLegendreTask::DrawGeometry ( int  cpad = 1)

Definition at line 558 of file PndTrkCombiLegendreTask.cxx.

References display, and DrawSttGeometry().

Referenced by Exec(), and Refresh().

558  {
559  display->cd(cpad);
560  DrawSttGeometry();
561 }
void PndTrkCombiLegendreTask::DrawGeometryConf ( double  x1,
double  x2,
double  y1,
double  y2 
)

Definition at line 592 of file PndTrkCombiLegendreTask.cxx.

References display, and huv.

Referenced by Exec(), and LegendreFit().

592  {
593  // CHECK
594  char goOnChar;
595  // cout << "DRAWING GEOMETRY CONF" << endl;
596  // cin >> goOnChar;
597 
598  // CHECK previous calculations, now not used;
599  if(huv == NULL) huv = new TH2F("huv", "uv plane", 100, x1, x2, 100, y1, y2);
600  else {
601  huv->Reset();
602  huv->GetXaxis()->SetLimits(x1, x2);
603  huv->GetYaxis()->SetLimits(y1, y2);
604  }
605  display->cd(2);
606  huv->SetStats(kFALSE);
607  huv->Draw();
608  display->Update();
609  display->Modified();
610 
611 }
void PndTrkCombiLegendreTask::DrawHits ( PndTrkHitList hitlist)

Definition at line 551 of file PndTrkCombiLegendreTask.cxx.

References display, and PndTrkHitList::Draw().

Referenced by Refresh().

551  {
552  display->cd(1);
553  hitlist->Draw();
554  display->Update();
555  display->Modified();
556 }
void Draw(Color_t color=kBlack)
void PndTrkCombiLegendreTask::DrawLegendreHisto ( )

Definition at line 536 of file PndTrkCombiLegendreTask.cxx.

References display, PndTrkCombiLegendreTransform::Draw(), and legendrecombi.

536  {
537  display->cd(3);
538  legendrecombi->Draw();
539  display->Update();
540  display->Modified();
541 }
PndTrkCombiLegendreTransform * legendrecombi
void PndTrkCombiLegendreTask::DrawLists ( )

Definition at line 614 of file PndTrkCombiLegendreTask.cxx.

References counter, fHitMap, fTubeArray, PndTrkNeighboringMap::GetCandseeds(), PndTrkNeighboringMap::GetIndivisibles(), PndSttTube::GetLayerID(), PndTrkNeighboringMap::GetNeighboringsToHit(), PndTrkNeighboringMap::GetSeeds(), PndTrkNeighboringMap::GetStandalone(), PndTrkHit::GetTubeID(), and i.

Referenced by FillHitMap().

614  {
615  char goOnChar;
616  // cout << "new hit?" << endl;
617  // cin >> goOnChar;
618  // Refresh();
619 
620 
621  for(int i = 0; i < fHitMap->GetStandalone().GetEntriesFast(); i++) {
622  PndTrkHit *hitA = (PndTrkHit*) fHitMap->GetStandalone().At(i);
623  // hitA->DrawTube(kGreen);
624  }
625  for(int i = 0; i < fHitMap->GetSeeds().GetEntriesFast(); i++) {
626  PndTrkHit *hitA = (PndTrkHit*) fHitMap->GetSeeds().At(i);
627  // hitA->DrawTube(kRed);
628  }
629  for(int i = 0; i < fHitMap->GetCandseeds().GetEntriesFast(); i++) {
630  PndTrkHit *hitA = (PndTrkHit*) fHitMap->GetCandseeds().At(i);
631  // hitA->DrawTube(kBlue);
632  }
633  for(int i = 0; i < fHitMap->GetIndivisibles().GetEntriesFast(); i++) {
634  PndTrkHit *hitA = (PndTrkHit*) fHitMap->GetIndivisibles().At(i);
635  // hitA->DrawTube(kOrange);
636  TObjArray *neighs = fHitMap->GetNeighboringsToHit(hitA);
637  for(int j = 0; j < neighs->GetEntriesFast(); j++) {
638  PndTrkHit *hitB = (PndTrkHit*) neighs->At(j);
639  TObjArray *neighs2 = fHitMap->GetNeighboringsToHit(hitA);
640  if(neighs2->GetEntriesFast() > 2) {
641  int counter = 0;
642  PndSttTube *tubeB = (PndSttTube* ) fTubeArray->At(hitB->GetTubeID());
643  for(int k = 0; k < neighs2->GetEntriesFast(); k++) {
644  PndTrkHit *hitC = (PndTrkHit*) neighs2->At(k);
645  PndSttTube *tubeC = (PndSttTube* ) fTubeArray->At(hitC->GetTubeID());
646  // cout << "tubes " << tubeB << " "<< tubeC << endl;
647  if(tubeB->GetLayerID() == tubeC->GetLayerID()) continue;
648  counter++;
649  }
650  if(counter > 2) continue;
651  }
652  // hitB->DrawTube(kYellow);
653  }
654  // display->Update();
655  // display->Modified();
656  // cin >> goOnChar;
657 
658  }
659 
660  // for(int i = 0; i < limits.GetEntriesFast(); i++) {
661  // PndTrkHit *hitA = (PndTrkHit*) limits.At(i);
662  // hitA->DrawTube(kYellow);
663  // }
664 
665  // display->Update();
666  // display->Modified();
667  // cin >> goOnChar;
668 }
Int_t i
Definition: run_full.C:25
TObjArray GetNeighboringsToHit(PndTrkHit *hit)
PndTrkNeighboringMap * fHitMap
int GetLayerID()
Definition: PndSttTube.cxx:128
int counter
Definition: ZeeAnalysis.C:59
Int_t GetTubeID()
Definition: PndTrkHit.h:61
void PndTrkCombiLegendreTask::DrawNeighborings ( )

Definition at line 672 of file PndTrkCombiLegendreTask.cxx.

References DrawNeighboringsToHit(), PndTrkHitList::GetHit(), PndTrkHitList::GetNofHits(), hit(), and stthitlist.

Referenced by FillHitMap().

672  {
673  char goOnChar;
674 
675  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
676  cout << "new neigh hit?" << endl;
677  cin >> goOnChar;
678  PndTrkHit *hit = stthitlist->GetHit(ihit);
680  cin >> goOnChar;
681  }
682 
683 }
PndTrkHit * GetHit(int index)
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
void DrawNeighboringsToHit(PndTrkHit *hit)
void PndTrkCombiLegendreTask::DrawNeighboringsToHit ( PndTrkHit hit)

Definition at line 685 of file PndTrkCombiLegendreTask.cxx.

References display, PndTrkHit::DrawTube(), fHitMap, fTubeArray, PndTrkHit::GetHitID(), PndSttTube::GetLayerID(), PndTrkNeighboringMap::GetNeighboringsToHit(), PndTrkHit::GetTubeID(), i, and Refresh().

Referenced by DrawNeighborings().

685  {
686 
687 
688  Refresh();
689  hit->DrawTube(kYellow);
690  PndSttTube *tube = (PndSttTube*) fTubeArray->At(hit->GetTubeID());
691  TObjArray *neighs = fHitMap->GetNeighboringsToHit(hit);
692 
693 
694  cout << "HIT " << hit->GetHitID() << "(" << hit->GetTubeID() << "/" << tube->GetLayerID() << ")" << " has " << neighs->GetEntriesFast() << " neighborings: ";
695  for(int i = 0; i < neighs->GetEntriesFast(); i++) {
696  PndTrkHit *hitA = (PndTrkHit*) neighs->At(i);
697  hitA->DrawTube(kCyan);
698  PndSttTube *tubeA = (PndSttTube*) fTubeArray->At(hitA->GetTubeID());
699  cout << " " << hitA->GetHitID() << "(" << hitA->GetTubeID() << "/" << tubeA->GetLayerID() << ")";
700  }
701  cout << endl;
702  display->Update();
703  display->Modified();
704 
705 }
Int_t i
Definition: run_full.C:25
TObjArray GetNeighboringsToHit(PndTrkHit *hit)
PndTrkNeighboringMap * fHitMap
Int_t GetHitID()
Definition: PndTrkHit.h:56
int GetLayerID()
Definition: PndSttTube.cxx:128
void DrawTube(Color_t color)
Definition: PndTrkHit.cxx:178
Int_t GetTubeID()
Definition: PndTrkHit.h:61
void PndTrkCombiLegendreTask::DrawSttGeometry ( )

Definition at line 563 of file PndTrkCombiLegendreTask.cxx.

References display, fTubeArray, PndSttTube::GetPosition(), hxy, and PndSttTube::IsParallel().

Referenced by DrawGeometry().

563  {
564  if(hxy == NULL) hxy = new TH2F("hxy", "xy plane", 100, -43, 43, 100, -43, 43);
565  else hxy->Reset();
566  hxy->SetStats(kFALSE);
567  hxy->Draw();
568 
569  // draw all the tubes
570  for(int itube = 1; itube < fTubeArray->GetEntriesFast(); itube++) {
571  PndSttTube *tube = (PndSttTube*) fTubeArray->At(itube);
572  if(tube->IsParallel()) {
573  TArc * arc = new TArc(tube->GetPosition().X(), tube->GetPosition().Y(), 0.5);
574  arc->SetFillStyle(0);
575  arc->SetLineColor(kCyan - 10);
576  arc->Draw("SAME");
577  }
578  else {
579  TMarker *mrk = new TMarker(tube->GetPosition().X(), tube->GetPosition().Y(), 6);
580 
581  mrk->SetMarkerColor(kCyan - 10);
582  mrk->Draw("SAME");
583  }
584  }
585  // ............................
586 
587  display->Update();
588  display->Modified();
589 
590 }
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
bool IsParallel()
Definition: PndSttTube.h:66
void PndTrkCombiLegendreTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 218 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCluster::AddHit(), PndTrkTrackList::AddTrack(), AnalyticalFit2(), CleanTrack(), PndTrkNeighboringMap::Clear(), ClusterToConformal(), ComputePlaneExtremities(), CountTracksInSkewSector(), CreateClusterAroundTrack(), CreateClusterAroundTrack2(), CreateClusterAroundTrack3(), display, PndTrkCluster::DoesContain(), PndTrkTrack::Draw(), DrawGeometry(), DrawGeometryConf(), PndTrkHit::DrawTube(), fabs(), fDisplayOn, fEventCounter, fHitMap, FillHitMap(), fMvdPixelHitArray, fMvdPointArray, fMvdStripHitArray, fRefHit, FromConformalToRealTrack(), FromRealToConformalTrack(), fSecondary, fSeeMC, fSttHitArray, fSttPointArray, fTrackArray, fTrackCandArray, fUmax, fUmin, fVerbose, fVmax, fVmin, PndTrkTrack::GetCenter(), PndTrkTrack::GetCluster(), PndTrkHitList::GetHit(), PndTrkCluster::GetHit(), PndTrkHit::GetHitID(), PndTrkHitList::GetNofHits(), PndTrkCluster::GetNofHits(), PndTrkTrackList::GetNofTracks(), PndTrkTrack::GetRadius(), PndTrkTrackList::GetTrack(), hit(), Initialize(), PndTrkHit::IsSttSkew(), LegendreFitWithRecovering(), PndTrkCluster::LightUp(), nhits, pnt, R, Refresh(), RefreshConf(), Reset(), PndTrkTrack::SetCenter(), PndTrkTrack::SetCluster(), PndTrkTrack::SetRadius(), stthitlist, and track.

218  {
219 
220  // ############## I N I T I A L I Z A T I O N S ##############
221  fTrackArray->Delete();
222  fTrackCandArray->Delete();
223  if(fVerbose > 0) cout << "*********************** " << fEventCounter << " ***********************" << endl;
224 
225  // initialize -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~
226  Initialize();
227  if(fVerbose > 1) {
228  cout << "number of stt hits " << fSttHitArray->GetEntriesFast() << endl;
229  cout << "number of mvdpix hits " << fMvdPixelHitArray->GetEntriesFast() << endl;
230  cout << "number of mvdstr hits " << fMvdStripHitArray->GetEntriesFast() << endl;
231  }
232 
233  // initialize display -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-
234  if(fDisplayOn) {
235  Refresh();
236  char goOnChar;
237  if(fSeeMC) {
238  DrawGeometry(3);
239  for(int ipnt = 0; ipnt < fSttPointArray->GetEntriesFast(); ipnt++) {
240  PndSttPoint *pnt = (PndSttPoint*) fSttPointArray->At(ipnt);
241  TMarker *mrk = new TMarker(pnt->GetX(), pnt->GetY(), 7);
242  mrk->SetMarkerColor(pnt->GetTrackID() + 1);
243  mrk->Draw("SAME");
244  }
245  for(int ipnt = 0; ipnt < fMvdPointArray->GetEntriesFast(); ipnt++) {
246  PndSdsMCPoint *pnt = (PndSdsMCPoint*) fMvdPointArray->At(ipnt);
247  TMarker *mrk = new TMarker(pnt->GetX(), pnt->GetY(), 7);
248  mrk->SetMarkerColor(pnt->GetTrackID() + 1);
249  mrk->Draw("SAME");
250  }
251  }
252  display->Update();
253  display->Modified();
254  cout << " STARTING" << endl;
255  // cin >> goOnChar;
256  display->Update();
257  display->Modified();
258  }
259 
260  // initialize hit map -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-
261  fHitMap->Clear();
262  FillHitMap();
263  // ##########################################################
264 
265  //
266  fDisplayOn = kFALSE;
267 
268  // --------- NO CLUSTERING -----------
269  PndTrkCluster *globalcluster = new PndTrkCluster();
270  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
271  PndTrkHit *hit = stthitlist->GetHit(ihit);
272  globalcluster->AddHit(hit);
273  }
274  // ------------------------------------
275 
276 
277  // ComputeSkewedXYZ(cluster);
278 
279 
280  PndTrkTrackList tracklist;
281 
282  // print and display cluster -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~--
283  cout << "GLOBAL CLUSTER:";
284  if(fDisplayOn) {
285  char goOnChar;
286  // cin >> goOnChar;
287  Refresh();
288  globalcluster->LightUp();
289  display->Update();
290  display->Modified();
291  }
292 
293  for(int ihit = 0; ihit < globalcluster->GetNofHits(); ihit++) {
294  PndTrkHit *hit = globalcluster->GetHit(ihit);
295  cout << " " << hit->GetHitID();
296  }
297 
298  cout << endl;
299 
300  // count tracks in skew sector -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~
301  int noftracksinlay[30];
302  Int_t maxnoftracks = CountTracksInSkewSector(globalcluster, noftracksinlay);
303 
304  // if(maxnoftracks > 1) continue; // CHECK
305 
306  cout << "\033[1;36m ITERATIONS -----------------------> " << maxnoftracks << "\033[0m" << endl;
307 
308  for(int iter = 0; iter < maxnoftracks; iter++) {
309  cout << "\033[1;36m ############### ITER " << iter << "/" << maxnoftracks << "\033[0m" << endl;
310  if(fDisplayOn) {
311  char goOnChar;
312  cin >> goOnChar;
313  Refresh();
314  globalcluster->LightUp();
315  display->Update();
316  display->Modified();
317  }
318 
319  PndTrkCluster *thiscluster = NULL, *cluster = NULL;
320  PndTrkTrack *track = NULL;
321  double fitm, fitp, xc, yc, R;
322 
323  for(int irun = 0; irun < 2; irun++)
324  {
325  thiscluster = NULL;
326  if(irun == 0) thiscluster = globalcluster;
327  else thiscluster = cluster;
328  cout << "\033[1;36m ############### ITER " << iter << " IRUN " << irun << "\033[0m" << endl;
329  if(thiscluster == NULL) continue;
330  // cout << thiscluster << endl;
331  // fitting procedure -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~
332  Int_t nhits = 0;
333  if(irun == 0) nhits = ClusterToConformal(thiscluster, 0);
334  else nhits = ClusterToConformal(thiscluster, 1);
335  if(nhits == 0) continue;
336  if(fSecondary) ComputePlaneExtremities(thiscluster);
337 
338  if(fDisplayOn) {
339  char goOnChar;
340  fRefHit->DrawTube(kRed);
341  cin >> goOnChar;
342  display->Update();
343  display->Modified();
344  }
345 
346 
347  // track = LegendreFit(thiscluster);
348  track = LegendreFitWithRecovering(thiscluster);
349  if(track == NULL) {
350  // if on the 2nd round there are too few points, then try with the old track
351  if(irun == 1) {
352  track = new PndTrkTrack(thiscluster, xc, yc, R);
353  cluster = thiscluster;
354  }
355  else continue;
356  }
357 
358  if(irun == 0) cluster = CreateClusterAroundTrack2(track);
359  else cluster = CreateClusterAroundTrack(track);
360  cout << "legendre fit " << irun << " *** nof hits " << cluster->GetNofHits() << endl;
361 
362  // cluster->Sort(); // CHECK THIS ######
363  track->SetCluster(cluster); // CHECK THIS ######
364 
365  // cleaning -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~
366  CleanTrack(track);
367 
368  // tracklist filling ~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~
369  // if(cluster->GetNofHits() < 3) continue; // CHECK THIS ######
370  // tracklist.AddTrack(track); // CHECK THIS ######
371 
372  // print and display cluster -----~~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~--
373 
374  if(fDisplayOn) {
375  char goOnChar;
376  cin >> goOnChar;
377  Refresh();
378  cluster->LightUp();
379  track->Draw();
380  }
381  xc = track->GetCenter().X();
382  yc = track->GetCenter().Y();
383  R = track->GetRadius();
384  FromRealToConformalTrack(xc, yc, R, fitm, fitp);
385 
386  if(fDisplayOn) {
387  RefreshConf();
389  display->cd(2);
390  TLine *line = new TLine(-10.07, fitp + fitm * (-10.07), 10.07, fitp + fitm * (10.07));
391  line->Draw("SAME");
392 
393  display->Update();
394  display->Modified();
395  }
396  }
397 
398  if(cluster == NULL) continue;
399  // fit with analytical chi2 -----~~~~-----~~~~~-----~~~~~-----~~~~~-----~~~~~--
400  // analytical LS fit
401  double fitm2, fitp2;
402  if(fSecondary) ComputePlaneExtremities(cluster);
403  cout << "ANALYTICAL FIT " << endl;
404  cout << "xc/yc/R " << xc << " " << yc << " " << R << endl;
405  cout << "nof hits " << cluster->GetNofHits() << endl;
406  AnalyticalFit2(cluster, fitm, fitp, fitm2, fitp2);
407 
408  // backup old values for comparison
409  double xc0 = xc, yc0 = yc, R0 = R;
410  // get the new ones ...
411  FromConformalToRealTrack(fitm2, fitp2, xc, yc, R);
412  // ... and compare them! if the difference is too big
413  // consider this findings a failure
414  if(fabs(xc - xc0) > 5 && fabs(yc - yc0) > 5 && fabs(R - R0) > 20) {
415  cout << "\033[1;31m THIS FINDING IS A FAILURE!\033[0m" << endl;
416  cout << "\033[1;31m LETS TRY ANOTHER ONE -------- BONUS ------------ \033[0m" << endl;
417  maxnoftracks++;
418  }
419  else {
420 
421  // otherwise save them
422  track->SetCenter(xc, yc);
423  track->SetRadius(R);
424 
425  // create final cluster on the refitted track
426  thiscluster = CreateClusterAroundTrack3(track);
427  cout << "after analytical fit *** nof hits " << cluster->GetNofHits() << endl;
428 
429  track->SetCluster(thiscluster);
430  cout << "ADD CLUSTER " << tracklist.GetNofTracks() << " TO TRACKLIST " << thiscluster->GetNofHits() << endl;
431 
432  tracklist.AddTrack(track);
433 
434  // count remaining hits to see whether the iterations can go on or not ~~~-----
435  PndTrkCluster *remainingcluster = new PndTrkCluster();
436  int skewed = 0;
437  for(int ihit = 0; ihit < globalcluster->GetNofHits(); ihit++) {
438  PndTrkHit *hit = globalcluster->GetHit(ihit);
439  if(thiscluster->DoesContain(hit)) continue;
440  if(hit->IsSttSkew()) skewed++;
441  remainingcluster->AddHit(hit);
442  }
443  globalcluster = remainingcluster;
444  cout << "tracklist " << tracklist.GetNofTracks() << ", remainning hits " << remainingcluster->GetNofHits() << " of which " << skewed << " skewed" << endl;
445 
446  // if there are still a lot of hits not assigned, maybe
447  // there is another track...
448  if(remainingcluster->GetNofHits() - skewed > 15 && iter == maxnoftracks - 1) {
449  cout << "\033[1;31m LETS TRY ANOTHER ONE -------- BONUS ------------ \033[0m" << endl;
450  maxnoftracks++;
451  }
452 
453  }
454 
455  }
456 
457  fDisplayOn = kTRUE;
458  cout << "\033[1;35m --------------- SUMMARY -------------- \033[0m" << endl;
459  cout << "tracklist " << tracklist.GetNofTracks() << endl;
460  if(fDisplayOn) {
461  Refresh();
462  for(int itrk = 0; itrk < tracklist.GetNofTracks(); itrk++) {
463  PndTrkTrack *track = tracklist.GetTrack(itrk);
464  track->GetCluster()->LightUp();
465  display->cd(1); track->Draw(kMagenta);
466  display->cd(3); track->Draw(kMagenta);
467  display->Update();
468  display->Modified();
469  char goOnChar;
470  cin >> goOnChar;
471  }
472  }
473 
474 
475  if(fDisplayOn) {
476  char goOnChar;
477  display->Update();
478  display->Modified();
479  cout << "Finish? ";
480  cin >> goOnChar;
481  }
482 
483 
484  Reset();
485 }
int fVerbose
Definition: poormantracks.C:24
void CleanTrack(PndTrkTrack *track)
Double_t GetRadius()
Definition: PndTrkTrack.h:43
void AnalyticalFit2(PndTrkCluster *cluster, double fitm, double fitp, double &fitm2, double &fip2)
void ComputePlaneExtremities(PndTrkCluster *cluster)
PndRiemannTrack track
Definition: RiemannTest.C:33
PndTrkCluster GetCluster()
Definition: PndTrkTrack.h:48
TClonesArray * pnt
PndTrkTrack * LegendreFitWithRecovering(PndTrkCluster *cluster)
void AddHit(PndTrkHit *hit)
void SetCluster(PndTrkCluster *cluster)
Definition: PndTrkTrack.h:41
PndTrkHit * GetHit(int index)
TVector2 GetCenter()
Definition: PndTrkTrack.h:44
PndTrkNeighboringMap * fHitMap
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
void SetCenter(double x, double y)
Definition: PndTrkTrack.h:37
PndTrkTrack * GetTrack(Int_t index)
void AddTrack(PndTrkTrack *track)
void SetRadius(double radius)
Definition: PndTrkTrack.h:36
void FromRealToConformalTrack(double x0, double y0, double R, double &fitm, double &fitp)
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
Int_t CountTracksInSkewSector(PndTrkCluster *cluster, int *noftracksinlayer)
void Draw(Color_t color=kBlack)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void DrawTube(Color_t color)
Definition: PndTrkHit.cxx:178
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
Bool_t DoesContain(PndTrkHit *hit)
void DrawGeometryConf(double x1, double x2, double y1, double y2)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
PndTrkCluster * CreateClusterAroundTrack2(PndTrkTrack *track)
Int_t ClusterToConformal(PndTrkCluster *cluster, bool samerefhit)
Double_t R
Definition: checkhelixhit.C:61
Bool_t IsSttSkew()
Definition: PndTrkHit.h:71
PndTrkCluster * CreateClusterAroundTrack3(PndTrkTrack *track)
PndTrkCluster * CreateClusterAroundTrack(PndTrkTrack *track)
Int_t PndTrkCombiLegendreTask::ExtractLegendre ( Int_t  mode,
double &  theta_max,
double &  r_max 
)
Int_t PndTrkCombiLegendreTask::FillConformalHitList ( PndTrkCluster cluster)

Definition at line 722 of file PndTrkCombiLegendreTask.cxx.

References PndTrkConformalHitList::AddHit(), conform, conformalhitlist, fRefHit, PndTrkConformalTransform::GetConformalSttHit(), PndTrkCluster::GetHit(), PndTrkConformalHitList::GetNofHits(), PndTrkCluster::GetNofHits(), hit(), PndTrkHit::IsSttParallel(), and PndTrkConformalHitList::SetConformalTransform().

Referenced by ClusterToConformal().

722  {
723 
724  // set the conformal transformation, where the
725  // translation and rotation must be already set
727 
728  // loop over the cluster hits
729  // and port them to conf plane
730  for(int jhit = 0; jhit < cluster->GetNofHits(); jhit++) {
731  PndTrkHit *hit = cluster->GetHit(jhit);
732  if(hit == fRefHit) continue;
733  PndTrkConformalHit * chit = NULL;
734  // cout << "HIT " << hit->GetHitID() << " " << hit->IsSttParallel() << " " << hit->IsSttSkew() << endl;
735  if(hit->IsSttParallel() == kTRUE) chit = conform->GetConformalSttHit(hit);
736  else continue; // CHECK chit = conform->GetConformalHit(hit); // CHECK
737  conformalhitlist->AddHit(chit);
738  // cout << hit->GetPosition().X() << " " << hit->GetPosition().Y() << " " << hit->GetIsochrone() << " " << hit->IsSttParallel() << " " << " to CONFORMAL " << chit->GetU() << " " << chit->GetV() << " " << chit->GetIsochrone() << endl;
739  // if(chit->GetPosition().Mod() > 1.16) cout << "\033[1;36m CONFORMAL DISTANCE IS " << chit->GetPosition().Mod() << "\033[0m" << endl;
740 
741  }
742  return conformalhitlist->GetNofHits();
743 }
PndTrkConformalTransform * conform
PndTrkConformalHitList * conformalhitlist
PndTrkHit * GetHit(int index)
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
void AddHit(PndTrkConformalHit *chit)
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 SetConformalTransform(PndTrkConformalTransform *conformal)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
void PndTrkCombiLegendreTask::FillHitMap ( )

Definition at line 1132 of file PndTrkCombiLegendreTask.cxx.

References PndTrkNeighboringMap::AddNeighboringsToHit(), display, PndTrkHit::Draw(), DrawLists(), DrawNeighborings(), fDisplayOn, fHitMap, fTubeArray, PndTrkHitList::GetHit(), PndTrkNeighboringMap::GetIndivisiblesToHit(), PndTrkHitList::GetNofHits(), PndTrkHit::GetTubeID(), hit(), PndSttTube::IsNeighboring(), PndSttTube::IsSectorLimit(), Refresh(), PndTrkNeighboringMap::SetOwnerValue(), and stthitlist.

Referenced by Exec().

1132  {
1133  TObjArray limits;
1134  TObjArray sector[6];
1135  TObjArray *neighborings = NULL;
1136 
1137 
1138  // PndTrkHit *hit, hit2;
1139  // Loop over all hits and look for:
1140  // 1 - tubes limiting sectors std::vector< int > limithit
1141  // 2 - tubes with no neighborings (will not use them) std::vector< int > standalone
1142  // 3 - tubes with only 1 neighboring (will serve as seed) std::vector< int > seeds
1143  // 4 - tubes with only 2 neighborings, one of which is on std::vector< int > candseeds
1144  // the same layer and has neighboring (will be candidate
1145  // to serve as seed, if needed)
1146  // 5 - Fill the sector std::vector according to sectors std::vector< int > sector*
1147 
1148  fHitMap->SetOwnerValue(kTRUE); // CHECK
1149  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1150 
1151  PndTrkHit *hit = stthitlist->GetHit(ihit);
1152  int tubeID = hit->GetTubeID();
1153  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
1154  if(tube->IsSectorLimit() == kTRUE) limits.Add(hit);
1155 
1156  neighborings = new TObjArray();
1157 
1158  for(int jhit = 0; jhit < stthitlist->GetNofHits(); jhit++) {
1159  if(ihit == jhit) continue;
1160 
1161  PndTrkHit *hit2 = stthitlist->GetHit(jhit);
1162  int tubeID2 = hit2->GetTubeID();
1163 
1164  if(tube->IsNeighboring(tubeID2) == kTRUE) neighborings->Add(hit2);
1165 
1166  }
1167 
1168  // cout << "HIT: " << hit->GetHitID() << " has " << neighborings->GetEntriesFast() << " hits" << endl;
1169 // if(fDisplayOn) {
1170 // Refresh();
1171 // }
1172 
1173  fHitMap->AddNeighboringsToHit(hit, neighborings);
1174 
1175 // if(fDisplayOn) {
1176 // char goOnChar;
1177 // display->Update();
1178 // display->Modified();
1179 // cout << " go on?" << endl;
1180 // cin >> goOnChar;
1181 // }
1182  }
1183  // neighborings = NULL;
1184  // delete neighborings;
1185 
1186  if(fDisplayOn) {
1187  if(1 == 1) DrawLists();
1188  if(1 == 2) DrawNeighborings();
1189  // ================================================
1190  Refresh();
1191  char goOnChar;
1192  for(int ihit = 0; ihit < stthitlist->GetNofHits(); ihit++) {
1193  PndTrkHit *stthit = stthitlist->GetHit(ihit);
1194  TObjArray *indiv = fHitMap->GetIndivisiblesToHit(stthit);
1195  for(int jhit = 0; jhit < indiv->GetEntriesFast(); jhit++) {
1196  PndTrkHit *stthit2 = (PndTrkHit*) indiv->At(jhit);
1197  stthit2->Draw(kOrange);
1198  stthit->Draw(kOrange);
1199  }
1200  }
1201 
1202  display->Update();
1203  display->Modified();
1204  cout << " STARTING" << endl;
1205  cin >> goOnChar;
1206  display->Update();
1207  display->Modified();
1208  // ================================================
1209  }
1210  // cout << "PRINT INDIVISIBILE MAP" << endl;
1211  // fHitMap->PrintIndivisibleMap();
1212 }
void AddNeighboringsToHit(PndTrkHit *hit, TObjArray *hits)
PndTrkHit * GetHit(int index)
PndTrkNeighboringMap * fHitMap
void SetOwnerValue(Bool_t enable=kTRUE)
Bool_t IsNeighboring(int tubeID)
Definition: PndSttTube.cxx:145
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 Draw(Color_t color)
Definition: PndTrkHit.cxx:109
Int_t GetNofHits()
Definition: PndTrkHitList.h:43
TObjArray GetIndivisiblesToHit(PndTrkHit *hit)
int IsSectorLimit()
Definition: PndSttTube.h:64
Int_t GetTubeID()
Definition: PndTrkHit.h:61
void PndTrkCombiLegendreTask::FillLegendreHisto ( PndTrkCluster cluster)
void PndTrkCombiLegendreTask::FillPeakCouplesHisto ( PndTrkCluster cluster)

Definition at line 1059 of file PndTrkCombiLegendreTask.cxx.

References conformalhitlist, display, PndTrkCluster::DoesContain(), PndTrkCombiLegendreTransform::Draw(), PndTrkConformalHit::Draw(), fDisplayOn, PndTrkCombiLegendreTransform::FillLegendreHisto(), fTimer, PndTrkConformalHit::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), and legendrecombi.

Referenced by LegendreFit().

1060 {
1061  fTimer->Start();
1062  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
1064  PndTrkHit *hit = chit->GetHit();
1065  if(cluster->DoesContain(hit) == kFALSE) continue;
1066  if(fDisplayOn) {
1067  display->cd(2);
1068  chit->Draw(1);
1069  }
1070  for(int jhit = ihit + 1; jhit < conformalhitlist->GetNofHits(); jhit++) {
1071  // if(ihit == jhit) continue;
1072  PndTrkConformalHit *chit2 = conformalhitlist->GetHit(jhit);
1073  PndTrkHit *hit2 = chit2->GetHit();
1074  if(cluster->DoesContain(hit2) == kFALSE) continue;
1075 
1076  legendrecombi->FillLegendreHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone(), chit2->GetU(), chit2->GetV(), chit2->GetIsochrone());
1077  }
1078  }
1079  fTimer->Stop();
1080  cout << "fill peak legendre histo " << fTimer->RealTime() << endl;
1081 
1082  if(fDisplayOn) {
1083  display->cd(4);
1084  legendrecombi->Draw();
1085  display->Update();
1086  display->Modified();
1087  char goOnchar;
1088  cout << "get the max? " << endl;
1089  cin >> goOnchar;
1090  }
1091 }
PndTrkConformalHitList * conformalhitlist
void FillLegendreHisto(double x1, double y1, double radius1, double x2, double y2, double radius2)
void Draw(Color_t color)
PndTrkConformalHit * GetHit(int index)
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 DoesContain(PndTrkHit *hit)
PndTrkCombiLegendreTransform * legendrecombi
void PndTrkCombiLegendreTask::FillPeakNeighCouplesHisto ( PndTrkCluster cluster)

Definition at line 963 of file PndTrkCombiLegendreTask.cxx.

References conformalhitlist, display, PndTrkCombiLegendreTransform::Draw(), PndTrkConformalHit::Draw(), fDisplayOn, fHitMap, PndTrkCombiLegendreTransform::FillLegendreHisto(), fTimer, PndTrkConformalHit::GetHit(), PndTrkConformalHitList::GetHit(), PndTrkHit::GetHitID(), PndTrkConformalHit::GetIsochrone(), PndTrkNeighboringMap::GetNeighboringsToHit(), PndTrkConformalHitList::GetNofHits(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), hit(), and legendrecombi.

964 {
965  fTimer->Start();
966 
967  std::vector< std::pair<int, int> > usedcouples;
968  for(int ihit = 0; ihit < conformalhitlist->GetNofHits(); ihit++) {
970  PndTrkHit *hit = chit->GetHit();
971  if(fDisplayOn) {
972  display->cd(2);
973  chit->Draw(1);
974  }
975  // cout << "---------- HIT ihit " << ihit << endl;
976  // if(fDisplayOn) {
977 // Refresh();
978 // display->cd(1);
979 // hit->DrawTube(kBlue);
980 // display->Update();
981 // display->Modified();
982 // char goOnchar;
983 // // cin >> goOnchar;
984 // }
985 
986  TObjArray *neighborings = fHitMap->GetNeighboringsToHit(hit);
987  if(neighborings->GetEntriesFast() == 0) continue;
988 
989  for(int jhit = 0; jhit < neighborings->GetEntriesFast(); jhit++) {
990  PndTrkHit *hit2 = (PndTrkHit*) neighborings->At(jhit);
991 
992  // cout << "jhit " << jhit << " ";
993  // if(fDisplayOn) {
994 // display->cd(1);
995 // hit2->DrawTube(kOrange);
996 // display->Update();
997 // display->Modified();
998 // char goOnchar;
999 // // cin >> goOnchar;
1000 // }
1001 
1002  for(int khit = 0; khit < conformalhitlist->GetNofHits(); khit++) {
1003  PndTrkConformalHit *chit2 = conformalhitlist->GetHit(khit);
1004  if(hit2 != chit2->GetHit()) continue;
1005 
1006  std::pair< int, int > thiscouple(hit->GetHitID(), hit2->GetHitID());
1007  std::pair< int, int > thisrevcouple(hit2->GetHitID(), hit->GetHitID());
1008 
1009  if((find(usedcouples.begin(), usedcouples.end(), thiscouple) != usedcouples.end()) ||
1010  (find(usedcouples.begin(), usedcouples.end(), thisrevcouple) != usedcouples.end()))
1011  {
1012 // cout << "ALREADY USED" << endl;
1013  // if(fDisplayOn) {
1014 // display->cd(1);
1015 // hit2->DrawTube(kRed);
1016 // display->Update();
1017 // display->Modified();
1018 // char goOnchar;
1019 // // cin >> goOnchar;
1020 // }
1021 
1022  break;
1023  }
1024 // cout << "ADDED" << endl;
1025 // if(fDisplayOn) {
1026 // display->cd(1);
1027 // hit2->DrawTube(kGreen);
1028 // display->cd(4);
1029 // legendrecombi->Draw();
1030 // display->Update();
1031 // display->Modified();
1032 // char goOnchar;
1033 // // cin >> goOnchar;
1034 // }
1035 
1036 // cout << "couple " << usedcouples.size() << " " << hit->GetHitID() << " " << hit2->GetHitID() << endl;
1037  legendrecombi->FillLegendreHisto(chit->GetU(), chit->GetV(), chit->GetIsochrone(), chit2->GetU(), chit2->GetV(), chit2->GetIsochrone());
1038  usedcouples.push_back(thiscouple);
1039  break;
1040  }
1041  }
1042  }
1043 
1044  fTimer->Stop();
1045  cout << "fill peak legendre histo time " << fTimer->RealTime() << " sec" << endl;
1046 
1047  if(fDisplayOn) {
1048  display->cd(4);
1049  legendrecombi->Draw();
1050  display->Update();
1051  display->Modified();
1052  char goOnchar;
1053  cin >> goOnchar;
1054  }
1055 }
PndTrkConformalHitList * conformalhitlist
TObjArray GetNeighboringsToHit(PndTrkHit *hit)
void FillLegendreHisto(double x1, double y1, double radius1, double x2, double y2, double radius2)
PndTrkNeighboringMap * fHitMap
Int_t GetHitID()
Definition: PndTrkHit.h:56
void Draw(Color_t color)
PndTrkConformalHit * GetHit(int index)
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
PndTrkCombiLegendreTransform * legendrecombi
PndTrkHit * PndTrkCombiLegendreTask::FindMvdPixelReferenceHit ( )

Definition at line 781 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by FindMvdReferenceHit().

782  {
783  if(mvdpixhitlist->GetNofHits() == 0) return NULL;
784  // loop on mvd pix hits
785  int tmphitid = -1;
786  PndTrkHit *refhit = NULL;
787  for(int jhit = 0; jhit < mvdpixhitlist->GetNofHits(); jhit++) {
788  PndTrkHit *hit = mvdpixhitlist->GetHit(jhit);
789  if(hit->IsUsed()) {
790  if(fVerbose > 1) cout << "already used V" << endl;
791  continue;
792  }
793  tmphitid = jhit;
794  break;
795  }
796  if(tmphitid == -1) return NULL;
797  refhit = mvdpixhitlist->GetHit(tmphitid);
798  if(fVerbose > 1) cout << "MVD PIXEL REFERENCE HIT " << refhit->GetHitID() << endl;
799  return refhit;
800 }
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
PndTrkHit * PndTrkCombiLegendreTask::FindMvdReferenceHit ( )

Definition at line 823 of file PndTrkCombiLegendreTask.cxx.

References FindMvdPixelReferenceHit(), and FindMvdStripReferenceHit().

Referenced by FindReferenceHit().

824 {
825  PndTrkHit *refhit = NULL;
826  refhit = FindMvdStripReferenceHit();
827  // refhit = FindMvdPixelReferenceHit();
828  if(refhit != NULL) return refhit;
829  // refhit = FindMvdStripReferenceHit();
831  return refhit;
832 }
PndTrkHit * PndTrkCombiLegendreTask::FindMvdStripReferenceHit ( )

Definition at line 802 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by FindMvdReferenceHit().

803 {
804  if(mvdstrhitlist->GetNofHits() == 0) return NULL;
805  // loop on mvd str hits
806  int tmphitid = -1;
807  PndTrkHit *refhit = NULL;
808  for(int jhit = 0; jhit < mvdstrhitlist->GetNofHits(); jhit++) {
809  PndTrkHit *hit = mvdstrhitlist->GetHit(jhit);
810  if(hit->IsUsed()) {
811  if(fVerbose > 1) cout << "already used V" << endl;
812  continue;
813  }
814  tmphitid = jhit;
815  break;
816  }
817  if(tmphitid == -1) return NULL;
818  refhit = mvdstrhitlist->GetHit(tmphitid);
819  if(fVerbose > 1) cout << "MVD STRIP REFERENCE HIT " << refhit->GetHitID() << endl;
820  return refhit;
821 }
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
PndTrkHit * PndTrkCombiLegendreTask::FindReferenceHit ( )

Definition at line 834 of file PndTrkCombiLegendreTask.cxx.

References FindMvdReferenceHit(), and FindSttReferenceHit().

Referenced by ClusterToConformal().

835 {
836  PndTrkHit *refhit = NULL;
837  // refhit = FindMvdReferenceHit();
838  refhit = FindSttReferenceHit();
839  if(refhit != NULL) return refhit;
840  // refhit = FindSttReferenceHit();
842 
843  return refhit;
844 }
PndTrkHit * FindSttReferenceHit(int isec=-1)
PndTrkHit * PndTrkCombiLegendreTask::FindReferenceHit ( PndTrkCluster cluster,
bool  keeprefhit 
)

Definition at line 846 of file PndTrkCombiLegendreTask.cxx.

References PndTrkCluster::DoesContain(), Double_t, fRefHit, fVerbose, PndTrkHit::GetDetectorID(), PndTrkCluster::GetHit(), PndTrkHit::GetHitID(), PndTrkHit::GetIsochrone(), PndTrkCluster::GetNofHits(), hit(), PndTrkHit::IsStt(), PndTrkHit::IsSttParallel(), PndTrkHit::SetRefHitFlag(), and PndTrkHit::WasRefHit().

846  {
847  int ntot = cluster->GetNofHits();
848  // cout << "FIND REFERENCE HIT " << ntot << endl;
849  if(ntot == 0) return NULL;
850 
851  if(keeprefhit && cluster->DoesContain(fRefHit) == kTRUE) {
852  cout << "THE REF HIT IS ALREADY INSIDE THE CLUSTER SO I KEEP IT" << endl;
853  return fRefHit;
854  }
855 
856 
857  int tmphitid = -1;
858  Double_t tmpiso = 1.;
859  PndTrkHit *refhit = NULL;
860  for(int jhit = 0; jhit < ntot; jhit++) {
861  PndTrkHit *hit = cluster->GetHit(jhit);
862 
863  // if(hit->IsUsed()) {
864  // if(fVerbose > 1) cout << "STT hit " << jhit << "already used " << endl;
865  // continue; }
866 
867  if(hit->IsStt()) {
868  if(hit->IsSttParallel()) {
869  if(hit->GetIsochrone() < tmpiso) {
870  if(hit->WasRefHit() == kFALSE) {
871  tmphitid = jhit;
872  tmpiso = hit->GetIsochrone();
873  refhit = hit;
874  }
875  }
876  }
877  }
878  else {
879  tmphitid = jhit;
880  break;
881  }
882  }
883 
884  if(tmphitid == -1) return NULL;
885  refhit = cluster->GetHit(tmphitid);
886  if(fVerbose > 1) cout << "REFERENCE HIT " << refhit->GetHitID() << " " << refhit->GetDetectorID() << endl;
887  refhit->SetRefHitFlag(1);
888  return refhit;
889 
890 
891 }
int fVerbose
Definition: poormantracks.C:24
PndTrkHit * GetHit(int index)
Int_t GetHitID()
Definition: PndTrkHit.h:56
Bool_t IsSttParallel()
Definition: PndTrkHit.h:70
Int_t GetDetectorID()
Definition: PndTrkHit.h:57
Double_t
void SetRefHitFlag(Bool_t used)
Definition: PndTrkHit.h:51
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 DoesContain(PndTrkHit *hit)
Bool_t IsStt()
Definition: PndTrkHit.h:72
Bool_t WasRefHit()
Definition: PndTrkHit.h:59
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
PndTrkHit * PndTrkCombiLegendreTask::FindSttReferenceHit ( int  isec = -1)

Definition at line 746 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by FindReferenceHit().

746  {
747  int ntot = 0;
748  if(isec == -1) ntot = stthitlist->GetNofHits();
749  else ntot = stthitlist->GetNofHitsInSector(isec);
750 
751  if(ntot == 0) return NULL;
752 
753 
754  int tmphitid = -1;
755  Double_t tmpiso = 1.;
756  PndTrkHit *refhit = NULL;
757  for(int jhit = 0; jhit < ntot; jhit++) {
758  PndTrkHit *hit = NULL;
759  if(isec == -1) hit = stthitlist->GetHit(jhit);
760  else hit = stthitlist->GetHitFromSector(jhit, isec);
761 
762  if(hit->IsUsed()) {
763  // cout << "STT hit " << jhit << "already used " << endl;
764  continue; }
765  if(hit->IsSttSkew()) continue;
766  if(hit->GetIsochrone() < tmpiso) {
767  tmphitid = jhit;
768  tmpiso = hit->GetIsochrone();
769  refhit = hit;
770  }
771  }
772  if(tmphitid == -1) return NULL;
773 
774  // PndTrkHit *refhit = &thishitlist[tmphitid];
775  // if(fVerbose > 1) cout << "STT REFERENCE HIT " << tmphitid << " " << refhit->GetIsochrone() << endl;
776 
777  return refhit;
778 
779 }
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
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 PndTrkCombiLegendreTask::FromConformalToRealTrack ( double  fitm,
double  fitp,
double &  x0,
double &  y0,
double &  R 
)

Definition at line 1093 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by AnalyticalFit(), AnalyticalFit2(), Exec(), and LegendreFit().

1093  {
1094  // CHECK if this needs to be kept --> change xc0 to xc etc
1095  // center and radius
1096  Double_t xcrot0, ycrot0;
1097  ycrot0 = 1 / (2 * fitp);
1098  xcrot0 = - fitm * ycrot0;
1099  R = sqrt(xcrot0 * xcrot0 + ycrot0 * ycrot0);
1100  // re-rotation and re-traslation of xc and yc
1101  // rotation
1104  // traslation
1107 }
Double_t x0
Definition: checkhelixhit.C:70
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
PndTrkConformalHitList * conformalhitlist
static T Sin(const T &x)
Definition: PndCAMath.h:42
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
void PndTrkCombiLegendreTask::FromRealToConformalTrack ( double  x0,
double  y0,
double  R,
double &  fitm,
double &  fitp 
)

|x| |c -s||xr| —> |xr| | c s||x| |y| |s c||yr| |yr| |-s c||y|

Definition at line 1109 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by Exec().

1109  {
1110  // CHECK if this needs to be kept --> change xc0 to xc etc
1111  Double_t xcrot0, ycrot0;
1112 
1113  // traslation
1116 
1122  // rotation
1125 
1126  // yr = 1/ (2 p) --> p = 1 / (2 yr)
1127  // xr = - m / (2 p) --> m = - 2 p xr
1128  fitp = 1 / (2 * ycrot0);
1129  fitm = - 2 * fitp * xcrot0;
1130 }
Double_t x0
Definition: checkhelixhit.C:70
PndTrkConformalHitList * conformalhitlist
static T Sin(const T &x)
Definition: PndCAMath.h:42
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double_t
Double_t y0
Definition: checkhelixhit.C:71
PndTrkConformalTransform * GetConformalTransform()
InitStatus PndTrkCombiLegendreTask::Init ( )
virtual

Virtual method Init

Definition at line 85 of file PndTrkCombiLegendreTask.cxx.

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

85  {
86 
87  fEventCounter = 0;
88 
89  fMvdPix_RealDistLimit = 0.5; // CHECK limits
90  fMvdStr_RealDistLimit = 0.5; // CHECK limits
91  fStt_RealDistLimit = 1.5 * 0.5; // CHECK limits
92  fMvdPix_ConfDistLimit = 0.003; // CHECK limits
93  fMvdStr_ConfDistLimit = 0.003; // CHECK limits
94  fStt_ConfDistLimit = 0.001; // CHECK limits
95  if(fSecondary) {
96  fMvdPix_RealDistLimit = 1.; // CHECK limits
97  fMvdStr_RealDistLimit = 1.; // CHECK limits
98  fMvdPix_ConfDistLimit = 0.007; // CHECK limits
99  fMvdStr_ConfDistLimit = 0.007; // CHECK limits
100  }
101 
102 
103  // Get RootManager
104  FairRootManager* ioman = FairRootManager::Instance();
105  if ( ! ioman ) {
106  cout << "-E- PndTrkCombiLegendreTask::Init: "
107  << "RootManager not instantiated, return!" << endl;
108  return kFATAL;
109  }
110 
111  // -- HITS -------------------------------------------------
112  //
113  // STT
114  fSttHitArray = (TClonesArray*) ioman->GetObject(fSttBranch);
115  if ( ! fSttHitArray ) {
116  cout << "-W- PndTrkCombiLegendreTask::Init: "
117  << "No STTHit array, return!" << endl;
118  return kERROR;
119  }
120  //
121  // MVD PIXEL
122  fMvdPixelHitArray = (TClonesArray*) ioman->GetObject(fMvdPixelBranch);
123  if ( !fMvdPixelHitArray){
124  std::cout << "-W- PndTrkCombiLegendreTask::Init: " << "No MVD Pixel hitArray, return!" << std::endl;
125  return kERROR;
126  }
127  //
128  // MVD STRIP
129  fMvdStripHitArray = (TClonesArray*) ioman->GetObject(fMvdStripBranch);
130  if ( !fMvdStripHitArray){
131  std::cout << "-W- PndTrkCombiLegendreTask::Init: " << "No MVD Strip hitArray, return!" << std::endl;
132  return kERROR;
133  }
134 
135  fTrackArray = new TClonesArray("PndTrack");
136  fTrackCandArray = new TClonesArray("PndTrackCand");
137  ioman->Register("Track", "pr", fTrackArray, fPersistence); // CHECK
138  ioman->Register("TrackCand", "pr", fTrackCandArray, fPersistence); // CHECK
139 
140 
141 
142 
143 
144 
145 
146  // ---------------------------------------- maps of STT tubes
149  // ---------------------------------------------------- end map
150 
151  if(fDisplayOn) {
152  display = new TCanvas("display", "display", 0, 0, 800, 800); // CHECK
153  display->Divide(2, 2);
154  if(fSeeMC) {
155  fSttPointArray = (TClonesArray*) ioman->GetObject("STTPoint");
156  fMvdPointArray = (TClonesArray*) ioman->GetObject("MVDPoint");
157  }
158  }
159 
162 
163 
165 
166 
167 
169 
170  tools = new PndTrkTools();
173  fTimer = new TStopwatch();
174 
175  return kSUCCESS;
176 
177 }
int fVerbose
Definition: poormantracks.C:24
PndTrkConformalTransform * conform
PndTrkNeighboringMap * fHitMap
TClonesArray * FillTubeArray()
PndTrkLegendreTransform * legendre
PndTrkCombiLegendreTransform * legendrecombi
void PndTrkCombiLegendreTask::Initialize ( )

Definition at line 189 of file PndTrkCombiLegendreTask.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().

189  {
190 
194 
195  if(fUseSTT) {
196  stthitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fSttBranch), fSttHitArray);
198  }
199 
200  if(fUseMVDPix) {
201  mvdpixhitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fMvdPixelBranch), fMvdPixelHitArray);
203  }
204 
205  if(fUseMVDStr) {
206  mvdstrhitlist->AddTCA(FairRootManager::Instance()->GetBranchId(fMvdStripBranch), fMvdStripHitArray);
208  }
209 
210  // conformalhitlist = new PndTrkConformalHitList();
211  fFoundPeaks.clear();
212 
213  fInitDone = kTRUE;
214  // stthitlist->PrintSectors();
215 }
void AddTCA(Int_t detID, TClonesArray *array)
PndTrkSttHitList * Instanciate()
#define MVDSTRIP
PndTrkSdsHitList * InstanciateStrip()
std::vector< std::pair< double, double > > fFoundPeaks
#define MVDPIXEL
PndTrkSdsHitList * InstanciatePixel()
void PndTrkCombiLegendreTask::IntersectionFinder ( PndTrkHit hit,
double  xc,
double  yc,
double  R 
)

Definition at line 2153 of file PndTrkCombiLegendreTask.cxx.

References Double_t, fabs(), fTubeArray, PndTrkHit::GetIsochrone(), PndSttTube::GetPosition(), PndTrkHit::GetTubeID(), m, point, R, PndTrkHit::SetPosition(), sqrt(), and vec.

Referenced by AnalyticalFit(), AnalyticalFit2(), and ComputePerpendicularChi2().

2153  {
2154 
2155  TVector2 vec(xc, yc);
2156 
2157  // tubeID CHECK added
2158  Int_t tubeID = hit->GetTubeID();
2159  PndSttTube *tube = (PndSttTube*) fTubeArray->At(tubeID);
2160 
2161  // [xp, yp] point = coordinates xy of the centre of the firing tube
2162  TVector2 point(tube->GetPosition().X(), tube->GetPosition().Y());
2163  double radius = hit->GetIsochrone();
2164 
2165  // the coordinates of the point are taken from the intersection
2166  // between the circumference from the drift time and the R radius of
2167  // curvature. -------------------------------------------------------
2168  // 2. find the intersection between the little circle and the line // R
2169  // 2.a
2170  // find the line passing throught [xc, yc] (centre of curvature) and [xp, yp] (first wire)
2171  // y = mx + q
2172  Double_t m = (point.Y() - vec.Y())/(point.X() - vec.X());
2173  Double_t q = point.Y() - m*point.X();
2174 
2175  Double_t x1 = 0, y1 = 0,
2176  x2 = 0, y2 = 0,
2177  xb1 = 0, yb1 = 0,
2178  xb2 = 0, yb2 = 0;
2179 
2180  // CHECK the vertical track
2181  if(fabs(point.X() - vec.X()) < 1e-6) {
2182 
2183  // 2.b
2184  // intersection little circle and line --> [x1, y1]
2185  // + and - refer to the 2 possible intersections
2186  // +
2187  x1 = point.X();
2188  y1 = point.Y() + sqrt(radius * radius - (x1 - point.X()) * (x1 - point.X()));
2189  // -
2190  x2 = x1;
2191  y2 = point.Y() - sqrt(radius * radius - (x2 - point.X()) * (x2 - point.X()));
2192 
2193  // 2.c intersection between line and circle
2194  // +
2195  xb1 = vec.X();
2196  yb1 = vec.Y() + sqrt(R * R - (xb1 - vec.X()) * (xb1 - vec.X()));
2197  // -
2198  xb2 = xb1;
2199  yb2 = vec.Y() - sqrt(R * R - (xb2 - vec.X()) * (xb2 - vec.X()));
2200 
2201  } // END CHECK
2202  else {
2203 
2204  // 2.b
2205  // intersection little circle and line --> [x1, y1]
2206  // + and - refer to the 2 possible intersections
2207  // +
2208  x1 = (-(m*(q - point.Y()) - point.X()) + sqrt((m*(q - point.Y()) - point.X())*(m*(q - point.Y()) - point.X()) - (m*m + 1)*((q - point.Y())*(q - point.Y()) + point.X()*point.X() - radius*radius))) / (m*m + 1);
2209  y1 = m*x1 + q;
2210  // -
2211  x2 = (-(m*(q - point.Y()) - point.X()) - sqrt((m*(q - point.Y()) - point.X())*(m*(q - point.Y()) - point.X()) - (m*m + 1)*((q - point.Y())*(q - point.Y()) + point.X()*point.X() - radius*radius))) / (m*m + 1);
2212  y2 = m*x2 + q;
2213 
2214  // 2.c intersection between line and circle
2215  // +
2216  xb1 = (-(m*(q - vec.Y()) - vec.X()) + sqrt((m*(q - vec.Y()) - vec.X())*(m*(q - vec.Y()) - vec.X()) - (m*m + 1)*((q - vec.Y())*(q - vec.Y()) + vec.X()*vec.X() - R * R))) / (m*m + 1);
2217  yb1 = m*xb1 + q;
2218  // -
2219  xb2 = (-(m*(q - vec.Y()) - vec.X()) - sqrt((m*(q - vec.Y()) - vec.X())*(m*(q - vec.Y()) - vec.X()) - (m*m + 1)*((q - vec.Y())*(q - vec.Y()) + vec.X()*vec.X() - R * R))) / (m*m + 1);
2220  yb2 = m*xb2 + q;
2221  }
2222 
2223  // calculation of the distance between [xb, yb] and [xp, yp]
2224  Double_t distb1 = sqrt((yb1 - point.Y())*(yb1 - point.Y()) + (xb1 - point.X())*(xb1 - point.X()));
2225  Double_t distb2 = sqrt((yb2 - point.Y())*(yb2 - point.Y()) + (xb2 - point.X())*(xb2 - point.X()));
2226 
2227  // choice of [xb, yb]
2228  TVector2 xyb;
2229  if(distb1 > distb2) xyb.Set(xb2, yb2);
2230  else xyb.Set(xb1, yb1);
2231 
2232  // calculation of the distance between [x, y] and [xb. yb]
2233  Double_t dist1 = sqrt((xyb.Y() - y1)*(xyb.Y() - y1) + (xyb.X() - x1)*(xyb.X() - x1));
2234  Double_t dist2 = sqrt((xyb.Y() - y2)*(xyb.Y() - y2) + (xyb.X() - x2)*(xyb.X() - x2));
2235 
2236  // choice of [x, y]
2237  TVector2 *xy;
2238  if(dist1 > dist2) xy = new TVector2(x2, y2);
2239  else xy = new TVector2(x1, y1); // <========= THIS IS THE NEW POINT to be used for the fit
2240 
2241  hit->SetPosition(TVector3(xy->X(), xy->Y(), 0.0));
2242 
2243  delete xy;
2244 }
__m128 m
Definition: P4_F32vec4.h:28
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
Double_t
TVector3 GetPosition()
Definition: PndSttTube.cxx:87
TClonesArray * point
Definition: anaLmdDigi.C:29
void SetPosition(TVector3 pos)
Definition: PndTrkHit.h:47
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
Double_t GetIsochrone()
Definition: PndTrkHit.h:63
Int_t GetTubeID()
Definition: PndTrkHit.h:61
Double_t R
Definition: checkhelixhit.C:61
dble_vec_t vec[12]
Definition: ranlxd.cxx:380
void PndTrkCombiLegendreTask::IntersectionFinder ( PndTrkConformalHit chit,
double  fitm,
double  fitp 
)

Definition at line 2138 of file PndTrkCombiLegendreTask.cxx.

References fabs(), PndTrkConformalHit::GetIsochrone(), PndTrkConformalHit::GetU(), PndTrkConformalHit::GetV(), PndTrkConformalHit::SetPosition(), and CAMath::Sqrt().

2138  {
2139 
2140  double xi1 = chit->GetU() + fitm * chit->GetIsochrone()/ TMath::Sqrt(fitm * fitm + 1);
2141  double yi1 = chit->GetV() - chit->GetIsochrone() / TMath::Sqrt(fitm * fitm + 1);
2142 
2143  double xi2 = chit->GetU() - fitm * chit->GetIsochrone() / TMath::Sqrt(fitm * fitm + 1);
2144  double yi2 = chit->GetV() + chit->GetIsochrone()/ TMath::Sqrt(fitm * fitm + 1);
2145 
2146  double xi = 0, yi = 0;
2147 
2148  fabs(yi1 - (fitm * xi1 + fitp)) < fabs(yi2 - (fitm * xi2 + fitp)) ? (yi = yi1, xi = xi1) : (yi = yi2, xi = xi2);
2149 
2150  chit->SetPosition(xi, yi);
2151 }
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void SetPosition(double x, double y)
PndTrkTrack * PndTrkCombiLegendreTask::LegendreFit ( PndTrkCluster cluster)

Definition at line 1485 of file PndTrkCombiLegendreTask.cxx.

References display, Double_t, PndTrkTrack::Draw(), DrawGeometryConf(), PndTrkCombiLegendreTransform::ExtractLegendreMaximum(), PndTrkCombiLegendreTransform::ExtractLegendreSingleLineParameters(), fDisplayOn, FillPeakCouplesHisto(), fRecoverIteration, fRmax, fRmin, FromConformalToRealTrack(), fThetamax, fThetamin, fUmax, fUmin, fVmax, fVmin, PndTrkCombiLegendreTransform::GetLegendreHisto(), PndTrkCluster::GetNofHits(), legendrecombi, R, RefreshConf(), PndTrkCombiLegendreTransform::ResetLegendreHisto(), PndTrkCombiLegendreTransform::SetUpLegendreHisto(), and track.

Referenced by LegendreFitWithRecovering().

1485  {
1486 
1487  cout << "APPLY LEGENDRE ======================= (nofhits " << cluster->GetNofHits() << ") " << endl;
1488  // reset the legendre histo for a new legendre fit
1490  if(fRecoverIteration > 0) {
1491  legendrecombi->GetLegendreHisto()->Rebin2D(TMath::Power(2, fRecoverIteration), TMath::Power(2, fRecoverIteration));
1492  cout << "RECOVER ITERATION " << fRecoverIteration << " " << TMath::Power(2, fRecoverIteration) << " " << legendrecombi->GetLegendreHisto()->GetNbinsX() << " " << legendrecombi->GetLegendreHisto()->GetNbinsY() << endl;
1493  }
1494 
1495  if(legendrecombi->GetLegendreHisto()->GetNbinsX() < 50) return NULL; // CHECK
1496 
1498 
1499  if(fDisplayOn) {
1500  RefreshConf();
1502  }
1503 
1504 
1505  // ---------------------------------------
1506  // NEW LEGENDRE WITH ONLY PEAKS
1507  FillPeakCouplesHisto(cluster);
1508  // FillPeakNeighCouplesHisto(cluster);
1509  double theta_max;
1510  double r_max;
1511  int maxpeak = legendrecombi->ExtractLegendreMaximum(theta_max, r_max);
1512  // cout << " MAX PEAK " << maxpeak << endl;
1513  if(maxpeak <= 3) {
1515  return NULL;
1516  }
1517 
1518  double fitm, fitq;
1520  Double_t xc, yc, R;
1521  FromConformalToRealTrack(fitm, fitq, xc, yc, R);
1522  cout << "\033[1;33m MAXPEAK " << maxpeak << " XR, YC, R: " << xc << " " << yc << " " << R << "\033[0m" << endl;
1523 
1524  // create a track from the cluster
1525  PndTrkTrack *track = new PndTrkTrack(cluster, xc, yc, R);
1526 
1527  if(fDisplayOn) {
1528  TMarker *maxmrk = new TMarker(theta_max, r_max, 20);
1529  display->cd(4); maxmrk->Draw("SAME");
1530  // display->cd(3); maxmrk->Draw("SAME");
1531 
1532  display->cd(2);
1533  TLine *line = new TLine(-10.07, fitq + fitm * (-10.07), 10.07, fitq + fitm * (10.07));
1534  line->SetLineColor(kGreen);
1535  line->Draw("SAME");
1536 
1537  display->cd(1);
1538  track->Draw(kGreen);
1539 
1540  display->Update();
1541  display->Modified();
1542  char goOnChar;
1543  cout << "want to go on?" << endl;
1544  cin >> goOnChar;
1545  }
1546 
1547  return track;
1548 }
void FillPeakCouplesHisto(PndTrkCluster *cluster)
PndRiemannTrack track
Definition: RiemannTest.C:33
void ExtractLegendreSingleLineParameters(double &slope, double &intercept)
Double_t
void FromConformalToRealTrack(double fitm, double fitp, double &x0, double &y0, double &R)
void Draw(Color_t color=kBlack)
int ExtractLegendreMaximum(double &theta_max, double &r_max)
void DrawGeometryConf(double x1, double x2, double y1, double y2)
Int_t GetNofHits()
Definition: PndTrkCluster.h:52
Double_t R
Definition: checkhelixhit.C:61
PndTrkCombiLegendreTransform * legendrecombi
PndTrkTrack * PndTrkCombiLegendreTask::LegendreFitWithRecovering ( PndTrkCluster cluster)

Definition at line 1473 of file PndTrkCombiLegendreTask.cxx.

References fRecoverIteration, PndTrkCombiLegendreTransform::GetLegendreHisto(), legendrecombi, LegendreFit(), and track.

Referenced by Exec().

1473  {
1474  PndTrkTrack *track = NULL;
1475  fRecoverIteration = 0;
1476  int stopit = false;
1477  while(stopit != true) {
1478  track = LegendreFit(cluster);
1479  if(track != NULL) stopit = true;
1480  else if(legendrecombi->GetLegendreHisto()->GetNbinsX() < 50) stopit = true;
1481  }
1482  return track;
1483 }
PndRiemannTrack track
Definition: RiemannTest.C:33
PndTrkTrack * LegendreFit(PndTrkCluster *cluster)
PndTrkCombiLegendreTransform * legendrecombi
void PndTrkCombiLegendreTask::LightCluster ( PndTrkCluster cluster)
void PndTrkCombiLegendreTask::Refresh ( )

Definition at line 519 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by AnalyticalFit(), AnalyticalFit2(), CleanTrack(), DrawNeighboringsToHit(), Exec(), and FillHitMap().

519  {
520  // CHECK
521  char goOnChar;
522  // cout << "Refresh?" << endl;
523  // cin >> goOnChar;
524  // cout << "REFRESHING" << endl;
525  DrawGeometry();
526  if(fVerbose) cout << "Refresh stt" << endl;
528  if(fVerbose) cout << "Refresh pixel" << endl;
530  if(fVerbose) cout << "Refresh strip" << endl;
532  if(fVerbose) cout << "Refresh stop" << endl;
533 
534 }
int fVerbose
Definition: poormantracks.C:24
void DrawHits(PndTrkHitList *hitlist)
void PndTrkCombiLegendreTask::RefreshConf ( )

Definition at line 543 of file PndTrkCombiLegendreTask.cxx.

Referenced by Exec(), and LegendreFit().

543  { // CHECK delete
544  // CHECK
545  char goOnChar;
546  // cout << "RefreshConf?" << endl;
547  // cin >> goOnChar;
548  // cout << "REFRESHING CONF" << endl;
549 }
void PndTrkCombiLegendreTask::RePrepareLegendre ( PndTrkCluster cluster)
void PndTrkCombiLegendreTask::Reset ( )

Definition at line 487 of file PndTrkCombiLegendreTask.cxx.

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

Referenced by Exec().

488 {
489 
490  if(fDisplayOn) {
491  char goOnChar;
492  display->Update();
493  display->Modified();
494  cout << "Finish? ";
495  cin >> goOnChar;
496  cout << "FINISH" << endl;
497  }
498 
499  if(fInitDone) {
500  if(stthitlist) delete stthitlist;
501  if(mvdpixhitlist) delete mvdpixhitlist;
502  if(mvdstrhitlist) delete mvdstrhitlist;
503  if(fTimer) {
504  fTimer->Stop();
505  fTime += fTimer->RealTime();
506 
507  if(fVerbose > 0) cerr << fEventCounter << " Real time " << fTime << " s" << endl;
508  }
509  }
510 
511  fInitDone = kFALSE;
512 }
int fVerbose
Definition: poormantracks.C:24
void PndTrkCombiLegendreTask::SearchSecondaryTracks ( )
inline

Definition at line 102 of file PndTrkCombiLegendreTask.h.

References fSecondary.

102 { fSecondary = kTRUE; }
void PndTrkCombiLegendreTask::SetParContainers ( )

Definition at line 181 of file PndTrkCombiLegendreTask.cxx.

References fSttParameters, and rtdb.

181  {
182  FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb();
183  fSttParameters = (PndGeoSttPar*) rtdb->getContainer("PndGeoSttPar");
184 }
FairRuntimeDb * rtdb
Definition: hit_dirc.C:66
void PndTrkCombiLegendreTask::SwitchOnDisplay ( )
inline

Definition at line 63 of file PndTrkCombiLegendreTask.h.

References fDisplayOn.

void PndTrkCombiLegendreTask::SwitchOnSeeMC ( )
inline

Definition at line 64 of file PndTrkCombiLegendreTask.h.

References fSeeMC.

64 { fSeeMC = kTRUE; }

Member Data Documentation

PndTrkConformalTransform* PndTrkCombiLegendreTask::conform
private
PndTrkConformalHitList* PndTrkCombiLegendreTask::conformalhitlist
private
TCanvas* PndTrkCombiLegendreTask::display
private
double PndTrkCombiLegendreTask::fDeltaThetaRad
private

Definition at line 174 of file PndTrkCombiLegendreTask.h.

Bool_t PndTrkCombiLegendreTask::fDisplayOn
private
Int_t PndTrkCombiLegendreTask::fEventCounter
private

Definition at line 165 of file PndTrkCombiLegendreTask.h.

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

PndTrkFitter* PndTrkCombiLegendreTask::fFitter
private

Definition at line 194 of file PndTrkCombiLegendreTask.h.

Referenced by AnalyticalFit(), AnalyticalFit2(), and Init().

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

Definition at line 191 of file PndTrkCombiLegendreTask.h.

Referenced by Initialize().

PndTrkNeighboringMap* PndTrkCombiLegendreTask::fHitMap
private
Bool_t PndTrkCombiLegendreTask::fInitDone
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by Initialize(), and Reset().

PndSttMapCreator* PndTrkCombiLegendreTask::fMapper
private

Definition at line 163 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

Double_t PndTrkCombiLegendreTask::fMvdPix_ConfDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

Double_t PndTrkCombiLegendreTask::fMvdPix_RealDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

char PndTrkCombiLegendreTask::fMvdPixelBranch[200]
private

Definition at line 159 of file PndTrkCombiLegendreTask.h.

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

TClonesArray* PndTrkCombiLegendreTask::fMvdPixelHitArray
private

Input array of MvdPixelHitArray

Definition at line 149 of file PndTrkCombiLegendreTask.h.

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

TClonesArray* PndTrkCombiLegendreTask::fMvdPointArray
private

Input array of PndSdsPoint

Definition at line 147 of file PndTrkCombiLegendreTask.h.

Referenced by Exec(), and Init().

Double_t PndTrkCombiLegendreTask::fMvdStr_ConfDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

Double_t PndTrkCombiLegendreTask::fMvdStr_RealDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

char PndTrkCombiLegendreTask::fMvdStripBranch[200]
private

Definition at line 159 of file PndTrkCombiLegendreTask.h.

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

TClonesArray* PndTrkCombiLegendreTask::fMvdStripHitArray
private

Input array of MvdStripHitArray

Definition at line 151 of file PndTrkCombiLegendreTask.h.

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

Int_t PndTrkCombiLegendreTask::fNofHits
private

Definition at line 138 of file PndTrkCombiLegendreTask.h.

Int_t PndTrkCombiLegendreTask::fNofMvdPixHits
private

Definition at line 138 of file PndTrkCombiLegendreTask.h.

Int_t PndTrkCombiLegendreTask::fNofMvdStrHits
private

Definition at line 138 of file PndTrkCombiLegendreTask.h.

Int_t PndTrkCombiLegendreTask::fNofSttHits
private

Definition at line 138 of file PndTrkCombiLegendreTask.h.

Int_t PndTrkCombiLegendreTask::fNofTriplets
private

Definition at line 138 of file PndTrkCombiLegendreTask.h.

Bool_t PndTrkCombiLegendreTask::fPersistence
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

Int_t PndTrkCombiLegendreTask::fRecoverIteration
private

Definition at line 179 of file PndTrkCombiLegendreTask.h.

Referenced by LegendreFit(), and LegendreFitWithRecovering().

PndTrkHit* PndTrkCombiLegendreTask::fRefHit
private
double PndTrkCombiLegendreTask::fRmax
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), and LegendreFit().

double PndTrkCombiLegendreTask::fRmin
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), and LegendreFit().

Bool_t PndTrkCombiLegendreTask::fSecondary
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by ClusterToConformal(), Exec(), Init(), and SearchSecondaryTracks().

Bool_t PndTrkCombiLegendreTask::fSeeMC
private

Definition at line 201 of file PndTrkCombiLegendreTask.h.

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

Double_t PndTrkCombiLegendreTask::fStt_ConfDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

Double_t PndTrkCombiLegendreTask::fStt_RealDistLimit
private

Definition at line 189 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

char PndTrkCombiLegendreTask::fSttBranch[200]
private

Definition at line 159 of file PndTrkCombiLegendreTask.h.

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

TClonesArray* PndTrkCombiLegendreTask::fSttHitArray
private

Input array of PndSttHit

Definition at line 144 of file PndTrkCombiLegendreTask.h.

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

Double_t PndTrkCombiLegendreTask::fSttParalDistance
private

Definition at line 171 of file PndTrkCombiLegendreTask.h.

PndGeoSttPar* PndTrkCombiLegendreTask::fSttParameters
private

Definition at line 158 of file PndTrkCombiLegendreTask.h.

Referenced by Init(), and SetParContainers().

TClonesArray* PndTrkCombiLegendreTask::fSttPointArray
private

Input array of PndSttPoints

Definition at line 142 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePerpendicularChi2(), DoesBelong(), Exec(), and Init().

Double_t PndTrkCombiLegendreTask::fSttToMvdStripDistance
private

Definition at line 171 of file PndTrkCombiLegendreTask.h.

double PndTrkCombiLegendreTask::fThetamax
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by LegendreFit().

double PndTrkCombiLegendreTask::fThetamin
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by LegendreFit().

double PndTrkCombiLegendreTask::fTime
private

Definition at line 192 of file PndTrkCombiLegendreTask.h.

Referenced by Reset().

TStopwatch* PndTrkCombiLegendreTask::fTimer
private
TClonesArray* PndTrkCombiLegendreTask::fTrackArray
private

Definition at line 153 of file PndTrkCombiLegendreTask.h.

Referenced by Exec(), and Init().

TClonesArray * PndTrkCombiLegendreTask::fTrackCandArray
private

Definition at line 153 of file PndTrkCombiLegendreTask.h.

Referenced by Exec(), and Init().

TClonesArray* PndTrkCombiLegendreTask::fTubeArray
private
double PndTrkCombiLegendreTask::fUmax
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), Exec(), and LegendreFit().

double PndTrkCombiLegendreTask::fUmin
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), Exec(), and LegendreFit().

Bool_t PndTrkCombiLegendreTask::fUseMVDPix
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by Initialize().

Bool_t PndTrkCombiLegendreTask::fUseMVDStr
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by Initialize().

Bool_t PndTrkCombiLegendreTask::fUseSTT
private

Definition at line 178 of file PndTrkCombiLegendreTask.h.

Referenced by Initialize().

double PndTrkCombiLegendreTask::fVmax
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), Exec(), and LegendreFit().

double PndTrkCombiLegendreTask::fVmin
private

Definition at line 197 of file PndTrkCombiLegendreTask.h.

Referenced by ComputePlaneExtremities(), Exec(), and LegendreFit().

TH2F* PndTrkCombiLegendreTask::huv
private

Definition at line 204 of file PndTrkCombiLegendreTask.h.

Referenced by DrawGeometryConf().

TH2F* PndTrkCombiLegendreTask::hxy
private

Definition at line 202 of file PndTrkCombiLegendreTask.h.

Referenced by DrawSttGeometry().

TH2F * PndTrkCombiLegendreTask::hxz
private

Definition at line 202 of file PndTrkCombiLegendreTask.h.

TH2F * PndTrkCombiLegendreTask::hzphi
private

Definition at line 202 of file PndTrkCombiLegendreTask.h.

PndTrkLegendreTransform* PndTrkCombiLegendreTask::legendre
private

Definition at line 176 of file PndTrkCombiLegendreTask.h.

Referenced by Init().

PndTrkCombiLegendreTransform* PndTrkCombiLegendreTask::legendrecombi
private
PndTrkSdsHitList* PndTrkCombiLegendreTask::mvdpixhitlist
private

Definition at line 169 of file PndTrkCombiLegendreTask.h.

Referenced by FindMvdPixelReferenceHit(), Initialize(), Refresh(), and Reset().

PndTrkSdsHitList* PndTrkCombiLegendreTask::mvdstrhitlist
private

Definition at line 170 of file PndTrkCombiLegendreTask.h.

Referenced by FindMvdStripReferenceHit(), Initialize(), Refresh(), and Reset().

PndTrkSttHitList* PndTrkCombiLegendreTask::stthitlist
private
PndTrkTools* PndTrkCombiLegendreTask::tools
private

Definition at line 185 of file PndTrkCombiLegendreTask.h.

Referenced by CreateClusterAroundTrack2(), and Init().


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