Skip to content

Commit

Permalink
Merge pull request #10008 from ferencek/DegridifiedUnpackedPhi_from-C…
Browse files Browse the repository at this point in the history
…MSSW_7_4_4

Degridifying unpacked phi to break degeneracies in angular separations for packed candidates: 74X
  • Loading branch information
cmsbuild committed Aug 1, 2015
2 parents 234ff7f + 2c753b3 commit aabe8e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions DataFormats/PatCandidates/src/PackedCandidate.cc
Expand Up @@ -61,9 +61,13 @@ void pat::PackedCandidate::packVtx(bool unpackAfterwards) {
}

void pat::PackedCandidate::unpack() const {
p4_ = PolarLorentzVector(MiniFloatConverter::float16to32(packedPt_),
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 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(),
int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max(),
phi,
MiniFloatConverter::float16to32(packedM_));
p4c_ = p4_;
unpacked_ = true;
Expand Down
5 changes: 4 additions & 1 deletion DataFormats/PatCandidates/src/PackedGenParticle.cc
Expand Up @@ -19,7 +19,10 @@ void pat::PackedGenParticle::unpack() const {
float m=MiniFloatConverter::float16to32(packedM_);
float pz = std::tanh(y)*std::sqrt((m*m+pt*pt)/(1.-std::tanh(y)*std::tanh(y)));
float eta = std::asinh(pz/pt);
p4_ = PolarLorentzVector(pt,eta,int16_t(packedPhi_)*3.2f/std::numeric_limits<int16_t>::max(),m);
double shift = (pt<1. ? 0.1*pt : 0.1/pt); // shift particle phi to break degeneracies in angular separations
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 aabe8e3

Please sign in to comment.