21 #include "TEveElement.h"
22 #include "TEveCompound.h"
23 #include "TEveScene.h"
24 #include "TEvePointSet.h"
25 #include "TEveStraightLineSet.h"
26 #include "TEveGeoNode.h"
27 #include "TEveManager.h"
28 #include "TEveProjectionManager.h"
58 m_pixelBarrelElements(0),
59 m_pixelEndcapElements(0),
60 m_trackerBarrelElements(0),
61 m_trackerEndcapElements(0)
63 SetElementName(
"RPZGeomShared");
102 using namespace fireworks;
106 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
107 el->SetPickable(kFALSE);
125 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
129 const unsigned int nSegments = 100;
131 for (
unsigned int i = 1;
i <= nSegments; ++
i )
135 TEvePointSet* ref =
new TEvePointSet(
"reference");
136 ref->SetTitle(
"(0,0,0)");
137 ref->SetMarkerStyle(4);
138 ref->SetMarkerColor(kWhite);
139 ref->SetNextPoint(0.,0.,0.);
153 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
156 for( Int_t iStation = 1; iStation <= 4; ++iStation )
158 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
160 if( iStation < 4 && iSector > 12 )
continue;
167 container->AddElement( shape );
179 TEveElementList* container =
new TEveElementList(
"MuonRhoZ" );
182 TEveCompound* dtContainer =
new TEveCompound(
"DT" );
183 for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
185 for( Int_t iStation = 1; iStation <= 4; ++iStation )
187 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
191 for( Int_t iSector = 1; iSector <= 4; ++iSector )
194 unsigned int rawid =
id.rawId();
198 if ( min_rho > max_rho || min_z > max_z )
continue;
199 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z );
201 dtContainer->AddElement(se);
202 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
204 dtContainer->AddElement(se);
208 container->AddElement( dtContainer );
211 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
213 Int_t maxChambers = 36;
216 for( Int_t iEndcap = 1; iEndcap <= 2; ++iEndcap )
223 for( Int_t iStation = 1; iStation <= 4; ++iStation )
225 for( Int_t iRing = 1; iRing <= 4; ++iRing )
227 if( iStation > 1 && iRing > 2 )
continue;
228 if( iStation > 3 && iRing > 1 )
continue;
229 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
230 ( iRing == 1 && iStation > 1 ) ? ( maxChambers = 18 ) : ( maxChambers = 36 );
231 ( iRing == 1 && iStation > 1 ) ? ( step = 5 ) : ( step = 18 );
235 for( Int_t iChamber = step; iChamber <= maxChambers; iChamber +=
step )
237 CSCDetId id( iEndcap, iStation, iRing, iChamber, iLayer );
243 CSCDetId nextid( iEndcap, iStation, iRing, iChamber, iLayer );
247 if ( min_rho > max_rho || min_z > max_z )
continue;
249 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z);
251 cscContainer->AddElement(se);
253 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
255 cscContainer->AddElement(se);
259 container->AddElement( cscContainer );
270 t(1,1) = 1;
t(1,2) = 0;
t(1,3) = 0;
271 t(2,1) = 0;
t(2,2) = 1;
t(2,3) = 0;
272 t(3,1) = 0;
t(3,2) = 0;
t(3,3) = 1;
273 t(1,4) = 0;
t(2,4) = (min_rho+max_rho)/2;
t(3,4) = (min_z+max_z)/2;
275 TEveGeoShape* shape =
new TEveGeoShape;
276 shape->SetTransMatrix(t.Array());
278 shape->SetRnrSelf(kTRUE);
279 shape->SetRnrChildren(kTRUE);
280 TGeoBBox* box =
new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
281 shape->SetShape( box );
290 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
293 float local[3], global[3];
295 float dX = info.
shape[1];
296 float dY = info.
shape[2];
297 float dZ = info.
shape[3];
299 local[0] = 0; local[1] = 0; local[2] = dZ;
303 local[0] = dX; local[1] = dY; local[2] = dZ;
307 local[0] = -dX; local[1] = dY; local[2] = dZ;
311 local[0] = dX; local[1] = -dY; local[2] = dZ;
315 local[0] = -dX; local[1] = -dY; local[2] = dZ;
319 local[0] = 0; local[1] = 0; local[2] = -dZ;
323 local[0] = dX; local[1] = dY; local[2] = -dZ;
327 local[0] = -dX; local[1] = dY; local[2] = -dZ;
331 local[0] = dX; local[1] = -dY; local[2] = -dZ;
335 local[0] = -dX; local[1] = -dY; local[2] = -dZ;
342 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
344 float local[3], global[3];
347 float dY = info.
shape[4];
348 float ddY =
sqrt( 4 * dY * dY + dX * dX ) * 0.5;
349 float dZ = info.
shape[3];
351 local[0] = info.
shape[2]; local[1] = ddY; local[2] = -dZ;
355 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = -dZ;
359 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = dZ;
363 local[0] = info.
shape[2]; local[1] = ddY; local[2] = dZ;
370 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
372 double rho =
sqrt(global[0] *global[0]+global[1] *global[1]);
373 if ( min_rho > rho ) min_rho =
rho;
374 if ( max_rho < rho ) max_rho =
rho;
375 if ( min_z > global[2] ) min_z = global[2];
376 if ( max_z < global[2] ) max_z = global[2];
403 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
404 id != ids.end(); ++id )
407 shape->SetTitle(Form(
"PixelBarrel %d",*
id));
429 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
430 id != ids.end(); ++id )
434 shape->SetTitle(Form(
"PixelEndCap %d",*
id));
459 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
460 id != ids.end(); ++id )
467 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
468 id != ids.end(); ++id )
472 shape->SetTitle(Form(
"TrackerBarrel %d",*
id));
496 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
497 id != ids.end(); ++id )
504 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
505 id != ids.end(); ++id )
509 shape->SetTitle(Form(
"TrackerEndcap %d",*
id));
528 TEveProjected*
proj = *BeginProjecteds();
529 proj->GetManager()->SubImportElements(x, proj->GetProjectedAsElement());
TEveElementList * m_pixelBarrelElements
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)
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)
void initStdGeoElements(const FWViewType::EType id)
static float caloR2(bool offset=true)
TEveElement * makeMuonGeometryRhoPhi()
void importNew(TEveElementList *x)
TEveElementList * m_trackerBarrelElements
void estimateProjectionSize(const float *, float &, float &, float &, float &)
TEveGeoShape * getEveShape(unsigned int id) const
TEveElementList * m_pixelEndcapElements
Cos< T >::type cos(const T &t)
static float caloR1(bool offset=true)
Tan< T >::type tan(const T &t)
const FWGeometry * m_geom
void showPixelEndcap(bool)
TEveElementList * m_rhoZGeo
void showPixelBarrel(bool)
TEveElement * makeCaloOutlineRhoZ()
void showTrackerBarrel(bool)
TEveElementList * m_trackerEndcapElements
std::vector< unsigned int > getMatchedIds(Detector det, SubDetector subdet) const
TEveElement * makeMuonGeometryRhoZ()
static double caloMaxEta()
static float caloZ1(bool offset=true)
void showTrackerEndcap(bool)
Color_t geomColor(FWGeomColorIndex) const
const fireworks::Context & m_context
virtual ~FWRPZViewGeometry()
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr