1 #include "EVENT/LCIO.h"
2 #include "EVENT/LCRunHeader.h"
3 #include "EVENT/LCCollection.h"
4 #include "EVENT/LCParameters.h"
5 #include "EVENT/ReconstructedParticle.h"
6 #include "IMPL/ReconstructedParticleImpl.h"
8 #include "CLHEP/Vector/LorentzVector.h"
9 #include "CLHEP/Vector/ThreeVector.h"
14 #include <marlin/Global.h>
29 registerProcessorParameter(
"Printing" ,
30 "Print certain messages" ,
34 std::string inputParticleCollectionName1 =
"PandoraPFOs";
35 registerInputCollection( LCIO::RECONSTRUCTEDPARTICLE,
36 "InputParticleCollectionName1" ,
37 "Input Particle Collection Name1 " ,
39 inputParticleCollectionName1);
41 std::string inputParticleCollectionName2 =
"GammaGammaParticles";
42 registerInputCollection( LCIO::RECONSTRUCTEDPARTICLE,
43 "InputParticleCollectionName2" ,
44 "Input Particle Collection Name2 " ,
46 inputParticleCollectionName2);
48 std::string outputParticleCollectionName =
"DistilledPFOs";
49 registerOutputCollection( LCIO::RECONSTRUCTEDPARTICLE,
50 "OutputParticleCollectionName" ,
51 "Output Particle Collection Name " ,
53 outputParticleCollectionName);
78 recparcol->setSubset(
true);
83 if(
_printing>1)std::cout <<
"Create DistilledPFOs : " << std::endl;
112 typedef const std::vector<std::string>
StringVec ;
113 StringVec* strVec = evt->getCollectionNames() ;
116 for(StringVec::const_iterator name=strVec->begin(); name!=strVec->end(); name++){
118 LCCollection* col = evt->getCollection(*name);
119 unsigned int nelem = col->getNumberOfElements();
121 for(
unsigned int i=0;i<nelem;i++){
122 ReconstructedParticle* recoPart =
dynamic_cast<ReconstructedParticle*
>(col->getElementAt(i));
127 if(
_printing>1)std::cout <<
"FindPFOs : (nPFOs (PandoraPFOs) = " <<
_pfovec.size() <<
" )" << std::endl;
130 for(StringVec::const_iterator name=strVec->begin(); name!=strVec->end(); name++){
132 LCCollection* col = evt->getCollection(*name);
133 unsigned int nelem = col->getNumberOfElements();
135 for(
unsigned int i=0;i<nelem;i++){
136 ReconstructedParticle* recoPart =
dynamic_cast<ReconstructedParticle*
>(col->getElementAt(i));
141 if(
_printing>1)std::cout <<
"FindPFOs : (nPFOs (GammaGammaParticles) = " <<
_ggpfovec.size() <<
" )" << std::endl;
143 if(
_printing>1)std::cout <<
"Find PFOs : " << tf << std::endl;
166 float esumothers = 0.0;
167 float chargesum = 0.0;
170 int npi0=0;
int neta=0;
int netap=0;
171 float epi0=0.0;
float eeta=0.0;
float eetap=0.0;
172 float Vpi0=0.0;
float Veta=0.0;
float Vetap=0.0;
175 if(
_printing>1)std::cout <<
"CreateDistilledPFOs : (nPFOs initially = " <<
_pfovec.size() <<
" " <<
_ggpfovec.size() <<
" )" << std::endl;
177 typedef std::set<const ReconstructedParticle*> PfoSet;
178 PfoSet particles_used;
186 for(
unsigned int i = 0; i <
_ggpfovec.size(); i++){
200 Vetap +=
_ggpfovec[i]->getCovMatrix()[9];
203 const ReconstructedParticleVec particles =
_ggpfovec[i]->getParticles();
204 if(
_printing>3)std::cout <<
"CreateDistilledPFOs: (nparticles = " << particles.size() <<
" )" << std::endl;
205 for(
unsigned int j = 0; j < particles.size(); j++){
206 const ReconstructedParticle *particle = particles[j];
207 particles_used.insert(particle);
212 if(
_printing>3)std::cout <<
"CreateDistilledPFOs: (nparticles_used = " << particles_used.size() <<
" )" << std::endl;
215 for(
unsigned int i = 0; i <
_pfovec.size(); i++){
216 esump +=
_pfovec[i]->getEnergy();
217 if(abs(
_pfovec[i]->getCharge())>0.5){
219 chargesum+=
_pfovec[i]->getCharge();
220 esumch+=
_pfovec[i]->getEnergy();
223 if(
_pfovec[i]->getType()==2112){
225 esumNH +=
_pfovec[i]->getEnergy();
227 else if(
_pfovec[i]->getType()==22){
229 esumph +=
_pfovec[i]->getEnergy();
233 esumothers +=
_pfovec[i]->getEnergy();
236 if( particles_used.find(
_pfovec[i]) == particles_used.end() ){
238 recparcol->addElement(
_pfovec[i]);
239 esumd +=
_pfovec[i]->getEnergy();
243 float V = Vpi0 + Veta + Vetap;
244 int ntot = npi0 + neta + netap;
246 if(
_printing>3)std::cout <<
"CreateDistilledPFOs : (nPFOs finally = " << recparcol->getNumberOfElements() <<
" )" << std::endl;
248 if(
_printing>3)std::cout <<
"CreateDistilledPFOs SUMMARY " << ntot <<
" " << nppfo <<
" "
249 << ncharged <<
" " << chargesum <<
" " << esumch <<
" "
250 << nphotons <<
" " << esumph <<
" "
251 << nNH <<
" " << esumNH <<
" "
252 << nothers <<
" " << esumothers <<
" "
257 << npi0 <<
" " << neta <<
" " << netap <<
" "
258 << epi0 <<
" " << eeta <<
" " << eetap <<
" "
259 << Vpi0 <<
" " << Veta <<
" " << Vetap <<
" "
270 const double lhs_energy = lhs->getEnergy();
271 const double rhs_energy = rhs->getEnergy();
273 return (lhs_energy>rhs_energy);
bool FindPFOs(LCEvent *evt)
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
CLHEP::Hep3Vector Vector3D
std::vector< ReconstructedParticle * > _mypfovec
DistilledPFOCreator aDistilledPFOCreator
std::vector< ReconstructedParticle * > _pfovec
std::string _inputParticleCollectionName2
virtual void end()
Called after data processing for clean up.
virtual void init()
Called at the beginning of the job before anything is read.
static bool PfoEnergySortFunction(ReconstructedParticle *lhs, ReconstructedParticle *rhs)
CLHEP::HepLorentzVector LorentzVector
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.
std::string _outputParticleCollectionName
void CreateDistilledPFOs(LCCollectionVec *)
std::vector< LCCollection * > LCCollectionVec
std::vector< ReconstructedParticle * > _ggpfovec
std::string _inputParticleCollectionName1
std::vector< std::string > StringVec