CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWME0DigiProxyBuilder.cc
Go to the documentation of this file.
1 //#include "TEveStraightLineSet.h"
2 #include "TEveBoxSet.h"
3 #include "TEveCompound.h"
4 #include "TEveGeoNode.h"
5 
10 
14 
16 {
17 public:
20 
22 
23 private:
24  virtual void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*);
27 };
28 
29 void FWME0DigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*)
30 {
31  const ME0DigiPreRecoCollection* digis = 0;
32 
33  iItem->get(digis);
34 
35  if ( ! digis )
36  {
37  fwLog(fwlog::kWarning)<<"Failed to get ME0Digis"<<std::endl;
38  return;
39  }
40  const FWGeometry *geom = iItem->getGeom();
41 
42  for ( ME0DigiPreRecoCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end();
43  dri != driEnd; ++dri )
44  {
45  unsigned int rawid = (*dri).first.rawId();
46  const ME0DigiPreRecoCollection::Range& range = (*dri).second;
47 
48  if( ! geom->contains( rawid ))
49  {
50  fwLog( fwlog::kWarning ) << "Failed to get geometry of ME0 roll with detid: "
51  << rawid << std::endl;
52 
53  TEveCompound* compound = createCompound();
54  setupAddElement( compound, product );
55 
56  continue;
57  }
58 
59  for( ME0DigiPreRecoCollection::const_iterator dit = range.first;
60  dit != range.second; ++dit )
61  {
62  TEveBoxSet* stripDigiSet = new TEveBoxSet;
63  setupAddElement( stripDigiSet, product );
64 
65  float localPoint[3] = {(*dit).x(), (*dit).y(), 0.0};
66  float globalPoint[3];
67 
68  geom->localToGlobal( rawid, localPoint, globalPoint);
69 
70  stripDigiSet->AddBox(globalPoint[0], globalPoint[1], globalPoint[2],
71  (*dit).ex(), (*dit).ey(), 0.1);
72  }
73  }
74 }
75 
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
static const int kAll3DBits
Definition: FWViewType.h:59
const FWME0DigiProxyBuilder & operator=(const FWME0DigiProxyBuilder &)
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:328
bool contains(unsigned int id) const
Definition: FWGeometry.h:109
#define fwLog(_level_)
Definition: fwLog.h:50
std::vector< ME0DigiPreReco >::const_iterator const_iterator
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
std::pair< const_iterator, const_iterator > Range
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683