ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1Systems
VP1MissingEtSystems
src
VP1MissingEtHandle.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
7
// //
8
// Implementation of class VP1MissingEtHandle //
9
// //
10
// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
11
// Initial version: July 2008 //
12
// Updated: Giorgi Gvaberidze (ggvaberi@cern.ch) //
13
// Updated: July 2010 //
14
// //
16
17
#include "
VP1MissingEtSystems/VP1MissingEtHandle.h
"
18
#include "
VP1Base/VP1MaterialButton.h
"
19
#include "
VP1Base/VP1Serialise.h
"
20
#include "
VP1Utils/VP1SGContentsHelper.h
"
21
#include "
VP1Utils/VP1SGAccessHelper.h
"
22
23
#include "
MissingETEvent/MissingET.h
"
24
#include "
MissingETEvent/MissingEtCalo.h
"
25
#include "
MissingETEvent/MissingEtTruth.h
"
26
#include "CLHEP/Units/SystemOfUnits.h"
27
28
#include <Inventor/nodes/SoSeparator.h>
29
#include <Inventor/nodes/SoRotationXYZ.h>
30
#include <Inventor/nodes/SoTranslation.h>
31
#include <Inventor/nodes/SoCone.h>
32
#include <Inventor/SoPath.h>
33
34
#include <QColor>
35
36
37
double
VP1MissingEtHandle::thickness
= 1.0;
38
double
VP1MissingEtHandle::scale
= 1.0;
39
bool
VP1MissingEtHandle::shape
=
true
;
40
41
42
//____________________________________________________________________
43
QList<VP1StdCollection*>
VP1MissingEtHandle::createCollections
(
IVP1System
*sys)
44
{
45
//updated: for prevent loading zero length system
46
static
const
MissingET
*
met
= 0;
47
48
//Get list of keys (only those that are not MissingEtTruth/MissingEtCalo as well):
49
VP1SGContentsHelper
sg(sys);
50
QStringList keys = sg.
getKeys
<
MissingET
>();
51
for
(
const
QString&
key
: sg.
getKeys
<
MissingEtTruth
>())
52
keys.removeAll(
key
);
53
for
(
const
QString&
key
: sg.
getKeys
<
MissingEtCalo
>())
54
keys.removeAll(
key
);
55
56
QList<VP1StdCollection*> l;
57
for
(
const
QString&
key
: keys) {
58
//updated: for prevent loading zero length system
59
met
= 0;
60
if
(!
VP1SGAccessHelper
(sys).retrieve(
met
,
key
))
61
continue
;
62
double
length
=
met
->et() * (200.0*CLHEP::cm/(100.0*CLHEP::GeV));
63
if
(
MISSINGET_ZEROLENGTH
(
length
))
64
continue
;
65
//-----------------------------------------------
66
67
VP1MissingEtHandle
* col =
new
VP1MissingEtHandle
(sys,
key
);
68
col->
init
();
69
l << col;
70
}
71
return
l;
72
}
73
74
//____________________________________________________________________
75
class
VP1MissingEtHandle::Imp
{
76
public
:
77
QString
key
;
78
const
MissingET
*
met
=
nullptr
;
79
//Classification (purely for where/how the handle is displayed in
80
//the collection widget and for the default colour):
81
enum
TYPE
{
NORMAL
,
OBJECTBASED
,
OTHER
};
82
TYPE
type
{};
83
};
84
85
86
//____________________________________________________________________
87
VP1MissingEtHandle::VP1MissingEtHandle
(
IVP1System
*sys,
const
QString&
key
)
88
:
VP1StdCollection
(sys,
"VP1MissingEtHandle_"
+
key
),
m_d
(new
Imp
)
89
{
90
m_d
->key =
key
;
91
m_d
->met = 0;
92
93
if
(
m_d
->key.startsWith(
"MET_"
))
94
m_d
->type =
Imp::NORMAL
;
95
else
if
(
m_d
->key.startsWith(
"ObjMET_"
))
96
m_d
->type =
Imp::OBJECTBASED
;
97
else
98
m_d
->type =
Imp::OTHER
;
99
100
//ggvaberi
101
m_base
= 0;
102
m_arrow
= 0;
103
m_dash
= 0;
104
105
m_length
= 0.0;
106
m_phi
= 0.0;
107
//-------------------
108
}
109
110
//____________________________________________________________________
111
VP1MissingEtHandle::~VP1MissingEtHandle
()
112
{
113
delete
m_d
;
114
115
if
(
m_arrow
){
116
m_arrow
->removeAllChildren();
117
m_arrow
->unref();
118
}
119
120
if
(
m_dash
){
121
m_dash
->removeAllChildren();
122
m_dash
->unref();
123
}
124
}
125
126
//____________________________________________________________________
127
const
QString&
VP1MissingEtHandle::key
()
const
128
{
129
return
m_d
->key;
130
}
131
132
//____________________________________________________________________
133
QByteArray
VP1MissingEtHandle::providePersistifiableID
()
const
134
{
135
VP1Serialise
serialise(0);
136
serialise.disableUnsavedChecks();
137
serialise.save(
collTypeID
());
138
serialise.save(
key
());
//Since we truncate stuff in provideText(), we want to m_base the id on the full key.
139
return
serialise.result();
140
}
141
142
//____________________________________________________________________
143
QString
VP1MissingEtHandle::provideText
()
const
144
{
145
if
(
m_d
->key.startsWith(
"MET_"
))
146
return
m_d
->key.right(
m_d
->key.count()-4);
147
else
if
(
m_d
->key.startsWith(
"ObjMET_"
))
148
return
m_d
->key.right(
m_d
->key.count()-7);
149
return
m_d
->key;
150
}
151
152
//____________________________________________________________________
153
QString
VP1MissingEtHandle::provideSection
()
const
154
{
155
if
(
m_d
->type==
Imp::NORMAL
)
156
return
"Standard"
;
157
else
if
(
m_d
->type==
Imp::OBJECTBASED
)
158
return
"Object-Based"
;
159
else
if
(
m_d
->type==
Imp::OTHER
)
160
return
"Other"
;
161
else
162
return
"Unknown"
;
163
}
164
165
//____________________________________________________________________
166
QString
VP1MissingEtHandle::provideSectionToolTip
()
const
167
{
168
if
(
m_d
->type==
Imp::NORMAL
)
169
return
"Missing Et objects found by standard algorithms"
;
170
else
if
(
m_d
->type==
Imp::OBJECTBASED
)
171
return
"Missing Et found by Object-Based algorithms"
;
172
else
if
(
m_d
->type==
Imp::OTHER
)
173
return
"Missing ET objects not recognised as belonging to any other section"
;
174
else
175
return
"Unknown"
;
176
}
177
178
//____________________________________________________________________
179
QColor
VP1MissingEtHandle::baseCol
()
const
180
{
181
if
(
m_d
->type==
Imp::OBJECTBASED
)
182
return
QColor::fromRgbF(0, 2./3., 0.5);
183
else
184
return
QColor::fromRgbF(1, 2./3., 0.5);
185
}
186
187
//____________________________________________________________________
188
void
VP1MissingEtHandle::assignDefaultMaterial
( SoMaterial* m )
const
189
{
190
VP1MaterialButton::setMaterialParameters
( m,
baseCol
(), 0.2
/*brightness*/
);
191
}
192
193
//____________________________________________________________________
194
void
VP1MissingEtHandle::truncateToCollSep
(SoPath*p)
const
195
{
196
//Truncate to collSep to get correct highlighting:
197
int
icollsep = p->findNode(
collSep
());
198
if
(icollsep<0)
199
message
(
"ERROR: Could not truncate picked path correctly"
);
200
else
201
p->truncate(icollsep+1);
202
}
203
204
//____________________________________________________________________
205
QStringList
VP1MissingEtHandle::baseInfo
(
const
MissingET
*
met
)
const
206
{
207
if
(!
met
)
208
return
QStringList() <<
"ERROR: Nul MissingET pointer!"
;
209
QStringList l;
210
l <<
"Missing ET ["
+
key
()+
"]:"
;
211
l <<
" Et: "
+
str
(
met
->et()/CLHEP::GeV)+
" GeV"
;
212
l <<
" SumEt: "
+
str
(
met
->sumet()/CLHEP::GeV)+
" GeV"
;
213
l <<
" EtX: "
+
str
(
met
->etx()/CLHEP::GeV)+
" GeV"
;
214
l <<
" EtY: "
+
str
(
met
->ety()/CLHEP::GeV)+
" GeV"
;
215
l <<
" Phi: "
+
str
(
met
->phi());
216
//Fixme: Add author (met->getSource() enum)
217
return
l;
218
}
219
220
//____________________________________________________________________
221
QStringList
VP1MissingEtHandle::clicked
(SoPath*pickedPath)
const
222
{
223
truncateToCollSep
(pickedPath);
224
return
baseInfo
(
m_d
->met);
225
}
226
227
//____________________________________________________________________
228
void
VP1MissingEtHandle::addArrowToCollSep
(
const
MissingET
*
met
)
229
{
230
//3D code for the m_arrow here is due to Moustapha Thioye:
231
//Updated by GGvaberi
232
233
double
length
=
met
->et() * (200.0*CLHEP::cm/(100.0*CLHEP::GeV));
//Fixme: Make scale factor (and thickness) adjustable.
234
235
this->
m_length
=
length
;
236
this->
m_phi
=
met
->phi();
237
238
SoRotationXYZ *finalRotation =
new
SoRotationXYZ();
239
finalRotation->axis=SoRotationXYZ::Z;
240
finalRotation->angle=-
M_PI
/2+
met
->phi();
241
242
//Translation
243
SoTranslation *translation1=
new
SoTranslation();
244
translation1->translation.setValue(0,0.5*0.75*
m_length
*
scale
,0);
245
246
//Cylinder
247
SoCylinder *cyl =
new
SoCylinder();
248
cyl->height=0.75*
m_length
*
scale
;
249
cyl->radius=2.0*
thickness
;
250
251
//Translation
252
SoTranslation *translation2=
new
SoTranslation();
253
translation2->translation.setValue(0,0.5*
m_length
*
scale
,0);
254
255
//Cone
256
SoCone *cone =
new
SoCone();
257
cone->height=0.25*
m_length
*
scale
;
258
cone->bottomRadius= 4.0*
thickness
;
259
260
//Arrow
261
m_arrow
=
new
SoGroup;
262
m_arrow
->addChild(finalRotation);
263
m_arrow
->addChild(translation1);
264
m_arrow
->addChild(cyl);
265
m_arrow
->addChild(translation2);
266
m_arrow
->addChild(cone);
267
m_arrow
->ref();
268
269
//Dash line
270
m_dash
=
new
SoGroup;
271
SoRotationXYZ *
r
=
new
SoRotationXYZ();
272
r
->axis=SoRotationXYZ::Z;
273
r
->angle=-
M_PI
/2+
met
->phi();
274
m_dash
->addChild(
r
);
275
276
SoTranslation *t=
new
SoTranslation();
277
t->translation.setValue(0, 0, 0);
278
m_dash
->addChild(t);
279
280
//Define line width
281
SoDrawStyle *drawStyle =
new
SoDrawStyle;
282
drawStyle->style.setValue(SoDrawStyle::LINES);
283
drawStyle->lineWidth.setValue(2.0 *
thickness
);
284
drawStyle->linePattern.setValue(0xFF00);
285
m_dash
->addChild(drawStyle);
286
287
//Define line connection
288
SoCoordinate3 *coords =
new
SoCoordinate3;
289
SbVec3f* vert =
new
SbVec3f[2];
290
vert[0] = SbVec3f(0.0, 0.0, 0.0);
291
vert[1] = SbVec3f(0.0,
m_length
*
scale
, 0.0);
292
coords->point.setValues(0, 2, vert);
293
delete
[] vert;
294
m_dash
->addChild(coords);
295
296
SoLineSet *lineSet =
new
SoLineSet ;
297
lineSet->numVertices.set1Value(0, 2) ;
298
m_dash
->addChild(lineSet);
299
m_dash
->ref();
300
301
m_base
=
new
SoGroup;
302
if
(
shape
)
303
m_base
->addChild(
m_arrow
);
304
else
305
m_base
->addChild(
m_dash
);
306
307
collSep
()->addChild(
m_base
);
308
//--------
309
}
310
311
//____________________________________________________________________
312
bool
VP1MissingEtHandle::load
()
313
{
314
if
(!
VP1SGAccessHelper
(
systemBase
()).retrieve(
m_d
->met,
m_d
->key))
315
return
false
;
316
317
addArrowToCollSep
(
m_d
->met);
318
return
true
;
319
}
320
321
//ggvaberi
322
void
VP1MissingEtHandle::refresh
(){
323
if
(!
m_base
)
324
return
;
325
326
//Arrow
327
SoTranslation *translation1= (SoTranslation*)
m_arrow
->getChild(1);
328
translation1->translation.setValue(0,0.5*0.75*
m_length
*
scale
,0);
329
330
SoCylinder *cyl = (SoCylinder*)
m_arrow
->getChild(2);
331
cyl->height=0.75*
m_length
*
scale
;
332
cyl->radius=2.0*
thickness
;
333
334
SoTranslation *translation2= (SoTranslation*)
m_arrow
->getChild(3);
335
translation2->translation.setValue(0,0.5*
m_length
*
scale
,0);
336
337
SoCone *cone = (SoCone*)
m_arrow
->getChild(4);
338
cone->height=0.25*
m_length
*
scale
;
339
cone->bottomRadius= 4.0*
thickness
;
340
341
//Dash
342
SoDrawStyle *drawStyle = (SoDrawStyle*)
m_dash
->getChild(2);
343
drawStyle->lineWidth.setValue(2.0 *
thickness
);
344
345
SoCoordinate3 *coords = (SoCoordinate3*)
m_dash
->getChild(3);
346
SbVec3f* vert =
new
SbVec3f[2];
347
vert[0] = SbVec3f(0.0, 0.0, 0.0);
348
vert[1] = SbVec3f(0.0,
m_length
*
scale
, 0.0);
349
coords->point.setValues(0, 2, vert);
350
delete
[] vert;
351
352
m_base
->removeAllChildren();
353
if
(
shape
)
354
m_base
->addChild(
m_arrow
);
355
else
356
m_base
->addChild(
m_dash
);
357
}
358
359
void
VP1MissingEtHandle::useThickness
(
double
thickness
){
360
VP1MissingEtHandle::thickness
=
thickness
;
361
}
362
363
void
VP1MissingEtHandle::useScale
(
double
scale
){
364
VP1MissingEtHandle::scale
=
scale
;
365
}
366
367
void
VP1MissingEtHandle::useShape
(
bool
shape
){
368
VP1MissingEtHandle::shape
=
shape
;
369
}
370
//--------
M_PI
#define M_PI
Definition
ActiveFraction.h:14
length
double length(const pvec &v)
Definition
FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
MissingEtCalo.h
MissingEtTruth.h
MissingET.h
if
if(pathvar)
Definition
SealSharedLib.cxx:168
VP1MaterialButton.h
VP1MissingEtHandle.h
MISSINGET_ZEROLENGTH
#define MISSINGET_ZEROLENGTH(x)
Definition
VP1MissingEtHandle.h:34
VP1SGAccessHelper.h
VP1SGContentsHelper.h
VP1Serialise.h
IVP1System
Definition
IVP1System.h:36
MissingET
Definition
Reconstruction/MissingETEvent/MissingETEvent/MissingET.h:23
MissingEtCalo
Definition
MissingEtCalo.h:27
MissingEtTruth
Definition
MissingEtTruth.h:28
VP1HelperClassBase::message
void message(const QString &) const
Definition
VP1HelperClassBase.cxx:49
VP1HelperClassBase::systemBase
IVP1System * systemBase() const
Definition
VP1HelperClassBase.h:50
VP1MaterialButton::setMaterialParameters
static void setMaterialParameters(SoMaterial *m, const QColor &, const double &brightness=0.0, const double &transp=0.0)
Definition
VP1MaterialButton.cxx:802
VP1MissingEtHandle::Imp
Definition
VP1MissingEtHandle.cxx:75
VP1MissingEtHandle::Imp::type
TYPE type
Definition
VP1MissingEtHandle.cxx:82
VP1MissingEtHandle::Imp::key
QString key
Definition
VP1MissingEtHandle.cxx:77
VP1MissingEtHandle::Imp::TYPE
TYPE
Definition
VP1MissingEtHandle.cxx:81
VP1MissingEtHandle::Imp::NORMAL
@ NORMAL
Definition
VP1MissingEtHandle.cxx:81
VP1MissingEtHandle::Imp::OBJECTBASED
@ OBJECTBASED
Definition
VP1MissingEtHandle.cxx:81
VP1MissingEtHandle::Imp::OTHER
@ OTHER
Definition
VP1MissingEtHandle.cxx:81
VP1MissingEtHandle::shape
static bool shape
Definition
VP1MissingEtHandle.h:71
VP1MissingEtHandle::m_d
Imp * m_d
Definition
VP1MissingEtHandle.h:62
VP1MissingEtHandle::key
const QString & key() const
Definition
VP1MissingEtHandle.cxx:127
VP1MissingEtHandle::thickness
static double thickness
Definition
VP1MissingEtHandle.h:69
VP1MissingEtHandle::baseCol
virtual QColor baseCol() const
Definition
VP1MissingEtHandle.cxx:179
VP1MissingEtHandle::m_base
SoGroup * m_base
Definition
VP1MissingEtHandle.h:65
VP1MissingEtHandle::useThickness
static void useThickness(double)
Definition
VP1MissingEtHandle.cxx:359
VP1MissingEtHandle::m_arrow
SoGroup * m_arrow
Definition
VP1MissingEtHandle.h:65
VP1MissingEtHandle::baseInfo
QStringList baseInfo(const MissingET *) const
Definition
VP1MissingEtHandle.cxx:205
VP1MissingEtHandle::provideText
virtual QString provideText() const
Definition
VP1MissingEtHandle.cxx:143
VP1MissingEtHandle::clicked
virtual QStringList clicked(SoPath *) const
Definition
VP1MissingEtHandle.cxx:221
VP1MissingEtHandle::useShape
static void useShape(bool)
Definition
VP1MissingEtHandle.cxx:367
VP1MissingEtHandle::VP1MissingEtHandle
VP1MissingEtHandle(IVP1System *sys, const QString &key)
Definition
VP1MissingEtHandle.cxx:87
VP1MissingEtHandle::refresh
void refresh()
Definition
VP1MissingEtHandle.cxx:322
VP1MissingEtHandle::m_length
double m_length
Definition
VP1MissingEtHandle.h:66
VP1MissingEtHandle::scale
static double scale
Definition
VP1MissingEtHandle.h:70
VP1MissingEtHandle::providePersistifiableID
virtual QByteArray providePersistifiableID() const
Definition
VP1MissingEtHandle.cxx:133
VP1MissingEtHandle::provideSection
virtual QString provideSection() const
Definition
VP1MissingEtHandle.cxx:153
VP1MissingEtHandle::~VP1MissingEtHandle
virtual ~VP1MissingEtHandle()
Definition
VP1MissingEtHandle.cxx:111
VP1MissingEtHandle::truncateToCollSep
void truncateToCollSep(SoPath *) const
Definition
VP1MissingEtHandle.cxx:194
VP1MissingEtHandle::provideSectionToolTip
virtual QString provideSectionToolTip() const
Definition
VP1MissingEtHandle.cxx:166
VP1MissingEtHandle::m_phi
double m_phi
Definition
VP1MissingEtHandle.h:66
VP1MissingEtHandle::assignDefaultMaterial
void assignDefaultMaterial(SoMaterial *) const
Definition
VP1MissingEtHandle.cxx:188
VP1MissingEtHandle::addArrowToCollSep
void addArrowToCollSep(const MissingET *)
Definition
VP1MissingEtHandle.cxx:228
VP1MissingEtHandle::useScale
static void useScale(double)
Definition
VP1MissingEtHandle.cxx:363
VP1MissingEtHandle::load
virtual bool load()
Definition
VP1MissingEtHandle.cxx:312
VP1MissingEtHandle::m_dash
SoGroup * m_dash
Definition
VP1MissingEtHandle.h:65
VP1MissingEtHandle::createCollections
static QList< VP1StdCollection * > createCollections(IVP1System *sys)
Definition
VP1MissingEtHandle.cxx:43
VP1SGAccessHelper
Definition
VP1SGAccessHelper.h:25
VP1SGContentsHelper
Definition
VP1SGContentsHelper.h:26
VP1SGContentsHelper::getKeys
QStringList getKeys() const
Definition
VP1SGContentsHelper.h:55
VP1Serialise
Definition
VP1Serialise.h:45
VP1StdCollection::init
virtual void init(VP1MaterialButtonBase *button=0)
Definition
VP1StdCollection.cxx:73
VP1StdCollection::collSep
SoSeparator * collSep() const
All 3D objects from this coll.
Definition
VP1StdCollection.cxx:212
VP1StdCollection::collTypeID
qint32 collTypeID() const
Definition
VP1StdCollection.cxx:315
VP1StdCollection::VP1StdCollection
VP1StdCollection(IVP1System *, const QString &helperClassName)
Definition
VP1StdCollection.cxx:67
r
int r
Definition
globals.cxx:22
met
Definition
IMETSignificance.h:24
str
Definition
BTagTrackIpAccessor.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0