ATLAS Offline Software
Loading...
Searching...
No Matches
IParticleHandle_Muon Class Reference

#include <IParticleHandle_Muon.h>

Inheritance diagram for IParticleHandle_Muon:
Collaboration diagram for IParticleHandle_Muon:

Classes

class  Imp

Public Member Functions

 IParticleHandle_Muon (IParticleCollHandleBase *, const xAOD::Muon *)
virtual ~IParticleHandle_Muon ()
virtual bool has3DObjects ()
 Returns true if the 3D objects have been created.
virtual void clear3DObjects ()
 Delete objects.
virtual SoNode * nodes ()
 Returns the 3Dobjects.
void addParameterShapes ()
void addLine_FromTrackParticle ()
void linear (Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, float t)
void bezier (Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, Amg::Vector3D &c, Amg::Vector3D &d, float t)
void fillLineFromSplineFit (const std::vector< Amg::Vector3D > &positions, const std::vector< Amg::Vector3D > &momenta)
virtual QStringList clicked () const
 Called when user selects the node (stringlist is displayed in messagebox).
virtual Amg::Vector3D momentum () const
virtual Amg::Vector3D position () const
const xAOD::IParticleiParticle () const
virtual double charge () const
 Returns unknown() in case of trouble.
virtual QString type () const
 return very short word with type (maybe link with collection type?)
unsigned int quality () const
const xAOD::Muonmuon () const
QString muonTypeString () const
QString qualityString () const
QString shortInfo () const
 This returns the information shown about the object in the object browser.
void fillObjectBrowser (QList< QTreeWidgetItem * > &listOfItems)
 Create and fill the object browser QTreeWidgetItem.
const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & parametersAndPositions () const
SoMaterial * determineMaterial ()
 Should be implemented by children, in order to change the material depending on the interface etc.
virtual QStringList baseInfo () const
virtual double mass () const
 Returns unknown() in case of trouble.
bool hasCharge () const
bool hasMass () const
const AODSysCommonDatacommon () const
void setVisible (bool)
 use by the collection handle.
bool visible () const
const AODCollHandleBasecollHandle () const
virtual void update3DObjects ()
 Called after some configuration changes, or when the object is first created. Must be overloaded by children.
virtual void rebuild3DObjects ()
virtual void attach3DObjects ()
 Connect to the scene graph.
virtual void detach3DObjects ()
 Remove from the scene graph.
void updateMaterial ()
 Called after some configuration related to material changes.
SoMaterial * currentMaterial () const
 Returns the current material of the handle.
void updateObjectBrowser ()
 Update object browser QTreeWidgetItem.
QTreeWidgetItem * browserTreeItem () const
 Return the QTreeWidgetItem;.
virtual void dumpToJSON (std::ofstream &) const

Static Public Member Functions

static int numberOfInstances ()
static double unknown ()

Protected Member Functions

virtual void visibleStateChanged ()
 Dummy implementation does nothing.
virtual void currentMaterialChanged ()

Private Member Functions

void ensureInitSubSysHitInfo () const

Private Attributes

Impm_d
bool m_visible
AODCollHandleBasem_collhandle
SoMaterial * m_currentmaterial

Detailed Description

Definition at line 22 of file IParticleHandle_Muon.h.

Constructor & Destructor Documentation

◆ IParticleHandle_Muon()

IParticleHandle_Muon::IParticleHandle_Muon ( IParticleCollHandleBase * ch,
const xAOD::Muon * tp )

Definition at line 60 of file IParticleHandle_Muon.cxx.

61 : IParticleHandleBase(ch), m_d(new Imp)
62{
63 m_d->theclass = this;
64 m_d->muon = tp;
65 m_d->collHandle = dynamic_cast<IParticleCollHandle_Muon*>(ch);
66 m_d->sep=0;
67 m_d->line=0;
68}
IParticleHandleBase(IParticleCollHandleBase *)

◆ ~IParticleHandle_Muon()

IParticleHandle_Muon::~IParticleHandle_Muon ( )
virtual

Definition at line 71 of file IParticleHandle_Muon.cxx.

72{
73 if (m_d->line) m_d->line->unref();
74 if (m_d->sep) m_d->sep->unref();
75 delete m_d;
76}

Member Function Documentation

◆ addLine_FromTrackParticle()

void IParticleHandle_Muon::addLine_FromTrackParticle ( )

Definition at line 218 of file IParticleHandle_Muon.cxx.

