OpenWalnut
1.5.0dev
|
Creates, updates and handles the filter properties. More...
#include <WFilterPropertyHandler.h>
Public Types | |
typedef std::shared_ptr< WFilterPropertyHandler > | SPtr |
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< WItemSelection > | m_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... | |
Creates, updates and handles the filter properties.
Definition at line 44 of file WFilterPropertyHandler.h.
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.
typedef boost::function< void( ) > WFilterPropertyHandler::CallbackPtr |
shared_ptr that points to itself
Definition at line 55 of file WFilterPropertyHandler.h.
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.
typedef std::shared_ptr< WFilterPropertyHandler > WFilterPropertyHandler::SPtr |
Function variables for updating the data.
Definition at line 50 of file WFilterPropertyHandler.h.
|
explicit |
constructor
protonData | Pointer to the content and header of the CSV |
properties | A property variable that is generated by the WModul |
dataUpdate | A function variable that reinitializes the WDataSets |
Definition at line 33 of file WFilterPropertyHandler.cpp.
|
private |
set or replace a particlename and pdg in the bimap
pdg | pdg number of a selected particle name |
newParticleName | new particlename of a pdg number |
WException |
Definition at line 322 of file WFilterPropertyHandler.cpp.
References m_PdgNamesByID, and writePdgMapInParticleNameFile().
Referenced by selectPdgAndSaveEvent().
|
private |
Helperfunction to copy the particlename file.
shareDirFile | sourcepath of the particle name file in the share directory |
homeDirFile | destinypath of the local directory for the particle name file |
Definition at line 363 of file WFilterPropertyHandler.cpp.
Referenced by createPDGMap().
|
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().
|
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().
void WFilterPropertyHandler::createPDGMap | ( | std::string | path | ) |
creates a bimap out of the names and ids of PDG txt
path | fielpath of the pdg particlename file |
WException |
Definition at line 270 of file WFilterPropertyHandler.cpp.
References copyFileToHomePath(), getParticleNameFilePath(), and m_PdgNamesByID.
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().
|
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().
|
private |
Definition at line 358 of file WFilterPropertyHandler.cpp.
References WPathHelper::getHomePath().
Referenced by createPDGMap(), and writePdgMapInParticleNameFile().
|
private |
Seatch the ParticleName in the map with a given pdg.
pdg | pdg number of a particlename |
Definition at line 299 of file WFilterPropertyHandler.cpp.
References m_PdgNamesByID.
Referenced by createMultiSelectionForPDG().
|
private |
Search the pdg in the map with a given particlename.
particleName | particlename of a pdg number |
Definition at line 306 of file WFilterPropertyHandler.cpp.
References getPdgFromUnkownParticle(), and m_PdgNamesByID.
Referenced by isPDGTypeSelected(), and selectPdgAndSaveEvent().
|
private |
get the PDG number of an unknown particle element with the help of regex
particleName | particle name of an unknown number |
Definition at line 313 of file WFilterPropertyHandler.cpp.
Referenced by getPdgFromName().
WPropBool WFilterPropertyHandler::getShowPrimaries | ( | ) |
Getter.
Definition at line 260 of file WFilterPropertyHandler.cpp.
References m_showPrimaries.
WPropBool WFilterPropertyHandler::getShowSecondaries | ( | ) |
Getter.
Definition at line 265 of file WFilterPropertyHandler.cpp.
References m_showSecondaries.
bool WFilterPropertyHandler::isPDGTypeSelected | ( | int | pdgType | ) |
Check whether the PDG type is contained in the m_selectedPDGTypes.
pdgType | the int value of the PDG-Type |
Definition at line 225 of file WFilterPropertyHandler.cpp.
References WItemSelector::at(), getPdgFromName(), m_multiSelection, and WItemSelector::size().
|
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().
|
private |
Event of the save button in the rename pdg subgroup.
property | contains 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().
|
private |
Set the default string for the string property textfield.
Definition at line 195 of file WFilterPropertyHandler.cpp.
References WItemSelector::at(), WItemSelector::empty(), and m_PdgForRenameSelection.
Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().
|
private |
Reload data when properties for selection of primaries and secondaries changed.
property | contains 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().
|
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().
|
private |
Updates possible selectable particle types in multiselection.
particleItemSelectionList | selectable partyle types as itemSelectionList |
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().
|
private |
Update the m_selectedPDGTypes.
Definition at line 169 of file WFilterPropertyHandler.cpp.
References m_dataUpdate.
Referenced by createMultiSelectionForPDG().
|
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().
|
private |
The current column that is selected as particle data group.
Definition at line 254 of file WFilterPropertyHandler.h.
Referenced by updatePDGProperties().
|
private |
A function variable that reinitializes the WDataSets.
Definition at line 132 of file WFilterPropertyHandler.h.
Referenced by updateCheckboxProperty(), and updateSelectedPDGTypes().
|
private |
Property group for filtering options.
Definition at line 264 of file WFilterPropertyHandler.h.
Referenced by createCheckBoxForPrimaryAndSecondary(), createMultiSelectionForPDG(), createProperties(), createPropToSetParticleNames(), and updatePDGProperties().
|
private |
Stores subgroup for change the pdg-Name.
Definition at line 284 of file WFilterPropertyHandler.h.
Referenced by createPropToSetParticleNames(), selectPdgAndSaveEvent(), updatePDGProperties(), and updateProperty().
|
private |
A string for the new particle name.
Definition at line 299 of file WFilterPropertyHandler.h.
Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().
|
private |
Stores users selected items.
Definition at line 279 of file WFilterPropertyHandler.h.
Referenced by createMultiSelectionForPDG(), isPDGTypeSelected(), updatePDGProperties(), and updateProperty().
|
private |
A notifier for the Changeevents of the Rename PDG property.
Definition at line 314 of file WFilterPropertyHandler.h.
Referenced by createPropToSetParticleNames(), and selectPdgAndSaveEvent().
|
private |
Stores selectable items.
Definition at line 289 of file WFilterPropertyHandler.h.
Referenced by createMultiSelectionForPDG(), and createPropToSetParticleNames().
|
private |
A property to select one pdg to change.
Definition at line 309 of file WFilterPropertyHandler.h.
Referenced by createPropToSetParticleNames(), selectPdgAndSaveEvent(), and setDefaultForRenameField().
|
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().
|
private |
Stores every unique particle id.
Definition at line 259 of file WFilterPropertyHandler.h.
Referenced by createMultiSelectionForPDG(), and searchPDGTypes().
|
private |
A property variable that is generated by the WModul.
Definition at line 127 of file WFilterPropertyHandler.h.
Referenced by createProperties().
|
private |
Pointer to the content and header of the CSV.
Definition at line 122 of file WFilterPropertyHandler.h.
Referenced by searchPDGTypes(), updatePDGProperties(), and updateProperty().
|
private |
A trigger for the save button to save changes.
Definition at line 304 of file WFilterPropertyHandler.h.
|
private |
vector of the options of PDG
Definition at line 294 of file WFilterPropertyHandler.h.
|
private |
Decides whether to hide or show primaries.
Definition at line 269 of file WFilterPropertyHandler.h.
Referenced by createCheckBoxForPrimaryAndSecondary(), getShowPrimaries(), updateCheckboxProperty(), and updateProperty().
|
private |
Decides whether to hide or show secondaries.
Definition at line 274 of file WFilterPropertyHandler.h.
Referenced by createCheckBoxForPrimaryAndSecondary(), getShowSecondaries(), updateCheckboxProperty(), and updateProperty().