CbmRoot
Loading...
Searching...
No Matches
LitMath.h
Go to the documentation of this file.
1/* Copyright (C) 2009-2013 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Andrey Lebedev [committer] */
4
14#ifndef LITMATH_H_
15#define LITMATH_H_
16
17#include "LitScalTrack.h"
18#include "LitTypes.h"
19
20namespace lit
21{
22 namespace parallel
23 {
24
32 inline fscal rcp(const fscal& a) { return 1. / a; }
33
44 inline fscal sgn(const fscal& a) { return a < 0 ? -1 : (a > 0 ? 1 : 0); }
45
56 inline unsigned short NDF(const LitScalTrack& track)
57 {
58 short ndf = 2 * track.GetNofHits() - 5;
59 if (ndf > 0) {
60 return ndf;
61 }
62 else {
63 return 1;
64 }
65
66 // int ndf = 0;
67 // for (int i = 0; i < track->GetNofHits(); i++){
68 // if (track->GetHit(i)->GetType() == kLITPIXELHIT) ndf += 2;
69 // else if (track->GetHit(i)->GetType() == kLITSTRIPHIT) ndf++;
70 // }
71 // ndf -= 5;
72 // if (ndf > 0) return ndf; else return 1;
73 }
74
75 } // namespace parallel
76} // namespace lit
77#endif /* LITMATH_H_ */
Scalar track data class.
Header files for SSE operations.
Scalar track data class.
unsigned short GetNofHits() const
Returns number of hits in track.
fscal rcp(const fscal &a)
Returns reciprocal.
Definition LitMath.h:32
fscal sgn(const fscal &a)
Returns sign of the input number.
Definition LitMath.h:44
unsigned short NDF(const LitScalTrack &track)
Returns number of degrees of freedom for the track.
Definition LitMath.h:56