ATLAS Offline Software
VP1TrackingVolumes.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 // //
8 // Implementation of class VP1TrackingVolumes //
9 // //
10 // Author: Edward.Moyse@cern.ch //
11 // Initial version: March 2009 //
12 // //
14 
16 #include <Inventor/C/errors/debugerror.h>
17 #include <Inventor/nodes/SoMaterial.h>
18 #include <Inventor/nodes/SoSeparator.h>
19 #include <Inventor/nodes/SoCylinder.h>
20 #include <Inventor/nodes/SoCone.h>
21 #include <Inventor/nodes/SoTranslation.h>
22 #include <Inventor/nodes/SoRotationXYZ.h>
23 #include <iostream>
24 //____________________________________________________________________
26 public:
28  SoMaterial * materialID,
29  SoMaterial * materialCalo,
30  SoMaterial * materialMS,
31  SoSeparator * attachsep,
32  bool showID, bool showCalo, bool showMS);
34  SoSeparator * attachSep;
35  SoMaterial * materialID;
36  SoMaterial * materialCalo;
37  SoMaterial * materialMS;
38 
39  bool shown;
40  bool shownID;
41  bool shownCalo;
42  bool shownMS;
43 
44  SoSeparator * sep;
45  SoSeparator * sepID;
46  SoSeparator * sepCalo;
47  SoSeparator * sepMS;
48  SoCylinder* innerDetector;
49  SoCylinder* calos;
50  SoCylinder* muonSpectrometer;
51 
52  void updateFields();
53  void ensureInit3DObjects();
54 };
55 
56 //____________________________________________________________________
57 VP1TrackingVolumes::VP1TrackingVolumes( SoMaterial * materialID,SoMaterial * materialCalo,SoMaterial * materialMS,
58  bool showID, bool showCalo, bool showMS,
59  SoSeparator * attachsep,
60  IVP1System * sys,QObject * parent)
61  : QObject(parent), VP1HelperClassBase(sys,"VP1TrackingVolumes"), m_d(new Imp(this,materialID, materialCalo, materialMS, attachsep, showID, showCalo, showMS))
62 {
63 }
64 
65 //____________________________________________________________________
67 {
68 
69  setShown(false);
70  if (m_d->sepID)
71  m_d->sepID->unref();
72  if (m_d->sepCalo)
73  m_d->sepCalo->unref();
74  if (m_d->sepMS)
75  m_d->sepMS->unref();
76 
77  if (m_d->sep)
78  m_d->sep->unref();
79  std::cout<<"m_d->attachSep"<<std::endl;
80 
81  m_d->attachSep->unref();
82  delete m_d;
83 }
84 
85 //____________________________________________________________________
86 VP1TrackingVolumes::Imp::Imp(VP1TrackingVolumes *tc, SoMaterial * materialID,SoMaterial * materialCalo,SoMaterial * materialMS, SoSeparator * as, bool showID, bool showCalo, bool showMS)
87  : theclass(tc), attachSep(as),
88  materialID(materialID), materialCalo(materialCalo), materialMS(materialMS),
89  shown(false), shownID(showID), shownCalo(showCalo), shownMS(showMS),
90  sep(0),sepID(0),sepCalo(0),sepMS(0),innerDetector(0),calos(0),muonSpectrometer(0)
91 {
92  attachSep->ref();
93 }
94 
95 //____________________________________________________________________
97 {
98  if (sep && sepID && sepCalo && sepMS)
99  return;
100  theclass->messageVerbose("Building 3D objects");
101 
102  sep = new SoSeparator;
103  sep->ref();
104  SoRotationXYZ * rotz = new SoRotationXYZ;
105  rotz->axis.setValue(SoRotationXYZ::X);
106  rotz->angle.setValue(0.5*M_PI);
107  sep->addChild(rotz);
108 
109  sepID = new SoSeparator;
110  sepID->ref();
111  sepID->addChild(materialID);
112  innerDetector = new SoCylinder;
113  innerDetector->radius.setValue(1100.0);
114  innerDetector->height.setValue( 6400.0 );
115  sepID->addChild(innerDetector);
116 
117  sepCalo = new SoSeparator;
118  sepCalo->ref();
119  sepCalo->addChild(materialCalo);
120  calos = new SoCylinder;
121  calos->radius.setValue(4250.0);
122  calos->height.setValue( 6779.0*2.0 );
123  sepCalo->addChild(calos);
124 
125  sepMS = new SoSeparator;
126  sepMS->ref();
127  sepMS->addChild(materialMS);
128  muonSpectrometer = new SoCylinder;
129  muonSpectrometer->radius.setValue(15000.0);
130  muonSpectrometer->height.setValue( 21000.0*2.0 );
131  sepMS->addChild(muonSpectrometer);
132 
133 
134 // innerDetector->parts.setValue(SoCylinder::SIDES|SoCylinder::BOTTOM);
135 }
136 
137 //____________________________________________________________________
139 {
140  ensureInit3DObjects();
141  theclass->messageVerbose("Updating fields");
142 
143  const bool save = sep->enableNotify(false);
144 
145  if (shownID ){
146  if (sep->findChild(sepID)<0)
147  sep->addChild(sepID);
148  } else {
149  sep->removeChild(sepID);
150  }
151 
152  if (shownCalo ){
153  if (sep->findChild(sepCalo)<0)
154  sep->addChild(sepCalo);
155  } else {
156  sep->removeChild(sepCalo);
157  }
158 
159  if (shownMS ){
160  if (sep->findChild(sepMS)<0)
161  sep->addChild(sepMS);
162  } else {
163  sep->removeChild(sepMS);
164  }
165 
166  if (save) {
167  sep->enableNotify(true);
168  sep->touch();
169  }
170 }
171 
172 //____________________________________________________________________
174 {
175  messageVerbose("Signal received: setShown("+str(b)+")");
176  if (m_d->shown==b)
177  return;
178  m_d->shown=b;
179  if (m_d->shown) {
180  m_d->updateFields();
181  if (m_d->attachSep->findChild(m_d->sep)<0)
182  m_d->attachSep->addChild(m_d->sep);
183  } else {
184  m_d->attachSep->removeChild(m_d->sep);
185  }
186 }
187 
188 //____________________________________________________________________
190 {
191  messageVerbose("Signal received: setShownID("+str(b)+")");
192  if (m_d->shownID==b)
193  return;
194  m_d->shownID=b;
195  if (m_d->shown)
196  m_d->updateFields();
197 }
198 
199 //____________________________________________________________________
201 {
202  messageVerbose("Signal received: setShownCalo("+str(b)+")");
203  if (m_d->shownCalo==b)
204  return;
205  m_d->shownCalo=b;
206  if (m_d->shown)
207  m_d->updateFields();
208 }
209 
210 //____________________________________________________________________
212 {
213  messageVerbose("Signal received: setShownMS("+str(b)+")");
214  if (m_d->shownMS==b)
215  return;
216  m_d->shownMS=b;
217  if (m_d->shown)
218  m_d->updateFields();
219 }
VP1TrackingVolumes::VP1TrackingVolumes
VP1TrackingVolumes(SoMaterial *materialID, SoMaterial *materialCalo, SoMaterial *materialMS, bool showID, bool showCalo, bool showMS, SoSeparator *attachsep, IVP1System *sys, QObject *parent=0)
Definition: VP1TrackingVolumes.cxx:57
VP1TrackingVolumes::Imp::theclass
VP1TrackingVolumes * theclass
Definition: VP1TrackingVolumes.cxx:33
VP1TrackingVolumes::Imp::sepID
SoSeparator * sepID
Definition: VP1TrackingVolumes.cxx:45
VP1TrackingVolumes::~VP1TrackingVolumes
virtual ~VP1TrackingVolumes()
Definition: VP1TrackingVolumes.cxx:66
VP1TrackingVolumes::Imp::updateFields
void updateFields()
Definition: VP1TrackingVolumes.cxx:138
VP1TrackingVolumes::Imp::sep
SoSeparator * sep
Definition: VP1TrackingVolumes.cxx:44
VP1TrackingVolumes
Definition: VP1TrackingVolumes.h:26
VP1TrackingVolumes::Imp::muonSpectrometer
SoCylinder * muonSpectrometer
Definition: VP1TrackingVolumes.cxx:50
VP1TrackingVolumes::Imp::materialID
SoMaterial * materialID
Definition: VP1TrackingVolumes.cxx:35
VP1TrackingVolumes::Imp::shown
bool shown
Definition: VP1TrackingVolumes.cxx:39
VP1HelperClassBase::messageVerbose
void messageVerbose(const QString &) const
Definition: VP1HelperClassBase.cxx:78
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
M_PI
#define M_PI
Definition: ActiveFraction.h:11
VP1TrackingVolumes::Imp::ensureInit3DObjects
void ensureInit3DObjects()
Definition: VP1TrackingVolumes.cxx:96
VP1TrackingVolumes::setShownMS
void setShownMS(bool)
will attach/detach MS from sep depending on this
Definition: VP1TrackingVolumes.cxx:211
VP1String::str
static QString str(const QString &s)
Definition: VP1String.h:49
mapkey::sys
@ sys
Definition: TElectronEfficiencyCorrectionTool.cxx:42
VP1TrackingVolumes::Imp::Imp
Imp(VP1TrackingVolumes *tc, SoMaterial *materialID, SoMaterial *materialCalo, SoMaterial *materialMS, SoSeparator *attachsep, bool showID, bool showCalo, bool showMS)
Definition: VP1TrackingVolumes.cxx:86
VP1TrackingVolumes::Imp::materialCalo
SoMaterial * materialCalo
Definition: VP1TrackingVolumes.cxx:36
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
VP1TrackingVolumes::Imp::sepCalo
SoSeparator * sepCalo
Definition: VP1TrackingVolumes.cxx:46
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
IVP1System
Definition: IVP1System.h:36
VP1TrackingVolumes::Imp::materialMS
SoMaterial * materialMS
Definition: VP1TrackingVolumes.cxx:37
VP1TrackingVolumes::setShownCalo
void setShownCalo(bool)
will attach/detach Calo from sep depending on this
Definition: VP1TrackingVolumes.cxx:200
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1TrackingVolumes::Imp
Definition: VP1TrackingVolumes.cxx:25
VP1HelperClassBase
Definition: VP1HelperClassBase.h:28
grepfile.sep
sep
Definition: grepfile.py:38
VP1TrackingVolumes::Imp::calos
SoCylinder * calos
Definition: VP1TrackingVolumes.cxx:49
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
VP1TrackingVolumes::Imp::shownCalo
bool shownCalo
Definition: VP1TrackingVolumes.cxx:41
VP1TrackingVolumes::Imp::shownID
bool shownID
Definition: VP1TrackingVolumes.cxx:40
VP1TrackingVolumes.h
VP1TrackingVolumes::Imp::innerDetector
SoCylinder * innerDetector
Definition: VP1TrackingVolumes.cxx:48
VP1TrackingVolumes::setShownID
void setShownID(bool)
will attach/detach ID from sep depending on this
Definition: VP1TrackingVolumes.cxx:189
VP1TrackingVolumes::Imp::attachSep
SoSeparator * attachSep
Definition: VP1TrackingVolumes.cxx:34
VP1TrackingVolumes::Imp::shownMS
bool shownMS
Definition: VP1TrackingVolumes.cxx:42
VP1TrackingVolumes::m_d
Imp * m_d
Definition: VP1TrackingVolumes.h:47
VP1TrackingVolumes::Imp::sepMS
SoSeparator * sepMS
Definition: VP1TrackingVolumes.cxx:47
VP1TrackingVolumes::setShown
void setShown(bool)
will attach/detach itself from attachsep depending on this
Definition: VP1TrackingVolumes.cxx:173