Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

DurhamProtoJet.cpp

Go to the documentation of this file.
00001 
00002 //
00003 // Implementation of
00004 // CLASS : DurhamProtoJet
00005 // Object used to compute jets with Durham
00006 //
00007 // Written by J.P. Wellisch, 25. Jan 1999
00008 // adapted to Alpha++ by C.Delaere
00009 //
00011 
00012 #include "DurhamProtoJet.h"
00013 #include "QvecBase.h"
00014 #include <float.h>
00015 
00016 // Constructor (from QvecBase)
00017 
00018 DurhamProtoJet::DurhamProtoJet(const QvecBase & alobj)
00019 {
00020   if (alobj.A4V().e()==0)
00021     {
00022       cout << "Error: bad Eflw: E=0" << endl;
00023       exit(1);
00024     }
00025   theFourMomentum = alobj.A4V();
00026   theConstituants.push_back(&alobj);
00027 }
00028 
00029 // Operator += (depends on the scheme)
00030 DurhamProtoJet & 
00031 DurhamProtoJet::operator+=(const DurhamProtoJet & aJet)
00032 {
00033   if (Scheme)
00034     {
00035       // recombination according to E-Scheme.
00036       theFourMomentum += aJet.get4Momentum();
00037     }
00038   else
00039     {
00040       // recombination according to E0-Scheme.
00041       double e = theFourMomentum.e() + aJet.get4Momentum().e();
00042       double p2i = (theFourMomentum + aJet.get4Momentum()).vect().mag();
00043       if (p2i <= pow(10,-14))
00044         {
00045           cout << " Error: Division by zero! " << endl;
00046           exit(1);
00047         }
00048       theFourMomentum.setVect(e/p2i*(theFourMomentum.vect()+aJet.get4Momentum().vect()));
00049       theFourMomentum.setE(e);
00050     }
00051 
00052   vector<const QvecBase *> aConstituantList;
00053   aConstituantList = aJet.getConstituants();
00054   vector<const QvecBase *>::iterator constitIter;
00055   for(constitIter=aConstituantList.begin(); 
00056       constitIter!=aConstituantList.end(); 
00057       constitIter++)
00058   {
00059     theConstituants.push_back(*constitIter);
00060   }
00061   
00062   return *this;
00063 }  
00064 
00065 // the Metric
00066 double 
00067 DurhamProtoJet::getYTimesE2(const DurhamProtoJet * aJet)
00068 {
00069   double result;
00070   double e1 = theFourMomentum.e();
00071   double e2 = aJet->get4Momentum().e();
00072   double costh = theFourMomentum.vect() * aJet->get4Momentum().vect();
00073   costh /= theFourMomentum.vect().mag();
00074   costh /= aJet->get4Momentum().vect().mag();
00075   result = e1;
00076   if(e1>e2) result = e2;
00077   result *= result;
00078   result *= 2.*(1-costh);
00079   return result;
00080 }
00081 
00082 // find the Next Neighbour
00083 vector<DurhamProtoJet>::iterator 
00084 DurhamProtoJet::findNextNeighbour(const vector<DurhamProtoJet> & theProtoJets)
00085 {
00086   vector<DurhamProtoJet>::const_iterator i = theProtoJets.begin();
00087   double minDist = DBL_MAX;
00088   vector<DurhamProtoJet>::const_iterator theNextNeighbour = 0;
00089   for (i = theProtoJets.begin(); i != theProtoJets.end(); i++)
00090   {
00091     if(i!=this)
00092     {
00093       double distance = getYTimesE2(i);
00094       if(distance<minDist)
00095       {
00096         minDist = distance;
00097         theNextNeighbour = i;
00098       }
00099     }
00100   }
00101   return (vector<DurhamProtoJet>::iterator)theNextNeighbour;
00102 }
00103 
00104 // the scheme (set by the algo, used by operator+=)
00105 int DurhamProtoJet::Scheme=1;
00106 
00107 

Generated at Wed Jun 18 17:19:19 2003 for ALPHA++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001