00001
00002
00003
00004
00005
00006
00007
00008
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
00018 #include "GaudiKernel/MsgStream.h"
00019
00020
00021 #include "CLHEP/Vector/LorentzVector.h"
00022 #include <map>
00023 #include <vector>
00024
00025
00026 namespace Atlfast {
00027 void
00028 ClusterKtStrategy::makeClusters(
00029 MsgStream& log,
00030 const std::vector<IKinematic*>& storedCells,
00031 std::vector<IKinematic*>& unusedCells,
00032 ClusterCollection* clusters) const {
00033 log << MSG::DEBUG << storedCells.size() << " cells to start with"<<endreq;
00034
00039 std::vector<IKinematic*>::const_iterator itr = storedCells.begin();
00040 std::vector<KtJet::KtLorentzVector> jetvec;
00041 std::map<KtJet::KtLorentzVector,IKinematic*> CellMap;
00042 for(; itr != storedCells.end() ; ++itr){
00043 KtJet::KtLorentzVector tempVec = KtJet::KtLorentzVector((*itr)->momentum());
00044 jetvec.push_back(tempVec);
00045 CellMap[tempVec] = (*itr);
00046 }
00047 log << MSG::DEBUG << "Made jetvec"<<endreq;
00052 KtJet::KtEvent ev(jetvec,4,2,1,1.0);
00053 log << MSG::DEBUG << "Made KtEvent"<<endreq;
00054
00056 vector<KtJet::KtLorentzVector> jets0 = ev.getJets();
00061 log << MSG::DEBUG << "Got events jets "<< jets0.size() << endreq;
00062 std::vector<KtJet::KtLorentzVector>::const_iterator iter = jets0.begin();
00063 for (; iter != jets0.end() ; ++iter){
00064 if((*iter).et() > m_minClusterET) {
00065 std::vector<KtJet::KtLorentzVector> tompVec;
00066 tompVec = (*iter).copyConstituents();
00067
00068 std::vector<IKinematic*> tempCellVec;
00069 std::vector<KtJet::KtLorentzVector>::const_iterator iter2 = tompVec.begin();
00070 for (; iter2 != tompVec.end() ; ++iter2){
00071 if(CellMap.find((*iter2)) == CellMap.end()){
00072 log << MSG::ERROR << "Cannot find this key" << endreq;
00073 }else {
00074 tempCellVec.push_back(CellMap[(*iter2)]);
00075 CellMap.erase((*iter2));
00076
00077 }
00078 }
00079
00080 Cluster* clu = new Cluster(*iter,tempCellVec.begin(),tempCellVec.end());
00081 log << MSG::DEBUG << "Made a KtCluster" << endreq;
00083 clusters->push_back(clu);
00084 }
00085 }
00086
00087 log << MSG::DEBUG
00088 << "Number of clusters Made by Kt algo " << clusters->size()
00089 << endreq;
00091 std::map<KtJet::KtLorentzVector,IKinematic*>::iterator celit =
00092 CellMap.begin();
00093
00094 for (; celit != CellMap.end() ; ++celit){
00095
00096 unusedCells.push_back( ( (*celit).second ) );
00097
00098 log << MSG::DEBUG
00099 << "Size of unusedCells vector " << unusedCells.size()
00100 << endreq;
00101 }
00102
00103 return;
00104 }
00105
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117