ATLAS Offline Software
Event/FourMomUtils/src/FoxWolfram.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // AthAnalysisBase/ManaCore doesn't currently include the Trigger Service
8 #ifndef XAOD_ANALYSIS
9 
10 
11 #include <cmath>
12 
13 namespace FourMomUtils {
14 
15 using std::abs;
16 using std::exp;
17 using std::cos;
18 
19 bool
20 foxWolfram( const I4MomIter_t& iBeg, const I4MomIter_t& iEnd,
21  std::vector<double>& H, unsigned int order )
22 {
23  // this is the vector of results
24  H.resize(order, 0);
25  if(order==0) return true;
26 
27  double N0=0;
28 
29  // store the first four values of the legendre polynomials in vector,
30  // then use recursive formula to calculate others (just need two previous elements)
31  std::vector<double> P(order, 1);
32 
33  for ( I4MomIter_t itr_i = iBeg; itr_i != iEnd; ++itr_i )
34  {
35  CLHEP::Hep3Vector ci( (*itr_i)->px(), (*itr_i)->py(), (*itr_i)->pz() );
36 
37  for ( I4MomIter_t itr_j = iBeg; itr_j != iEnd; ++itr_j )
38  {
39  CLHEP::Hep3Vector cj( (*itr_j)->px(), (*itr_j)->py(), (*itr_j)->pz() );
40  double x=cos(ci.angle(cj));
41 
42  double P0=1;
43  double P1=x;
44  double P2=0.5*(3.0*x*x-1);
45  double P3=0.5*(5.0*x*x*x-3.0*x);
46  double P4=0.125*(35.0*x*x*x*x-30*x*x+3);
47 
48  H[0]+=abs(ci.mag())*abs(cj.mag())*P0;
49  if(order>=1)
50  {
51  H[1]+=abs(ci.mag())*abs(cj.mag())*P1;
52  P[1]=P1; // never used
53  }
54  if(order>=2)
55  {
56  H[2]+=abs(ci.mag())*abs(cj.mag())*P2;
57  P[2]=P2; // never used
58  }
59  if(order>=3)
60  {
61  H[3]+=abs(ci.mag())*abs(cj.mag())*P3;
62  P[3]=P3;
63  }
64  if(order>=4)
65  {
66  H[4]+=abs(ci.mag())*abs(cj.mag())*P4;
67  P[4]=P4;
68  }
69 
70  for ( unsigned int loop=5; loop<order; ++loop )
71  {
72  P[loop] = 1.0/loop*((2.0*loop-1)*x*P[loop-1]-
73  (loop-1)*P[loop-2]);
74  H[loop]=abs(ci.mag())*abs(ci.mag())*P[loop];
75  }
76  }
77  N0+=(*itr_i)->e();
78  }
79 
80  N0=N0*N0;
81 
82  // and normalize
83  const double inv_N0 = 1. / N0;
84  for ( unsigned int loop=5; loop<order; ++loop ) {
85  H[loop] *= inv_N0;
86  }
87 
88  return true;
89 }
90 
91 } //> end namespace FourMomUtils
92 
93 
94 #endif
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
x
#define x
H
#define H(x, y, z)
Definition: MD5.cxx:114
mc.order
order
Configure Herwig7.
Definition: mc.Herwig7_Dijet.py:12
python.pydraw.loop
def loop(arg)
Definition: pydraw.py:1242
FoxWolfram.h
FourMomUtils::foxWolfram
bool foxWolfram(const I4MomIter_t &iBeg, const I4MomIter_t &iEnd, std::vector< double > &H, unsigned int order=5)
Definition: Event/FourMomUtils/src/FoxWolfram.cxx:20
FourMomUtils
Definition: ForwardTerm.h:14