14 #ifndef __TOPTOOLSTOPOLOGYWORKER__
15 #define __TOPTOOLSTOPOLOGYWORKER__
17 #warning The TopologyWorker class is currently not supported anymore! There might be issues in its implementation.
18 #warning If you are still using it or planned to do so, please contact the admins of the corresponding CMSSW package.
19 #warning You can find their e-mail adresses in: cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW/TopQuarkAnalysis/TopTools/.admin/
27 #include "TLorentzVector.h"
82 void getetaphi(
double px,
double py,
double pz,
double&
eta,
double&
phi);
84 double sign(
double a,
double b);
167 bool operator () (
const TLorentzVector & tl1,
const TLorentzVector &
170 return tl2.Pt() < tl1.Pt();
177 m_dSphMomPower(2.0),m_dDeltaThPower(0),
178 m_iFast(4),m_dConv(0.0001),m_iGood(2)
224 double tdi[4] = {0.,0.,0.,0.};
226 double tpr[4] = {0.,0.,0.,0.};
236 Int_t numElements = e1->GetEntries();
237 Int_t numElements2 = e2->GetEntries();
246 std::cout <<
"looping over array, element " <<
elem << std::endl;
248 TObject*
o = (TObject*) e1->At(
elem);
250 std::cerr <<
"TopologyWorker:SetPartList(): adding jet " <<
elem <<
"." << std::endl;
253 printf(
"Too many particles input to TopologyWorker");
257 std::cout <<
"getting name of object..." << std::endl;
259 TString nam(o->IsA()->GetName());
261 std::cout <<
"TopologyWorker::setPartList(): object is of type " << nam << std::endl;
263 if (nam.Contains(
"TVector3")) {
264 TVector3
v(((TVector3 *) o)->
X(),
265 ((TVector3 *) o)->Y(),
266 ((TVector3 *) o)->
Z());
272 else if (nam.Contains(
"TLorentzVector")) {
273 TVector3
v(((TLorentzVector *) o)->
X(),
274 ((TLorentzVector *) o)->Y(),
275 ((TLorentzVector *) o)->
Z());
279 mom(np,4) = ((TLorentzVector *) o)->T();
282 printf(
"TopologyWorker::setEvent input is not a TVector3 or a TLorentzVector\n");
293 tmax = tmax + mom(np,4)*mom(np,5);
305 TObject*
o = (TObject*) e2->At(
elem);
307 printf(
"Too many particles input to TopologyWorker");
311 TString nam(o->IsA()->GetName());
312 if (nam.Contains(
"TVector3")) {
313 TVector3
v(((TVector3 *) o)->
X(),
314 ((TVector3 *) o)->Y(),
315 ((TVector3 *) o)->
Z());
319 mom2(np2,4) = v.Mag();
321 else if (nam.Contains(
"TLorentzVector")) {
322 TVector3
v(((TLorentzVector *) o)->
X(),
323 ((TLorentzVector *) o)->Y(),
324 ((TLorentzVector *) o)->
Z());
328 mom2(np2,4) = ((TLorentzVector *) o)->T();
332 printf(
"TopologyWorker::setEvent Second vector input is not a TVector3 or a TLorentzVector\n");
341 printf(
"TopologyWorker::setEvent Only boosting first vector so watch out when you do this!!!");
342 TVector3 booze(-pxtot/etot,-pytot/etot,-pztot/etot);
360 for (
int id=0;
id<6;
id++) {
361 m_mom(ip,
id)=mom(ip,
id);
372 for ( Int_t pass=1; pass < 3; pass++) {
375 ludbrb( &mom, 0, -phi, 0., 0., 0. );
376 for ( Int_t
i = 0;
i < 3;
i++ ) {
377 for ( Int_t
j = 1;
j < 4;
j++ ) {
382 ludbrb(&temp,0.,-phi,0.,0.,0.);
383 for ( Int_t
ib = 0;
ib < 3;
ib++ ) {
384 for ( Int_t
j = 1;
j < 4;
j++ ) {
389 ludbrb( &mom, -the, 0., 0., 0., 0. );
390 for ( Int_t ic = 0; ic < 3; ic++ ) {
391 for ( Int_t
j = 1;
j < 4;
j++ ) {
396 ludbrb(&temp,-the,0.,0.,0.,0.);
397 for ( Int_t
id = 0;
id < 3;
id++ ) {
398 for ( Int_t
j = 1;
j < 4;
j++ ) {
403 for ( Int_t ifas = 0; ifas <
m_iFast + 1 ; ifas++ ) {
409 for ( Int_t
i = 0;
i <
np;
i++ ) {
411 mom(
i,4) = TMath::Sqrt( mom(
i,1)*mom(
i,1)
412 + mom(
i,2)*mom(
i,2) );
414 for ( Int_t ifas = m_iFast - 1; ifas > -1; ifas-- ) {
415 if ( mom(
i,4) > fast(ifas,4) ) {
416 for ( Int_t
j = 1;
j < 6;
j++ ) {
417 fast(ifas+1,
j) = fast(ifas,
j);
418 if ( ifas == 0 ) fast(ifas,
j) = mom(
i,
j);
422 for ( Int_t
j = 1;
j < 6;
j++ ) {
423 fast(ifas+1,
j) = mom(
i,
j);
430 for ( Int_t ie = 0; ie < work.GetNrows(); ie++ ) {
436 Int_t nc =
iPow(2,p);
437 for ( Int_t
n = 0;
n < nc;
n++ ) {
438 for ( Int_t
j = 1;
j < 4;
j++ ) {
446 for ( Int_t
j = 1;
j < 5-pass;
j++ ) {
447 tdi[
j] = tdi[
j] + sgn*fast(
i,
j);
450 tds = tdi[1]*tdi[1] + tdi[2]*tdi[2] + tdi[3]*tdi[3];
451 for ( Int_t iw = TMath::Min(
n,9); iw > -1; iw--) {
452 if( tds > work(iw,4) ) {
453 for ( Int_t
j = 1;
j < 5;
j++ ) {
454 work(iw+1,
j) = work(iw,
j);
466 for ( Int_t
j = 1;
j < 4;
j++ ) {
467 work(iw+1,
j) = tdi[
j];
481 while ( thp > thps +
m_dConv ) {
483 for ( Int_t
j = 1;
j < 4;
j++ ) {
484 if ( thp <= 1E-10 ) {
492 for ( Int_t
i = 0;
i <
np;
i++ ) {
497 for ( Int_t
j = 1;
j < 5 - pass;
j++ ){
498 tpr[
j] = tpr[
j] + sgn*mom(
i,
j);
501 thp = TMath::Sqrt(tpr[1]*tpr[1]
503 + tpr[3]*tpr[3])/
tmax;
513 for ( Int_t
j = 1;
j < 4;
j++ ) {
527 for ( Int_t
i = 0;
i <
np;
i++ ) {
528 thp += mom(
i,5)*TMath::Abs(
m_dAxes(3,1)*mom(
i,1) +
533 for ( Int_t i6 = 0; i6 < 3; i6++ ) {
534 for ( Int_t
j = 1;
j < 4;
j++ ) {
539 ludbrb(&temp,the,phi,0.,0.,0.);
540 for ( Int_t i7 = 0; i7 < 3; i7++ ) {
541 for ( Int_t
j = 1;
j < 4;
j++ ) {
622 double r = TMath::Sqrt(x*x + y*y);
626 if ( TMath::Abs(x)/r < 0.8 ) {
627 ulangl =
sign(TMath::ACos(x/r),y);
630 ulangl = TMath::ASin(y/r);
631 if ( x < 0. && ulangl >= 0. ) {
644 return -TMath::Abs(a);
647 return TMath::Abs(a);
664 Int_t
np = mom->GetNrows();
665 if ( the*the + phi*phi > 1.0E-20 )
667 rot(1,1) = TMath::Cos(the)*TMath::Cos(phi);
668 rot(1,2) = -TMath::Sin(phi);
669 rot(1,3) = TMath::Sin(the)*TMath::Cos(phi);
670 rot(2,1) = TMath::Cos(the)*TMath::Sin(phi);
671 rot(2,2) = TMath::Cos(phi);
672 rot(2,3) = TMath::Sin(the)*TMath::Sin(phi);
673 rot(3,1) = -TMath::Sin(the);
675 rot(3,3) = TMath::Cos(the);
676 for ( Int_t
i = 0;
i <
np;
i++ )
678 for ( Int_t
j = 1;
j < 4;
j++ )
683 for ( Int_t jb = 1; jb < 4; jb++)
685 for ( Int_t
k = 1;
k < 4;
k++)
687 (*mom)(
i,jb) = (*mom)(
i,jb) +
rot(jb,
k)*pr[
k];
691 double beta = TMath::Sqrt( bx*bx + by*by + bz*bz );
692 if ( beta*beta > 1.0E-20 )
694 if ( beta > 0.99999999 )
697 bx = bx*(0.99999999/
beta);
698 by = by*(0.99999999/
beta);
699 bz = bz*(0.99999999/
beta);
702 double gamma = 1.0/TMath::Sqrt(1.0 - beta*beta);
703 for ( Int_t
i = 0;
i <
np;
i++ )
705 for ( Int_t
j = 1;
j < 5;
j++ )
709 double bp = bx*dp[1] + by*dp[2] + bz*dp[3];
710 double gbp = gamma*(gamma*bp/(1.0 + gamma) + dp[4]);
711 (*mom)(
i,1) = dp[1] + gbp*bx;
712 (*mom)(
i,2) = dp[2] + gbp*by;
713 (*mom)(
i,3) = dp[3] + gbp*bz;
714 (*mom)(
i,4) = gamma*(dp[4] + bp);
745 double SM[4][4],SV[4][4];
746 double PA,
PWT,PS,SQ,SR,SP,SMAX,
SGN;
748 int J, J1, J2,
I,
N, JA, JB, J3, JC, JB1, JB2;
759 P[NP][1]=
m_mom(I-1,1) ;
760 P[NP][2]=
m_mom(I-1,2) ;
761 P[NP][3]=
m_mom(I-1,3) ;
762 P[NP][4]=
m_mom(I-1,4) ;
770 for (J1=1;J1<4;J1++) {
771 for (J2=J1;J2<4;J2++) {
776 for (I=1;I<N+1;I++) {
779 for (J1=1;J1<4;J1++) {
780 for (J2=J1;J2<4;J2++) {
781 SM[J1][J2]=SM[J1][J2]+PWT*P[
I][J1]*P[
I][J2];
792 for (J1=1;J1<4;J1++) {
793 for (J2=J1;J2<4;J2++) {
794 SM[J1][J2]=SM[J1][J2]/PS;
798 SQ=(SM[1][1]*SM[2][2]+SM[1][1]*SM[3][3]+SM[2][2]*SM[3][3]
800 -
pow(SM[1][3],2)-
pow(SM[2][3],2))/3.-1./9.;
801 SR=-0.5*(SQ+1./9.+SM[1][1]*
pow(SM[2][3],2)+SM[2][2]*
pow(SM[1][3],2)+SM[3][3]*
802 pow(SM[1][2],2)-SM[1][1]*SM[2][2]*SM[3][3])+SM[1][2]*SM[1][3]*SM[2][3]+1./27.;
806 P[N+1][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Max(2.*SP,TMath::Sqrt(3.*(1.-SP*SP))-SP);
807 P[N+3][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Min(2.*SP,-TMath::Sqrt(3.*(1.-SP*SP))-SP);
808 P[N+2][4]=1.-P[N+1][4]-P[N+3][4];
809 if (P[N+2][4]> 1E-5) {
812 for (I=1;I<4;I=I+2) {
813 for (J1=1;J1<4;J1++) {
814 SV[J1][J1]=SM[J1][J1]-P[N+
I][4];
815 for (J2=J1+1;J2<4;J2++) {
816 SV[J1][J2]=SM[J1][J2];
817 SV[J2][J1]=SM[J1][J2];
821 for (J1=1;J1<4;J1++) {
822 for (J2=1;J2<4;J2++) {
823 if(std::fabs(SV[J1][J2])>SMAX) {
826 SMAX=std::fabs(SV[J1][J2]);
831 for (J3=JA+1;J3<JA+3;J3++) {
833 RL=SV[J1][JB]/SV[JA][JB];
834 for (J2=1;J2<4;J2++) {
835 SV[J1][J2]=SV[J1][J2]-RL*SV[JA][J2];
836 if (std::fabs(SV[J1][J2])>SMAX) {
838 SMAX=std::fabs(SV[J1][J2]);
843 JB2=JB+2-3*((JB+1)/3);
844 P[N+
I][JB1]=-SV[JC][JB2];
845 P[N+
I][JB2]=SV[JC][JB1];
846 P[N+
I][JB]=-(SV[JA][JB1]*P[N+
I][JB1]+SV[JA][JB2]*P[N+
I][JB2])/
848 PA=TMath::Sqrt(
pow(P[N+I][1],2)+
pow(P[N+I][2],2)+
pow(P[N+I][3],2));
851 rlu=std::fabs(pa)-std::fabs(
int(pa)*1.);
852 rlu1=std::fabs(pa*pa)-std::fabs(
int(pa*pa)*1.);
853 SGN=
pow((-1.),1.*
int(rlu+0.5));
855 P[N+
I][J]=SGN*P[N+
I][J]/PA;
860 SGN=
pow((-1.),1.*
int(rlu1+0.5));
861 P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]);
862 P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]);
863 P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]);
866 SPH=1.5*(P[N+2][4]+P[N+3][4]);
884 double SM[4][4],SV[4][4];
885 double PA,
PWT,PS,SQ,SR,SP,SMAX,
SGN;
887 int J, J1, J2,
I,
N, JA, JB, J3, JC, JB1, JB2;
898 P[NP][1]=
m_mom(I-1,1) ;
899 P[NP][2]=
m_mom(I-1,2) ;
900 P[NP][3]=
m_mom(I-1,3) ;
901 P[NP][4]=
m_mom(I-1,4) ;
909 for (J1=1;J1<4;J1++) {
910 for (J2=J1;J2<4;J2++) {
915 for (I=1;I<N+1;I++) {
918 getetaphi(P[I][1],P[I][2],P[I][3],eta,phi);
919 PWT=
exp(-std::fabs(eta));
921 for (J1=1;J1<4;J1++) {
922 for (J2=J1;J2<4;J2++) {
923 SM[J1][J2]=SM[J1][J2]+PWT*P[
I][J1]*P[
I][J2];
934 for (J1=1;J1<4;J1++) {
935 for (J2=J1;J2<4;J2++) {
936 SM[J1][J2]=SM[J1][J2]/PS;
940 SQ=(SM[1][1]*SM[2][2]+SM[1][1]*SM[3][3]+SM[2][2]*SM[3][3]
942 -
pow(SM[1][3],2)-
pow(SM[2][3],2))/3.-1./9.;
943 SR=-0.5*(SQ+1./9.+SM[1][1]*
pow(SM[2][3],2)+SM[2][2]*
pow(SM[1][3],2)+SM[3][3]*
944 pow(SM[1][2],2)-SM[1][1]*SM[2][2]*SM[3][3])+SM[1][2]*SM[1][3]*SM[2][3]+1./27.;
948 P[N+1][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Max(2.*SP,TMath::Sqrt(3.*(1.-SP*SP))-SP);
949 P[N+3][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Min(2.*SP,-TMath::Sqrt(3.*(1.-SP*SP))-SP);
950 P[N+2][4]=1.-P[N+1][4]-P[N+3][4];
951 if (P[N+2][4]> 1E-5) {
954 for (I=1;I<4;I=I+2) {
955 for (J1=1;J1<4;J1++) {
956 SV[J1][J1]=SM[J1][J1]-P[N+
I][4];
957 for (J2=J1+1;J2<4;J2++) {
958 SV[J1][J2]=SM[J1][J2];
959 SV[J2][J1]=SM[J1][J2];
963 for (J1=1;J1<4;J1++) {
964 for (J2=1;J2<4;J2++) {
965 if(std::fabs(SV[J1][J2])>SMAX) {
968 SMAX=std::fabs(SV[J1][J2]);
973 for (J3=JA+1;J3<JA+3;J3++) {
975 RL=SV[J1][JB]/SV[JA][JB];
976 for (J2=1;J2<4;J2++) {
977 SV[J1][J2]=SV[J1][J2]-RL*SV[JA][J2];
978 if (std::fabs(SV[J1][J2])>SMAX) {
980 SMAX=std::fabs(SV[J1][J2]);
985 JB2=JB+2-3*((JB+1)/3);
986 P[N+
I][JB1]=-SV[JC][JB2];
987 P[N+
I][JB2]=SV[JC][JB1];
988 P[N+
I][JB]=-(SV[JA][JB1]*P[N+
I][JB1]+SV[JA][JB2]*P[N+
I][JB2])/
990 PA=TMath::Sqrt(
pow(P[N+I][1],2)+
pow(P[N+I][2],2)+
pow(P[N+I][3],2));
993 rlu=std::fabs(pa)-std::fabs(
int(pa)*1.);
994 rlu1=std::fabs(pa*pa)-std::fabs(
int(pa*pa)*1.);
995 SGN=
pow((-1.),1.*
int(rlu+0.5));
997 P[N+
I][J]=SGN*P[N+
I][J]/PA;
1002 SGN=
pow((-1.),1.*
int(rlu1+0.5));
1003 P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]);
1004 P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]);
1005 P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]);
1020 double ax[4], ay[4], az[4];
1021 for (
int ia=1;ia<4;ia++) {
1028 ax[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1029 ay[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1030 az[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1034 for (
int k =0 ;
k<
m_np ;
k++) {
1038 for (
int ia=1;ia<4;ia++) {
1044 double ets=(e*e-el*el);
1060 double pi=3.1415927;
1065 double b=sum22-sum33;
1066 double disc=b*b-4*a*
c;
1069 double x1=(
sqrt(disc)-
b)/2/a;
1070 double x2=(-
sqrt(disc)-
b)/2/a;
1073 if (phi<0) phi=2.*pi+
phi;
1074 if (phip<0) phip=2.*pi+phip;
1076 double p21=sum22*
cos(phi)*
cos(phi)+sum33*
sin(phi)*
sin(phi)+2*sum23*
cos(phi)*
sin(phi);
1077 double p31=sum22*
sin(phi)*
sin(phi)+sum33*
cos(phi)*
cos(phi)-2*sum23*
cos(phi)*
sin(phi);
1079 double p22=sum22*
cos(phip)*
cos(phip)+sum33*
sin(phip)*
sin(phip)+2*sum23*
cos(phip)*
sin(phip);
1080 double p32=sum22*
sin(phip)*
sin(phip)+sum33*
cos(phip)*
cos(phip)-2*sum23*
cos(phip)*
sin(phip);
1083 double d1=std::fabs(p31*p31 - p21*p21);
1084 double d2=std::fabs(p32*p32 - p22*p22);
1094 pnorm=
sqrt(eltot[1]);
1119 double SM[4][4],SV[4][4];
1120 double PA,
PWT,PS,SQ,SR,SP,SMAX,
SGN;
1122 int J, J1, J2,
I,
N, JA, JB, J3, JC, JB1, JB2;
1131 for (I=1;I<N+1;I++){
1133 P[NP][1]=
m_mom(I-1,1) ;
1134 P[NP][2]=
m_mom(I-1,2) ;
1135 P[NP][3]=
m_mom(I-1,3) ;
1136 P[NP][4]=
m_mom(I-1,4) ;
1144 for (J1=1;J1<4;J1++) {
1145 for (J2=J1;J2<4;J2++) {
1150 for (I=1;I<N+1;I++) {
1156 for (J1=1;J1<4;J1++) {
1157 for (J2=J1;J2<4;J2++) {
1158 SM[J1][J2]=SM[J1][J2]+PWT*P[
I][J1]*P[
I][J2];
1169 for (J1=1;J1<4;J1++) {
1170 for (J2=J1;J2<4;J2++) {
1171 SM[J1][J2]=SM[J1][J2]/PS;
1175 SQ=(SM[1][1]*SM[2][2]+SM[1][1]*SM[3][3]+SM[2][2]*SM[3][3]
1177 -
pow(SM[1][3],2)-
pow(SM[2][3],2))/3.-1./9.;
1178 SR=-0.5*(SQ+1./9.+SM[1][1]*
pow(SM[2][3],2)+SM[2][2]*
pow(SM[1][3],2)+SM[3][3]*
1179 pow(SM[1][2],2)-SM[1][1]*SM[2][2]*SM[3][3])+SM[1][2]*SM[1][3]*SM[2][3]+1./27.;
1183 P[N+1][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Max(2.*SP,TMath::Sqrt(3.*(1.-SP*SP))-SP);
1184 P[N+3][4]=1./3.+TMath::Sqrt(-SQ)*
TMath::Min(2.*SP,-TMath::Sqrt(3.*(1.-SP*SP))-SP);
1185 P[N+2][4]=1.-P[N+1][4]-P[N+3][4];
1186 if (P[N+2][4]> 1E-5) {
1189 for (I=1;I<4;I=I+2) {
1190 for (J1=1;J1<4;J1++) {
1191 SV[J1][J1]=SM[J1][J1]-P[N+
I][4];
1192 for (J2=J1+1;J2<4;J2++) {
1193 SV[J1][J2]=SM[J1][J2];
1194 SV[J2][J1]=SM[J1][J2];
1198 for (J1=1;J1<4;J1++) {
1199 for (J2=1;J2<4;J2++) {
1200 if(std::fabs(SV[J1][J2])>SMAX) {
1203 SMAX=std::fabs(SV[J1][J2]);
1208 for (J3=JA+1;J3<JA+3;J3++) {
1210 RL=SV[J1][JB]/SV[JA][JB];
1211 for (J2=1;J2<4;J2++) {
1212 SV[J1][J2]=SV[J1][J2]-RL*SV[JA][J2];
1213 if (std::fabs(SV[J1][J2])>SMAX) {
1215 SMAX=std::fabs(SV[J1][J2]);
1220 JB2=JB+2-3*((JB+1)/3);
1221 P[N+
I][JB1]=-SV[JC][JB2];
1222 P[N+
I][JB2]=SV[JC][JB1];
1223 P[N+
I][JB]=-(SV[JA][JB1]*P[N+
I][JB1]+SV[JA][JB2]*P[N+
I][JB2])/
1225 PA=TMath::Sqrt(
pow(P[N+I][1],2)+
pow(P[N+I][2],2)+
pow(P[N+I][3],2));
1228 rlu=std::fabs(pa)-std::fabs(
int(pa)*1.);
1229 rlu1=std::fabs(pa*pa)-std::fabs(
int(pa*pa)*1.);
1230 SGN=
pow((-1.),1.*
int(rlu+0.5));
1232 P[N+
I][J]=SGN*P[N+
I][J]/PA;
1237 SGN=
pow((-1.),1.*
int(rlu1+0.5));
1238 P[N+2][1]=SGN*(P[N+1][2]*P[N+3][3]-P[N+1][3]*P[N+3][2]);
1239 P[N+2][2]=SGN*(P[N+1][3]*P[N+3][1]-P[N+1][1]*P[N+3][3]);
1240 P[N+2][3]=SGN*(P[N+1][1]*P[N+3][2]-P[N+1][2]*P[N+3][1]);
1255 double ax[4], ay[4], az[4];
1256 for (
int ia=1;ia<4;ia++) {
1263 ax[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1264 ay[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1265 az[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1268 for (
int k =0 ;
k<
m_np ;
k++) {
1271 double W=
exp(-std::fabs(eta*1.0));
1272 for (
int ia=1;ia<4;ia++) {
1278 double ets=(e*e-el*el);
1293 double pi=3.1415927;
1298 double b=sum22-sum33;
1299 double disc=b*b-4*a*
c;
1302 double x1=(
sqrt(disc)-
b)/2/a;
1303 double x2=(-
sqrt(disc)-
b)/2/a;
1306 if (phi<0) phi=2.*pi+
phi;
1307 if (phip<0) phip=2.*pi+phip;
1309 double p21=sum22*
cos(phi)*
cos(phi)+sum33*
sin(phi)*
sin(phi)+2*sum23*
cos(phi)*
sin(phi);
1310 double p31=sum22*
sin(phi)*
sin(phi)+sum33*
cos(phi)*
cos(phi)-2*sum23*
cos(phi)*
sin(phi);
1312 double p22=sum22*
cos(phip)*
cos(phip)+sum33*
sin(phip)*
sin(phip)+2*sum23*
cos(phip)*
sin(phip);
1313 double p32=sum22*
sin(phip)*
sin(phip)+sum33*
cos(phip)*
cos(phip)-2*sum23*
cos(phip)*
sin(phip);
1316 double d1=std::fabs(p31*p31 - p21*p21);
1317 double d2=std::fabs(p32*p32 - p22*p22);
1327 pnorm=
sqrt(eltot[1]);
1359 double ax[4], ay[4], az[4];
1360 ax[1]=thrustaxis(0); ay[1]=thrustaxis(1); az[1]=thrustaxis(2);
1361 ax[2]=minoraxis(0); ay[2]=minoraxis(1); az[2]=minoraxis(2);
1362 ax[3]=majoraxis(0); ay[3]=majoraxis(1); az[3]=majoraxis(2);
1363 for (
int ia=1;ia<4;ia++) {
1367 ax[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1368 ay[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1369 az[ia]/=
sqrt(ax[ia]*ax[ia]+ay[ia]*ay[ia]+az[ia]*az[ia]);
1372 for (
int k =0 ;
k<
m_np ;
k++) {
1373 for (
int ia=1;ia<4;ia++) {
1379 double ets=(e*e-el*el);
1381 eltot[ia]+=std::fabs(el);
1394 double pi=3.1415927;
1399 double b=sum22-sum33;
1400 double disc=b*b-4*a*
c;
1403 double x1=(
sqrt(disc)-
b)/2/a;
1404 double x2=(-
sqrt(disc)-
b)/2/a;
1407 if (phi<0) phi=2.*pi+
phi;
1408 if (phip<0) phip=2.*pi+phip;
1410 double p21=sum22*
cos(phi)*
cos(phi)+sum33*
sin(phi)*
sin(phi)+2*sum23*
cos(phi)*
sin(phi);
1411 double p31=sum22*
sin(phi)*
sin(phi)+sum33*
cos(phi)*
cos(phi)-2*sum23*
cos(phi)*
sin(phi);
1413 double p22=sum22*
cos(phip)*
cos(phip)+sum33*
sin(phip)*
sin(phip)+2*sum23*
cos(phip)*
sin(phip);
1414 double p32=sum22*
sin(phip)*
sin(phip)+sum33*
cos(phip)*
cos(phip)-2*sum23*
cos(phip)*
sin(phip);
1417 double d1=std::fabs(p31*p31 - p21*p21);
1418 double d2=std::fabs(p32*p32 - p22*p22);
1428 pnorm=
sqrt(etstot[1]);
1456 float P[1000][6],H0,HD,CTHE;
1461 for (I=1;I<N+1;I++){
1463 P[NP][1]=
m_mom(I-1,1) ;
1464 P[NP][2]=
m_mom(I-1,2) ;
1465 P[NP][3]=
m_mom(I-1,3) ;
1466 P[NP][4]=
m_mom(I-1,4) ;
1467 P[NP][5]=
m_mom(I-1,5) ;
1473 for (I=1;I<N+1;I++) {
1479 P[N+NP][4]=
sqrt(
pow(P[I][1],2)+
pow(P[I][2],2)+
pow(P[I][3],2));
1481 P[N+NP][5]=
sqrt(
pow(P[I][1],2)+
pow(P[I][2],2));
1483 HD=HD+
pow(P[N+NP][5],2);
1507 for (I1=N+1;I1<N+NP+1;I1++) {
1508 for (I2=I1+1;I2<N+NP+1;I2++) {
1509 CTHE=(P[I1][1]*P[I2][1]+P[I1][2]*P[I2][2]+P[I1][3]*P[I2][3])/
1510 (P[I1][4]*P[I2][4]);
1511 H10=H10+P[I1][5]*P[I2][5]*CTHE;
1512 double C2=(1.5*CTHE*CTHE-0.5);
1513 H20=H20+P[I1][5]*P[I2][5]*C2;
1514 double C3=(2.5*CTHE*CTHE*CTHE-1.5*CTHE);
1515 H30=H30+P[I1][5]*P[I2][5]*C3;
1517 double C4=(7*CTHE*C3 - 3*C2)/4.;
1518 double C5=(9*CTHE*C4 - 4*C3)/5.;
1519 double C6=(11*CTHE*C5 - 5*C4)/6.;
1525 H40=H40+P[I1][5]*P[I2][5]*C4;
1526 H50=H50+P[I1][5]*P[I2][5]*C5;
1527 H60=H60+P[I1][5]*P[I2][5]*C6;
1585 double pi=3.1415927;
1587 double p=
sqrt(px*px+py*py+pz*pz);
1598 if (
tan( thg/2.0 )>0.000001) {
1599 eta = -
log(
tan( thg/2.0 ) );
1602 if(phi<=0) phi += 2.0*
pi;
1609 double eta1,eta2,phi1,phi2,deta,dphi,dr;
1614 for (
int kp=
k;kp<
m_np;kp++){
1617 dphi=std::fabs(phi1-phi2);
1618 if (dphi>3.1415) dphi=2*3.1415-dphi;
1619 deta=std::fabs(eta1-eta2);
1620 dr=
sqrt(dphi*dphi+deta*deta);
1633 for( Int_t
k = 0;
k <
exp;
k++)
1646 for(Int_t ijet=0; ijet<njets-1; ijet++){
1653 result+=0.5 * (emax*emax-emin*emin)*(ijet+1);
1660 result+=0.5 * (elo*elo-(15*15))*(njets);
1661 result/=((55*55)-100)/2.0;
1668 TLorentzVector
event(0,0,0,0);
1669 TLorentzVector worker(0,0,0,0);
const double Z[kNumberCalorimeter]
double ulAngle(double x, double y)
Sin< T >::type sin(const T &t)
void planes_sphe_wei(double &pnorm, double &p2, double &p3)
bool operator()(const TLorentzVector &tl1, const TLorentzVector &tl2) const
void ludbrb(TMatrix *mom, double the, double phi, double bx, double by, double bz)
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
void planes_sphe(double &pnorm, double &p2, double &p3)
void setVerbose(bool loud)
const std::complex< double > I
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void setThMomPower(double tp)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double sign(double a, double b)
void planes_thrust(double &pnorm, double &p2, double &p3)
static const double tmax[3]
void getetaphi(double px, double py, double pz, double &eta, double &phi)
void setPartList(TObjArray *e1, TObjArray *e2)
void sumangles(float &sdeta, float &sdr)
virtual ~TopologyWorker()
Power< A, B >::type pow(const A &a, const B &b)
int iPow(int man, int exp)