#include "TLorentzVector.h" #include "TVector3.h" #include "SimpleCand.C" #include "TMatrixD.h" #include "TMatrixDEigen.h" #define FWMAX 6 // maximum Fox Wolfram moment class EventShape { public: EventShape(const CandList &l, TLorentzVector cms); ~EventShape(){}; // ******* multiplicities int NParticles() const {return fN;} // number of particle candidates int NCharged() const {return fnChrg;} // number of charged candidates int NNeutral() const {return fnNeut;} // number of neutral candidates // ******* maxima of momenta double PmaxLab() const {return fpmaxlab;} // max momentum in lab system double PmaxCms() const {return fpmaxcms;} // max momentum im cms system double PminLab() const {return fpminlab;} // min momentum in lab system double PminCms() const {return fpmincms;} // min momentum im cms system double Ptmax() const {return fptmax;} // max pt (same for lab and cms) double Ptmin() const {return fptmin;} // min pt (same for lab and cms) double PRapmax() const {return fprapmax;} // max pseudorapidity (lab) // ******* sum of energies/momenta (lab system) double PtSumLab() const {return fptsumlab;} // sum of pt in (lab) double NeutEtSumLab() const {return fneutetsumlab;} // sum of transvers energys of neutrals (lab) double NeutESumLab() const {return fneutesumlab;} // sum of energys of neutrals (lab) double ChrgPtSumLab() const {return fchrgptsumlab;} // sum of pt of charged (lab) double ChrgPSumLab() const {return fchrgpsumlab;} // sum of momenta of charged (lab) // ******* sum of energies/momenta (cms system) double PtSumCms() const {return fptsumcms;} // sum of pt in (cms) double NeutEtSumCms() const {return fneutetsumcms;} // sum of transvers energys of neutrals (cms) double NeutESumCms() const {return fneutesumcms;} // sum of energys of neutrals (cms) double ChrgPtSumCms() const {return fchrgptsumcms;} // sum of pt of charged (cms) double ChrgPSumCms() const {return fchrgpsumcms;} // sum of momenta of charged (cms) // ******* multiplicities with threshold int MultPminLab(double pmin); // number of particles with p>pmin (lab frame) int MultPmaxLab(double pmax); // number of particles with ppmin (cms frame) int MultPmaxCms(double pmax); // number of particles with ppmin (lab frame) int MultPtmaxLab(double ptmax); // number of particles with ptpmin (cms frame) int MultPtmaxCms(double ptmax); // number of particles with ptemin (lab frame) int MultNeutEmaxLab(double emax); // number of neutrals with Eemin (cms frame) int MultNeutEmaxCms(double emax); // number of neutrals with Epmin (lab frame) int MultChrgPmaxLab(double pmax); // number of charged with ppmin (cms frame) int MultChrgPmaxCms(double pmax); // number of charged with ppmin (lab frame) double SumPmaxLab(double pmax); // sum of momenta with ppmin (cms frame) double SumPmaxCms(double pmax); // sum of momenta with ppmin (lab frame) double SumPtmaxLab(double ptmax); // sum of pt with ptpmin (cms frame) double SumPtmaxCms(double ptmax); // sum of pt with ptemin (lab frame) double SumNeutEmaxLab(double emax); // sum of energies of neutrals with Eemin (cms frame) double SumNeutEmaxCms(double emax); // sum of energies of neutrals with Epmin (lab frame) double SumChrgPmaxLab(double pmax); // sum of momenta of charged with ppmin (cms frame) double SumChrgPmaxCms(double pmax); // sum of momenta of charged with p0. ? 1. : -1.;} // aux for Thrust double Legendre( int l, double x ); // Legendre function; auxilliary for Fox Wolfram moments std::vector fLabList; // List of 4-vectors in lab frame std::vector fCmsList; // List of 4-vectors in cms frame std::vector fCharge; // List of charges of particles int fnChrg; // number of charged particles int fnNeut; // number of neutral particles int fN; // number of particles double fpmaxlab; // maximum momentum lab frame double fpmaxcms; // maximum momentum cms frame double fpminlab; // minimum momentum lab frame double fpmincms; // minimum momentum cms frame double fptmax; // maximum transvers momentum double fptmin; // minimum transvers momentum double fprapmax; // maximum pseudorapidity double fptsumlab; // sum of pt in (lab) double fneutetsumlab; // sum of transvers energys of neutrals (lab) double fneutesumlab; // sum of energys of neutrals (lab) double fchrgptsumlab; // sum of pt of charged (lab) double fchrgpsumlab; // sum of momenta of charged (lab) double fptsumcms; // sum of pt in (lab) double fneutetsumcms; // sum of transvers energys of neutrals (lab) double fneutesumcms; // sum of energys of neutrals (lab) double fchrgptsumcms; // sum of pt of charged (lab) double fchrgpsumcms; // sum of momenta of charged (lab) double fsph; // Sphericity double fapl; // Aplanarity double fpla; // Planarity double fcir; // Circularity double fFWmom[FWMAX]; // Fox Wolfram moments up to FWMAX bool fFWready; // did we compute FW moments? double fthr; // thrust TVector3 fThrVect; // direction of thrust TVector3 fBoost; // boost vector to go to requested frame }; // ************************************ IMPLEMENTATION EventShape::EventShape(const CandList &l, TLorentzVector cms) : fnChrg(0), fnNeut(0), fN(0), fpmaxlab(0.), fpmaxcms(0.),fpminlab(0.), fpmincms(0.), fptmax(0.), fptmin(0.), fptsumlab(0.),fneutetsumlab(0.),fneutesumlab(0.),fchrgptsumlab(0.),fchrgpsumlab(0.), fptsumcms(0.),fneutetsumcms(0.),fneutesumcms(0.),fchrgptsumcms(0.),fchrgpsumcms(0.), fsph(-1.), fapl(-1.), fpla(-1.), fcir(-1.), fFWready(false), fthr(-1.) { int i; // initialize more complex things fThrVect.SetXYZ(0.,0.,0.); fBoost=cms.BoostVector(); for (i=0;i<=FWMAX;++i) fFWmom[i]=0.; double pmax=0., ptmax=0., pmaxcms=0.; double pmin=1000., ptmin=1000., pmincms=1000.; double prapmax=0.; fLabList.clear(); fCmsList.clear(); for (i=0;ipmax) pmax=lv.P(); if (lv.Pt()>ptmax) ptmax=lv.Pt(); // cache minimum momenta in lab if (lv.P()prapmax) prapmax = lv.PseudoRapidity(); // cache boosted vectors lv.Boost(-fBoost); fCmsList.push_back(lv); // sum momentum variables (cms) fptsumcms += lv.Pt(); if (chrg==0) { fneutetsumcms += lv.Pt(); fneutesumcms += lv.E(); } else { fchrgptsumcms += lv.Pt(); fchrgpsumcms += lv.P(); } // cache maximum momenta in cms if (lv.P()>pmaxcms) pmaxcms=lv.P(); // cache minimum momenta in cms if (lv.P()0 double EventShape::Thrust() { // did we already compute? if (fthr>-1.) return fthr; TVector3 n0(0,0,0); if( fN==0 ) return -1.; int i,j; double pmax=0; //find starting vector as maximum momentum vector for (i=0;ipmax) { n0=fCmsList[i].Vect(); pmax=fCmsList[i].Vect().Mag(); } } TVector3 nnew(0,0,0); // find thrust axis (10 iterations) for (i=0;i<10;++i) { for (j=0;j1.) return -999.; if (l==0) return 1.; double pmm = 1.; double pmmp1 = x; if (l>1) { for(int ll=2; ll<=l; ll++) { double pll = (x * (2 * ll - 1) * pmmp1 - (ll - 1) * pmm) / (ll); pmm = pmmp1; pmmp1 = pll; } } return pmmp1; } // --------------------------------------- double EventShape::FoxWolfMomH(int order) { if (order>FWMAX) return -1.; // already computed FW moments if (fFWready) return fFWmom[order]; if( fN==0 ) return -1.; double s = 0.; int i,j,l; for (i=0; ipmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultPmaxLab(double pmax) { int cnt=0; for (int i=0;ipmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultPmaxCms(double pmax) { int cnt=0; for (int i=0;iptmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultPtmaxLab(double ptmax) { int cnt=0; for (int i=0;iptmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultPtmaxCms(double ptmax) { int cnt=0; for (int i=0;iemin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultNeutEmaxLab(double emax) { int cnt=0; for (int i=0;iemin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultNeutEmaxCms(double emax) { int cnt=0; for (int i=0;ipmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultChrgPmaxLab(double pmax) { int cnt=0; for (int i=0;ipmin) cnt++; return cnt; } // --------------------------------------- int EventShape::MultChrgPmaxCms(double pmax) { int cnt=0; for (int i=0;ipmin) sum+=fLabList[i].P(); return sum; } // --------------------------------------- double EventShape::SumPmaxLab(double pmax) { double sum=0; for (int i=0;ipmin) sum+=fLabList[i].P(); return sum; } // --------------------------------------- double EventShape::SumPmaxCms(double pmax) { double sum=0; for (int i=0;iptmin) sum+=fLabList[i].Pt(); return sum; } // --------------------------------------- double EventShape::SumPtmaxLab(double ptmax) { double sum=0; for (int i=0;iptmin) sum+=fLabList[i].Pt(); return sum; } // --------------------------------------- double EventShape::SumPtmaxCms(double ptmax) { double sum=0; for (int i=0;iemin) sum+=fLabList[i].E(); return sum; } // --------------------------------------- double EventShape::SumNeutEmaxLab(double emax) { double sum=0; for (int i=0;iemin) sum+=fLabList[i].E(); return sum; } // --------------------------------------- double EventShape::SumNeutEmaxCms(double emax) { double sum=0; for (int i=0;ipmin) sum+=fLabList[i].P(); return sum; } // --------------------------------------- double EventShape::SumChrgPmaxLab(double pmax) { double sum=0; for (int i=0;ipmin) sum+=fLabList[i].P(); return sum; } // --------------------------------------- double EventShape::SumChrgPmaxCms(double pmax) { double sum=0; for (int i=0;i