Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:34:45

0001 
0002 #include "RecoHI/HiJetAlgos/interface/UEParameters.h"
0003 
0004 UEParameters::UEParameters(const std::vector<float> *v, int nn, int neta) : v_(v), nn_(nn), neta_(neta) {
0005   parameters_ =
0006       new boost::const_multi_array_ref<float, 4>(&(*v)[0], boost::extents[neta][nreduced_particle_flow_id][nn][2]);
0007 }
0008 
0009 void UEParameters::get_fourier(double &re, double &im, size_t n, size_t eta, int type) const {
0010   re = 0;
0011   im = 0;
0012 
0013   if (type < 0) {
0014     for (size_t i = 0; i < nreduced_particle_flow_id; i++) {
0015       re += (*parameters_)[eta][i][n][0];
0016       im += (*parameters_)[eta][i][n][1];
0017     }
0018   } else {
0019     re = (*parameters_)[eta][type][n][0];
0020     im = (*parameters_)[eta][type][n][1];
0021   }
0022 }
0023 
0024 double UEParameters::get_sum_pt(int eta, int type) const {
0025   double re;
0026   double im;
0027 
0028   get_fourier(re, im, 0, eta, type);
0029 
0030   // There is no imaginary part
0031   return re;
0032 }
0033 
0034 double UEParameters::get_vn(int n, int eta, int type) const {
0035   if (n < 0) {
0036     return NAN;
0037   } else if (n == 0) {
0038     return 1;
0039   }
0040 
0041   double re;
0042   double im;
0043 
0044   get_fourier(re, im, n, eta, type);
0045 
0046   return sqrt(re * re + im * im) / get_sum_pt(eta, type);
0047 }
0048 
0049 double UEParameters::get_psin(int n, int eta, int type) const {
0050   if (n <= 0) {
0051     return 0;
0052   }
0053 
0054   double re;
0055   double im;
0056 
0057   get_fourier(re, im, n, eta, type);
0058 
0059   return atan2(im, re) / n;
0060 }