39#include <Inventor/C/errors/debugerror.h>
40#include <Inventor/nodes/SoSeparator.h>
41#include <Inventor/nodes/SoSwitch.h>
42#include <Inventor/nodes/SoMaterial.h>
45#include <Inventor/nodes/SoTexture2.h>
57 #include "GeoModelKernel/Units.h"
58 #define SYSTEM_OF_UNITS GeoModelKernelUnits
60 #include "GaudiKernel/SystemOfUnits.h"
61 #define SYSTEM_OF_UNITS Gaudi::Units
65#if defined BUILDVP1LIGHT
118 theclass->systemBase()->updateGUI();
128 m_d->theclass =
this;
129 m_d->updateGUICounter = 0;
130 m_d->collSettingsButton=0;
136 m_d->bTaggingSwitch=
new SoSwitch;
137 m_d->bTaggingSwitch->whichChild=SO_SWITCH_ALL;
139 m_d->bTaggingTexture =
new SoTexture2;
140 m_d->bTaggingMaterial =
new SoMaterial;
144 QString safetext(
text());
145 safetext.replace(
' ',
'_');
146 safetext.replace(
'[',
'_');
147 safetext.replace(
']',
'_');
148 safetext.replace(
'/',
'_');
149 safetext.replace(
'.',
'_');
150 safetext.replace(
',',
'_');
151 safetext.replace(
'<',
'_');
152 safetext.replace(
'>',
'_');
153 safetext.replace(
'&',
'_');
166 if (
m_d->bTaggingSwitch)
m_d->bTaggingSwitch->unref();
177 m_d->collSettingsButton->setMaterialText(
name());
191 m_d->m_jetMaterialDefault->ref();
193 m_d->collSettingsButton->setMaterial(
m_d->m_jetMaterialDefault);
194 messageVerbose(
"set new jet color=" +
str(
m_d->collSettingsButton->getMaterialButton()->lastAppliedDiffuseColour()));
207 if(
m_d->collSettingsButton->is_bTaggingSkinEnabled()) {
211 else if (
m_d->collSettingsButton->is_bTaggingMaterialEnabled()) {
221 m_d->bTaggingSwitch->ref();
231 messageDebug(
"IParticleCollHandle_Jet::setupSettingsFromControllerSpecific()");
242 connect(controller,SIGNAL(cutAllowedPhiChanged(
const QList<VP1Interval>&)),
this,SLOT(
setCutAllowedPhi(
const QList<VP1Interval>&)));
251 connect(controller,SIGNAL(scaleChanged(
const double&)),
this,SLOT(
setScale(
const double&)));
256 connect(controller,SIGNAL(randomJetColoursChanged(
const bool&)),
this,SLOT(
setRandomJetColours(
const bool&)));
260 connect(controller, SIGNAL(maxRChanged(
const double&)),
this, SLOT(
setMaxR(
const double&)));
263 connect(controller, SIGNAL(bTaggingEnabledChanged(
const bool&)),
this, SLOT(
setBTaggingEnabled(
const bool&)));
265 connect(controller, SIGNAL(bTaggingTaggerChanged(
const QString &)),
this, SLOT(
setBTaggingTagger(
const QString &)));
267 connect(controller, SIGNAL(bTaggingCutChanged(
const double &)),
this, SLOT(
setBTaggingCut(
const double &)));
269 connect(controller,SIGNAL(bTaggingRenderingMaterialChanged(
const bool&)),
this, SLOT(
setBTaggingMaterialChanged(
const bool&)));
271 connect(controller,SIGNAL(bTaggingRenderingSkinChanged(
const bool&)),
this, SLOT(
setBTaggingSkinChanged(
const bool&)));
280 if (!
m_d->collSettingsButton){
281 messageVerbose(
"Jet - No collSettingsButton set! Can't call init(), so crash is imminent...");
282 throw std::runtime_error(
"Jet - No collSettingsButton set!");
284 return *
m_d->collSettingsButton;
293 messageVerbose(
"IParticleCollHandle_Jet::setScale() - scale: " + QString::number(sca));
299 if (
m_d->scale == sca)
303 double tmpScale = std::max(1*SYSTEM_OF_UNITS::mm/(100*SYSTEM_OF_UNITS::GeV),
304 std::min(99*SYSTEM_OF_UNITS::m/(1*SYSTEM_OF_UNITS::MeV),
306 std::fabs(sca) * SYSTEM_OF_UNITS::m/(100.0*SYSTEM_OF_UNITS::GeV)));
308 m_d->scale = isEt ? tmpScale : -tmpScale;
322 if (
jet &&
jet->has3DObjects()) {
323 jet->setScale(tmpScale, isEt);
326 message(
"ERROR Handle of wrong type!");
348 messageVerbose(
"IParticleCollHandle_Jet::setMaxR() - maxR: " + QString::number(
maxR));
370 if (
jet &&
jet->has3DObjects()) {
374 message(
"ERROR Handle of wrong type!");
385 return m_d->randomColours;
399 messageVerbose(
"IParticleCollHandle_Jet::setRandomJetColours() - b: "+QString::number(b));
401 if (
m_d->randomColours == b)
404 m_d->randomColours = b;
417 if (
jet &&
jet->has3DObjects()) {
420 messageVerbose(
"setting random material on jet: "+QString::number(ijet)+
" - random colors? "+QString::number(randomColors));
422 jet->updateMaterial( randomColors );
425 message(
"ERROR Handle of wrong type!");
437 messageVerbose(
"IParticleCollHandle_Jet::rerandomise() - Returning.");
441 VP1Msg::message(
"'Random jet colours' is not checked. Nothing to do. Returning.");
451 if (
jet &&
jet->has3DObjects()) {
452 jet->rerandomiseMaterial();
454 message(
"ERROR Handle of wrong type!");
468 #if defined BUILDVP1LIGHT
479 if( !(
systemBase()->getEvent())->retrieve( coll,
name().toStdString()).isSuccess() ) {
480 QString errMsg =
"Failed to retrieve " +
name();
481 message(
"Error: Could not retrieve collection with key="+
name());
486 message(
"Error: Could not retrieve Jet collection with key="+
name());
498 if( ! coll->hasStore() ) {
499 message(
"No auxiliary store got associated to the Jet container with key: " +
name());
510 for ( it = coll->
begin() ; it != itEnd; ++it) {
511 m_d->possiblyUpdateGUI();
541 double jEnergy = handle->energyForCuts();
542 double jEnergySqr = jEnergy * jEnergy;
559 double phi = handle->phi();
563 if (phirange.contains(
phi)||phirange.contains(
phi+2*
M_PI)||phirange.contains(
phi-2*
M_PI)) {
581 messageVerbose(
"Not a IParticleCollHandle_Jet. Calling base method...");
602 m_d->bTaggingSwitch->whichChild = (flag ? SO_SWITCH_ALL : SO_SWITCH_NONE);
612 if (
m_d->collSettingsButton->bTaggingRenderingSkin()) {
615 m_d->bTaggingSwitch->removeChild(
m_d->bTaggingTexture);
616 m_d->bTaggingSwitch->removeChild(
m_d->bTaggingMaterial);
619 m_d->bTaggingTexture = 0;
620 m_d->bTaggingMaterial = 0;
623 m_d->bTaggingTexture =
new SoTexture2;
624 m_d->bTaggingMaterial =
new SoMaterial;
628 messageVerbose(
"texture found: " + QString::fromStdString(fName) );
629 m_d->bTaggingTexture->filename.setValue(fName.c_str());
632 m_d->bTaggingSwitch->addChild(
m_d->bTaggingTexture);
644 if (
m_d->collSettingsButton->bTaggingRenderingMaterial()) {
649 m_d->bTaggingSwitch->removeChild(
m_d->bTaggingTexture);
650 m_d->bTaggingSwitch->removeChild(
m_d->bTaggingMaterial);
653 m_d->bTaggingTexture = 0;
654 m_d->bTaggingMaterial = 0;
661 m_d->bTaggingMaterial =
m_d->collSettingsButton->bTaggingMaterial();
662 m_d->bTaggingSwitch->addChild(
m_d->bTaggingMaterial );
666 m_d->bTaggingMaterial = mat;
667 m_d->bTaggingSwitch->addChild(
m_d->bTaggingMaterial );
683 if (
m_d->bTaggingTagger == tagger.toStdString())
686 m_d->bTaggingTagger = tagger.toStdString();
700 if (
m_d->bTaggingCut == wCut)
703 m_d->bTaggingCut = wCut;
717 messageVerbose(
"IParticleCollHandle_Jet::updateBTaggingAllJets()");
724 if (
jet &&
jet->has3DObjects()) {
725 jet->updateBTagging(
m_d->bTaggingTagger,
m_d->bTaggingCut);
727 message(
"ERROR Handle of wrong type!");
736 messageVerbose(
"IParticleCollHandle_Jet::updateBTaggingSwitchAllJets()");
743 if (
jet &&
jet->has3DObjects()) {
744 jet->updateBTaggingSwitch(
m_d->bTaggingSwitch);
746 message(
"ERROR Handle of wrong type!");
757 messageVerbose(
"IParticleCollHandle_Jet::setBTaggingMaterialChanged()");
772 messageDebug(
"IParticleCollHandle_Jet::persistifiableState() - start...");
783 serialise.disableUnsavedChecks();
796 serialise.save(
m_d->collSettingsButton->saveState());
798 messageDebug(
"IParticleCollHandle_Jet::persistifiableState() - end.");
799 return serialise.result();
810 messageDebug(
"Warning: Ignoring state with wrong version");
823 if (extraWidgetState!=QByteArray())
827 messageDebug(
"restoring material collection button...");
830 messageDebug(
"reset all caches storing values for cuts...");
857 str <<
"\""<<
name().toLatin1().data()<<
"\":{";
861 if (handle->visible()) {
862 if (num)
str <<
",\n";
863 handle->dumpToJSON(
str);
Scalar phi() const
phi method
const AODSysCommonData * common() const
void recheckCutStatusOfAllVisibleHandles()
void setExtraWidgetsState(const QByteArray &)
QByteArray extraWidgetsState() const
void setupSettingsFromController(const AODSystemController *)
void update3DObjectsOfAllHandles()
void collVisibilityChanged(bool)
const QString & name() const
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const VP1Interval & getCutAllowedEta()
IParticleCollHandleBase(AODSysCommonData *, const QString &name, xAOD::Type::ObjectType)
virtual AODHandleBase * getNextHandle()
virtual void handleIterationBegin()
void setCutAllowedPt(const VP1Interval &)
const QList< VP1Interval > & getCutAllowedPhi()
const VP1Interval & getCutAllowedPt()
virtual bool cut(AODHandleBase *)
QList< AODHandleBase * > getHandlesList() const
void setCutAllowedPhi(const QList< VP1Interval > &)
void addHandle(AODHandleBase *)
void setCutAllowedEta(const VP1Interval &)
SoSwitch * bTaggingSwitch
IParticleCollHandle_Jet * theclass
SoTexture2 * bTaggingTexture
std::string bTaggingTagger
SoMaterial * bTaggingMaterial
JetCollectionSettingsButton * collSettingsButton
SoMaterial * m_jetMaterialDefault
void setRandomJetColours(const bool &)
void updateBTaggingSwitchAllJets()
virtual void setupSettingsFromControllerSpecific(const AODSystemController *)
For extensions specific to this collection.
void setBTaggingMaterialChanged(const bool &)
virtual ~IParticleCollHandle_Jet()
void setBTaggingSkinChanged(const bool &ok)
void updateBTaggingAllJets()
void setMaxR(const double &max)
void setState(const QByteArray &)
Provide specific implementation.
void setBTaggingCut(const double &)
void showParametersChanged(bool)
QByteArray persistifiableState() const
Provide specific implementation.
virtual void init(VP1MaterialButtonBase *matBut=0)
void resetCachedValuesCuts()
void setBTaggingMaterial(SoMaterial *mat=NULL)
bool isRandomColors() const
virtual void dumpToJSON(std::ofstream &) const
void setBTaggingTagger(const QString &)
const JetCollectionSettingsButton & collSettingsButton() const
virtual bool cut(AODHandleBase *)
IParticleCollHandle_Jet(AODSysCommonData *, const QString &name, xAOD::Type::ObjectType type)
void setBTaggingEnabled(const bool &)
static QStringList availableCollections(IVP1System *)
void setScale(const double &s)
void setBTaggingSkin(const QString &filename)
virtual QColor defaultColor() const
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Interface for non-const operations on an auxiliary store.
QByteArray restoreByteArray()
void disableUnrestoredChecks()
void restore(QCheckBox *sb)
void messageVerbose(const QString &) const
void message(const QString &) const
IVP1System * systemBase() const
void messageDebug(const QString &) const
static void messageVerbose(const QString &)
static void message(const QString &, IVP1System *sys=0)
QStringList getKeys() const
virtual void largeChangesEnd()
virtual void init(VP1MaterialButtonBase *button=0)
virtual void largeChangesBegin()
void visibilityChanged(bool)
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ Jet
The object is a jet.
JetContainer_v1 JetContainer
Definition of the current "jet container version".