ATLAS Offline Software
Loading...
Searching...
No Matches
IParticleHandle_Jet::Imp Class Reference
Collaboration diagram for IParticleHandle_Jet::Imp:

Public Member Functions

double pt () const
double phi () const
double eta () const
double energy () const
double transverseEnergy () const
double coneR () const
double energyForLengthAndCuts () const
void createShapeFromJetParameters (const IParticleCollHandle_Jet *collHandleJet, const double &coneR, const double &eta, const double &phi, const double &energy, const SbVec3f &origin)
void updateConeHeightParameters (SoCone *, SoTranslation *, const double &energy) const
void updateConeHeightParameters () const
void rerandomiseMaterial ()

Public Attributes

IParticleHandle_Jettheclass = nullptr
const IParticleCollHandle_JettheCollHandle = nullptr
const xAOD::Jetm_jet = nullptr
SoSeparator * sep = nullptr
SoCone * cone = nullptr
SoMaterial * m_randomMat = nullptr
SoSwitch * m_bTagged = nullptr
SoSwitch * m_bTaggingCollSwitch = nullptr
double m_bTagWeightMV1 = 0.0
double m_bTagWeightMV2c20 = 0.0
double m_bTagWeightMV2c10 = 0.0
double m_JetFitterCombNN_pb = 0.0
double m_JetFitterCombNN_pc = 0.0
double m_JetFitterCombNN_pu = 0.0
bool considerTransverseEnergies = true
double coneRPar = -1
double scale = (10.0 * SYSTEM_OF_UNITS::m) / (100.0*SYSTEM_OF_UNITS::GeV)
double maxR = 0.0 * SYSTEM_OF_UNITS::m

Detailed Description

Definition at line 51 of file IParticleHandle_Jet.cxx.

Member Function Documentation

◆ coneR()

double IParticleHandle_Jet::Imp::coneR ( ) const
inline

Definition at line 97 of file IParticleHandle_Jet.cxx.

97{ return coneRPar > 0 ? coneRPar : 0.4; }

◆ createShapeFromJetParameters()

void IParticleHandle_Jet::Imp::createShapeFromJetParameters ( const IParticleCollHandle_Jet * collHandleJet,
const double & coneR,
const double & eta,
const double & phi,
const double & energy,
const SbVec3f & origin )

Definition at line 245 of file IParticleHandle_Jet.cxx.

247{
248 VP1Msg::messageVerbose("IParticleHandle_Jet::Imp::createShapeFromJetParameters()");
249
250
251
252 sep = new SoSeparator();
253 sep->ref();
254
255 cone = new SoCone();
256 cone->ref();
257
258 // coneR IS the opening half-angle of the jet, in delta phi (easy) and in
259 // delta eta (trickier)
260 // to try to get the jet extent right in eta, find theta corresponding
261 // to eta+R, eta-R, and take half of the difference:
262 double thetaMax = 2.*atan(exp(-(eta+inputconeR)));
263 double thetaMin = 2.*atan(exp(-(eta-inputconeR)));
264 double deltaTheta = fabs(thetaMax-thetaMin);
265 double etaScale = deltaTheta/(2.*inputconeR);
266
267 // Translate by half cone height and flip 180 deg so point is at IP:
268 SoTranslation *translate = new SoTranslation();
269
270 SoRotationXYZ *flip = new SoRotationXYZ();
271 flip->axis=SoRotationXYZ::Z;
272 flip->angle=M_PI;
273
274 SoRotationXYZ *ytoz = new SoRotationXYZ();
275 ytoz->axis=SoRotationXYZ::X;
276 ytoz->angle=M_PI/2.;
277
278 // Cones should now be along Z-axis,point at IP.
279 SoRotationXYZ *rotationPhi = new SoRotationXYZ();
280 rotationPhi->axis=SoRotationXYZ::Z;
281 rotationPhi->angle = phi+M_PI/2.; // starts from -y-axis in x-y plane
282 // phi is measured from x-axis, so +M_PI/2
283
284 SoRotationXYZ *rotationEta = new SoRotationXYZ();
285 double signEta = fabs(eta)/eta;
286 double theta = 2.*atan(signEta*exp(-fabs(eta)));
287 if (theta<0.)theta+=M_PI;
288 rotationEta->axis=SoRotationXYZ::X;
289 rotationEta->angle=theta;
290
291 //message("Eta: "+QString::number(eta)+" theta: "+QString::number(theta)+" phi: "+QString::number(phi));
292
294
295 // play with Scale:
296 SoScale* myScale = new SoScale();
297 //message("Eta scaling factor is "+QString::number(etaScale));
298 // maybe we need to squish along both axes...
299 myScale->scaleFactor.setValue(etaScale,1.,etaScale);
300
301 // translate to origin vertex rather than (0,0,0)
302 SoTranslation *transvertex = new SoTranslation();
303 transvertex->translation = origin;
304
305 sep->addChild(transvertex);
306 sep->addChild(rotationPhi);
307 sep->addChild(rotationEta);//theta rotation done around x-axis
308 sep->addChild(ytoz); // now it's along the z-axis
309 sep->addChild(flip); // flip so tip at origin
310 sep->addChild(translate); // back it up so base at origin // DO NOT MOVE THIS: ITS POSITION IS USED BY "updateConeHeightParameters(SoSeparator* sep,const double& energy)"
311 sep->addChild(myScale); // squeeze jet according to eta
312 //This is the point in the child sequence where we MAY add a random colour when appropriate.
313 //Thus: The translation is the SIXTH child and the cone is the LAST child.
314
315 // sep->addChild(collHandleJet->collSettingsButton().defaultParameterMaterial());
316
317 sep->addChild(collHandleJet->material());
318 // ^^ FIXME - should rearrange so we don't need to reset material
319
320 sep->addChild(cone); // starts along y-axis // DO NOT MOVE THIS: ITS POSITION IS USED BY "updateConeHeightParameters(SoSeparator* sep,const double& energy)"
321
322
323 // rendering b-tagged jets
324 SoNode * lastChild = sep->getChild( sep->getNumChildren()-1 );
325 if (lastChild->getTypeId() == SoCone::getClassTypeId())
326 {
327 VP1Msg::messageVerbose("adding b-tagging switch");
328
329 m_bTagged = new SoSwitch();
330 m_bTagged->whichChild=SO_SWITCH_ALL;
331
333
334 // add the b-tagging switch before the SoCone node
335 sep->insertChild(m_bTagged, sep->getNumChildren()-1);
336 }
337
338
339 //return sep;
340}
#define M_PI
Scalar theta() const
theta method
static void messageVerbose(const QString &)
Definition VP1Msg.cxx:84
SoMaterial * material() const

◆ energy()

double IParticleHandle_Jet::Imp::energy ( ) const
inline

Definition at line 95 of file IParticleHandle_Jet.cxx.

95{ return m_jet->e(); }

◆ energyForLengthAndCuts()

double IParticleHandle_Jet::Imp::energyForLengthAndCuts ( ) const
inline

◆ eta()

double IParticleHandle_Jet::Imp::eta ( ) const
inline

Definition at line 94 of file IParticleHandle_Jet.cxx.

94{ /*VP1Msg::messageVerbose("eta: " + QString::number(m_jet->eta()) );*/ return m_jet->eta(); }

◆ phi()

double IParticleHandle_Jet::Imp::phi ( ) const
inline

Definition at line 93 of file IParticleHandle_Jet.cxx.

93{ /*VP1Msg::messageVerbose("phi: " + QString::number(m_jet->phi()) );*/ return m_jet->phi(); }

◆ pt()

double IParticleHandle_Jet::Imp::pt ( ) const
inline

Definition at line 92 of file IParticleHandle_Jet.cxx.

92{ return m_jet->pt(); }

◆ rerandomiseMaterial()

void IParticleHandle_Jet::Imp::rerandomiseMaterial ( )

Definition at line 592 of file IParticleHandle_Jet.cxx.

593{
594 VP1Msg::messageVerbose("IParticleHandle_Jet::Imp::rerandomiseMaterial()");
595
596 // TODO: Move to HSV system, instead of RGB, and make random colors more contrasting
597
598
599 //Fixme: share this code with other systems!!
600 if ( !m_randomMat ) { //We will anyway rerandomize it when we need it
601 VP1Msg::messageVerbose("'m_randomMat not set. Returning.");
602 return;
603 }
604
605 double r2 = 0.3*0.3;
606 unsigned i(0);
607 double r,g,b;
608 bool ok;
609 while (true) {
610 r = (rand() / static_cast<double>(RAND_MAX));
611 g = (rand() / static_cast<double>(RAND_MAX));
612 b = (rand() / static_cast<double>(RAND_MAX));
613 ok = true;
614 //For now we make sure that we avoid black and red. This should be updated from bgd and highlight col automatically! (fixme).
615 // -> and we should probably also make sure that tracks close in (eta,phi) are well separated in colour-space.
616 if ( (r-1.0)*(r-1.0)+g*g+b*b < r2*0.5 )//avoid red (distance)
617 ok = false;
618 else if ( r*r/(r*r+g*g+b*b) > 0.8 )//avoid red (angle)
619 ok = false;
620 else if ( r*r+g*g+b*b < r2*2.0 )//avoid black
621 ok = false;
622 if (ok)
623 break;
624 ++i;
625 if (i>50 ) {
626 r2 *= 0.99;//To avoid problem in case we add too many forbidden spheres.
627 if (i>1000) {
628 //Just a safety
629 VP1Msg::messageVerbose("IParticleHandle_Jet::Imp::rerandomiseMaterial() - Warning: Random colour could"
630 " not be selected such as to satisfy all separation criterias");
631 break;
632 }
633 }
634 }
635
637}
static void setMaterialParameters(SoMaterial *m, const QColor &, const double &brightness=0.0, const double &transp=0.0)
int r
Definition globals.cxx:22

◆ transverseEnergy()

double IParticleHandle_Jet::Imp::transverseEnergy ( ) const
inline

Definition at line 96 of file IParticleHandle_Jet.cxx.

96{ return sin(2*atan(exp(-fabs(eta()))))*energy(); }

◆ updateConeHeightParameters() [1/2]

void IParticleHandle_Jet::Imp::updateConeHeightParameters ( ) const

Definition at line 376 of file IParticleHandle_Jet.cxx.

376 {
377
378
379 if (!sep) {
380 VP1Msg::messageVerbose("sep not defined. Returning.");
381 return;
382 }
383
384 //NB: The translation is the SIXTH child and the cone is the LAST child.
385 if (sep->getNumChildren()<6) {
386 VP1Msg::messageVerbose("getNumChildren() < 6!!! Returning...");
387 return;
388 }
389
390 const double energyJet = energyForLengthAndCuts();
391
392 SoNode * sixthChild = sep->getChild(5);
393 if (sixthChild->getTypeId()!=SoTranslation::getClassTypeId()) {
394 VP1Msg::messageVerbose("6th child is not a translation!!! Returning...");
395 return;
396 }
397 SoNode * lastChild = sep->getChild(sep->getNumChildren()-1);
398 if (lastChild->getTypeId()!=SoCone::getClassTypeId()) {
399 VP1Msg::messageVerbose("lastChild is not a cone!!! Returning...");
400 return;
401 }
402 updateConeHeightParameters(static_cast<SoCone*>(lastChild),static_cast<SoTranslation*>(sixthChild), energyJet);
403}

◆ updateConeHeightParameters() [2/2]

void IParticleHandle_Jet::Imp::updateConeHeightParameters ( SoCone * cone,
SoTranslation * trans,
const double & energy ) const

Definition at line 343 of file IParticleHandle_Jet.cxx.

344{
345 VP1Msg::messageVerbose("IParticleHandle_Jet::Imp::updateConeHeightParameters()");
346
347 double h( std::fabs(scale * energy) );
348
349 // FIXME: check this! when maxR is set, what should that do?? Here it's only used as "h", but maybe it should set the max length of the cone's bottom radius?? Check with Ed!
350 if (maxR > 0.0001) { // maxR > 0. is not univocally defined, because maxR is a floating point number
351 VP1Msg::messageVerbose("maxR > 0.0001 ==> setting h = min(h, maxR)");
352 h = std::min(h, maxR);
353 }
354
355 cone->height = h;
356 cone->bottomRadius = tan(coneR()) * h;
357 trans->translation = SbVec3f(0,-0.5*h, 0);
358
359
360
361 //debug
362 SbString strHeight, strRadius;
363 (cone->height).get(strHeight);
364 (cone->bottomRadius).get(strRadius);
365// std::cout << "input - energy: " << energy << " - scale: " << scale << " - maxR: " << maxR << " - h: " << h << " --- updated cone - height: " << strHeight.getString() << " - bottom radius: " << strRadius.getString() << std::endl;
366
367 // you can also use the 'writeField()' method, direct to std output
368 //SoDebug::writeField(&(cone->height));
369
370 // QString text = "updated cone - height: " + QString::number(cone->height) + " - bottom radius: " + QString::number(cone->bottomRadius) " - translation: " + trans->translation;
371 // VP1Msg::messageVerbose(text);
372}
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

