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

JadeProtoJet.cpp

Go to the documentation of this file.
00001 
00002 //
00003 // Implementation of
00004 // CLASS : JadeProtoJet
00005 // Object used to compute jets with Jade
00006 //
00007 // Written by J.P. Wellisch, 25. Jan 1999
00008 // adapted to Alpha++ by C.Delaere
00009 //
00011 
00012 #include "JadeProtoJet.h"
00013 #include "QvecBase.h"
00014 #include <float.h>
00015 
00016 // Constructor (from QvecBase)
00017 
00018 JadeProtoJet::JadeProtoJet(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 JadeProtoJet & 
00031 JadeProtoJet::operator+=(const JadeProtoJet & 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 JadeProtoJet::getYTimesE2(const JadeProtoJet * 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 = 2.*e1*e2*(1-costh);
00076   return result;
00077 }
00078 
00079 // find the Next Neighbour
00080 vector<JadeProtoJet>::iterator 
00081 JadeProtoJet::findNextNeighbour(const vector<JadeProtoJet> & theProtoJets)
00082 {
00083   vector<JadeProtoJet>::const_iterator i = theProtoJets.begin();
00084   double minDist = DBL_MAX;
00085   vector<JadeProtoJet>::const_iterator theNextNeighbour = 0;
00086   for (i = theProtoJets.begin(); i != theProtoJets.end(); i++)
00087   {
00088     if(i!=this)
00089     {
00090       double distance = getYTimesE2(i);
00091       if(distance<minDist)
00092       {
00093         minDist = distance;
00094         theNextNeighbour = i;
00095       }
00096     }
00097   }
00098   return (vector<JadeProtoJet>::iterator)theNextNeighbour;
00099 }
00100 
00101 // the scheme (set by the algo, used by operator+=)
00102 int JadeProtoJet::Scheme=1;
00103 

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