Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7025 from alja/andrea73
New proxy Candidates and Vertices builders from arizzi
- Loading branch information
Showing
6 changed files
with
384 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
Fireworks/Candidates/plugins/FWCandidatePtrProxyBuilder.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// -*- C++ -*- | ||
// | ||
// Package: CandidatePtrs | ||
// Class : FWCandidatePtrProxyBuilder | ||
// | ||
// Implementation: | ||
// <Notes on implementation> | ||
// | ||
// Original Author: Chris Jones | ||
// Created: Fri Dec 5 09:56:09 EST 2008 | ||
// | ||
|
||
#include "TEveTrack.h" | ||
|
||
// user include files | ||
#include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h" | ||
#include "Fireworks/Core/interface/Context.h" | ||
|
||
#include "Fireworks/Candidates/interface/CandidateUtils.h" | ||
|
||
#include "DataFormats/Candidate/interface/Candidate.h" | ||
|
||
class FWCandidatePtrProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CandidatePtr> { | ||
|
||
public: | ||
FWCandidatePtrProxyBuilder() {} | ||
virtual ~FWCandidatePtrProxyBuilder() {} | ||
|
||
REGISTER_PROXYBUILDER_METHODS(); | ||
|
||
private: | ||
FWCandidatePtrProxyBuilder(const FWCandidatePtrProxyBuilder&); // stop default | ||
const FWCandidatePtrProxyBuilder& operator=(const FWCandidatePtrProxyBuilder&); // stop default | ||
|
||
using FWSimpleProxyBuilderTemplate<reco::CandidatePtr>::build; | ||
void build(const reco::CandidatePtr& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override; | ||
}; | ||
|
||
|
||
void | ||
FWCandidatePtrProxyBuilder::build(const reco::CandidatePtr& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) | ||
{ | ||
TEveTrack* trk = fireworks::prepareCandidate( *iData, context().getTrackPropagator() ); | ||
|
||
trk->MakeTrack(); | ||
setupAddElement(trk, &oItemHolder); | ||
{ | ||
TEveRecTrack t; | ||
t.fBeta = 1.; | ||
t.fV = TEveVector(iData->vx(),iData->vy(),iData->vz()); | ||
t.fP = TEveVector(-iData->p4().px(), -iData->p4().py(), -iData->p4().pz()); | ||
t.fSign = iData->charge(); | ||
TEveTrack* trk2= new TEveTrack(&t, context().getTrackPropagator()); | ||
trk2->SetLineStyle(7); | ||
trk2->MakeTrack(); | ||
setupAddElement(trk2, &oItemHolder); | ||
|
||
} | ||
|
||
} | ||
|
||
// | ||
// static member functions | ||
// | ||
REGISTER_FWPROXYBUILDER(FWCandidatePtrProxyBuilder, reco::CandidatePtr, "CandidatePtrs", FWViewType::kAll3DBits | FWViewType::kAllRPZBits); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
Fireworks/Vertices/plugins/FWSecVertexCandidateProxyBuilder.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// -*- C++ -*- | ||
// | ||
#include <vector> | ||
|
||
#include "TMatrixDEigen.h" | ||
#include "TMatrixDSym.h" | ||
#include "TDecompSVD.h" | ||
#include "TEveTrans.h" | ||
#include "TEveTrack.h" | ||
#include "TGeoSphere.h" | ||
#include "TGeoMatrix.h" | ||
#include "TEveGeoNode.h" | ||
#include "TEveVSDStructs.h" | ||
|
||
#include "Fireworks/Candidates/interface/CandidateUtils.h" | ||
|
||
|
||
// include files | ||
#include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h" | ||
#include "Fireworks/Core/interface/FWEventItem.h" | ||
|
||
#include "DataFormats/BTauReco/interface/CandSecondaryVertexTagInfo.h" | ||
|
||
class FWSecVertexCandidateProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CandSecondaryVertexTagInfo> { | ||
|
||
public: | ||
FWSecVertexCandidateProxyBuilder(){} | ||
virtual ~FWSecVertexCandidateProxyBuilder(){} | ||
|
||
REGISTER_PROXYBUILDER_METHODS(); | ||
|
||
private: | ||
FWSecVertexCandidateProxyBuilder(const FWSecVertexCandidateProxyBuilder&); // stop default | ||
const FWSecVertexCandidateProxyBuilder& operator=(const FWSecVertexCandidateProxyBuilder&); // stop default | ||
|
||
// ---------- member data -------------------------------- | ||
using FWSimpleProxyBuilderTemplate<reco::CandSecondaryVertexTagInfo>::build; | ||
void build(const reco::CandSecondaryVertexTagInfo& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override; | ||
}; | ||
|
||
void | ||
FWSecVertexCandidateProxyBuilder::build(const reco::CandSecondaryVertexTagInfo& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*) | ||
{ | ||
TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur()); | ||
TEvePointSet* pointSet = new TEvePointSet(); | ||
pointSet->SetMainColor(item()->defaultDisplayProperties().color()); | ||
for(unsigned int i=0;i<iData.nVertices();i++) | ||
{ | ||
const reco::VertexCompositePtrCandidate & v = iData.secondaryVertex(i); | ||
// do we need this stuff? | ||
TGeoSphere * sphere = new TGeoSphere(0, 0.002); //would that leak? | ||
TGeoTranslation position(v.vx(), v.vy(), v.vz() ); | ||
TEveGeoShape * shape = new TEveGeoShape(); | ||
sphere->SetBoxDimensions(2.5,2.5,2.5); | ||
shape->SetShape(sphere); | ||
shape->SetMainColor(item()->defaultDisplayProperties().color()); | ||
shape->SetMainTransparency(10); | ||
|
||
TEveTrans & t = shape->RefMainTrans(); | ||
reco::Vertex::Error e= v.error(); | ||
TMatrixDSym m(3); | ||
for(int i=0;i<3;i++) | ||
for(int j=0;j<3;j++) | ||
{ | ||
m(i,j) = e(i,j); | ||
} | ||
TMatrixDEigen eig(m); | ||
TDecompSVD svd(m); | ||
TMatrixD mm = svd.GetU(); | ||
// TMatrixD mm = eig.GetEigenVectors().Print(); | ||
for(int i=0;i<3;i++) | ||
for(int j=0;j<3;j++) | ||
{ | ||
t(i+1,j+1) = mm(i,j); | ||
} | ||
TVectorD vv ( eig.GetEigenValuesRe()) ; | ||
t.Scale(sqrt(vv(0))*1000.,sqrt(vv(1))*1000.,sqrt(vv(2))*1000.); | ||
t.SetPos(v.vx(),v.vy(),v.vz()); | ||
|
||
setupAddElement(shape, &oItemHolder); | ||
|
||
pointSet->SetNextPoint( v.vx(), v.vy(), v.vz() ); | ||
|
||
for(unsigned int j=0;j<v.numberOfDaughters();j++) | ||
{ | ||
const reco::Candidate * c = v.daughter(j); | ||
std::cout << c << std::endl; | ||
TEveTrack* trk = fireworks::prepareCandidate( *c, context().getTrackPropagator() ); | ||
|
||
trk->SetMainColor(item()->defaultDisplayProperties().color()); | ||
trk->MakeTrack(); | ||
setupAddElement(trk, &oItemHolder); | ||
} | ||
} | ||
setupAddElement(pointSet, &oItemHolder); | ||
} | ||
|
||
REGISTER_FWPROXYBUILDER(FWSecVertexCandidateProxyBuilder, reco::CandSecondaryVertexTagInfo, "SecVertexCand", FWViewType::k3DBit | FWViewType::kAllRPZBits); |
Oops, something went wrong.