218 {
219
220 std::vector<Amg::Vector3D> positions, momenta;
221
222 const xAOD::TrackParticle* trackparticle = m_d->muon->primaryTrackParticle();
223 if (!trackparticle) {
224 VP1Msg::message("ERROR : no primary track particle associated with this Muon. Can't visualise it.");
225 return;
226 }
227#if defined BUILDVP1LIGHT
228 positions.push_back(position());
229 momenta. push_back(momentum());
230#else
231 const Trk::Perigee& peri = trackparticle->perigeeParameters (); // FIXME - I'd quite like not to use anything which requires Athena ...
232
233 positions.push_back(Amg::Vector3D(peri.position().x(),peri.position().y(),peri.position().z()));
234 momenta. push_back(Amg::Vector3D(peri.momentum().x(),peri.momentum().y(),peri.momentum().z()));
235 VP1Msg::messageVerbose("IParticleHandle_Muon::addLine_FromTrackParticle - has "+QString::number(trackparticle->numberOfParameters())+" extra parameters.");
236 #endif // BUILDVP1LIGHT
237 for (unsigned int i=0; i<trackparticle->numberOfParameters() ; ++i){
238 // std::cout<<"i:"<<i<<"/"<<m_d->trackparticle->numberOfParameters()+1<<std::endl;
239
240 positions.push_back(Amg::Vector3D(trackparticle->parameterX(i),
241 trackparticle->parameterY(i),
242 trackparticle->parameterZ(i)));
243 momenta.push_back(Amg::Vector3D( trackparticle->parameterPX(i),
244 trackparticle->parameterPY(i),
245 trackparticle->parameterPZ(i)));
246 } // end of loop.
247
248 if ( positions.size()<2 ) {
249 VP1Msg::messageVerbose("IParticleHandle_Muon::addLine_FromTrackParticle - WARNING - not enough points to make a line.");
250 return;
251 }
252
253 fillLineFromSplineFit(positions, momenta);
254
255 // std::cout<<"About to add "<<collHandleTrk->material()<<std::endl;
256 m_d->sep->addChild(m_d->collHandle->material());
257 // ^^ FIXME - should rearrange so we don't need to reset material
258
259 m_d->sep->addChild(m_d->line);
260}
virtual Amg::Vector3D position() const
virtual Amg::Vector3D momentum() const
void fillLineFromSplineFit(const std::vector< Amg::Vector3D > &positions, const std::vector< Amg::Vector3D > &momenta)
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
static void message(const QString &, IVP1System *sys=0)
Definition VP1Msg.cxx:30
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
float parameterPX(unsigned int index) const
Returns the parameter x momentum component, for 'index'.
float parameterX(unsigned int index) const
Returns the parameter x position, for 'index'.
float parameterPY(unsigned int index) const
Returns the parameter y momentum component, for 'index'.
float parameterZ(unsigned int index) const
Returns the parameter z position, for 'index'.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.
float parameterY(unsigned int index) const
Returns the parameter y position, for 'index'.
float parameterPZ(unsigned int index) const
Returns the parameter z momentum component, for 'index'.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ addParameterShapes()

void IParticleHandle_Muon::addParameterShapes ( )

Definition at line 197 of file IParticleHandle_Muon.cxx.

197 {
198 // Okay. so let's make the containers to hold them...
199 SoPointSet* parameterPoints = new SoPointSet;
200 SoVertexProperty* vertices2 = new SoVertexProperty;
201
202 int i = 0;
203 QList<std::pair<xAOD::ParameterPosition, Amg::Vector3D> > parAndPoses = parametersAndPositions();
204
205 for (std::pair<xAOD::ParameterPosition, Amg::Vector3D> parpos : parAndPoses ) {
206 Amg::Vector3D pos = parpos.second;
207 vertices2->vertex.set1Value(i++,pos.x(),pos.y(),pos.z());
208 }
209
210 parameterPoints->numPoints=i;
211 parameterPoints->vertexProperty = vertices2;
212
213 // m_d->sep->addChild(m_d->collHandle->collSettingsButton().defaultParameterMaterial());
214 m_d->sep->addChild(parameterPoints);
215
216}
const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & parametersAndPositions() const

◆ attach3DObjects()

void AODHandleBase::attach3DObjects ( )
virtualinherited

Connect to the scene graph.

Definition at line 157 of file AODHandleBase.cxx.

