4 #include "TGLFontManager.h" 6 #include "TEveManager.h" 7 #include "TEveStraightLineSet.h" 9 #include "TEveTrackPropagator.h" 10 #include "TEveTrans.h" 12 #include "TEveGeoShape.h" 20 #include "TEveCaloData.h" 61 void setCameraInit(TGLViewer*
v, TGLViewer::ECameraType
type,
const TEveVectorD b1, TEveVectorD b3, TEveVector center )
63 TGLCamera& cam = v->RefCamera(type);
64 TGLMatrix& trans = cam.RefCamBase();
66 trans.Set(trans.GetTranslation(), b3.Arr(), b1.Arr());
67 cam.Setup(v->RefOverallBoundingBox(), kTRUE);
69 cam.SetExternalCenter(
true);
70 cam.SetCenterVec(center.fX, center.fY, center.fZ);
98 m_guiFrame->AddFrame(
new TGLabel(
m_guiFrame,
"Camera Views:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
101 TGHorizontalFrame*
f =
new TGHorizontalFrame(
m_guiFrame);
102 m_guiFrame->AddFrame(f,
new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
106 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
107 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
108 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
109 b->SetToolTipText(
"plane normal: track0 x track1");
115 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
116 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
117 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
118 b->SetToolTipText(
"left fir: track1");
123 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
124 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
125 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
127 b->SetToolTipText(
"plane normal: track1 ");
141 b->SetState(kButtonDown,
false);
142 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
143 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
149 b->SetState(kButtonDown,
false);
150 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
151 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
155 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
159 m_modules =
new TEveElementList(
"Modules" );
163 m_hits =
new TEveElementList(
"Hits" );
177 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
178 if (gs == 0 && (*
i != 0)) {
179 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
185 TString
name = gs->GetElementTitle();
186 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
187 gs->SetMainColor(kBlue);
189 TEveText*
text =
new TEveText(name.Data());
190 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
191 text->SetFontMode(TGLFont::kPixmap);
192 text->SetFontSize(12);
197 TEveTrackPropagator* prop =
new TEveTrackPropagator();
199 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
203 prop->SetRnrDaughters(kTRUE);
204 prop->SetRnrReferences(kTRUE);
205 prop->SetRnrDecay(kTRUE);
208 prop->SetRnrFV(kTRUE);
209 prop->RefFVAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
210 prop->RefFVAtt().SetMarkerSize(0.8);
213 prop->RefPMAtt().SetMarkerSize(0.5);
214 prop->RefPMAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
218 trk1->SetLineWidth(2);
219 trk1->SetTitle(
"Track 1 and its ref states" );
220 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
221 trk1->SetLineStyle(7);
226 trk0->SetLineWidth(2);
227 trk0->SetTitle(
"Track 0 and its ref states" );
228 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
239 TEveCalo3D* calo3d =
new TEveCalo3D(data);
240 gEve->AddElement(data);
241 calo3d->SetBarrelRadius(129.00);
242 calo3d->SetEndCapPos(268.36);
244 float theta = TEveCaloData::EtaToTheta(eta);
245 float ext = data->GetMaxVal(
true) * calo3d->GetValToHeight();
246 if (
TMath::Abs(eta) < calo3d->GetTransitionEta())
249 float x = calo3d->GetBarrelRadius() * TMath::Cos(phi);
250 float y = calo3d->GetBarrelRadius() * TMath::Sin(phi);
251 float z = calo3d->GetBarrelRadius() / TMath::Tan(theta);
253 calo3d->SetupBBoxCube(ext, x, y, z);
259 float r = z*TMath::Tan(theta);
260 calo3d->SetupBBoxCube(ext, r* TMath::Cos(phi), r*TMath::Sin(phi), z);
266 TEveVectorD fwd = trk1->GetMomentum().Cross(trk0->GetMomentum());
268 TEveVectorD lft =trk1->GetMomentum();
270 TEveVectorD
up = lft.Cross(fwd);
273 TEveVectorD
c = ( trk1->GetVertex() + trk0->GetVertex()) *0.5;
276 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOZ, fwd, up, c);
277 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspYOZ, up, lft,c);
278 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOY, lft, fwd,c);
280 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOY, fwd, up,c);
281 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOZ, up, lft,c);
282 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoZOY, lft, fwd,c);
291 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base1");
292 bls->AddLine(c, fwd + c);
293 bls->SetMainColor(kBlue);
294 bls->SetMainTransparency(transp);
295 bls->SetPickable(
false);
300 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base2");
301 bls->AddLine(c, lft + c);
302 bls->SetMainColor(kBlue);
303 bls->SetMainTransparency(transp);
304 bls->SetPickable(
false);
309 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base3");
310 bls->AddLine(c, up + c);
311 bls->SetMainColor(kBlue);
312 bls->SetMainTransparency(transp);
313 bls->SetPickable(
false);
318 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"Photon",
"Photon");
320 bls->AddLine(c.fX, c.fY, c.fZ, bs->
x0(), bs->
y0(), bs->
z0());
321 bls->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
322 bls->SetLineStyle(3);
326 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
327 viewerGL()->ResetCamerasAfterNextUpdate();
343 TLatex* latex =
new TLatex( x, y,
"" );
344 const double textsize( 0.07 );
345 latex->SetTextSize( 2*textsize );
348 y -= latex->GetTextSize()*0.6;
350 latex->SetTextSize( textsize );
351 float lineH = latex->GetTextSize()*0.6;
353 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
356 latex->DrawLatex( x, y, Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
360 latex->DrawLatex( x, y, Form(
"#Deltactg#theta=%.3f",
363 latex->DrawLatex( x, y, Form(
"#Delta#phi_{vtx}=%.3f",
366 latex->DrawLatex( x, y, Form(
"dist. min. app.=%.3f cm",
373 latex->DrawLatex( x, y, Form(
"Trk0 q=%i",track0->
charge()));
375 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
376 track0->
pt(), track0->
eta(), track0->
phi()));
379 int nvalid_tk0 = 0, ninvalid_tk0 = 0, npix_tk0 = 0, nstrip_tk0 = 0;
386 }
else ninvalid_tk0++;
388 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0) );
390 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk0) );
393 int npix_mhi_tk0 = 0, nstrip_mhi_tk0 = 0;
399 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0) );
404 latex->DrawLatex( x, y, Form(
"Trk1 q=%i",track1->
charge()));
406 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
407 track1->
pt(), track1->
eta(), track1->
phi()));
411 int nvalid_tk1 = 0, ninvalid_tk1 = 0, npix_tk1 = 0, nstrip_tk1 = 0;
418 }
else ninvalid_tk1++;
420 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1) );
422 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk1) );
425 int npix_mhi_tk1 = 0, nstrip_mhi_tk1 = 0;
431 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1) );
443 TEvePointSet* pointSet =
new TEvePointSet();
444 pointSet->SetMarkerSize(size);
445 pointSet->SetMarkerStyle(4);
446 pointSet->SetPickable(kTRUE);
447 pointSet->SetTitle(
"Pixel Hits");
448 pointSet->SetMarkerColor(color);
450 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
451 pointSet->SetNextPoint(it->x(), it->y(), it->z());
453 tList->AddElement(pointSet);
459 TEveElement* trkList,
462 std::vector<TVector3> pixelPoints;
464 TEveElementList*
pixels =
new TEveElementList(
"Pixels" );
465 trkList->AddElement( pixels );
469 std::vector<TVector3> pixelExtraPoints;
483 TEveElementList*
strips =
new TEveElementList(
"Strips" );
484 trkList->AddElement( strips );
493 TEveElement* trkList,
496 std::set<unsigned int> ids;
498 recIt != recItEnd; ++recIt )
500 DetId detid = (*recIt)->geographicalId();
501 if( !addLostHits && !(*recIt)->isValid())
continue;
502 if( detid.
rawId() != 0 )
523 name =
"Pixel Barrel ";
526 name =
"Pixel Endcap ";
552 if( ! ids.insert( detid.
rawId()).
second )
continue;
558 shape->SetMainTransparency( 65 );
559 shape->SetPickable( kTRUE );
560 switch(( *recIt )->type())
569 shape->SetMainColor( kRed );
573 shape->SetMainColor( 28 );
577 shape->SetMainColor( 218 );
580 shape->SetTitle( name + ULong_t( detid.
rawId()));
581 trkList->AddElement( shape );
598 viewerGL()->SetDrawCameraCenter(kTRUE);
virtual ~FWConvTrackHitsDetailView()
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
const std::string & getName() const
void addModules(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addLostHits)
const FWDisplayProperties & defaultDisplayProperties() const
TGLViewer * viewerGL() const
static bool pixelHitFilter(uint16_t pattern)
const TrackExtraRef & extra() const
reference to "extra" object
unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
static HepMC::IO_HEPEVT conv
double y() const
y coordinate
const FWEventItem * item()
sigc::signal< void > activated
Geom::Theta< T > theta() const
double distOfMinimumApproach() const
double pairCotThetaSeparation() const
Delta cot(Theta) where Theta is the angle in the (y,z) plane between the two tracks. Original tracks are used.
void build(const FWModelId &id, const reco::Conversion *)
double phi() const
azimuthal angle of momentum vector
const Point & position() const
position
TEveCaloData * buildCaloData(bool xyEE)
static bool validHitFilter(uint16_t pattern)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
FWBeamSpot * getBeamSpot() const
const fireworks::Context & context() const
double eta() const
pseudorapidity of momentum vector
TEveGeoShape * getEveShape(unsigned int id) const
TEveElementList * m_moduleLabels
double pt() const
track transverse momentum
static bool stripHitFilter(uint16_t pattern)
TGCompositeFrame * m_guiFrame
double z() const
z coordinate
void setName(const std::string &name)
FWConvTrackHitsDetailView()
void pushPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
TEveElementList * m_modules
void addHits(const reco::Track &track, const FWEventItem *iItem, TEveElement *trkList, bool addNearbyHits)
void addSiStripClusters(const FWEventItem *iItem, const reco::Track &t, class TEveElement *tList, bool addNearbyClusters, bool master)
unsigned int nTracks() const
Number of tracks= 0,1,2.
void setTextInfo(const FWModelId &id, const reco::Conversion *)
double x() const
x coordinate
math::XYZVectorF pairMomentum() const
Conversion tracks momentum from the tracks inner momentum.
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
void createTextButton(TGCompositeFrame *p, TGLayoutHints *l=0, Int_t id=-1, GContext_t norm=TGButton::GetDefaultGC()(), FontStruct_t font=TGTextButton::GetDefaultFontStruct(), UInt_t option=kRaisedFrame|kDoubleBorder)
#define REGISTER_FWDETAILVIEW(_classname_, _name_,...)
char data[epos_bytes_allocation]
std::string info(const DetId &)
CSGAction * m_camTypeAction
int charge() const
track electric charge
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
uint16_t getHitPattern(HitCategory category, int position) const
Detector det() const
get the detector field from this detid
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
const FWGeometry * getGeom() const
double dPhiTracksAtVtx() const
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
int numberOfHits(HitCategory category) const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.