Skip to content

Commit

Permalink
introduced a pseudo-random sign of the phi shift
Browse files Browse the repository at this point in the history
  • Loading branch information
ferencek committed Jun 13, 2015
1 parent a88380d commit 2c753b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DataFormats/PatCandidates/src/PackedCandidate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ void pat::PackedCandidate::packVtx(bool unpackAfterwards) {
void pat::PackedCandidate::unpack() const {
float pt = MiniFloatConverter::float16to32(packedPt_);
double shift = (pt<1. ? 0.1*pt : 0.1/pt); // shift particle phi to break degeneracies in angular separations
double phi = int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max() + shift*3.2/std::numeric_limits<int16_t>::max();
double sign = ( ( int(pt*10) % 2 == 0 ) ? 1 : -1 ); // introduce a pseudo-random sign of the shift
double phi = int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max() + sign*shift*3.2/std::numeric_limits<int16_t>::max();
p4_ = PolarLorentzVector(pt,
int16_t(packedEta_)*6.0f/std::numeric_limits<int16_t>::max(),
phi,
Expand Down
3 changes: 2 additions & 1 deletion DataFormats/PatCandidates/src/PackedGenParticle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ void pat::PackedGenParticle::unpack() const {
float pz = std::tanh(y)*std::sqrt((m*m+pt*pt)/(1.-std::tanh(y)*std::tanh(y)));
float eta = std::asinh(pz/pt);
double shift = (pt<1. ? 0.1*pt : 0.1/pt); // shift particle phi to break degeneracies in angular separations
double phi = int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max() + shift*3.2/std::numeric_limits<int16_t>::max();
double sign = ( ( int(pt*10) % 2 == 0 ) ? 1 : -1 ); // introduce a pseudo-random sign of the shift
double phi = int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max() + sign*shift*3.2/std::numeric_limits<int16_t>::max();
p4_ = PolarLorentzVector(pt,eta,phi,m);
p4c_ = p4_;
unpacked_ = true;
Expand Down

0 comments on commit 2c753b3

Please sign in to comment.