2 #define protected public
6 #include "TGLFontManager.h"
8 #include "TEveManager.h"
9 #include "TEveStraightLineSet.h"
10 #include "TEveTrack.h"
11 #include "TEveTrackPropagator.h"
12 #include "TEveTrans.h"
14 #include "TEveGeoShape.h"
22 #include "TEveCaloData.h"
63 void setCameraInit(TGLViewer*
v, TGLViewer::ECameraType
type,
const TEveVectorD b1, TEveVectorD b3, TEveVector center )
65 TGLCamera& cam = v->RefCamera(type);
66 TGLMatrix&
trans = cam.RefCamBase();
68 trans.Set(trans.GetTranslation(), b3.Arr(), b1.Arr());
69 cam.Setup(v->fOverallBoundingBox, kTRUE);
71 cam.SetExternalCenter(
true);
72 cam.SetCenterVec(center.fX, center.fY, center.fZ);
100 m_guiFrame->AddFrame(
new TGLabel(
m_guiFrame,
"Camera Views:"),
new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));
103 TGHorizontalFrame*
f =
new TGHorizontalFrame(
m_guiFrame);
104 m_guiFrame->AddFrame(f,
new TGLayoutHints(kLHintsExpandX, 2, 0, 0, 0));
108 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
109 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
110 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
111 b->SetToolTipText(
"plane normal: track0 x track1");
117 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
118 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
119 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
120 b->SetToolTipText(
"left fir: track1");
125 TGTextButton*
b =
new TGTextButton(f, action->
getName().c_str());
126 f->AddFrame(b,
new TGLayoutHints( kLHintsExpandX));
127 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
129 b->SetToolTipText(
"plane normal: track1 ");
143 b->SetState(kButtonDown,
false);
144 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
145 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
151 b->SetState(kButtonDown,
false);
152 m_guiFrame->AddFrame(b,
new TGLayoutHints( kLHintsNormal, 2, 3, 1, 4));
153 TQObject::Connect(b,
"Clicked()",
"CSGAction", action,
"activate()");
157 TGCompositeFrame*
p = (TGCompositeFrame*)
m_guiFrame->GetParent();
161 m_modules =
new TEveElementList(
"Modules" );
165 m_hits =
new TEveElementList(
"Hits" );
179 TEveGeoShape*
gs =
dynamic_cast<TEveGeoShape*
>(*i);
180 if (gs == 0 && (*
i != 0)) {
181 std::cerr <<
"Got a " <<
typeid(**i).name() <<
", expecting TEveGeoShape. ignoring (it must be the clusters)." << std::endl;
187 TString
name = gs->GetElementTitle();
188 if (!name.Contains(
"BAD") && !name.Contains(
"INACTIVE") && !name.Contains(
"LOST")) {
189 gs->SetMainColor(kBlue);
191 TEveText*
text =
new TEveText(name.Data());
192 text->PtrMainTrans()->SetFrom(gs->RefMainTrans().Array());
193 text->SetFontMode(TGLFont::kPixmap);
194 text->SetFontSize(12);
199 TEveTrackPropagator* prop =
new TEveTrackPropagator();
200 prop->SetMagFieldObj(
item()->
context().getField(),
false);
201 prop->SetStepper(TEveTrackPropagator::kRungeKutta);
205 prop->SetRnrDaughters(kTRUE);
206 prop->SetRnrReferences(kTRUE);
207 prop->SetRnrDecay(kTRUE);
210 prop->SetRnrFV(kTRUE);
211 prop->RefFVAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
212 prop->RefFVAtt().SetMarkerSize(0.8);
215 prop->RefPMAtt().SetMarkerSize(0.5);
216 prop->RefPMAtt().SetMarkerColor(
id.
item()->defaultDisplayProperties().
color());
220 trk1->SetLineWidth(2);
221 trk1->SetTitle(
"Track 1 and its ref states" );
222 trk1->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
223 trk1->SetLineStyle(7);
228 trk0->SetLineWidth(2);
229 trk0->SetTitle(
"Track 0 and its ref states" );
230 trk0->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
241 TEveCalo3D* calo3d =
new TEveCalo3D(data);
242 gEve->AddElement(data);
243 calo3d->SetBarrelRadius(129.00);
244 calo3d->SetEndCapPos(268.36);
246 float theta = TEveCaloData::EtaToTheta(eta);
247 float eps = data->GetMaxVal(
true) * calo3d->GetValToHeight();
248 if (
TMath::Abs(eta) < calo3d->GetTransitionEta())
251 float x = calo3d->GetBarrelRadius() * TMath::Cos(phi);
252 float y = calo3d->GetBarrelRadius() * TMath::Sin(phi);
253 float z = calo3d->GetBarrelRadius() / TMath::Tan(theta);
255 calo3d->BBoxZero(eps, x, y, z);
261 float r = z*TMath::Tan(theta);
262 calo3d->BBoxZero(eps, r* TMath::Cos(phi), r*TMath::Sin(phi), z);
268 TEveVectorD fwd = trk1->GetMomentum().Cross(trk0->GetMomentum());
270 TEveVectorD lft =trk1->GetMomentum();
272 TEveVectorD up = lft.Cross(fwd);
275 TEveVectorD
c = ( trk1->GetVertex() + trk0->GetVertex()) *0.5;
278 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOZ, fwd, up, c);
279 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspYOZ, up, lft,c);
280 setCameraInit(
viewerGL(),TGLViewer::kCameraPerspXOY, lft, fwd,c);
282 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOY, fwd, up,c);
283 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoXOZ, up, lft,c);
284 setCameraInit(
viewerGL(),TGLViewer::kCameraOrthoZOY, lft, fwd,c);
293 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base1");
294 bls->AddLine(c, fwd + c);
295 bls->SetMainColor(kBlue);
296 bls->SetMainTransparency(transp);
297 bls->SetPickable(
false);
302 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base2");
303 bls->AddLine(c, lft + c);
304 bls->SetMainColor(kBlue);
305 bls->SetMainTransparency(transp);
306 bls->SetPickable(
false);
311 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"base3");
312 bls->AddLine(c, up + c);
313 bls->SetMainColor(kBlue);
314 bls->SetMainTransparency(transp);
315 bls->SetPickable(
false);
320 TEveStraightLineSet* bls =
new TEveStraightLineSet(
"Photon",
"Photon");
322 bls->AddLine(c.fX, c.fY, c.fZ, bs->
x0(), bs->
y0(), bs->
z0());
323 bls->SetMainColor(
id.
item()->defaultDisplayProperties().
color());
324 bls->SetLineStyle(3);
328 viewerGL()->SetStyle(TGLRnrCtx::kOutline);
329 viewerGL()->ResetCamerasAfterNextUpdate();
345 TLatex* latex =
new TLatex( x, y,
"" );
346 const double textsize( 0.07 );
347 latex->SetTextSize( 2*textsize );
349 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index()).c_str());
350 y -= latex->GetTextSize()*0.6;
352 latex->SetTextSize( textsize );
353 float lineH = latex->GetTextSize()*0.6;
355 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
358 latex->DrawLatex( x, y, Form(
"vtx=(%.1f, %.1f, %.1f) r=%.1f [cm]",
362 latex->DrawLatex( x, y, Form(
"#Deltactg#theta=%.3f",
365 latex->DrawLatex( x, y, Form(
"#Delta#phi_{vtx}=%.3f",
368 latex->DrawLatex( x, y, Form(
"dist. min. app.=%.3f cm",
375 latex->DrawLatex( x, y, Form(
"Trk0 q=%i",track0->
charge()));
377 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
378 track0->
pt(), track0->
eta(), track0->
phi()));
381 int nvalid_tk0=0, ninvalid_tk0=0, npix_tk0=0, nstrip_tk0=0;
388 }
else ninvalid_tk0++;
390 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk0, npix_tk0, nstrip_tk0) );
392 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk0) );
395 int npix_mhi_tk0=0, nstrip_mhi_tk0=0;
396 for(
int i_mhi_tk0=0; i_mhi_tk0<p_mhi_tk0.
numberOfHits(); i_mhi_tk0++) {
401 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk0, nstrip_mhi_tk0) );
406 latex->DrawLatex( x, y, Form(
"Trk1 q=%i",track1->
charge()));
408 latex->DrawLatex( x, y, Form(
"p_{T}=%.1f GeV, #eta=%0.2f, #varphi=%0.2f",
409 track1->
pt(), track1->
eta(), track1->
phi()));
412 int nvalid_tk1=0, ninvalid_tk1=0, npix_tk1=0, nstrip_tk1=0;
419 }
else ninvalid_tk1++;
421 latex->DrawLatex( x, y, Form(
"valid hits: %i (pix. %i, str. %i)", nvalid_tk1, npix_tk1, nstrip_tk1) );
423 latex->DrawLatex( x, y, Form(
"invalid: %i", ninvalid_tk1) );
426 int npix_mhi_tk1=0, nstrip_mhi_tk1=0;
427 for(
int i_mhi_tk1=0; i_mhi_tk1<p_mhi_tk1.
numberOfHits(); i_mhi_tk1++) {
432 latex->DrawLatex( x, y, Form(
"miss. inner hits: pix. %i, str. %i", npix_mhi_tk1, nstrip_mhi_tk1) );
444 TEvePointSet* pointSet =
new TEvePointSet();
445 pointSet->SetMarkerSize(size);
446 pointSet->SetMarkerStyle(4);
447 pointSet->SetPickable(kTRUE);
448 pointSet->SetTitle(
"Pixel Hits");
449 pointSet->SetMarkerColor(color);
451 for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it) {
452 pointSet->SetNextPoint(it->x(), it->y(), it->z());
454 tList->AddElement(pointSet);
460 TEveElement* trkList,
463 std::vector<TVector3> pixelPoints;
465 TEveElementList* pixels =
new TEveElementList(
"Pixels" );
466 trkList->AddElement( pixels );
470 std::vector<TVector3> pixelExtraPoints;
484 TEveElementList*
strips =
new TEveElementList(
"Strips" );
485 trkList->AddElement( strips );
494 TEveElement* trkList,
497 std::set<unsigned int> ids;
499 recIt != recItEnd; ++recIt )
502 if( !addLostHits && !(*recIt)->isValid())
continue;
503 if( detid.
rawId() != 0 )
524 name =
"Pixel Barrel ";
527 name =
"Pixel Endcap ";
553 if( ! ids.insert( detid.
rawId()).
second )
continue;
559 shape->SetMainTransparency( 65 );
560 shape->SetPickable( kTRUE );
561 switch(( *recIt )->type())
568 shape->SetMainColor( kRed );
572 shape->SetMainColor( 28 );
576 shape->SetMainColor( 218 );
579 shape->SetTitle( name + ULong_t( detid.
rawId()));
580 trkList->AddElement( shape );
597 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
const TrackExtraRef & extra() const
reference to "extra" object
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
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 pixelHitFilter(uint32_t pattern)
TEveCaloData * buildCaloData(bool xyEE)
TGCompositeFrame * m_guiFrame
double z() const
y coordinate
void setName(const std::string &name)
const HitPattern & trackerExpectedHitsInner() const
Access the hit pattern counting (in the Tracker) the number of expected crossed layers before the fir...
static bool validHitFilter(uint32_t pattern)
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.
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
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.
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)
char data[epos_bytes_allocation]
#define REGISTER_FWDETAILVIEW(_classname_, _name_)
std::string info(const DetId &)
static bool stripHitFilter(uint32_t pattern)
CSGAction * m_camTypeAction
int charge() const
track electric charge
volatile std::atomic< bool > shutdown_flag false
void addTrackerHits3D(std::vector< TVector3 > &points, class TEveElementList *tList, Color_t color, int size)
Detector det() const
get the detector field from this detid
uint32_t getHitPattern(int position) const
void pushNearbyPixelHits(std::vector< TVector3 > &pixelPoints, const FWEventItem &iItem, const reco::Track &t)
tuple size
Write out results.
const FWGeometry * getGeom() const
double dPhiTracksAtVtx() const
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.