158{
159 VP1Msg::messageVerbose("AODHandleBase::attach3DObjects");
160
161 if (!m_currentmaterial) {
163 m_currentmaterial->ref();
165 }
166 if (has3DObjects() && m_collhandle->sepHelper()) {
167 VP1Msg::messageVerbose("Adding nodes to sep helper...");
168
169 m_collhandle->common()->registerHandle(this);
170
171 // debug
172 // std::cout<<"m_collhandle->sepHelper() = " << m_collhandle->sepHelper()<<std::endl;
173 SoNode* tmp = nodes();
174 // std::cout << "tmp nodes = "<< tmp << std::endl;
175
176 // m_collhandle->sepHelper()->addNodeUnderMaterial( nodes(), m_currentmaterial );
177 m_collhandle->sepHelper()->addNodeUnderMaterial( tmp, m_currentmaterial );
178
179 } else {
180 if (!has3DObjects()) {
181 VP1Msg::message("AODHandleBase::attach3DObjects() - No 3D objects to attach!");
182 }
183 if (!m_collhandle->sepHelper()) VP1Msg::message("AODHandleBase::attach3DObjects() - No sep helper!");
184 }
185 // if (label_sep && theclass->common()->textSep() && theclass->common()->controller()->doTrackLabels())
186 // theclass->common()->textSep()->addChild(label_sep);
187 //
188}
virtual void currentMaterialChanged()
SoMaterial * m_currentmaterial
virtual SoNode * nodes()=0
Returns the 3Dobjects.
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
virtual SoMaterial * determineMaterial()=0
Should be implemented by children, in order to change the material depending on the interface etc.
AODCollHandleBase * m_collhandle

◆ baseInfo()

QStringList IParticleHandleBase::baseInfo ( ) const
virtualinherited

Reimplemented from AODHandleBase.

Definition at line 85 of file IParticleHandleBase.cxx.

86{
87 QStringList l;
88 Amg::Vector3D mom = momentum()/1000;
89 if (mom.mag2()==0.0) {
90 l << "Momentum : 0 (undefined)";
91 } else {
92 l << "Momentum [GeV]: "+VP1Msg::str(mom);
93 l << "|Pt|/|P| [GeV]: "+VP1Msg::str(mom.perp())+" / " + VP1Msg::str(mom.mag());
94 l << VP1Msg::str("(")+QChar(0x03B7)+","+QChar(0x03D5)+VP1Msg::str(")=(")
96
97 l << "Eta: "+VP1Msg::str(mom.eta());
98 l << "Phi: "+VP1Msg::str(VP1LinAlgUtils::phiFromXY(mom.x(), mom.y() ));
99 }
100 // l<<"Hit summary: Pix["+VP1Msg::str(getNPixelHits())+"], SCT["+VP1Msg::str(getNSCTHits())+"], TRT["+VP1Msg::str(getNTRTHits())
101 // +"], MDT["+QString::number(getNMDTHits())+"], RPC["+QString::number(getNRPCHits())+"], TGC["+QString::number(getNTGCHits())+"], CSC["+QString::number(getNCSCHits())+"].";
102 //
103 // return l;
104 // int pdg = pdgCode();
105 // if (pdg) {
106 // bool ok;
107 // QString name = VP1ParticleData::particleName(pdg,ok);
108 // if (ok)
109 // l << "pdg: "+QString::number(pdg)+" ["+name+"]";
110 // else
111 // l << "pdg: "+QString::number(pdg);
112 // }
113
114 return l;
115}
virtual Amg::Vector3D momentum() const
static double phiFromXY(const double &x, const double &y)
static QString str(const QString &s)
Definition VP1String.h:49
l
Printing final latex table to .tex output file.

◆ bezier()

void IParticleHandle_Muon::bezier ( Amg::Vector3D & output,
Amg::Vector3D & a,
Amg::Vector3D & b,
Amg::Vector3D & c,
Amg::Vector3D & d,
float t )

Definition at line 269 of file IParticleHandle_Muon.cxx.

269 {
270 // DeCasteljau subdivision
271 Amg::Vector3D ab,bc,cd,abbc,bccd;
272 linear(ab, a,b,t); // point between a and b (green)
273 linear(bc, b,c,t); // point between b and c (green)
274 linear(cd, c,d,t); // point between c and d (green)
275 linear(abbc, ab,bc,t); // point between ab and bc (blue)
276 linear(bccd, bc,cd,t); // point between bc and cd (blue)
277 linear(output, abbc,bccd,t); // point on the bezier-curve (black)
278}
static Double_t a
void linear(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, float t)

◆ browserTreeItem()

QTreeWidgetItem * AODHandleBase::browserTreeItem ( ) const
inherited

Return the QTreeWidgetItem;.

Definition at line 311 of file AODHandleBase.cxx.

311 {
312 return m_d->m_objBrowseTree;
313}

◆ charge()

double IParticleHandle_Muon::charge ( ) const
virtual

Returns unknown() in case of trouble.

Implements IParticleHandleBase.

Definition at line 458 of file IParticleHandle_Muon.cxx.

459{
460 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
461 m_d->collHandle->printMsgNoTrackParticle();
462 return 0.0;
463 }
464 return m_d->muon->primaryTrackParticle()->charge();
465}

◆ clear3DObjects()

void IParticleHandle_Muon::clear3DObjects ( )
virtual

Delete objects.

Implements AODHandleBase.

Definition at line 81 of file IParticleHandle_Muon.cxx.

