Skip to content

Commit

Permalink
embedding: add rfMirror option to transform input muon four-vectors
Browse files Browse the repository at this point in the history
This mirrors the input muons along the plane defined by the Z axis and
the proton axis. In contrast to the rfRotation, this seems to preserve
the polarization of the Z boson.
  • Loading branch information
aburgm committed Jun 30, 2014
1 parent 940f46f commit 1f41199
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
37 changes: 36 additions & 1 deletion TauAnalysis/MCEmbeddingTools/plugins/ParticleReplacerZtautau.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ ParticleReplacerZtautau::ParticleReplacerZtautau(const edm::ParameterSet& cfg)
}

rfRotationAngle_ = cfg.getParameter<double>("rfRotationAngle")*TMath::Pi()/180.;
rfMirror_ = cfg.getParameter<bool>("rfMirror");

std::string applyMuonRadiationCorrection_string = cfg.getParameter<std::string>("applyMuonRadiationCorrection");
if ( applyMuonRadiationCorrection_string != "" ) {
Expand Down Expand Up @@ -872,6 +873,30 @@ namespace
return p4_rotated;
}

reco::Particle::LorentzVector mirror(const reco::Particle::LorentzVector& p4, const reco::Particle::LorentzVector& zAxis, const reco::Particle::LorentzVector& pAxis)
{
typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double>, ROOT::Math::DefaultCoordinateSystemTag> RotVector3;

// Make zAxis and pAxis orthogonal:
// (this is not strictly needed)
const RotVector3 pAxisOrtho = pAxis.Vect() - pAxis.Vect().Dot(zAxis.Vect().Unit()) * zAxis.Vect().Unit();
assert(fabs(pAxisOrtho.Dot(zAxis.Vect())) < 1e-3);

// Define a cartesian coordinate system such that the X axis is in the projected proton momentum direction,
// the Z axis is in the Z boson direction and the Y axis is orthogonal on the two:
const RotVector3 x = pAxisOrtho.Unit();
const RotVector3 z = zAxis.Vect().Unit();
const RotVector3 y = x.Cross(z).Unit();

// Mirror the vector on the x-z plane
const double ycomp1 = p4.Vect().Dot(y);
const RotVector3 y1 = p4.Vect() - 2 * ycomp1 * y;
assert(fabs(ycomp1 + y1.Dot(y)) < 1e-3);

const reco::Particle::LorentzVector p4Mirrored(y1.x(), y1.y(), y1.z(), p4.energy());
return p4Mirrored;
}

void print(const std::string& label, const reco::Particle::LorentzVector& p4, const reco::Particle::LorentzVector* p4_ref = 0)
{
std::cout << label << ": En = " << p4.E() << ", Pt = " << p4.pt() << " (Px = " << p4.px() << ", Py = " << p4.py() << "),"
Expand Down Expand Up @@ -917,11 +942,21 @@ void ParticleReplacerZtautau::transformMuMu2LepLep(CLHEP::HepRandomEngine& rando
double u = randomEngine.flat();
rfRotationAngle_value = 2.*TMath::Pi()*u;
}

muon1P4_rf = rotate(muon1P4_rf, zP4_lab, rfRotationAngle_value);
muon2P4_rf = rotate(muon2P4_rf, zP4_lab, rfRotationAngle_value);
}

if ( rfMirror_ ) {
double protonEn = beamEnergy_;
double protonPz = sqrt(square(protonEn) - square(protonMass));
const reco::Particle::LorentzVector pplus_lab(0., 0., protonPz, protonEn);
const reco::Particle::LorentzVector pplus_rf = boost_to_rf(pplus_lab);

muon1P4_rf = mirror(muon1P4_rf, zP4_lab, pplus_rf);
muon2P4_rf = mirror(muon2P4_rf, zP4_lab, pplus_rf);
}

double muon1P_rf2 = square(muon1P4_rf.px()) + square(muon1P4_rf.py()) + square(muon1P4_rf.pz());
double lep1Mass2 = square(targetParticle1Mass_);
double lep1En_rf = 0.5*zP4_rf.E();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class ParticleReplacerZtautau : public ParticleReplacerBase
bool useTauolaPolarization_;
double rfRotationAngle_; // angle of rotation around Z-direction of embedded leptons wrt. reconstructed muons
// (used to "place" simulated leptons in a detector region different from reconstructed muons,
// while preserving Z/W-boson momentum and spin effects)
// Note this does not preserve the Z polarization!!!
bool rfMirror_; // mirror the muon momentum vectors at the plane defined by the Z axis and the proton axis
// This preserves the Z polarization from what we have seen so far.

gen::TauolaInterfaceBase* tauola_;
// keep track if TAUOLA interface has already been initialized.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
PhotosOptions = cms.PSet(),
filterEfficiency = cms.untracked.double(1.0),
beamEnergy = cms.double(4000.), # GeV
rfRotationAngle = cms.double(90.),
rfRotationAngle = cms.double(0.),
rfMirror = cms.bool(True),
applyMuonRadiationCorrection = cms.string(""),
enablePhotosFSR = cms.bool(False),
pythiaHepMCVerbosity = cms.untracked.bool(False),
Expand Down
3 changes: 3 additions & 0 deletions TauAnalysis/MCEmbeddingTools/python/embeddingCustomizeAll.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ def customise(process):
print "Setting rfRotationAngle to %1.0f" % process.customization_options.rfRotationAngle.value()
process.generator.Ztautau.rfRotationAngle = process.customization_options.rfRotationAngle

print "Setting rfMirror to %s" % process.customization_options.rfMirror.value()
process.generator.Ztautau.rfMirror = process.customization_options.rfMirror

print "Setting muon radiation corrections to \"%s\"" % process.customization_options.applyMuonRadiationCorrection.value()
process.generator.Ztautau.applyMuonRadiationCorrection = process.customization_options.applyMuonRadiationCorrection

Expand Down
3 changes: 2 additions & 1 deletion TauAnalysis/MCEmbeddingTools/python/setDefaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def setDefaults(process):
mdtau = cms.int32(0), # mdtau value passed to TAUOLA: 0=no tau decay mode selection,
useTauolaPolarization = cms.bool(False), # disable tau polarization effects in TAUOLA, weight events by weights computed by TauSpinner instead
transformationMode = cms.int32(1), # transformation mode: 0=mumu->mumu, 1=mumu->tautau
rfRotationAngle = cms.double(90.), # rotation angle around Z-boson direction, used when replacing muons by simulated taus
rfRotationAngle = cms.double(0.), # rotation angle around Z-boson direction, used when replacing muons by simulated taus
rfMirror = cms.bool(True), # mirror at the Z-boson / proton plane
embeddingMode = cms.string("RH"), # embedding mode: 'PF'=particle flow embedding, 'RH'=recHit embedding
replaceGenOrRecMuonMomenta = cms.string("rec"), # take momenta of generated tau leptons from: 'rec'=reconstructed muons, 'gen'=generator level muons
applyMuonRadiationCorrection = cms.string(""), # should I correct the momementa of replaced muons for muon -> muon + photon radiation ?
Expand Down

0 comments on commit 1f41199

Please sign in to comment.