12 #include "ui_simhitcontrollerform.h"
26 #include "CaloDetDescr/CaloDetDescrElement.h"
50 #include <Inventor/C/errors/debugerror.h>
51 #include <Inventor/nodes/SoDrawStyle.h>
52 #include <Inventor/nodes/SoMaterial.h>
53 #include <Inventor/nodes/SoSeparator.h>
54 #include <Inventor/nodes/SoSwitch.h>
55 #include <Inventor/nodes/SoVertexProperty.h>
56 #include <Inventor/nodes/SoPointSet.h>
57 #include <Inventor/SbColor.h>
82 :
IVP13DSystemSimple(
"Sim Hits",
"Display simulation hits from trackers and calorimeters",
"Vakho Tsulaia <Vakhtang.Tsulaia@cern.ch>, Riccardo Maria Bianchi <Riccardo.Maria.Bianchi@cern.ch>"),
95 QWidget* controller =
new QWidget(0);
96 Ui::SimHitControllerForm ui;
97 ui.setupUi(controller);
169 SoDrawStyle*
ds =
new SoDrawStyle();
170 ds->style.setValue(SoDrawStyle::POINTS);
183 message(
"0 pointer to the Store Gate!");
190 SoSwitch* sw =
new SoSwitch();
191 sw->whichChild = SO_SWITCH_NONE;
200 sw->whichChild = SO_SWITCH_ALL;
209 QCheckBox* cb =
dynamic_cast<QCheckBox*
>(sender());
222 sw->whichChild = SO_SWITCH_ALL;
225 sw->whichChild = SO_SWITCH_NONE;
249 unsigned int hitCount = 0;
251 SoVertexProperty* hitVtxProperty =
new SoVertexProperty();
252 SoPointSet* hitPointSet =
new SoPointSet();
254 hitVtxProperty->enableNotify(
FALSE);
255 hitPointSet->enableNotify(
FALSE);
258 SoMaterial* material =
new SoMaterial();
261 sw->addChild(material);
270 if(sg->
retrieve(p_collection,
"PixelHits")==StatusCode::SUCCESS)
272 for (
const SiHit& hit : *p_collection)
277 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
281 message(
"Unable to retrieve Pixel Hits");
289 if(sg->
retrieve(s_collection,
"SCT_Hits")==StatusCode::SUCCESS)
291 for (
const SiHit& hit : *s_collection)
296 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
300 message(
"Unable to retrieve SCT Hits");
308 if(sg->
retrieve(t_collection,
"TRTUncompressedHits")==StatusCode::SUCCESS)
315 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z() );
319 message(
"Unable to retrieve TRT Hits");
331 std::string collName{
"LArHit"};
332 std::string suff{
""};
344 if(sg->
retrieve(lar_collection, collName)==StatusCode::SUCCESS)
346 for (
auto hi : *lar_collection ) {
348 const LArHit* larHit = hi;
353 message(
"Unable to retrieve the CaloDetDescrElement!");
357 message(
"Unable to retrieve " + QString::fromStdString(collName) );
369 if(sg->
retrieve(t_collection,
"TileHitVec")==StatusCode::SUCCESS)
371 for (
const TileHit& hit : *t_collection) {
378 message(
"Unable to retrieve the CaloDetDescrElement!");
382 message(
"Unable to retrieve Tile Hits");
390 if(sg->
retrieve(mdt_collection)==StatusCode::SUCCESS)
392 for (
const MDTSimHit& hit : *mdt_collection)
397 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
401 message(
"Unable to retrieve MDT Hits");
409 if(sg->
retrieve(rpc_collection)==StatusCode::SUCCESS) {
410 for (
const RPCSimHit& hit : *rpc_collection)
415 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
419 message(
"Unable to retrieve RPC Hits");
427 if (sg->
retrieve(tgc_collection)==StatusCode::SUCCESS)
429 for (
const TGCSimHit& hit : *tgc_collection)
434 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
438 message(
"Unable to retrieve TGC Hits");
446 if(sg->
retrieve(csc_collection)==StatusCode::SUCCESS)
448 for (
const CSCSimHit& hit : *csc_collection)
453 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
457 message(
"Unable to retrieve CSC Hits");
465 if(sg->
retrieve(mm_collection)==StatusCode::SUCCESS)
467 for(
const MMSimHit& hit : *mm_collection )
472 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
476 message(
"Unable to retrieve MM Hits");
484 if(sg->
retrieve(stgc_collection)==StatusCode::SUCCESS)
486 for(
const sTGCSimHit& hit : *stgc_collection )
491 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
495 message(
"Unable to retrieve sTGC Hits");
502 message(
"Trying for Generic Muon (as many collections as can be found)");
505 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
508 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
516 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
520 message(
"Unable to retrieve Generic Muon Hits from "+
key);
522 }
else if(
detector==
"Forward Region")
527 message(
"Trying for ForwardRegion (as many collections as can be found)");
530 if(sg->
retrieve( generic_collection,
key.toStdString().c_str() )==StatusCode::SUCCESS)
533 std::cout<<
"Got collection with size: "<<generic_collection->
size()<<std::endl;
541 hitVtxProperty->vertex.set1Value(hitCount++,
u.x(),
u.y(),
u.z());
545 message(
"Unable to retrieve Simulation Hits from "+
key);
550 hitPointSet->numPoints=hitCount;
551 hitPointSet->vertexProperty.setValue(hitVtxProperty);
552 sw->addChild(hitPointSet);
553 hitPointSet->enableNotify(
TRUE);
554 hitVtxProperty->enableNotify(
TRUE);
560 float x = hitElement->
x();
561 float y = hitElement->
y();
562 double z = hitElement->
z();
563 hitVtxProperty->vertex.set1Value(hitCount++,
x,
y,
z);