CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWMETProxyBuilder Class Reference
Inheritance diagram for FWMETProxyBuilder:
FWSimpleProxyBuilderTemplate< reco::MET > FWSimpleProxyBuilder FWProxyBuilderBase

Public Member Functions

virtual void cleanLocal ()
 
 FWMETProxyBuilder ()
 
virtual bool havePerViewProduct (FWViewType::EType) const
 
virtual bool haveSingleProduct () const
 
 REGISTER_PROXYBUILDER_METHODS ()
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
virtual ~FWMETProxyBuilder ()
 
- Public Member Functions inherited from FWSimpleProxyBuilderTemplate< reco::MET >
 FWSimpleProxyBuilderTemplate ()
 
- Public Member Functions inherited from FWSimpleProxyBuilder
 FWSimpleProxyBuilder (const std::type_info &iType)
 
virtual ~FWSimpleProxyBuilder ()
 
- Public Member Functions inherited from FWProxyBuilderBase
void build ()
 
virtual bool canHandle (const FWEventItem &)
 
const fireworks::Contextcontext () const
 
TEveElementList * createProduct (FWViewType::EType, const FWViewContext *)
 
 FWProxyBuilderBase ()
 
bool getHaveWindow () const
 
const FWEventItemitem () const
 
virtual void itemBeingDestroyed (const FWEventItem *)
 
void itemChanged (const FWEventItem *)
 
int layer () const
 
void modelChanges (const FWModelIds &)
 
void removePerViewProduct (FWViewType::EType, const FWViewContext *vc)
 
void scaleChanged (const FWViewContext *)
 
void setHaveWindow (bool iFlag)
 
virtual void setInteractionList (FWInteractionList *, const std::string &)
 
virtual void setItem (const FWEventItem *iItem)
 
void setupAddElement (TEveElement *el, TEveElement *parent, bool set_color=true) const
 
void setupElement (TEveElement *el, bool color=true) const
 
virtual bool willHandleInteraction () const
 
virtual ~FWProxyBuilderBase ()
 

Private Member Functions

virtual void buildViewType (const reco::MET &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
 
 FWMETProxyBuilder (const FWMETProxyBuilder &)
 
const FWMETProxyBuilderoperator= (const FWMETProxyBuilder &)
 

Private Attributes

std::vector
< fireworks::scaleMarker
m_lines
 

Additional Inherited Members

- Static Public Member Functions inherited from FWSimpleProxyBuilder
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- Static Public Member Functions inherited from FWProxyBuilderBase
static bool representsSubPart ()
 
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >
::iterator 
Product_it
 
- Protected Member Functions inherited from FWSimpleProxyBuilderTemplate< reco::MET >
const reco::METmodelData (int index)
 
- Protected Member Functions inherited from FWSimpleProxyBuilder
virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *product, FWViewType::EType viewType, const FWViewContext *)
 
virtual void clean ()
 
- Protected Member Functions inherited from FWProxyBuilderBase
TEveCompound * createCompound (bool set_color=true, bool propagate_color_to_all_children=false) const
 
 FWProxyBuilderBase (const FWProxyBuilderBase &)
 
