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)
65 SetElementName(
"RPZGeomShared");
104 using namespace fireworks;
108 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
109 el->SetPickable(kFALSE);
127 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
131 const unsigned int nSegments = 100;
133 for (
unsigned int i = 1;
i <= nSegments; ++
i )
137 TEvePointSet* ref =
new TEvePointSet(
"reference");
138 ref->SetTitle(
"(0,0,0)");
139 ref->SetMarkerStyle(4);
140 ref->SetMarkerColor(kWhite);
141 ref->SetNextPoint(0.,0.,0.);
155 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
158 for( Int_t iStation = 1; iStation <= 4; ++iStation )
160 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
162 if( iStation < 4 && iSector > 12 )
continue;
169 container->AddElement( shape );
185 TEveElementList* container =
new TEveElementList(
"MuonRhoZ" );
188 TEveCompound* dtContainer =
new TEveCompound(
"DT" );
189 for( Int_t iWheel = -2; iWheel <= 2; ++iWheel )
191 for( Int_t iStation = 1; iStation <= 4; ++iStation )
193 float min_rho(1000), max_rho(0), min_z(2000), max_z(-2000);
197 for( Int_t iSector = 1; iSector <= 4; ++iSector )
200 unsigned int rawid =
id.rawId();
204 if ( min_rho > max_rho || min_z > max_z )
continue;
205 TEveElement* se =
makeShape( min_rho, max_rho, min_z, max_z );
207 dtContainer->AddElement(se);
208 se =
makeShape( -max_rho, -min_rho, min_z, max_z );
210 dtContainer->AddElement(se);
214 container->AddElement( dtContainer );
218 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
219 std::vector<CSCDetId> ids;
233 int off = (
station == 1) ? 10:0;
240 for (std::vector<CSCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
242 unsigned int rawid =
i->rawId();
245 shape->SetName(Form(
" e:%d r:%d s:%d chamber %d",
i->endcap(),
i->ring(),
i->station(),
i->chamber() ));
246 cscContainer->AddElement(shape);
248 container->AddElement( cscContainer );
260 t(1,1) = 1;
t(1,2) = 0;
t(1,3) = 0;
261 t(2,1) = 0;
t(2,2) = 1;
t(2,3) = 0;
262 t(3,1) = 0;
t(3,2) = 0;
t(3,3) = 1;
263 t(1,4) = 0;
t(2,4) = (min_rho+max_rho)/2;
t(3,4) = (min_z+max_z)/2;
265 TEveGeoShape* shape =
new TEveGeoShape;
266 shape->SetTransMatrix(t.Array());
268 shape->SetRnrSelf(kTRUE);
269 shape->SetRnrChildren(kTRUE);
270 TGeoBBox* box =
new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
271 shape->SetShape( box );
280 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
283 float local[3], global[3];
285 float dX = info.
shape[1];
286 float dY = info.
shape[2];
287 float dZ = info.
shape[3];
289 local[0] = 0; local[1] = 0; local[2] = dZ;
293 local[0] = dX; local[1] = dY; local[2] = dZ;
297 local[0] = -dX; local[1] = dY; local[2] = dZ;
301 local[0] = dX; local[1] = -dY; local[2] = dZ;
305 local[0] = -dX; local[1] = -dY; local[2] = dZ;
309 local[0] = 0; local[1] = 0; local[2] = -dZ;
313 local[0] = dX; local[1] = dY; local[2] = -dZ;
317 local[0] = -dX; local[1] = dY; local[2] = -dZ;
321 local[0] = dX; local[1] = -dY; local[2] = -dZ;
325 local[0] = -dX; local[1] = -dY; local[2] = -dZ;
333 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
335 double rho =
sqrt(global[0] *global[0]+global[1] *global[1]);
336 if ( min_rho > rho ) min_rho =
rho;
337 if ( max_rho < rho ) max_rho =
rho;
338 if ( min_z > global[2] ) min_z = global[2];
339 if ( max_z < global[2] ) max_z = global[2];
366 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
367 id != ids.end(); ++id )
370 shape->SetTitle(Form(
"PixelBarrel %d",*
id));
392 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
393 id != ids.end(); ++id )
397 shape->SetTitle(Form(
"PixelEndCap %d",*
id));
422 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
423 id != ids.end(); ++id )
430 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
431 id != ids.end(); ++id )
435 shape->SetTitle(Form(
"TrackerBarrel %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(
"TrackerEndcap %d",*
id));
497 std::vector<RPCDetId> ids;
499 for (
int region = -1; region <=1; ++ region )
501 if (region == 0 )
continue;
527 for (std::vector<RPCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
532 gEve->AddToListTree(shape,
true);
556 std::vector<GEMDetId> ids;
557 int rArr [] = { -1, 1};
558 int cArr [] = { 10, 30};
560 for (
int st = 1; st <= 2; ++st )
561 for (
int ri = 0; ri < 2; ++ri )
562 for (
int ci= 0; ci < 2; ++ci) {
563 int maxRoll = st == 1 ? 8 : 12;
564 for (
int roll = 1; roll <=maxRoll; ++roll)
565 for (
int layer = 1; layer <=2; ++layer)
567 GEMDetId id(rArr[ri], 1, st, layer, cArr[ci]/st, roll);
591 TEveProjected* proj = *BeginProjecteds();
592 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)
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