16 #include "FairField.h"
25 #include "FairTrackParP.h"
34 #include "TSpectrum2.h"
38 #include "FairRunAna.h"
39 #include "FairRootManager.h"
40 #include "FairRuntimeDb.h"
54 #include "TClonesArray.h"
55 #include "TParticlePDG.h"
58 #include "FairRootManager.h"
60 #include "FairRuntimeDb.h"
61 #include "FairRunAna.h"
64 #include "TObjectTable.h"
80 fLogger(FairLogger::GetLogger()),
87 fTracksArrayName(
"FTSTrkHough"),
90 fSaveDebugInfo(kFALSE),
95 if(3<
fVerbose) std::cout <<
"PndFtsHoughTrackerTask is the tracker ptr " <<
this <<
'\n';
102 if(
fVerbose>3)
fLogger->Info(MESSAGE_ORIGIN,
"Destructor of PndFtsHoughTrackerTask");
116 if(
fVerbose>3)
fLogger->Info(MESSAGE_ORIGIN,
"SetParContainers of PndFtsHoughTrackerTask");
119 FairRuntimeDb *
rtdb= FairRun::Instance()->GetRuntimeDb();
126 if(
fVerbose>3) Info(
"Init",
"Initilization of PndFtsHoughTrackerTask");
129 FairRootManager* ioman = FairRootManager::Instance();
131 fLogger->Fatal(MESSAGE_ORIGIN,
"RootManager not instantiated, return!");
159 fFtsHitArray= (TClonesArray *)ioman->GetObject(
"FTSHit");
161 fLogger->Info(MESSAGE_ORIGIN,
"No FTSHit array!");
164 fFtsMcPoints =
dynamic_cast<TClonesArray *
> (ioman->GetObject(
"FTSPoint"));
166 fLogger->Info(MESSAGE_ORIGIN,
"No McPoints array!");
180 if(
fVerbose>3) Info(
"Init",
"Try to get B field.");
181 fField = FairRunAna::Instance()->GetField();
201 fTracks =
new TClonesArray(
"PndTrack");
205 if(3<
fVerbose) Info(
"Register",
"Done.");
247 InitStatus stat=kSUCCESS;
248 if(3<
fVerbose)
fLogger->Info(MESSAGE_ORIGIN,
"Re- Initilization of PndFtsHoughTrackerTask");
257 const Double_t sizeSigmaCoeff = 1.5;
261 TVector3 hitPosErrors(rhoError,rhoError,zError);
270 const Double_t sizeSigmaCoeff = 1.5;
275 TMatrixT<Double_t> unrotatedCovMatrix(3,3);
277 for (Int_t firstIdx=0; firstIdx < 3; ++firstIdx){
278 for (Int_t secondIdx=0; secondIdx < 3; ++secondIdx){
279 unrotatedCovMatrix[firstIdx][secondIdx] = 0;
282 unrotatedCovMatrix[0][0] = pow(rhoError, 2);
283 unrotatedCovMatrix[1][1] = pow(rhoError, 2);
284 unrotatedCovMatrix[2][2] = pow(zError, 2);
286 TMatrixT<Double_t> rotatedCovMatrix = rotationMatrix*unrotatedCovMatrix;
287 rotatedCovMatrix *= rotationMatrix.Transpose(rotationMatrix);
289 return rotatedCovMatrix;
296 if(1<
fVerbose) Info(
"Exec",
"Exec of PndFtsHoughTrackerTask on event %i",
fEventNr);
299 if ( !
fTrackCands ) Fatal(
"Exec",
"No track cand array");
308 if(3<
fVerbose) std::cout <<
"PndFtsHoughTrackFinder::Exec tracker ptr " <<
this <<
'\n';
319 for (Int_t iFoundTrack = 0; iFoundTrack < trackFinder.
NTracks(); ++iFoundTrack){
331 std::cout <<
"Track " << iFoundTrack <<
'\n';
332 std::cout <<
"Links: ";
333 ((FairMultiLinkedData*) myCand)->
Print();
342 if (myCand->GetTimeStamp() == 0){
343 myTrack->SetTimeStamp(0.0001 * (iFoundTrack+1));
344 myCand->SetTimeStamp(0.0001 * (iFoundTrack+1));
347 myTrack->SetTimeStamp(myCand->GetTimeStamp());
348 myTrack->SetTimeStampError(myCand->GetTimeStampError());
350 myTrack->SetLink(FairLink(
"FTSHoughTrackCand", iFoundTrack));
355 std::cout << iFoundTrack <<
": ";
364 if(3<
fVerbose) Info(
"Exec",
"End eventloop.");
381 if(3<
fVerbose) Info(
"Finish",
"Finish of PndFtsHoughTrackerTask");
383 FairRootManager* ioman = FairRootManager::Instance();
385 fLogger->Fatal(MESSAGE_ORIGIN,
"RootManager not instantiated, return!");
virtual InitStatus ReInit()
ReInitiliazation of task when the runID changes.
UInt_t fEventNr
Event number for debugging purposes.
virtual void Finish()
Writes output to root file, I guess. Called at the end of the run.
FairField * fField
For B field access.
Interface between PandaRoot (data input and output) and PndFtsHoughTrackFinder (implementation of PR ...
const TMatrixT< Double_t > GetFtsHitCovMatrix(const PndFtsHit *const ftsHit) const
Returns the position covariance matrix (based on FTS straw geometry) for the hit with index hitId in ...
void SetPersistency(Bool_t val=kTRUE)
TClonesArray * fFtsHitArray
Input array of PndFtsHit.
void SetTrackCandRef(PndTrackCand *candPointer)
TClonesArray * fTracks
Array of found tracks in PndTrack (for output)
PndTrack GetPndTrack(int i)
Returns the number of found tracks.
virtual void FinishEvent()
When is this executed? After each event?
PndTrackCand GetPndTrackCand(int i)
Returns the track cand. with index i.
Int_t fFtsBranchId
Detector Id of FTS.
TClonesArray * fFtsMcPoints
Input array of McPoints.
TString fTracksArrayName
Branch name where to store the Track candidates.
PndFtsHoughTrackerTask(Int_t verbose=0, Bool_t persistence=kTRUE)
Constructor with flags. Can also be used as standard constructor.
TMatrixT< Double_t > GetRotationMatrix() const
virtual void SetParContainers()
Loads the parameter container from the runtime database.
FairLogger * fLogger
Returns pointer to the B field.
void CheckForDuplicateFtsHits()
virtual void FindTracks()
Performs the track finding.
PndFtsHoughTrackCand GetHoughTrack(int i) const
Returns the track cand. with index i.
Double_t GetHalfLength() const
PndGeoFtsPar * fFtsParameters
Needed for FTS map creator.
virtual InitStatus Init()
Initialization of task at the beginning of a run.
PndLheTrackFinder * trackFinder
~PndFtsHoughTrackerTask()
Destructor.
Double_t GetRadIn() const
const PndFtsTube * GetFtsTube(const PndFtsHit *const myHit) const
Returns pointer to the FTS tube corresponding to input FTS hit.
TClonesArray * FillTubeArray()
this function will be used in PndFtsHitProducesRealFast
Implementation of the QA for the Hough transform based FTS PR. Use this for parameter optimization...
virtual void Exec(Option_t *opt)
Executed for each event.
const TVector3 GetFtsHitPosErrors(const PndFtsHit *const ftsHit) const
Returns the position error (based on FTS straw geometry) for the hit with index hitId in the FTS hit ...
TClonesArray * fFtsTubeArray
Input array of PndFtsTube (map of FTS tubes).
TClonesArray * fTrackCands
Array of found track candidates in PndTrackCand (for output)