CMS 3D CMS Logo

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

Public Member Functions

 FWDTSegmentProxyBuilder (void)
 
virtual bool haveSingleProduct () const override
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
virtual ~FWDTSegmentProxyBuilder (void)
 
- Public Member Functions inherited from FWSimpleProxyBuilderTemplate< DTRecSegment4D >
 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
 
virtual bool havePerViewProduct (FWViewType::EType) 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 ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
- 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...
 

Private Member Functions

void buildViewType (const DTRecSegment4D &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
 
 FWDTSegmentProxyBuilder (const FWDTSegmentProxyBuilder &)
 
const FWDTSegmentProxyBuilderoperator= (const FWDTSegmentProxyBuilder &)
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >
::iterator 
Product_it
 
- Protected Member Functions inherited from FWSimpleProxyBuilderTemplate< DTRecSegment4D >
virtual void build (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *context)
 
virtual void build (const DTRecSegment4D &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 
virtual void buildViewType (const void *iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType viewType, const FWViewContext *context)
 
const DTRecSegment4DmodelData (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
virtual void cleanLocal ()
 
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 &)
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
- Protected Attributes inherited from FWSimpleProxyBuilder
FWSimpleProxyHelper m_helper
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 28 of file FWDTSegmentProxyBuilder.cc.

Constructor & Destructor Documentation

FWDTSegmentProxyBuilder::FWDTSegmentProxyBuilder ( void  )
inline

Definition at line 31 of file FWDTSegmentProxyBuilder.cc.

31 {}
virtual FWDTSegmentProxyBuilder::~FWDTSegmentProxyBuilder ( void  )
inlinevirtual

Definition at line 32 of file FWDTSegmentProxyBuilder.cc.

32 {}
FWDTSegmentProxyBuilder::FWDTSegmentProxyBuilder ( const FWDTSegmentProxyBuilder )
private

Member Function Documentation

void FWDTSegmentProxyBuilder::buildViewType ( const DTRecSegment4D iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
FWViewType::EType  type,
const FWViewContext  
)
overrideprivatevirtual

Reimplemented from FWSimpleProxyBuilderTemplate< DTRecSegment4D >.

Definition at line 47 of file FWDTSegmentProxyBuilder.cc.

References DTRecSegment4D::chamberId(), FWGeometry::contains(), filterCSVwithJSON::copy, dir, fwLog, relativeConstraints::geom, FWGeometry::getEveShape(), FWEventItem::getGeom(), FWProxyBuilderBase::item(), fwlog::kError, FWViewType::kRhoZ, DTRecSegment4D::localDirection(), DTRecSegment4D::localPosition(), FWGeometry::localToGlobal(), DTRecSegment4D::phiSegment(), DetId::rawId(), HLT_FULL_cff::recHits, FWProxyBuilderBase::setupAddElement(), DTRecSegment2D::specificRecHits(), DTSuperLayerId::superLayer(), csvLumiCalc::unit, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and DTRecSegment4D::zSegment().

49 {
50  unsigned int rawid = iData.chamberId().rawId();
51  const FWGeometry *geom = item()->getGeom();
52 
53  if( ! geom->contains( rawid ))
54  {
55  fwLog( fwlog::kError ) << "failed to get geometry of DT chamber with detid: "
56  << rawid << std::endl;
57  return;
58  }
59 
60  TEveStraightLineSet* segmentSet = new TEveStraightLineSet();
61  // FIXME: This should be set elsewhere.
62  segmentSet->SetLineWidth( 3 );
63  setupAddElement( segmentSet, &oItemHolder );
64 
65  TEveGeoShape* shape = item()->getGeom()->getEveShape( rawid );
66  if( shape )
67  {
68  if( TGeoBBox* box = dynamic_cast<TGeoBBox*>( shape->GetShape()))
69  {
70  LocalPoint pos = iData.localPosition();
71  LocalVector dir = iData.localDirection();
72  LocalVector unit = dir.unit();
73 
74  double localPosition[3] = { pos.x(), pos.y(), pos.z() };
75  double localDirectionIn[3] = { dir.x(), dir.y(), dir.z() };
76  double localDirectionOut[3] = { -dir.x(), -dir.y(), -dir.z() };
77 
78  // In RhoZ view, draw segments at the middle of the chamber, otherwise they won't align with 1D rechits,
79  // for which only one coordinate is known.
80  if (type == FWViewType::kRhoZ) {
81  localPosition[0]=0;
82  localDirectionIn[0]=0;
83  localDirectionOut[0]=0;
84  }
85 
86  Double_t distIn = box->DistFromInside( localPosition, localDirectionIn );
87  Double_t distOut = box->DistFromInside( localPosition, localDirectionOut );
88  LocalVector vIn = unit * distIn;
89  LocalVector vOut = -unit * distOut;
90  float localSegmentInnerPoint[3] = { static_cast<float>(localPosition[0] + vIn.x()),
91  static_cast<float>(localPosition[1] + vIn.y()),
92  static_cast<float>(localPosition[2] + vIn.z())
93  };
94 
95  float localSegmentOuterPoint[3] = { static_cast<float>(localPosition[0] + vOut.x()),
96  static_cast<float>(localPosition[1] + vOut.y()),
97  static_cast<float>(localPosition[2] + vOut.z())
98  };
99 
100  float globalSegmentInnerPoint[3];
101  float globalSegmentOuterPoint[3];
102 
103  geom->localToGlobal( rawid, localSegmentInnerPoint, globalSegmentInnerPoint, localSegmentOuterPoint, globalSegmentOuterPoint );
104 
105  segmentSet->AddLine( globalSegmentInnerPoint[0], globalSegmentInnerPoint[1], globalSegmentInnerPoint[2],
106  globalSegmentOuterPoint[0], globalSegmentOuterPoint[1], globalSegmentOuterPoint[2] );
107 
108 
109  // Draw hits included in the segment
110  TEvePointSet* pointSet = new TEvePointSet;
111  // FIXME: This should be set elsewhere.
112  pointSet->SetMarkerSize(1.5);
113  setupAddElement( pointSet, &oItemHolder );
114 
115  std::vector<DTRecHit1D> recHits;
116  const DTChamberRecSegment2D* phiSeg = iData.phiSegment();
117  const DTSLRecSegment2D* zSeg = iData.zSegment();
118  if (phiSeg) {
119  std::vector<DTRecHit1D> phiRecHits = phiSeg->specificRecHits();
120  copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits));
121  }
122  if (zSeg) {
123  std::vector<DTRecHit1D> zRecHits = zSeg->specificRecHits();
124  copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits));
125  }
126 
127  for (std::vector<DTRecHit1D>::const_iterator rh=recHits.begin(); rh!=recHits.end(); ++rh){
128  DTLayerId layerId = (*rh).wireId().layerId();
129  LocalPoint hpos = (*rh).localPosition();
130  float hitLocalPos[3]= {hpos.x(), hpos.y(), hpos.z()};
131  if (type == FWViewType::kRhoZ) {
132  // In RhoZ view, draw hits at the middle of the layer in the global Z coordinate,
133  // otherwise they won't align with 1D rechits, for which only one coordinate is known.
134  if (layerId.superLayer()==2) {
135  hitLocalPos[1]=0;
136  } else {
137  hitLocalPos[0]=0;
138  }
139  }
140  float hitGlobalPoint[3];
141  geom->localToGlobal(layerId, hitLocalPos, hitGlobalPoint);
142  pointSet->SetNextPoint(hitGlobalPoint[0], hitGlobalPoint[1], hitGlobalPoint[2]);
143  }
144  }
145  }
146 }
type
Definition: HCALResponse.h:21
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
T y() const
Definition: PV3DBase.h:63
virtual DTChamberId chamberId() const
The (specific) DetId of the chamber on which the segment resides.
const FWEventItem * item() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual LocalVector localDirection() const
Local direction in Chamber frame.
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:253
string unit
Definition: csvLumiCalc.py:46
T z() const
Definition: PV3DBase.h:64
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:328
int superLayer() const
Return the superlayer number.
bool contains(unsigned int id) const
Definition: FWGeometry.h:109
virtual LocalPoint localPosition() const
Local position in Chamber frame.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
#define fwLog(_level_)
Definition: fwLog.h:50
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
const std::string & FWDTSegmentProxyBuilder::classPurpose ( )
static

Definition at line 148 of file FWDTSegmentProxyBuilder.cc.

const std::string & FWDTSegmentProxyBuilder::classRegisterTypeName ( )
static

Definition at line 148 of file FWDTSegmentProxyBuilder.cc.

const std::string & FWDTSegmentProxyBuilder::classTypeName ( )
static

Definition at line 148 of file FWDTSegmentProxyBuilder.cc.

const std::string & FWDTSegmentProxyBuilder::classView ( )
static

Definition at line 148 of file FWDTSegmentProxyBuilder.cc.

virtual bool FWDTSegmentProxyBuilder::haveSingleProduct ( void  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 34 of file FWDTSegmentProxyBuilder.cc.

34 { return false; }
const FWDTSegmentProxyBuilder& FWDTSegmentProxyBuilder::operator= ( const FWDTSegmentProxyBuilder )
private
const std::string& FWDTSegmentProxyBuilder::purpose ( ) const
inline
const std::string& FWDTSegmentProxyBuilder::typeName ( ) const
inline
const std::string& FWDTSegmentProxyBuilder::view ( ) const
inline