L1AlgoTBB.h 7.95 KB
Newer Older
1
2
3
/* Copyright (C) 2010-2021 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt
   SPDX-License-Identifier: GPL-3.0-only
   Authors: Igor Kulakov [committer] */
4

5
6
7
8
9
10
11
12
13
14
#ifndef L1AlgoTBB_h
#define L1AlgoTBB_h


#include "L1Algo.h"

#ifdef TBB

#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
Administrator's avatar
Administrator committed
15
16
#include "tbb/task_scheduler_init.h"

17
namespace tbb
18
{
Administrator's avatar
Administrator committed
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  class ParalleledDup {
    // input
    int isec;
    L1Station* vStations;
    int NStations;
    Tindex* StsHitsStartIndex;
    Tindex* StsHitsStopIndex;
    vector<unsigned char>& vSFlag;
    vector<unsigned char>& vSFlagB;
    std::vector<L1HitPoint>& vStsHits;
    double Pick_r;
    double Pick_m;
    double MaxInvMom;
    fvec targX;
    fvec targY;
    fvec targZ;
    L1FieldValue& targB;
    L1XYMeasurementInfo& TargetXYInfo;

    Tindex* n_g1;
    unsigned* portionStopIndex;
    L1TrackPar* T_g1;
    L1FieldRegion* fld_g1;
43
    L1HitIndex_t* hitsl_g1;
44
45
    // 	fvec *x_minusV_g1; fvec *x_plusV_g1; fvec *y_minusV_g1; fvec *y_plusV_g1;
    // output
46
47
    L1HitIndex_t* Duplets_start;
    L1HitIndex_t* Duplets_hits;
48
49

    Tindex* n_g2;
50
    L1HitIndex_t* i1_g2;
51
52
53
    // 	L1TrackPar *T_g2;
    // 	L1FieldRegion *fld_g2;
    // 	fvec *u_front_g2; fvec *u_back_g2;
54
55
    // 	L1HitIndex_t *hitsl_g2;
    L1HitIndex_t* hitsm_g2;
56
57
58
59
60
61
62
63
64
65
66
67
    // 	fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2;

  public:
    void operator()(const blocked_range<size_t>& r) const;

    ParalleledDup(
      // input
      int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_,
      vector<unsigned char>& vSFlag_, vector<unsigned char>& vSFlagB_, std::vector<L1HitPoint>& vStsHits_,
      double Pick_r_, double Pick_m_, double MaxInvMom_, fvec targX_, fvec targY_, fvec targZ_, L1FieldValue& targB_,
      L1XYMeasurementInfo& TargetXYInfo_,

68
      Tindex* n_g1_, unsigned* portionStopIndex_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, L1HitIndex_t* hitsl_g1_,
69
      // 								fvec *x_minusV_g1_, fvec *x_plusV_g1_, fvec *y_minusV_g1_, fvec *y_plusV_g1_,
Administrator's avatar
Administrator committed
70
      // output
71
      L1HitIndex_t* Duplets_start_, L1HitIndex_t* Duplets_hits_,
72

73
      Tindex* n_g2_, L1HitIndex_t* i1_g2_,
74
75
76
      // 								L1TrackPar *T_g2_,
      // 								L1FieldRegion *fld_g2_,
      // 								fvec *u_front_g2_, fvec *u_back_g2_,
77
78
      // 								L1HitIndex_t *hitsl_g2_,
      L1HitIndex_t* hitsm_g2_
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
      // 								fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_
      )
      : isec(isec_)
      , vStations(vStations_)
      , NStations(NStations_)
      , StsHitsStartIndex(StsHitsStartIndex_)
      , StsHitsStopIndex(StsHitsStopIndex_)
      , vSFlag(vSFlag_)
      , vSFlagB(vSFlagB_)
      , vStsHits(vStsHits_)
      , Pick_r(Pick_r_)
      , Pick_m(Pick_m_)
      , MaxInvMom(MaxInvMom_)
      , targX(targX_)
      , targY(targY_)
      , targZ(targZ_)
      , targB(targB_)
      , TargetXYInfo(TargetXYInfo_)
      ,

      n_g1(n_g1_)
      , portionStopIndex(portionStopIndex_)
      , T_g1(T_g1_)
      , fld_g1(fld_g1_)
      , hitsl_g1(hitsl_g1_)
      ,
      // 											x_minusV_g1(x_minusV_g1_), x_plusV_g1(x_plusV_g1_), y_minusV_g1(y_minusV_g1_), y_plusV_g1(y_plusV_g1_),
      // output
      Duplets_start(Duplets_start_)
      , Duplets_hits(Duplets_hits_)
      ,

      n_g2(n_g2_)
      , i1_g2(i1_g2_)
      ,
      // 											T_g2(T_g2_),
      // 											fld_g2(fld_g2_),
      // 											u_front_g2(u_front_g2_), u_back_g2(u_back_g2_),
      // 											hitsl_g2(hitsl_g2_),
      hitsm_g2(hitsm_g2_)
      // 											x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_)
      {};

    ~ParalleledDup() {};
  };

  void ParalleledDup::operator()(const blocked_range<size_t>& r) const
  {

    for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) {
      // 		cout<< " ParalleledDup::operator(). Station: " << istal << endl;
      DupletsStaPort(  // input
        isec, istal, vStsHits, targX, targY, targZ, targB, TargetXYInfo,

        n_g1, portionStopIndex, T_g1, fld_g1, hitsl_g1,
        // 											x_minusV_g1, x_plusV_g1, y_minusV_g1, y_plusV_g1,
        // output
        Duplets_start, Duplets_hits,

        n_g2, i1_g2,
        // 											T_g2,
        // 											fld_g2,
        // 											u_front_g2, u_back_g2,
        // 											hitsl_g2,
        hitsm_g2
        // 											x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2
      );
    }
Administrator's avatar
Administrator committed
147
  }
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164


  class ParalleledTrip {
    // input
    int isec;
    L1Station* vStations;
    int NStations;
    Tindex* StsHitsStartIndex;
    Tindex* StsHitsStopIndex;
    std::vector<L1HitPoint>& svStsHits;
    double Pick_r;
    double TRACK_CHI2_CUT;
    double MaxInvMom;

    Tindex* n_g1;
    L1TrackPar* T_g1;
    L1FieldRegion* fld_g1;
165
    L1HitIndex_t* hitsl_g1;
166
167
168

    Tindex* n_g2;
    unsigned* portionStopIndex;
169
    L1HitIndex_t* i1_g2;
170
    /*	L1FieldRegion *fld_g2;
171
172
	fvec *u_front_g2; fvec *u_back_g2;
	L1TrackPar *T_g2;*/
173
174
    // 	L1HitIndex_t *hitsl_g2;
    L1HitIndex_t* hitsm_g2;
175
176
    // 	fvec *x_minusV_g2; fvec *x_plusV_g2; fvec *y_minusV_g2; fvec *y_plusV_g2;
    // output
177
178
    L1HitIndex_t* Duplets_start;
    L1HitIndex_t* Duplets_hits;
179
180
181
182
183
184
185
186
187
188
189
    std::vector<L1Triplet>* vTriplets_part;
    unsigned* TripStartIndexH;
    unsigned* TripStopIndexH;

  public:
    void operator()(const blocked_range<size_t>& r) const;

    ParalleledTrip(
      // input
      int isec_, L1Station* vStations_, int NStations_, Tindex* StsHitsStartIndex_, Tindex* StsHitsStopIndex_,
      std::vector<L1HitPoint>& vStsHits_, double Pick_r_, double TRACK_CHI2_CUT_, double MaxInvMom_,
190

191
      Tindex* n_g1_, L1TrackPar* T_g1_, L1FieldRegion* fld_g1_, L1HitIndex_t* hitsl_g1_,
192

193
      Tindex* n_g2_, unsigned* portionStopIndex_, L1HitIndex_t* i1_g2_,
194
      /*L1FieldRegion *fld_g2_,
195
196
								fvec *u_front_g2_, fvec *u_back_g2_,
								L1TrackPar *T_g2_,*/
197
198
      // 								L1HitIndex_t *hitsl_g2_,
      L1HitIndex_t* hitsm_g2_,
199
200
      // 								fvec *x_minusV_g2_, fvec *x_plusV_g2_, fvec *y_minusV_g2_, fvec *y_plusV_g2_,
      // output
Sergei Zharko's avatar
Sergei Zharko committed
201
202
      L1HitIndex_t* Duplets_start_, L1HitIndex_t* Duplets_hits_, std::vector<L1Triplet>* vTriplets_part_,
      unsigned* TripStartIndexH_,
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
      unsigned* TripStopIndexH_)
      :  // input
      isec(isec_)
      , vStations(vStations_)
      , NStations(NStations_)
      , StsHitsStartIndex(StsHitsStartIndex_)
      , StsHitsStopIndex(StsHitsStopIndex_)
      , svStsHits(vStsHits_)
      , Pick_r(Pick_r_)
      , TRACK_CHI2_CUT(TRACK_CHI2_CUT_)
      , MaxInvMom(MaxInvMom_)
      ,

      n_g1(n_g1_)
      , T_g1(T_g1_)
      , fld_g1(fld_g1_)
      , hitsl_g1(hitsl_g1_)
      ,

      n_g2(n_g2_)
      , portionStopIndex(portionStopIndex_)
      , i1_g2(i1_g2_)
      ,
      /*											fld_g2(fld_g2_),
227
228
											u_front_g2(u_front_g2_), u_back_g2(u_back_g2_),
											T_g2(T_g2_),*/
229
230
231
232
233
234
235
236
237
238
      // 											hitsl_g2(hitsl_g2_),
      hitsm_g2(hitsm_g2_)
      ,
      // 											x_minusV_g2(x_minusV_g2_), x_plusV_g2(x_plusV_g2_), y_minusV_g2(y_minusV_g2_), y_plusV_g2(y_plusV_g2_),
      // output
      Duplets_start(Duplets_start_)
      , Duplets_hits(Duplets_hits_)
      , vTriplets_part(vTriplets_part_)
      , TripStartIndexH(TripStartIndexH_)
      , TripStopIndexH(TripStopIndexH_) {};
Administrator's avatar
Administrator committed
239

240
241
    ~ParalleledTrip() {};
  };
242

243
244
  void ParalleledTrip::operator()(const blocked_range<size_t>& r) const
  {
Administrator's avatar
Administrator committed
245

246
247
248
249
    for (Tindex istal = r.begin(); istal < (Tindex) r.end(); ++istal) {
      // 		cout<< " ParalleledTrip::operator(). Station: " << istal << endl;
      TripletsStaPort(  // input
        isec, istal, svStsHits, n_g1, T_g1, fld_g1, hitsl_g1,
250

251
252
        n_g2, portionStopIndex, i1_g2,
        /*											fld_g2,
253
254
											u_front_g2, u_back_g2,
											T_g2,*/
255
256
257
258
259
260
        // 											hitsl_g2,
        hitsm_g2,
        // 											x_minusV_g2, x_plusV_g2, y_minusV_g2, y_plusV_g2,
        // output
        Duplets_start, Duplets_hits, vTriplets_part, TripStartIndexH, TripStopIndexH);
    }
Administrator's avatar
Administrator committed
261
  }
262
263
}  //namespace tbb

Administrator's avatar
Administrator committed
264
#endif  // TBB
265

266
#endif