ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
IParticleHandleBase Class Referenceabstract

#include <IParticleHandleBase.h>

Inheritance diagram for IParticleHandleBase:
Collaboration diagram for IParticleHandleBase:

Classes

class  Imp
 

Public Member Functions

 IParticleHandleBase (IParticleCollHandleBase *)
 
virtual ~IParticleHandleBase ()
 
SoMaterial * determineMaterial ()
 Should be implemented by children, in order to change the material depending on the interface etc. More...
 
virtual QStringList baseInfo () const
 
virtual Amg::Vector3D momentum () const
 
virtual const xAOD::IParticleiParticle () const =0
 
virtual double charge () const =0
 
virtual double mass () const
 Returns unknown() in case of trouble. More...
 
bool hasCharge () const
 
bool hasMass () const
 
const AODSysCommonDatacommon () const
 
void setVisible (bool)
 use by the collection handle. More...
 
bool visible () const
 
const AODCollHandleBasecollHandle () const
 
virtual bool has3DObjects ()
 Returns true if the 3D objects have been created. More...
 
virtual void update3DObjects ()
 Called after some configuration changes, or when the object is first created. Must be overloaded by children. More...
 
virtual void rebuild3DObjects ()
 
virtual void clear3DObjects ()=0
 Delete objects. More...
 
virtual void attach3DObjects ()
 Connect to the scene graph. More...
 
virtual void detach3DObjects ()
 Remove from the scene graph. More...
 
virtual SoNode * nodes ()=0
 Returns the 3Dobjects. More...
 
void updateMaterial ()
 Called after some configuration related to material changes. More...
 
SoMaterial * currentMaterial () const
 Returns the current material of the handle. More...
 
virtual QStringList clicked () const =0
 Called when user selects the node (stringlist is displayed in messagebox). More...
 
virtual QString shortInfo () const
 returns mom and hit information about track More...
 
virtual QString type () const
 return very short word with type (maybe link with collection type?) More...
 
virtual void fillObjectBrowser (QList< QTreeWidgetItem * > &list)
 Create and fill the object browser QTreeWidgetItem. More...
 
void updateObjectBrowser ()
 Update object browser QTreeWidgetItem. More...
 
QTreeWidgetItem * browserTreeItem () const
 Return the QTreeWidgetItem;. More...
 
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. More...
 
virtual void currentMaterialChanged ()
 

Private Member Functions

 IParticleHandleBase (const IParticleHandleBase &)
 
IParticleHandleBaseoperator= (const IParticleHandleBase &)
 

Private Attributes

Impm_d
 
bool m_visible
 
AODCollHandleBasem_collhandle
 
SoMaterial * m_currentmaterial
 

Detailed Description

Definition at line 42 of file IParticleHandleBase.h.

Constructor & Destructor Documentation

◆ IParticleHandleBase() [1/2]

IParticleHandleBase::IParticleHandleBase ( IParticleCollHandleBase ch)

Definition at line 59 of file IParticleHandleBase.cxx.

60  : AODHandleBase(ch), m_d(new Imp(this))
61 {
62 }

◆ ~IParticleHandleBase()

IParticleHandleBase::~IParticleHandleBase ( )
virtual

Definition at line 65 of file IParticleHandleBase.cxx.

66 {
67  delete m_d;
68 }

◆ IParticleHandleBase() [2/2]

IParticleHandleBase::IParticleHandleBase ( const IParticleHandleBase )
private

Member Function Documentation

◆ 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 
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 );
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 }

◆ baseInfo()

QStringList IParticleHandleBase::baseInfo ( ) const
virtual

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 }

◆ 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()

virtual double IParticleHandleBase::charge ( ) const
pure virtual

◆ clear3DObjects()

virtual void AODHandleBase::clear3DObjects ( )
pure virtualinherited

◆ clicked()

virtual QStringList AODHandleBase::clicked ( ) const
pure virtualinherited

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.

Implemented in IParticleHandle_CaloCluster, VertexHandle, IParticleHandle_Jet, IParticleHandle_Electron, IParticleHandle_TrackParticle, MissingEtHandle, and IParticleHandle_Muon.

◆ 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 
195  if (!m_currentmaterial)
196  return;//Can never have been attached!
197  if (has3DObjects() && m_collhandle->sepHelper()) {
199  }
200 
202 
203  // if (label_sep && theclass->common()->textSep())
204  // theclass->common()->textSep()->removeChild(label_sep);
205 }

◆ determineMaterial()

SoMaterial * IParticleHandleBase::determineMaterial ( )
virtual

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 }

◆ dumpToJSON()

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

◆ fillObjectBrowser()

void AODHandleBase::fillObjectBrowser ( QList< QTreeWidgetItem * > &  list)
virtualinherited

Create and fill the object browser QTreeWidgetItem.

Reimplemented in IParticleHandle_Electron, IParticleHandle_TrackParticle, MissingEtHandle, IParticleHandle_Muon, IParticleHandle_CaloCluster, and IParticleHandle_Jet.

Definition at line 288 of file AODHandleBase.cxx.

288  {
289 
290  VP1Msg::messageDebug("AODHandleBase::fillObjectBrowser()");
291 
292  if (m_d->m_objBrowseTree){
293  VP1Msg::message("ERROR: AODHandleBase::fillObjectBrowser - already have m_objBrowseTree. Aborting.");
294  return;
295  }
296 
297  m_d->m_objBrowseTree = new QTreeWidgetItem();
298 
299  QString l = shortInfo();
300 
301  m_d->m_objBrowseTree->setText(0, type()+QString(QString::number(listOfItems.size())) );
302  m_d->m_objBrowseTree->setText(1, l );
303 
304  if (!visible()) {
305  m_d->m_objBrowseTree->setFlags(Qt::ItemFlags()); // not selectable, not enabled
306  }
307  listOfItems << browserTreeItem();
308 }

◆ has3DObjects()

virtual bool AODHandleBase::has3DObjects ( )
inlinevirtualinherited

Returns true if the 3D objects have been created.

Reimplemented in IParticleHandle_CaloCluster, VertexHandle, IParticleHandle_Jet, IParticleHandle_Electron, IParticleHandle_TrackParticle, MissingEtHandle, and IParticleHandle_Muon.

Definition at line 57 of file AODHandleBase.h.

57 {return false;}

◆ hasCharge()

bool IParticleHandleBase::hasCharge ( ) const
inline

Definition at line 59 of file IParticleHandleBase.h.

59 { return charge()!=unknown(); }

◆ hasMass()

bool IParticleHandleBase::hasMass ( ) const
inline

Definition at line 60 of file IParticleHandleBase.h.

60 { return mass()!=unknown(); }

◆ iParticle()

virtual const xAOD::IParticle& IParticleHandleBase::iParticle ( ) const
pure virtual

◆ mass()

double IParticleHandleBase::mass ( ) const
virtual

Returns unknown() in case of trouble.

Definition at line 78 of file IParticleHandleBase.cxx.

79 {
80  return 0.0;
81 }

◆ momentum()

virtual Amg::Vector3D IParticleHandleBase::momentum ( ) const
inlinevirtual

Reimplemented in IParticleHandle_Electron, IParticleHandle_TrackParticle, and IParticleHandle_Muon.

Definition at line 52 of file IParticleHandleBase.h.

52 { return Amg::Vector3D(0,0,0); }

◆ nodes()

virtual SoNode* AODHandleBase::nodes ( )
pure virtualinherited

◆ numberOfInstances()

int AODHandleBase::numberOfInstances ( )
staticinherited

Definition at line 87 of file AODHandleBase.cxx.

88 {
89  return Imp::nobjhandles;
90 }

◆ operator=()

IParticleHandleBase& IParticleHandleBase::operator= ( const IParticleHandleBase )
private

◆ 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) {
144  detach3DObjects();
145  }
146 
147  clear3DObjects();
148  nodes(); // rebuilds the 3D shapes
149 
150  //Attach if visible:
151  if (m_visible) {
152  attach3DObjects();
153  }
154 }

◆ 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) {
110 
111  if (!has3DObjects())
112  rebuild3DObjects();//The call to rebuild also fixes attached state.
113  else
114  attach3DObjects();
115  } else {
117  detach3DObjects();
118  }
119 
121 }

◆ shortInfo()

virtual QString AODHandleBase::shortInfo ( ) const
inlinevirtualinherited

returns mom and hit information about track

Reimplemented in IParticleHandle_CaloCluster, IParticleHandle_Electron, IParticleHandle_Jet, IParticleHandle_TrackParticle, VertexHandle, MissingEtHandle, and IParticleHandle_Muon.

Definition at line 95 of file AODHandleBase.h.

◆ type()

virtual QString AODHandleBase::type ( ) const
inlinevirtualinherited

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

Reimplemented in IParticleHandle_CaloCluster, VertexHandle, IParticleHandle_Electron, IParticleHandle_Jet, IParticleHandle_TrackParticle, MissingEtHandle, and IParticleHandle_Muon.

Definition at line 96 of file AODHandleBase.h.

◆ unknown()

static 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.
131  clear3DObjects();
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 
216  if (!m_currentmaterial)
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) {
223  detach3DObjects();
224  m_currentmaterial->unref();
225  m_currentmaterial = newmat;
226  attach3DObjects();
228  } else {
229  newmat->unref();
230  }
231  } else {
232  //Just clear material.
233  m_currentmaterial->unref();
234  m_currentmaterial = 0;
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 }

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* IParticleHandleBase::m_d
private

