14 Hemisphere::Hemisphere(vector<float> Px_vector, vector<float> Py_vector, vector<float> Pz_vector,
15 vector<float> E_vector,
int seed_method,
int hemisphere_association_method) : Object_Px(Px_vector),
16 Object_Py(Py_vector), Object_Pz(Pz_vector), Object_E(E_vector), seed_meth(seed_method),
17 hemi_meth(hemisphere_association_method),
status(0),
18 dRminSeed1(0.5),nItermax(100),
19 rejectISR(0), rejectISRPt(0), rejectISRPtmax(10000.),
20 rejectISRDR(0), rejectISRDRmax(100.), dbg(0) {
31 vector<float> E_vector) : Object_Px(Px_vector),
32 Object_Py(Py_vector), Object_Pz(Pz_vector), Object_E(E_vector), seed_meth(0),
34 dRminSeed1(0.5),nItermax(100),
35 rejectISR(0), rejectISRPt(0), rejectISRPtmax(10000.),
36 rejectISRDR(0), rejectISRDRmax(100.), dbg(0) {
94 cout <<
"WARNING!!!!! Input vectors have different size! Fix it!" << endl;
99 cout <<
" Hemisphere method " << endl;
113 for(
int j = 0;
j < vsize; ++
j){
120 for(
int j = 0;
j < 5; ++
j){
127 for (
int i = 0;
i <vsize; ++
i){
130 cout <<
"WARNING!!!!! Object " << i <<
" has E = " <<
Object_E[
i]
131 <<
" less than P = " <<
Object_P[
i] <<
" *** Fix it!" << endl;
142 if (theta < 0.) {theta = theta + 3.141592654;}
163 float DeltaRP_Max = 0.;
166 for (
int i = 0;
i < vsize; ++
i){
188 for (
int i = 0;
i < vsize; ++
i){
195 if (DeltaRP > DeltaRP_Max){
196 DeltaRP_Max = DeltaRP;
213 cout <<
" Axis 1 is Object = " << I_Max << endl;
214 cout <<
" Axis 2 is Object = " << J_Max << endl;
224 for (
int i = 0;
i < vsize; ++
i){
227 for (
int j =
i+1;
j < vsize; ++
j){
243 if (Mass_Max < InvariantMass){
271 cout <<
" Axis 1 is Object = " << I_Max << endl;
272 cout <<
" Axis 2 is Object = " << J_Max << endl;
281 for (
int i = 0;
i < vsize; ++
i){
288 if(I_Max < 0)
return 0;
291 for (
int i = 0;
i < vsize; ++
i){
292 if(
i == I_Max)
continue;
300 if(J_Max < 0)
return 0;
321 cout <<
" Axis 1 is Object = " << I_Max <<
" with Pt " <<
Object_Pt[I_Max]<< endl;
322 cout <<
" Axis 2 is Object = " << J_Max <<
" with Pt " <<
Object_Pt[J_Max]<< endl;
326 cout <<
"Please give a valid seeding method!" << endl;
352 cout <<
" Hemishpere: warning - reaching max number of iterations " << endl;
368 for (
int i = 0;
i < vsize; ++
i){
372 if (P_Long1 >= P_Long2){
397 for (
int i = 0;
i < vsize; ++
i){
405 }
else if (
i == J_Max) {
420 float NewAxis1_Py = Axis1[1] * Axis1[3];
421 float NewAxis1_Pz = Axis1[2] * Axis1[3];
422 float NewAxis1_E = Axis1[4];
424 float NewAxis2_Py = Axis2[1] * Axis2[3];
425 float NewAxis2_Pz = Axis2[2] * Axis2[3];
426 float NewAxis2_E = Axis2[4];
441 float mass1 = NewAxis1_E
444 float mass2 = NewAxis2_E
494 cout <<
"Please give a valid hemisphere association method!" << endl;
500 Axis1[3] =
sqrt(Sum1_Px*Sum1_Px + Sum1_Py*Sum1_Py + Sum1_Pz*Sum1_Pz);
501 if (
Axis1[3] < 0.0001) {
502 cout <<
"ZERO objects in group 1! " << endl;
509 Axis2[3] =
sqrt(Sum2_Px*Sum2_Px + Sum2_Py*Sum2_Py + Sum2_Pz*Sum2_Pz);
510 if (
Axis2[3] < 0.0001) {
511 cout <<
" ZERO objects in group 2! " << endl;
520 cout <<
" Grouping = ";
521 for (
int i=0;
i<vsize;
i++){
527 if (
numLoop <= 1) I_Move =
true;
534 for (
int i = 0;
i < vsize; ++
i){
539 float sumdiff = fabs(sumtot - 2*
Object_E[0]);
541 int ibest = 0, jbest = 0;
547 for (
int i = 0;
i < vsize-1; ++
i){
551 for (
int j =
i+1;
j < vsize; ++
j){
559 float sum2_E = sumtot - sum1_E;
560 if(sumdiff >= fabs(sum1_E - sum2_E)) {
561 sumdiff = fabs(sum1_E - sum2_E);
570 float Sum1_Px=0, Sum1_Py=0, Sum1_Pz=0, Sum1_E=0;
571 float Sum2_Px=0, Sum2_Py=0, Sum2_Pz=0, Sum2_E=0;
572 for (
int i = 0;
i < vsize; ++
i){
574 else if (
i <= ibest ||
i == jbest) {
588 Axis1[3] =
sqrt(Sum1_Px*Sum1_Px + Sum1_Py*Sum1_Py + Sum1_Pz*Sum1_Pz);
593 Axis2[3] =
sqrt(Sum2_Px*Sum2_Px + Sum2_Py*Sum2_Py + Sum2_Pz*Sum2_Pz);
619 if (hemiOK == 0) {
return 0;}
623 float newAxis1_Py = Axis1[1] * Axis1[3];
624 float newAxis1_Pz = Axis1[2] * Axis1[3];
627 float newAxis2_Py = Axis2[1] * Axis2[3];
628 float newAxis2_Pz = Axis2[2] * Axis2[3];
633 for (
int i = 0;
i < vsize; ++
i){
661 /
sqrt(newPx*newPx+newPy*newPy+newPz*newPz);
664 ptHemi =
sqrt(pObjsq - plHemi*plHemi);
665 if (ptHemi > valmax) {
670 float theta = 1.570796327;
675 if (fabs(newPz) > 0.001) {
676 theta = atan(
sqrt(newPx*newPx+newPy*newPy)/newPz);
678 if (theta < 0.) {theta = theta + 3.141592654;}
679 hemiEta = -
log(
tan(0.5*theta));
680 hemiPhi = atan2(newPy, newPx);
686 if (DeltaR > valmax) {
std::vector< float > getAxis1()
std::vector< float > Object_Phi
std::vector< float > Object_P
Geom::Theta< T > theta() const
VDouble InvariantMass(Tau)
std::vector< float > Axis2
std::vector< int > getGrouping()
std::vector< float > Object_Eta
std::vector< float > Object_Py
std::vector< int > Object_Noseed
Tan< T >::type tan(const T &t)
std::vector< float > Object_E
double deltaR(double eta1, double eta2, double phi1, double phi2)
std::vector< float > Object_Pt
std::vector< int > Object_Noassoc
std::vector< float > getAxis2()
std::vector< float > Object_Pz
std::vector< float > Object_Px
std::vector< float > Axis1
std::vector< int > Object_Group
void SetNoAssoc(int object_number)