36 for(
unsigned int j=0; j<eff_hits.size(); j++) mini_trk->
addHit(eff_hits.at(j));
46 for(
unsigned int iBeta=0; iBeta<
fBeta.size(); iBeta++) {
48 for(
unsigned int j=0; j<mini_trk->
getNumHits(); j++) {
58 if(iBeta !=
fBeta.size()-1 )
82 std::vector<std::vector<double> > ret_val;
87 std::vector<double>
phi;
91 std::vector<double> weights;
94 if(x_smoo.GetNrows() == 0) {
96 std::cout<<
"Assumed weight 0.5!!"<<std::endl;
97 ret_val.push_back(weights);
101 for(
unsigned int j=0; j<eff_hit->
getNumHits(); j++) {
111 TMatrixT<double> V( beta * real_hit->
getHitCov(pl));
112 TMatrixT<double> resid(
m - x_smoo);
113 TMatrixT<double> resid_T(resid);
115 double detV = V.Determinant();
116 TMatrixT<double> Vinv;
119 phi.push_back((1./(pow(2.*
TMath::Pi(),V.GetNrows()/2.)*
sqrt(detV)))*
exp(-0.5*(resid_T * Vinv * resid)[0][0]));
120 phi_sum += phi.at(j);
123 assert(cutVal>1.E-6);
128 for(
unsigned int j=0; j<eff_hit->
getNumHits(); j++) {
131 weights.push_back(phi.at(j)/(phi_sum+phi_cut));
135 ret_val.push_back(weights);
145 if(
fabs(val-0.01)<1.E-10){
152 else if(
fabs(val-0.005)<1.E-10){
159 else if(
fabs(val-0.001)<1.E-10){
167 GFException exc(
"GFDafsetProbCut() value is not supported",__LINE__,__FILE__);
174 void GFDaf::setBetas(
double b1,
double b2,
double b3,
double b4,
double b5,
double b6,
double b7,
double b8,
double b9,
double b10){
175 assert(b1>0);
fBeta.push_back(b1);
176 assert(b2>0 && b2<=b1);
fBeta.push_back(b2);
178 assert(b3<=b2);
fBeta.push_back(b3);
180 assert(b4<=b3);
fBeta.push_back(b4);
182 assert(b5<=b4);
fBeta.push_back(b5);
184 assert(b6<=b5);
fBeta.push_back(b6);
186 assert(b7<=b6);
fBeta.push_back(b7);
188 assert(b8<=b7);
fBeta.push_back(b8);
190 assert(b9<=b8);
fBeta.push_back(b9);
192 assert(b10<=b9);
fBeta.push_back(b10);
205 std::vector< std::vector<int>* > planes;
207 int nPlanes = planes.size();
209 std::vector<GFDafHit*> eff_hits;
211 for(
int i=0;
i<nPlanes;
i++) {
213 std::vector<GFAbsRecoHit*>
hits;
215 for(
unsigned int j=0; j<planes.at(
i)->size(); j++) {
216 hits.push_back(trk->
getHit(planes.at(
i)->at(j)) );
220 eff_hits.push_back(eff_hit);
225 std::vector<std::vector<double> > rep_weights;
226 for(
unsigned int j=0; j<eff_hits.size(); j++) {
227 std::vector<double> single_weights;
228 single_weights.assign(eff_hits.at(j)->getNumHits(),1.);
229 rep_weights.push_back(single_weights);
243 bool already_there =
false;
244 for(
unsigned int j=0; j<mat_keys.size(); j++) {
245 if(mat_keys.at(j) ==
"fUpSt") already_there =
true;
247 if(already_there)
continue;
264 for(
unsigned int pl_i=0; pl_i<source->
getNumHits(); pl_i++) {
268 for(
unsigned int hit_i=0; hit_i<eff_hit->
getNumHits(); hit_i++) {
270 TMatrixT<double> fUpSt, fUpCov, bUpSt, bUpCov, fAuxInfo, bAuxInfo;
283 target->
getBK(target_irep)->
setMatrix(
"fAuxInfo",hit_count,fAuxInfo);
284 target->
getBK(target_irep)->
setMatrix(
"bAuxInfo",hit_count,bAuxInfo);
std::vector< GFDafHit * > initHitsWeights(GFTrack *trk)
Initialize the GFDafHit and their weights before the fit.
GFBookkeeping * getBK(int index=-1)
get GFBookKeeping object for particular track rep (default is cardinal rep)
unsigned int getNumHits()
Get the number of hits in the GFDafHit.
unsigned int getNumHits() const
friend F32vec4 exp(const F32vec4 &a)
void addHit(GFAbsRecoHit *theHit)
deprecated!
Detector plane genfit geometry class.
friend F32vec4 sqrt(const F32vec4 &a)
Track object for genfit. genfit algorithms work on these objects.
bool getSmoothing()
Read back if smoothing is/was turned on or off for this track.
Double_t val[nBoxes][nFEBox]
void getHitsByPlane(std::vector< std::vector< int > * > &retVal)
Generic Kalman Filter implementation.
virtual const GFDetPlane & getDetPlane(GFAbsTrackRep *)=0
Get detector plane for a given track representation.
void setSmoothing(bool smooth=true)
Switch smoothing on or off for this track.
virtual const char * what() const
standard error message handling for exceptions. use like "std::cerr << e.what();" ...
void setProbCut(double prob_cut)
Set the probabilty cut for the weight calculation for the hits.
void setWeights(std::vector< double > weights)
Set the weights.
std::map< int, double > fchi2Cuts
GFAbsRecoHit * getHit(unsigned int ihit)
Get at hit from the GFDafHit.
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl)
std::vector< std::vector< double > > calcWeights(GFTrack *trk, double beta)
Calculate the weights for the next fitting pass.
void bookGFDetPlanes(std::string key)
unsigned int getNumReps() const
Get number of track represenatations.
Wrapper class for use with GFDaf.
void setBlowUp(double blow_up)
Set the blow up factor for the covariance matrices.
std::vector< std::vector< std::vector< double > > > fWeights
virtual bool hasAuxInfo()
See if the track representation has auxillary information stored.
void setDetPlane(std::string key, unsigned int index, const GFDetPlane &pl)
void copySmoothing(GFTrack *source, GFTrack *target, int target_ire)
Copy the smoothing matrices from the source track to the target.
std::vector< std::string > getMatrixKeys()
virtual TMatrixT< double > getHitCov(const GFDetPlane &)=0
Get hit covariances in a specific detector plane.
void processTrack(GFTrack *trk)
Process a track using the DAF.
void processTrack(GFTrack *trk)
Performs fit on a GFTrack.
friend F32vec4 fabs(const F32vec4 &a)
void info()
print information in the exception object
Base Class for representing a Hit in GENFIT.
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
void releaseTrackReps()
Clear TrackRep vector. Note that the Reps will not be deleted!
void setBetas(double b1, double b2, double b3=-1., double b4=-1., double b5=-1., double b6=-1., double b7=-1., double b8=-1., double b9=-1., double b10=-1.)
Configure the annealing scheme.
void setMatrix(std::string key, unsigned int index, const TMatrixT< double > &mat)
void bookMatrices(std::string key)
bool getMatrix(std::string key, unsigned int index, TMatrixT< double > &mat)
void addTrackRep(GFAbsTrackRep *theTrackRep)
Add track represenation.
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
GFAbsRecoHit * getHit(int id) const
std::vector< double > fBeta
void setStatusFlag(int _val)
void setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
void setNumIterations(Int_t i)
Set number of iterations for Kalman Filter.
virtual TMatrixT< double > getHitCoord(const GFDetPlane &)=0
Get hit coordinates in a specific detector plane.