MCBooster  1.0.1
Tool to generate MC phase space samples in parallel.
Evaluate.h
Go to the documentation of this file.
1 /*
2  * Evaluate.h
3  *
4  * Copyright 2016 Antonio Augusto Alves Junior
5  *
6  * Created on : Feb 25, 2016
7  * Author: Antonio Augusto Alves Junior
8  */
9 
10 /*
11  * This file is part of MCBooster.
12  *
13  * MCBooster is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation, either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * MCBooster is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with MCBooster. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
31 #ifndef EVALUATE_H_
32 #define EVALUATE_H_
33 
34 
35 #include <mcbooster/Config.h>
36 #include <mcbooster/Vector3R.h>
37 #include <mcbooster/Vector4R.h>
38 #include <mcbooster/GContainers.h>
39 #include <mcbooster/GTypes.h>
41 
42 namespace MCBooster
43 {
49 template<typename CUSTOMFUNC, typename RESULT>
50 void Evaluate(const CUSTOMFUNC funcObj, ParticlesSet_d &pset,
52 {
53 
54  if (pset.size() > 10 || pset.size() < 2)
55  {
56  cout
57  << "Can not Calculate(Eval) more than a nine-particle invariant mass."
58  << endl;
59  return;
60  }
61 
62  mc_device_vector<RESULT> dev_out(eval.begin(), eval.end());
63 
64  if (pset.size() == 2)
65  {
66  mc_device_vector<Vector4R> *dev_v0 = pset[0];
67  mc_device_vector<Vector4R> *dev_v1 = pset[1];
68 
69  thrust::transform(
70  thrust::make_zip_iterator(
71  thrust::make_tuple(dev_v0->begin(), dev_v1->begin())),
72  thrust::make_zip_iterator(
73  thrust::make_tuple(dev_v0->end(), dev_v1->end())),
74  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
75 
76  }
77 
78  if (pset.size() == 3)
79  {
80 
81  mc_device_vector<Vector4R> *dev_v0 = pset[0];
82  mc_device_vector<Vector4R> *dev_v1 = pset[1];
83  mc_device_vector<Vector4R> *dev_v2 = pset[2];
84 
85  thrust::transform(
86  thrust::make_zip_iterator(
87  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
88  dev_v2->begin())),
89  thrust::make_zip_iterator(
90  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
91  dev_v2->end())), dev_out.begin(),
93 
94  }
95 
96  if (pset.size() == 4)
97  {
98 
99  mc_device_vector<Vector4R> *dev_v0 = pset[0];
100  mc_device_vector<Vector4R> *dev_v1 = pset[1];
101  mc_device_vector<Vector4R> *dev_v2 = pset[2];
102  mc_device_vector<Vector4R> *dev_v3 = pset[3];
103 
104  thrust::transform(
105  thrust::make_zip_iterator(
106  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
107  dev_v2->begin(), dev_v3->begin())),
108  thrust::make_zip_iterator(
109  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
110  dev_v2->end(), dev_v3->end())), dev_out.begin(),
112 
113  }
114 
115  if (pset.size() == 5)
116  {
117 
118  mc_device_vector<Vector4R> *dev_v0 = pset[0];
119  mc_device_vector<Vector4R> *dev_v1 = pset[1];
120  mc_device_vector<Vector4R> *dev_v2 = pset[2];
121  mc_device_vector<Vector4R> *dev_v3 = pset[3];
122  mc_device_vector<Vector4R> *dev_v4 = pset[4];
123 
124  thrust::transform(
125  thrust::make_zip_iterator(
126  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
127  dev_v2->begin(), dev_v3->begin(),
128  dev_v4->begin())),
129  thrust::make_zip_iterator(
130  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
131  dev_v2->end(), dev_v3->end(), dev_v4->end())),
132  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
133 
134  }
135 
136  if (pset.size() == 6)
137  {
138 
139  mc_device_vector<Vector4R> *dev_v0 = pset[0];
140  mc_device_vector<Vector4R> *dev_v1 = pset[1];
141  mc_device_vector<Vector4R> *dev_v2 = pset[2];
142  mc_device_vector<Vector4R> *dev_v3 = pset[3];
143  mc_device_vector<Vector4R> *dev_v4 = pset[4];
144  mc_device_vector<Vector4R> *dev_v5 = pset[5];
145 
146  thrust::transform(
147  thrust::make_zip_iterator(
148  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
149  dev_v2->begin(), dev_v3->begin(),
150  dev_v4->begin(), dev_v5->begin())),
151  thrust::make_zip_iterator(
152  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
153  dev_v2->end(), dev_v3->end(), dev_v4->end(),
154  dev_v5->end())), dev_out.begin(),
156 
157  }
158 
159  if (pset.size() == 7)
160  {
161 
162  mc_device_vector<Vector4R> *dev_v0 = pset[0];
163  mc_device_vector<Vector4R> *dev_v1 = pset[1];
164  mc_device_vector<Vector4R> *dev_v2 = pset[2];
165  mc_device_vector<Vector4R> *dev_v3 = pset[3];
166  mc_device_vector<Vector4R> *dev_v4 = pset[4];
167  mc_device_vector<Vector4R> *dev_v5 = pset[5];
168  mc_device_vector<Vector4R> *dev_v6 = pset[6];
169 
170  thrust::transform(
171  thrust::make_zip_iterator(
172  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
173  dev_v2->begin(), dev_v3->begin(),
174  dev_v4->begin(), dev_v5->begin(),
175  dev_v6->begin())),
176  thrust::make_zip_iterator(
177  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
178  dev_v2->end(), dev_v3->end(), dev_v4->end(),
179  dev_v5->end(), dev_v6->end())), dev_out.begin(),
181 
182  }
183 
184  if (pset.size() == 8)
185  {
186 
187  mc_device_vector<Vector4R> *dev_v0 = pset[0];
188  mc_device_vector<Vector4R> *dev_v1 = pset[1];
189  mc_device_vector<Vector4R> *dev_v2 = pset[2];
190  mc_device_vector<Vector4R> *dev_v3 = pset[3];
191  mc_device_vector<Vector4R> *dev_v4 = pset[4];
192  mc_device_vector<Vector4R> *dev_v5 = pset[5];
193  mc_device_vector<Vector4R> *dev_v6 = pset[6];
194  mc_device_vector<Vector4R> *dev_v7 = pset[7];
195 
196  thrust::transform(
197  thrust::make_zip_iterator(
198  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
199  dev_v2->begin(), dev_v3->begin(),
200  dev_v4->begin(), dev_v5->begin(),
201  dev_v6->begin(), dev_v7->begin())),
202  thrust::make_zip_iterator(
203  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
204  dev_v2->end(), dev_v3->end(), dev_v4->end(),
205  dev_v5->end(), dev_v6->end(), dev_v7->end())),
206  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
207 
208  }
209 
210  if (pset.size() == 9)
211  {
212 
213  mc_device_vector<Vector4R> *dev_v0 = pset[0];
214  mc_device_vector<Vector4R> *dev_v1 = pset[1];
215  mc_device_vector<Vector4R> *dev_v2 = pset[2];
216  mc_device_vector<Vector4R> *dev_v3 = pset[3];
217  mc_device_vector<Vector4R> *dev_v4 = pset[4];
218  mc_device_vector<Vector4R> *dev_v5 = pset[5];
219  mc_device_vector<Vector4R> *dev_v6 = pset[6];
220  mc_device_vector<Vector4R> *dev_v7 = pset[7];
221  mc_device_vector<Vector4R> *dev_v8 = pset[8];
222 
223  thrust::transform(
224  thrust::make_zip_iterator(
225  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
226  dev_v2->begin(), dev_v3->begin(),
227  dev_v4->begin(), dev_v5->begin(),
228  dev_v6->begin(), dev_v7->begin(),
229  dev_v8->begin())),
230  thrust::make_zip_iterator(
231  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
232  dev_v2->end(), dev_v3->end(), dev_v4->end(),
233  dev_v5->end(), dev_v6->end(), dev_v7->end(),
234  dev_v8->end())), dev_out.begin(),
236 
237  }
238 
239  if (pset.size() == 10)
240  {
241 
242  mc_device_vector<Vector4R> *dev_v0 = pset[0];
243  mc_device_vector<Vector4R> *dev_v1 = pset[1];
244  mc_device_vector<Vector4R> *dev_v2 = pset[2];
245  mc_device_vector<Vector4R> *dev_v3 = pset[3];
246  mc_device_vector<Vector4R> *dev_v4 = pset[4];
247  mc_device_vector<Vector4R> *dev_v5 = pset[5];
248  mc_device_vector<Vector4R> *dev_v6 = pset[6];
249  mc_device_vector<Vector4R> *dev_v7 = pset[7];
250  mc_device_vector<Vector4R> *dev_v8 = pset[8];
251  mc_device_vector<Vector4R> *dev_v9 = pset[9];
252 
253  thrust::transform(
254  thrust::make_zip_iterator(
255  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
256  dev_v2->begin(), dev_v3->begin(),
257  dev_v4->begin(), dev_v5->begin(),
258  dev_v6->begin(), dev_v7->begin(),
259  dev_v8->begin(), dev_v9->begin())),
260  thrust::make_zip_iterator(
261  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
262  dev_v2->end(), dev_v3->end(), dev_v4->end(),
263  dev_v5->end(), dev_v6->end(), dev_v7->end(),
264  dev_v8->end(), dev_v9->end())), dev_out.begin(),
266 
267  }
268 
269  thrust::copy(dev_out.begin(), dev_out.end(), eval.begin());
270 
271  return;
272 }
273 
279 template<typename CUSTOMFUNC, typename RESULT>
280 void Evaluate(const CUSTOMFUNC funcObj, ParticlesSet_d &pset,
281  mc_device_vector<RESULT> dev_out)
282 {
283 
284  if (pset.size() > 10 || pset.size() < 2)
285  {
286  cout
287  << "Can not Calculate(Eval) more than a nine-particle invariant mass."
288  << endl;
289  return;
290  }
291 
292  if (pset.size() == 2)
293  {
294  mc_device_vector<Vector4R> *dev_v0 = pset[0];
295  mc_device_vector<Vector4R> *dev_v1 = pset[1];
296 
297  thrust::transform(
298  thrust::make_zip_iterator(
299  thrust::make_tuple(dev_v0->begin(), dev_v1->begin())),
300  thrust::make_zip_iterator(
301  thrust::make_tuple(dev_v0->end(), dev_v1->end())),
302  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
303 
304  }
305 
306  if (pset.size() == 3)
307  {
308 
309  mc_device_vector<Vector4R> *dev_v0 = pset[0];
310  mc_device_vector<Vector4R> *dev_v1 = pset[1];
311  mc_device_vector<Vector4R> *dev_v2 = pset[2];
312 
313  thrust::transform(
314  thrust::make_zip_iterator(
315  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
316  dev_v2->begin())),
317  thrust::make_zip_iterator(
318  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
319  dev_v2->end())), dev_out.begin(),
321 
322  }
323 
324  if (pset.size() == 4)
325  {
326 
327  mc_device_vector<Vector4R> *dev_v0 = pset[0];
328  mc_device_vector<Vector4R> *dev_v1 = pset[1];
329  mc_device_vector<Vector4R> *dev_v2 = pset[2];
330  mc_device_vector<Vector4R> *dev_v3 = pset[3];
331 
332  thrust::transform(
333  thrust::make_zip_iterator(
334  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
335  dev_v2->begin(), dev_v3->begin())),
336  thrust::make_zip_iterator(
337  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
338  dev_v2->end(), dev_v3->end())), dev_out.begin(),
340 
341  }
342 
343  if (pset.size() == 5)
344  {
345 
346  mc_device_vector<Vector4R> *dev_v0 = pset[0];
347  mc_device_vector<Vector4R> *dev_v1 = pset[1];
348  mc_device_vector<Vector4R> *dev_v2 = pset[2];
349  mc_device_vector<Vector4R> *dev_v3 = pset[3];
350  mc_device_vector<Vector4R> *dev_v4 = pset[4];
351 
352  thrust::transform(
353  thrust::make_zip_iterator(
354  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
355  dev_v2->begin(), dev_v3->begin(),
356  dev_v4->begin())),
357  thrust::make_zip_iterator(
358  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
359  dev_v2->end(), dev_v3->end(), dev_v4->end())),
360  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
361 
362  }
363 
364  if (pset.size() == 6)
365  {
366 
367  mc_device_vector<Vector4R> *dev_v0 = pset[0];
368  mc_device_vector<Vector4R> *dev_v1 = pset[1];
369  mc_device_vector<Vector4R> *dev_v2 = pset[2];
370  mc_device_vector<Vector4R> *dev_v3 = pset[3];
371  mc_device_vector<Vector4R> *dev_v4 = pset[4];
372  mc_device_vector<Vector4R> *dev_v5 = pset[5];
373 
374  thrust::transform(
375  thrust::make_zip_iterator(
376  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
377  dev_v2->begin(), dev_v3->begin(),
378  dev_v4->begin(), dev_v5->begin())),
379  thrust::make_zip_iterator(
380  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
381  dev_v2->end(), dev_v3->end(), dev_v4->end(),
382  dev_v5->end())), dev_out.begin(),
384 
385  }
386 
387  if (pset.size() == 7)
388  {
389 
390  mc_device_vector<Vector4R> *dev_v0 = pset[0];
391  mc_device_vector<Vector4R> *dev_v1 = pset[1];
392  mc_device_vector<Vector4R> *dev_v2 = pset[2];
393  mc_device_vector<Vector4R> *dev_v3 = pset[3];
394  mc_device_vector<Vector4R> *dev_v4 = pset[4];
395  mc_device_vector<Vector4R> *dev_v5 = pset[5];
396  mc_device_vector<Vector4R> *dev_v6 = pset[6];
397 
398  thrust::transform(
399  thrust::make_zip_iterator(
400  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
401  dev_v2->begin(), dev_v3->begin(),
402  dev_v4->begin(), dev_v5->begin(),
403  dev_v6->begin())),
404  thrust::make_zip_iterator(
405  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
406  dev_v2->end(), dev_v3->end(), dev_v4->end(),
407  dev_v5->end(), dev_v6->end())), dev_out.begin(),
409 
410  }
411 
412  if (pset.size() == 8)
413  {
414 
415  mc_device_vector<Vector4R> *dev_v0 = pset[0];
416  mc_device_vector<Vector4R> *dev_v1 = pset[1];
417  mc_device_vector<Vector4R> *dev_v2 = pset[2];
418  mc_device_vector<Vector4R> *dev_v3 = pset[3];
419  mc_device_vector<Vector4R> *dev_v4 = pset[4];
420  mc_device_vector<Vector4R> *dev_v5 = pset[5];
421  mc_device_vector<Vector4R> *dev_v6 = pset[6];
422  mc_device_vector<Vector4R> *dev_v7 = pset[7];
423 
424  thrust::transform(
425  thrust::make_zip_iterator(
426  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
427  dev_v2->begin(), dev_v3->begin(),
428  dev_v4->begin(), dev_v5->begin(),
429  dev_v6->begin(), dev_v7->begin())),
430  thrust::make_zip_iterator(
431  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
432  dev_v2->end(), dev_v3->end(), dev_v4->end(),
433  dev_v5->end(), dev_v6->end(), dev_v7->end())),
434  dev_out.begin(), Calculate<CUSTOMFUNC, RESULT>(funcObj));
435 
436  }
437 
438  if (pset.size() == 9)
439  {
440 
441  mc_device_vector<Vector4R> *dev_v0 = pset[0];
442  mc_device_vector<Vector4R> *dev_v1 = pset[1];
443  mc_device_vector<Vector4R> *dev_v2 = pset[2];
444  mc_device_vector<Vector4R> *dev_v3 = pset[3];
445  mc_device_vector<Vector4R> *dev_v4 = pset[4];
446  mc_device_vector<Vector4R> *dev_v5 = pset[5];
447  mc_device_vector<Vector4R> *dev_v6 = pset[6];
448  mc_device_vector<Vector4R> *dev_v7 = pset[7];
449  mc_device_vector<Vector4R> *dev_v8 = pset[8];
450 
451  thrust::transform(
452  thrust::make_zip_iterator(
453  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
454  dev_v2->begin(), dev_v3->begin(),
455  dev_v4->begin(), dev_v5->begin(),
456  dev_v6->begin(), dev_v7->begin(),
457  dev_v8->begin())),
458  thrust::make_zip_iterator(
459  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
460  dev_v2->end(), dev_v3->end(), dev_v4->end(),
461  dev_v5->end(), dev_v6->end(), dev_v7->end(),
462  dev_v8->end())), dev_out.begin(),
464 
465  }
466 
467  if (pset.size() == 10)
468  {
469 
470  mc_device_vector<Vector4R> *dev_v0 = pset[0];
471  mc_device_vector<Vector4R> *dev_v1 = pset[1];
472  mc_device_vector<Vector4R> *dev_v2 = pset[2];
473  mc_device_vector<Vector4R> *dev_v3 = pset[3];
474  mc_device_vector<Vector4R> *dev_v4 = pset[4];
475  mc_device_vector<Vector4R> *dev_v5 = pset[5];
476  mc_device_vector<Vector4R> *dev_v6 = pset[6];
477  mc_device_vector<Vector4R> *dev_v7 = pset[7];
478  mc_device_vector<Vector4R> *dev_v8 = pset[8];
479  mc_device_vector<Vector4R> *dev_v9 = pset[9];
480 
481  thrust::transform(
482  thrust::make_zip_iterator(
483  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
484  dev_v2->begin(), dev_v3->begin(),
485  dev_v4->begin(), dev_v5->begin(),
486  dev_v6->begin(), dev_v7->begin(),
487  dev_v8->begin(), dev_v9->begin())),
488  thrust::make_zip_iterator(
489  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
490  dev_v2->end(), dev_v3->end(), dev_v4->end(),
491  dev_v5->end(), dev_v6->end(), dev_v7->end(),
492  dev_v8->end(), dev_v9->end())), dev_out.begin(),
494 
495  }
496 
497  return;
498 }
499 
505 template<typename CUSTOMFUNC>
506 void Evaluate(const CUSTOMFUNC funcObj, ParticlesSet_d &pset)
507 {
508 
509  if (pset.size() > 10 || pset.size() < 2)
510  {
511  cout
512  << "Can not Calculate(Eval) more than a nine-particle invariant mass."
513  << endl;
514  return;
515  }
516 
517  if (pset.size() == 2)
518  {
519 
520  mc_device_vector<Vector4R> *dev_v0 = pset[0];
521  mc_device_vector<Vector4R> *dev_v1 = pset[1];
522 
523  thrust::for_each(
524  thrust::make_zip_iterator(
525  thrust::make_tuple(dev_v0->begin(), dev_v1->begin())),
526  thrust::make_zip_iterator(
527  thrust::make_tuple(dev_v0->end(), dev_v1->end())),
528  Calculate2<CUSTOMFUNC>(funcObj));
529 
530  }
531 
532  if (pset.size() == 3)
533  {
534 
535  mc_device_vector<Vector4R> *dev_v0 = pset[0];
536  mc_device_vector<Vector4R> *dev_v1 = pset[1];
537  mc_device_vector<Vector4R> *dev_v2 = pset[2];
538 
539  thrust::for_each(
540  thrust::make_zip_iterator(
541  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
542  dev_v2->begin())),
543  thrust::make_zip_iterator(
544  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
545  dev_v2->end())),
546  Calculate2<CUSTOMFUNC>(funcObj));
547 
548  }
549 
550  if (pset.size() == 4)
551  {
552 
553  mc_device_vector<Vector4R> *dev_v0 = pset[0];
554  mc_device_vector<Vector4R> *dev_v1 = pset[1];
555  mc_device_vector<Vector4R> *dev_v2 = pset[2];
556  mc_device_vector<Vector4R> *dev_v3 = pset[3];
557 
558  thrust::for_each(
559  thrust::make_zip_iterator(
560  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
561  dev_v2->begin(), dev_v3->begin())),
562  thrust::make_zip_iterator(
563  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
564  dev_v2->end(), dev_v3->end())),
565  Calculate2<CUSTOMFUNC>(funcObj));
566 
567  }
568 
569  if (pset.size() == 5)
570  {
571 
572  mc_device_vector<Vector4R> *dev_v0 = pset[0];
573  mc_device_vector<Vector4R> *dev_v1 = pset[1];
574  mc_device_vector<Vector4R> *dev_v2 = pset[2];
575  mc_device_vector<Vector4R> *dev_v3 = pset[3];
576  mc_device_vector<Vector4R> *dev_v4 = pset[4];
577 
578  thrust::for_each(
579  thrust::make_zip_iterator(
580  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
581  dev_v2->begin(), dev_v3->begin(),
582  dev_v4->begin())),
583  thrust::make_zip_iterator(
584  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
585  dev_v2->end(), dev_v3->end(), dev_v4->end())),
586  Calculate2<CUSTOMFUNC>(funcObj));
587 
588  }
589 
590  if (pset.size() == 6)
591  {
592 
593  mc_device_vector<Vector4R> *dev_v0 = pset[0];
594  mc_device_vector<Vector4R> *dev_v1 = pset[1];
595  mc_device_vector<Vector4R> *dev_v2 = pset[2];
596  mc_device_vector<Vector4R> *dev_v3 = pset[3];
597  mc_device_vector<Vector4R> *dev_v4 = pset[4];
598  mc_device_vector<Vector4R> *dev_v5 = pset[5];
599 
600  thrust::for_each(
601  thrust::make_zip_iterator(
602  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
603  dev_v2->begin(), dev_v3->begin(),
604  dev_v4->begin(), dev_v5->begin())),
605  thrust::make_zip_iterator(
606  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
607  dev_v2->end(), dev_v3->end(), dev_v4->end(),
608  dev_v5->end())),
609  Calculate2<CUSTOMFUNC>(funcObj));
610 
611  }
612 
613  if (pset.size() == 7)
614  {
615 
616  mc_device_vector<Vector4R> *dev_v0 = pset[0];
617  mc_device_vector<Vector4R> *dev_v1 = pset[1];
618  mc_device_vector<Vector4R> *dev_v2 = pset[2];
619  mc_device_vector<Vector4R> *dev_v3 = pset[3];
620  mc_device_vector<Vector4R> *dev_v4 = pset[4];
621  mc_device_vector<Vector4R> *dev_v5 = pset[5];
622  mc_device_vector<Vector4R> *dev_v6 = pset[6];
623 
624  thrust::for_each(
625  thrust::make_zip_iterator(
626  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
627  dev_v2->begin(), dev_v3->begin(),
628  dev_v4->begin(), dev_v5->begin(),
629  dev_v6->begin())),
630  thrust::make_zip_iterator(
631  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
632  dev_v2->end(), dev_v3->end(), dev_v4->end(),
633  dev_v5->end(), dev_v6->end())),
634  Calculate2<CUSTOMFUNC>(funcObj));
635 
636  }
637 
638  if (pset.size() == 8)
639  {
640 
641  mc_device_vector<Vector4R> *dev_v0 = pset[0];
642  mc_device_vector<Vector4R> *dev_v1 = pset[1];
643  mc_device_vector<Vector4R> *dev_v2 = pset[2];
644  mc_device_vector<Vector4R> *dev_v3 = pset[3];
645  mc_device_vector<Vector4R> *dev_v4 = pset[4];
646  mc_device_vector<Vector4R> *dev_v5 = pset[5];
647  mc_device_vector<Vector4R> *dev_v6 = pset[6];
648  mc_device_vector<Vector4R> *dev_v7 = pset[7];
649 
650  thrust::for_each(
651  thrust::make_zip_iterator(
652  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
653  dev_v2->begin(), dev_v3->begin(),
654  dev_v4->begin(), dev_v5->begin(),
655  dev_v6->begin(), dev_v7->begin())),
656  thrust::make_zip_iterator(
657  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
658  dev_v2->end(), dev_v3->end(), dev_v4->end(),
659  dev_v5->end(), dev_v6->end(), dev_v7->end())),
660  Calculate2<CUSTOMFUNC>(funcObj));
661 
662  }
663 
664  if (pset.size() == 9)
665  {
666 
667  mc_device_vector<Vector4R> *dev_v0 = pset[0];
668  mc_device_vector<Vector4R> *dev_v1 = pset[1];
669  mc_device_vector<Vector4R> *dev_v2 = pset[2];
670  mc_device_vector<Vector4R> *dev_v3 = pset[3];
671  mc_device_vector<Vector4R> *dev_v4 = pset[4];
672  mc_device_vector<Vector4R> *dev_v5 = pset[5];
673  mc_device_vector<Vector4R> *dev_v6 = pset[6];
674  mc_device_vector<Vector4R> *dev_v7 = pset[7];
675  mc_device_vector<Vector4R> *dev_v8 = pset[8];
676 
677  thrust::for_each(
678  thrust::make_zip_iterator(
679  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
680  dev_v2->begin(), dev_v3->begin(),
681  dev_v4->begin(), dev_v5->begin(),
682  dev_v6->begin(), dev_v7->begin(),
683  dev_v8->begin())),
684  thrust::make_zip_iterator(
685  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
686  dev_v2->end(), dev_v3->end(), dev_v4->end(),
687  dev_v5->end(), dev_v6->end(), dev_v7->end(),
688  dev_v8->end())),
689  Calculate2<CUSTOMFUNC>(funcObj));
690 
691  }
692 
693  if (pset.size() == 10)
694  {
695 
696  mc_device_vector<Vector4R> *dev_v0 = pset[0];
697  mc_device_vector<Vector4R> *dev_v1 = pset[1];
698  mc_device_vector<Vector4R> *dev_v2 = pset[2];
699  mc_device_vector<Vector4R> *dev_v3 = pset[3];
700  mc_device_vector<Vector4R> *dev_v4 = pset[4];
701  mc_device_vector<Vector4R> *dev_v5 = pset[5];
702  mc_device_vector<Vector4R> *dev_v6 = pset[6];
703  mc_device_vector<Vector4R> *dev_v7 = pset[7];
704  mc_device_vector<Vector4R> *dev_v8 = pset[8];
705  mc_device_vector<Vector4R> *dev_v9 = pset[9];
706 
707  thrust::for_each(
708  thrust::make_zip_iterator(
709  thrust::make_tuple(dev_v0->begin(), dev_v1->begin(),
710  dev_v2->begin(), dev_v3->begin(),
711  dev_v4->begin(), dev_v5->begin(),
712  dev_v6->begin(), dev_v7->begin(),
713  dev_v8->begin(), dev_v9->begin())),
714  thrust::make_zip_iterator(
715  thrust::make_tuple(dev_v0->end(), dev_v1->end(),
716  dev_v2->end(), dev_v3->end(), dev_v4->end(),
717  dev_v5->end(), dev_v6->end(), dev_v7->end(),
718  dev_v8->end(), dev_v9->end())),
719  Calculate2<CUSTOMFUNC>(funcObj));
720 
721  }
722 
723  return;
724 }
725 
726 }
727 
728 #endif /* EVALUATE_H_ */
thrust::host_vector< T > mc_host_vector
Generic template typedef for thrust::host_vector.
Definition: GContainers.h:68
Typedef for useful container classes used in MCBooster.
void Evaluate(const CUSTOMFUNC funcObj, ParticlesSet_d &pset, mc_host_vector< RESULT > &eval)
Template functor for evaluate an arbitrary function object.
Definition: Evaluate.h:50
vector< Particles_d * > ParticlesSet_d
Typedef for a Vector4R device vector.
Definition: GContainers.h:116
thrust::host_vector< T > mc_device_vector
Generic template typedef for thrust::host_vector.
Definition: GContainers.h:60