3 #include "PhotosBranch.h"
4 #include "PhotosParticle.h"
12 vector<PhotosParticle*> PH_HEPEVT_Interface::m_particle_list;
13 int PH_HEPEVT_Interface::ME_channel=0;
14 int PH_HEPEVT_Interface::decay_idx=0;
16 void PH_HEPEVT_Interface::clear(){
18 m_particle_list.clear();
46 int first_mother,
int last_mother,
47 int first_daughter,
int last_daughter){
52 Log::Warning()<<
"Index given to PH_HEPEVT_Interface::add_particle "
53 <<
"is too low (it must be > 0)."<<endl;
56 m_particle_list.push_back(particle);
81 int pdgid = abs(particle->
getPdgID());
84 if(Photos::forceMassList)
86 for(
unsigned int j=0;j<Photos::forceMassList->size();j++)
88 if(pdgid == abs(Photos::forceMassList->at(j)->first))
90 double mass = Photos::forceMassList->at(j)->second;
95 if(mass<0.0) mass = particle->
getMass();
112 PH_HEPEVT_Interface::clear();
116 vector<PhotosParticle *> mothers = branch->
getMothers();
117 int nmothers=mothers.size();
122 if(decay_particle) decay_idx=nmothers+1;
125 vector<PhotosParticle *> daughters = branch->
getDaughters();
126 int ndaughters=daughters.size();
128 for(
int i=0;
i<nmothers;
i++)
131 add_particle(idx++,mothers.at(
i),
133 decay_idx,decay_idx);
135 add_particle(idx++,mothers.at(
i),
137 nmothers+1,nmothers+ndaughters);
141 add_particle(idx++,decay_particle,
143 nmothers+2,nmothers+1+ndaughters);
145 for(
int i=0;
i<ndaughters;
i++)
148 add_particle(idx++,daughters.at(
i),
152 add_particle(idx++,daughters.at(
i),
157 Log::Debug(1000,
false)<<
"PH_HEPEVT returning: "<<( (decay_idx) ? decay_idx : 1 )<<
" from "<<idx-1<<
" particles."<<endl;
158 return (decay_idx) ? decay_idx : 1;
161 void PH_HEPEVT_Interface::get(){
166 if(
ph_hepevt_.nhep == (
int) m_particle_list.size())
171 int particle_count = m_particle_list.size();
173 int photons =
ph_hepevt_.nhep - m_particle_list.size();
174 bool isPhotonCreated = (photons>0);
176 std::vector<PhotosParticle*> photon_list;
190 index = particle_count;
193 for(;photons>0; photons--, index++){
195 if(
ph_hepevt_.idhep[index]!=PhotosParticle::GAMMA)
196 Log::Fatal(
"PH_HEPEVT_Interface::get(): Extra particle added to the PH_HEPEVT common block in not a photon!",6);
214 photon_list.push_back(new_photon);
224 if( isPhotonCreated )
226 std::vector<PhotosParticle*> daughters;
234 for(
int i=daughters_start;
i<particle_count;
i++)
238 daughters.push_back(p);
244 if(daughters.size()==0) special =
false;
248 for(
unsigned int i=0;
i<daughters.size();
i++)
250 if(daughters[
i]->getStatus()==1)
259 std::vector<PhotosParticle*> daughters2 = daughters[
i]->getDaughters();
261 if(daughters2.size()!=1 ||
262 daughters2[0]->getPdgID() != daughters[
i]->getPdgID() )
271 double px1=0.0, py1=0.0, pz1=0.0, e1=0.0;
272 double px2=0.0, py2=0.0, pz2=0.0, e2=0.0;
275 for(
unsigned int i=0;
i<daughters.size();
i++)
278 if(daughters[
i]->getPdgID()==22)
continue;
280 px1+=daughters[
i]->getPx();
281 py1+=daughters[
i]->getPy();
282 pz1+=daughters[
i]->getPz();
283 e1 +=daughters[
i]->getE();
287 for(
unsigned int i=0;
i<daughters.size();
i++)
290 if(daughters[
i]->getPdgID()==22)
continue;
294 px2 += daughters[
i]->getDaughters().at(0)->getPx();
295 py2 += daughters[
i]->getDaughters().at(0)->getPy();
296 pz2 += daughters[
i]->getDaughters().at(0)->getPz();
297 e2 += daughters[
i]->getDaughters().at(0)->getE();
307 for(
unsigned int i=0;
i<photon_list.size();
i++)
311 photon_list[
i]->getPx(),
312 photon_list[
i]->getPy(),
313 photon_list[
i]->getPz(),
314 photon_list[
i]->getE() );
319 photon_list[
i]->createSelfDecayVertex(boosted);
324 Log::Warning()<<
"Hidden interaction, all daughters self decay."
325 <<
"Potentially over simplified solution applied."<<endl;
333 for(index=daughters_start; index < particle_count && index < (int) m_particle_list.size(); index++){
338 Log::Fatal(
"PH_HEPEVT_Interface::get(): Something is wrong with the PH_HEPEVT common block",5);
341 if(isPhotonCreated && Photos::isCreateHistoryEntries)
389 particled->
setE ( particle->
getE() );
414 void PH_HEPEVT_Interface::complete()
419 void PH_HEPEVT_Interface::check_ME_channel()
425 if(decay_idx==2)
return;
428 Log::Debug(900)<<
"ME_channel: Mothers PDG: "<<
ph_hepevt_.idhep[0]<<
" "<<
ph_hepevt_.idhep[1]<<endl;
430 Log::Debug(900,
false)<<
" Intermediate: "<<
ph_hepevt_.idhep[decay_idx-1]<<endl;
433 if(decay_idx==0) firstDaughter=2;
438 if( mother1<1 || (mother1>6 && mother1<11) || mother1>16 )
return;
439 if( mother2<1 || (mother2>6 && mother2<11) || mother2>16 )
return;
450 if(pdg==11 || pdg==13 || pdg==15)
457 if(firstPDG*secondPDG>0) secondPDG=0;
463 if( ME_channel==0 && firstPDG!=0 && secondPDG!=0 &&
464 firstPDG==-secondPDG ) ME_channel=1;
473 if(pdg>=11 && pdg<=16)
480 if(firstPDG*secondPDG>0) secondPDG=0;
486 firstPDG =abs(firstPDG);
487 secondPDG=abs(secondPDG);
489 if( ME_channel==0 && firstPDG!=0 && secondPDG!=0 &&
490 ( ( firstPDG==11 && secondPDG==12 ) || (firstPDG == 12 && secondPDG == 11) ||
491 ( firstPDG==13 && secondPDG==14 ) || (firstPDG == 14 && secondPDG == 13) ||
492 ( firstPDG==15 && secondPDG==16 ) || (firstPDG == 16 && secondPDG == 15)
496 Log::Debug(901)<<
"ME_channel: Found ME_channel: "<<ME_channel<<endl;
501 if(ME_channel>0 && decay_idx)
505 if(ME_channel==1 && !(pdg==22 || pdg==23) ) ME_channel=0;
506 if(ME_channel==2 && !(pdg==24 || pdg==-24)) ME_channel=0;
509 Log::Debug(901,
false)<<
" but set to 0: wrong intermediate particle: "<<pdg<<endl;
517 case 1:
if(!Photos::meCorrectionWtForZ) ME_channel=0;
break;
518 case 2:
if(!Photos::meCorrectionWtForW) ME_channel=0;
break;
519 default: Log::Error()<<
"Unimplemented ME channel: "<<ME_channel<<endl;
break;
521 Log::Debug(902)<<
"ME_channel: Finally, after flag check, ME_channel is: "<<ME_channel<<endl;
527 *x=PH_HEPEVT_Interface::ME_channel;
533 *x=(int) Photos::meCorrectionWtForScalar;
virtual void setPz(double pz)=0
void boostToRestFrame(PhotosParticle *boost)
void boostDaughtersFromRestFrame(PhotosParticle *boost)
vector< PhotosParticle * > getDaughters()
vector< PhotosParticle * > getMothers()
PhotosParticle * getDecayingParticle()
virtual PhotosParticle * createNewParticle(int pdg_id, int status, double mass, double px, double py, double pz, double e)=0
void boostDaughtersToRestFrame(PhotosParticle *boost)
virtual void setPx(double px)=0
static const double NO_BOOST_THRESHOLD
virtual double getVirtuality()
virtual void setPy(double py)=0
void boostFromRestFrame(PhotosParticle *boost)
virtual void addDaughter(PhotosParticle *daughter)=0
virtual void setE(double e)=0
struct Photospp::@32 ph_hepevt_
virtual int getStatus()=0
friend F32vec4 fabs(const F32vec4 &a)
bool prepare(TString pts, TString exts, StrVec &c, StrVec &vars)
struct Photospp::@33 ph_phoqed_
virtual void createHistoryEntry()=0
virtual std::vector< PhotosParticle * > getDaughters()=0
virtual double getMass()=0