TruthAna_BaseSelector: "DecayH" and "AssociatedToH" behaviour
Hi, These two methods fail to give coherent return values when they don't find what they are looking for. I propose to modify the last lines to these:
( TruthAna_BaseSelector::AssociatedToH) [...]
if(!(tlv_vec.size()==2))
{
std::cout<<"INFO: Expected two objects in association with H, found ntops="<<tlv_vec.size()<<"), skipping event"<<std::endl;
while (tlv_vec.size()>0) tlv_vec.pop_back(); // empty tlv (not) to pass checks in MyxAODTruthAnalysis::NtupleFiller
}
else { // the two following lines were not enclosed in this new else statement: added to let also samples with backgrounds to be analised
assoc=tlv_vec[0]+tlv_vec[1];
tlv_vec.push_back(assoc)
}
return tlv_vec;
( TruthAna_BaseSelector::DecayH) [...]
if(!(tlv_vec.size()==2))
{
std::cout<<"INFO: Expected two H decay products, found n="<<tlv_vec.size()<<"), skipping event . " <<std::endl;
//exit(0);
// added to inhibit following filling of wrong results
while (tlv_vec.size()>0) tlv_vec.pop_back();
}
else
{
decdec=tlv_vec[0]+tlv_vec[1];
tlv_vec.push_back(decdec); // moved here, it was just two rows below (and so returning a filled vector and passing the "size" check)
}
return tlv_vec;
With these little changes, also in presence of background events ,histograms can be filled nicely (of course only with H-like events, as the methods state to do). Indeed, when a background event is found, the returned size of tlv_vec will be 0, and the event will not be filled in MyxAODTruthAnalysis::NtupleFiller method.
cheers Giancarlo