CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions
FWCSCWireDigiProxyBuilder Class Reference
Inheritance diagram for FWCSCWireDigiProxyBuilder:
FWProxyBuilderBase

Public Member Functions

 FWCSCWireDigiProxyBuilder ()
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
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 ()
 

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 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

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

- 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 104 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(), REGISTER_FWPROXYBUILDER, CSCDetId::ring(), FWProxyBuilderBase::setupAddElement(), and CSCDetId::station().

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

Definition at line 187 of file FWCSCWireDigiProxyBuilder.cc.

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

Definition at line 187 of file FWCSCWireDigiProxyBuilder.cc.

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

Definition at line 187 of file FWCSCWireDigiProxyBuilder.cc.

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

Definition at line 187 of file FWCSCWireDigiProxyBuilder.cc.

double FWCSCWireDigiProxyBuilder::getAverageWireSpacing ( const int  station,
const int  ring 
)
private

Definition at line 76 of file FWCSCWireDigiProxyBuilder.cc.

Referenced by build().

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

Definition at line 46 of file FWCSCWireDigiProxyBuilder.cc.

Referenced by build().

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

Definition at line 31 of file FWCSCWireDigiProxyBuilder.cc.

const std::string& FWCSCWireDigiProxyBuilder::typeName ( ) const
inline

Definition at line 31 of file FWCSCWireDigiProxyBuilder.cc.

const std::string& FWCSCWireDigiProxyBuilder::view ( ) const
inline

Definition at line 31 of file FWCSCWireDigiProxyBuilder.cc.