23 #include "TVirtualGeoTrack.h"
26 : fTrackReps(NULL),
fPDG(2112), fCardinal_rep(0), fNextHitToFit(0)
32 : fTrackReps(NULL), fCardinal_rep(0), fNextHitToFit(0)
39 for(
unsigned int i=0;i<getNumReps();i++) {
40 delete fTrackReps->At(i);
44 for(
unsigned int i=0;i<fHits.size();i++) {
47 for(
unsigned int i=0;i<fBookkeeping.size();++i){
48 if(fBookkeeping.at(i)!=NULL)
delete fBookkeeping.at(i);
60 for(
unsigned int i=0; i<_tr.
getNumReps();i++) {
74 for(
unsigned int i=0;i<getNumReps();i++) {
75 delete fTrackReps->At(i);
80 for(
unsigned int i=0;i<fHits.size();i++) {
83 for(
unsigned int i=0;i<fBookkeeping.size();++i){
84 if(fBookkeeping.at(i)!=NULL)
delete fBookkeeping.at(i);
94 fHits.push_back((_tr.
getHit(i))->clone());
98 for(
unsigned int i=0; i<fBookkeeping.size(); ++i)
delete fBookkeeping[i];
112 if(fTrackReps!=NULL){
113 for(
unsigned int i=0;i<getNumReps();i++) {
114 delete fTrackReps->At(i);
115 delete fBookkeeping.at(i);
118 for(
unsigned int i=0;i<fHits.size();i++) {
128 for(
unsigned int i=0;i<nhits;++i){
133 addHit(hit,detId,hitId);
145 for(
unsigned int i=0;i<getNumReps();i++) {
155 unsigned int n=fCand.getNHits();
157 for(
unsigned int i=0; i<
n; ++i){
159 TVector3 pos=rep->
getPos(pl);
161 std::cout<<pos.X()<<
","<<pos.Y()<<
","<<pos.Z()<<std::endl;
163 geotrk->AddPoint(pos.X(),pos.Y(),pos.Z(),0);
172 std::vector<double>& result)
174 unsigned int nhits=getNumHits();
175 if(repid>=getNumReps())
return;
177 for(
unsigned int ih=0; ih<nhits; ++ih){
180 fCand.getHit(ih,anid,dummy);
185 TMatrixT<Double_t>
state(repDim,1);
195 result.push_back(res);
202 out <<
"GFTrack::printBookkeeping()" << std::endl;
203 for(
unsigned int i=0;i<getNumReps();++i){
204 out <<
"trackRep " << i <<
":" << std::endl;
205 fBookkeeping.at(i)->Print(out);
211 for(
unsigned int i=0;i<getNumReps();++i){
212 getTrackRep(i)->Print(out);
213 fBookkeeping.at(i)->Print(out);
215 out <<
"GFTrack has " << getNumHits() <<
" detector hits." << std::endl;
221 for(
int i=0;retVal.size();++i){
226 if (fHits.size() != fCand.getNHits())
227 throw GFException(
"genf::GFTrack::getResiduals(): inconsistent hits", __LINE__, __FILE__).
setFatal();
228 if (fHits.size() < 2)
229 throw GFException(
"genf::GFTrack::getResiduals(): less than 2 hits", __LINE__, __FILE__).
setFatal();
230 unsigned int detId,hitId,planeId;
231 fCand.getHitWithPlane(0,detId,hitId,planeId);
233 unsigned int lastPlane=planeId;
234 retVal.push_back(
new std::vector<int>);
235 retVal.at(0)->push_back(0);
236 for(
unsigned int i=1;i<fCand.getNHits();++i){
237 fCand.getHitWithPlane(i,detId,hitId,planeId);
239 if(lastPlane==planeId){
240 retVal.at(retVal.size()-1)->push_back(i);
244 retVal.push_back(
new std::vector<int>);
245 retVal.at(retVal.size()-1)->push_back(i);
void printBookkeeping(std::ostream &out=std::cout) const
print bookkeeping
GFTrack & operator=(const GFTrack &)
assignement operator
TObjArray * fTrackReps
Collection of track representations.
virtual GFAbsTrackRep * clone() const =0
virtual TVector3 getPos(const GFDetPlane &pl)=0
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
virtual const GFDetPlane & getDetPlane(GFAbsTrackRep *)=0
Get detector plane for a given track representation.
const TMatrixT< Double_t > & getState() const
unsigned int fNextHitToFit
std::vector< int > fRepAtHit
repAtHit keeps track of at which hit index which rep is currently defined, to avoid null extrapolatio...
Base Class for genfit track representations. Defines interface for track parameterizations.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void fillGeoTrack(TVirtualGeoTrack *tr) const
Fill TVirtualGeoTrack object Cardinal representation is used.
GFTrackCand fCand
Helper to store the indices of the hits in the track. See GFTrackCand for details.
unsigned int getNumReps() const
Get number of track represenatations.
GFTrack()
Default constructor – needed for compatibility with ROOT.
GFAbsRecoHit * getHit(int id) const
unsigned int fCardinal_rep
virtual double extrapolate(const GFDetPlane &plane, TMatrixT< Double_t > &statePred)
returns the tracklength spanned in this extrapolation
void Print(std::ostream &out=std::cout) const
void getResiduals(unsigned int detId, unsigned int dim, unsigned int rep, std::vector< double > &result)
Get residuals.
void mergeHits(GFTrack *trk)
Merge two GFTracks. Only hits will be merged.
unsigned int getNumHits() const
void getHit(unsigned int i, unsigned int &detId, unsigned int &hitId) const
Get detector ID and cluster index (hitId) for hit number i.
void reset()
Resets the GFTrack – deletes RecoHits!
std::vector< GFAbsRecoHit * > fHits
Collection of RecoHits.
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
void PrintROOTobject(std::ostream &, const ROOTOBJ &)
Small utility functions which print some ROOT objects into an output stream.
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
void getHitsByPlane(std::vector< std::vector< int > * > &retVal)
const GFTrackCand & getCand() const
unsigned int getDim() const
returns dimension of state vector
std::vector< GFBookkeeping * > fBookkeeping
Collection of Bookeeping objects for failed hits in every trackrep.
virtual TMatrixT< Double_t > residualVector(const GFAbsTrackRep *stateVector, const TMatrixT< Double_t > &state, const GFDetPlane &d)
Calculate residual with respect to a track representation.
void addTrackRep(GFAbsTrackRep *theTrackRep)
Add track represenation.
BEGIN_PROLOG could also be cout
void setCandidate(const GFTrackCand &cand, bool doreset=false)
set track candidate