90 assert(stableDaughters!=0);
93 double threshold=0.05, leftmax=0.0, selector=0.0, actLost=0.0;
94 if (nparams>0 && params==0)
return -1;
95 if (nparams>0) threshold=params[0];
96 if (nparams>1) leftmax =params[1];
97 if (nparams>2) selector =params[2];
98 if (nparams>3) actLost =params[3];
101 HEPParticleList *lostDaughters=
new HEPParticleList;
102 double pt_limit=threshold*mother->GetM();
104 HEPParticleListIterator daughters (*stableDaughters);
106 double ephot=pow(10,22);
108 for (HEPParticle *part=daughters.first(); part!=0; (redo)? part=part:part=daughters.next() ) {
110 MC4Vector d4(part->GetE(),part->GetPx(),part->GetPy(),part->GetPz(),part->GetM());
112 d4.Boost(mother->GetPx(),mother->GetPy(),mother->GetPz(),mother->GetE(),mother->GetM());
116 double p_t=d4.GetX0();
117 switch ((
int) selector)
119 case 1: p_t=part->GetE();
break;
120 case 2: p_t=d4.Xt();
break;
124 if(
ifSofty(part->GetPDGId(),nparams,params)) nphot++;
125 if (
ifSofty(part->GetPDGId(),nparams,params) && p_t < pt_limit) {
128 lostDaughters->push_back(part);
129 stableDaughters->remove(part);
130 part=daughters.first();
134 if(
ifSofty(part->GetPDGId(),nparams,params) && ephot>p_t) ephot=p_t;
136 while(nphot>(
int) leftmax)
138 double ephot1=pow(10,22);
140 for (HEPParticle *part=daughters.first(); part!=0; (redo)? part=part:part=daughters.next() ) {
142 MC4Vector d4(part->GetE(),part->GetPx(),part->GetPy(),part->GetPz(),part->GetM());
144 d4.Boost(mother->GetPx(),mother->GetPy(),mother->GetPz(),mother->GetE(),mother->GetM());
147 double p_t=d4.GetX0();
148 switch ((
int) selector)
150 case 1: p_t=part->GetE();
break;
151 case 2: p_t=d4.Xt();
break;
155 if (
ifSofty(part->GetPDGId(),nparams,params) && p_t == ephot) {
158 lostDaughters->push_back(part);
159 stableDaughters->remove(part);
161 part=daughters.first();
165 if(
ifSofty(part->GetPDGId(),nparams,params) && ephot1>p_t) ephot1=p_t;
175 HEPParticleListIterator symmetry (*stableDaughters);
176 HEPParticle *phot1 = NULL;
177 HEPParticle *phot2 = NULL;
178 for (HEPParticle *part=symmetry.first(); part!=0; part=symmetry.next() )
180 if(part->GetPDGId()==22)
182 if(!phot1) phot1=part;
192 if(phot1->GetE()<phot2->GetE())
195 double buf_x = phot1->GetPx();
196 double buf_y = phot1->GetPy();
197 double buf_z = phot1->GetPz();
198 double buf_e = phot1->GetE();
200 phot1->SetPx(phot2->GetPx());
201 phot1->SetPy(phot2->GetPy());
202 phot1->SetPz(phot2->GetPz());
203 phot1->SetE (phot2->GetE() );
224 int version=(int) actLost;
230 HEPParticleListIterator lost (*lostDaughters);
231 for (HEPParticle *lostpart=lost.first(); lostpart!=0; lostpart=lost.next() ) {
233 double searchvirt=pow(10.0,22);
235 for( HEPParticle *part=daughters.first(); part!=0; part=daughters.next() ){
236 if(part->GetCharge()==0)
continue;
237 VV=lostpart->GetP4()+part->GetP4();
239 if (VV.GetM()<searchvirt) {searchvirt=VV.GetM(); Best=part;}
242 Best->SetPx(Best->GetPx()+lostpart->GetPx());
243 Best->SetPy(Best->GetPy()+lostpart->GetPy());
244 Best->SetPz(Best->GetPz()+lostpart->GetPz());
245 Best->SetE (Best->GetE ()+lostpart->GetE ());
253 delete lostDaughters;
256 bool activateUserHist=
true;
257 if(!activateUserHist)
return 1;
261 double X=mother->GetPx(),
Y=mother->GetPy(),
Z=mother->GetPz();
267 if(Z<0 && eta>0) eta=-
eta;
268 if(Z>0 && eta<0) eta=-
eta;
270 char hist1[] =
"mother-PT";
271 char hist2[] =
"mother-eta";
272 char hist3[] =
"mother-phi";
friend F32vec4 sqrt(const F32vec4 &a)
friend F32vec4 log(const F32vec4 &a)
void fillUserHisto(char *name, double val, double weight=1.0, double min=Setup::bin_min[0][0], double max=Setup::bin_max[0][0])
TString pt(TString pts, TString exts="px py pz")
double angle(double X, double Y)
bool ifSofty(int Id, int nparams, double *params)