FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndLmdLineTask Class Reference

#include <PndLmdLineTask.h>

Inheritance diagram for PndLmdLineTask:

Public Member Functions

 PndLmdLineTask (TString hitBranch="LMDHitsStrip")
 
 PndLmdLineTask (const PndLmdLineTask &)=delete
 
PndLmdLineTaskoperator= (const PndLmdLineTask &)=delete
 
virtual ~PndLmdLineTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 

Protected Member Functions

double line3Dfit (Int_t nd, TGraph2DErrors *gr, Double_t *fitpar, Double_t *fitparErr)
 
double line3Dfit (Int_t nd, TGraph2DErrors *gr, TVector3 posSeed, TVector3 dirSeed, Double_t *fitpar, TMatrixDSym *covmatrix)
 
 ClassDef (PndLmdLineTask, 1)
 

Protected Attributes

TClonesArray * fTCandArray
 
TClonesArray * fRecoArray
 
TClonesArray * fTruePointArray
 
TString fTCandBranchName
 
TString fRecoBranchName
 
TString fTruePointBranch
 
TClonesArray * fTrackArray
 
Int_t fTrackcount
 
Int_t fEvent
 

Detailed Description

Definition at line 29 of file PndLmdLineTask.h.

Constructor & Destructor Documentation

PndLmdLineTask::PndLmdLineTask ( TString  hitBranch = "LMDHitsStrip")

Definition at line 58 of file PndLmdLineTask.cxx.

References fRecoBranchName, fTCandBranchName, and fTruePointBranch.

59  : FairTask("Connect 2 points task") {
60  fTCandBranchName = "LMDTrackCand";
61  fRecoBranchName = hitBranch;
62  fTruePointBranch = "LMDPoint"; // True Points only for drawing!
63 }
TString fTCandBranchName
TString fTruePointBranch
TString fRecoBranchName
PndLmdLineTask::PndLmdLineTask ( const PndLmdLineTask )
delete
PndLmdLineTask::~PndLmdLineTask ( )
virtual

Definition at line 65 of file PndLmdLineTask.cxx.

65  {
66  cout << "PndLmdLineTask::~PndLmdLineTask()" << endl;
67 }

Member Function Documentation

PndLmdLineTask::ClassDef ( PndLmdLineTask  ,
 
)
protected
void PndLmdLineTask::Exec ( Option_t *  opt)
virtual

Obtain first approximation


Definition at line 100 of file PndLmdLineTask.cxx.

References fRecoArray, fTCandArray, fTrackArray, fVerbose, PndTrackCandHit::GetHitId(), PndTrackCand::GetNHits(), PndSdsHit::GetPosition(), PndTrackCand::GetSortedHit(), and track.

