12 for(
size_t idau(0); idau < mc.numberOfDaughters(); idau++)
13 if(abs(mc.daughter(idau)->pdgId())==
id)
return true;
21 for(
size_t idau(0); idau < mc.numberOfDaughters(); idau++)
22 if(abs(mc.daughter(idau)->charge())!=0) ncharged++;
30 return (abs(mc.pdgId())==
id && !hasDaughter(mc,
id));
34 const reco::GenParticle *mcMom;
35 int momId = abs(mom(mc, mcMom));
36 if(momId == 24)
return true;
37 if(momId == 15 && abs(mom(*mcMom, mcMom)) == 24)
return true;
43 const reco::GenParticle *mcMom;
44 int momId = abs(mom(mc, mcMom));
45 if(momId == 15 && abs(mom(*mcMom, mcMom)) == 24)
return true;
51 int mc_tools::mom(
const reco::GenParticle &mc,
const reco::GenParticle *&mcMom){
52 mcMom =
static_cast<const reco::GenParticle *
>(mc.mother());
54 if(mcMom->pdgId() == mc.pdgId())
return mom(*mcMom, mcMom);
55 else return mcMom->pdgId();
61 const reco::GenParticle * mcMom =
static_cast<const reco::GenParticle *
>(mc.mother());
63 for(
size_t ind=0;
ind<indices.size();
ind++)
64 if(indices[
ind].second == mcMom)
return static_cast<int>(
ind);
65 return getMomIndex(*mcMom, indices);
70 bool mc_tools::decaysTo(
const reco::GenParticle &mc,
size_t id,
const reco::GenParticle *&mcDau){
71 bool idInDaughters(
false);
72 for(
size_t idau(0); idau < mc.numberOfDaughters(); idau++) {
73 size_t dauid(abs(mc.daughter(idau)->pdgId()));
76 mcDau =
static_cast<const reco::GenParticle *
>(mc.daughter(idau));
78 if(dauid == abs(mc.pdgId()))
return decaysTo(*static_cast<const reco::GenParticle*>((mc.daughter(idau))), id, mcDau);
89 bool isFromGSP =
false;
90 if( c->numberOfMothers() == 1 ) {
91 const reco::Candidate* dau =
c;
92 const reco::Candidate* mom = c->mother();
93 while( dau->numberOfMothers() == 1 && !( isHardProcess(mom->status()) && (abs(mom->pdgId())==4 || abs(mom->pdgId())==5) ) ) {
94 if( abs(mom->pdgId())==21 && (abs(c->pdgId())==4 || abs(c->pdgId())==5) )
110 if( status>=21 && status<=29 )
return true;
117 if(mc.mother()) momid = mc.mother()->pdgId();
118 cout<<setw(8)<<mc.pdgId()<<
", mom "<<setw(8)<<momid<<
", status "<<setw(3)<<mc.status()
119 <<
", (pt,eta,phi) = ("<<setw(7)<<
roundNumber(mc.pt(),2)<<
", " 122 <<
", nDau "<<setw(2)<<mc.numberOfDaughters()<<
": ";
123 for(
size_t idau(0); idau < mc.numberOfDaughters(); idau++) {
124 cout<<mc.daughter(idau)->pdgId();
125 if(idau < mc.numberOfDaughters()-1) cout<<
", ";
133 TString ml(mpoints), mg(mpoints);
134 if (mpoints.Contains(
"TChiHH")){
135 mg.Remove(0, ml.Last(
'_')+1);
136 mg.ReplaceAll(
"\n",
"");
139 cout<<
"ERROR: Improper parsing of mass points"<<endl;
140 cout<<
"Mass of gluino parsed as \""<<mg<<
"\""<<endl;
144 ml.Remove(0, ml.Last(
'_')+1);
145 ml.ReplaceAll(
"\n",
"");
146 mg.Remove(mg.Last(
'_'));
147 mg.Remove(0, mg.Last(
'_')+1);
149 if(!mg.IsFloat() || !ml.IsFloat()){
150 cout<<
"ERROR: Improper parsing of mass points"<<endl;
151 cout<<
"Mass of gluino parsed as \""<<mg<<
"\""<<endl;
152 cout<<
"Mass of LSP parsed as \""<<ml<<
"\""<<endl;
TString roundNumber(double num, int decimals, double denom=1.)