Definition at line 71 of file IParticleHandleBase.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:
AODHandleBase::visible
bool visible() const
Definition: AODHandleBase.h:54
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
DeMoUpdate.tmp2
string tmp2
Definition: DeMoUpdate.py:1168
AODHandleBase::unknown
static double unknown()
Definition: AODHandleBase.h:93
VP1StdCollection::material
SoMaterial * material() const
Definition: VP1StdCollection.cxx:220
AODHandleBase::AODHandleBase
AODHandleBase(AODCollHandleBase *)
Definition: AODHandleBase.cxx:73
AODHandleBase::detach3DObjects
virtual void detach3DObjects()
Remove from the scene graph.
Definition: AODHandleBase.cxx:191
VP1ExtraSepLayerHelper::addNodeUnderMaterial
void addNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:190
AODHandleBase::m_collhandle
AODCollHandleBase * m_collhandle
Definition: AODHandleBase.h:126
IParticleHandleBase::m_d
Imp * m_d
Definition: IParticleHandleBase.h:70
AODHandleBase::collHandle
const AODCollHandleBase * collHandle() const
Definition: AODHandleBase.h:55
AODHandleBase::determineMaterial
virtual SoMaterial * determineMaterial()=0
Should be implemented by children, in order to change the material depending on the interface etc.
VP1ExtraSepLayerHelper::removeNodeUnderMaterial
void removeNodeUnderMaterial(SoNode *, SoMaterial *)
Definition: VP1ExtraSepLayerHelper.cxx:216
AODHandleBase::has3DObjects
virtual bool has3DObjects()
Returns true if the 3D objects have been created.
Definition: AODHandleBase.h:57
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
IParticleHandleBase::charge
virtual double charge() const =0
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
AODHandleBase::currentMaterialChanged
virtual void currentMaterialChanged()
Definition: AODHandleBase.h:111
AODCollHandleBase::common
const AODSysCommonData * common() const
Definition: AODCollHandleBase.h:88
AODCollHandleBase::incrementNShownHandles
void incrementNShownHandles()
Definition: AODCollHandleBase.h:132
VP1LinAlgUtils::phiFromXY
static double phiFromXY(const double &x, const double &y)
Definition: VP1LinAlgUtils.cxx:374
AODHandleBase::attach3DObjects
virtual void attach3DObjects()
Connect to the scene graph.
Definition: AODHandleBase.cxx:157
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
AODHandleBase::Imp::nobjhandles
static std::atomic< int > nobjhandles
Definition: AODHandleBase.cxx:56
IParticleHandleBase::momentum
virtual Amg::Vector3D momentum() const
Definition: IParticleHandleBase.h:52
AODHandleBase::visibleStateChanged
virtual void visibleStateChanged()
Dummy implementation does nothing.
Definition: AODHandleBase.cxx:316
AODSysCommonData::deregisterHandle
void deregisterHandle(AODHandleBase *h)
Definition: AODSysCommonData.cxx:67
AODHandleBase::browserTreeItem
QTreeWidgetItem * browserTreeItem() const
Return the QTreeWidgetItem;.
Definition: AODHandleBase.cxx:311
AODCollHandleBase::decrementNShownHandles
void decrementNShownHandles()
Definition: AODCollHandleBase.h:133
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
python.selection.number
number
Definition: selection.py:20
AODHandleBase::type
virtual QString type() const
return very short word with type (maybe link with collection type?)
Definition: AODHandleBase.h:96
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
AODHandleBase::nodes
virtual SoNode * nodes()=0
Returns the 3Dobjects.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
AODHandleBase::m_d
Imp * m_d
Definition: AODHandleBase.h:120
AODHandleBase::m_visible
bool m_visible
Definition: AODHandleBase.h:125
AODCollHandleBase::sepHelper
const VP1ExtraSepLayerHelper * sepHelper() const
Definition: AODCollHandleBase.h:90
IParticleHandleBase::mass
virtual double mass() const
Returns unknown() in case of trouble.
Definition: IParticleHandleBase.cxx:78
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
VP1Msg::message
static void message(const QString &, IVP1System *sys=0)
Definition: VP1Msg.cxx:30
AODHandleBase::shortInfo
virtual QString shortInfo() const
returns mom and hit information about track
Definition: AODHandleBase.h:95
AODHandleBase::rebuild3DObjects
virtual void rebuild3DObjects()
Definition: AODHandleBase.cxx:137
AODHandleBase::Imp::m_objBrowseTree
QTreeWidgetItem * m_objBrowseTree
Definition: AODHandleBase.cxx:65
AODSysCommonData::registerHandle
void registerHandle(AODHandleBase *h)
Definition: AODSysCommonData.cxx:60
AODHandleBase::m_currentmaterial
SoMaterial * m_currentmaterial
Definition: AODHandleBase.h:127
AODHandleBase::clear3DObjects
virtual void clear3DObjects()=0
Delete objects.