100  {
101  std::cout << "PndLmdLineTask::Exec" << std::endl;
102  // Reset output Array
103  if (fTrackArray == 0) Fatal("PndLmdLineTask::Exec", "No TrackArray");
104  fTrackArray->Delete();
105 
106  Int_t ntcand = fTCandArray->GetEntriesFast();
107 
108  // Detailed output
109  if (fVerbose > 1)
110  std::cout << " -I- PndLmdLineTask: contains " << ntcand << " RhoCandidates"
111  << std::endl;
112  if (fVerbose > 2) {
113  std::cout << " Detailed Debug info on the candidates:" << std::endl;
114  unsigned int index =
115  12345; // detid=12345, //[R.K.03/2017] unused variable
116  for (Int_t itr = 0; itr < ntcand; ++itr) {
117  PndTrackCand* trcnd = (PndTrackCand*)fTCandArray->At(itr);
118  std::cout << "TrackCand no. " << itr << " has " << trcnd->GetNHits()
119  << " hits." << std::endl;
120  std::cout << "Point: \t Index: " << std::endl;
121  for (unsigned int ihit = 0; ihit < trcnd->GetNHits();
122  ihit++) { // fill Graph
123  PndTrackCandHit theHit = trcnd->GetSortedHit(ihit); // get hit
124  index = theHit.GetHitId();
125  // detid = theHit.GetDetId(); //[R.K.03/2017] unused variable
126  std::cout << ihit << "\t" << index << std::endl;
127  }
128  }
129  }
130 
131  // Cut evil event
132  // if(ntcand>20){
133  // std::cout<<"ntcand="<<ntcand<<" Evil Event! skipping"<<std::endl;
134  // return;
135  //}
136 
137  // Fitting
138  // ----------------------------------------------------------------------------------
139  if (fVerbose > 1)
140  std::cout << " -I- PndLmdLineTask: start Fitting " << std::endl;
141  int rec_tkr = 0;
142  for (Int_t track = 0; track < ntcand; track++) {
143  PndTrackCand* trcnd = (PndTrackCand*)fTCandArray->At(track);
144  const int numPts = trcnd->GetNHits(); // read how many points in this track
145 
147  PndTrackCandHit theHit1 = trcnd->GetSortedHit(0); // get 1st hit
148  Int_t index1 = theHit1.GetHitId();
149  PndSdsHit* Hit1sds = (PndSdsHit*)fRecoArray->At(index1);
150  TVector3 posSeed = Hit1sds->GetPosition();
151  PndTrackCandHit theHit2 = trcnd->GetSortedHit(numPts - 1); // get last hit
152  Int_t index2 = theHit2.GetHitId();
153  PndSdsHit* Hit2sds = (PndSdsHit*)fRecoArray->At(index2);
154  TVector3 pos2 = Hit2sds->GetPosition();
155  TVector3 dirSeed = pos2 - posSeed;
156  dirSeed *= 1. / dirSeed.Mag();
157  // TVector3 posSeed = trcnd->getPosSeed();
158  // TVector3 dirSeed = trcnd->getDirSeed();
159  if (fVerbose > 2)
160  std::cout << "Track: " << track << " Points: " << numPts << std::endl;
162 
163  // TGraph2DErrors fitme(numPts); //new graph for fitting
164  Int_t firstHit = -1, lastHit = -1;
165  for (int ihit = 0; ihit < numPts; ihit++) { // fill Graph
166  PndTrackCandHit theHit = trcnd->GetSortedHit(ihit); // get hit
167  Int_t index = theHit.GetHitId();
168  // Int_t detId = theHit.GetDetId(); //[R.K. 01/2017] unused variable
169  // if(fVerbose>2) std::cout << "Point: "<< ihit<< " index: "<< index
170  // <<std::endl;
171 
172  if (ihit == 0)
173  firstHit = index;
174  else if (ihit == numPts - 1)
175  lastHit = index;
176  // PndSdsHit* addHit = (PndSdsHit*) fRecoArray->At(index);
177  // TVector3 addPos = addHit->GetPosition();
178  // cout<<"#"<<ihit<<" addPos:"<<endl;
179  // addPos.Print();
180  // fitme.SetPoint(ihit, addPos.X(), addPos.Y(), addPos.Z());
181  // fitme.SetPointError(ihit, addHit->GetDx(), addHit->GetDy(),
182  // addHit->GetDz());
183 
184  // PndSdsMCPoint *addHit = (PndSdsMCPoint*) fTruePointArray->At(index);
185  // //TEST ideal fit
186  // TVector3 addPos = addHit->GetPosition();
187  // fitme.SetPoint(ihit, addPos.X(), addPos.Y(), addPos.Z());
188  // PndSdsHit* recHit = (PndSdsHit*) fRecoArray->At(index);
189  // fitme.SetPointError(ihit, recHit->GetDx(), recHit->GetDy(),
190  // recHit->GetDz());
191  } // end of Hits in TCand
192 
193  /*Double_t parFit[6]; //fit-parameter
194  TMatrixDSym *COVmatrix = new TMatrixDSym(6);
195  Double_t accuracy = line3Dfit(numPts, &fitme, posSeed, dirSeed, parFit,
196  COVmatrix);*/
197 
198  // if(accuracy>0 && accuracy<1e3){
199  // start (P0, P2, P4), direction (P1, P3, P5) straight line
200  PndLinTrack* trackfit = new PndLinTrack(
201  "Lumi", posSeed.X(), dirSeed.X(), posSeed.Y(), dirSeed.Y(), posSeed.Z(),
202  posSeed.Z(), 0, firstHit, lastHit, track);
203  // PndLinTrack* trackfit = new PndLinTrack("Lumi", parFit[0], parFit[1],
204  // parFit[2], parFit[3], parFit[4], parFit[5],
205  // accuracy, firstHit, lastHit, track);
206  // trackfit->SetCovarianceMatrix(*COVmatrix);
207  new ((*fTrackArray)[rec_tkr]) PndLinTrack(*(trackfit)); // save Track
208  delete trackfit; // TEST
209  rec_tkr++;
210  // }
211  } // end of TCand's
212 
213  // Done--------------------------------------------------------------------------------------
214 
215  // TCanvas *c1 = new TCanvas("hchi2");
216  // c1->Divide(2,2);
217  // c1->cd(1);
218  // hchi2_0->Draw();
219  // c1->cd(2);
220  // hchi2_1->Draw();
221  // c1->cd(3);
222  // hchi2_2->Draw();
223  // c1->cd(4);
224  // hchi2_3->Draw();
225  // // c1->Write();
226  // gPad->WaitPrimitive();
227  std::cout << "Fitting done" << std::endl;
228  return;
229 }
int fVerbose
Definition: poormantracks.C:24
TVector3 GetPosition() const
Definition: PndSdsHit.h:93
PndRiemannTrack track
Definition: RiemannTest.C:33
PndTrackCandHit GetSortedHit(UInt_t i)
Definition: PndTrackCand.h:54
TClonesArray * fTrackArray
TClonesArray * fRecoArray
TClonesArray * fTCandArray
UInt_t GetNHits() const
Definition: PndTrackCand.h:59
Int_t GetHitId() const
InitStatus PndLmdLineTask::Init ( )
virtual