81 {
82 VP1Msg::messageVerbose("IParticleHandle_Muon::clear3DObjects()");
83
84 if (m_d->line) {
85 m_d->line->unref();
86 m_d->line=0;
87 }
88 if (m_d->sep) {
89 m_d->sep->unref();
90 m_d->sep=0;
91 }
92}

◆ clicked()

QStringList IParticleHandle_Muon::clicked ( ) const
virtual

Called when user selects the node (stringlist is displayed in messagebox).

Reimplementations should add info momInfo() to get momentum, eta, phi, pid,charge, mass printed.

Implements AODHandleBase.

Definition at line 321 of file IParticleHandle_Muon.cxx.

322{
323 QStringList l;
324 l << "Muon:";
326 switch (m_d->muon->muonType()){
327 case xAOD::Muon::Combined:
328 l << "Type = Combined";
329 break;
330 case xAOD::Muon::MuonStandAlone:
331 l << "Type = MuonStandAlone";
332 break;
333 case xAOD::Muon::SegmentTagged:
334 l << "Type = SegmentTagged";
335 break;
336 case xAOD::Muon::CaloTagged:
337 l << "Type = CaloTagged";
338 break;
339 case xAOD::Muon::SiliconAssociatedForwardMuon:
340 l << "Type = SiliconAssociatedForwardMuon";
341 break;
342 default:
343 l << "Type = Unknown";
344 }
345
346 switch (m_d->muon->quality()){
347 case xAOD::Muon::Tight:
348 l << "Quality = Tight";
349 break;
350 case xAOD::Muon::Medium:
351 l << "Quality = Medium";
352 break;
353 case xAOD::Muon::Loose:
354 l << "Quality = Loose";
355 break;
356 case xAOD::Muon::VeryLoose:
357 l << "Quality = VeryLoose";
358 break;
359 default:
360 l << "Quality = Unknown";
361 }
362
363 return l;
364}
virtual QStringList baseInfo() const

◆ collHandle()

const AODCollHandleBase * AODHandleBase::collHandle ( ) const
inlineinherited

Definition at line 55 of file AODHandleBase.h.

55{ return m_collhandle; }

◆ common()

const AODSysCommonData * AODHandleBase::common ( ) const
inherited

Definition at line 93 of file AODHandleBase.cxx.

94{
95 return std::as_const(m_collhandle)->common();
96}

◆ currentMaterial()

SoMaterial * AODHandleBase::currentMaterial ( ) const
inlineinherited

Returns the current material of the handle.

Definition at line 76 of file AODHandleBase.h.

76{ return m_currentmaterial; }

◆ currentMaterialChanged()

virtual void AODHandleBase::currentMaterialChanged ( )
inlineprotectedvirtualinherited

Definition at line 111 of file AODHandleBase.h.

111{};

◆ detach3DObjects()

void AODHandleBase::detach3DObjects ( )
virtualinherited

Remove from the scene graph.

Definition at line 191 of file AODHandleBase.cxx.

192{
193 VP1Msg::messageVerbose("AODHandleBase::detach3DObjects");
194
196 return;//Can never have been attached!
197 if (has3DObjects() && m_collhandle->sepHelper()) {
198 m_collhandle->sepHelper()->removeNodeUnderMaterial(nodes(),m_currentmaterial);
199 }
200
201 m_collhandle->common()->deregisterHandle(this);
202
203 // if (label_sep && theclass->common()->textSep())
204 // theclass->common()->textSep()->removeChild(label_sep);
205}

◆ determineMaterial()

SoMaterial * IParticleHandleBase::determineMaterial ( )
virtualinherited

Should be implemented by children, in order to change the material depending on the interface etc.

This will (by default) return the collection material.

Implements AODHandleBase.

Definition at line 71 of file IParticleHandleBase.cxx.

71 {
72 // By default we use the collection material.
73 // std::cout<<"AODHandleBase::determineMaterial() - collHandle()->material()"<<collHandle()->material()<<std::endl;
74 return collHandle()->material();
75}
const AODCollHandleBase * collHandle() const
SoMaterial * material() const

◆ dumpToJSON()

virtual void AODHandleBase::dumpToJSON ( std::ofstream & ) const
inlinevirtualinherited

◆ ensureInitSubSysHitInfo()

void IParticleHandle_Muon::ensureInitSubSysHitInfo ( ) const
private

◆ fillLineFromSplineFit()

void IParticleHandle_Muon::fillLineFromSplineFit ( const std::vector< Amg::Vector3D > & positions,
const std::vector< Amg::Vector3D > & momenta )

Definition at line 280 of file IParticleHandle_Muon.cxx.

280 {
281 int iver(0);
282 unsigned int npointsused(0);
283 // Create new lineset etc
284 m_d->line = new SoLineSet();
285 m_d->line->ref();
286
287 // For the moment, lets just draw the lines.
288 // std::cout<<"About to loop over "<<positions.size()<<" points to make line"<<std::endl;
289 SoVertexProperty * vertices = new SoVertexProperty();
290
291 for (unsigned int i=1; i<positions.size(); ++i){
292 // std::cout<<"i: "<<i<<" at ("<<positions[i].x()<<","<<positions[i].y()<<","<<positions[i].z()<<")"<<" \tmom = ("<<momenta[i].x()<<","<<momenta[i].y()<<","<<momenta[i].z()<<")"<<std::endl;
293 // unsigned int maxCount=m_d->collHandle->collSettingsButton().numOfStepsForInterpolation();
294 unsigned int maxCount=4;
295 float scale = ( (positions[i]-positions[i-1]).mag() )/2.0;
296 Amg::Vector3D p0(positions[i-1]);
297 Amg::Vector3D p1(positions[i-1]+(scale * momenta[i-1].unit() ) );
298 Amg::Vector3D p2(positions[i] -(scale * momenta[i].unit() ) );
299 Amg::Vector3D p3(positions[i]);
300 // std::cout<<"p0: "<<p0<<"\np1: "<<p1<<"\np2: "<<p2<<"\np3: "<<p3<<std::endl;
301
302 for (unsigned int count=0; count<maxCount;++count){
303 float t=count/(float)maxCount;
305 bezier(pos, p0, p1, p2, p3, t);
306 // std::cout<<"i: "<<count<<" \tat ("<<pos.x()<<","<<pos.y()<<","<<pos.z()<<")"<<" \tmomdelta = ("<<momdelta.x()<<","<<momdelta.y()<<","<<momdelta.z()<<")"<<std::endl;
307
308 // pos = pos + momdelta;
309 vertices->vertex.set1Value(iver++,pos.x(),pos.y(),pos.z());
310
311 npointsused++;
312 }
313 }
314 // Add to SoLine set
315 m_d->line->numVertices.set1Value(0,npointsused);
316 m_d->line->vertexProperty = vertices;
317
318}
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
void bezier(Amg::Vector3D &output, Amg::Vector3D &a, Amg::Vector3D &b, Amg::Vector3D &c, Amg::Vector3D &d, float t)
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146

◆ fillObjectBrowser()

void IParticleHandle_Muon::fillObjectBrowser ( QList< QTreeWidgetItem * > & list)
virtual

Create and fill the object browser QTreeWidgetItem.

Reimplemented from AODHandleBase.

Definition at line 538 of file IParticleHandle_Muon.cxx.

539{
540 IParticleHandleBase::fillObjectBrowser(listOfItems); // Obligatory!
541
542 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
543 m_d->collHandle->printMsgNoTrackParticle();
544 return;
545 }
546
547
548 QTreeWidgetItem* TSOSitem = new QTreeWidgetItem(browserTreeItem());
549 TSOSitem->setText(0, QString("Def. Parameters [d0,z0,phi0,theta,qOverP]" ) );
550 QString dParameters("(");
551 dParameters+=QString::number(m_d->muon->primaryTrackParticle()->d0());
552 dParameters+=", ";
553 dParameters+=QString::number(m_d->muon->primaryTrackParticle()->z0());
554 dParameters+=", ";
555 dParameters+=QString::number(m_d->muon->primaryTrackParticle()->phi0());
556 dParameters+=", ";
557 dParameters+=QString::number(m_d->muon->primaryTrackParticle()->theta());
558 dParameters+=", ";
559 dParameters+=QString::number(m_d->muon->primaryTrackParticle()->qOverP());
560 dParameters+=")";
561 TSOSitem->setText(1, dParameters );
562
563 for (unsigned int i=0; i<m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
564 QTreeWidgetItem* TSOSitem = new QTreeWidgetItem(browserTreeItem());
565 TSOSitem->setText(0, QString("Parameter "+QString::number( i+1 ) ) );
566 QString pos(", Position = (");
567 pos+=QString::number(m_d->muon->primaryTrackParticle()->parameterX(i));
568 pos+=", ";
569 pos+=QString::number(m_d->muon->primaryTrackParticle()->parameterY(i));
570 pos+=", ";
571 pos+=QString::number(m_d->muon->primaryTrackParticle()->parameterZ(i));
572 pos+=")";
573
574 switch (m_d->muon->primaryTrackParticle()->parameterPosition(i)){
575 case xAOD::BeamLine:
576 TSOSitem->setText(1, QString("BeamLine" )+pos );
577 break;
579 TSOSitem->setText(1, QString("FirstMeasurement")+pos );
580 break;
582 TSOSitem->setText(1, QString("LastMeasurement" )+pos );
583 break;
585 TSOSitem->setText(1, QString("CalorimeterEntrance")+pos );
586 break;
588 TSOSitem->setText(1, QString("CalorimeterExit" )+pos );
589 break;
591 TSOSitem->setText(1, QString("MuonSpectrometerEntrance")+pos );
592 break;
593 default:
594 TSOSitem->setText(1, QString("Undefined")+pos );
595 }
596 }
597
598 // TODO - add more.
599}
QTreeWidgetItem * browserTreeItem() const
Return the QTreeWidgetItem;.
virtual void fillObjectBrowser(QList< QTreeWidgetItem * > &list)
Create and fill the object browser QTreeWidgetItem.
@ MuonSpectrometerEntrance
Parameter defined at the entrance to the Muon Spectrometer.
@ BeamLine
Parameter defined at the Vertex/Beamline.
@ CalorimeterExit
Parameter defined at the exit of the calorimeter.
@ CalorimeterEntrance
Parameter defined at the entrance to the calorimeter.
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
@ LastMeasurement
Parameter defined at the position of the last measurement.

◆ has3DObjects()

bool IParticleHandle_Muon::has3DObjects ( )
virtual

Returns true if the 3D objects have been created.

Reimplemented from AODHandleBase.

Definition at line 78 of file IParticleHandle_Muon.cxx.

78 {
79 return 0!=m_d->sep;
80}

◆ hasCharge()

bool IParticleHandleBase::hasCharge ( ) const
inlineinherited

Definition at line 59 of file IParticleHandleBase.h.

59{ return charge()!=unknown(); }
static double unknown()
virtual double charge() const =0

◆ hasMass()

bool IParticleHandleBase::hasMass ( ) const
inlineinherited

Definition at line 60 of file IParticleHandleBase.h.

60{ return mass()!=unknown(); }
virtual double mass() const
Returns unknown() in case of trouble.

◆ iParticle()

const xAOD::IParticle & IParticleHandle_Muon::iParticle ( ) const
virtual

Implements IParticleHandleBase.

Definition at line 449 of file IParticleHandle_Muon.cxx.

450{
451 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
452 m_d->collHandle->printMsgNoTrackParticle();
453 }
454 return *(m_d->muon->primaryTrackParticle());
455}

◆ linear()

void IParticleHandle_Muon::linear ( Amg::Vector3D & output,
Amg::Vector3D & a,
Amg::Vector3D & b,
float t )

Definition at line 262 of file IParticleHandle_Muon.cxx.

262 {
263 float x = a.x() + (b.x()-a.x())*t;
264 float y = a.y() + (b.y()-a.y())*t;
265 float z = a.z() + (b.z()-a.z())*t;
267}
#define y
#define x
#define z
output
Definition merge.py:16

◆ mass()

double IParticleHandleBase::mass ( ) const
virtualinherited

Returns unknown() in case of trouble.

Definition at line 78 of file IParticleHandleBase.cxx.

79{
80 return 0.0;
81}

◆ momentum()

Amg::Vector3D IParticleHandle_Muon::momentum ( ) const
virtual

Reimplemented from IParticleHandleBase.

Definition at line 402 of file IParticleHandle_Muon.cxx.

403 {
404 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
405 m_d->collHandle->printMsgNoTrackParticle();
406 return Amg::Vector3D();
407 }
408 //return Amg::Vector3D(); // RMB test
409 const Trk::Perigee& p = m_d->muon->primaryTrackParticle()->perigeeParameters();
410 return p.momentum();
411 }

◆ muon()

const xAOD::Muon & IParticleHandle_Muon::muon ( ) const

Definition at line 477 of file IParticleHandle_Muon.cxx.

478{
479 return *(m_d->muon);
480}

◆ muonTypeString()

QString IParticleHandle_Muon::muonTypeString ( ) const

Definition at line 482 of file IParticleHandle_Muon.cxx.

482 {
483 switch (m_d->muon->muonType()) {
484 case xAOD::Muon::Combined:
485 return QString("Combined");
486 case xAOD::Muon::MuonStandAlone:
487 return QString("MuonStandAlone");
488 case xAOD::Muon::SegmentTagged:
489 return QString("SegmentTagged");
490 case xAOD::Muon::CaloTagged:
491 return QString("CaloTagged");
492 case xAOD::Muon::SiliconAssociatedForwardMuon:
493 return QString("SiliconAssociatedForwardMuon");
494 default:
495 return QString("Unknown Muon type");
496 }
497}

◆ nodes()

SoNode * IParticleHandle_Muon::nodes ( )
virtual

Returns the 3Dobjects.

Implements AODHandleBase.

Definition at line 179 of file IParticleHandle_Muon.cxx.

179 {
180 VP1Msg::messageVerbose("IParticleHandle_Muon::nodes with d->sep="+VP1Msg::str(m_d->sep));
181
182 if (m_d->sep) {
183 VP1Msg::messageVerbose("IParticleHandle_Muon::nodes() - already have sep so not doing anything.");
184 return m_d->sep;
185 }
186 if (!m_d->sep) {
187 m_d->sep = new SoSeparator();
188 m_d->sep->ref();
189 }
190
193
194 return m_d->sep;
195}

