CMS 3D CMS Logo

FWTauProxyBuilderBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Calo
4 // Class : FWTauProxyBuilderBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Alja Mrak-Tadel
10 // Created: Thu Oct 21 20:40:28 CEST 2010
11 //
12 
13 // system include files
14 
15 // user include files
16 #include "TGeoTube.h"
17 #include "TEveJetCone.h"
18 #include "TEveGeoNode.h"
19 #include "TEveScalableStraightLineSet.h"
20 #include "TEveTrack.h"
21 
32 
34 
37 
38 static const std::string kTauApexBeamSpot("Place Apex In BeamSpot");
39 FWTauProxyBuilderBase::FWTauProxyBuilderBase() : m_minTheta(0), m_maxTheta(0) {}
40 
42 
45  if (iItem) {
46  iItem->getConfig()->assertParam(kTauApexBeamSpot, false);
47  }
48 }
49 
51  const reco::Jet* iJet,
52  TEveElement* comp,
54  const FWViewContext* vc) {
55  // track
56  addLeadTrack(iTau, comp);
58 
59  // projected markers
61  double phi = iTau.phi();
62  double theta = iTau.theta();
63  double size = 1;
64 
66  float ecalR = barrel ? context().caloR1() : context().caloR2();
67  float ecalZ = barrel ? context().caloZ1() : context().caloZ2();
68 
69  TEveScalableStraightLineSet* marker = new TEveScalableStraightLineSet("energy");
70 
71  if (type == FWViewType::kRhoZ) {
72  double r(0);
73  (theta < context().caloTransAngle() || M_PI - theta < context().caloTransAngle()) ? r = ecalZ / fabs(cos(theta))
74  : r = ecalR / sin(theta);
75 
76  fireworks::addRhoZEnergyProjection(this, comp, ecalR, ecalZ, m_minTheta - 0.003, m_maxTheta + 0.003, phi);
77 
78  marker->SetScaleCenter(0., (phi > 0 ? r * fabs(sin(theta)) : -r * fabs(sin(theta))), r * cos(theta));
79  marker->AddLine(0.,
80  (phi > 0 ? r * fabs(sin(theta)) : -r * fabs(sin(theta))),
81  r * cos(theta),
82  0.,
83  (phi > 0 ? (r + size) * fabs(sin(theta)) : -(r + size) * fabs(sin(theta))),
84  (r + size) * cos(theta));
85 
86  } else {
87  std::pair<double, double> phiRange = fireworks::getPhiRange(m_phis, phi);
88  double min_phi = phiRange.first - M_PI / 36 / 2;
89  double max_phi = phiRange.second + M_PI / 36 / 2;
90  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
91  TGeoBBox* sc_box = new TGeoTubeSeg(ecalR - 1, ecalR + 1, 1, min_phi * 180 / M_PI, max_phi * 180 / M_PI);
92  TEveGeoShape* shape = fireworks::getShape("spread", sc_box, item()->defaultDisplayProperties().color());
93  shape->SetPickable(kTRUE);
94  setupAddElement(shape, comp);
95 
96  marker->SetScaleCenter(ecalR * cos(phi), ecalR * sin(phi), 0);
97  marker->AddLine(ecalR * cos(phi), ecalR * sin(phi), 0, (ecalR + size) * cos(phi), (ecalR + size) * sin(phi), 0);
98  }
99  marker->SetLineWidth(4);
100  FWViewEnergyScale* caloScale = vc->getEnergyScale();
101  marker->SetScale(caloScale->getScaleFactor3D() * (caloScale->getPlotEt() ? iTau.et() : iTau.energy()));
102  setupAddElement(marker, comp);
103  m_lines.push_back(fireworks::scaleMarker(marker, iTau.et(), iTau.energy(), vc));
104 
105  context().voteMaxEtAndEnergy(iTau.et(), iTau.energy());
106  } else if (iJet) {
107  // jet
108  TEveJetCone* cone = fireworks::makeEveJetCone(*iJet, context());
109  if (item()->getConfig()->value<bool>(kTauApexBeamSpot)) {
111  cone->SetApex(TEveVector(bs->x0(), bs->y0(), bs->z0()));
112  }
114  cone->SetFillColor(dp.color());
115  cone->SetLineColor(dp.color());
116  setupAddElement(cone, comp);
117  cone->SetMainTransparency(TMath::Min(100, 80 + dp.transparency() / 5));
118  }
119 }
120 
121 // Tracks which passed quality cuts and are inside a tracker signal cone around leading Track
122 void FWTauProxyBuilderBase::addConstituentTracks(const reco::BaseTau& tau, class TEveElement* product) {
123  for (reco::TrackRefVector::iterator i = tau.signalTracks().begin(), iEnd = tau.signalTracks().end(); i != iEnd; ++i) {
124  TEveTrack* track(nullptr);
125  if (i->isAvailable()) {
126  track = fireworks::prepareTrack(**i, context().getTrackPropagator());
127  track->MakeTrack();
128  setupAddElement(track, product);
129  }
130  }
131 }
132 
133 // Leading Track
134 void FWTauProxyBuilderBase::addLeadTrack(const reco::BaseTau& tau, class TEveElement* product) {
135  const reco::TrackRef leadTrack = tau.leadTrack();
136  if (!leadTrack)
137  return;
138 
139  TEveTrack* track = fireworks::prepareTrack(*leadTrack, context().getTrackPropagator());
140  if (track) {
141  track->MakeTrack();
142  setupAddElement(track, product);
143  }
144 }
145 
147  TEveElement* iCompound,
148  FWViewType::EType viewType,
149  const FWViewContext* vc) {
150  if (FWViewType::isProjected(viewType))
151  increaseComponentTransparency(iId.index(), iCompound, "TEveJetCone", 80);
152 }
153 
154 void FWTauProxyBuilderBase::scaleProduct(TEveElementList* parent, FWViewType::EType viewType, const FWViewContext* vc) {
155  if (FWViewType::isProjected(viewType)) {
156  typedef std::vector<fireworks::scaleMarker> Lines_t;
157  FWViewEnergyScale* caloScale = vc->getEnergyScale();
158  // printf("%p -> %f\n", this,caloScale->getValToHeight() );
159  for (Lines_t::iterator i = m_lines.begin(); i != m_lines.end(); ++i) {
160  if (vc == (*i).m_vc) {
161  float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
162  (*i).m_ls->SetScale(caloScale->getScaleFactor3D() * value);
163  TEveProjected* proj = *(*i).m_ls->BeginProjecteds();
164  proj->UpdateProjection();
165  }
166  }
167  }
168 }
169 
mps_fire.i
i
Definition: mps_fire.py:355
reco::Jet
Base class for all types of Jets.
Definition: Jet.h:20
FWTauProxyBuilderBase::buildBaseTau
void buildBaseTau(const reco::BaseTau &iTau, const reco::Jet *iJet, TEveElement *comp, FWViewType::EType type, const FWViewContext *vc)
Definition: FWTauProxyBuilderBase.cc:50
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
FWViewType::EType
EType
Definition: FWViewType.h:31
FWEventItem::getConfig
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
metsig::tau
Definition: SignAlgoResolutions.h:49
BaseTau.h
FWModelId
Definition: FWModelId.h:28
FWTauProxyBuilderBase::cleanLocal
void cleanLocal() override
Definition: FWTauProxyBuilderBase.cc:170
FWViewType::kRhoZ
Definition: FWViewType.h:33
makeEveJetCone.h
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
fireworks::Context::getBeamSpot
FWBeamSpot * getBeamSpot() const
Definition: Context.h:67
BuilderUtils.h
FWTauProxyBuilderBase::localModelChanges
void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
Definition: FWTauProxyBuilderBase.cc:146
FWViewType::isProjected
static bool isProjected(int)
Definition: FWViewType.cc:100
FWTauProxyBuilderBase::m_maxTheta
float m_maxTheta
Definition: FWTauProxyBuilderBase.h:53
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
TrackUtils.h
edm::Ref< TrackCollection >
kTauApexBeamSpot
static const std::string kTauApexBeamSpot("Place Apex In BeamSpot")
fireworks::getShape
TEveGeoShape * getShape(const char *name, TGeoBBox *shape, Color_t color)
Definition: BuilderUtils.cc:43
FWEventItem::defaultDisplayProperties
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
cms::cuda::bs
bs
Definition: HistoContainer.h:127
singlePfTauSkim_cff.leadTrack
leadTrack
Definition: singlePfTauSkim_cff.py:22
fireworks::Context::caloZ2
static float caloZ2(bool offset=true)
Definition: Context.cc:185
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Track.h
reco::BaseTau
Definition: BaseTau.h:18
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:157
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
FWTauProxyBuilderBase::addConstituentTracks
void addConstituentTracks(const reco::BaseTau &tau, class TEveElement *product)
Definition: FWTauProxyBuilderBase.cc:122
FWProxyBuilderBase::increaseComponentTransparency
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
Definition: FWProxyBuilderBase.cc:393
reco::LeafCandidate::theta
double theta() const final
momentum polar angle
Definition: LeafCandidate.h:150
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
FWTauProxyBuilderBase::addLeadTrack
void addLeadTrack(const reco::BaseTau &tau, class TEveElement *product)
Definition: FWTauProxyBuilderBase.cc:134
FWModelId::index
int index() const
Definition: FWModelId.h:41
fireworks::addRhoZEnergyProjection
void addRhoZEnergyProjection(FWProxyBuilderBase *, TEveElement *, double r_ecal, double z_ecal, double theta_min, double theta_max, double phi)
Definition: BuilderUtils.cc:57
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWBeamSpot
Definition: FWBeamSpot.h:11
FWProxyBuilderConfiguration::assertParam
FWGenericParameter< T > * assertParam(const std::string &name, T def)
Definition: FWProxyBuilderConfiguration.cc:83
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
FWTauProxyBuilderBase::~FWTauProxyBuilderBase
~FWTauProxyBuilderBase() override
Definition: FWTauProxyBuilderBase.cc:41
fireworks::Context::caloR2
static float caloR2(bool offset=true)
Definition: Context.cc:182
fireworks::makeEveJetCone
TEveJetCone * makeEveJetCone(const reco::Jet &iData, const fireworks::Context &context)
Definition: makeEveJetCone.cc:6
fireworks::prepareTrack
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
FWProxyBuilderConfiguration.h
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
value
Definition: value.py:1
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
FWTauProxyBuilderBase::m_lines
std::vector< fireworks::scaleMarker > m_lines
Definition: FWTauProxyBuilderBase.h:77
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
fireworks::Context::caloTransAngle
static float caloTransAngle()
Definition: Context.cc:189
FWTauProxyBuilderBase::m_phis
std::vector< double > m_phis
Definition: FWTauProxyBuilderBase.h:54
FWDisplayProperties
Definition: FWDisplayProperties.h:28
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWViewEnergyScale::getScaleFactor3D
float getScaleFactor3D() const
Definition: FWViewEnergyScale.h:44
reco::LeafCandidate::et
double et() const final
transverse energy
Definition: LeafCandidate.h:127
FWEventItem
Definition: FWEventItem.h:56
type
type
Definition: HCALResponse.h:21
fireworks::Context::caloZ1
static float caloZ1(bool offset=true)
Definition: Context.cc:183
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
FWTauProxyBuilderBase::FWTauProxyBuilderBase
FWTauProxyBuilderBase()
Definition: FWTauProxyBuilderBase.cc:39
relativeConstraints.value
value
Definition: relativeConstraints.py:53
edm::RefVectorIterator
Definition: EDProductfwd.h:33
thetaBins.h
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
fireworks::scaleMarker
Definition: scaleMarker.h:25
FWBeamSpot.h
reco::LeafCandidate::energy
double energy() const final
energy
Definition: LeafCandidate.h:125
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWTauProxyBuilderBase::m_minTheta
float m_minTheta
Definition: FWTauProxyBuilderBase.h:52
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
FWViewEnergyScale.h
FWTauProxyBuilderBase::setItem
void setItem(const FWEventItem *iItem) override
Definition: FWTauProxyBuilderBase.cc:43
Min
T Min(T a, T b)
Definition: MathUtil.h:39
FWProxyBuilderBase::setItem
virtual void setItem(const FWEventItem *iItem)
Definition: FWProxyBuilderBase.cc:83
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
class-composition.parent
parent
Definition: class-composition.py:88
FWTauProxyBuilderBase.h
fireworks::Context::caloR1
static float caloR1(bool offset=true)
Definition: Context.cc:180
FWTauProxyBuilderBase::scaleProduct
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
Definition: FWTauProxyBuilderBase.cc:154
Context.h
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
fireworks::getPhiRange
std::pair< double, double > getPhiRange(const std::vector< double > &phis, double phi)
Definition: BuilderUtils.cc:20