void increaseComponentTransparency (unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
 
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
virtual void modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
- Protected Attributes inherited from FWSimpleProxyBuilder
FWSimpleProxyHelper m_helper
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 36 of file FWMETProxyBuilder.cc.

Constructor & Destructor Documentation

FWMETProxyBuilder::FWMETProxyBuilder ( )
inline

Definition at line 39 of file FWMETProxyBuilder.cc.

39 {}
virtual FWMETProxyBuilder::~FWMETProxyBuilder ( )
inlinevirtual

Definition at line 40 of file FWMETProxyBuilder.cc.

40 {}
FWMETProxyBuilder::FWMETProxyBuilder ( const FWMETProxyBuilder )
private

Member Function Documentation

void FWMETProxyBuilder::buildViewType ( const reco::MET iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
FWViewType::EType  type,
const FWViewContext vc 
)
privatevirtual

Reimplemented from FWSimpleProxyBuilderTemplate< reco::MET >.

Definition at line 88 of file FWMETProxyBuilder.cc.

References fireworks::addRhoZEnergyProjection(), FWPFGeom::caloR1(), fireworks::Context::caloR1(), fireworks::Context::caloTransEta(), FWPFGeom::caloZ1(), fireworks::Context::caloZ1(), FWProxyBuilderBase::context(), funct::cos(), reco::LeafCandidate::energy(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), FWViewContext::getEnergyScale(), fireworks::getShape(), FWViewType::kRhoZ, m_lines, M_PI, create_public_lumi_plots::marker, phi, reco::LeafCandidate::phi(), diffTwoXMLs::r1, diffTwoXMLs::r2, FWProxyBuilderBase::setupAddElement(), funct::sin(), findQualityFiles::size, reco::LeafCandidate::theta(), theta(), and fireworks::Context::voteMaxEtAndEnergy().

89 {
90  using namespace TMath;
91  double phi = met.phi();
92  double theta = met.theta();
93  double size = 1.f;
94 
95  FWViewEnergyScale* caloScale = vc->getEnergyScale();
96 
97  TEveScalableStraightLineSet* marker = new TEveScalableStraightLineSet( "MET marker" );
98  marker->SetLineWidth( 2 );
99 
100 
101 
102  if ( type == FWViewType::kRhoZ )
103  {
104  // body
105  double r0;
106  if (TMath::Abs(met.eta()) < context().caloTransEta())
107  {
108  r0 = context().caloR1()/sin(theta);
109  }
110  else
111  {
112  r0 = context().caloZ1()/fabs(cos(theta));
113  }
114  marker->SetScaleCenter( 0., Sign(r0*sin(theta), phi), r0*cos(theta) );
115  double r1 = r0 + 1;
116  marker->AddLine( 0., Sign(r0*sin(theta), phi), r0*cos(theta),
117  0., Sign(r1*sin(theta), phi), r1*cos(theta) );
118 
119  // arrow pointer
120  double r2 = r1 - 0.1;
121  double dy = 0.05*size;
122  marker->AddLine( 0., Sign(r2*sin(theta) + dy*cos(theta), phi), r2*cos(theta) -dy*sin(theta),
123  0., Sign(r1*sin(theta), phi), r1*cos(theta) );
124  dy = -dy;
125  marker->AddLine( 0., Sign(r2*sin(theta) + dy*cos(theta), phi), r2*cos(theta) -dy*sin(theta),
126  0., Sign(r1*sin(theta), phi), r1*cos(theta) );
127 
128  // segment
129  fireworks::addRhoZEnergyProjection( this, &oItemHolder, context().caloR1() -1, context().caloZ1() -1,
130  theta - 0.04, theta + 0.04,
131  phi );
132  }
133  else
134  {
135  // body
136  double r0 = context().caloR1();
137  double r1 = r0 + 1;
138  marker->SetScaleCenter( r0*cos(phi), r0*sin(phi), 0 );
139  marker->AddLine( r0*cos(phi), r0*sin(phi), 0,
140  r1*cos(phi), r1*sin(phi), 0);
141 
142  // arrow pointer, xy rotate offset point ..
143  double r2 = r1 - 0.1;
144  double dy = 0.05*size;
145 
146  marker->AddLine( r2*cos(phi) -dy*sin(phi), r2*sin(phi) + dy*cos(phi), 0,
147  r1*cos(phi), r1*sin(phi), 0);
148  dy = -dy;
149  marker->AddLine( r2*cos(phi) -dy*sin(phi), r2*sin(phi) + dy*cos(phi), 0,
150  r1*cos(phi), r1*sin(phi), 0);
151 
152  // segment
153  double min_phi = phi-M_PI/36/2;
154  double max_phi = phi+M_PI/36/2;
155  TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
156  TEveGeoShape *element = fireworks::getShape( "spread", new TGeoTubeSeg( r0 - 2, r0, 1, min_phi*180/M_PI, max_phi*180/M_PI ), 0 );
157  element->SetPickable( kTRUE );
158  setupAddElement( element, &oItemHolder );
159  }
160 
161  marker->SetScale(caloScale->getScaleFactor3D()*(caloScale->getPlotEt() ? met.et() : met.energy()));
162  setupAddElement( marker, &oItemHolder );
163 
164  // printf("add line %s %f %f .... eta %f theta %f\n", item()->name().c_str(), met.et(), met.energy(), met.eta(), met.theta());
165  m_lines.push_back(fireworks::scaleMarker(marker, met.et(), met.energy(), vc)); // register for scales
166 
167  context().voteMaxEtAndEnergy(met.et(), met.energy());
168 }
static float caloTransEta()
Definition: Context.cc:229
type
Definition: HCALResponse.h:21
const fireworks::Context & context() const
std::vector< fireworks::scaleMarker > m_lines
tuple met
____________________________________________________________________________||
Definition: CaloMET_cfi.py:7
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:184
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
FWViewEnergyScale * getEnergyScale() const
Geom::Theta< T > theta() const
float caloR1()
Definition: FWPFGeom.h:21
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static float caloR1(bool offset=true)
Definition: Context.cc:209
void addRhoZEnergyProjection(FWProxyBuilderBase *, TEveElement *, double r_ecal, double z_ecal, double theta_min, double theta_max, double phi)
Definition: BuilderUtils.cc:60
#define M_PI
Definition: BFit3D.cc:3
float caloZ1()
Definition: FWPFGeom.h:22
static float caloZ1(bool offset=true)
Definition: Context.cc:219
TEveGeoShape * getShape(const char *name, TGeoBBox *shape, Color_t color)
Definition: BuilderUtils.cc:42
tuple size
Write out results.
Definition: DDAxes.h:10
virtual void FWMETProxyBuilder::cleanLocal ( )
inlinevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 48 of file FWMETProxyBuilder.cc.

References m_lines.

48 { m_lines.clear(); }
std::vector< fireworks::scaleMarker > m_lines
virtual bool FWMETProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlinevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 44 of file FWMETProxyBuilder.cc.

44 { return true; } // used energy scaling
virtual bool FWMETProxyBuilder::haveSingleProduct ( void  ) const
inlinevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 42 of file FWMETProxyBuilder.cc.

42 { return false; } // use buildViewType instead of buildView
const FWMETProxyBuilder& FWMETProxyBuilder::operator= ( const FWMETProxyBuilder )
private
FWMETProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
void FWMETProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 63 of file FWMETProxyBuilder.cc.

References FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), i, j, m_lines, and relativeConstraints::value.