◆ numberOfInstances()

int AODHandleBase::numberOfInstances ( )
staticinherited

Definition at line 87 of file AODHandleBase.cxx.

88{
89 return Imp::nobjhandles;
90}
static std::atomic< int > nobjhandles

◆ parametersAndPositions()

const QList< std::pair< xAOD::ParameterPosition, Amg::Vector3D > > & IParticleHandle_Muon::parametersAndPositions ( ) const

Definition at line 601 of file IParticleHandle_Muon.cxx.

601 {
602 // 1st position
603 if (!m_d->parametersAndPositions.isEmpty())
604 return m_d->parametersAndPositions;
605
606 typedef std::pair<xAOD::ParameterPosition, Amg::Vector3D> paramAndPos;
607
608 #if defined BUILDVP1LIGHT
609 m_d->parametersAndPositions.append(paramAndPos(xAOD::BeamLine, position() ) );
610 #else
611 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
612 m_d->collHandle->printMsgNoTrackParticle();
613 return m_d->parametersAndPositions;
614 }
615 const Trk::Perigee& peri = m_d->muon->primaryTrackParticle()->perigeeParameters (); // FIXME - I'd quite like not to use anything which requires Athena ...
616 m_d->parametersAndPositions.append(paramAndPos(xAOD::BeamLine, Amg::Vector3D(peri.position().x(),peri.position().y(),peri.position().z()) ) );
617 #endif // BUILDVP1LIGHT
618
619 float x,y,z;
620 for (unsigned int i=0; i<m_d->muon->primaryTrackParticle()->numberOfParameters() ; ++i){
621 x = m_d->muon->primaryTrackParticle()->parameterX(i);
622 y = m_d->muon->primaryTrackParticle()->parameterY(i);
623 z = m_d->muon->primaryTrackParticle()->parameterZ(i);
624
625 m_d->parametersAndPositions.append(paramAndPos(m_d->muon->primaryTrackParticle()->parameterPosition(i), Amg::Vector3D(x,y,z)));
626 }
627 return m_d->parametersAndPositions;
628}

◆ position()

Amg::Vector3D IParticleHandle_Muon::position ( ) const
virtual

Definition at line 437 of file IParticleHandle_Muon.cxx.

438 {
439 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
440 m_d->collHandle->printMsgNoTrackParticle();
441 return Amg::Vector3D();
442 }
443 const Trk::Perigee& p = m_d->muon->primaryTrackParticle()->perigeeParameters();
444 return p.position(); // TODO: check what this returns
445 }

◆ quality()

unsigned int IParticleHandle_Muon::quality ( ) const

Definition at line 468 of file IParticleHandle_Muon.cxx.

469{
470 if( !(m_d->collHandle->hasPrimaryTrackParticleInfo()) ) {
471 m_d->collHandle->printMsgNoTrackParticle();
472 return 0;
473 }
474 return static_cast<unsigned int>(m_d->muon->quality());
475}

◆ qualityString()

QString IParticleHandle_Muon::qualityString ( ) const

Definition at line 499 of file IParticleHandle_Muon.cxx.

499 {
500 switch (m_d->muon->quality()) {
501 case xAOD::Muon::Tight:
502 return QString("Tight");
503 case xAOD::Muon::Medium:
504 return QString("Medium");
505 case xAOD::Muon::Loose:
506 return QString("Loose");
507 case xAOD::Muon::VeryLoose:
508 return QString("VeryLoose");
509 default:
510 return QString("Unknown Muon quality");
511 }
512}

◆ rebuild3DObjects()

void AODHandleBase::rebuild3DObjects ( )
virtualinherited

Definition at line 137 of file AODHandleBase.cxx.

138{
139 QString tmp2 = (m_visible==true)?"True":"False";
140 VP1Msg::messageDebug("AODHandleBase::rebuild3DObjects() - with m_visible="+tmp2 );
141
142 //Ensure we are always detached while updating.
143 if (m_visible) {
145 }
146
148 nodes(); // rebuilds the 3D shapes
149
150 //Attach if visible:
151 if (m_visible) {
153 }
154}
virtual void clear3DObjects()=0
Delete objects.
virtual void detach3DObjects()
Remove from the scene graph.
virtual void attach3DObjects()
Connect to the scene graph.
static void messageDebug(const QString &)
Definition VP1Msg.cxx:39

◆ setVisible()

void AODHandleBase::setVisible ( bool vis)
inherited

use by the collection handle.

Definition at line 99 of file AODHandleBase.cxx.

100{
101 QString tmp = (vis==true)?"True":"False";
102 QString tmp2 = (m_visible==true)?"True":"False";
103 VP1Msg::messageDebug(QString("AODHandleBase calling setVisible with vis=")+tmp+QString(", and m_visible=")+tmp2 );
104 if (vis==m_visible)
105 return;
106
107 m_visible=vis;
108 if (vis) {
109 m_collhandle->incrementNShownHandles();
110
111 if (!has3DObjects())
112 rebuild3DObjects();//The call to rebuild also fixes attached state.
113 else
115 } else {
116 m_collhandle->decrementNShownHandles();
118 }
119
121}
virtual void rebuild3DObjects()
virtual void visibleStateChanged()
Dummy implementation does nothing.

◆ shortInfo()

QString IParticleHandle_Muon::shortInfo ( ) const
virtual

This returns the information shown about the object in the object browser.

Reimplemented from AODHandleBase.

Definition at line 527 of file IParticleHandle_Muon.cxx.

528{
529
530 QString l("");
531 l+= "|P|=";
532 l+= VP1Msg::str(momentum().mag()/SYSTEM_OF_UNITS::GeV)+" [GeV], ";
533 l+= muonTypeString() + ", ";
534 l+= qualityString();
535 return l;
536}
Scalar mag() const
mag method

◆ type()

virtual QString IParticleHandle_Muon::type ( ) const
inlinevirtual

return very short word with type (maybe link with collection type?)

Reimplemented from AODHandleBase.

Definition at line 46 of file IParticleHandle_Muon.h.

◆ unknown()

double AODHandleBase::unknown ( )
inlinestaticinherited

Definition at line 93 of file AODHandleBase.h.

93{ return -999.0; }

◆ update3DObjects()

void AODHandleBase::update3DObjects ( )
virtualinherited

Called after some configuration changes, or when the object is first created. Must be overloaded by children.

Definition at line 125 of file AODHandleBase.cxx.

126{
127 if (m_visible) {
129 } else {
130 //Simply clear the present 3D objects. They will only be recreated if/when the track/jet becomes visible again.
132 }
133}

◆ updateMaterial()

void AODHandleBase::updateMaterial ( )
inherited

Called after some configuration related to material changes.

Definition at line 208 of file AODHandleBase.cxx.

209{
210 VP1Msg::messageVerbose("AODHandleBase::updateMaterial()");
211
212 //We need to change the current material. This means we need to
213 //clear the cache. Only if we are visible do we need to do a
214 //detach->clear material->attach cycle to trigger attachment under new material.
215
217 return;//We have no material cached and is thus not attached either.
218 if (m_visible) {
219 //See if the material changed. If it did, detach, update the material, attach again.
220 SoMaterial * newmat = determineMaterial();
221 newmat->ref();
222 if (newmat!=m_currentmaterial) {
224 m_currentmaterial->unref();
225 m_currentmaterial = newmat;
228 } else {
229 newmat->unref();
230 }
231 } else {
232 //Just clear material.
233 m_currentmaterial->unref();
236 }
237}

◆ updateObjectBrowser()

void AODHandleBase::updateObjectBrowser ( )
inlineinherited

Update object browser QTreeWidgetItem.

Definition at line 102 of file AODHandleBase.h.

102{};

◆ visible()

bool AODHandleBase::visible ( ) const
inlineinherited

Definition at line 54 of file AODHandleBase.h.

54{ return m_visible; }

◆ visibleStateChanged()

void AODHandleBase::visibleStateChanged ( )
protectedvirtualinherited

Dummy implementation does nothing.

override if need to take action in this case.

Definition at line 316 of file AODHandleBase.cxx.

317{
318 if ( !browserTreeItem()) {
319 VP1Msg::messageVerbose("visibleStateChanged: No m_objBrowseTree!");
320 return;
321 }
322
323 if (!visible()) {
324 browserTreeItem()->setFlags(Qt::ItemFlags()); // not selectable, not enabled
325 } else {
326 browserTreeItem()->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); // selectable, enabled
327 }
328 QFont itemFont = browserTreeItem()->font(0);
329 itemFont.setStrikeOut(!visible());
330 browserTreeItem()->setFont(0, itemFont);
331 browserTreeItem()->setFont(1, itemFont);
332}
bool visible() const

Member Data Documentation

◆ m_collhandle

AODCollHandleBase* AODHandleBase::m_collhandle
privateinherited

Definition at line 126 of file AODHandleBase.h.

◆ m_currentmaterial

SoMaterial* AODHandleBase::m_currentmaterial
privateinherited

Definition at line 127 of file AODHandleBase.h.

◆ m_d

Imp* IParticleHandle_Muon::m_d
private

Definition at line 66 of file IParticleHandle_Muon.h.

◆ m_visible

bool AODHandleBase::m_visible
privateinherited

Definition at line 125 of file AODHandleBase.h.


The documentation for this class was generated from the following files: