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

ClusterKtStrategy.cxx

Go to the documentation of this file.
00001 // ================================================
00002 //        ClusterKtStrategy class Implementation
00003 //
00004 //  + PreCluster helper class
00005 //
00006 // ================================================
00007 //
00008 // Namespace Atlfast
00009 //
00010 #include "AtlfastAlgs/ClusterKtStrategy.h"
00011 #include "AtlfastEvent/Cell.h"
00012 #include "AtlfastEvent/Cluster.h"
00013 
00014 #include "KtJet/KtLorentzVector.h"
00015 #include "KtJet/KtEvent.h"
00016 
00017 // Gaudi includes
00018 #include "GaudiKernel/MsgStream.h"
00019 
00020 //Other
00021 #include "CLHEP/Vector/LorentzVector.h"
00022 #include <map>
00023 #include <vector>
00024 
00025 
00026 namespace Atlfast {
00027   void ClusterKtStrategy::makeClusters( 
00028                                          MsgStream& log, 
00029                                          const localCellCollection&  storedCells,
00030                                          localCellCollection& unusedCells,
00031                                          ClusterCollection* clusters) const {
00032     log << MSG::DEBUG << storedCells.size() << " cells to start with"<<endreq;
00033     
00037     localCellIterator itr = storedCells.begin();
00038     std::vector<KtJet::KtLorentzVector> jetvec;
00039     std::map<KtJet::KtLorentzVector,Cell*> CellMap;
00040     for(; itr != storedCells.end() ; ++itr){
00041       KtJet::KtLorentzVector tempVec = KtJet::KtLorentzVector((*itr)->momentum());
00042       jetvec.push_back(tempVec);
00043       CellMap[tempVec] = (*itr);
00044     }
00045     log << MSG::DEBUG << "Made jetvec"<<endreq;
00050     KtJet::KtEvent ev(jetvec,4,2,1,1.0);
00051     log << MSG::DEBUG << "Made KtEvent"<<endreq;
00053     vector<KtJet::KtLorentzVector> jets0 = ev.getJets();
00058     log << MSG::DEBUG << "Got events jets "<< jets0.size() << endreq;
00059     std::vector<KtJet::KtLorentzVector>::const_iterator iter = jets0.begin();
00060     for (; iter != jets0.end() ; ++iter){
00061       if((*iter).et() > m_minClusterET) { 
00062         std::vector<KtJet::KtLorentzVector> tompVec;
00063         tompVec = (*iter).copyConstituents();
00064         //Make a vector of associated cells
00065         std::vector<Cell*> tempCellVec;
00066         std::vector<KtJet::KtLorentzVector>::const_iterator iter2  = tompVec.begin();
00067         for (; iter2 != tompVec.end() ; ++iter2){
00068           if(CellMap.find((*iter2)) == CellMap.end()){
00069             log << MSG::ERROR <<  "Cannot find this key" << endreq;
00070           }else {
00071             tempCellVec.push_back(CellMap[(*iter2)]);
00072             CellMap.erase((*iter2));
00073             //      log << MSG::DEBUG << "Removed cell from map" << endreq;
00074           }
00075         }
00076         //Make a Atlfast::KtCluster
00077         Cluster* clu = new Cluster(*iter,tempCellVec.begin(),tempCellVec.end());
00078         log << MSG::DEBUG << "Made a KtCluster" << endreq;
00080         clusters->push_back(clu);
00081       }
00082     }
00083     log << MSG::DEBUG <<  "Number of clusters Made by Kt algo " << clusters->size() << endreq;
00085     std::map<KtJet::KtLorentzVector,Cell*>::iterator celit = CellMap.begin();
00086     for (; celit != CellMap.end() ; ++celit) unusedCells.push_back((*celit).second);
00087     log << MSG::DEBUG <<  "Size of unusedCells vector " << unusedCells.size() << endreq;
00088     return;
00089   }
00090   
00091 } // end of namespace bracket
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 

Generated on Tue Jan 28 09:57:12 2003 for AtlfastAlgs by doxygen1.3-rc1