64 {
65  typedef std::vector<fireworks::scaleMarker> Lines_t;
66  FWViewEnergyScale* caloScale = vc->getEnergyScale();
67 
68  // printf("MET %s %p -> %f\n", item()->name().c_str(), vc, caloScale->getScaleFactor3D() );
69  for (Lines_t::iterator i = m_lines.begin(); i!= m_lines.end(); ++ i)
70  {
71  if ( vc == (*i).m_vc )
72  {
73  // printf("lineset %s %p val %f ...%f\n", item()->name().c_str(), (*i).m_ls , (*i).m_et, caloScale->getScaleFactor3D()*(*i).m_et);
74  float value = caloScale->getPlotEt() ? (*i).m_et : (*i).m_energy;
75 
76  (*i).m_ls->SetScale(caloScale->getScaleFactor3D()*value);
77 
78  TEveProjectable *pable = static_cast<TEveProjectable*>((*i).m_ls);
79  for (TEveProjectable::ProjList_i j = pable->BeginProjecteds(); j != pable->EndProjecteds(); ++j)
80  {
81  (*j)->UpdateProjection();
82  }
83  }
84  }
85 }
float getScaleFactor3D() const
std::vector< fireworks::scaleMarker > m_lines
int i
Definition: DBlmapReader.cc:9
FWViewEnergyScale * getEnergyScale() const
int j
Definition: DBlmapReader.cc:9
bool getPlotEt() const

Member Data Documentation

std::vector<fireworks::scaleMarker> FWMETProxyBuilder::m_lines
private

Definition at line 59 of file FWMETProxyBuilder.cc.

Referenced by buildViewType(), cleanLocal(), and scaleProduct().