Member Data Documentation

◆ cone

SoCone* IParticleHandle_Jet::Imp::cone = nullptr

Definition at line 63 of file IParticleHandle_Jet.cxx.

◆ coneRPar

double IParticleHandle_Jet::Imp::coneRPar = -1

Definition at line 82 of file IParticleHandle_Jet.cxx.

◆ considerTransverseEnergies

bool IParticleHandle_Jet::Imp::considerTransverseEnergies = true

Definition at line 81 of file IParticleHandle_Jet.cxx.

◆ m_bTagged

SoSwitch* IParticleHandle_Jet::Imp::m_bTagged = nullptr

Definition at line 65 of file IParticleHandle_Jet.cxx.

◆ m_bTaggingCollSwitch

SoSwitch* IParticleHandle_Jet::Imp::m_bTaggingCollSwitch = nullptr

Definition at line 66 of file IParticleHandle_Jet.cxx.

◆ m_bTagWeightMV1

double IParticleHandle_Jet::Imp::m_bTagWeightMV1 = 0.0

Definition at line 70 of file IParticleHandle_Jet.cxx.

◆ m_bTagWeightMV2c10

double IParticleHandle_Jet::Imp::m_bTagWeightMV2c10 = 0.0

Definition at line 72 of file IParticleHandle_Jet.cxx.

◆ m_bTagWeightMV2c20

double IParticleHandle_Jet::Imp::m_bTagWeightMV2c20 = 0.0

Definition at line 71 of file IParticleHandle_Jet.cxx.

◆ m_jet

const xAOD::Jet* IParticleHandle_Jet::Imp::m_jet = nullptr

Definition at line 60 of file IParticleHandle_Jet.cxx.

◆ m_JetFitterCombNN_pb

double IParticleHandle_Jet::Imp::m_JetFitterCombNN_pb = 0.0

Definition at line 73 of file IParticleHandle_Jet.cxx.

◆ m_JetFitterCombNN_pc

double IParticleHandle_Jet::Imp::m_JetFitterCombNN_pc = 0.0

Definition at line 74 of file IParticleHandle_Jet.cxx.

◆ m_JetFitterCombNN_pu

double IParticleHandle_Jet::Imp::m_JetFitterCombNN_pu = 0.0

Definition at line 75 of file IParticleHandle_Jet.cxx.

◆ m_randomMat

SoMaterial* IParticleHandle_Jet::Imp::m_randomMat = nullptr

Definition at line 64 of file IParticleHandle_Jet.cxx.

◆ maxR

double IParticleHandle_Jet::Imp::maxR = 0.0 * SYSTEM_OF_UNITS::m

Definition at line 84 of file IParticleHandle_Jet.cxx.

◆ scale

double IParticleHandle_Jet::Imp::scale = (10.0 * SYSTEM_OF_UNITS::m) / (100.0*SYSTEM_OF_UNITS::GeV)

Definition at line 83 of file IParticleHandle_Jet.cxx.

◆ sep

SoSeparator* IParticleHandle_Jet::Imp::sep = nullptr

Definition at line 62 of file IParticleHandle_Jet.cxx.

◆ theclass

IParticleHandle_Jet* IParticleHandle_Jet::Imp::theclass = nullptr

Definition at line 57 of file IParticleHandle_Jet.cxx.

◆ theCollHandle

const IParticleCollHandle_Jet* IParticleHandle_Jet::Imp::theCollHandle = nullptr

Definition at line 58 of file IParticleHandle_Jet.cxx.


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