20 #include "TEveElement.h"
21 #include "TEveCompound.h"
22 #include "TEveScene.h"
23 #include "TEvePointSet.h"
24 #include "TEveStraightLineSet.h"
25 #include "TEveGeoNode.h"
26 #include "TEveManager.h"
27 #include "TEveProjectionManager.h"
57 m_pixelBarrelElements(0),
58 m_pixelEndcapElements(0),
59 m_trackerBarrelElements(0),
60 m_trackerEndcapElements(0)
62 SetElementName(
"RPZGeomShared");
101 using namespace fireworks;
105 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
106 el->SetPickable(kFALSE);
124 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
128 const unsigned int nSegments = 100;
130 for (
unsigned int i = 1;
i <= nSegments; ++
i )
134 TEvePointSet* ref =
new TEvePointSet(
"reference");
135 ref->SetTitle(
"(0,0,0)");
136 ref->SetMarkerStyle(4);
137 ref->SetMarkerColor(kWhite);
138 ref->SetNextPoint(0.,0.,0.);
152 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
155 for( Int_t iStation = 1; iStation <= 4; ++iStation )
157 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
159 if( iStation < 4 && iSector > 12 )
continue;
166 container->AddElement( shape );
178 TEveElementList* container =
new TEveElementList(
"MuonRhoZ" );
181 TEveCompound* dtContainer =
new TEveCompound(
"DT" );
182 for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
184 for( Int_t iStation = 1; iStation <= 4; ++iStation )
186 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
190 for( Int_t iSector = 1; iSector <= 4; ++iSector )
193 unsigned int rawid =
id.rawId();
197 if ( min_rho > max_rho || min_z > max_z )
continue;
198 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z );
200 dtContainer->AddElement(se);
201 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
203 dtContainer->AddElement(se);
207 container->AddElement( dtContainer );
210 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
212 Int_t maxChambers = 36;
215 for( Int_t iEndcap = 1; iEndcap <= 2; ++iEndcap )
222 for( Int_t iStation = 1; iStation <= 4; ++iStation )
224 for( Int_t iRing = 1; iRing <= 4; ++iRing )
226 if( iStation > 1 && iRing > 2 )
continue;
227 if( iStation > 3 && iRing > 1 )
continue;
228 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
229 ( iRing == 1 && iStation > 1 ) ? ( maxChambers = 18 ) : ( maxChambers = 36 );
230 ( iRing == 1 && iStation > 1 ) ? ( step = 5 ) : ( step = 18 );
234 for( Int_t iChamber = step; iChamber <= maxChambers; iChamber +=
step )
236 CSCDetId id( iEndcap, iStation, iRing, iChamber, iLayer );
242 CSCDetId nextid( iEndcap, iStation, iRing, iChamber, iLayer );
246 if ( min_rho > max_rho || min_z > max_z )
continue;
248 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z);
250 cscContainer->AddElement(se);
252 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
254 cscContainer->AddElement(se);
258 container->AddElement( cscContainer );
269 t(1,1) = 1;
t(1,2) = 0;
t(1,3) = 0;
270 t(2,1) = 0;
t(2,2) = 1;
t(2,3) = 0;
271 t(3,1) = 0;
t(3,2) = 0;
t(3,3) = 1;
272 t(1,4) = 0;
t(2,4) = (min_rho+max_rho)/2;
t(3,4) = (min_z+max_z)/2;
274 TEveGeoShape* shape =
new TEveGeoShape;
275 shape->SetTransMatrix(t.Array());
277 shape->SetRnrSelf(kTRUE);
278 shape->SetRnrChildren(kTRUE);
279 TGeoBBox* box =
new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
280 shape->SetShape( box );
289 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
292 float local[3], global[3];
294 float dX = info.
shape[1];
295 float dY = info.
shape[2];
296 float dZ = info.
shape[3];
298 local[0] = 0; local[1] = 0; local[2] = dZ;
302 local[0] = dX; local[1] = dY; local[2] = dZ;
306 local[0] = -dX; local[1] = dY; local[2] = dZ;
310 local[0] = dX; local[1] = -dY; local[2] = dZ;
314 local[0] = -dX; local[1] = -dY; local[2] = dZ;
318 local[0] = 0; local[1] = 0; local[2] = -dZ;
322 local[0] = dX; local[1] = dY; local[2] = -dZ;
326 local[0] = -dX; local[1] = dY; local[2] = -dZ;
330 local[0] = dX; local[1] = -dY; local[2] = -dZ;
334 local[0] = -dX; local[1] = -dY; local[2] = -dZ;
341 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
343 float local[3], global[3];
346 float dY = info.
shape[4];
347 float ddY =
sqrt( 4 * dY * dY + dX * dX ) * 0.5;
348 float dZ = info.
shape[3];
350 local[0] = info.
shape[2]; local[1] = ddY; local[2] = -dZ;
354 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = -dZ;
358 local[0] = info.
shape[1]; local[1] = -ddY; local[2] = dZ;
362 local[0] = info.
shape[2]; local[1] = ddY; local[2] = dZ;
369 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
371 double rho =
sqrt(global[0] *global[0]+global[1] *global[1]);
372 if ( min_rho > rho ) min_rho =
rho;
373 if ( max_rho < rho ) max_rho =
rho;
374 if ( min_z > global[2] ) min_z = global[2];
375 if ( max_z < global[2] ) max_z = global[2];
402 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
403 id != ids.end(); ++id )
406 shape->SetTitle(Form(
"PixelBarrel %d",*
id));
428 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
429 id != ids.end(); ++id )
433 shape->SetTitle(Form(
"PixelEndCap %d",*
id));
458 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
459 id != ids.end(); ++id )
466 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
467 id != ids.end(); ++id )
471 shape->SetTitle(Form(
"TrackerBarrel %d",*
id));
495 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
496 id != ids.end(); ++id )
503 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
504 id != ids.end(); ++id )
508 shape->SetTitle(Form(
"TrackerEndcap %d",*
id));
527 TEveProjected* proj = *BeginProjecteds();
528 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)
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)
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
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