fastjet 2.4.5
Public Types | Public Member Functions | Private Attributes
fastjet::d0::ConeSplitMerge< Item > Class Template Reference

#include <ConeSplitMerge.hpp>

List of all members.

Public Types

typedef std::multimap
< ProtoJet< Item >, float,
ProtoJet_ET_seedET_order< Item > > 
PJMMAP

Public Member Functions

 ConeSplitMerge ()
 ConeSplitMerge (const std::vector< ProtoJet< Item > > &jvector)
 ConeSplitMerge (const std::list< ProtoJet< Item > > &jlist)
 ~ConeSplitMerge ()
void split_merge (std::vector< ProtoJet< Item > > &ecv, float s, float pT_min_leading_protojet, float pT_min_second_protojet, int MergeMax, float pT_min_noMergeMax)

Private Attributes

PJMMAP _members

Detailed Description

template<class Item>
class fastjet::d0::ConeSplitMerge< Item >

Definition at line 65 of file ConeSplitMerge.hpp.


Member Typedef Documentation

template<class Item>
typedef std::multimap<ProtoJet<Item>,float,ProtoJet_ET_seedET_order<Item> > fastjet::d0::ConeSplitMerge< Item >::PJMMAP

Definition at line 69 of file ConeSplitMerge.hpp.


Constructor & Destructor Documentation

template<class Item >
fastjet::d0::ConeSplitMerge< Item >::ConeSplitMerge ( )

Definition at line 82 of file ConeSplitMerge.hpp.

:_members() {;}
template<class Item >
fastjet::d0::ConeSplitMerge< Item >::ConeSplitMerge ( const std::vector< ProtoJet< Item > > &  jvector)

Definition at line 85 of file ConeSplitMerge.hpp.

References fastjet::d0::ProtoJet< Item >::NowStable(), and fastjet::d0::ProtoJet< Item >::pT().

{
  // sort proto_jets in Et descending order
  typename std::vector<ProtoJet<Item> >::const_iterator jt;
  for(jt = jvector.begin(); jt != jvector.end(); ++jt) 
  {
    // this is supposed to be a stable cone, declare so
    ProtoJet<Item> jet(*jt);
    jet.NowStable();
    _members.insert(std::make_pair(jet,jet.pT()));
  }
}
template<class Item >
fastjet::d0::ConeSplitMerge< Item >::ConeSplitMerge ( const std::list< ProtoJet< Item > > &  jlist)

Definition at line 99 of file ConeSplitMerge.hpp.

References fastjet::d0::ProtoJet< Item >::NowStable(), and fastjet::d0::ProtoJet< Item >::pT().

{
  //_max_nb_items =-1;
  // sort proto_jets in Et descending order
  typename std::list<ProtoJet<Item> >::const_iterator jt;
  for(jt = jlist.begin(); jt != jlist.end(); ++jt) 
  {
    // this is supposed to be a stable cone, declare so
    ProtoJet<Item> jet(*jt);
    jet.NowStable();
    _members.insert(std::make_pair(jet,jet.pT()));
  }
}
template<class Item>
fastjet::d0::ConeSplitMerge< Item >::~ConeSplitMerge ( ) [inline]

Definition at line 74 of file ConeSplitMerge.hpp.

{;}

Member Function Documentation

template<class Item >
void fastjet::d0::ConeSplitMerge< Item >::split_merge ( std::vector< ProtoJet< Item > > &  ecv,
float  s,
float  pT_min_leading_protojet,
float  pT_min_second_protojet,
int  MergeMax,
float  pT_min_noMergeMax 
)

Definition at line 114 of file ConeSplitMerge.hpp.

References fastjet::d0::ProtoJet< Item >::addItem(), fastjet::d0::ProtoJet< Item >::erase(), fastjet::d0::ProtoJet< Item >::info(), fastjet::d0::ProtoJet< Item >::LItems(), fastjet::d0::ProtoJet< Item >::merged(), fastjet::d0::D0RunIIconeJets_CONEJETINFO::ConeJetInfo::nbMerge(), fastjet::d0::ProtoJet< Item >::phi(), fastjet::d0::ProtoJet< Item >::pT(), fastjet::d0::RD2(), fastjet::d0::ProtoJet< Item >::splitted(), fastjet::d0::ProtoJet< Item >::updateJet(), and fastjet::d0::ProtoJet< Item >::y().

Referenced by fastjet::d0::ILConeAlgorithm< Item >makeClusters().

{
  while(!_members.empty()) 
  {
    /*
    {
      std::cout << std::endl;
      std::cout << " ---------------  list of protojets ------------------ " <<std::endl;
      for ( PJMMAP::iterator it = _members.begin();
            it != _members.end(); ++it)
      {
        std::cout << " pT y phi " << (*it).pT() << " " << (*it).y() << " " << (*it).phi() << " " << (*it).info().seedET() <<  " " << (*it).info().nbMerge() << " " << (*it).info().nbSplit() << std::endl;
      }
      std::cout << " ----------------------------------------------------- " <<std::endl;
    }
    */


    // select highest Et jet
    typename PJMMAP::iterator itmax= _members.begin();
    ProtoJet<Item> imax((*itmax).first);
    const std::list<const Item*>& ilist(imax.LItems());

    _members.erase(itmax);
 
    // does jet share items?
    bool share= false;
    float shared_ET = 0.;
    typename PJMMAP::iterator jtmax;
    typename PJMMAP::iterator jt;
    for(jt = _members.begin(); jt != _members.end(); ++jt) 
    {
      const std::list<const Item*>& jlist((*jt).first.LItems());
      typename std::list<const Item*>::const_iterator tk;
      int count;
      for(tk = ilist.begin(), count = 0; tk != ilist.end(); 
          ++tk, ++count) 
      {
        typename std::list<const Item*>::const_iterator where= 
          find(jlist.begin(),jlist.end(),*tk);   
        if(where != jlist.end()) 
        {
          share= true;
          shared_ET += (*tk)->pT();
        }
      }
      if(share) 
      {
        jtmax = jt;
        break;
      }
    }
    
    if(!share) {
      // add jet to the final jet list
      jcv.push_back(imax);
      //std::cout << " final jet " << imax.pT() << " "<< imax.info().nbMerge() << " " << imax.info().nbSplit() << std::endl; 
    }
    else 
    {
      // find highest Et neighbor
      ProtoJet<Item> jmax((*jtmax).first);

      // drop neighbor
      _members.erase(jtmax);


      //std::cout << " split or merge ? " << imax.pT() << " " << shared_ET << " " << jmax.pT() << " " << s << " " << (jmax.pT())*s << std::endl;

      // merge
      if( shared_ET > (jmax.pT())*shared_ET_fraction 
          && (imax.pT() > pT_min_leading_protojet || jmax.pT() > pT_min_second_protojet)
          && (imax.info().nbMerge() < MergeMax || imax.pT() > pT_min_noMergeMax))
        {
          // add neighbor's items to imax
          const std::list<const Item*>& jlist(jmax.LItems());
          typename std::list<const Item*>::const_iterator tk;
          typename std::list<const Item*>::const_iterator iend= ilist.end();
          bool same = true; // is jmax just the same as imax ? 
          for(tk = jlist.begin(); tk != jlist.end(); ++tk) 
            {
              typename std::list<const Item*>::const_iterator where= 
                find(ilist.begin(),iend,*tk);   
              if(where == iend) 
                {
                  imax.addItem(*tk);
                  same = false;
                }
            }
          if ( ! same ) 
            {
              // recalculate
              //float old_pT = imax.pT();
              
              imax.updateJet();
              imax.merged();
              //std::cout << " jet merge :: " << old_pT << " " << jmax.pT() << " " << imax.pT() << " "<< imax.info().nbMerge() << " " << imax.info().nbSplit() << std::endl; 
            }
        }
      
      //split and assign removed shared cells from lowest pT protojet
      else if(shared_ET > (jmax.pT())*shared_ET_fraction)
      {
        // here we need to pull the lists, because there are items to remove                                                                           
        std::list<const Item*> ilist(imax.LItems());
        std::list<const Item*> jlist(jmax.LItems());

        typename std::list<const Item*>::iterator tk;
        for(tk = jlist.begin(); tk != jlist.end(); )
          {
            typename std::list<const Item*>::iterator where=
              find(ilist.begin(),ilist.end(),*tk);
            if(where != ilist.end()) {
              tk = jlist.erase(tk);
            }
            else ++tk;
          }
        
        jmax.erase();

        for ( typename std::list<const Item*>::const_iterator it = jlist.begin();
              it != jlist.end(); ++it) jmax.addItem(*it);

        // recalculated jet quantities 
        jmax.updateJet();
        jmax.splitted();
        //std::cout << " jet split 1 :: " << jmax.pT() << " "<< jmax.info().nbMerge() << " " << jmax.info().nbSplit() << std::endl;                         
        _members.insert(std::make_pair(jmax,jmax.pT()));
      }

      // split and assign shared cells to nearest protojet
      else 
      {
        // here we need to pull the lists, because there are items to remove
        std::list<const Item*> ilist(imax.LItems());
        std::list<const Item*> jlist(jmax.LItems());
        
        typename std::list<const Item*>::iterator tk;
        for(tk = jlist.begin(); tk != jlist.end(); ) 
        {
          typename std::list<const Item*>::iterator where= 
            find(ilist.begin(),ilist.end(),*tk);
          if(where != ilist.end()) {
            float yk   = (*tk)->y();
            float phik = (*tk)->phi();
            float di= RD2(imax.y(),imax.phi(),yk,phik);
            float dj= RD2(jmax.y(),jmax.phi(),yk,phik);
            if(dj > di) 
            {
              tk = jlist.erase(tk);
              //std::cout << " shared item " << (*tk)->pT() << " removed from neighbour jet " << std::endl;
            }
            else
            {
              ilist.erase(where);
              ++tk;
              //std::cout << " shared item " << (*tk)->pT() << " removed from leading jet " << std::endl;
            }
          }
          else ++tk;
        }
        // recalculate jets imax and jmax
        
        // first erase all items
        imax.erase();
        // put items that are left
        for ( typename std::list<const Item*>::const_iterator it = ilist.begin();
              it != ilist.end(); ++it) imax.addItem(*it);
        // recalculated jet quantities
        imax.updateJet();
        imax.splitted();
        //std::cout << " jet split 2 :: " << imax.pT() << " "<< imax.info().nbMerge() << " " << imax.info().nbSplit() << std::endl; 


        // first erase all items
        jmax.erase();
        // put items that are left
        for ( typename std::list<const Item*>::const_iterator it = jlist.begin();
              it != jlist.end(); ++it) jmax.addItem(*it);
        // recalculated jet quantities
        jmax.updateJet();
        jmax.splitted();
        //std::cout << " jet split " << jmax.pT() << " "<< jmax.info().nbMerge() << " " << jmax.info().nbSplit() << std::endl; 

        _members.insert(std::make_pair(jmax,jmax.pT()));
      }
      _members.insert(std::make_pair(imax,imax.pT()));
    }
  } // while
}

Member Data Documentation

template<class Item>
PJMMAP fastjet::d0::ConeSplitMerge< Item >::_members [private]

Definition at line 78 of file ConeSplitMerge.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines