Skip to content

Commit

Permalink
Merge pull request #460 from sophiemiddleton/NewED
Browse files Browse the repository at this point in the history
Tidying up Offline Event Display
  • Loading branch information
kutschke committed May 28, 2021
2 parents 244a330 + beb2219 commit c2dc425
Show file tree
Hide file tree
Showing 36 changed files with 521 additions and 665 deletions.
12 changes: 12 additions & 0 deletions TEveEventDisplay/CallerFclExamples/POT.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "JobConfig/beam/beam_g4s1MT_phase1.fcl"

physics.producers.g4run.TrajectoryControl: @local::mu2eg4DefaultTrajectories
physics.producers.g4run.TrajectoryControl: @local::mu2eg4DefaultTrajectories

outputs.mubeamout.outputCommands: [
@sequence::outputs.mubeamout.outputCommands,
"keep mu2e::SimParticleart::Ptrmu2e::MCTrajectorystd::map_*_*_*" ]

outputs.dsout.outputCommands: [
@sequence::outputs.dsout.outputCommands,
"keep mu2e::SimParticleart::Ptrmu2e::MCTrajectorystd::map_*_*_*" ]
50 changes: 0 additions & 50 deletions TEveEventDisplay/CallerFclExamples/cosmicExample.fcl

This file was deleted.

4 changes: 2 additions & 2 deletions TEveEventDisplay/CallerFclExamples/cosmictracks.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "TrkHitReco/fcl/prolog.fcl"
#include "CosmicReco/fcl/prolog.fcl"
#include "TEveEventDisplay/fcl/prolog.fcl"
#include "JobConfig/reco/mcdigis_nocosmic.fcl"
//#include "JobConfig/reco/mcdigis_nocosmic.fcl"

source : { module_type : RootInput}

Expand All @@ -33,7 +33,7 @@ physics :
}
filters : {
@table::CosmicTracking.filters
@table::TEveDis.filters

}
}

Expand Down
4 changes: 3 additions & 1 deletion TEveEventDisplay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,6 @@ In order to add Data Products to the Event Display you may need to add an additi

## Authors

This code is built upon the Mu2e Offline code however TEveEventDisplay is package developed within Mu2e Offline by Sophie Middleton with help from Aditi Venkatesh both from Caltech. If you have any questions/comments about TEveEventDisplay please contact: smidd@caltech.edu.
This code is built upon the Mu2e Offline code however TEveEventDisplay is package developed within Mu2e Offline by Sophie Middleton with help from: Aditi Venkatesh both from Caltech (2020) and Namitha Chithirasee from Pisa (2021).

If you have any questions/comments about TEveEventDisplay please contact: smidd@caltech.edu.
16 changes: 12 additions & 4 deletions TEveEventDisplay/fcl/prolog.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ TEveEventDisplayBase : {
showBuilding : false
showDSOnly : true
showEvent : true
isMCOnly : false
filler : {
ComboHitCollection : "makeSH"
CrvRecoPulseCollection : "CrvRecoPulses"
Expand All @@ -34,20 +35,22 @@ TEveEventDisplayBase : {
addMCTraj : true

}
particles : [11,13,2212,2112,211,22,212]
}

TEveEventDisplayUpstream : {
module_type : TEveEventDisplay
showCRV : false
showDSOnly : false
isMCOnly : true
accumulate : false
filler : {
ComboHitCollection : NULL
CosmicTrackSeedCollection : NULL
CrvRecoPulseCollection : NULL
CaloClusterCollection : NULL
CaloHitCollection : NULL
MCTrajectoryCollection : "g4run"
MCTrajectoryCollection : "BeamFilter" #"g4run"
HelixSeedCollection : NULL
KalSeedCollection : [NULL]
TrkExtTrajCollection : NULL
Expand All @@ -57,6 +60,8 @@ TEveEventDisplayUpstream : {
addCosmicSeedFit : false
addMCTraj : true
}
particles : [11,13,2212,2112,211,22,212]

}

TEveEventDisplayHelix : {
Expand All @@ -66,6 +71,7 @@ TEveEventDisplayHelix : {
showBuilding : false
showDSOnly : true
showEvent : true
isMCOnly : false
filler : {
ComboHitCollection : "makeSH"
CrvRecoPulseCollection : NULL
Expand All @@ -84,6 +90,7 @@ TEveEventDisplayHelix : {
addTrkExtTrajs : false
addMCTraj : true
}
particles : [11,13,2212,2112,211,22,212]
}

TEveEventDisplayCosmics : {
Expand All @@ -96,17 +103,18 @@ TEveEventDisplayCosmics : {
CaloClusterCollection : NULL
CaloHitCollection : NULL
HelixSeedCollection : NULL
KalSeedCollection : NULL
KalSeedCollection : []
TrkExtTrajCollection : NULL
MCTrajectoryCollection : "compressDigiMCs"
addHits : true
addTracks : true
addCrvHits : true
addCrvHits : false
addCosmicSeedFit : false
addClusters : false
addTrkExtTrajs : false
addMCTraj : true
addMCTraj : false
}
particles : [11,13,2212,2112,211,22,212]
}


Expand Down
17 changes: 7 additions & 10 deletions TEveEventDisplay/src/Collection_Filler.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#include <TObject.h>
#include <TSystem.h>
#include <TFile.h>
#include "TEveEventDisplay/src/dict_classes/Collection_Filler.h"
#include "art/Framework/Principal/SubRun.h"

#include "TEveEventDisplay/src/dict_classes/Collection_Filler.h"
using namespace mu2e;
namespace mu2e{

Expand All @@ -29,15 +25,17 @@ namespace mu2e{
{}



/*------------Function to turn InputTag to string for track labels:-------------*/
template <typename T>
std::string TurnNameToString( const T& value )
{
std::ostringstream ss;
ss << value;
return ss.str();
}



/*------------Function to fill RecoDataProduct lists:-------------*/
void Collection_Filler::FillRecoCollections(const art::Event& evt, Data_Collections &data, RecoDataProductName CollectionName){
if(FillAll_ or RecoOnly_ or (addHits_ and CollectionName == ComboHits)){
auto chH = evt.getValidHandle<mu2e::ComboHitCollection>(chTag_);
Expand Down Expand Up @@ -67,7 +65,7 @@ namespace mu2e{
data.track_list.push_back(data.kalseedcol);

std::string name = TurnNameToString(tag);
std::cout<<"adding "<<name<<" size "<<data.track_list.size()<<std::endl;
std::cout<<"Plotting KalSeed Instance: "<<name<<std::endl;
data.track_labels.push_back(name);

}
Expand All @@ -83,10 +81,9 @@ namespace mu2e{
}
}


/*------------Function to fill MCDataProduct lists:-------------*/
void Collection_Filler::FillMCCollections(const art::Event& evt, Data_Collections &data, MCDataProductName CollectionName){
if(FillAll_ or MCOnly_ or (addMCTraj_ and CollectionName == MCTrajectories)){
std::cout<<" Filling MC Traj "<<std::endl;
auto chH = evt.getValidHandle<mu2e::MCTrajectoryCollection>(mctrajTag_);
data.mctrajcol = chH.product();
}
Expand Down
30 changes: 5 additions & 25 deletions TEveEventDisplay/src/Geom_Interface.cc
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
#include <TObject.h>
#include <TSystem.h>
// ... libRIO
#include <TFile.h>
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Run.h"
//Geom:
#include "GeometryService/inc/GeomHandle.hh"
#include "GeometryService/inc/DetectorSystem.hh"
#include "GeometryService/inc/WorldG4.hh"
#include "GeometryService/inc/WorldG4Maker.hh"
#include "GeometryService/inc/TrackerMaker.hh"
#include "GeometryService/inc/Mu2eHallMaker.hh"
#include "GeometryService/inc/G4GeometryOptions.hh"
//Mu2e Tracker Geom:
#include "TrackerGeom/inc/Tracker.hh"
#include "GeometryService/inc/Mu2eCoordTransform.hh"
#include "BFieldGeom/inc/BFieldManager.hh"
#include "Mu2eUtilities/inc/SimParticleTimeOffset.hh"
#include "TrkDiag/inc/TrkMCTools.hh"
//TEve

#include "TEveEventDisplay/src/dict_classes/Geom_Interface.h"

using namespace mu2e;
Expand Down Expand Up @@ -95,7 +75,6 @@ namespace mu2e{
static std::vector <std::string> substrings { "Ceiling",
"backfill", "dirt", "concrete", "VirtualDetector",
"pipeType","ExtShield", "PSShield"};
//,"CRSAluminium","CRV","CRS",
for(auto& i: substrings) hideNodesByName(node,i,kFALSE, 0);
static std::vector <std::string> materials { "MBOverburden", "CONCRETE"};
for(auto& i: materials) hideNodesByMaterial(node,i,kFALSE);
Expand Down Expand Up @@ -129,10 +108,11 @@ namespace mu2e{
}
}

//Useful function to extract heirarchy of tracker (not used anywhere)
void Geom_Interface::TrackerVolumeHeirarchy( TGeoNode * node, std::vector<CLHEP::Hep3Vector> &TransformList ){
std::string _name = (node->GetVolume()->GetName());
if( _name == "HallAir") {
cout<<"HallAir Origin IS "<<node->GetMotherVolume()->GetName();
std::cout<<"HallAir Origin IS "<<node->GetMotherVolume()->GetName();
TGeoVolume *vol = node->GetVolume();
TGeoBBox *shape = (TGeoBBox*)vol->GetShape();
Double_t master[3];
Expand All @@ -144,7 +124,7 @@ namespace mu2e{
}
}
if( _name == "DS3Vacuum") {
cout<<"DS3 Origin IS "<<node->GetMotherVolume()->GetName();
std::cout<<"DS3 Origin IS "<<node->GetMotherVolume()->GetName();
TGeoVolume *vol = node->GetVolume();
TGeoBBox *shape = (TGeoBBox*)vol->GetShape();
Double_t master[3];
Expand All @@ -156,7 +136,7 @@ namespace mu2e{
}
}
if( _name == "TrackerMother") {
cout<<"Tracker Origin IS "<<node->GetMotherVolume()->GetName();
std::cout<<"Tracker Origin IS "<<node->GetMotherVolume()->GetName();
TGeoVolume *vol = node->GetVolume();
TGeoBBox *shape = (TGeoBBox*)vol->GetShape();
Double_t master[3];
Expand Down
15 changes: 11 additions & 4 deletions TEveEventDisplay/src/TEveEventDisplay_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ namespace mu2e
fhicl::Atom<bool> showBuilding{Name("showBuilding"), Comment("set false to remove building"),false};
fhicl::Atom<bool> showDSOnly{Name("showDSOnly"), Comment(""),true};
fhicl::Atom<bool> showEvent{Name("showEvent"), Comment(""),true};

fhicl::Atom<bool> isMCOnly{Name("isMCOnly"), Comment(""),false};
fhicl::Atom<bool> accumulate{Name("accumulate"), Comment(""),false};
fhicl::Table<Collection_Filler::Config> filler{Name("filler"),Comment("fill collections")};
//fhicl::Table<TEveMu2eMCInterface::Config> particles{Name("particles"),Comment("particles to plot")};
fhicl::Sequence<int>particles{Name("particles"),Comment("PDGcodes to plot")};
};

typedef art::EDAnalyzer::Table<Config> Parameters;
Expand All @@ -55,11 +57,13 @@ namespace mu2e
bool _showBuilding;
bool _showDSOnly;
bool _showCRV;
bool _showEvent;
bool _showEvent;
bool _isMCOnly;
bool _accumulate;
TApplication* application_;
TDirectory* directory_ = nullptr;
Collection_Filler _filler;
std::vector<int> _particles;
TEveMu2eMainWindow *_frame;
fhicl::ParameterSet _pset;
bool foundEvent = false;
Expand All @@ -78,8 +82,10 @@ namespace mu2e
_showDSOnly(conf().showDSOnly()),
_showCRV(conf().showCRV()),
_showEvent(conf().showEvent()),
_isMCOnly(conf().isMCOnly()),
_accumulate(conf().accumulate()),
_filler(conf().filler())
_filler(conf().filler()),
_particles(conf().particles())
{}


Expand All @@ -95,6 +101,7 @@ namespace mu2e
}
_frame = new TEveMu2eMainWindow(gClient->GetRoot(), 1000,600, _pset);
_frame->StartProjectionTabs();
_frame->SetParticleOpts(_particles);

}

Expand All @@ -121,7 +128,7 @@ namespace mu2e
if(_filler.addTracks_)_filler.FillRecoCollections(event, data, KalSeeds);
if(_filler.addClusters_)_filler.FillRecoCollections(event, data, CaloClusters);
if(_filler.addMCTraj_)_filler.FillMCCollections(event, data, MCTrajectories);
if(!_frame->isClosed()) _frame->setEvent(event, _firstLoop, data, -1, _accumulate, runn, eventn, eventSelected);
if(!_frame->isClosed()) _frame->setEvent(event, _firstLoop, data, -1, _accumulate, runn, eventn, eventSelected, _isMCOnly);
_firstLoop = false;
}
}
Expand Down
4 changes: 1 addition & 3 deletions TEveEventDisplay/src/TEveMu2eCRV.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#include "TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h"
#include "TEveEventDisplay/src/dict_classes/GeomUtils.h"

#include <TBox.h>
#include <TGeoBBox.h>
using namespace mu2e;
namespace mu2e{
TEveMu2eCRV::TEveMu2eCRV(){};

/*------------Function to draw CRV geometry in 2D:-------------*/
void TEveMu2eCRV::DrawCRVDetector(art::Run const& run, TGeoVolume* topvol, TEveElementList *orthodetlist[]){
TGeoMaterial *matSi = new TGeoMaterial("Si", 28.085,14,2.33);
TGeoMedium *Si = new TGeoMedium("Silicon",2, matSi);
Expand Down
Loading

0 comments on commit c2dc425

Please sign in to comment.