19#include <TGeoMatrix.h>
35 UInt_t indexB, Double_t du, Double_t dv)
42 Double_t local[3] = {xLocal, yLocal, 0.};
46 fMatrix->LocalToMaster(local, global);
55 Double_t error[3] = {TMath::Sqrt(varX), TMath::Sqrt(varY), 0.};
58 Double_t hitTime = 0.5 * (clusterF.
GetTime() + clusterB.
GetTime());
61 Double_t hitTimeError = 0.5 * TMath::Sqrt(etF * etF + etB * etB);
64 fHits->emplace_back(
fAddress, global, error, varXY, indexF, indexB, hitTime, hitTimeError, du, dv);
73 vector<CbmStsHit>&
hits, UInt_t address, Double_t timeCutSig, Double_t timeCutAbs,
74 Double_t dY, UInt_t nStrips, Double_t pitch, Double_t stereoF, Double_t stereoB,
75 Double_t lorentzF, Double_t lorentzB, TGeoHMatrix* matrix)
81 assert(TMath::Abs(stereoF - stereoB) > 0.1);
101 Double_t maxTerrF = 0.;
102 for (
auto& cluster : clustersF) {
103 if (cluster.GetTimeError() > maxTerrF) maxTerrF = cluster.GetTimeError();
105 Double_t maxTerrB = 0.;
106 for (
auto& cluster : clustersB) {
107 if (cluster.GetTimeError() > maxTerrB) maxTerrB = cluster.GetTimeError();
109 const Double_t maxTerrF2 = maxTerrF * maxTerrF;
110 const Double_t maxTerrB2 = maxTerrB * maxTerrB;
111 const Double_t max_sigma_both = 4. * TMath::Sqrt(maxTerrF2 + maxTerrB2);
116 for (UInt_t iClusterF = 0; iClusterF < clustersF.size(); iClusterF++) {
119 Double_t tF = clusterF.
GetTime();
121 Double_t max_sigma = 4. * TMath::Sqrt(tFerr2 + maxTerrB2);
123 for (UInt_t iClusterB = startB; iClusterB < clustersB.size(); iClusterB++) {
126 Double_t timeDiff = tF - clusterB.
GetTime();
128 if ((timeDiff > 0) && (timeDiff > max_sigma_both)) {
132 else if ((timeDiff > 0) && (timeDiff > max_sigma)) {
135 else if ((timeDiff < 0) && (fabs(timeDiff) > max_sigma))
139 Double_t timeCut = -1.;
141 timeCut = timeCutAbs;
143 if (timeCutSig > 0.) {
146 timeCut = timeCutSig * TMath::Sqrt(eF * eF + eB * eB);
149 if (fabs(clusterF.
GetTime() - clusterB.
GetTime()) > timeCut)
continue;
169 Int_t iChannel = Int_t(centre);
170 Double_t xDif = centre - Double_t(iChannel);
174 pair<Int_t, Int_t> stripSide =
GetStrip(iChannel);
175 iStrip = stripSide.first;
176 side = stripSide.second;
180 xCluster = (Double_t(iStrip) + xDif + 0.5) *
fPitch;
221 return (pair<Int_t, Int_t>(stripNr, side));
228 Double_t& varX, Double_t& varY, Double_t& varXY)
273 varY =
fErrorFac * (exF * exF + exB * exB);
295 std::cout <<
"Cluster position " << clusterF.
GetPosition() <<
": x " << xF <<
" side " << side << std::endl;
299 Double_t du = exF * TMath::Cos(TMath::DegToRad() *
fStereoF);
303 Double_t dv = exB * TMath::Cos(TMath::DegToRad() *
fStereoB);
306 if (!(xF >= 0. || xF <=
fDx))
return 0;
307 if (!(xB >= 0. || xB <=
fDx))
return 0;
325 Int_t nF1 = TMath::Min(0, nF);
326 Int_t nF2 = TMath::Max(0, nF);
327 Int_t nB1 = TMath::Min(0, nB);
328 Int_t nB2 = TMath::Max(0, nB);
336 for (Int_t iF = nF1; iF <= nF2; iF++) {
337 Double_t xFi = xF - Double_t(iF) *
fDx;
338 for (Int_t iB = nB1; iB <= nB2; iB++) {
339 Double_t xBi = xB - Double_t(iB) *
fDx;
342 Bool_t found =
Intersect(xFi, exF, xBi, exB, xC, yC, varX, varY, varXY);
349 CreateHit(xC, yC, varX, varY, varXY, clusterF, clusterB, indexF, indexB, du, dv);
366 if (
x < -
fDx / 2.)
return kFALSE;
367 if (
x >
fDx / 2.)
return kFALSE;
368 if (
y < -
fDy / 2.)
return kFALSE;
369 if (
y >
fDy / 2.)
return kFALSE;
ClassImp(CbmConverterManager)
Data class for STS clusters.
Data class for a reconstructed hit in the STS.
static vector< vector< QAHit > > hits
Algorithm for hit finding in the sensors of the CBM-STS.
Double_t fDy
Active size in y [cm].
Bool_t Intersect(Double_t xF, Double_t exF, Double_t xB, Double_t exB, Double_t &x, Double_t &y, Double_t &varX, Double_t &varY, Double_t &varXY)
Intersection point of two strips / cluster centres.
std::pair< Int_t, Int_t > GetStrip(UInt_t channel) const
Get strip and side from module channel.
Double_t fLorentzF
Lorentz shift correction front side [cm].
Double_t fPitch
Strip pitch [cm].
Double_t fStereoF
Stereo angle front side [deg].
CbmStsAlgoFindHits()
Constructor.
UInt_t fAddress
Unique address for hits (sensor)
Double_t fTanStereoB
Tangent of stereo angle back side.
Double_t fErrorFac
For calculation of the hit error.
Double_t fTanStereoF
///< Transformation matrix to global C.S.
void CreateHit(Double_t xLocal, Double_t yLocal, Double_t varX, Double_t varY, Double_t varXY, const CbmStsCluster &clusterF, const CbmStsCluster &clusterB, UInt_t indexF, UInt_t indexB, Double_t du=0., Double_t dv=0.)
Create a new hit in the output array.
Double_t fStereoB
Stereo angle back side [deg].
void GetClusterPosition(Double_t ClusterCentre, Double_t &xCluster, Int_t &side)
Int_t IntersectClusters(const CbmStsCluster &clusterF, const CbmStsCluster &clusterB, UInt_t indexF, UInt_t indexB)
Find the intersection points of two clusters.
UInt_t fNofStrips
Number of strips.
Double_t fDx
Active size in x [cm].
Bool_t IsInside(Double_t x, Double_t y)
Check whether a point (x,y) is inside the active area.
std::vector< CbmStsHit > * fHits
Output vector of hits.
Double_t fLorentzB
Lorentz shift correction back side [cm].
Long64_t Exec(const std::vector< CbmStsCluster > &clustersF, const std::vector< CbmStsCluster > &clustersB, std::vector< CbmStsHit > &hits, UInt_t address, Double_t timeCutSig, Double_t timeCutAbs, Double_t dY, UInt_t nStrips, Double_t pitch, Double_t stereoF, Double_t stereoB, Double_t lorentzF, Double_t lorentzB, TGeoHMatrix *matrix)
Execute algorithm.
Data class for STS clusters.
double GetPositionError() const
Cluster position error @value Error (r.m.s.) of cluster position in channel number units.
double GetTime() const
Get cluster time.
double GetPosition() const
Cluster position @value Cluster position in channel number units.
double GetTimeError() const
Get error of cluster time.
void LocalToMasterCovarianceMatrix(const TGeoMatrix &m, Double_t &covXX, Double_t &covXY, Double_t &covYY)
Convert the local X/Y covariance matrix to global coordinates.