Definition at line 69 of file PndLmdLineTask.cxx.

References fRecoArray, fRecoBranchName, fTCandArray, fTCandBranchName, and fTrackArray.

69  {
70  // Get ROOT Manager
71  FairRootManager* ioman = FairRootManager::Instance();
72 
73  if (ioman == 0) {
74  Error("PndLmdLineTask::Init", "RootManager not instantiated!");
75  return kERROR;
76  }
77 
78  // Get input collection
79  fTCandArray = (TClonesArray*)ioman->GetObject(fTCandBranchName);
80 
81  if (fTCandArray == 0) {
82  Error("PndLmdLineTask::Init", "trackcand-array not found!");
83  return kERROR;
84  }
85 
86  fRecoArray = (TClonesArray*)ioman->GetObject(fRecoBranchName);
87 
88  if (fRecoArray == 0) {
89  Error("PndLmdLineTask::Init", "reco-array not found!");
90  return kERROR;
91  }
92 
93  fTrackArray = new TClonesArray("PndLinTrack");
94  ioman->Register("LMDTrack", "PndLmd", fTrackArray, kTRUE);
95 
96  std::cout << "-I- PndLmdLineTask: Initialisation successfull" << std::endl;
97  return kSUCCESS;
98 }
TClonesArray * fTrackArray
TClonesArray * fRecoArray
TString fTCandBranchName
TString fRecoBranchName
TClonesArray * fTCandArray
double PndLmdLineTask::line3Dfit ( Int_t  nd,
TGraph2DErrors *  gr,
Double_t fitpar,
Double_t fitparErr 
)
protected
double PndLmdLineTask::line3Dfit ( Int_t  nd,
TGraph2DErrors *  gr,
TVector3  posSeed,
TVector3  dirSeed,
Double_t fitpar,
TMatrixDSym *  covmatrix 
)
protected
PndLmdLineTask& PndLmdLineTask::operator= ( const PndLmdLineTask )
delete

Member Data Documentation

Int_t PndLmdLineTask::fEvent
protected

Definition at line 72 of file PndLmdLineTask.h.

TClonesArray* PndLmdLineTask::fRecoArray
protected

Definition at line 59 of file PndLmdLineTask.h.

Referenced by Exec(), and Init().

TString PndLmdLineTask::fRecoBranchName
protected

Definition at line 63 of file PndLmdLineTask.h.

Referenced by Init(), and PndLmdLineTask().

TClonesArray* PndLmdLineTask::fTCandArray
protected

Definition at line 58 of file PndLmdLineTask.h.

Referenced by Exec(), and Init().

TString PndLmdLineTask::fTCandBranchName
protected

Definition at line 62 of file PndLmdLineTask.h.

Referenced by Init(), and PndLmdLineTask().

TClonesArray* PndLmdLineTask::fTrackArray
protected

Definition at line 66 of file PndLmdLineTask.h.

Referenced by Exec(), and Init().

Int_t PndLmdLineTask::fTrackcount
protected

Definition at line 70 of file PndLmdLineTask.h.

TClonesArray* PndLmdLineTask::fTruePointArray
protected

Definition at line 60 of file PndLmdLineTask.h.

TString PndLmdLineTask::fTruePointBranch
protected

Definition at line 64 of file PndLmdLineTask.h.

Referenced by PndLmdLineTask().


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