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"
59 m_pixelBarrelElements(0),
60 m_pixelEndcapElements(0),
61 m_trackerBarrelElements(0),
62 m_trackerEndcapElements(0),
63 m_rpcEndcapElements(0),
66 SetElementName(
"RPZGeomShared");
105 using namespace fireworks;
109 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
110 el->SetPickable(kFALSE);
128 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
132 const unsigned int nSegments = 100;
134 for (
unsigned int i = 1;
i <= nSegments; ++
i )
138 TEvePointSet* ref =
new TEvePointSet(
"reference");
139 ref->SetTitle(
"(0,0,0)");
140 ref->SetMarkerStyle(4);
141 ref->SetMarkerColor(kWhite);
142 ref->SetNextPoint(0.,0.,0.);
156 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
159 for( Int_t iStation = 1; iStation <= 4; ++iStation )
161 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
163 if( iStation < 4 && iSector > 12 )
continue;
170 container->AddElement( shape );
186 TEveElementList* container =
new TEveElementList(
"MuonRhoZ" );
189 TEveCompound* dtContainer =
new TEveCompound(
"DT" );
190 for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
192 for( Int_t iStation = 1; iStation <= 4; ++iStation )
194 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
198 for( Int_t iSector = 1; iSector <= 4; ++iSector )
201 unsigned int rawid =
id.rawId();
205 if ( min_rho > max_rho || min_z > max_z )
continue;
206 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z );
208 dtContainer->AddElement(se);
209 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
211 dtContainer->AddElement(se);
215 container->AddElement( dtContainer );
219 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
220 std::vector<CSCDetId> ids;
234 int off = (
station == 1) ? 10:0;
241 for (std::vector<CSCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
243 unsigned int rawid =
i->rawId();
246 shape->SetName(Form(
" e:%d r:%d s:%d chamber %d",
i->endcap(),
i->ring(),
i->station(),
i->chamber() ));
247 cscContainer->AddElement(shape);
249 container->AddElement( cscContainer );
261 t(1,1) = 1;
t(1,2) = 0;
t(1,3) = 0;
262 t(2,1) = 0;
t(2,2) = 1;
t(2,3) = 0;
263 t(3,1) = 0;
t(3,2) = 0;
t(3,3) = 1;
264 t(1,4) = 0;
t(2,4) = (min_rho+max_rho)/2;
t(3,4) = (min_z+max_z)/2;
266 TEveGeoShape* shape =
new TEveGeoShape;
267 shape->SetTransMatrix(t.Array());
269 shape->SetRnrSelf(kTRUE);
270 shape->SetRnrChildren(kTRUE);
271 TGeoBBox* box =
new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
272 shape->SetShape( box );
281 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
284 float local[3], global[3];
286 float dX = info.
shape[1];
287 float dY = info.
shape[2];
288 float dZ = info.
shape[3];
290 local[0] = 0; local[1] = 0; local[2] = dZ;
294 local[0] = dX; local[1] = dY; local[2] = dZ;
298 local[0] = -dX; local[1] = dY; 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] = 0; local[1] = 0; local[2] = -dZ;
314 local[0] = dX; local[1] = dY; local[2] = -dZ;
318 local[0] = -dX; local[1] = dY; local[2] = -dZ;
322 local[0] = dX; local[1] = -dY; local[2] = -dZ;
326 local[0] = -dX; local[1] = -dY; local[2] = -dZ;
334 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
336 double rho =
sqrt(global[0] *global[0]+global[1] *global[1]);
337 if ( min_rho > rho ) min_rho =
rho;
338 if ( max_rho < rho ) max_rho =
rho;
339 if ( min_z > global[2] ) min_z = global[2];
340 if ( max_z < global[2] ) max_z = global[2];
367 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
368 id != ids.end(); ++id )
371 shape->SetTitle(Form(
"PixelBarrel %d",*
id));
393 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
394 id != ids.end(); ++id )
398 shape->SetTitle(Form(
"PixelEndCap %d",*
id));
423 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
424 id != ids.end(); ++id )
431 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
432 id != ids.end(); ++id )
436 shape->SetTitle(Form(
"TrackerBarrel %d",*
id));
460 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
461 id != ids.end(); ++id )
468 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
469 id != ids.end(); ++id )
473 shape->SetTitle(Form(
"TrackerEndcap %d",*
id));
498 std::vector<RPCDetId> ids;
500 for (
int region = -1; region <=1; ++ region )
502 if (region == 0 )
continue;
528 for (std::vector<RPCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
533 gEve->AddToListTree(shape,
true);
557 std::vector<GEMDetId> ids;
558 int rArr [] = { -1, 1};
559 int cArr [] = { 9, 10, 29, 30};
561 for (
int ri = 0; ri < 2; ++ri )
562 for (
int ci= 0; ci < 4; ++ci) {
565 for (
int roll = minRoll; roll <=10; ++roll)
566 for (
int layer = 1; layer <=2; ++layer)
568 GEMDetId id(rArr[ri], 1, 1, layer, cArr[ci], roll);
590 TEveProjected* proj = *BeginProjecteds();
591 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_GEMElements
TEveElementList * m_rhoPhiGeo
TEveElement * makeCaloOutlineRhoPhi()
Sin< T >::type sin(const T &t)
FWColorManager * colorManager() const
static float caloZ2(bool offset=true)
const VersionInfo & versionInfo() const
TEveElementList * m_rpcEndcapElements
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
TEveGeoShape * makeShape(double, double, double, double)
void initStdGeoElements(const FWViewType::EType id)
bool haveExtraDet(const char *) const
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