6 #include <IMPL/LCCollectionVec.h>
7 #include <IMPL/ClusterImpl.h>
9 #include "NNClusters.h"
13 using namespace lcio ;
14 using namespace marlin ;
22 _description =
"NNClusterProcessor : simple nearest neighbour clustering" ;
26 colDefault.push_back(
"ecal" ) ;
28 registerInputCollections( LCIO::CALORIMETERHIT,
30 "Name of the input collections" ,
34 registerOutputCollection( LCIO::CLUSTER,
36 "Name of the output collections" ,
38 std::string(
"NNClusters" ) ) ;
41 registerProcessorParameter(
"DistanceCut" ,
42 "Cut for distance between hits in mm" ,
46 registerProcessorParameter(
"EnergyCut" ,
47 "Cut for hit energy in GeV" ,
72 std::cout <<
" ---- NNClusterProcessor::processEvent() - evt: "
73 << evt->getRunNumber() <<
" , " << evt->getEventNumber()
76 clock_t start = clock () ;
81 GenericHitVec<CalorimeterHit> h ;
83 GenericClusterVec<CalorimeterHit> cl ;
85 EnergyCut<CalorimeterHit> eCut(
_eCut ) ;
87 ZIndex<CalorimeterHit,100> zIndex( -4300. , 4300. ) ;
89 NNDistance< CalorimeterHit, float> dist(
_distCut ) ;
91 LCIOCluster<CalorimeterHit> converter ;
98 LCCollection* col = evt->getCollection( *it ) ;
99 nHit += col->getNumberOfElements() ;
102 addToGenericHitVec( h , col , eCut , zIndex ) ;
108 cluster( h.begin() , h.end() , std::back_inserter( cl ) , &dist ) ;
110 std::cout <<
" passing " << h.size() <<
" of " << nHit
111 <<
" hits to clustering (E_cut: " <<
_eCut <<
") "
112 <<
" found " << cl.size() <<
" clusters " << std::endl ;
115 std::transform( cl.begin(), cl.end(), std::back_inserter( *lcioClusters ) , converter ) ;
123 clock_t
end = clock () ;
125 std::cout <<
" ---- NNClusterProcessor::processEvent() - time: "
126 << double( end - start ) / double(CLOCKS_PER_SEC)
NNClusterProcessor aNNClusterProcessor
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
virtual void check(LCEvent *evt)
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
std::string _outputColName
std::vector< LCCollection * > LCCollectionVec
virtual void end()
Called after data processing for clean up.
virtual void init()
Called at the begin of the job before anything is read.
StringVec _colNames
Input collection name.
std::vector< std::string > StringVec