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"
60 m_pixelBarrelElements(0),
61 m_pixelEndcapElements(0),
62 m_trackerBarrelElements(0),
63 m_trackerEndcapElements(0),
64 m_rpcEndcapElements(0),
68 SetElementName(
"RPZGeomShared");
107 using namespace fireworks;
111 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoZoutline" );
112 el->SetPickable(kFALSE);
130 TEveStraightLineSet* el =
new TEveStraightLineSet(
"TrackerRhoPhi" );
134 const unsigned int nSegments = 100;
136 for (
unsigned int i = 1;
i <= nSegments; ++
i )
140 TEvePointSet* ref =
new TEvePointSet(
"reference");
141 ref->SetTitle(
"(0,0,0)");
142 ref->SetMarkerStyle(4);
143 ref->SetMarkerColor(kWhite);
144 ref->SetNextPoint(0.,0.,0.);
158 TEveCompound* container =
new TEveCompound(
"MuonRhoPhi" );
161 for( Int_t iStation = 1; iStation <= 4; ++iStation )
163 for( Int_t iSector = 1 ; iSector <= 14; ++iSector )
165 if( iStation < 4 && iSector > 12 )
continue;
172 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 );
221 TEveCompound* cscContainer =
new TEveCompound(
"CSC" );
222 std::vector<CSCDetId> ids;
236 int off = (
station == 1) ? 10:0;
243 for (std::vector<CSCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
245 unsigned int rawid =
i->rawId();
248 shape->SetName(Form(
" e:%d r:%d s:%d chamber %d",
i->endcap(),
i->ring(),
i->station(),
i->chamber() ));
249 cscContainer->AddElement(shape);
251 container->AddElement( cscContainer );
263 t(1,1) = 1;
t(1,2) = 0;
t(1,3) = 0;
264 t(2,1) = 0;
t(2,2) = 1;
t(2,3) = 0;
265 t(3,1) = 0;
t(3,2) = 0;
t(3,3) = 1;
266 t(1,4) = 0;
t(2,4) = (min_rho+max_rho)/2;
t(3,4) = (min_z+max_z)/2;
268 TEveGeoShape* shape =
new TEveGeoShape;
269 shape->SetTransMatrix(t.Array());
271 shape->SetRnrSelf(kTRUE);
272 shape->SetRnrChildren(kTRUE);
273 TGeoBBox* box =
new TGeoBBox( 0, (max_rho-min_rho)/2, (max_z-min_z)/2 );
274 shape->SetShape( box );
283 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
286 float local[3], global[3];
288 float dX = info.
shape[1];
289 float dY = info.
shape[2];
290 float dZ = info.
shape[3];
292 local[0] = 0; local[1] = 0; local[2] = dZ;
296 local[0] = dX; local[1] = dY; local[2] = dZ;
300 local[0] = -dX; local[1] = dY; local[2] = dZ;
304 local[0] = dX; local[1] = -dY; local[2] = dZ;
308 local[0] = -dX; local[1] = -dY; local[2] = dZ;
312 local[0] = 0; local[1] = 0; 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] = -dX; local[1] = -dY; local[2] = -dZ;
336 float& min_rho,
float& max_rho,
float& min_z,
float& max_z )
338 double rho =
sqrt(global[0] *global[0]+global[1] *global[1]);
339 if ( min_rho > rho ) min_rho =
rho;
340 if ( max_rho < rho ) max_rho =
rho;
341 if ( min_z > global[2] ) min_z = global[2];
342 if ( max_z < global[2] ) max_z = global[2];
369 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
370 id != ids.end(); ++id )
373 shape->SetTitle(Form(
"PixelBarrel %d",*
id));
395 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
396 id != ids.end(); ++id )
400 shape->SetTitle(Form(
"PixelEndCap %d",*
id));
425 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
426 id != ids.end(); ++id )
433 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
434 id != ids.end(); ++id )
438 shape->SetTitle(Form(
"TrackerBarrel %d",*
id));
462 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
463 id != ids.end(); ++id )
470 for( std::vector<unsigned int>::const_iterator
id = ids.begin();
471 id != ids.end(); ++id )
475 shape->SetTitle(Form(
"TrackerEndcap %d",*
id));
500 std::vector<RPCDetId> ids;
504 if (
region == 0 )
continue;
530 for (std::vector<RPCDetId>::iterator
i = ids.begin();
i != ids.end(); ++
i)
535 gEve->AddToListTree(shape,
true);
565 if (iStation >= 2) maxChamber = 18;
567 for( Int_t iChamber = 1; iChamber <= maxChamber; ++iChamber ){
568 int maxRoll = iChamber%2 ? 9:10;
569 if (iStation == 2) maxRoll = 8;
570 if (iStation == 3) maxRoll = 12;
573 GEMDetId id( iRegion, iRing, iStation, iLayer, iChamber, iRoll );
578 gEve->AddToListTree(shape,
true);
602 for( Int_t iLayer = 1; iLayer <= 6 ; ++iLayer ){
603 for( Int_t iChamber = 1; iChamber <= 18; ++iChamber ){
605 ME0DetId id( iRegion, iLayer, iChamber, iRoll );
610 gEve->AddToListTree(shape,
true);
629 TEveProjected* proj = *BeginProjecteds();
630 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)
static const int minRegionId
static const int maxRegionId
const VersionInfo & versionInfo() const
static const int maxLayerId
TEveElementList * m_rpcEndcapElements
void addToCompound(TEveElement *el, FWGeomColorIndex idx, bool applyTransp=true) const
TEveGeoShape * makeShape(double, double, double, double)
static const int minRegionId
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)
static const int minRollId
Tan< T >::type tan(const T &t)
const FWGeometry * m_geom
void showPixelEndcap(bool)
TEveElementList * m_rhoZGeo
TEveElementList * m_ME0Elements
void showPixelBarrel(bool)
static const int minStationId
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)
static const int minLayerId
static const int maxRegionId
Color_t geomColor(FWGeomColorIndex) const
const fireworks::Context & m_context
virtual ~FWRPZViewGeometry()
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr