22 #include "TEveElement.h"
23 #include "TEveCompound.h"
24 #include "TEveScene.h"
25 #include "TEvePointSet.h"
26 #include "TEveStraightLineSet.h"
27 #include "TEveGeoNode.h"
56 SetElementName(
"RPZGeomShared");
76 if( !
m_geom )
return (
new TEveCompound(
"dummy" ));
82 m_rhoZGeo =
new TEveElementList(
"Geomtery RhoZ");
94 m_rhoPhiGeo =
new TEveElementList(
"Geomtery RhoPhi");
111 using namespace fireworks;
115 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
116 el->SetPickable(kFALSE);
134 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
138 const unsigned int nSegments = 100;
140 for (
unsigned int i = 1;
i <= nSegments; ++
i )
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.);
162 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
165 for( Int_t iStation = 1; iStation <= 4; ++iStation )
167 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
169 if( iStation < 4 && iSector > 12 )
continue;
176 container->AddElement( shape );
188 TEveElementList* container =
new TEveElementList(
"MuonRhoZ" );
191 TEveCompound* dtContainer =
new TEveCompound(
"DT" );
192 for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
194 for( Int_t iStation = 1; iStation <= 4; ++iStation )
196 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
200 for( Int_t iSector = 1; iSector <= 4; ++iSector )
203 unsigned int rawid =
id.rawId();
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);
217 container->AddElement( dtContainer );
220 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
222 Int_t maxChambers = 36;
225 for( Int_t iEndcap = 1; iEndcap <= 2; ++iEndcap )
232 for( Int_t iStation = 1; iStation <= 4; ++iStation )
234 for( Int_t iRing = 1; iRing <= 4; ++iRing )
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 );
244 for( Int_t iChamber = step; iChamber <= maxChambers; iChamber +=
step )
246 CSCDetId id( iEndcap, iStation, iRing, iChamber, iLayer );
252 CSCDetId nextid( iEndcap, iStation, iRing, iChamber, iLayer );
256 if ( min_rho > max_rho || min_z > max_z )
continue;
258 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z);
260 cscContainer->AddElement(se);
262 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
264 cscContainer->AddElement(se);
268 container->AddElement( cscContainer );
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;
284 TEveGeoShape* shape =
new TEveGeoShape;
285 shape->SetTransMatrix(t.Array());
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 );
299 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
302 float local[3], global[3];
304 float dX = info.
shape[1];
305 float dY = info.
shape[2];
306 float dZ = info.
shape[3];
308 local[0] = 0; local[1] = 0; local[2] = dZ;
312 local[0] = dX; local[1] = dY; local[2] = dZ;
316 local[0] = -dX; local[1] = dY; local[2] = dZ;
320 local[0] = dX; local[1] = -dY; local[2] = dZ;
324 local[0] = -dX; local[1] = -dY; local[2] = dZ;
328 local[0] = 0; local[1] = 0; local[2] = -dZ;
332 local[0] = dX; local[1] = dY; local[2] = -dZ;
336 local[0] = -dX; local[1] = dY; local[2] = -dZ;
340 local[0] = dX; local[1] = -dY; local[2] = -dZ;
344 local[0] = -dX; local[1] = -dY; local[2] = -dZ;
351 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
353 float local[3], global[3];
356 float dY = info.
shape[4];
357 float ddY =
sqrt( 4 * dY * dY + dX * dX ) * 0.5;
358 float dZ = info.
shape[3];
360 local[0] = info.
shape[2]; local[1] = ddY; local[2] = -dZ;
364 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = -dZ;
368 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = dZ;
372 local[0] = info.
shape[2]; local[1] = ddY; local[2] = dZ;
379 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
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];
TEveElement * getGeoElements(const FWViewType::EType id)
FWRPZViewGeometry(const fireworks::Context &context)
TEveCompound * m_colorComp[kFWGeomColorSize]
void estimateProjectionSizeDT(const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
IdToInfoItr find(unsigned int) const
TEveElementList * m_rhoPhiGeo
TEveElement * makeCaloOutlineRhoPhi()
void estimateProjectionSizeCSC(const FWGeometry::GeomDetInfo &info, float &, float &, float &, float &)
Sin< T >::type sin(const T &t)
FWColorManager * colorManager() const
static float caloZ2(bool offset=true)
Exp< T >::type exp(const T &t)
void localToGlobal(unsigned int id, const float *local, float *global) const
uint32_t rawId() const
get the raw id
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
TEveGeoShape * makeShape(double, double, double, double)
static float caloR2(bool offset=true)
TEveElement * makeMuonGeometryRhoPhi()
void estimateProjectionSize(const float *, float &, float &, float &, float &)
TEveGeoShape * getEveShape(unsigned int id) const
Cos< T >::type cos(const T &t)
static float caloR1(bool offset=true)
Tan< T >::type tan(const T &t)
const FWGeometry * m_geom
TEveElementList * m_rhoZGeo
TEveElement * makeCaloOutlineRhoZ()
TEveElement * makeMuonGeometryRhoZ()
static double caloMaxEta()
static float caloZ1(bool offset=true)
Color_t geomColor(FWGeomColorIndex) const
const fireworks::Context & m_context
virtual ~FWRPZViewGeometry()
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr