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
FWRPZViewGeometry Class Reference

#include <Fireworks/Core/interface/FWRPZViewGeometry.h>

Inheritance diagram for FWRPZViewGeometry:
FWViewGeometryList

Public Member Functions

 FWRPZViewGeometry (const fireworks::Context &context)
 
TEveElement * getGeoElements (const FWViewType::EType id)
 
virtual ~FWRPZViewGeometry ()
 
- Public Member Functions inherited from FWViewGeometryList
 FWViewGeometryList (const fireworks::Context &context, bool projected=true)
 
void updateColors ()
 
void updateTransparency (bool projectedType)
 
virtual ~FWViewGeometryList ()
 

Private Member Functions

void estimateProjectionSize (const float *, float &, float &, float &, float &)
 
void estimateProjectionSizeCSC (const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
 
void estimateProjectionSizeDT (const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
 
 FWRPZViewGeometry (const FWRPZViewGeometry &)
 
TEveElement * makeCaloOutlineRhoPhi ()
 
TEveElement * makeCaloOutlineRhoZ ()
 
TEveElement * makeMuonGeometryRhoPhi ()
 
TEveElement * makeMuonGeometryRhoZ ()
 
TEveGeoShape * makeShape (double, double, double, double)
 
const FWRPZViewGeometryoperator= (const FWRPZViewGeometry &)
 

Private Attributes

TEveElementList * m_rhoPhiGeo
 
TEveElementList * m_rhoZGeo
 

Additional Inherited Members

- Protected Member Functions inherited from FWViewGeometryList
void addToCompound (TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
 
- Protected Attributes inherited from FWViewGeometryList
TEveCompound * m_colorComp [kFWGeomColorSize]
 
const fireworks::Contextm_context
 
const FWGeometrym_geom
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 33 of file FWRPZViewGeometry.h.

Constructor & Destructor Documentation

FWRPZViewGeometry::FWRPZViewGeometry ( const fireworks::Context context)

Definition at line 51 of file FWRPZViewGeometry.cc.

51  :
52  FWViewGeometryList(context),
53  m_rhoPhiGeo(0),
54  m_rhoZGeo(0)
55 {
56  SetElementName("RPZGeomShared");
57 }
TEveElementList * m_rhoPhiGeo
FWViewGeometryList(const fireworks::Context &context, bool projected=true)
TEveElementList * m_rhoZGeo
FWRPZViewGeometry::~FWRPZViewGeometry ( )
virtual

Definition at line 64 of file FWRPZViewGeometry.cc.

References m_rhoPhiGeo, and m_rhoZGeo.

65 {
66  m_rhoPhiGeo->DecDenyDestroy();
67  m_rhoZGeo->DecDenyDestroy();
68 }
TEveElementList * m_rhoPhiGeo
TEveElementList * m_rhoZGeo
FWRPZViewGeometry::FWRPZViewGeometry ( const FWRPZViewGeometry )
private

Member Function Documentation

void FWRPZViewGeometry::estimateProjectionSize ( const float *  global,
float &  min_rho,
float &  max_rho,
float &  min_z,
float &  max_z 
)
private

Definition at line 378 of file FWRPZViewGeometry.cc.

References rho, and mathSSE::sqrt().

Referenced by estimateProjectionSizeCSC(), and estimateProjectionSizeDT().

380 {
381  double rho = sqrt(global[0] *global[0]+global[1] *global[1]);
382  if ( min_rho > rho ) min_rho = rho;
383  if ( max_rho < rho ) max_rho = rho;
384  if ( min_z > global[2] ) min_z = global[2];
385  if ( max_z < global[2] ) max_z = global[2];
386 }
Definition: DDAxes.h:10
T sqrt(T t)
Definition: SSEVec.h:28
void FWRPZViewGeometry::estimateProjectionSizeCSC ( const FWGeometry::GeomDetInfo info,
float &  min_rho,
float &  max_rho,
float &  min_z,
float &  max_z 
)
private

Definition at line 350 of file FWRPZViewGeometry.cc.

References estimateProjectionSize(), FWGeometry::localToGlobal(), FWViewGeometryList::m_geom, FWGeometry::GeomDetInfo::shape, and mathSSE::sqrt().

Referenced by makeMuonGeometryRhoZ().

352 {
353  float local[3], global[3];
354 
355  float dX = info.shape[2] - info.shape[1];
356  float dY = info.shape[4];
357  float ddY = sqrt( 4 * dY * dY + dX * dX ) * 0.5;
358  float dZ = info.shape[3];
359 
360  local[0] = info.shape[2]; local[1] = ddY; local[2] = -dZ;
361  m_geom->localToGlobal( info, local, global );
362  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
363 
364  local[0] = info.shape[1]; local[1] = -ddY; local[2] = -dZ;
365  m_geom->localToGlobal( info, local, global );
366  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
367 
368  local[0] = info.shape[1]; local[1] = -ddY; local[2] = dZ;
369  m_geom->localToGlobal( info, local, global );
370  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
371 
372  local[0] = info.shape[2]; local[1] = ddY; local[2] = dZ;
373  m_geom->localToGlobal( info, local, global );
374  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
375 }
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
void estimateProjectionSize(const float *, float &, float &, float &, float &)
T sqrt(T t)
Definition: SSEVec.h:28
const FWGeometry * m_geom
void FWRPZViewGeometry::estimateProjectionSizeDT ( const FWGeometry::GeomDetInfo info,
float &  min_rho,
float &  max_rho,
float &  min_z,
float &  max_z 
)
private

Definition at line 298 of file FWRPZViewGeometry.cc.

References estimateProjectionSize(), FWGeometry::localToGlobal(), FWViewGeometryList::m_geom, and FWGeometry::GeomDetInfo::shape.

Referenced by makeMuonGeometryRhoZ().

300 {
301  // we will test 5 points on both sides ( +/- z)
302  float local[3], global[3];
303 
304  float dX = info.shape[1];
305  float dY = info.shape[2];
306  float dZ = info.shape[3];
307 
308  local[0] = 0; local[1] = 0; local[2] = dZ;
309  m_geom->localToGlobal( info, local, global );
310  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
311 
312  local[0] = dX; local[1] = dY; local[2] = dZ;
313  m_geom->localToGlobal( info, local, global );
314  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
315 
316  local[0] = -dX; local[1] = dY; local[2] = dZ;
317  m_geom->localToGlobal( info, local, global );
318  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
319 
320  local[0] = dX; local[1] = -dY; local[2] = dZ;
321  m_geom->localToGlobal( info, local, global );
322  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
323 
324  local[0] = -dX; local[1] = -dY; local[2] = dZ;
325  m_geom->localToGlobal( info, local, global );
326  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
327 
328  local[0] = 0; local[1] = 0; local[2] = -dZ;
329  m_geom->localToGlobal( info, local, global );
330  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
331 
332  local[0] = dX; local[1] = dY; local[2] = -dZ;
333  m_geom->localToGlobal( info, local, global );
334  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
335 
336  local[0] = -dX; local[1] = dY; local[2] = -dZ;
337  m_geom->localToGlobal( info, local, global );
338  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
339 
340  local[0] = dX; local[1] = -dY; local[2] = -dZ;
341  m_geom->localToGlobal( info, local, global );
342  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
343 
344  local[0] = -dX; local[1] = -dY; local[2] = -dZ;
345  m_geom->localToGlobal( info, local, global );
346  estimateProjectionSize( global, min_rho, max_rho, min_z, max_z );
347 }
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
void estimateProjectionSize(const float *, float &, float &, float &, float &)
const FWGeometry * m_geom
TEveElement * FWRPZViewGeometry::getGeoElements ( const FWViewType::EType  id)

Definition at line 74 of file FWRPZViewGeometry.cc.

References FWViewType::kRhoZ, FWViewGeometryList::m_geom, m_rhoPhiGeo, m_rhoZGeo, makeCaloOutlineRhoPhi(), makeCaloOutlineRhoZ(), makeMuonGeometryRhoPhi(), and makeMuonGeometryRhoZ().

Referenced by FWRPZView::setContext().

75 {
76  if( !m_geom ) return ( new TEveCompound( "dummy" ));
77 
78  if (type == FWViewType::kRhoZ)
79  {
80  if ( !m_rhoZGeo)
81  {
82  m_rhoZGeo = new TEveElementList("Geometry RhoZ");
83 
84  m_rhoZGeo->IncDenyDestroy();
85  m_rhoZGeo->AddElement(makeMuonGeometryRhoZ());
86  m_rhoZGeo->AddElement(makeCaloOutlineRhoZ());
87  }
88  return m_rhoZGeo;
89  }
90  else
91  {
92  if ( !m_rhoPhiGeo)
93  {
94  m_rhoPhiGeo = new TEveElementList("Geometry RhoPhi");
95  m_rhoPhiGeo->IncDenyDestroy();
96  m_rhoPhiGeo->AddElement(makeMuonGeometryRhoPhi());
97  m_rhoPhiGeo->AddElement(makeCaloOutlineRhoPhi());
98 
99  }
100  return m_rhoPhiGeo;
101  }
102  return 0;
103 }
type
Definition: HCALResponse.h:22
TEveElementList * m_rhoPhiGeo
TEveElement * makeCaloOutlineRhoPhi()
TEveElement * makeMuonGeometryRhoPhi()
const FWGeometry * m_geom
TEveElementList * m_rhoZGeo
TEveElement * makeCaloOutlineRhoZ()
TEveElement * makeMuonGeometryRhoZ()
TEveElement * FWRPZViewGeometry::makeCaloOutlineRhoPhi ( )
private

Definition at line 132 of file FWRPZViewGeometry.cc.

References FWViewGeometryList::addToCompound(), fireworks::Context::caloR1(), fireworks::Context::colorManager(), funct::cos(), FWColorManager::geomColor(), i, kFWTrackerBarrelColorIndex, FWViewGeometryList::m_context, csvReporter::r, funct::sin(), and TwoPi.

Referenced by getGeoElements().

133 {
134  TEveStraightLineSet* el = new TEveStraightLineSet( "TrackerRhoPhi" );
136 
138  const unsigned int nSegments = 100;
139  const double r = m_context.caloR1();
140  for ( unsigned int i = 1; i <= nSegments; ++i )
141  el->AddLine(r*sin(TMath::TwoPi()/nSegments*(i-1)), r*cos(TMath::TwoPi()/nSegments*(i-1)), 0,
142  r*sin(TMath::TwoPi()/nSegments*i), r*cos(TMath::TwoPi()/nSegments*i), 0);
143 
144  TEvePointSet* ref = new TEvePointSet("reference");
145  ref->SetTitle("(0,0,0)");
146  ref->SetMarkerStyle(4);
147  ref->SetMarkerColor(kWhite);
148  ref->SetNextPoint(0.,0.,0.);
149  el->AddElement(ref);
150 
151  return el;
152 }
const double TwoPi
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
FWColorManager * colorManager() const
Definition: Context.h:66
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static float caloR1(bool offset=true)
Definition: Context.cc:210
Color_t geomColor(FWGeomColorIndex) const
const fireworks::Context & m_context
TEveElement * FWRPZViewGeometry::makeCaloOutlineRhoZ ( )
private

Definition at line 109 of file FWRPZViewGeometry.cc.

References FWViewGeometryList::addToCompound(), fireworks::Context::caloMaxEta(), fireworks::Context::caloR1(), fireworks::Context::caloR2(), fireworks::Context::caloZ1(), fireworks::Context::caloZ2(), funct::exp(), kFWTrackerBarrelColorIndex, FWViewGeometryList::m_context, and funct::tan().

Referenced by getGeoElements().

110 {
111  using namespace fireworks;
112 
113  float ri = m_context.caloZ2()*tan(2*atan(exp(-m_context.caloMaxEta())));
114 
115  TEveStraightLineSet* el = new TEveStraightLineSet( "TrackerRhoZoutline" );
116  el->SetPickable(kFALSE);
118 
119  el->AddLine(0, m_context.caloR1(), -m_context.caloZ1(), 0, m_context.caloR1(), m_context.caloZ1());
120  el->AddLine(0, -m_context.caloR1(), m_context.caloZ1(), 0, -m_context.caloR1(), -m_context.caloZ1());
121 
122  el->AddLine(0, -m_context.caloR2(), m_context.caloZ2(), 0, -ri, m_context.caloZ2());
123  el->AddLine(0, ri, m_context.caloZ2(), 0, m_context.caloR2(), m_context.caloZ2());
124 
125  el->AddLine(0, -m_context.caloR2(), -m_context.caloZ2(), 0, -ri, -m_context.caloZ2());
126  el->AddLine(0, ri, -m_context.caloZ2(), 0, m_context.caloR2(), -m_context.caloZ2());
127 
128  return el;
129 }
static float caloZ2(bool offset=true)
Definition: Context.cc:225
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
static float caloR2(bool offset=true)
Definition: Context.cc:215
static float caloR1(bool offset=true)
Definition: Context.cc:210
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static double caloMaxEta()
Definition: Context.cc:240
static float caloZ1(bool offset=true)
Definition: Context.cc:220
const fireworks::Context & m_context
TEveElement * FWRPZViewGeometry::makeMuonGeometryRhoPhi ( void  )
private

Definition at line 157 of file FWRPZViewGeometry.cc.

References FWViewGeometryList::addToCompound(), FWGeometry::getEveShape(), kFWMuonBarrelLineColorIndex, FWViewGeometryList::m_colorComp, and FWViewGeometryList::m_geom.

Referenced by getGeoElements().

158 {
159  Int_t iWheel = 0;
160 
161  // rho-phi view
162  TEveCompound* container = new TEveCompound( "MuonRhoPhi" );
163 
164 
165  for( Int_t iStation = 1; iStation <= 4; ++iStation )
166  {
167  for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
168  {
169  if( iStation < 4 && iSector > 12 ) continue;
170  DTChamberId id( iWheel, iStation, iSector );
171  TEveGeoShape* shape = m_geom->getEveShape( id.rawId() );
172  if( shape )
173  {
174  shape->SetMainColor(m_colorComp[kFWMuonBarrelLineColorIndex]->GetMainColor());
176  container->AddElement( shape );
177  }
178  }
179  }
180  return container;
181 }
TEveCompound * m_colorComp[kFWGeomColorSize]
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:251
const FWGeometry * m_geom
TEveElement * FWRPZViewGeometry::makeMuonGeometryRhoZ ( void  )
private

Definition at line 186 of file FWRPZViewGeometry.cc.

References FWViewGeometryList::addToCompound(), estimateProjectionSizeCSC(), estimateProjectionSizeDT(), FWGeometry::find(), kFWMuonBarrelLineColorIndex, kFWMuonEndcapLineColorIndex, FWViewGeometryList::m_geom, makeShape(), DetId::rawId(), and launcher::step.

Referenced by getGeoElements().

187 {
188  TEveElementList* container = new TEveElementList( "MuonRhoZ" );
189 
190  {
191  TEveCompound* dtContainer = new TEveCompound( "DT" );
192  for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
193  {
194  for( Int_t iStation = 1; iStation <= 4; ++iStation )
195  {
196  float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
197 
198  // This will give us a quarter of DTs
199  // which is enough for our projection
200  for( Int_t iSector = 1; iSector <= 4; ++iSector )
201  {
202  DTChamberId id( iWheel, iStation, iSector );
203  unsigned int rawid = id.rawId();
204  FWGeometry::IdToInfoItr det = m_geom->find( rawid );
205  estimateProjectionSizeDT( *det, min_rho, max_rho, min_z, max_z );
206  }
207  if ( min_rho > max_rho || min_z > max_z ) continue;
208  TEveElement* se = makeShape( min_rho, max_rho, min_z, max_z );
210  dtContainer->AddElement(se);
211  se = makeShape( -max_rho, -min_rho, min_z, max_z );
213  dtContainer->AddElement(se);
214  }
215  }
216 
217  container->AddElement( dtContainer );
218  }
219  {
220  TEveCompound* cscContainer = new TEveCompound( "CSC" );
221 
222  Int_t maxChambers = 36;
223  Int_t step = 9;
224  Int_t iLayer = 0; // chamber
225  for( Int_t iEndcap = 1; iEndcap <= 2; ++iEndcap ) // 1=forward (+Z), 2=backward(-Z)
226  {
227  // Actual CSC geometry:
228  // Station 1 has 4 rings with 36 chambers in each
229  // Station 2: ring 1 has 18 chambers, ring 2 has 36 chambers
230  // Station 3: ring 1 has 18 chambers, ring 2 has 36 chambers
231  // Station 4: ring 1 has 18 chambers
232  for( Int_t iStation = 1; iStation <= 4; ++iStation )
233  {
234  for( Int_t iRing = 1; iRing <= 4; ++iRing )
235  {
236  if( iStation > 1 && iRing > 2 ) continue;
237  if( iStation > 3 && iRing > 1 ) continue;
238  float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
239  ( iRing == 1 && iStation > 1 ) ? ( maxChambers = 18 ) : ( maxChambers = 36 );
240  ( iRing == 1 && iStation > 1 ) ? ( step = 5 ) : ( step = 18 );
241 
242  // Skip most of the chambers since they will project
243  // the same way as the two top ones and the two bottom ones
244  for( Int_t iChamber = step; iChamber <= maxChambers; iChamber += step )
245  {
246  CSCDetId id( iEndcap, iStation, iRing, iChamber, iLayer );
247  FWGeometry::IdToInfoItr det = m_geom->find( id.rawId() );
248  estimateProjectionSizeCSC( *det, min_rho, max_rho, min_z, max_z );
249 
250  // and a chamber next to it
251  ++iChamber;
252  CSCDetId nextid( iEndcap, iStation, iRing, iChamber, iLayer );
253  det = m_geom->find( nextid.rawId() );
254  estimateProjectionSizeCSC( *det, min_rho, max_rho, min_z, max_z );
255  }
256  if ( min_rho > max_rho || min_z > max_z ) continue;
257 
258  TEveElement* se = makeShape( min_rho, max_rho, min_z, max_z);
260  cscContainer->AddElement(se);
261 
262  se = makeShape( -max_rho, -min_rho, min_z, max_z );
264  cscContainer->AddElement(se);
265  }
266  }
267  }
268  container->AddElement( cscContainer );
269  }
270  return container;
271 }
list step
Definition: launcher.py:15
void estimateProjectionSizeDT(const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
void estimateProjectionSizeCSC(const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
TEveGeoShape * makeShape(double, double, double, double)
const FWGeometry * m_geom
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
TEveGeoShape * FWRPZViewGeometry::makeShape ( double  min_rho,
double  max_rho,
double  min_z,
double  max_z 
)
private

Definition at line 276 of file FWRPZViewGeometry.cc.

References matplotRender::t.

Referenced by makeMuonGeometryRhoZ().

277 {
278  TEveTrans t;
279  t(1,1) = 1; t(1,2) = 0; t(1,3) = 0;
280  t(2,1) = 0; t(2,2) = 1; t(2,3) = 0;
281  t(3,1) = 0; t(3,2) = 0; t(3,3) = 1;
282  t(1,4) = 0; t(2,4) = (min_rho+max_rho)/2; t(3,4) = (min_z+max_z)/2;
283 
284  TEveGeoShape* shape = new TEveGeoShape;
285  shape->SetTransMatrix(t.Array());
286 
287  shape->SetRnrSelf(kTRUE);
288  shape->SetRnrChildren(kTRUE);
289  TGeoBBox* box = new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
290  shape->SetShape( box );
291 
292  return shape;
293 }
const FWRPZViewGeometry& FWRPZViewGeometry::operator= ( const FWRPZViewGeometry )
private

Member Data Documentation

TEveElementList* FWRPZViewGeometry::m_rhoPhiGeo
private

Definition at line 62 of file FWRPZViewGeometry.h.

Referenced by getGeoElements(), and ~FWRPZViewGeometry().

TEveElementList* FWRPZViewGeometry::m_rhoZGeo
private

Definition at line 63 of file FWRPZViewGeometry.h.

Referenced by getGeoElements(), and ~FWRPZViewGeometry().