OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WFilterPropertyHandler Class Reference

Creates, updates and handles the filter properties. More...

#include <WFilterPropertyHandler.h>

+ Collaboration diagram for WFilterPropertyHandler:

Public Types

typedef std::shared_ptr< WFilterPropertyHandlerSPtr
 Function variables for updating the data. More...
 
typedef boost::function< void() > CallbackPtr
 shared_ptr that points to itself More...
 
typedef boost::bimap< std::string, int > BM_PDG
 bimap to save the pdg to a particlename More...
 
typedef BM_PDG::value_type PdgElement
 represent an Element of a pdg and a particlename for the map More...
 

Public Member Functions

 WFilterPropertyHandler (WProtonData::SPtr protonData, WPropertyGroup::SPtr properties, WFilterPropertyHandler::CallbackPtr dataUpdate)
 constructor More...
 
void createProperties ()
 creates the group property and the subproperty
More...
 
void updateProperty ()
 update current group property and subproperty More...
 
WPropBool getShowPrimaries ()
 Getter. More...
 
WPropBool getShowSecondaries ()
 Getter. More...
 
bool isPDGTypeSelected (int pdgType)
 Check whether the PDG type is contained in the m_selectedPDGTypes. More...
 
void createPDGMap (std::string path)
 creates a bimap out of the names and ids of PDG txt More...
 

Private Member Functions

std::string getParticleNameFilePath ()
 
bool copyFileToHomePath (std::string shareDirFile, std::string homeDirFile)
 Helperfunction to copy the particlename file. More...
 
void searchPDGTypes ()
 Collect all particle types from your input data. More...
 
void updateSelectedPDGTypes ()
 Update the m_selectedPDGTypes. More...
 
void selectPdgAndSaveEvent (WPropertyBase::SPtr property)
 Event of the save button in the rename pdg subgroup. More...
 
void updatePDGProperties ()
 Update PDG Properties (Multiselector and change-Name-Properties) More...
 
void createCheckBoxForPrimaryAndSecondary ()
 Create the Checkbox for primaries and secondaries. More...
 
void createMultiSelectionForPDG ()
 Create the multiselection for the option of PDG. More...
 
void createPropToSetParticleNames ()
 Create the Subgroup for change of PDG names. More...
 
std::string setDefaultForRenameField ()
 Set the default string for the string property textfield. More...
 
void updatePDGTypesProperty (WItemSelection::SPtr particleItemSelectionList)
 Updates possible selectable particle types in multiselection. More...
 
void updateCheckboxProperty (WPropertyBase::SPtr property)
 Reload data when properties for selection of primaries and secondaries changed. More...
 
std::string getParticleNameFromPdg (int pdg)
 Seatch the ParticleName in the map with a given pdg. More...
 
int getPdgFromName (std::string particleName)
 Search the pdg in the map with a given particlename. More...
 
int getPdgFromUnkownParticle (std::string particleName)
 get the PDG number of an unknown particle element with the help of regex More...
 
void writePdgMapInParticleNameFile ()
 write the BiMap in the Pdg particle name file More...
 
void changePdgBiMap (int pdg, std::string newParticleName)
 set or replace a particlename and pdg in the bimap More...
 

Private Attributes

WProtonData::SPtr m_protonData
 Pointer to the content and header of the CSV. More...
 
WPropertyGroup::SPtr m_properties
 A property variable that is generated by the WModul. More...
 
WFilterPropertyHandler::CallbackPtr m_dataUpdate
 A function variable that reinitializes the WDataSets. More...
 
BM_PDG m_PdgNamesByID
 A Map of the PDG and their names. More...
 
int m_currentColumnIndex = 0
 The current column that is selected as particle data group. More...
 
std::vector< int > m_pdgTypes
 Stores every unique particle id. More...
 
WPropGroup m_filteringGroup
 Property group for filtering options. More...
 
WPropBool m_showPrimaries
 Decides whether to hide or show primaries. More...
 
WPropBool m_showSecondaries
 Decides whether to hide or show secondaries. More...
 
WPropSelection m_multiSelection
 Stores users selected items. More...
 
WPropGroup m_filteringsubGroup
 Stores subgroup for change the pdg-Name. More...
 
std::shared_ptr< WItemSelectionm_particleItemSelectionList
 Stores selectable items. More...
 
std::vector< int > m_selectedPDGTypes
 vector of the options of PDG More...
 
WPropString m_inputNewParticleName
 A string for the new particle name. More...
 
WPropTrigger m_saveButton
 A trigger for the save button to save changes. More...
 
WPropSelection m_PdgForRenameSelection
 A property to select one pdg to change. More...
 
WPropertyBase::PropertyChangeNotifierType m_notifierSetParticleName
 A notifier for the Changeevents of the Rename PDG property. More...
 

Detailed Description

Creates, updates and handles the filter properties.

Definition at line 44 of file WFilterPropertyHandler.h.

Member Typedef Documentation

◆ BM_PDG

typedef boost::bimap< std::string, int > WFilterPropertyHandler::BM_PDG

bimap to save the pdg to a particlename

Definition at line 60 of file WFilterPropertyHandler.h.

◆ CallbackPtr

typedef boost::function< void( ) > WFilterPropertyHandler::CallbackPtr

shared_ptr that points to itself

Definition at line 55 of file WFilterPropertyHandler.h.

◆ PdgElement

typedef BM_PDG::value_type WFilterPropertyHandler::PdgElement

represent an Element of a pdg and a particlename for the map

Definition at line 65 of file WFilterPropertyHandler.h.

◆ SPtr

Function variables for updating the data.

Definition at line 50 of file WFilterPropertyHandler.h.

Constructor & Destructor Documentation

◆ WFilterPropertyHandler()

WFilterPropertyHandler::WFilterPropertyHandler ( WProtonData::SPtr  protonData,
WPropertyGroup::SPtr  properties,
WFilterPropertyHandler::CallbackPtr  dataUpdate 
)
explicit

constructor

Parameters
protonDataPointer to the content and header of the CSV
propertiesA property variable that is generated by the WModul
dataUpdateA function variable that reinitializes the WDataSets

Definition at line 33 of file WFilterPropertyHandler.cpp.

Member Function Documentation

◆ changePdgBiMap()

void WFilterPropertyHandler::changePdgBiMap ( int  pdg,
std::string  newParticleName 
)
private

set or replace a particlename and pdg in the bimap

Parameters
pdgpdg number of a selected particle name
newParticleNamenew particlename of a pdg number
Exceptions
WException

Definition at line 322 of file WFilterPropertyHandler.cpp.

References m_PdgNamesByID, and writePdgMapInParticleNameFile().

Referenced by selectPdgAndSaveEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyFileToHomePath()

bool WFilterPropertyHandler::copyFileToHomePath ( std::string  shareDirFile,
std::string  homeDirFile 
)
private

Helperfunction to copy the particlename file.

Parameters
shareDirFilesourcepath of the particle name file in the share directory
homeDirFiledestinypath of the local directory for the particle name file
Returns
true copy was succesful
false copy was unsuccesful

Definition at line 363 of file WFilterPropertyHandler.cpp.

Referenced by createPDGMap().

+ Here is the caller graph for this function:

◆ createCheckBoxForPrimaryAndSecondary()

void WFilterPropertyHandler::createCheckBoxForPrimaryAndSecondary ( )
private

Create the Checkbox for primaries and secondaries.

Definition at line 90 of file WFilterPropertyHandler.cpp.

References m_filteringGroup, m_showPrimaries, m_showSecondaries, and updateCheckboxProperty().

Referenced by createProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createMultiSelectionForPDG()

void WFilterPropertyHandler::createMultiSelectionForPDG ( )
private

Create the multiselection for the option of PDG.

Definition at line 139 of file WFilterPropertyHandler.cpp.

References WPropertyHelper::PC_NOTEMPTY::addTo(), getParticleNameFromPdg(), m_filteringGroup, m_multiSelection, m_particleItemSelectionList, m_pdgTypes, searchPDGTypes(), and updateSelectedPDGTypes().

Referenced by createProperties(), and updatePDGProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createPDGMap()

void WFilterPropertyHandler::createPDGMap ( std::string  path)

creates a bimap out of the names and ids of PDG txt

Parameters
pathfielpath of the pdg particlename file
Exceptions
WException

Definition at line 270 of file WFilterPropertyHandler.cpp.

References copyFileToHomePath(), getParticleNameFilePath(), and m_PdgNamesByID.

+ Here is the call graph for this function:

◆ createProperties()

void WFilterPropertyHandler::createProperties ( )

creates the group property and the subproperty

Definition at line 42 of file WFilterPropertyHandler.cpp.

References createCheckBoxForPrimaryAndSecondary(), createMultiSelectionForPDG(), createPropToSetParticleNames(), m_filteringGroup, m_properties, and updateProperty().

+ Here is the call graph for this function:

◆ createPropToSetParticleNames()

void WFilterPropertyHandler::createPropToSetParticleNames ( )
private

Create the Subgroup for change of PDG names.

Definition at line 174 of file WFilterPropertyHandler.cpp.

References WPropertyHelper::PC_SELECTONLYONE::addTo(), WPropertyHelper::PC_NOTEMPTY::addTo(), m_filteringGroup, m_filteringsubGroup, m_inputNewParticleName, m_notifierSetParticleName, m_particleItemSelectionList, m_PdgForRenameSelection, selectPdgAndSaveEvent(), and setDefaultForRenameField().

Referenced by createProperties(), and updatePDGProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticleNameFilePath()

std::string WFilterPropertyHandler::getParticleNameFilePath ( )
private
Returns
the path of the particle names file

Definition at line 358 of file WFilterPropertyHandler.cpp.

References WPathHelper::getHomePath().

Referenced by createPDGMap(), and writePdgMapInParticleNameFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParticleNameFromPdg()

std::string WFilterPropertyHandler::getParticleNameFromPdg ( int  pdg)
private

Seatch the ParticleName in the map with a given pdg.

Parameters
pdgpdg number of a particlename
Returns
the particle name

Definition at line 299 of file WFilterPropertyHandler.cpp.

References m_PdgNamesByID.

Referenced by createMultiSelectionForPDG().

+ Here is the caller graph for this function:

◆ getPdgFromName()

int WFilterPropertyHandler::getPdgFromName ( std::string  particleName)
private

Search the pdg in the map with a given particlename.

Parameters
particleNameparticlename of a pdg number
Returns
pdg number

Definition at line 306 of file WFilterPropertyHandler.cpp.

References getPdgFromUnkownParticle(), and m_PdgNamesByID.

Referenced by isPDGTypeSelected(), and selectPdgAndSaveEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPdgFromUnkownParticle()

int WFilterPropertyHandler::getPdgFromUnkownParticle ( std::string  particleName)
private

get the PDG number of an unknown particle element with the help of regex

Parameters
particleNameparticle name of an unknown number
Returns
pdg number

Definition at line 313 of file WFilterPropertyHandler.cpp.

Referenced by getPdgFromName().

+ Here is the caller graph for this function:

◆ getShowPrimaries()

WPropBool WFilterPropertyHandler::getShowPrimaries ( )

Getter.

Returns
WPropBool of the ShowPrimaries

Definition at line 260 of file WFilterPropertyHandler.cpp.

References m_showPrimaries.

◆ getShowSecondaries()

WPropBool WFilterPropertyHandler::getShowSecondaries ( )

Getter.

Returns
WPropBool of the ShowSecondaries

Definition at line 265 of file WFilterPropertyHandler.cpp.

References m_showSecondaries.

◆ isPDGTypeSelected()

bool WFilterPropertyHandler::isPDGTypeSelected ( int  pdgType)

Check whether the PDG type is contained in the m_selectedPDGTypes.

Parameters
pdgTypethe int value of the PDG-Type
Returns
true, if it includes. false, if it does not includes

Definition at line 225 of file WFilterPropertyHandler.cpp.

References WItemSelector::at(), getPdgFromName(), m_multiSelection, and WItemSelector::size().

+ Here is the call graph for this function:

◆ searchPDGTypes()

void WFilterPropertyHandler::searchPDGTypes ( )
private

Collect all particle types from your input data.

Definition at line 103 of file WFilterPropertyHandler.cpp.

References m_pdgTypes, and m_protonData.

Referenced by createMultiSelectionForPDG().

+ Here is the caller graph for this function:

◆ selectPdgAndSaveEvent()

void WFilterPropertyHandler::selectPdgAndSaveEvent ( WPropertyBase::SPtr  property)
private

Event of the save button in the rename pdg subgroup.

Parameters
propertycontains reference to the property which called updateProperty()

Definition at line 208 of file WFilterPropertyHandler.cpp.

References WItemSelector::at(), changePdgBiMap(), getPdgFromName(), m_filteringsubGroup, m_inputNewParticleName, m_notifierSetParticleName, m_PdgForRenameSelection, setDefaultForRenameField(), and updatePDGProperties().

Referenced by createPropToSetParticleNames().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultForRenameField()

std::string WFilterPropertyHandler::setDefaultForRenameField ( )
private

Set the default string for the string property textfield.

Returns
the string of the selected item of the itemselector

Definition at line 195 of file WFilterPropertyHandler.cpp.

References WItemSelector::at(), WItemSelector::empty(), and m_PdgForRenameSelection.

Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCheckboxProperty()

void WFilterPropertyHandler::updateCheckboxProperty ( WPropertyBase::SPtr  property)
private

Reload data when properties for selection of primaries and secondaries changed.

Parameters
propertycontains reference to the property which called updateProperty()

Definition at line 240 of file WFilterPropertyHandler.cpp.

References m_dataUpdate, m_showPrimaries, and m_showSecondaries.

Referenced by createCheckBoxForPrimaryAndSecondary().

+ Here is the caller graph for this function:

◆ updatePDGProperties()

void WFilterPropertyHandler::updatePDGProperties ( )
private

Update PDG Properties (Multiselector and change-Name-Properties)

Definition at line 79 of file WFilterPropertyHandler.cpp.

References createMultiSelectionForPDG(), createPropToSetParticleNames(), WSingleSelectorName::getPDG(), m_currentColumnIndex, m_filteringGroup, m_filteringsubGroup, m_multiSelection, and m_protonData.

Referenced by selectPdgAndSaveEvent(), and updateProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updatePDGTypesProperty()

void WFilterPropertyHandler::updatePDGTypesProperty ( WItemSelection::SPtr  particleItemSelectionList)
private

Updates possible selectable particle types in multiselection.

Parameters
particleItemSelectionListselectable partyle types as itemSelectionList

◆ updateProperty()

void WFilterPropertyHandler::updateProperty ( )

update current group property and subproperty

Definition at line 53 of file WFilterPropertyHandler.cpp.

References WSingleSelectorName::getParentId(), WSingleSelectorName::getPDG(), m_filteringsubGroup, m_multiSelection, m_protonData, m_showPrimaries, m_showSecondaries, and updatePDGProperties().

Referenced by createProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSelectedPDGTypes()

void WFilterPropertyHandler::updateSelectedPDGTypes ( )
private

Update the m_selectedPDGTypes.

Definition at line 169 of file WFilterPropertyHandler.cpp.

References m_dataUpdate.

Referenced by createMultiSelectionForPDG().

+ Here is the caller graph for this function:

◆ writePdgMapInParticleNameFile()

void WFilterPropertyHandler::writePdgMapInParticleNameFile ( )
private

write the BiMap in the Pdg particle name file

Definition at line 342 of file WFilterPropertyHandler.cpp.

References getParticleNameFilePath(), and m_PdgNamesByID.

Referenced by changePdgBiMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_currentColumnIndex

int WFilterPropertyHandler::m_currentColumnIndex = 0
private

The current column that is selected as particle data group.

Definition at line 254 of file WFilterPropertyHandler.h.

Referenced by updatePDGProperties().

◆ m_dataUpdate

WFilterPropertyHandler::CallbackPtr WFilterPropertyHandler::m_dataUpdate
private

A function variable that reinitializes the WDataSets.

Definition at line 132 of file WFilterPropertyHandler.h.

Referenced by updateCheckboxProperty(), and updateSelectedPDGTypes().

◆ m_filteringGroup

WPropGroup WFilterPropertyHandler::m_filteringGroup
private

◆ m_filteringsubGroup

WPropGroup WFilterPropertyHandler::m_filteringsubGroup
private

Stores subgroup for change the pdg-Name.

Definition at line 284 of file WFilterPropertyHandler.h.

Referenced by createPropToSetParticleNames(), selectPdgAndSaveEvent(), updatePDGProperties(), and updateProperty().

◆ m_inputNewParticleName

WPropString WFilterPropertyHandler::m_inputNewParticleName
private

A string for the new particle name.

Definition at line 299 of file WFilterPropertyHandler.h.

Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().

◆ m_multiSelection

WPropSelection WFilterPropertyHandler::m_multiSelection
private

Stores users selected items.

Definition at line 279 of file WFilterPropertyHandler.h.

Referenced by createMultiSelectionForPDG(), isPDGTypeSelected(), updatePDGProperties(), and updateProperty().

◆ m_notifierSetParticleName

WPropertyBase::PropertyChangeNotifierType WFilterPropertyHandler::m_notifierSetParticleName
private

A notifier for the Changeevents of the Rename PDG property.

Definition at line 314 of file WFilterPropertyHandler.h.

Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().

◆ m_particleItemSelectionList

std::shared_ptr< WItemSelection > WFilterPropertyHandler::m_particleItemSelectionList
private

Stores selectable items.

Definition at line 289 of file WFilterPropertyHandler.h.

Referenced by createMultiSelectionForPDG(), and createPropToSetParticleNames().

◆ m_PdgForRenameSelection

WPropSelection WFilterPropertyHandler::m_PdgForRenameSelection
private

A property to select one pdg to change.

Definition at line 309 of file WFilterPropertyHandler.h.

Referenced by createPropToSetParticleNames(), selectPdgAndSaveEvent(), and setDefaultForRenameField().

◆ m_PdgNamesByID

BM_PDG WFilterPropertyHandler::m_PdgNamesByID
private

A Map of the PDG and their names.

Definition at line 249 of file WFilterPropertyHandler.h.

Referenced by changePdgBiMap(), createPDGMap(), getParticleNameFromPdg(), getPdgFromName(), and writePdgMapInParticleNameFile().

◆ m_pdgTypes

std::vector< int > WFilterPropertyHandler::m_pdgTypes
private

Stores every unique particle id.

Definition at line 259 of file WFilterPropertyHandler.h.

Referenced by createMultiSelectionForPDG(), and searchPDGTypes().

◆ m_properties

WPropertyGroup::SPtr WFilterPropertyHandler::m_properties
private

A property variable that is generated by the WModul.

Definition at line 127 of file WFilterPropertyHandler.h.

Referenced by createProperties().

◆ m_protonData

WProtonData::SPtr WFilterPropertyHandler::m_protonData
private

Pointer to the content and header of the CSV.

Definition at line 122 of file WFilterPropertyHandler.h.

Referenced by searchPDGTypes(), updatePDGProperties(), and updateProperty().

◆ m_saveButton

WPropTrigger WFilterPropertyHandler::m_saveButton
private

A trigger for the save button to save changes.

Definition at line 304 of file WFilterPropertyHandler.h.

◆ m_selectedPDGTypes

std::vector< int > WFilterPropertyHandler::m_selectedPDGTypes
private

vector of the options of PDG

Definition at line 294 of file WFilterPropertyHandler.h.

◆ m_showPrimaries

WPropBool WFilterPropertyHandler::m_showPrimaries
private

Decides whether to hide or show primaries.

Definition at line 269 of file WFilterPropertyHandler.h.

Referenced by createCheckBoxForPrimaryAndSecondary(), getShowPrimaries(), updateCheckboxProperty(), and updateProperty().

◆ m_showSecondaries

WPropBool WFilterPropertyHandler::m_showSecondaries
private

Decides whether to hide or show secondaries.

Definition at line 274 of file WFilterPropertyHandler.h.

Referenced by createCheckBoxForPrimaryAndSecondary(), getShowSecondaries(), updateCheckboxProperty(), and updateProperty().


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