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
FWCSCWireDigiProxyBuilder Class Reference
Inheritance diagram for FWCSCWireDigiProxyBuilder:
FWProxyBuilderBase

Public Member Functions

 FWCSCWireDigiProxyBuilder ()
 
 REGISTER_PROXYBUILDER_METHODS ()
 
virtual ~FWCSCWireDigiProxyBuilder ()
 
- 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
 
virtual bool haveSingleProduct () 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 build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
 FWCSCWireDigiProxyBuilder (const FWCSCWireDigiProxyBuilder &)
 
double getAverageWireSpacing (const int station, const int ring)
 
double getYOfFirstWire (const int station, const int ring, const double length)
 
const FWCSCWireDigiProxyBuilderoperator= (const FWCSCWireDigiProxyBuilder &)
 

Additional Inherited Members

- 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 FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
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)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 25 of file FWCSCWireDigiProxyBuilder.cc.

Constructor & Destructor Documentation

FWCSCWireDigiProxyBuilder::FWCSCWireDigiProxyBuilder ( )
inline

Definition at line 28 of file FWCSCWireDigiProxyBuilder.cc.

28 {}
virtual FWCSCWireDigiProxyBuilder::~FWCSCWireDigiProxyBuilder ( )
inlinevirtual

Definition at line 29 of file FWCSCWireDigiProxyBuilder.cc.

29 {}
FWCSCWireDigiProxyBuilder::FWCSCWireDigiProxyBuilder ( const FWCSCWireDigiProxyBuilder )
private

Member Function Documentation

void FWCSCWireDigiProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext  
)
overrideprivatevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 103 of file FWCSCWireDigiProxyBuilder.cc.

References FWGeometry::contains(), FWProxyBuilderBase::createCompound(), fwLog, relativeConstraints::geom, FWEventItem::get(), getAverageWireSpacing(), FWEventItem::getGeom(), FWGeometry::getShapePars(), getYOfFirstWire(), fwlog::kWarning, FWGeometry::localToGlobal(), DetId::rawId(), CSCDetId::ring(), FWProxyBuilderBase::setupAddElement(), and CSCDetId::station().

104 {
105  const CSCWireDigiCollection* digis = 0;
106 
107  iItem->get(digis);
108 
109  if ( ! digis )
110  {
111  fwLog( fwlog::kWarning ) << "Failed to get CSCWireDigis" << std::endl;
112  return;
113  }
114  const FWGeometry *geom = iItem->getGeom();
115 
116  for ( CSCWireDigiCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end();
117  dri != driEnd; ++dri )
118  {
119  const CSCDetId& cscDetId = (*dri).first;
120  unsigned int rawid = cscDetId.rawId();
121  const CSCWireDigiCollection::Range& range = (*dri).second;
122 
123  if( ! geom->contains( rawid ))
124  {
125  fwLog( fwlog::kWarning ) << "Failed to get geometry of CSC chamber with detid: "
126  << rawid << std::endl;
127 
128  TEveCompound* compound = createCompound();
129  setupAddElement( compound, product );
130 
131  continue;
132  }
133 
134  const float* shape = geom->getShapePars( rawid );
135 
136  float length = shape[4];
137  float topWidth = shape[2];
138  float bottomWidth = shape[1];
139 
140  // NOTE: do not use parameters right now: need to sort out what is finally needed
141  //const float* parameters = iItem->getGeom()->getParameters( rawid );
142  //float wireSpacing = parameters[6];
143  double wireSpacing = getAverageWireSpacing(cscDetId.station(), cscDetId.ring());
144  //float wireAngle = parameters[7];
145  //float cosWireAngle = cos(wireAngle);
146 
147  double yOfFirstWire = getYOfFirstWire( cscDetId.station(), cscDetId.ring(), length );
148 
149  for ( CSCWireDigiCollection::const_iterator dit = range.first;
150  dit != range.second; ++dit )
151  {
152  TEveStraightLineSet* wireDigiSet = new TEveStraightLineSet();
153  wireDigiSet->SetLineWidth(3);
154  setupAddElement(wireDigiSet, product);
155 
156  int wireGroup = (*dit).getWireGroup();
157  float yOfWire = yOfFirstWire + ((wireGroup-1)*wireSpacing);
158  float wireLength = yOfWire*(topWidth-bottomWidth) / length;
159  wireLength += bottomWidth*2.0;
160 
161  float localPointLeft[3] =
162  {
163  static_cast<float>(-wireLength*0.5), yOfWire, static_cast<float>(0.0)
164  };
165 
166  // NOTE: This is only an approximation for slanted wires.
167  // Need to improve the determination of the x coordinate.
168  float localPointRight[3] =
169  {
170  static_cast<float>(wireLength*0.5), yOfWire, static_cast<float>(0.0)
171  //wireLength*0.5, yOfWire + wireLength*tan(wireAngle), 0.0
172  };
173 
174  float globalPointLeft[3];
175  float globalPointRight[3];
176 
177  geom->localToGlobal( rawid, localPointLeft, globalPointLeft, localPointRight, globalPointRight );
178 
179  wireDigiSet->AddLine( globalPointLeft[0], globalPointLeft[1], globalPointLeft[2],
180  globalPointRight[0], globalPointRight[1], globalPointRight[2] );
181  }
182  }
183 }
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:84
double getAverageWireSpacing(const int station, const int ring)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:309
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:325
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
int ring() const
Definition: CSCDetId.h:77
#define fwLog(_level_)
Definition: fwLog.h:50
std::vector< CSCWireDigi >::const_iterator const_iterator
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
int station() const
Definition: CSCDetId.h:88
std::pair< const_iterator, const_iterator > Range
double getYOfFirstWire(const int station, const int ring, const double length)
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
double FWCSCWireDigiProxyBuilder::getAverageWireSpacing ( const int  station,
const int  ring 
)
private

Definition at line 75 of file FWCSCWireDigiProxyBuilder.cc.

Referenced by build().

76 {
77  // return radialExtentOfTheWirePlane / numOfWireGroups
78  // These numbers come from cscSpec.xml
79 
80  if ( ring == 2 )
81  {
82  if ( station == 1 )
83  return 174.81/64;
84  else
85  return 323.38/64;
86  }
87 
88  if ( station == 1 && (ring == 1 || ring == 4))
89  return 150.5/48;
90  if ( station == 1 && ring == 3 )
91  return 164.47/32;
92  if ( station == 2 && ring == 1 )
93  return 189.97/112;
94  if ( station == 3 && ring == 1 )
95  return 170.01/96;
96  if ( station == 4 && ring == 1 )
97  return 149.73/96;
98 
99  return 0.0;
100 }
double FWCSCWireDigiProxyBuilder::getYOfFirstWire ( const int  station,
const int  ring,
const double  length 
)
private

Definition at line 45 of file FWCSCWireDigiProxyBuilder.cc.

Referenced by build().

46 {
47  double yAlignmentFrame = 3.49;
48  double alignmentPinToFirstWire;
49 
50  if ( station == 1 )
51  {
52  if ( ring == 1 || ring == 4 )
53  {
54  alignmentPinToFirstWire = 1.065;
55  yAlignmentFrame = 0.0;
56  }
57 
58  else // ME12, ME 13
59  alignmentPinToFirstWire = 2.85;
60  }
61 
62  else if ( station == 4 && ring == 1 )
63  alignmentPinToFirstWire = 3.04;
64 
65  else if ( station == 3 && ring == 1 )
66  alignmentPinToFirstWire = 2.84;
67 
68  else // ME21, ME22, ME32, ME42
69  alignmentPinToFirstWire = 2.87;
70 
71  return (yAlignmentFrame-length) + alignmentPinToFirstWire;
72 }
const FWCSCWireDigiProxyBuilder& FWCSCWireDigiProxyBuilder::operator= ( const FWCSCWireDigiProxyBuilder )
private
FWCSCWireDigiProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )