ATLAS Offline Software
Loading...
Searching...
No Matches
VP1CaloReadoutSystem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "ui_caloreadoutsystemcontroller.h"
9
10#include "VP1Utils/VP1DetInfo.h"
12
13#include <QMap>
14#include <QVector>
15
16#include <Inventor/nodes/SoSwitch.h>
17#include <Inventor/nodes/SoSeparator.h>
18#include <Inventor/nodes/SoMaterial.h>
19#include <Inventor/nodes/SoDrawStyle.h>
20#include <Inventor/nodes/SoPickStyle.h>
21#include <Inventor/nodes/SoLightModel.h>
22#include <Inventor/nodes/SoTransform.h>
23#include <Inventor/nodes/SoPointSet.h>
24#include <Inventor/nodes/SoLineSet.h>
25#include <Inventor/nodes/SoVertexProperty.h>
26#include <Inventor/nodes/SoSphere.h>
27
32
35
38
43
49#include "LArHV/EMBHVModule.h"
50#include "LArHV/EMBHVManager.h"
51#include "LArHV/FCALHVLine.h"
52#include "LArHV/FCALHVModule.h"
53#include "LArHV/FCALHVManager.h"
54#include "LArHV/HECHVManager.h"
55#include "LArHV/HECHVModule.h"
56#include "LArHV/HECHVSubgap.h"
57#include "LArHV/LArHVManager.h"
62
64
66#include <sstream>
67
68
69#define MAX_OBJECTS_PER_TECHNOLOGY 3000
70#define NPHISECTORS 16
71
73{
74public:
75
76 SoSeparator *volatileSeparator = nullptr;
77
78 QMap<QString,SoSwitch*> switchMap;
79
80 // Two maps for controller check boxes
81 QMap<QCheckBox*,QString> checkBoxNamesMap;
82 QMap<QString,QCheckBox*> checkBoxMap;
83 SoPickStyle *pickStyle = nullptr;
84
85 SoSwitch *fcalSwitch[3]{}; // FCAL
86 SoSwitch *fcalHVSwitch[3]{}; // FCAL
87 SoSwitch *fcalNormalSwitch[3]{};
88 SoSwitch *fcalBadSwitch[3]{};
89 SoSwitch *fcalMissingSwitch[3]{};
90
91 SoSwitch *hecSwitch[4]{}; // HEC
92 SoSwitch *hecHVSwitch[4]{}; // HEC
93 SoSwitch *hecNormalSwitch[4]{};
94 SoSwitch *hecBadSwitch[4]{};
95 SoSwitch *hecMissingSwitch[4]{};
96
97 SoSwitch *embSwitch[4]{}; // EMB
98 SoSwitch *embHVSwitch = nullptr;
99 SoSwitch *embModsSwitch = nullptr;
100 SoSwitch *embNormalSwitch = nullptr;
101 SoSwitch *embBadSwitch = nullptr;
102 SoSwitch *embMissingSwitch = nullptr;
103 SoSwitch *embPreHVSwitch = nullptr;
104 SoSwitch *embPreModsSwitch = nullptr;
105 SoSwitch *embPreNormalSwitch = nullptr;
106 SoSwitch *embPreBadSwitch = nullptr;
107 SoSwitch *embPreMissingSwitch = nullptr;
108
109 SoSwitch *emecPreHVSwitch = nullptr;
110 SoSwitch *emecPreModsSwitch = nullptr;
111 SoSwitch *emecPreNormalSwitch = nullptr;
112 SoSwitch *emecPreBadSwitch = nullptr;
113 SoSwitch *emecPreMissingSwitch = nullptr;
114
115
116 SoSwitch *emecSwitch[4]{}; // EMEC
117 SoSwitch *emecHVSwitch = nullptr; // EMB
118 SoSwitch *emecModsSwitch = nullptr;
119 SoSwitch *emecNormalSwitch = nullptr;
120 SoSwitch *emecBadSwitch = nullptr;
121 SoSwitch *emecMissingSwitch = nullptr;
122
123 SoSeparator *fcalSeparator[3]{}; // FCAL
124 SoSeparator *hecSeparator [4]{}; // HEC
125 SoSeparator *emecSeparator[4]{}; // EMEC
126 SoSeparator *embSeparator [4]{}; // EMB
127
128
129 SoSeparator *fcalHVSeparator[3]{};
130 SoSeparator *hecHVSeparator[4]{};
131 SoSeparator *embPreHVSeparator = nullptr;
132 SoSeparator *emecPreHVSeparator = nullptr;
133
134 SoSeparator *embHVSeparator = nullptr;
135 SoSeparator *emecHVSeparator = nullptr;
136 SoSeparator *embModsSeparator = nullptr;
137 SoSeparator *embPreModsSeparator = nullptr;
138 SoSeparator *emecPreModsSeparator = nullptr;
139 SoSeparator *emecModsSeparator = nullptr;
140
141 SoSwitch *embSubSwitch[4][NPHISECTORS]{};
142 SoSwitch *emecSubSwitch[4][NPHISECTORS]{};
143 SoSwitch *hecSubSwitch[4][NPHISECTORS]{};
144
145 SoSeparator *embSubSep[4][NPHISECTORS]{};
146 SoSeparator *emecSubSep[4][NPHISECTORS]{};
147 SoSeparator *hecSubSep[4][NPHISECTORS]{};
148 SoSeparator *fcalSubSep[3]{};
149
150 SoSeparator *fcalNormalSep[3]{};
151 SoSeparator *fcalMissingSep[3]{};
152 SoSeparator *fcalBadSep[3]{};
153
154 SoSeparator *hecNormalSep[4]{};
155 SoSeparator *hecMissingSep[4]{};
156 SoSeparator *hecBadSep[4]{};
157
158 SoSeparator *embNormalSep = nullptr;
159 SoSeparator *embMissingSep = nullptr;
160 SoSeparator *embBadSep = nullptr;
161
162 SoSeparator *embPreNormalSep = nullptr;
163 SoSeparator *embPreMissingSep = nullptr;
164 SoSeparator *embPreBadSep = nullptr;
165
166 SoSeparator *emecPreNormalSep = nullptr;
167 SoSeparator *emecPreMissingSep = nullptr;
168 SoSeparator *emecPreBadSep = nullptr;
169
170 SoSeparator *emecNormalSep = nullptr;
171 SoSeparator *emecMissingSep = nullptr;
172 SoSeparator *emecBadSep = nullptr;
173
174
177
178
179 SoSwitch *emecFocalSwitch = nullptr;
180 SoSwitch *hecFocalSwitch = nullptr;
181 SoSwitch *embAccViewSwitch = nullptr;
182
183 SoMaterial *embMaterial = nullptr;
184 SoMaterial *emecMaterial = nullptr;
185 SoMaterial *hecMaterial = nullptr;
186 SoMaterial *fcalMaterial = nullptr;
187 SoMaterial *embAccMaterial = nullptr;
188
189 std::map < SoNode *, const FCALTile *> TileMap;
190 std::map < SoNode *, HECCellConstLink> HECMap;
191 std::map < SoNode *, EMECCellConstLink> EMECMap;
192 std::map < SoNode *, EMBCellConstLink> EMBMap;
193
194 std::map < SoNode *, const EMBHVElectrode*> EMBHVMap;
195 std::map < SoNode *, const EMECHVElectrode*> EMECHVMap;
196 std::map < SoNode *, const FCALHVLine*> FCALHVMap;
197 std::map < SoNode *, const HECHVSubgap*> HECHVMap;
198
200
201 Ui::CaloReadoutSystemControllerForm ui{};
202 bool hvInit = false;
203 bool permInit = false;
205};
206
208 :IVP13DSystemSimple("CaloReadout","Display the calorimeter readout segmentation","boudreau@pitt.edu"),
210{
211 m_clockwork->hvInit=false;
212 m_clockwork->permInit=false;
213}
214
220
221#define INSERTCHECKBOX(checkboxname) \
222m_clockwork->checkBoxNamesMap.insert(m_clockwork->ui.checkboxname, m_clockwork->ui.checkboxname->objectName())
223
225{
226 QWidget* controller = new QWidget(0);
227 m_clockwork->ui.setupUi(controller);
228
229 // Populate Check Box Names Map
230 INSERTCHECKBOX(embS0CheckBox);
231 INSERTCHECKBOX(embS1CheckBox);
232 INSERTCHECKBOX(embS2CheckBox);
233 INSERTCHECKBOX(embS3CheckBox);
234
235 INSERTCHECKBOX(emecS0CheckBox);
236 INSERTCHECKBOX(emecS1CheckBox);
237 INSERTCHECKBOX(emecS2CheckBox);
238 INSERTCHECKBOX(emecS3CheckBox);
239
240 INSERTCHECKBOX(hecS0CheckBox);
241 INSERTCHECKBOX(hecS1CheckBox);
242 INSERTCHECKBOX(hecS2CheckBox);
243 INSERTCHECKBOX(hecS3CheckBox);
244
245 INSERTCHECKBOX(fcalS0CheckBox);
246 INSERTCHECKBOX(fcalS1CheckBox);
247 INSERTCHECKBOX(fcalS2CheckBox);
248
249
250 INSERTCHECKBOX(embCheckBoxHV);
251 INSERTCHECKBOX(embCheckBoxMods);
252 INSERTCHECKBOX(emecCheckBoxHV);
253 INSERTCHECKBOX(emecCheckBoxMods);
254 INSERTCHECKBOX(embPresamplerCheckBoxHV);
255 INSERTCHECKBOX(embPresamplerCheckBoxMods);
256 INSERTCHECKBOX(emecPresamplerCheckBoxHV);
257 INSERTCHECKBOX(emecPresamplerCheckBoxMods);
258
259 INSERTCHECKBOX(hecS0CheckBoxHV);
260 INSERTCHECKBOX(hecS1CheckBoxHV);
261 INSERTCHECKBOX(hecS2CheckBoxHV);
262 INSERTCHECKBOX(hecS3CheckBoxHV);
263
264 INSERTCHECKBOX(fcalS0CheckBoxHV);
265 INSERTCHECKBOX(fcalS1CheckBoxHV);
266 INSERTCHECKBOX(fcalS2CheckBoxHV);
267
268
269 INSERTCHECKBOX(emecFocalCheckBox);
270 INSERTCHECKBOX(hecFocalCheckBox);
271
272 INSERTCHECKBOX(embAccordionCheckBox);
273
274 INSERTCHECKBOX(geomSelectableCheckBox);
275
276 INSERTCHECKBOX(indicesCheckBox);
277 INSERTCHECKBOX(etaBoundariesCheckBox);
278 INSERTCHECKBOX(phiBoundariesCheckBox);
279 INSERTCHECKBOX(fcalTubesCheckBox);
280 INSERTCHECKBOX(highVoltageCheckBox);
281 INSERTCHECKBOX(badHVDisplayCheckBox);
282 INSERTCHECKBOX(missingHVDisplayCheckBox);
283 INSERTCHECKBOX(normalHVDisplayCheckBox);
284
285 m_clockwork->currentlyEnabledPhiSectors = QVector<bool>(NPHISECTORS,false);
286 QList<int> l; l << 4 << 8 << NPHISECTORS;//NB: All must be divisors in NPHISECTORS
287 m_clockwork->ui.phiSectionWidget->setNumberOfSectors(16);
288 m_clockwork->ui.phiSectionWidget->setAllowedNumberOfSectors(l);
289
290 // Populate Check Box Map and connect slots
291 for(QCheckBox* cb : m_clockwork->checkBoxNamesMap.keys())
292 {
293 connect(cb,SIGNAL(toggled(bool)),this,SLOT(checkboxChanged()));
294 m_clockwork->checkBoxMap.insert(m_clockwork->checkBoxNamesMap[cb],cb);
295 }
296
297 if (m_clockwork->ui.frontRadioButton->isChecked()) m_clockwork->pos=VP1CaloReadoutSystem::FRONT;
298 if (m_clockwork->ui.backRadioButton->isChecked()) m_clockwork->pos=VP1CaloReadoutSystem::BACK;
299 if (m_clockwork->ui.centerRadioButton->isChecked()) m_clockwork->pos=VP1CaloReadoutSystem::CENTER;
300
301 connect(m_clockwork->ui.frontRadioButton, SIGNAL(clicked()), this, SLOT(positionOptionChanged()));
302 connect(m_clockwork->ui.backRadioButton, SIGNAL(clicked()), this, SLOT(positionOptionChanged()));
303 connect(m_clockwork->ui.centerRadioButton, SIGNAL(clicked()), this, SLOT(positionOptionChanged()));
304 connect(m_clockwork->ui.acceptHVPushButton, SIGNAL(clicked()), this, SLOT(acceptHV()));
305
306 connect(m_clockwork->ui.geomSelectableCheckBox, SIGNAL(toggled(bool)), this, SLOT(setGeomSelectable(bool)));
307
308 // Connect the PhiSectionWidget:
309 connect(m_clockwork->ui.phiSectionWidget,SIGNAL(enabledPhiRangesChanged(const QList<VP1Interval>&)),
310 this,SLOT(enabledPhiSectorsChanged()));
311
312 return controller;
313}
314
316{
317
318 QVector<bool> v = m_clockwork->ui.phiSectionWidget->virtualSectorsEnabled(NPHISECTORS);
319 if (m_clockwork->currentlyEnabledPhiSectors == v)
320 return;
321 QList<int> justEnabledPhiSectors;
322 QList<int> justDisabledPhiSectors;
323 for (int iphi = 0; iphi < NPHISECTORS; ++iphi) {
324 bool currentstate=m_clockwork->currentlyEnabledPhiSectors[iphi];
325 if (currentstate!=v[iphi]) {
326 if (currentstate)
327 justDisabledPhiSectors << iphi;
328 else
329 justEnabledPhiSectors << iphi;
330 }
331 }
332 m_clockwork->currentlyEnabledPhiSectors = v;
333 for (int iphi : justDisabledPhiSectors)
334 phiSectorTurnoff(iphi);
335 for (int iphi : justEnabledPhiSectors)
336 phiSectorTurnon(iphi);
337}
338
342
344
345 if (m_clockwork->permInit) return;
346 m_clockwork->permInit = true;
347
348 // Styles & cet:
349 SoDrawStyle *drawStyle = new SoDrawStyle();
350 drawStyle->lineWidth=2;
351 drawStyle->pointSize=3;
352
353 SoLightModel *lightModel = new SoLightModel();
354 lightModel->model=SoLightModel::BASE_COLOR;
355
356 m_clockwork->pickStyle = new SoPickStyle();
357 m_clockwork->pickStyle->style = m_clockwork->ui.geomSelectableCheckBox->isChecked() ? SoPickStyleElement::SHAPE : SoPickStyleElement::UNPICKABLE;
358 m_clockwork->ui.etaBoundariesCheckBox->setEnabled(m_clockwork->ui.geomSelectableCheckBox->isChecked());
359 m_clockwork->ui.phiBoundariesCheckBox->setEnabled(m_clockwork->ui.geomSelectableCheckBox->isChecked());
360 m_clockwork->ui.fcalTubesCheckBox->setEnabled(m_clockwork->ui.geomSelectableCheckBox->isChecked());
361 m_clockwork->ui.highVoltageCheckBox->setEnabled(m_clockwork->ui.geomSelectableCheckBox->isChecked());
362 m_clockwork->ui.indicesCheckBox->setEnabled(m_clockwork->ui.geomSelectableCheckBox->isChecked());
363
364
365 root->addChild(m_clockwork->pickStyle);
366 root->addChild(drawStyle);
367 root->addChild(lightModel);
368
369 m_clockwork->volatileSeparator = new SoSeparator();
370// SoMaterial *red = new SoMaterial();
371// red->diffuseColor.setValue(1,0,0);
372
373 SoMaterial *white = new SoMaterial();
374 white->diffuseColor.setValue(1,1,1);
375
376// SoMaterial *blue = new SoMaterial();
377// blue->diffuseColor.setValue(0,0,1);
378
379 root->addChild(white);
380 root->addChild(m_clockwork->volatileSeparator);
381
382 // Blue, basically:
383 m_clockwork->embMaterial= new SoMaterial();
384 m_clockwork->embMaterial->diffuseColor.setValue(0,0,1);
385
386 // Green, basically:
387 m_clockwork->fcalMaterial= new SoMaterial();
388 m_clockwork->fcalMaterial->diffuseColor.setValue(0 , 1, 0);
389
390 // Yaller, basically:
391 m_clockwork->hecMaterial= new SoMaterial();
392 m_clockwork->hecMaterial->diffuseColor.setValue(0, 1.00, 1.00);
393
394 // Pink, basically:
395 m_clockwork->emecMaterial = new SoMaterial();
396 m_clockwork->emecMaterial->diffuseColor.setValue(1.00,0.00, 1.00);
397
398 // White, totally:
399 m_clockwork->embAccMaterial = new SoMaterial();
400 m_clockwork->embAccMaterial->diffuseColor.setValue(1.00,1.00, 1.00);
401
402 m_clockwork->ui.embColorSel->setMaterial(m_clockwork->embMaterial);
403 m_clockwork->ui.emecColorSel->setMaterial(m_clockwork->emecMaterial);
404 m_clockwork->ui.hecColorSel->setMaterial(m_clockwork->hecMaterial);
405 m_clockwork->ui.fcalColorSel->setMaterial(m_clockwork->fcalMaterial);
406
407// SoPickStyle *hvPickStyle=new SoPickStyle();
408// hvPickStyle->style = SoPickStyleElement::UNPICKABLE;
409
410 for (int i=0;i<3;i++) {
411 m_clockwork->fcalSwitch[i] = new SoSwitch();
412 m_clockwork->fcalHVSwitch[i] = new SoSwitch();
413 m_clockwork->fcalNormalSwitch[i] = new SoSwitch();
414 m_clockwork->fcalBadSwitch[i] = new SoSwitch();
415 m_clockwork->fcalMissingSwitch[i] = new SoSwitch();
416 m_clockwork->fcalSeparator[i] = new SoSeparator();
417 m_clockwork->fcalHVSeparator[i]= new SoSeparator();
418 // m_clockwork->fcalHVSeparator[i]->addChild(hvPickStyle);
419 m_clockwork->fcalSwitch[i]->addChild(m_clockwork->fcalSeparator[i]);
420 m_clockwork->fcalHVSwitch[i]->addChild(m_clockwork->fcalHVSeparator[i]);
421
422 m_clockwork->fcalSeparator[i]->addChild(m_clockwork->fcalMaterial);
423 m_clockwork->fcalSubSep[i]= new SoSeparator();
424 m_clockwork->fcalSeparator[i]->addChild(m_clockwork->fcalSubSep[i]);
425
426 m_clockwork->fcalHVSeparator[i]->addChild(drawStyle);
427 m_clockwork->fcalHVSeparator[i]->addChild(lightModel);
428
429 m_clockwork->fcalHVSeparator[i]->addChild(m_clockwork->fcalNormalSwitch[i]);
430 m_clockwork->fcalHVSeparator[i]->addChild(m_clockwork->fcalBadSwitch[i]);
431 m_clockwork->fcalHVSeparator[i]->addChild(m_clockwork->fcalMissingSwitch[i]);
432
433 m_clockwork->fcalNormalSep[i] =new SoSeparator(); m_clockwork->fcalNormalSwitch[i] ->addChild(m_clockwork->fcalNormalSep[i]);
434 m_clockwork->fcalBadSep[i] =new SoSeparator(); m_clockwork->fcalBadSwitch[i] ->addChild(m_clockwork->fcalBadSep[i]);
435 m_clockwork->fcalMissingSep[i]=new SoSeparator(); m_clockwork->fcalMissingSwitch[i]->addChild(m_clockwork->fcalMissingSep[i]);
436
437 root->addChild(m_clockwork->fcalSwitch[i]);
438 root->addChild(m_clockwork->fcalHVSwitch[i]);
439 }
440
441 {
442 m_clockwork->embModsSwitch = new SoSwitch();
443 m_clockwork->embModsSeparator = new SoSeparator();
444 m_clockwork->embModsSwitch->addChild(m_clockwork->embModsSeparator);
445 m_clockwork->embModsSeparator->addChild(drawStyle);
446 m_clockwork->embModsSeparator->addChild(lightModel);
447
448
449 m_clockwork->embHVSwitch = new SoSwitch();
450 m_clockwork->embHVSeparator = new SoSeparator();
451 m_clockwork->embHVSwitch->addChild(m_clockwork->embHVSeparator);
452 m_clockwork->embHVSeparator->addChild(drawStyle);
453 m_clockwork->embHVSeparator->addChild(lightModel);
454
455 m_clockwork->embNormalSep = new SoSeparator();
456 m_clockwork->embNormalSwitch = new SoSwitch();
457 m_clockwork->embNormalSwitch->addChild(m_clockwork->embNormalSep);
458 m_clockwork->embHVSeparator->addChild(m_clockwork->embNormalSwitch);
459
460 m_clockwork->embMissingSep = new SoSeparator();
461 m_clockwork->embMissingSwitch = new SoSwitch();
462 m_clockwork->embMissingSwitch->addChild(m_clockwork->embMissingSep);
463 m_clockwork->embHVSeparator->addChild(m_clockwork->embMissingSwitch);
464
465 m_clockwork->embBadSep = new SoSeparator();
466 m_clockwork->embBadSwitch = new SoSwitch();
467 m_clockwork->embBadSwitch->addChild(m_clockwork->embBadSep);
468 m_clockwork->embHVSeparator->addChild(m_clockwork->embBadSwitch);
469
470 }
471
472 {
473 m_clockwork->embPreModsSwitch = new SoSwitch();
474 m_clockwork->embPreModsSeparator = new SoSeparator();
475 m_clockwork->embPreModsSwitch->addChild(m_clockwork->embPreModsSeparator);
476 m_clockwork->embPreModsSeparator->addChild(drawStyle);
477 m_clockwork->embPreModsSeparator->addChild(lightModel);
478
479 m_clockwork->embPreHVSwitch = new SoSwitch();
480 m_clockwork->embPreHVSeparator = new SoSeparator();
481 m_clockwork->embPreHVSwitch->addChild(m_clockwork->embPreHVSeparator);
482 m_clockwork->embPreHVSeparator->addChild(drawStyle);
483 m_clockwork->embPreHVSeparator->addChild(lightModel);
484
485 m_clockwork->embPreNormalSep = new SoSeparator();
486 m_clockwork->embPreNormalSwitch = new SoSwitch();
487 m_clockwork->embPreNormalSwitch->addChild(m_clockwork->embPreNormalSep);
488 m_clockwork->embPreHVSeparator->addChild(m_clockwork->embPreNormalSwitch);
489
490 m_clockwork->embPreMissingSep = new SoSeparator();
491 m_clockwork->embPreMissingSwitch = new SoSwitch();
492 m_clockwork->embPreMissingSwitch->addChild(m_clockwork->embPreMissingSep);
493 m_clockwork->embPreHVSeparator->addChild(m_clockwork->embPreMissingSwitch);
494
495 m_clockwork->embPreBadSep = new SoSeparator();
496 m_clockwork->embPreBadSwitch = new SoSwitch();
497 m_clockwork->embPreBadSwitch->addChild(m_clockwork->embPreBadSep);
498 m_clockwork->embPreHVSeparator->addChild(m_clockwork->embPreBadSwitch);
499
500 }
501
502 {
503 m_clockwork->emecModsSwitch = new SoSwitch();
504 m_clockwork->emecModsSeparator = new SoSeparator();
505 m_clockwork->emecModsSwitch->addChild(m_clockwork->emecModsSeparator);
506 m_clockwork->emecModsSeparator->addChild(drawStyle);
507 m_clockwork->emecModsSeparator->addChild(lightModel);
508
509 m_clockwork->emecHVSwitch = new SoSwitch();
510 m_clockwork->emecHVSeparator = new SoSeparator();
511 m_clockwork->emecHVSwitch->addChild(m_clockwork->emecHVSeparator);
512 m_clockwork->emecHVSeparator->addChild(drawStyle);
513 m_clockwork->emecHVSeparator->addChild(lightModel);
514
515 m_clockwork->emecNormalSep = new SoSeparator();
516 m_clockwork->emecNormalSwitch = new SoSwitch();
517 m_clockwork->emecNormalSwitch->addChild(m_clockwork->emecNormalSep);
518 m_clockwork->emecHVSeparator->addChild(m_clockwork->emecNormalSwitch);
519
520 m_clockwork->emecMissingSep = new SoSeparator();
521 m_clockwork->emecMissingSwitch = new SoSwitch();
522 m_clockwork->emecMissingSwitch->addChild(m_clockwork->emecMissingSep);
523 m_clockwork->emecHVSeparator->addChild(m_clockwork->emecMissingSwitch);
524
525 m_clockwork->emecBadSep = new SoSeparator();
526 m_clockwork->emecBadSwitch = new SoSwitch();
527 m_clockwork->emecBadSwitch->addChild(m_clockwork->emecBadSep);
528 m_clockwork->emecHVSeparator->addChild(m_clockwork->emecBadSwitch);
529 }
530
531 {
532 m_clockwork->emecPreModsSwitch = new SoSwitch();
533 m_clockwork->emecPreModsSeparator = new SoSeparator();
534 m_clockwork->emecPreModsSwitch->addChild(m_clockwork->emecPreModsSeparator);
535 m_clockwork->emecPreModsSeparator->addChild(drawStyle);
536 m_clockwork->emecPreModsSeparator->addChild(lightModel);
537
538 m_clockwork->emecPreHVSwitch = new SoSwitch();
539 m_clockwork->emecPreHVSeparator = new SoSeparator();
540 m_clockwork->emecPreHVSwitch->addChild(m_clockwork->emecPreHVSeparator);
541 m_clockwork->emecPreHVSeparator->addChild(drawStyle);
542 m_clockwork->emecPreHVSeparator->addChild(lightModel);
543
544 m_clockwork->emecPreNormalSep = new SoSeparator();
545 m_clockwork->emecPreNormalSwitch = new SoSwitch();
546 m_clockwork->emecPreNormalSwitch->addChild(m_clockwork->emecPreNormalSep);
547 m_clockwork->emecPreHVSeparator->addChild(m_clockwork->emecPreNormalSwitch);
548
549 m_clockwork->emecPreMissingSep = new SoSeparator();
550 m_clockwork->emecPreMissingSwitch = new SoSwitch();
551 m_clockwork->emecPreMissingSwitch->addChild(m_clockwork->emecPreMissingSep);
552 m_clockwork->emecPreHVSeparator->addChild(m_clockwork->emecPreMissingSwitch);
553
554 m_clockwork->emecPreBadSep = new SoSeparator();
555 m_clockwork->emecPreBadSwitch = new SoSwitch();
556 m_clockwork->emecPreBadSwitch->addChild(m_clockwork->emecPreBadSep);
557 m_clockwork->emecPreHVSeparator->addChild(m_clockwork->emecPreBadSwitch);
558
559 }
560
561 root->addChild(m_clockwork->embHVSwitch);
562 root->addChild(m_clockwork->embPreHVSwitch);
563 root->addChild(m_clockwork->emecPreHVSwitch);
564 root->addChild(m_clockwork->emecHVSwitch);
565 root->addChild(m_clockwork->embModsSwitch);
566 root->addChild(m_clockwork->emecModsSwitch);
567 root->addChild(m_clockwork->embPreModsSwitch);
568 root->addChild(m_clockwork->emecPreModsSwitch);
569
570 for (int i=0;i<4;i++) {
571 m_clockwork->embSwitch[i] = new SoSwitch();
572 m_clockwork->embSeparator[i] = new SoSeparator();
573 m_clockwork->embSwitch[i]->addChild(m_clockwork->embSeparator[i]);
574 m_clockwork->embSeparator[i]->addChild(m_clockwork->embMaterial);
575
576 for (int p=0;p<NPHISECTORS;p++) {
577 m_clockwork->embSubSwitch[i][p] = new SoSwitch();
578 m_clockwork->embSubSep [i][p] = new SoSeparator();
579 m_clockwork->embSubSwitch[i][p]->addChild(m_clockwork->embSubSep[i][p]);
580 m_clockwork->embSeparator[i]->addChild(m_clockwork->embSubSwitch[i][p]);
581 m_clockwork->embSubSwitch[i][p]->whichChild= SO_SWITCH_ALL;
582 }
583
584 root->addChild(m_clockwork->embSwitch[i]);
585
586 m_clockwork->emecSwitch[i] = new SoSwitch();
587 m_clockwork->emecSeparator[i] = new SoSeparator();
588 m_clockwork->emecSwitch[i]->addChild(m_clockwork->emecSeparator[i]);
589 m_clockwork->emecSeparator[i]->addChild(m_clockwork->emecMaterial);
590
591 for (int p=0;p<NPHISECTORS;p++) {
592 m_clockwork->emecSubSwitch[i][p] = new SoSwitch();
593 m_clockwork->emecSubSep [i][p] = new SoSeparator();
594 m_clockwork->emecSubSwitch[i][p]->addChild(m_clockwork->emecSubSep[i][p]);
595 m_clockwork->emecSeparator[i]->addChild(m_clockwork->emecSubSwitch[i][p]);
596 m_clockwork->emecSubSwitch[i][p]->whichChild= SO_SWITCH_ALL;
597 }
598
599 root->addChild(m_clockwork->emecSwitch[i]);
600
601 m_clockwork->hecSwitch[i] = new SoSwitch();
602 m_clockwork->hecHVSwitch[i] = new SoSwitch();
603 m_clockwork->hecHVSeparator[i] = new SoSeparator();
604 m_clockwork->hecHVSwitch[i]->addChild(m_clockwork->hecHVSeparator[i]);
605 m_clockwork->hecHVSeparator[i]->addChild(drawStyle);
606 m_clockwork->hecHVSeparator[i]->addChild(lightModel);
607
608 m_clockwork->hecNormalSep[i] = new SoSeparator();
609 m_clockwork->hecNormalSwitch[i] = new SoSwitch();
610 m_clockwork->hecNormalSwitch[i]->addChild(m_clockwork->hecNormalSep[i]);
611 m_clockwork->hecHVSeparator[i]->addChild(m_clockwork->hecNormalSwitch[i]);
612
613 m_clockwork->hecMissingSep[i] = new SoSeparator();
614 m_clockwork->hecMissingSwitch[i] = new SoSwitch();
615 m_clockwork->hecMissingSwitch[i]->addChild(m_clockwork->hecMissingSep[i]);
616 m_clockwork->hecHVSeparator[i]->addChild(m_clockwork->hecMissingSwitch[i]);
617
618 m_clockwork->hecBadSep[i] = new SoSeparator();
619 m_clockwork->hecBadSwitch[i] = new SoSwitch();
620 m_clockwork->hecBadSwitch[i]->addChild(m_clockwork->hecBadSep[i]);
621 m_clockwork->hecHVSeparator[i]->addChild(m_clockwork->hecBadSwitch[i]);
622
623 m_clockwork->hecSeparator[i] = new SoSeparator();
624 m_clockwork->hecSwitch[i]->addChild(m_clockwork->hecSeparator[i]);
625 m_clockwork->hecSeparator[i]->addChild(m_clockwork->hecMaterial);
626
627 for (int p=0;p<NPHISECTORS;p++) {
628 m_clockwork->hecSubSwitch[i][p] = new SoSwitch();
629 m_clockwork->hecSubSep [i][p] = new SoSeparator();
630 m_clockwork->hecSubSwitch[i][p]->addChild(m_clockwork->hecSubSep[i][p]);
631 m_clockwork->hecSeparator[i]->addChild(m_clockwork->hecSubSwitch[i][p]);
632 m_clockwork->hecSubSwitch[i][p]->whichChild= SO_SWITCH_ALL;
633
634 }
635
636 root->addChild(m_clockwork->hecSwitch[i]);
637 root->addChild(m_clockwork->hecHVSwitch[i]);
638 }
639
640 m_clockwork->emecFocalSwitch = new SoSwitch();
641 m_clockwork->emecFocalSwitch->addChild(m_clockwork->emecMaterial);
642 root->addChild(m_clockwork->emecFocalSwitch);
643
644 m_clockwork->hecFocalSwitch = new SoSwitch();
645 m_clockwork->hecFocalSwitch->addChild(m_clockwork->hecMaterial);
646 root->addChild(m_clockwork->hecFocalSwitch);
647
648 m_clockwork->embAccViewSwitch = new SoSwitch();
649 m_clockwork->embAccViewSwitch->addChild(m_clockwork->embAccMaterial);
650 root->addChild(m_clockwork->embAccViewSwitch);
651
652 for (int p=0;p<NPHISECTORS;p++) {
653 m_clockwork->accordionSubSwitch[p] = new SoSwitch();
654 m_clockwork->accordionSubSep [p] = new SoSeparator();
655 m_clockwork->accordionSubSwitch[p]->addChild(m_clockwork->accordionSubSep[p]);
656 m_clockwork->embAccViewSwitch->addChild(m_clockwork->accordionSubSwitch[p]);
657 m_clockwork->accordionSubSwitch[p]->whichChild= SO_SWITCH_ALL;
658 }
659
660
661 m_clockwork->switchMap["embS0CheckBox"] = m_clockwork->embSwitch[0];
662 m_clockwork->switchMap["embS1CheckBox"] = m_clockwork->embSwitch[1];
663 m_clockwork->switchMap["embS2CheckBox"] = m_clockwork->embSwitch[2];
664 m_clockwork->switchMap["embS3CheckBox"] = m_clockwork->embSwitch[3];
665
666 m_clockwork->switchMap["emecS0CheckBox"] = m_clockwork->emecSwitch[0];
667 m_clockwork->switchMap["emecS1CheckBox"] = m_clockwork->emecSwitch[1];
668 m_clockwork->switchMap["emecS2CheckBox"] = m_clockwork->emecSwitch[2];
669 m_clockwork->switchMap["emecS3CheckBox"] = m_clockwork->emecSwitch[3];
670
671 m_clockwork->switchMap["hecS0CheckBox"] = m_clockwork->hecSwitch[0];
672 m_clockwork->switchMap["hecS1CheckBox"] = m_clockwork->hecSwitch[1];
673 m_clockwork->switchMap["hecS2CheckBox"] = m_clockwork->hecSwitch[2];
674 m_clockwork->switchMap["hecS3CheckBox"] = m_clockwork->hecSwitch[3];
675
676 m_clockwork->switchMap["fcalS0CheckBox"] = m_clockwork->fcalSwitch[0];
677 m_clockwork->switchMap["fcalS1CheckBox"] = m_clockwork->fcalSwitch[1];
678 m_clockwork->switchMap["fcalS2CheckBox"] = m_clockwork->fcalSwitch[2];
679
680 m_clockwork->switchMap["fcalS0CheckBoxHV"] = m_clockwork->fcalHVSwitch[0];
681 m_clockwork->switchMap["fcalS1CheckBoxHV"] = m_clockwork->fcalHVSwitch[1];
682 m_clockwork->switchMap["fcalS2CheckBoxHV"] = m_clockwork->fcalHVSwitch[2];
683
684 m_clockwork->switchMap["hecS0CheckBoxHV"] = m_clockwork->hecHVSwitch[0];
685 m_clockwork->switchMap["hecS1CheckBoxHV"] = m_clockwork->hecHVSwitch[1];
686 m_clockwork->switchMap["hecS2CheckBoxHV"] = m_clockwork->hecHVSwitch[2];
687 m_clockwork->switchMap["hecS3CheckBoxHV"] = m_clockwork->hecHVSwitch[3];
688
689 m_clockwork->switchMap["emecCheckBoxHV"] = m_clockwork->emecHVSwitch;
690 m_clockwork->switchMap["embCheckBoxHV"] = m_clockwork->embHVSwitch;
691 m_clockwork->switchMap["emecCheckBoxMods"] = m_clockwork->emecModsSwitch;
692 m_clockwork->switchMap["embCheckBoxMods"] = m_clockwork->embModsSwitch;
693
694 m_clockwork->switchMap["embPresamplerCheckBoxHV"] = m_clockwork->embPreHVSwitch;
695 m_clockwork->switchMap["embPresamplerCheckBoxMods"] = m_clockwork->embPreModsSwitch;
696 m_clockwork->switchMap["emecPresamplerCheckBoxHV"] = m_clockwork->emecPreHVSwitch;
697 m_clockwork->switchMap["emecPresamplerCheckBoxMods"] = m_clockwork->emecPreModsSwitch;
698
699 m_clockwork->switchMap["emecFocalCheckBox"] = m_clockwork->emecFocalSwitch;
700 m_clockwork->switchMap["hecFocalCheckBox"] = m_clockwork->hecFocalSwitch;
701 m_clockwork->switchMap["embAccordionCheckBox"] = m_clockwork->embAccViewSwitch;
702
703 createEtaPhi();
704
705 //Finally, make sure we start in a correct state:
706 m_clockwork->currentlyEnabledPhiSectors = QVector<bool>(NPHISECTORS,true);//we need this line for some reason...
707 QMapIterator<QString,QCheckBox*> it(m_clockwork->checkBoxMap);
708 while (it.hasNext()) {
709 it.next();
710 if (it.value()->isChecked())
711 checkboxChanged(it.value());
712 }
713 enabledPhiSectorsChanged();//To init properly
714}
715
717
718 if (m_clockwork->hvInit) return;
719 m_clockwork->hvInit=true;
720
721
722 SoMaterial *red = new SoMaterial();
723 red->diffuseColor.setValue(1,.3,.3);
724 red->ref();
725
726 SoMaterial *white = new SoMaterial();
727 white->diffuseColor.setValue(1,1,1);
728 white->ref();
729
730 SoMaterial *blue = new SoMaterial();
731 blue->diffuseColor.setValue(0,0,1);
732 blue->ref();
733
734 for (int i=0;i<3;i++) {
735 m_clockwork->fcalNormalSep[i]->addChild(blue);
736 m_clockwork->fcalBadSep[i]->addChild(red);
737 m_clockwork->fcalMissingSep[i]->addChild(white);
738 }
739
740 for (int i=0;i<4;i++) {
741 m_clockwork->hecNormalSep[i]->addChild(blue);
742 m_clockwork->hecBadSep[i]->addChild(red);
743 m_clockwork->hecMissingSep[i]->addChild(white);
744
745 }
746 m_clockwork->emecNormalSep->addChild(blue);
747 m_clockwork->emecBadSep->addChild(red);
748 m_clockwork->emecMissingSep->addChild(white);
749 m_clockwork->emecModsSeparator->addChild(white);
750
751 m_clockwork->embNormalSep->addChild(blue);
752 m_clockwork->embBadSep->addChild(red);
753 m_clockwork->embMissingSep->addChild(white);
754 m_clockwork->embModsSeparator->addChild(white);
755
756 m_clockwork->embPreNormalSep->addChild(blue);
757 m_clockwork->embPreBadSep->addChild(red);
758 m_clockwork->embPreMissingSep->addChild(white);
759 m_clockwork->embPreModsSeparator->addChild(white);
760
761 m_clockwork->emecPreNormalSep->addChild(blue);
762 m_clockwork->emecPreBadSep->addChild(red);
763 m_clockwork->emecPreMissingSep->addChild(white);
764 m_clockwork->emecPreModsSeparator->addChild(white);
765
766 red->unref();
767 white->unref();
768 blue->unref();
769
770
771 const LArHVManager *larHVManager=NULL;
772 if (!VP1SGAccessHelper(this,true).retrieve(larHVManager,"LArHVManager")) {
773 message("No Access To HV Information. The LArHVManager is NULL");
774 return;
775 }
776
777 SG::ReadCondHandleKey<LArHVIdMapping> hvCablingKey ("LArHVIdMap");
778 if (hvCablingKey.initialize().isFailure()) {
779 message("No Access To HV Information. Cannot retrieve LArHVIdMap.");
780 return;
781 }
782 if (hvCablingKey.storeHandle()->proxy (ClassID_traits<CondCont<LArHVIdMapping> >::ID(),
783 hvCablingKey.key()) == nullptr)
784 {
785 message("No Access To HV Information. Cannot retrieve LArHVIdMap.");
786 return;
787 }
788 SG::ReadCondHandle<LArHVIdMapping> hvCabling (hvCablingKey);
789
790 std::vector<const CondAttrListCollection*> attrLists;
791 {
792 // Not a typo --- this folder has a lower-case l in the database...
793 SG::ReadCondHandleKey<CondAttrListCollection> i16Key ("/LAR/DCS/HV/BARREl/I16");
794 SG::ReadCondHandleKey<CondAttrListCollection> i8Key ("/LAR/DCS/HV/BARREL/I8");
795 if (i16Key.initialize().isFailure()) {
796 message("No Access To HV Information. Cannot retrieve I16.");
797 return;
798 }
799 if (i8Key.initialize().isFailure()) {
800 message("No Access To HV Information. Cannot retrieve I8.");
801 return;
802 }
804 i16Key.key()) == nullptr ||
806 i8Key.key()) == nullptr)
807 {
808 message("No Access To HV Information. Cannot retrieve LArHVIdMap.");
809 return;
810 }
813 attrLists.push_back (*i16);
814 attrLists.push_back (*i8);
815 }
816
817 int tolerance =m_clockwork->ui.hvToleranceSpinBox->value();
818
819 const EMBHVManager& embHVManager = larHVManager->getEMBHVManager();
820 const EMBHVManager::EMBHVData hvdata_EMB = embHVManager.getData(**hvCabling,
821 attrLists);
822 for (unsigned int e=embHVManager.beginSideIndex();e!=embHVManager.endSideIndex();e++) {
823 for (unsigned int s=embHVManager.beginSectorIndex();s!=embHVManager.endSectorIndex();s++) {
824 for (unsigned int y=embHVManager.beginEtaIndex();y!=embHVManager.endEtaIndex();y++) {
825 for (unsigned int p=embHVManager.beginPhiIndex();p!=embHVManager.endPhiIndex();p++) {
826 const EMBHVModule& embMod=embHVManager.getHVModule(e,y,p,s);
827
828 double r=1970; // Radius to draw stuff at for barrel HV.
829
830
831
832 {
833 int cc=0;
834 double etaMin=embMod.getEtaMin();
835 double etaMax=embMod.getEtaMax();
836 double phiMin=embMod.getPhiMin();
837 double phiMax=embMod.getPhiMax();
838 SoVertexProperty *vtxProperty = new SoVertexProperty();
839 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
840 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMin)));
841 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMax)));
842 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMax)));
843 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
844
845 SoLineSet *ls = new SoLineSet();
846 ls->numVertices=5;
847 ls->vertexProperty=vtxProperty;
848 m_clockwork->embModsSeparator->addChild(ls);
849 }
850
851
852 for (unsigned int i=0;i<embMod.getNumElectrodes();i++) {
853 const EMBHVElectrode& electrode = embMod.getElectrode(i);
854
855 double voltage0 = hvdata_EMB.voltage (electrode, 0);
856 double voltage1 = hvdata_EMB.voltage (electrode, 1);
857 double nominalVoltage = m_clockwork->ui.embNominalSpinBox->value();
858 bool outOfTolerance = (fabs(voltage0-nominalVoltage) > double (tolerance)) || (fabs(voltage1-nominalVoltage) > double (tolerance)) ;
859 bool missing = voltage0 == -99999 || voltage1 == -99999;
860 {
861 int cc=0;
862 SoVertexProperty *vtxProperty = new SoVertexProperty();
863 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(electrode.getPhi()),r*sin(electrode.getPhi()) ,r*sinh(electrode.getModule().getEtaMin())));
864 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(electrode.getPhi()),r*sin(electrode.getPhi()) ,r*sinh(electrode.getModule().getEtaMax())));
865
866 SoLineSet *ls = new SoLineSet();
867 ls->numVertices=2;
868 ls->vertexProperty=vtxProperty;
869
870 if (missing) {
871 m_clockwork->embMissingSep->addChild(ls);
872 }
873 else if (outOfTolerance) {
874 m_clockwork->embBadSep->addChild(ls);
875 }
876 else {
877 m_clockwork->embNormalSep->addChild(ls);
878 }
879 m_clockwork->EMBHVMap[ls]=&electrode;
880 }
881 }
882 }
883 }
884 }
885 }
886
887 const EMBPresamplerHVManager& embPreHVManager = larHVManager->getEMBPresamplerHVManager();
888 const EMBPresamplerHVManager::EMBPresamplerHVData hvdata_EMBPS = embPreHVManager.getData(**hvCabling,
889 attrLists);
890 for (unsigned int e=embPreHVManager.beginSideIndex();e!=embPreHVManager.endSideIndex();e++) {
891 for (unsigned int y=embPreHVManager.beginEtaIndex();y!=embPreHVManager.endEtaIndex();y++) {
892 for (unsigned int p=embPreHVManager.beginPhiIndex();p!=embPreHVManager.endPhiIndex();p++) {
893 const EMBPresamplerHVModule& embMod=embPreHVManager.getHVModule(e,y,p);
894
895 double r=1900; // Radius to draw stuff at for barrel Presampler HV.
896
897 {
898 int cc=0;
899 double etaMin=embMod.getEtaMin();
900 double etaMax=embMod.getEtaMax();
901 double phiMin=embMod.getPhiMin();
902 double phiMax=embMod.getPhiMax();
903 SoVertexProperty *vtxProperty = new SoVertexProperty();
904 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
905 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMin)));
906 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMax)));
907 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMax)));
908 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
909
910 SoLineSet *ls = new SoLineSet();
911 ls->numVertices=5;
912 ls->vertexProperty=vtxProperty;
913 m_clockwork->embPreModsSeparator->addChild(ls);
914
915 double voltage0 = hvdata_EMBPS.voltage (embMod, 0);
916 double voltage1 = hvdata_EMBPS.voltage (embMod, 1);
917 double nominalVoltage = m_clockwork->ui.embPresamplerNominalSpinBox->value();
918 bool outOfTolerance = (fabs(voltage0-nominalVoltage) > double (tolerance)) || (fabs(voltage1-nominalVoltage) > double (tolerance)) ;
919 bool missing = voltage0 == -99999 || voltage1 == -99999;
920
921
922 if (missing) {
923 m_clockwork->embPreMissingSep->addChild(ls);
924 }
925 else if (outOfTolerance) {
926 m_clockwork->embPreBadSep->addChild(ls);
927 }
928 else {
929 m_clockwork->embPreNormalSep->addChild(ls);
930 }
931 m_clockwork->embPreModsSeparator->addChild(ls);
932 //m_clockwork->EMBPresamplerHVMap[ls]=embMod;
933 }
934 }
935 }
936 }
937
938 QSpinBox *emecSpinBoxOuter[]= {m_clockwork->ui.emecNominalSpinBox_1,
939 m_clockwork->ui.emecNominalSpinBox_2,
940 m_clockwork->ui.emecNominalSpinBox_3,
941 m_clockwork->ui.emecNominalSpinBox_4,
942 m_clockwork->ui.emecNominalSpinBox_5,
943 m_clockwork->ui.emecNominalSpinBox_6,
944 m_clockwork->ui.emecNominalSpinBox_7};
945 QSpinBox *emecSpinBoxInner[]= {m_clockwork->ui.emecNominalSpinBox_8,
946 m_clockwork->ui.emecNominalSpinBox_9};
947
948
949 for (int t=0;t<2;t++) {
950
952 QSpinBox **spinBoxes = iotype==EMECHVModule::OUTER ? emecSpinBoxOuter : emecSpinBoxInner;
953
954 const EMECHVManager& emecHVManager = larHVManager->getEMECHVManager(iotype);
955 const EMECHVManager::EMECHVData hvdata_EMEC = emecHVManager.getData(**hvCabling,
956 attrLists);
957 for (unsigned int e=emecHVManager.beginSideIndex();e!=emecHVManager.endSideIndex();e++) {
958 double z = e==0 ? -3740:3740;
959 for (unsigned int s=emecHVManager.beginSectorIndex();s!=emecHVManager.endSectorIndex();s++) {
960 for (unsigned int y=emecHVManager.beginEtaIndex();y!=emecHVManager.endEtaIndex();y++) {
961 for (unsigned int p=emecHVManager.beginPhiIndex();p!=emecHVManager.endPhiIndex();p++) {
962 const EMECHVModule& emecMod=emecHVManager.getHVModule(e,y,p,s);
963
964 double phiMin = emecMod.getPhiMin();
965 double phiMax = emecMod.getPhiMax();
966 double etaMin = emecMod.getEtaMin();
967 double etaMax = emecMod.getEtaMax();
968 double rMax=fabs(z/sinh(etaMin));
969 double rMin=fabs(z/sinh(etaMax));
970
971
972 int cc=0;
973 SoVertexProperty *vtxProperty = new SoVertexProperty();
974 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
975 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
976 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
977 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
978 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
979
980
981 SoLineSet *ls = new SoLineSet();
982 ls->numVertices=5;
983 ls->vertexProperty=vtxProperty;
984 m_clockwork->emecModsSeparator->addChild(ls);
985
986 for (unsigned int i=0;i<emecMod.getNumElectrodes();i++) {
987 const EMECHVElectrode& electrode = emecMod.getElectrode(i);
988 double voltage0 = hvdata_EMEC.voltage (electrode, 0);
989 double voltage1 = hvdata_EMEC.voltage (electrode, 1);
990 double nominalVoltage = spinBoxes[y]->value();
991 bool outOfTolerance = (fabs(voltage0-nominalVoltage) > double (tolerance)) || (fabs(voltage1-nominalVoltage) > double (tolerance)) ;
992 bool missing = voltage0 == -99999 || voltage1 == -99999;
993 double etaMax=electrode.getModule().getEtaMax();
994 double etaMin=electrode.getModule().getEtaMin();
995 double rMin=fabs(z/sinh(etaMin));
996 double rMax=fabs(z/sinh(etaMax));
997
998 {
999 int cc=0;
1000 SoVertexProperty *vtxProperty = new SoVertexProperty();
1001 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(electrode.getPhi()),rMin*sin(electrode.getPhi()) ,z));
1002 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(electrode.getPhi()),rMax*sin(electrode.getPhi()) ,z));
1003
1004 SoLineSet *ls = new SoLineSet();
1005 ls->numVertices=2;
1006 ls->vertexProperty=vtxProperty;
1007
1008 if (missing) {
1009 m_clockwork->emecMissingSep->addChild(ls);
1010 }
1011 else if (outOfTolerance) {
1012 m_clockwork->emecBadSep->addChild(ls);
1013 }
1014 else {
1015 m_clockwork->emecNormalSep->addChild(ls);
1016 }
1017 m_clockwork->EMECHVMap[ls]=&electrode;
1018 }
1019 }
1020 }
1021 }
1022 }
1023 }
1024 }
1025
1026 const EMECPresamplerHVManager& emecPreHVManager = larHVManager->getEMECPresamplerHVManager();
1027 const EMECPresamplerHVManager::EMECPresamplerHVData hvdata_EMECPS = emecPreHVManager.getData(**hvCabling,
1028 attrLists);
1029 for (unsigned int e=emecPreHVManager.beginSideIndex();e!=emecPreHVManager.endSideIndex();e++) {
1030 double z = e==0 ? -3650:3650;
1031 for (unsigned int p=emecPreHVManager.beginPhiIndex();p!=emecPreHVManager.endPhiIndex();p++) {
1032 const EMECPresamplerHVModule& emecMod=emecPreHVManager.getHVModule(e,p);
1033
1034 double phiMin = emecMod.getPhiMin();
1035 double phiMax = emecMod.getPhiMax();
1036 double etaMin = emecMod.getEtaMin();
1037 double etaMax = emecMod.getEtaMax();
1038 double rMax=fabs(z/sinh(etaMin));
1039 double rMin=fabs(z/sinh(etaMax));
1040
1041
1042 int cc=0;
1043 SoVertexProperty *vtxProperty = new SoVertexProperty();
1044 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1045 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
1046 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
1047 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
1048 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1049
1050
1051 SoLineSet *ls = new SoLineSet();
1052 ls->numVertices=5;
1053 ls->vertexProperty=vtxProperty;
1054 m_clockwork->emecPreModsSeparator->addChild(ls);
1055
1056 double voltage0 = hvdata_EMECPS.voltage (emecMod, 0);
1057 double voltage1 = hvdata_EMECPS.voltage (emecMod, 1);
1058 double nominalVoltage = m_clockwork->ui.emecPresamplerNominalSpinBox->value();
1059 bool outOfTolerance = (fabs(voltage0-nominalVoltage) > double (tolerance)) || (fabs(voltage1-nominalVoltage) > double (tolerance)) ;
1060 bool missing = voltage0 == -99999 || voltage1 == -99999;
1061
1062 if (missing) {
1063 m_clockwork->emecPreMissingSep->addChild(ls);
1064 }
1065 else if (outOfTolerance) {
1066 m_clockwork->emecPreBadSep->addChild(ls);
1067 }
1068 else {
1069 m_clockwork->emecPreNormalSep->addChild(ls);
1070 }
1071 m_clockwork->emecPreModsSeparator->addChild(ls);
1072 //m_clockwork->EMECPreHVMap[ls]=module;
1073 }
1074 }
1075
1076
1077 const HECDetectorManager *hecManager = VP1DetInfo::hecDetMgr();
1078 const HECHVManager& hecHVManager = larHVManager->getHECHVManager();
1079 const HECHVManager::HECHVData hvdata_HEC = hecHVManager.getData(**hvCabling,
1080 attrLists);
1081 for (unsigned int e=hecHVManager.beginSideIndex();e!=hecHVManager.endSideIndex();e++) {
1082 for (unsigned int s=hecHVManager.beginSamplingIndex();s!=hecHVManager.endSamplingIndex();s++) {
1083 for (unsigned int p=hecHVManager.beginPhiIndex();p!=hecHVManager.endPhiIndex();p++) {
1084 const HECHVModule& hecMod=hecHVManager.getHVModule(e,p,s);
1085 for (unsigned int i=0;i<hecMod.getNumSubgaps();i++) {
1086 const HECHVSubgap& subgap = hecMod.getSubgap(i);
1087 double voltage = hvdata_HEC.voltage (subgap);
1088 double nominalVoltage = m_clockwork->ui.hecNominalSpinBox->value();
1089 bool outOfTolerance = fabs(voltage-nominalVoltage) > double (tolerance);
1090 bool missing = voltage == -99999;
1091
1092
1093 HECCellConstLink element = hecManager->getDetectorRegion(e,s,0)->getHECCell(0,0); // 5 is relatively arbitrary. middle of HEC
1094
1095 // we comment out to avoid compilation warnings, because they're not used, apparently
1096// HECCell::CELLPOS pos=HECCell::FRONT;
1097// if (m_clockwork->pos==BACK) pos=HECCell::BACK;
1098// if (m_clockwork->pos==CENTER) pos=HECCell::CENTER;
1099
1100 const HECDetectorManager *hecManager = VP1DetInfo::hecDetMgr();
1101 const HECDetectorRegion *region = hecManager->getDetectorRegion(element->getEndcapIndex(),element->getSamplingIndex(),element->getRegionIndex());
1102 const HepGeom::Transform3D &XF= Amg::EigenTransformToCLHEP(region->getAbsoluteTransform());
1103 double z0 = (XF*HepGeom::Point3D<double>(0,0,element->getZLocal(HECCell::FRONT))).z();
1104 double z1 = (XF*HepGeom::Point3D<double>(0,0,element->getZLocal(HECCell::BACK))).z();
1105
1106
1107 double z = z0 + i*(z1-z0)/4;
1108 double phiMin = hecMod.getPhiMin();
1109 double phiMax = hecMod.getPhiMax();
1110 double rMax = 2130;
1111 double rMin = s==0 ? 371 : 474;
1112
1113 int cc=0;
1114 SoVertexProperty *vtxProperty = new SoVertexProperty();
1115 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1116 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
1117 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
1118 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
1119 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1120
1121 SoLineSet *ls = new SoLineSet();
1122 ls->numVertices=5;
1123 ls->vertexProperty=vtxProperty;
1124 if (missing) {
1125 m_clockwork->hecMissingSep[s]->addChild(ls);
1126 }
1127 else if (outOfTolerance) {
1128 m_clockwork->hecBadSep[s]->addChild(ls);
1129 }
1130 else {
1131 m_clockwork->hecNormalSep[s]->addChild(ls);
1132 }
1133 m_clockwork->HECHVMap[ls]=&subgap;
1134
1135 }
1136 }
1137 }
1138 }
1139
1140 const FCALHVManager& fcalHVManager = larHVManager->getFCALHVManager();
1141 const FCALHVManager::FCALHVData hvdata_FCAL = fcalHVManager.getData(**hvCabling,
1142 attrLists);
1143 for (unsigned int e=fcalHVManager.beginSideIndex();e!=fcalHVManager.endSideIndex();e++) {
1144 for (unsigned int s=fcalHVManager.beginSamplingIndex();s!=fcalHVManager.endSamplingIndex();s++) {
1145 for (unsigned int x=fcalHVManager.beginSectorIndex(s);x!=fcalHVManager.endSectorIndex(s);x++) {
1146 const FCALHVModule& fcalMod=fcalHVManager.getHVModule(e,x,s);
1147 for (unsigned int l=0;l<fcalMod.getNumHVLines();l++) {
1148 const FCALHVLine& fcalLine=fcalMod.getHVLine(l);
1149 double voltage = hvdata_FCAL.voltage (fcalLine);
1150
1151 //
1152 // Determine whether this is in bounds, or not..
1153 //
1154
1155 const QSpinBox *fcalSpin[] = {m_clockwork->ui.fcal1NominalSpinBox,m_clockwork->ui.fcal2NominalSpinBox,m_clockwork->ui.fcal3NominalSpinBox};
1156 const QSpinBox *spinBox=fcalSpin[s];
1157 double nominalVoltage = double (spinBox->value());
1158
1159 bool outOfTolerance = fabs(voltage-nominalVoltage) > double(tolerance);
1160 bool missing = voltage == -99999;
1161
1162 //
1163 // Loop over every single tube in the system. If the tube is associated with the HV Line then put a dot where the tube is:
1164 //
1165 const FCALDetectorManager *fcalManager=VP1DetInfo::fcalDetMgr();
1166 if (fcalManager) {
1168 for (e=fcalManager->beginFCAL();e!=fcalManager->endFCAL(); ++e) {
1169
1170 const FCALModule *fcalMod = *e;
1171 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(fcalMod->getAbsoluteTransform());
1172
1173 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1174 SoSeparator *sep = new SoSeparator();
1175 sep->addChild(XF);
1176
1177 SoVertexProperty *vtxProperty = new SoVertexProperty();
1178 int cc=0;
1179
1181 for (t=fcalMod->beginTiles();t!=fcalMod->endTiles();++t) {
1182
1183 double zf = fcalMod->getEndcapIndex()== 0 ? +fcalMod->getFullDepthZ(*t)/2.0 : -fcalMod->getFullDepthZ(*t)/2.0;
1184 // double zc = 0;
1185 // double zb = fcalMod->getEndcapIndex()== 0 ? -fcalMod->getFullDepthZ(*t)/2.0 : +fcalMod->getFullDepthZ(*t)/2.0;
1186
1187 double z=zf;
1188 //if (m_clockwork->pos==CENTER) z=zc;
1189 //if (m_clockwork->pos==BACK) z=zb;
1190
1191 for (unsigned int p=0;p<(*t).getNumTubes();p++) {
1192 FCALTubeConstLink T = (*t).getTube(p);
1193 const FCALHVLine& Line = T->getHVLine();
1194 if (&Line==&fcalLine) {
1195 vtxProperty->vertex.set1Value(cc++, SbVec3f(T->getXLocal(),T->getYLocal(),z));
1196 }
1197 }
1198 }
1199 SoPointSet *ps = new SoPointSet();
1200 ps->numPoints=cc;
1201 ps->vertexProperty=vtxProperty;
1202 sep->addChild(ps);
1203 if (missing) {
1204 m_clockwork->fcalMissingSep[fcalMod->getModuleIndex()-1]->addChild(sep);
1205 }
1206 else if (outOfTolerance) {
1207 m_clockwork->fcalBadSep[fcalMod->getModuleIndex()-1]->addChild(sep);
1208 }
1209 else {
1210 m_clockwork->fcalNormalSep[fcalMod->getModuleIndex()-1]->addChild(sep);
1211 }
1212 m_clockwork->FCALHVMap[ps]=&fcalLine;
1213 }
1214 }
1215 }
1216 }
1217 }
1218 }
1219}
1220
1222 {
1224 const EMBDetectorManager * manager=VP1DetInfo::embDetMgr();
1225 if (manager) {
1226
1228 for (e=manager->beginDetectorRegion();e!=manager->endDetectorRegion(); ++e) {
1229 const EMBDetectorRegion *region = *e;
1230 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(region->getAbsoluteTransform());
1231 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1232 SoSeparator *sep[NPHISECTORS]= {new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1233 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1234 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1235 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator()};
1236
1237 for (int p=0;p<NPHISECTORS;p++) sep[p]->addChild(XF);
1238
1239 for (unsigned int iPhi=region->beginPhiIndex();iPhi<region->endPhiIndex();iPhi++) {
1240 for (unsigned int iEta=region->beginEtaIndex();iEta<region->endEtaIndex();iEta++) {
1241
1242
1244 if (m_clockwork->pos==BACK) pos=EMBCell::BACK;
1245 if (m_clockwork->pos==CENTER) pos=EMBCell::CENTER;
1246
1247
1248 EMBCellConstLink cellPtr = region->getEMBCell(iEta,iPhi);
1249 double zMin = cellPtr->getZMinLocal(pos);
1250 double zMax = cellPtr->getZMaxLocal(pos);
1251 double r = cellPtr->getRLocal(pos);
1252 double phiMin = cellPtr->getPhiLocalLower();
1253 double phiMax = cellPtr->getPhiLocalUpper();
1254
1255 int cc=0;
1256 SoVertexProperty *vtxProperty = new SoVertexProperty();
1257 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,zMin));
1258 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,zMin));
1259 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,zMax));
1260 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,zMax));
1261 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,zMin));
1262
1263 SoLineSet *ls = new SoLineSet();
1264 ls->numVertices=5;
1265 ls->vertexProperty=vtxProperty;
1266 m_clockwork->EMBMap[ls]=cellPtr;
1267 int p = int ((cellPtr->getPhiMaxNominal() + cellPtr->getPhiMinNominal())/2.0 * NPHISECTORS/2.0/M_PI);
1268 if (p < 0) {
1269 messageDebug("P LT 0; repairing that..."+str(p));
1270 p=0;
1271 }
1272 if (p>15) {
1273 messageDebug("P GT 15; repairing that..."+str(p));
1274 p=15;
1275 }
1276 sep[p]->addChild(ls);
1277 }
1278 }
1279 for (int p=0;p<NPHISECTORS;p++) m_clockwork->embSubSep[region->getSamplingIndex()][p]->addChild(sep[p]);
1280 }
1281 }
1282 }
1283 {
1284 const EMBDetectorManager * manager=VP1DetInfo::embDetMgr();
1285 if (manager) {
1286
1287 const EMBAccordionDetails *accordionDetails = manager->getAccordionDetails();
1288 const GeoStraightAccSection *absorberSection = accordionDetails->getAbsorberSections();
1289 SoSeparator *sep[NPHISECTORS]= {new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1290 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1291 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1292 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator()};
1293
1294
1295 for (int i=0;i<1024;i++) {
1296
1297 int cc=0;
1298 SoVertexProperty *vtxProperty = new SoVertexProperty();
1299
1300
1301 for (int j=0; j<14; j++) {
1302 double xcent = absorberSection->XCent(i,j);
1303 double ycent = absorberSection->YCent(i,j);
1304 double cosU = absorberSection->Cosu(i,j);
1305 double sinU = absorberSection->Sinu(i,j);
1306 double halfLength = absorberSection->HalfLength(i,j);
1307 vtxProperty->vertex.set1Value(cc++, SbVec3f(xcent, ycent, 0.0)-SbVec3f(cosU, sinU, 0)*halfLength);
1308 vtxProperty->vertex.set1Value(cc++, SbVec3f(xcent, ycent, 0.0)+SbVec3f(cosU, sinU, 0)*halfLength);
1309 }
1310 SoLineSet *ls = new SoLineSet();
1311 ls->numVertices=cc;
1312 ls->vertexProperty=vtxProperty;
1313 int p = i/64;
1314 sep[p]->addChild(ls);
1315
1316 }
1317 for (int p=0;p<NPHISECTORS;p++) m_clockwork->accordionSubSep[p]->addChild(sep[p]);
1318
1319 }
1320 }
1321
1322
1323 {
1325 if (manager) {
1326
1328 for (e=manager->beginDetectorRegion();e!=manager->endDetectorRegion(); ++e) {
1329 const EMECDetectorRegion *region = *e;
1330 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(region->getAbsoluteTransform());
1331
1332 // First Focal Points:
1333 try {
1334 if (region->getSamplingIndex()==1) {
1335 SoSeparator *fsep = new SoSeparator;
1336 HepGeom::Point3D<double> vFocal = region->getFocalPointPos();
1337 SoTransform *soxf = new SoTransform();
1338 soxf->translation.setValue(vFocal.x(),vFocal.y(),vFocal.z());
1339 SoSphere *sphere = new SoSphere();
1340 sphere->radius=10.0;
1341 fsep->addChild(soxf);
1342 fsep->addChild(sphere);
1343 m_clockwork->emecFocalSwitch->addChild(fsep);
1344 }
1345 }
1346 // This will be the case of the presampler.
1347 catch (const std::runtime_error & e) {
1348 }
1349
1350 // Then grid:
1351
1352
1353 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1354 SoSeparator *sep[NPHISECTORS]= {new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1355 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1356 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1357 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator()};
1358
1359 for (int p=0;p<NPHISECTORS;p++) sep[p]->addChild(XF);
1360 for (unsigned int iPhi=region->beginPhiIndex();iPhi<region->endPhiIndex();iPhi++) {
1361 for (unsigned int iEta=region->beginEtaIndex();iEta<region->endEtaIndex();iEta++) {
1362 EMECCellConstLink cellPtr = region->getEMECCell(iEta,iPhi);
1363
1365 if (m_clockwork->pos==BACK) pos=EMECCell::BACK;
1366 if (m_clockwork->pos==CENTER) pos=EMECCell::CENTER;
1367
1368
1369
1370
1371 double rMin = cellPtr->getRMinLocal(pos);
1372 double rMax = cellPtr->getRMaxLocal(pos);
1373 double z = cellPtr->getZLocal(pos);
1374 double phiMin = cellPtr->getPhiLocalLower();
1375 double phiMax = cellPtr->getPhiLocalUpper();
1376
1377 int cc=0;
1378 SoVertexProperty *vtxProperty = new SoVertexProperty();
1379 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1380 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
1381 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
1382 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
1383 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1384
1385 SoLineSet *ls = new SoLineSet();
1386 ls->numVertices=5;
1387 ls->vertexProperty=vtxProperty;
1388 m_clockwork->EMECMap[ls]=cellPtr;
1389 int p = int ((cellPtr->getPhiMaxNominal() + cellPtr->getPhiMinNominal())/2.0 * NPHISECTORS/2.0/M_PI);
1390 if (p < 0) {
1391 messageDebug("P LT 0; repairing that..."+str(p));
1392 p=0;
1393 }
1394 if (p>15) {
1395 messageDebug("P GT 15; repairing that..."+str(p));
1396 p=15;
1397 }
1398 sep[p]->addChild(ls);
1399 }
1400 }
1401 for (int p=0;p<NPHISECTORS;p++) m_clockwork->emecSubSep[region->getSamplingIndex()][p]->addChild(sep[p]);
1402 }
1403 }
1404 }
1405 {
1406 const HECDetectorManager * manager=VP1DetInfo::hecDetMgr();
1407 if (manager) {
1408
1410 for (e=manager->beginDetectorRegion();e!=manager->endDetectorRegion(); ++e) {
1411
1412
1413 const HECDetectorRegion *region = *e;
1414 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(region->getAbsoluteTransform());
1415
1416 // First Focal Points:
1417 if (region->getSamplingIndex()==1) {
1418 SoSeparator *fsep = new SoSeparator;
1419 HepGeom::Point3D<double> vFocal = region->getFocalPointPos();
1420 SoTransform *soxf = new SoTransform();
1421 soxf->translation.setValue(vFocal.x(),vFocal.y(),vFocal.z());
1422 SoSphere *sphere = new SoSphere();
1423 sphere->radius=10.0;
1424 fsep->addChild(soxf);
1425 fsep->addChild(sphere);
1426 m_clockwork->hecFocalSwitch->addChild(fsep);
1427 }
1428
1429 // Then grid:
1430
1431
1432 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1433 SoSeparator *sep[NPHISECTORS]= {new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1434 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1435 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator(),
1436 new SoSeparator(), new SoSeparator(), new SoSeparator(), new SoSeparator()};
1437
1438 for (int p=0;p<NPHISECTORS;p++) sep[p]->addChild(XF);
1439
1440 for (unsigned int iPhi=region->beginPhiIndex();iPhi<region->endPhiIndex();iPhi++) {
1441 for (unsigned int iEta=region->beginEtaIndex();iEta<region->endEtaIndex();iEta++) {
1442 HECCellConstLink cellPtr = region->getHECCell(iEta,iPhi);
1443 if (cellPtr) {
1444
1445
1446 // double rMin = cellPtr->getRMin(0);
1447 // double rMax = cellPtr->getRMax(0);
1448
1450 if (m_clockwork->pos==BACK) pos=HECCell::BACK;
1451 if (m_clockwork->pos==CENTER) pos=HECCell::CENTER;
1452
1453
1454 double z = cellPtr->getZLocal(pos);
1455 double rMin = cellPtr->getRMinLocalNominal(pos);
1456 double rMax = cellPtr->getRMaxLocalNominal(pos);
1457
1458
1459 double phiMin = cellPtr->getPhiLocalUpper();
1460 double phiMax = cellPtr->getPhiLocalLower();
1461
1462 int cc=0;
1463 SoVertexProperty *vtxProperty = new SoVertexProperty();
1464 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1465 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
1466 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
1467 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
1468 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
1469
1470 SoLineSet *ls = new SoLineSet();
1471 ls->numVertices=5;
1472 ls->vertexProperty=vtxProperty;
1473
1474 m_clockwork->HECMap[ls]=cellPtr;
1475 int p = int ((cellPtr->getPhiMaxNominal() + cellPtr->getPhiMinNominal())/2.0 * NPHISECTORS/2.0/M_PI);
1476 if (p < 0) {
1477 messageDebug("P LT 0; repairing that..."+str(p));
1478 p=0;
1479 }
1480 if (p>15) {
1481 messageDebug("P GT 15; repairing that..."+str(p));
1482 p=15;
1483 }
1484 sep[p]->addChild(ls);
1485 }
1486 }
1487 }
1488 for (int p=0;p<NPHISECTORS;p++) m_clockwork->hecSubSep[region->getSamplingIndex()][p]->addChild(sep[p]);
1489 }
1490 }
1491 }
1492
1493 {
1495 if (manager) {
1497 for (e=manager->beginFCAL();e!=manager->endFCAL(); ++e) {
1498
1499 const FCALModule *fcalMod = *e;
1500 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(fcalMod->getAbsoluteTransform());
1501
1502 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1503
1504
1505
1506 SoSeparator *sep = new SoSeparator();
1507 sep->addChild(XF);
1509 for (t=fcalMod->beginTiles();t!=fcalMod->endTiles();++t) {
1510 double x = t->getX();
1511 double y = t->getY();
1512 double dx = fcalMod->getFullWidthX(*t)/2.0;
1513 double dy = fcalMod->getFullWidthY(*t)/2.0;
1514 double zf = fcalMod->getEndcapIndex()== 0 ? +fcalMod->getFullDepthZ(*t)/2.0 : -fcalMod->getFullDepthZ(*t)/2.0;
1515 double zc = 0;
1516 double zb = fcalMod->getEndcapIndex()== 0 ? -fcalMod->getFullDepthZ(*t)/2.0 : +fcalMod->getFullDepthZ(*t)/2.0;
1517
1518 double z=zf;
1519 if (m_clockwork->pos==CENTER) z=zc;
1520 if (m_clockwork->pos==BACK) z=zb;
1521
1522 int cc=0;
1523 SoVertexProperty *vtxProperty = new SoVertexProperty();
1524 vtxProperty->vertex.set1Value(cc++, SbVec3f(x-dx+3,y-dy+3 ,z));
1525 vtxProperty->vertex.set1Value(cc++, SbVec3f(x+dx-3,y-dy+3, z));
1526 vtxProperty->vertex.set1Value(cc++, SbVec3f(x+dx-3,y+dy-3 ,z));
1527 vtxProperty->vertex.set1Value(cc++, SbVec3f(x-dx+3,y+dy-3 ,z));
1528 vtxProperty->vertex.set1Value(cc++, SbVec3f(x-dx+3,y-dy+3 ,z));
1529
1530 SoLineSet *ls = new SoLineSet();
1531 ls->numVertices=5;
1532 ls->vertexProperty=vtxProperty;
1533 sep->addChild(ls);
1534
1535 m_clockwork->TileMap[ls]=&(*t);
1536 }
1537 int sp = fcalMod->getModuleIndex()-1;
1538 m_clockwork->fcalSubSep[sp]->addChild(sep);
1539
1540 }
1541 }
1542 }
1543
1544}
1545
1547{
1548
1549
1550}
1551
1553
1554 if (!m_clockwork->permInit) return; // do not change switches
1555 // if the switches are not yet built!!
1556
1557
1558 m_clockwork->pickStyle->style = flag ? SoPickStyleElement::SHAPE : SoPickStyleElement::UNPICKABLE;
1559 m_clockwork->ui.etaBoundariesCheckBox->setEnabled(flag);
1560 m_clockwork->ui.phiBoundariesCheckBox->setEnabled(flag);
1561 m_clockwork->ui.fcalTubesCheckBox->setEnabled(flag);
1562 m_clockwork->ui.highVoltageCheckBox->setEnabled(flag);
1563 m_clockwork->ui.indicesCheckBox->setEnabled(flag);
1564}
1565
1567 if (!m_clockwork->permInit) return; // do not change switches
1568 // if the switches are not yet built!!
1569
1570
1572
1573 if (m_clockwork->ui.frontRadioButton->isChecked()) pos=FRONT;
1574 if (m_clockwork->ui.backRadioButton->isChecked()) pos=BACK;
1575 if (m_clockwork->ui.centerRadioButton->isChecked()) pos=CENTER;
1576
1577
1578 if (pos!=m_clockwork->pos) {
1579
1580
1581 m_clockwork->pos=pos;
1582 for (int i=0;i<4;i++) {
1583 if (i<3) m_clockwork->fcalSubSep[i]->removeAllChildren();
1584 for (int p=0;p<NPHISECTORS;p++) {
1585 m_clockwork->embSubSep[i][p]->removeAllChildren();
1586 m_clockwork->emecSubSep[i][p]->removeAllChildren();
1587 m_clockwork->hecSubSep[i][p]->removeAllChildren();
1588 }
1589 }
1590 m_clockwork->emecFocalSwitch->removeAllChildren();
1591 m_clockwork->hecFocalSwitch->removeAllChildren();
1592
1593 for (int p=0;p<NPHISECTORS;p++) m_clockwork->accordionSubSep[p]->removeAllChildren();
1594
1595 m_clockwork->TileMap.erase(m_clockwork->TileMap.begin(),m_clockwork->TileMap.end());
1596 m_clockwork->HECMap.erase(m_clockwork->HECMap.begin(),m_clockwork->HECMap.end());
1597 m_clockwork->EMECMap.erase(m_clockwork->EMECMap.begin(),m_clockwork->EMECMap.end());
1598 m_clockwork->EMBMap.erase(m_clockwork->EMBMap.begin(),m_clockwork->EMBMap.end());
1599 m_clockwork->EMBHVMap.erase(m_clockwork->EMBHVMap.begin(),m_clockwork->EMBHVMap.end());
1600 m_clockwork->EMECHVMap.erase(m_clockwork->EMECHVMap.begin(),m_clockwork->EMECHVMap.end());
1601 m_clockwork->HECHVMap.erase(m_clockwork->HECHVMap.begin(),m_clockwork->HECHVMap.end());
1602 m_clockwork->FCALHVMap.erase(m_clockwork->FCALHVMap.begin(),m_clockwork->FCALHVMap.end());
1603
1604 m_clockwork->volatileSeparator->removeAllChildren();
1605
1606 createEtaPhi();
1607 }
1608
1609}
1610
1612 if (m_clockwork->currentlyEnabledPhiSectors.isEmpty())
1613 return;
1614 for (int i=0;i<4;i++) m_clockwork->embSubSwitch[i][p]->whichChild=SO_SWITCH_ALL;
1615 for (int i=0;i<4;i++) m_clockwork->emecSubSwitch[i][p]->whichChild=SO_SWITCH_ALL;
1616 for (int i=0;i<4;i++) m_clockwork->hecSubSwitch[i][p]->whichChild=SO_SWITCH_ALL;
1617 m_clockwork->accordionSubSwitch[p]->whichChild=SO_SWITCH_ALL;
1618}
1619
1621 if (m_clockwork->currentlyEnabledPhiSectors.isEmpty())
1622 return;
1623 for (int i=0;i<4;i++) m_clockwork->embSubSwitch[i][p]->whichChild=SO_SWITCH_NONE;
1624 for (int i=0;i<4;i++) m_clockwork->emecSubSwitch[i][p]->whichChild=SO_SWITCH_NONE;
1625 for (int i=0;i<4;i++) m_clockwork->hecSubSwitch[i][p]->whichChild=SO_SWITCH_NONE;
1626 m_clockwork->accordionSubSwitch[p]->whichChild=SO_SWITCH_NONE;
1627}
1628
1630{
1631 checkboxChanged(dynamic_cast<QCheckBox*>(sender()));
1632}
1633
1635{
1636 if (!m_clockwork->permInit) return; // do not change switches
1637 // if the switches are not yet built!!
1638
1639
1640 if(cb && m_clockwork->checkBoxNamesMap.contains(cb))
1641 {
1642 // Get technology name
1643 QString swName = m_clockwork->checkBoxNamesMap[cb];
1644
1645
1646 // See if HV needs to be updated:
1647 if (swName=="embCheckBoxHV" ||
1648 swName=="embCheckBoxMods" ||
1649 swName=="emecCheckBoxMods" ||
1650 swName=="emecCheckboxHV" ||
1651 swName=="embPresamplerCheckBoxHV" ||
1652 swName=="embPresamplerCheckBoxMods" ||
1653 swName=="emecPresamplerCheckBoxMods" ||
1654 swName=="emecPresamplerCheckboxHV" ||
1655 swName=="hecS0CheckBoxHV" ||
1656 swName=="hecS1CheckBoxHV" ||
1657 swName=="hecS2CheckBoxHV" ||
1658 swName=="hecS3CheckBoxHV" ||
1659 swName=="fcalS0CheckBoxHV" ||
1660 swName=="fcalS1CheckBoxHV" ||
1661 swName=="fcalS2CheckBoxHV" )
1662 {
1663 if (cb->isChecked()) createHV();
1664 }
1665
1666
1667
1668
1669 if(m_clockwork->switchMap.contains(swName))
1670 {
1671 // Get swtich
1672 SoSwitch* sw = m_clockwork->switchMap[swName];
1673 if(cb->isChecked())
1674 {
1675 sw->whichChild = SO_SWITCH_ALL;
1676 }
1677 else
1678 sw->whichChild = SO_SWITCH_NONE;
1679 }
1680 else if (swName=="badHVDisplayCheckBox")
1681 {
1682 for (int i=0;i<3;i++) m_clockwork->fcalBadSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1683 for (int i=0;i<4;i++) m_clockwork->hecBadSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1684 m_clockwork->emecBadSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1685 m_clockwork->embBadSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1686 m_clockwork->embPreBadSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1687 m_clockwork->emecPreBadSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1688 }
1689 else if (swName=="missingHVDisplayCheckBox")
1690 {
1691 for (int i=0;i<3;i++) m_clockwork->fcalMissingSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1692 for (int i=0;i<4;i++) m_clockwork->hecMissingSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1693 m_clockwork->emecMissingSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1694 m_clockwork->embMissingSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1695 m_clockwork->embPreMissingSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1696 m_clockwork->emecPreMissingSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1697 }
1698 else if (swName=="normalHVDisplayCheckBox")
1699 {
1700 for (int i=0;i<3;i++) m_clockwork->fcalNormalSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1701 for (int i=0;i<4;i++) m_clockwork->hecNormalSwitch[i]->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1702 m_clockwork->emecNormalSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1703 m_clockwork->embNormalSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1704 m_clockwork->embPreNormalSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1705 m_clockwork->emecPreNormalSwitch->whichChild = cb->isChecked() ? SO_SWITCH_ALL: SO_SWITCH_NONE;
1706 }
1707 else {
1708
1709 }
1710
1711 }
1712}
1713
1715 messageVerbose("VP1CaloReadoutSystem::userClickedOnBgd");
1716 m_clockwork->volatileSeparator->removeAllChildren();
1717 deselectAll();
1718}
1719
1720void VP1CaloReadoutSystem::userPickedNode(SoNode* /*mySelectedNode*/, SoPath */*pickedPath*/)
1721{
1722
1723#if 0
1724 m_clockwork->volatileSeparator->removeAllChildren();
1725 deselectAll();
1726 SoPickStyle *pickStyle = new SoPickStyle();
1727 pickStyle->style=SoPickStyleElement::UNPICKABLE;
1728 m_clockwork->volatileSeparator->addChild(pickStyle);
1729
1730
1731 std::ostringstream indexStream, etaBoundaryStream, phiBoundaryStream;
1732
1733 // EMB HV
1734 {
1735 std::map < SoNode *, const EMBHVElectrode*>::const_iterator p = m_clockwork->EMBHVMap.find(mySelectedNode);
1736 if (p!=m_clockwork->EMBHVMap.end()) {
1737
1738 const EMBHVElectrode& electrode = *p->second;
1739 const EMBHVModule& module = electrode.getModule();
1740 const EMBHVManager& manager = module.getManager();
1741 const EMBHVManager::EMBHVData hvdata = manager.getData(**hvCabling,
1742 attrLists);
1743 std::ostringstream outstream;
1744 outstream << "Side: " << module.getSideIndex()
1745 <<" Eta: " << module.getEtaIndex()
1746 << " Phi: " << module.getPhiIndex()
1747 << " Sector: " << module.getSectorIndex()
1748 << " Electrode " << electrode.getElectrodeIndex()
1749 << " Voltages: " << hvdata.voltage (electrode, 0)
1750 << "/" << hvdata.voltage (electrode, 1)
1751 << "; currents: " << hvdata.current (electrode, 0)
1752 << "/" << hvdata.current (electrode, 1);
1753 message (outstream.str().c_str());
1754 }
1755 }
1756 // EMEC HV
1757 {
1758 std::map < SoNode *, const EMECHVElectrode*>::const_iterator p = m_clockwork->EMECHVMap.find(mySelectedNode);
1759 if (p!=m_clockwork->EMECHVMap.end()) {
1760
1761 const EMECHVElectrode& electrode = *p->second;
1762 const EMECHVModule& module = electrode.getModule();
1763 const EMECHVManager& manager = module.getManager();
1764 const EMECHVManager::EMECHVData hvdata = manager.getData(**hvCabling,
1765 attrLists);
1766 std::ostringstream outstream;
1767 outstream << "Side: " << module.getSideIndex()
1768 << " Wheel: " << module.getWheelIndex()
1769 << " Eta: " << module.getEtaIndex()
1770 << " Phi: " << module.getPhiIndex()
1771 << " Sector: " << module.getSectorIndex()
1772 << " Electrode: " << electrode.getElectrodeIndex()
1773 << "Voltages: " << hvdata.voltage (electrode, 0)
1774 << "/" << hvdata.voltage (electrode, 1)
1775 << "; currents: " << hvdata.current (electrode, 0)
1776 << "/" << hvdata.current (electrode, 1);
1777 message (outstream.str().c_str());
1778 }
1779 }
1780
1781 // HEC HV
1782 {
1783 std::map < SoNode *, const HECHVSubgap*>::const_iterator p = m_clockwork->HECHVMap.find(mySelectedNode);
1784 if (p!=m_clockwork->HECHVMap.end()) {
1785
1786 const HECHVSubgap& subgap = *p->second;
1787 const HECHVModule& module = subgap.getModule();
1788 const HECHVManager& manager = module.getManager();
1789 const HECHVManager::HECHVData hvdata = manager.getData(**hvCabling,
1790 attrLists);
1791 std::ostringstream outstream;
1792 outstream << "Side: " << module.getSideIndex()
1793 << " Phi: " << module.getPhiIndex()
1794 << " Sampling: " << module.getSamplingIndex()
1795 << " Subgap: " << subgap.getSubgapIndex()
1796 << "Voltage: " << hvdata.voltage (subgap)
1797 << "; current: " << hvdata.current (subgap);
1798 message (outstream.str().c_str());
1799 }
1800 }
1801 // FCAL HV
1802 {
1803 std::map < SoNode *, const FCALHVLine*>::const_iterator p = m_clockwork->FCALHVMap.find(mySelectedNode);
1804 if (p!=m_clockwork->FCALHVMap.end()) {
1805
1806 const FCALHVLine& line = *p->second;
1807 const FCALHVModule& module = line.getModule();
1808 const FCALHVManager& manager = module.getManager();
1809 const FCALHVManager::FCALHVData hvdata = manager.getData(**hvCabling,
1810 attrLists);
1811 std::ostringstream outstream;
1812 outstream << "Side: " << module.getSideIndex()
1813 << " Sector: " << module.getSectorIndex()
1814 << " Sampling: " << module.getSamplingIndex()
1815 << " Line: " << line.getLineIndex()
1816 << "Voltage: " << hvdata.voltage (line)
1817 << "; current: " << hvdata.current (line);
1818 message (outstream.str().c_str());
1819 }
1820 }
1821
1822 // See if it is in the FCAL
1823 {
1824 std::map < SoNode *, const FCALTile *>::const_iterator p = m_clockwork->TileMap.find(mySelectedNode);
1825 if (p!=m_clockwork->TileMap.end()) {
1826
1827 const FCALTile *element = (*p).second;
1828 indexStream << "Element selected has identifier of " << element->identify() << std::endl;
1829 indexStream << "I index of " << element->getIndexI() << std::endl;
1830 indexStream << "J index of " << element->getIndexJ() << std::endl;
1831 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
1832 std::ostringstream highVoltageStream;
1833 highVoltageStream << "There are " << element->getNumHVLines() << " high voltage lines. Status: " << std::endl;
1834 message(highVoltageStream.str().c_str());
1835
1836 const FCALHVLine* line = nullptr;
1837 for (unsigned int i=0;i<element->getNumHVLines();i++) {
1838 line = element->getHVLine(i);
1839 if (line) break;
1840 }
1841
1842 if (line) {
1843 const FCALHVModule& module = line->getModule();
1844 const FCALHVManager& manager = module.getManager();
1845 const FCALHVManager::FCALHVData hvdata = manager.getData(**hvCabling,
1846 attrLists);
1847 for (unsigned int i=0;i<element->getNumHVLines();i++) {
1848 std::ostringstream highVoltageStream;
1849 if (element->getHVLine(i)) {
1850 highVoltageStream << i << ' ' << hvdata.voltage (*element->getHVLine(i)) << std::endl;
1851 }
1852 message(highVoltageStream.str().c_str());
1853 }
1854 }
1855 }
1856
1857
1858
1859
1860 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
1861
1862 const FCALModule *fcalMod=element->getModule();
1863
1864
1865 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(fcalMod->getAbsoluteTransform());
1866 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1867
1868 SoSeparator * sep = new SoSeparator();
1869 sep->addChild(XF);
1870
1871 double zf = fcalMod->getEndcapIndex()== 0 ? +fcalMod->getFullDepthZ(*element)/2.0 : -fcalMod->getFullDepthZ(*element)/2.0;
1872 double zc = 0;
1873 double zb = fcalMod->getEndcapIndex()== 0 ? -fcalMod->getFullDepthZ(*element)/2.0 : +fcalMod->getFullDepthZ(*element)/2.0;
1874
1875 double z=zf;
1876 if (m_clockwork->pos==CENTER) z=zc;
1877 if (m_clockwork->pos==BACK) z=zb;
1878
1879 SoMaterial *white = new SoMaterial();
1880 white->diffuseColor.setValue(1.00,1.00, 1.00);
1881
1882 SoDrawStyle *drawStyle = new SoDrawStyle();
1883 drawStyle->lineWidth=3;
1884 drawStyle->pointSize=3;
1885
1886 SoLightModel *lm = new SoLightModel();
1887 lm->model=SoLightModel::BASE_COLOR;
1888 sep->addChild(white);
1889 sep->addChild(drawStyle);
1890 sep->addChild(lm);
1891
1892
1893 int cc=0;
1894 SoVertexProperty *vtxProperty = new SoVertexProperty();
1895 for (FCALModule::ConstIterator f=fcalMod->beginTiles();f!=fcalMod->endTiles();f++) {
1896 if (((*f).getHVLine(0) && (*f).getHVLine(0)==element->getHVLine(0)) ||
1897 ((*f).getHVLine(1) && (*f).getHVLine(1)==element->getHVLine(1)) ||
1898 ((*f).getHVLine(2) && (*f).getHVLine(2)==element->getHVLine(2)) ||
1899 ((*f).getHVLine(3) && (*f).getHVLine(3)==element->getHVLine(3)) ) {
1900 for (unsigned int i=0;i<(*f).getNumTubes();i++) {
1901 FCALTubeConstLink myTube=(*f).getTube(i);
1902 vtxProperty->vertex.set1Value(cc++, SbVec3f(myTube->getXLocal(),myTube->getYLocal(),z));
1903 }
1904 }
1905 }
1906 SoPointSet *ps = new SoPointSet();
1907 ps->numPoints=cc;
1908 ps->vertexProperty=vtxProperty;
1909 sep->addChild(ps);
1910 m_clockwork->volatileSeparator->addChild(sep);
1911 }
1912 if (m_clockwork->ui.fcalTubesCheckBox->isChecked()) {
1913 const FCALModule *fcalMod=element->getModule();
1914 const HepGeom::Transform3D &xf = Amg::EigenTransformToCLHEP(fcalMod->getAbsoluteTransform());
1915 SoTransform *XF = VP1LinAlgUtils::toSoTransform(xf);
1916
1917 SoSeparator * sep = new SoSeparator();
1918 sep->addChild(XF);
1919
1920 double zf = fcalMod->getEndcapIndex()== 0 ? +fcalMod->getFullDepthZ(*element)/2.0 : -fcalMod->getFullDepthZ(*element)/2.0;
1921 double zc = 0;
1922 double zb = fcalMod->getEndcapIndex()== 0 ? -fcalMod->getFullDepthZ(*element)/2.0 : +fcalMod->getFullDepthZ(*element)/2.0;
1923
1924 double z=zf;
1925 if (m_clockwork->pos==CENTER) z=zc;
1926 if (m_clockwork->pos==BACK) z=zb;
1927
1928 SoMaterial *white = new SoMaterial();
1929 white->diffuseColor.setValue(1.00,1.00, 1.00);
1930
1931 SoDrawStyle *drawStyle = new SoDrawStyle();
1932 drawStyle->lineWidth=3;
1933 drawStyle->pointSize=3;
1934
1935 SoLightModel *lm = new SoLightModel();
1936 lm->model=SoLightModel::BASE_COLOR;
1937 sep->addChild(white);
1938 sep->addChild(drawStyle);
1939 sep->addChild(lm);
1940
1941
1942 int cc=0;
1943 SoVertexProperty *vtxProperty = new SoVertexProperty();
1944 for (unsigned int i=0;i<element->getNumTubes();i++) {
1945 FCALTubeConstLink myTube=element->getTube(i);
1946 vtxProperty->vertex.set1Value(cc++, SbVec3f(myTube->getXLocal(),myTube->getYLocal(),z));
1947 }
1948 SoPointSet *ps = new SoPointSet();
1949 ps->numPoints=cc;
1950 ps->vertexProperty=vtxProperty;
1951 sep->addChild(ps);
1952 m_clockwork->volatileSeparator->addChild(sep);
1953 }
1954 }
1955 }
1956
1957
1958 // See if it is in the HEC:
1959 {
1960 std::map < SoNode *, HECCellConstLink>::const_iterator p = m_clockwork->HECMap.find(mySelectedNode);
1961 if (p!=m_clockwork->HECMap.end()) {
1962
1963 HECCellConstLink element = (*p).second;
1964 indexStream << "Sampling Region,Eta,Phi indices of " << element->getSamplingIndex() << "," << element->getRegionIndex() << "," << element->getEtaIndex() << "," << element->getPhiIndex() << std::endl;
1965 phiBoundaryStream << "Phi min & max (CLHEP::deg) =" << element->getPhiLocalLower()*180/M_PI << " " << element->getPhiLocalUpper()*180/M_PI << std::endl;
1966 etaBoundaryStream << "Eta Min and Max " << element->getEtaMinNominal() << "," << element->getEtaMaxNominal() << std::endl;
1967 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
1968 std::ostringstream highVoltageStream;
1969 highVoltageStream << "There are " << element->getNumSubgaps() << " subgaps. Status: " << std::endl;
1970 message (highVoltageStream.str().c_str());
1971 }
1972 std::set<const HECHVModule*> modSet;
1973 if (element->getNumSubgaps() > 0) {
1974 const HECHVModule& module0 = element->getSubgap(0).getModule();
1975 const HECHVManager& manager = module0.getManager();
1976 const HECHVManager::HECHVData hvdata = manager.getData(**hvCabling,
1977 attrLists);
1978 for (unsigned int i=0;i<element->getNumSubgaps();i++) {
1979 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
1980 std::ostringstream highVoltageStream;
1981 highVoltageStream << i << " Status " << hvdata.hvOn (element->getSubgap(i))
1982 << " voltage: " << hvdata.voltage (element->getSubgap(i))
1983 << " current: " << hvdata.current (element->getSubgap(i))
1984 << std::endl;
1985 message(highVoltageStream.str().c_str());
1986 }
1987 //
1988 // Now let's show the module, and where she is:
1989 //
1990 const HECHVModule& module = element->getSubgap(i).getModule();
1991
1992 if (!m_clockwork->ui.highVoltageCheckBox->isChecked()) continue;
1993
1994 SoSeparator * sep = new SoSeparator();
1995
1996 SoMaterial *white = new SoMaterial();
1997 white->diffuseColor.setValue(1.00,1.00, 1.00);
1998
1999 SoDrawStyle *drawStyle = new SoDrawStyle();
2000 drawStyle->lineWidth=3;
2001 drawStyle->pointSize=3;
2002
2003 SoLightModel *lm = new SoLightModel();
2004 lm->model=SoLightModel::BASE_COLOR;
2005
2006
2007 // we comment out to avoid compilation warnings, because they're not used, apparently
2008 // HECCell::CELLPOS pos=HECCell::FRONT;
2009 // if (m_clockwork->pos==BACK) pos=HECCell::BACK;
2010 // if (m_clockwork->pos==CENTER) pos=HECCell::CENTER;
2011
2012
2013 const HECDetectorManager *hecManager = VP1DetInfo::hecDetMgr();
2014 const HECDetectorRegion *region = hecManager->getDetectorRegion(element->getEndcapIndex(),element->getSamplingIndex(),element->getRegionIndex());
2015 const HepGeom::Transform3D &XF= Amg::EigenTransformToCLHEP(region->getAbsoluteTransform());
2016 double z = (XF*HepGeom::Point3D<double>(0,0,element->getZLocal(HECCell::FRONT))).z();
2017
2018 double phiMin = module.getPhiMin();
2019 double phiMax = module.getPhiMax();
2020
2021
2022 double rMax=2130;
2023 double rMin=element->getSamplingIndex()==0 ? 371 : 474;
2024
2025 sep->addChild(white);
2026 sep->addChild(drawStyle);
2027 sep->addChild(lm);
2028 if (modSet.find(&module)==modSet.end()) {
2029 modSet.insert(&module);
2030 int cc=0;
2031 SoVertexProperty *vtxProperty = new SoVertexProperty();
2032 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2033 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
2034 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
2035 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
2036 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2037
2038
2039 SoLineSet *ls = new SoLineSet();
2040 ls->numVertices=5;
2041 ls->vertexProperty=vtxProperty;
2042 sep->addChild(ls);
2043 }
2044 m_clockwork->volatileSeparator->addChild(sep);
2045 }
2046 }
2047 }
2048 }
2049 // See if it is in the EMEC:
2050 {
2051 std::map < SoNode *, EMECCellConstLink>::const_iterator p = m_clockwork->EMECMap.find(mySelectedNode);
2052 if (p!=m_clockwork->EMECMap.end()) {
2053
2054 EMECCellConstLink element = (*p).second;
2055 indexStream<< "Sampling Region,Eta,Phi indices of " << element->getSamplingIndex() << "," << element->getRegionIndex() << "," << element->getEtaIndex() << "," << element->getPhiIndex() << std::endl;
2056 etaBoundaryStream << "Eta Min and Max " << element->getEtaMin() << "," << element->getEtaMax() << std::endl;
2057 phiBoundaryStream << "Phi min & max (CLHEP::deg) =" << element->getPhiLocalLower()*180/M_PI << " " << element->getPhiLocalUpper()*180/M_PI << std::endl;
2058 //
2059
2060 if (element->getSamplingIndex()==0) {
2061
2062 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
2063 const EMECPresamplerHVModule& module = element->getPresamplerHVModule();
2064 const EMECPresamplerHVManager& manager = module.getManager();
2065 const EMECPresamplerHVManager::EMECPresamplerHVData hvdata = manager.getData(**hvCabling,
2066 attrLists);
2067 std::ostringstream highVoltageStream;
2068 highVoltageStream << "Presampler cell. HV Status: " << '\n';
2069 message(highVoltageStream.str().c_str());
2070 highVoltageStream << "Status: "
2071 << hvdata.hvOn (module, 0) << ' '
2072 << hvdata.hvOn (module, 1) << '\n';
2073 highVoltageStream << "Current: " << hvdata.current(module, 0) << ' ' << hvdata.current (module, 1) << '\n';
2074 highVoltageStream << "Voltage: " << hvdata.voltage (module, 0) << ' ' << hvdata.voltage (module, 1) << '\n';
2075
2076 message(highVoltageStream.str().c_str());
2077
2078
2079 SoSeparator * sep = new SoSeparator();
2080
2081 SoMaterial *white = new SoMaterial();
2082 white->diffuseColor.setValue(1.00,1.00, 1.00);
2083
2084 SoDrawStyle *drawStyle = new SoDrawStyle();
2085 drawStyle->lineWidth=3;
2086 drawStyle->pointSize=3;
2087
2088 SoLightModel *lm = new SoLightModel();
2089 lm->model=SoLightModel::BASE_COLOR;
2090
2091
2092 EMECCell::CELLPOS pos=EMECCell::FRONT;
2093 if (m_clockwork->pos==BACK) pos=EMECCell::BACK;
2094 if (m_clockwork->pos==CENTER) pos=EMECCell::CENTER;
2095
2096
2097 double z = (element->getZLocal(pos)+
2098 element->getDescriptor()->getManager()->getFocalToRef() +
2099 element->getDescriptor()->getManager()->getRefToActive())* (element->getEndcapIndex()==0 ? -1:1);
2100 double phiMin = module.getPhiMin();
2101 double phiMax = module.getPhiMax();
2102 double etaMin = module.getEtaMin();
2103 double etaMax = module.getEtaMax();
2104
2105
2106 double rMax=fabs(z/sinh(etaMin));
2107 double rMin=fabs(z/sinh(etaMax));
2108
2109 sep->addChild(white);
2110 sep->addChild(drawStyle);
2111 sep->addChild(lm);
2112 int cc=0;
2113 SoVertexProperty *vtxProperty = new SoVertexProperty();
2114 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2115 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
2116 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
2117 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
2118 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2119
2120
2121 SoLineSet *ls = new SoLineSet();
2122 ls->numVertices=5;
2123 ls->vertexProperty=vtxProperty;
2124 sep->addChild(ls);
2125 m_clockwork->volatileSeparator->addChild(sep);
2126 }
2127 }
2128 else {
2129
2130 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
2131 std::ostringstream highVoltageStream;
2132 highVoltageStream << "There are " << element->getNumElectrodes() << " electrodes. Status: " << std::endl;
2133 message(highVoltageStream.str().c_str());
2134 }
2135 std::set<const EMECHVModule*> modSet;
2136 if (element->getNumElectrodes() > 0) {
2137 for (unsigned int i=0;i<element->getNumElectrodes();i++) {
2138 const EMECHVElectrode& electrode = element->getElectrode(0);
2139 const EMECHVModule& module0 = electrode.getModule();
2140 const EMECHVManager& manager = module0.getManager();
2141 const EMECHVManager::EMECHVData hvdata = manager.getData(**hvCabling,
2142 attrLists);
2143 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
2144 {
2145 std::ostringstream highVoltageStream;
2146 highVoltageStream << i << ' '
2147 << element->getElectrode(i).getElectrodeIndex() << ") status: "
2148 << hvdata.hvOn(element->getElectrode(i),0) << ' '
2149 << hvdata.hvOn(element->getElectrode(i),1) << std::endl;
2150 message(highVoltageStream.str().c_str());
2151 }
2152 {
2153 std::ostringstream highVoltageStream;
2154 highVoltageStream << i << '('
2155 << element->getElectrode(i).getElectrodeIndex() << ") voltage: "
2156 << hvdata.voltage(element->getElectrode(i),0) << ' '
2157 << hvdata.voltage(element->getElectrode(i),1) << std::endl;
2158 message(highVoltageStream.str().c_str());
2159 }
2160 {
2161 std::ostringstream highVoltageStream;
2162 highVoltageStream << i << '(' << element->getElectrode(i).getElectrodeIndex() << ") currents: "
2163 << hvdata.current(element->getElectrode(i),0) << ' '
2164 << hvdata.current(element->getElectrode(i),1) << std::endl;
2165 message(highVoltageStream.str().c_str());
2166 }
2167 }
2168 //
2169 // Now let's show the module, and where she is:
2170 //
2171 const EMECHVModule& module = element->getElectrode(i).getModule();
2172
2173 if (!m_clockwork->ui.highVoltageCheckBox->isChecked()) continue;
2174
2175 SoSeparator * sep = new SoSeparator();
2176
2177 SoMaterial *white = new SoMaterial();
2178 white->diffuseColor.setValue(1.00,1.00, 1.00);
2179
2180 SoDrawStyle *drawStyle = new SoDrawStyle();
2181 drawStyle->lineWidth=3;
2182 drawStyle->pointSize=3;
2183
2184 SoLightModel *lm = new SoLightModel();
2185 lm->model=SoLightModel::BASE_COLOR;
2186
2187
2188 EMECCell::CELLPOS pos=EMECCell::FRONT;
2189 if (m_clockwork->pos==BACK) pos=EMECCell::BACK;
2190 if (m_clockwork->pos==CENTER) pos=EMECCell::CENTER;
2191
2192
2193 double z = (element->getZLocal(pos)+
2194 element->getDescriptor()->getManager()->getFocalToRef() +
2195 element->getDescriptor()->getManager()->getRefToActive())* (element->getEndcapIndex()==0 ? -1:1);
2196 double phiMin = module.getPhiMin();
2197 double phiMax = module.getPhiMax();
2198 double etaMin = module.getEtaMin();
2199 double etaMax = module.getEtaMax();
2200
2201
2202 double rMax=fabs(z/sinh(etaMin));
2203 double rMin=fabs(z/sinh(etaMax));
2204
2205 sep->addChild(white);
2206 sep->addChild(drawStyle);
2207 sep->addChild(lm);
2208 if (modSet.find(&module)==modSet.end()) {
2209 modSet.insert(&module);
2210 int cc=0;
2211 SoVertexProperty *vtxProperty = new SoVertexProperty();
2212 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2213 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMax),rMin*sin(phiMax) ,z));
2214 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMax),rMax*sin(phiMax) ,z));
2215 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(phiMin),rMax*sin(phiMin) ,z));
2216 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(phiMin),rMin*sin(phiMin) ,z));
2217
2218
2219 SoLineSet *ls = new SoLineSet();
2220 ls->numVertices=5;
2221 ls->vertexProperty=vtxProperty;
2222 sep->addChild(ls);
2223 }
2224 {
2225
2226 int cc=0;
2227 SoVertexProperty *vtxProperty = new SoVertexProperty();
2228 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMin*cos(element->getElectrode(i).getPhi()),rMin*sin(element->getElectrode(i).getPhi()) ,z));
2229 vtxProperty->vertex.set1Value(cc++, SbVec3f(rMax*cos(element->getElectrode(i).getPhi()),rMax*sin(element->getElectrode(i).getPhi()) ,z));
2230 SoLineSet *ls = new SoLineSet();
2231 ls->numVertices=2;
2232 ls->vertexProperty=vtxProperty;
2233 sep->addChild(ls);
2234 }
2235
2236 m_clockwork->volatileSeparator->addChild(sep);
2237 }
2238 }
2239 }
2240 }
2241 }
2242
2243
2244 // See if it is in the EMB:
2245 {
2246 std::map < SoNode *, EMBCellConstLink>::const_iterator p = m_clockwork->EMBMap.find(mySelectedNode);
2247 if (p!=m_clockwork->EMBMap.end()) {
2248
2249 EMBCellConstLink element = (*p).second;
2250 //element->print();
2251 indexStream<< "Sampling Region,Eta,Phi indices of " << element->getSamplingIndex() << "," << element->getRegionIndex() << "," << element->getEtaIndex() << "," << element->getPhiIndex() << std::endl;
2252 etaBoundaryStream<< "Eta Min and Max " << element->getEtaMin() << "," << element->getEtaMax() << std::endl;
2253 phiBoundaryStream<< "Phi min & max (CLHEP::deg) =" << element->getPhiLocalLower()*180/M_PI << " " << element->getPhiLocalUpper()*180/M_PI << '\n';
2254 //
2255 if (m_clockwork->ui.highVoltageCheckBox->isChecked()) {
2256 if (element->getSamplingIndex()==0) {
2257 const EMBPresamplerHVModule& module = element->getPresamplerHVModule();
2258 const EMBPresamplerHVManager& manager = module.getManager();
2259 const EMBPresamplerHVManager::EMBPresamplerHVData hvdata = manager.getData(**hvCabling,
2260 attrLists);
2261
2262 std::ostringstream highVoltageStream;
2263 highVoltageStream << "Presampler cell. HV Status: " << '\n';
2264 message(highVoltageStream.str().c_str());
2265 highVoltageStream << "Status: "
2266 << hvdata.hvOn (module, 0) << ' '
2267 << hvdata.hvOn (module, 1) << '\n';
2268 highVoltageStream << "Current: "
2269 << hvdata.current (module, 0) << ' '
2270 << hvdata.current (module, 1) << '\n';
2271 highVoltageStream << "Voltage: "
2272 << hvdata.voltage (module, 0) << ' '
2273 << hvdata.voltage (module, 1) << '\n';
2274
2275 message(highVoltageStream.str().c_str());
2276
2277 SoSeparator * sep = new SoSeparator();
2278
2279 SoMaterial *white = new SoMaterial();
2280 white->diffuseColor.setValue(1.00,1.00, 1.00);
2281
2282 SoDrawStyle *drawStyle = new SoDrawStyle();
2283 drawStyle->lineWidth=3;
2284 drawStyle->pointSize=3;
2285
2286 SoLightModel *lm = new SoLightModel();
2287 lm->model=SoLightModel::BASE_COLOR;
2288
2289
2290 EMBCell::CELLPOS pos=EMBCell::FRONT;
2291 if (m_clockwork->pos==BACK) pos=EMBCell::BACK;
2292 if (m_clockwork->pos==CENTER) pos=EMBCell::CENTER;
2293
2294
2295 double r = element->getRLocal(pos);
2296 double phiMin = module.getPhiMin();
2297 double phiMax = module.getPhiMax();
2298 double etaMin = module.getEtaMin();
2299 double etaMax = module.getEtaMax();
2300 sep->addChild(white);
2301 sep->addChild(drawStyle);
2302 sep->addChild(lm);
2303
2304
2305
2306 int cc=0;
2307 SoVertexProperty *vtxProperty = new SoVertexProperty();
2308 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
2309 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMin)));
2310 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMax)));
2311 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMax)));
2312 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
2313
2314 SoLineSet *ls = new SoLineSet();
2315 ls->numVertices=5;
2316 ls->vertexProperty=vtxProperty;
2317 sep->addChild(ls);
2318
2319 m_clockwork->volatileSeparator->addChild(sep);
2320 }
2321 else {
2322 std::ostringstream highVoltageStream;
2323 highVoltageStream << "There are " << element->getNumElectrodes() << " electrodes. Status: " << '\n';
2324 message(highVoltageStream.str().c_str());
2325 std::set<const EMBHVModule*> modSet;
2326 if (element->getNumElectrodes() > 0) {
2327 const EMBHVModule& module0 = element->getElectrode(0).getModule();
2328 const EMBHVManager& manager = module0.getManager();
2329 const EMBHVManager::EMBHVData hvdata = manager.getData(**hvCabling,
2330 attrLists);
2331 for (unsigned int i=0;i<element->getNumElectrodes();i++) {
2332 highVoltageStream << i << "Status: " << element->getElectrode(i).getElectrodeIndex() << ' '
2333 << hvdata.hvOn (element->getElectrode(i), 0) << ' '
2334 << hvdata.hvOn (element->getElectrode(i), 1) << '\n';
2335 highVoltageStream << i << "Current: "
2336 << element->getElectrode(i).getElectrodeIndex() << ' '
2337 << hvdata.current (element->getElectrode(i), 0) << ' '
2338 << hvdata.current (element->getElectrode(i), 1) << '\n';
2339 highVoltageStream << i << "Voltage: " << element->getElectrode(i).getElectrodeIndex() << ' '
2340 << hvdata.voltage (element->getElectrode(i), 0) << ' '
2341 << hvdata.voltage (element->getElectrode(i), 1) << '\n';
2342 message(highVoltageStream.str().c_str());
2343 //
2344 // Now let's show the module, and where she is:
2345 //
2346 const EMBHVModule& module = element->getElectrode(i).getModule();
2347
2348 if (!m_clockwork->ui.highVoltageCheckBox->isChecked()) continue;
2349
2350 SoSeparator * sep = new SoSeparator();
2351
2352 SoMaterial *white = new SoMaterial();
2353 white->diffuseColor.setValue(1.00,1.00, 1.00);
2354
2355 SoDrawStyle *drawStyle = new SoDrawStyle();
2356 drawStyle->lineWidth=3;
2357 drawStyle->pointSize=3;
2358
2359 SoLightModel *lm = new SoLightModel();
2360 lm->model=SoLightModel::BASE_COLOR;
2361
2362
2363 EMBCell::CELLPOS pos=EMBCell::FRONT;
2364 if (m_clockwork->pos==BACK) pos=EMBCell::BACK;
2365 if (m_clockwork->pos==CENTER) pos=EMBCell::CENTER;
2366
2367
2368 double r = element->getRLocal(pos);
2369 double phiMin = module.getPhiMin();
2370 double phiMax = module.getPhiMax();
2371 double etaMin = module.getEtaMin();
2372 double etaMax = module.getEtaMax();
2373 sep->addChild(white);
2374 sep->addChild(drawStyle);
2375 sep->addChild(lm);
2376
2377 if (modSet.find(&module)==modSet.end()) {
2378 modSet.insert(&module);
2379
2380
2381
2382 int cc=0;
2383 SoVertexProperty *vtxProperty = new SoVertexProperty();
2384 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
2385 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMin)));
2386 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMax),r*sin(phiMax) ,r*sinh(etaMax)));
2387 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMax)));
2388 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(phiMin),r*sin(phiMin) ,r*sinh(etaMin)));
2389
2390 SoLineSet *ls = new SoLineSet();
2391 ls->numVertices=5;
2392 ls->vertexProperty=vtxProperty;
2393 sep->addChild(ls);
2394
2395 }
2396 {
2397 int cc=0;
2398 SoVertexProperty *vtxProperty = new SoVertexProperty();
2399 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(element->getElectrode(i).getPhi()),r*sin(element->getElectrode(i).getPhi()) ,r*sinh(etaMin)));
2400 vtxProperty->vertex.set1Value(cc++, SbVec3f(r*cos(element->getElectrode(i).getPhi()),r*sin(element->getElectrode(i).getPhi()) ,r*sinh(etaMax)));
2401
2402 SoLineSet *ls = new SoLineSet();
2403 ls->numVertices=2;
2404 ls->vertexProperty=vtxProperty;
2405
2406 sep->addChild(ls);
2407 }
2408
2409 m_clockwork->volatileSeparator->addChild(sep);
2410 }
2411 }
2412 }
2413 }
2414 }
2415 }
2416
2417 if (m_clockwork->ui.etaBoundariesCheckBox->isChecked()) {
2418 message(etaBoundaryStream.str().c_str());
2419 }
2420 if (m_clockwork->ui.phiBoundariesCheckBox->isChecked()) {
2421 message(phiBoundaryStream.str().c_str());
2422 }
2423 if (m_clockwork->ui.indicesCheckBox->isChecked()) {
2424 message(indexStream.str().c_str());
2425 }
2426#endif
2427}
2428
2429QByteArray VP1CaloReadoutSystem::saveState()
2430{
2431
2432 ensureBuildController();
2433
2434 VP1Serialise serialise(3/*version*/,this);
2435 serialise.save(IVP13DSystemSimple::saveState());
2436
2437 //Checkboxes (by name for greater stability in case we change content of map):
2438 QMapIterator<QString,QCheckBox*> it(m_clockwork->checkBoxMap);
2439 QMap<QString,bool> checkboxstate;
2440 while (it.hasNext()) {
2441 it.next();
2442 checkboxstate.insert(it.key(),it.value()->isChecked());
2443 serialise.widgetHandled(it.value());
2444 }
2445 serialise.save(checkboxstate);
2446
2447 serialise.save(m_clockwork->ui.phiSectionWidget);//Versions <=2 saved in old format
2448 serialise.save(m_clockwork->ui.frontRadioButton,
2449 m_clockwork->ui.backRadioButton,
2450 m_clockwork->ui.centerRadioButton);
2451 serialise.save(m_clockwork->ui.embColorSel);
2452 serialise.save(m_clockwork->ui.emecColorSel);
2453 serialise.save(m_clockwork->ui.hecColorSel);
2454 serialise.save(m_clockwork->ui.fcalColorSel);
2455 serialise.save(m_clockwork->ui.hvToleranceSpinBox);
2456 serialise.save(m_clockwork->ui.embNominalSpinBox);
2457 serialise.save(m_clockwork->ui.hecNominalSpinBox);
2458 serialise.save(m_clockwork->ui.fcal1NominalSpinBox);
2459 serialise.save(m_clockwork->ui.fcal2NominalSpinBox);
2460 serialise.save(m_clockwork->ui.fcal3NominalSpinBox);
2461 serialise.save(m_clockwork->ui.emecNominalSpinBox_1);
2462 serialise.save(m_clockwork->ui.emecNominalSpinBox_2);
2463 serialise.save(m_clockwork->ui.emecNominalSpinBox_3);
2464 serialise.save(m_clockwork->ui.emecNominalSpinBox_4);
2465 serialise.save(m_clockwork->ui.emecNominalSpinBox_5);
2466 serialise.save(m_clockwork->ui.emecNominalSpinBox_6);
2467 serialise.save(m_clockwork->ui.emecNominalSpinBox_7);
2468 serialise.save(m_clockwork->ui.emecNominalSpinBox_8);
2469 serialise.save(m_clockwork->ui.emecNominalSpinBox_9);
2470 serialise.save(m_clockwork->ui.embPresamplerNominalSpinBox);
2471 serialise.save(m_clockwork->ui.emecPresamplerNominalSpinBox);
2472
2473 serialise.save(m_clockwork->ui.caloReadoutToolBox); //Version 2+
2474 serialise.warnUnsaved(controllerWidget());
2475 return serialise.result();
2476
2477}
2478
2479void VP1CaloReadoutSystem::restoreFromState(QByteArray ba)
2480{
2481 VP1Deserialise state(ba,this);
2482 if (state.version()==0) {
2483 message("Warning: State data in .vp1 file has obsolete format - ignoring!");
2484 return;
2485 }
2486 if (state.version()<1||state.version()>3) {
2487 message("Warning: State data in .vp1 file is in wrong format - ignoring!");
2488 return;
2489 }
2490 ensureBuildController();
2491 IVP13DSystemSimple::restoreFromState(state.restoreByteArray());
2492
2493 //Checkboxes (by name for greater stability in case we change content of map):
2494 QMap<QString,bool> checkboxstate(state.restore<QMap<QString,bool> >());
2495 QMapIterator<QString,QCheckBox*> it(m_clockwork->checkBoxMap);
2496 while (it.hasNext()) {
2497 it.next();
2498 state.widgetHandled(it.value());
2499 if (checkboxstate.contains(it.key())) {
2500 bool checked = checkboxstate.value(it.key());
2501 if (it.value()->isChecked()!=checked)
2502 it.value()->setChecked(checked);
2503 }
2504 }
2505
2506 if (state.version()<=2) {
2507 state.ignoreObsoletePhiSectionWidgetState();
2508 state.ignoreWidget(m_clockwork->ui.phiSectionWidget);
2509 } else {
2510 state.restore(m_clockwork->ui.phiSectionWidget);
2511 }
2512 state.restore(m_clockwork->ui.frontRadioButton,
2513 m_clockwork->ui.backRadioButton,
2514 m_clockwork->ui.centerRadioButton);
2515 state.restore(m_clockwork->ui.embColorSel);
2516 state.restore(m_clockwork->ui.emecColorSel);
2517 state.restore(m_clockwork->ui.hecColorSel);
2518 state.restore(m_clockwork->ui.fcalColorSel);
2519 state.restore(m_clockwork->ui.hvToleranceSpinBox);
2520 state.restore(m_clockwork->ui.embNominalSpinBox);
2521 state.restore(m_clockwork->ui.hecNominalSpinBox);
2522 state.restore(m_clockwork->ui.fcal1NominalSpinBox);
2523 state.restore(m_clockwork->ui.fcal2NominalSpinBox);
2524 state.restore(m_clockwork->ui.fcal3NominalSpinBox);
2525 state.restore(m_clockwork->ui.emecNominalSpinBox_1);
2526 state.restore(m_clockwork->ui.emecNominalSpinBox_2);
2527 state.restore(m_clockwork->ui.emecNominalSpinBox_3);
2528 state.restore(m_clockwork->ui.emecNominalSpinBox_4);
2529 state.restore(m_clockwork->ui.emecNominalSpinBox_5);
2530 state.restore(m_clockwork->ui.emecNominalSpinBox_6);
2531 state.restore(m_clockwork->ui.emecNominalSpinBox_7);
2532 state.restore(m_clockwork->ui.emecNominalSpinBox_8);
2533 state.restore(m_clockwork->ui.emecNominalSpinBox_9);
2534 state.restore(m_clockwork->ui.embPresamplerNominalSpinBox);
2535 state.restore(m_clockwork->ui.emecPresamplerNominalSpinBox);
2536
2537 if (state.version()>=2)
2538 state.restore(m_clockwork->ui.caloReadoutToolBox);
2539
2540 state.warnUnrestored(controllerWidget());
2541}
2542
2543void VP1CaloReadoutSystem::acceptHV() {
2544 if (!m_clockwork->permInit) return; // do not change switches
2545 // if the switches are not yet built!!
2546
2547 for (int i=0;i<4;i++) {
2548 if (i<3) m_clockwork->fcalNormalSep[i]->removeAllChildren();
2549 if (i<3) m_clockwork->fcalMissingSep[i]->removeAllChildren();
2550 if (i<3) m_clockwork->fcalBadSep[i]->removeAllChildren();
2551 m_clockwork->hecNormalSep[i]->removeAllChildren();
2552 m_clockwork->hecMissingSep[i]->removeAllChildren();
2553 m_clockwork->hecBadSep[i]->removeAllChildren();
2554 m_clockwork->embModsSeparator->removeAllChildren();
2555 m_clockwork->embPreModsSeparator->removeAllChildren();
2556 m_clockwork->emecPreModsSeparator->removeAllChildren();
2557 m_clockwork->emecModsSeparator->removeAllChildren();
2558 }
2559 m_clockwork->hvInit=false;
2560 createHV();
2561}
#define M_PI
std::vector< Identifier > ID
@ Presampler
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sp
#define I(x, y, z)
Definition MD5.cxx:116
#define y
#define x
#define z
#define NPHISECTORS
#define INSERTCHECKBOX(checkboxname)
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
Hold mapping of ranges to condition objects.
Definition CondCont.h:889
const GeoStraightAccSection * getAbsorberSections() const
Absorber position details:
@ BACK
Definition EMBCell.h:33
@ CENTER
Definition EMBCell.h:33
@ FRONT
Definition EMBCell.h:33
A manager class providing access to readout geometry information for the electromagnetic barrel calor...
std::vector< constEMBDetectorRegion * >::const_iterator DetectorRegionConstIterator
unsigned int beginPhiIndex() const
Returns the first phi index in the region.
EMBCellConstLink getEMBCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
unsigned int beginEtaIndex() const
Returns the first eta index in the region.
const Amg::Transform3D & getAbsoluteTransform(const GeoAlignmentStore *alignStore=nullptr) const
Returns the absolute transform of this element.
const EMBHVModule & getModule() const
double getPhi() const
double voltage(const EMBHVElectrode &electrode, const int &iGap) const
This class provides direct access to information on the HV electrodes within the barrels.
unsigned int beginPhiIndex() const
unsigned int endEtaIndex() const
static unsigned int endSectorIndex()
unsigned int beginEtaIndex() const
static unsigned int beginSectorIndex()
const EMBHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
EMBHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
unsigned int endPhiIndex() const
static unsigned int beginSideIndex()
static unsigned int endSideIndex()
Describes one HV Module within the EMB.
Definition EMBHVModule.h:20
const EMBHVElectrode & getElectrode(unsigned int iElectrode) const
double getEtaMin() const
double getPhiMax() const
double getEtaMax() const
double getPhiMin() const
unsigned int getNumElectrodes() const
Definition EMBHVModule.h:34
double voltage(const EMBPresamplerHVModule &module, const int &iGap) const
This class provides direct access to information on the HV electrodes within the barrels.
const EMBPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi) const
EMBPresamplerHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
static unsigned int beginSideIndex()
unsigned int beginPhiIndex() const
static unsigned int endSideIndex()
unsigned int beginEtaIndex() const
Describes one HV Module within the EMB Presampler.
A manager class providing access to readout geometry information for the electromagnetic endcap calor...
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMECCellConstLink getEMECCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
const Amg::Transform3D & getAbsoluteTransform(const GeoAlignmentStore *alignStore=nullptr) const
Returns the absolute transform of this element.
HepGeom::Point3D< double > getFocalPointPos() const
Returns the position of the focal point of the EMEC.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
unsigned int beginEtaIndex() const
returns the first eta index in the region.
double getPhi() const
const EMECHVModule & getModule() const
double voltage(const EMECHVElectrode &electrode, const int &iGap) const
This class provides direct access to information on the HV electrodes within the EMEC.
unsigned int beginEtaIndex() const
const EMECHVModule & getHVModule(unsigned int iSide, unsigned int iEta, unsigned int iPhi, unsigned int iSector) const
unsigned int beginSectorIndex() const
unsigned int endPhiIndex() const
static unsigned int beginSideIndex()
static unsigned int endSideIndex()
unsigned int endEtaIndex() const
unsigned int endSectorIndex() const
unsigned int beginPhiIndex() const
EMECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
double getEtaMax() const
const EMECHVElectrode & getElectrode(unsigned int iElectrode) const
unsigned int getNumElectrodes() const
double getPhiMin() const
double getEtaMin() const
double getPhiMax() const
double voltage(const EMECPresamplerHVModule &module, const int &iGap) const
This class provides direct access to information on the HV electrodes within the EMEC.
EMECPresamplerHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
const EMECPresamplerHVModule & getHVModule(unsigned int iSide, unsigned int iPhi) const
static unsigned int beginSideIndex()
Describes one HV Module within the EMEc Presampler.
A manager class providing access to readout geometry information for the forward calorimeter.
std::vector< constFCALModule * >::const_iterator ConstIterator
FCALDetectorManager::ConstIterator beginFCAL() const
Iterate over FCAL Modules.
FCALDetectorManager::ConstIterator endFCAL() const
Iterate over FCAL Modules.
double voltage(const FCALHVLine &line) const
This class provides direct access to information on the HV electrodes within the barrels.
static unsigned int beginSideIndex()
static unsigned int endSamplingIndex()
static unsigned int endSideIndex()
static unsigned int beginSectorIndex(unsigned int iSampling)
static unsigned int beginSamplingIndex()
const FCALHVModule & getHVModule(unsigned int iSide, unsigned int iSector, unsigned int iSampling) const
static unsigned int endSectorIndex(unsigned int iSampling)
FCALHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
Describes one HV Module within the FCAL.
const FCALHVLine & getHVLine(unsigned int iLine) const
static unsigned int getNumHVLines()
FCALModule::Endcap getEndcapIndex() const
Returns the side (O=Negative, 1=Positive)
double getFullWidthY(const FCALTile &tile) const
Gets Tile Full Width in Y.
double getFullDepthZ(const FCALTile &) const
Gets Tile (full) Depth.
double getFullWidthX(const FCALTile &tile) const
Gets Tile Full Width in X.
const Amg::Transform3D & getAbsoluteTransform(const GeoAlignmentStore *alignStore=nullptr) const
Returns the absolute transform of this element.
std::vector< FCALTile >::const_iterator ConstIterator
Definition FCALModule.h:36
FCALModule::ConstIterator beginTiles() const
Iteration over FCAL Tiles.
FCALModule::Module getModuleIndex() const
Returns the Module (1,2, or 3)
FCALModule::ConstIterator endTiles() const
Iteration over FCAL Tiles.
Record of All Electrode Straight Pieces.
const double & YCent(int stackid, int cellid) const
const double & Cosu(int stackid, int cellid) const
const double & HalfLength(int stackid, int cellid) const
const double & Sinu(int stackid, int cellid) const
const double & XCent(int stackid, int cellid) const
@ BACK
Definition HECCell.h:34
@ FRONT
Definition HECCell.h:34
@ CENTER
Definition HECCell.h:34
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
const HECDetectorRegion * getDetectorRegion(unsigned int endcap, unsigned int sampling, unsigned int region) const
Random Access to detector regions.
std::vector< constHECDetectorRegion * >::const_iterator DetectorRegionConstIterator
Description of a region of homogenous granularity in the hadronic endcap calorimeter.
HECCellConstLink getHECCell(unsigned int ieta, unsigned int iphi) const
Retrieve a cell with eta index and phi index.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
HepGeom::Point3D< double > getFocalPointPos() const
Returns the position of the focal point of the HEC.
const Amg::Transform3D & getAbsoluteTransform(const GeoAlignmentStore *alignStore=nullptr) const
Returns the absolute transform of this element.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index (0-3)
unsigned int beginEtaIndex() const
returns the first eta index in the region.
double voltage(const HECHVSubgap &subgap) const
This class provides direct access to information on the HV electrodes within the barrels.
static unsigned int beginPhiIndex()
static unsigned int endSamplingIndex()
const HECHVModule & getHVModule(unsigned int iSide, unsigned int iPhi, unsigned int iSampling) const
static unsigned int endSideIndex()
HECHVData getData(const LArHVIdMapping &hvIdMapping, const std::vector< const CondAttrListCollection * > &attrLists) const
static unsigned int beginSideIndex()
static unsigned int beginSamplingIndex()
static unsigned int endPhiIndex()
Describes one HV Module within the HEC.
Definition HECHVModule.h:21
const HECHVSubgap & getSubgap(unsigned int iElectrode) const
double getPhiMin() const
static unsigned int getNumSubgaps()
double getPhiMax() const
IVP13DSystemSimple(const QString &name, const QString &information, const QString &contact_info)
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
void messageVerbose(const QString &) const
void messageDebug(const QString &) const
void message(const QString &) const
This class provides access to the High Voltage throughout the LAr.
const HECHVManager & getHECHVManager() const
const EMECHVManager & getEMECHVManager(IOType IO) const
const EMECPresamplerHVManager & getEMECPresamplerHVManager() const
const FCALHVManager & getFCALHVManager() const
const EMBHVManager & getEMBHVManager() const
const EMBPresamplerHVManager & getEMBPresamplerHVManager() const
StatusCode initialize(bool used=true)
const std::string & key() const
Return the StoreGate ID for the referenced object.
const ServiceHandle< IProxyDict > & storeHandle() const
Return handle to the referenced store.
The Athena Transient Store API.
std::map< SoNode *, const FCALTile * > TileMap
std::map< SoNode *, const FCALHVLine * > FCALHVMap
SoSeparator * embSubSep[4][NPHISECTORS]
SoSeparator * accordionSubSep[NPHISECTORS]
Ui::CaloReadoutSystemControllerForm ui
std::map< SoNode *, EMECCellConstLink > EMECMap
SoSwitch * embSubSwitch[4][NPHISECTORS]
SoSwitch * hecSubSwitch[4][NPHISECTORS]
QMap< QString, SoSwitch * > switchMap
std::map< SoNode *, EMBCellConstLink > EMBMap
QMap< QString, QCheckBox * > checkBoxMap
QMap< QCheckBox *, QString > checkBoxNamesMap
SoSeparator * emecSubSep[4][NPHISECTORS]
std::map< SoNode *, const HECHVSubgap * > HECHVMap
SoSwitch * emecSubSwitch[4][NPHISECTORS]
VP1CaloReadoutSystem::POSITION pos
std::map< SoNode *, HECCellConstLink > HECMap
SoSeparator * hecSubSep[4][NPHISECTORS]
SoSwitch * accordionSubSwitch[NPHISECTORS]
std::map< SoNode *, const EMBHVElectrode * > EMBHVMap
std::map< SoNode *, const EMECHVElectrode * > EMECHVMap
void userPickedNode(SoNode *pickedNode, SoPath *pickedPath)
void systemcreate(StoreGateSvc *detstore)
void buildEventSceneGraph(StoreGateSvc *sg, SoSeparator *root)
void buildPermanentSceneGraph(StoreGateSvc *detstore, SoSeparator *root)
static const FCALDetectorManager * fcalDetMgr()
static const EMECDetectorManager * emecDetMgr()
static void ensureInit(IVP1System *)
Definition VP1DetInfo.h:49
static const EMBDetectorManager * embDetMgr()
static const HECDetectorManager * hecDetMgr()
static SoTransform * toSoTransform(const HepGeom::Transform3D &, SoTransform *t=0)
int r
Definition globals.cxx:22
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
Definition index.py:1
Default, invalid implementation of ClassID_traits.
TFile * file