17 AngleRad = AngleDeg*Pi()/180;
21 if(AngleDeg <= 0.0 && AngleDeg >= -90.0) {
25 if(AngleDeg > 0.0 && AngleDeg <= 90.0) {
30 ClusterFindingThreshold = 0.0;
34 Double_t xsize, Double_t ysize,
35 Double_t xorig, Double_t yorig,
36 Double_t pitch, Double_t adeg) {
40 LayerZoneNumber = zone_number;
41 LayerType = layer_type;
44 XMaxLayer = xorig + xsize;
46 YMaxLayer = yorig + ysize;
50 AngleRad = AngleDeg*Pi()/180;
54 if(AngleDeg <= 0.0 && AngleDeg >= -90.0) {
58 if(AngleDeg > 0.0 && AngleDeg <= 90.0) {
63 ClusterFindingThreshold = 0.0;
75 Strips.resize(NStrips, 0.0);
91 Double_t n_strips = (xright_layer - xleft_layer)/Pitch;
93 if( (n_strips - (Int_t)n_strips) < 1E-10 ) {
94 return (Int_t)n_strips;
97 return (Int_t)(n_strips+1);
109 XMaxLayer = xorig + xsize;
111 YMaxLayer = yorig + ysize;
117 if(Abs(deg) <= 90.0) {
122 if(Verbosity) cerr <<
"WARNING: BmnSiBTLayer::SetAngleDeg(): the strip angle is incorrect and has been set to zero\n";
125 AngleRad = AngleDeg*Pi()/180;
131 if(x_right < x_left)
return false;
133 XLeftPointOfStripNumbering = x_left;
134 YLeftPointOfStripNumbering = y_left;
135 XRightPointOfStripNumbering = x_right;
136 YRightPointOfStripNumbering = y_right;
146 if(Verbosity) cerr <<
"WARNING: SetStripNumberingBorders: left strip border point is incorrect\n";
150 if(Verbosity) cerr <<
"WARNING: SetStripNumberingBorders: right strip border point is incorrect\n";
154 XLeftPointOfStripNumbering = XMinLayer;
155 XRightPointOfStripNumbering = XMaxLayer;
159 YLeftPointOfStripNumbering = YMaxLayer;
162 YLeftPointOfStripNumbering = YMinLayer;
170 YRightPointOfStripNumbering = YMaxLayer;
173 YRightPointOfStripNumbering = YMinLayer;
185 StripOrder = strip_direction;
194 Bool_t status = dead_zone.
SetDeadZone(n_points, x_points, y_points);
196 DeadZones.push_back(dead_zone);
206 DeadZones.push_back(dead_zone);
215 for (
size_t izone = 0; izone < DeadZones.size(); ++izone) {
216 if(DeadZones[izone].IsInside(x,y))
return true;
223 if( x >= XMinLayer && x <= XMaxLayer &&
224 y >= YMinLayer && y <= YMaxLayer &&
231 if (strip_num >= 0 && strip_num < (Int_t)Strips.size()) {
232 Strips[strip_num] = signal;
239 if (strip_num >= 0 && strip_num < (Int_t)Strips.size()) {
240 Strips[strip_num] += signal;
247 if (strip_num >= 0 && strip_num < (Int_t)Strips.size()) {
248 return Strips[strip_num];
254 if (strip_num >= 0 && strip_num < (Int_t)StripMatches.size()) {
255 StripMatches[strip_num] = strip_match;
262 if (strip_num >= 0 && strip_num < (Int_t)StripMatches.size()) {
263 StripMatches[strip_num].AddLink(weight, refID);
270 if (strip_num >= 0 && strip_num < (Int_t)StripMatches.size()) {
271 return StripMatches[strip_num];
279 StripMatches.clear();
280 StripMatches.resize(NStrips,
BmnMatch());
284 if (num >= 0 && num < (Int_t)StripHits.size()) {
285 return StripHits[num];
291 if (num >= 0 && num < (Int_t)StripHitsTotalSignal.size()) {
292 return StripHitsTotalSignal[num];
298 if (num >= 0 && num < (Int_t)StripHitsErrors.size()) {
299 return StripHitsErrors[num];
305 if (num >= 0 && num < (Int_t)StripHitsClusterSize.size()) {
306 return StripHitsClusterSize[num];
313 StripHitsTotalSignal.clear();
314 StripHitsErrors.clear();
315 StripHitsClusterSize.clear();
319 Double_t XRotationCenter;
320 Double_t YRotationCenter;
323 XRotationCenter = XLeftPointOfStripNumbering;
324 YRotationCenter = YLeftPointOfStripNumbering;
328 XRotationCenter = XRightPointOfStripNumbering;
329 YRotationCenter = YRightPointOfStripNumbering;
332 Double_t StripX = (x - XRotationCenter)*Cos(-AngleRad) + (y - YRotationCenter)*Sin(-AngleRad) + XRotationCenter;
337 Double_t XRotationCenter;
338 Double_t YRotationCenter;
341 XRotationCenter = XLeftPointOfStripNumbering;
342 YRotationCenter = YLeftPointOfStripNumbering;
346 XRotationCenter = XRightPointOfStripNumbering;
347 YRotationCenter = YRightPointOfStripNumbering;
350 Double_t StripY = -(x - XRotationCenter)*Sin(-AngleRad) + (y - YRotationCenter)*Cos(-AngleRad) + YRotationCenter;
374 if(Abs(AngleDeg) != 90.0) {
375 Double_t x_strip_shift = (strip_pos*Pitch)/Cos(Abs(AngleRad));
379 xcoord = XLeftPointOfStripNumbering + x_strip_shift;
380 b = YLeftPointOfStripNumbering - Tan(PiOver2()-AngleRad)*xcoord;
384 xcoord = XRightPointOfStripNumbering-x_strip_shift;
385 b = YRightPointOfStripNumbering - Tan(PiOver2()-AngleRad)*xcoord;
390 Double_t y_strip_shift = strip_pos*Pitch*Sin(AngleRad);
393 b = YLeftPointOfStripNumbering - y_strip_shift;
397 b = YRightPointOfStripNumbering + y_strip_shift;
409 Double_t threshold = ClusterFindingThreshold;
414 Bool_t ascent =
false;
415 Bool_t descent =
false;
418 vector<Double_t> AnalyzableStrips = Strips;
425 for (Int_t is = 0; is < (Int_t)AnalyzableStrips.size(); is++)
427 if(AnalyzableStrips.at(is) <= threshold) {
428 if(descent || ascent) {
459 cluster.
AddStrip(is, AnalyzableStrips.at(is));
464 Int_t lastnum = AnalyzableStrips.size()-1;
471 Double_t mean_strip_position = 0.0;
472 Double_t total_cluster_signal = 0.0;
473 Double_t cluster_rms = 0.0;
479 if(AnalyzableStrips.at(curcnt) >= AnalyzableStrips.at(curcnt-1)) {
481 AnalyzableStrips.at(curcnt-1) *= 0.5;
486 for(Int_t
i = 0;
i < NStripsInCluster; ++
i) {
487 Double_t strip_num = cluster.
Strips.at(
i);
488 Double_t signal = cluster.
Signals.at(
i);
489 total_cluster_signal += signal;
490 mean_strip_position += (strip_num+0.5)*signal;
492 mean_strip_position /= total_cluster_signal;
494 if(mean_strip_position < 0.0) mean_strip_position = 0.0;
495 if(mean_strip_position >= AnalyzableStrips.size()) mean_strip_position = AnalyzableStrips.size() - 0.001;
515 Double_t sumW = total_cluster_signal;
517 Double_t sumWX2 = 0.;
518 if(NStripsInCluster > 1) {
519 for(Int_t
i = 0;
i < NStripsInCluster; ++
i) {
520 Double_t strip_num = cluster.
Strips.at(
i);
521 Double_t signal = cluster.
Signals.at(
i);
522 sumWX += strip_num * signal;
523 sumWX2 += strip_num * strip_num * signal;
525 cluster_rms = (sumWX2 - sumWX * sumWX / sumW) / sumW;
529 cluster_rms = 1.0 /TMath::Sqrt(12.0);
547 StripHits.push_back(mean_strip_position);
548 StripHitsTotalSignal.push_back(total_cluster_signal);
549 StripHitsErrors.push_back(cluster_rms);
550 StripHitsClusterSize.push_back(NStripsInCluster);
554 if( curcnt < 0 ) curcnt = 0;
566 SmoothStrips.clear();
567 Int_t NStrips = AnalyzableStrips.size();
569 for(Int_t iteration = 0; iteration < NIterations; ++iteration) {
570 SmoothStrips.clear();
571 for(Int_t istrip = 0; istrip < NStrips; ++istrip) {
572 Double_t mean_value = 0.0;
573 for(Int_t iw = istrip-SmoothWindow; iw <= istrip+SmoothWindow; ++iw) {
574 if(iw >= 0 && iw < NStrips) {
575 if(iw == istrip) mean_value += AnalyzableStrips[iw]*Weight;
576 else mean_value += AnalyzableStrips[iw];
579 mean_value /= 2.0*SmoothWindow + Weight;
580 SmoothStrips.push_back(mean_value);
582 AnalyzableStrips = SmoothStrips;
Double_t GetStripHitTotalSignal(Int_t num)
void SetPitch(Double_t pitch)
Bool_t IsPointInsideStripLayer(Double_t x, Double_t y)
Double_t ConvertNormalPointToStripX(Double_t x, Double_t y)
Double_t ConvertPointToStripPosition(Double_t x, Double_t y)
void SetAngleDeg(Double_t deg)
Bool_t SetStripNumberingBorders(Double_t x_left, Double_t y_left, Double_t x_right, Double_t y_right)
Double_t GetStripSignal(Int_t strip_num)
void SmoothStripSignal(vector< Double_t > &AnalyzableStrips, Int_t NIterations, Int_t SmoothWindow, Double_t Weight)
Int_t GetStripHitClusterSize(Int_t num)
Bool_t SetStripMatch(Int_t strip_num, BmnMatch strip_match)
Double_t ConvertNormalPointToStripY(Double_t x, Double_t y)
void MakeStripHit(StripCluster &cluster, vector< Double_t > &AnalyzableStrips, Int_t &curcnt)
Bool_t SetStripNumberingOrder(StripNumberingDirection strip_direction)
Bool_t SetStripSignal(Int_t strip_num, Double_t signal)
Bool_t AddLinkToStripMatch(Int_t strip_num, Double_t weight, Int_t refID)
void FindClustersAndStripHits()
BmnMatch GetStripMatch(Int_t strip_num)
Bool_t IsPointInsideDeadZones(Double_t x, Double_t y)
Bool_t AddDeadZone(Int_t n_points, Double_t *x_points, Double_t *y_points)
Double_t GetStripHitPos(Int_t num)
void SetLayerSizes(Double_t xsize, Double_t ysize, Double_t xorig=0.0, Double_t yorig=0.0)
Bool_t AddStripSignal(Int_t strip_num, Double_t signal)
Double_t GetStripHitError(Int_t num)
Double_t CalculateStripEquationB(Double_t strip_pos)
Bool_t SetDeadZone(Int_t n_points, Double_t *xpoints, Double_t *ypoints)
void AddStrip(Int_t strip_num, Double_t strip_signal)
vector< Double_t > Signals