diff --git a/TEveEventDisplay/CallerFclExamples/POT.fcl b/TEveEventDisplay/CallerFclExamples/POT.fcl new file mode 100644 index 0000000000..8f7aeee477 --- /dev/null +++ b/TEveEventDisplay/CallerFclExamples/POT.fcl @@ -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_*_*_*" ] diff --git a/TEveEventDisplay/CallerFclExamples/cosmicExample.fcl b/TEveEventDisplay/CallerFclExamples/cosmicExample.fcl deleted file mode 100644 index 7a9d80cf63..0000000000 --- a/TEveEventDisplay/CallerFclExamples/cosmicExample.fcl +++ /dev/null @@ -1,50 +0,0 @@ -# Sophie Middleton test fcl @sequence::TrkAna.EndSequence -#include "fcl/minimalMessageService.fcl" -#include "fcl/standardProducers.fcl" -#include "fcl/standardServices.fcl" -#include "TrkDiag/fcl/prolog.fcl" -#include "TrkPatRec/fcl/prolog.fcl" -#include "TrackerConditions/fcl/prolog.fcl" -#include "TrkHitReco/fcl/prolog.fcl" -#include "CosmicReco/fcl/prolog.fcl" -#include "TEveEventDisplay/fcl/prolog.fcl" -#include "JobConfig/reco/mcdigis_nocosmic.fcl" - -source : { module_type : RootInput} - -StrawPhysics.useNonLinearDrift: false -StrawDrift.phiBins: 20 -StrawResponse.linearDriftVelocity: 0.0625 - -services : @local::Services.Reco - - -process_name : CosmicExample - -physics : -{ - - producers : { @table::CosmicTracking.producers - @table::TrkHitReco.producers - TimeClusterFinderCosmics : @local::TimeClusterFinderCosmics - CosmicTrackFinder : @local::CosmicTrackFinder} - analyzers : { - @table::CosmicTracking.analyzers - @table::TEveDis.analyzers - } - filters : { - @table::CosmicTracking.filters - @table::TEveDis.filters - } -} -# for MDC2018g and earlier, correct the time maps. Comment these out for MDC2018h and beyond - -physics.RecoPath : [EventFilter, @sequence::TrkHitReco.PrepareHits]// @sequence::CosmicTracking.FindCosmics] -physics.producers.TimeClusterFinderCosmics.UseCaloCluster : false -physics.producers.TimeClusterFinderCosmics.UseCaloClusterPosition : false - -physics.EndPath : [ @sequence::TEveDis.seqCosmics] -physics.producers.CosmicTrackFinder.ComboHitCollection : "makePH" -physics.analyzers.CosmicAnalysis.TimeClusterCollection : TimeClusterFinderCosmics - - diff --git a/TEveEventDisplay/CallerFclExamples/cosmictracks.fcl b/TEveEventDisplay/CallerFclExamples/cosmictracks.fcl index 31a684c0dc..0b43456abc 100644 --- a/TEveEventDisplay/CallerFclExamples/cosmictracks.fcl +++ b/TEveEventDisplay/CallerFclExamples/cosmictracks.fcl @@ -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} @@ -33,7 +33,7 @@ physics : } filters : { @table::CosmicTracking.filters - @table::TEveDis.filters + } } diff --git a/TEveEventDisplay/README.md b/TEveEventDisplay/README.md index f2d781ce30..abeefbe5a1 100644 --- a/TEveEventDisplay/README.md +++ b/TEveEventDisplay/README.md @@ -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. diff --git a/TEveEventDisplay/fcl/prolog.fcl b/TEveEventDisplay/fcl/prolog.fcl index 4f1b31fd61..257e8ac773 100644 --- a/TEveEventDisplay/fcl/prolog.fcl +++ b/TEveEventDisplay/fcl/prolog.fcl @@ -15,6 +15,7 @@ TEveEventDisplayBase : { showBuilding : false showDSOnly : true showEvent : true + isMCOnly : false filler : { ComboHitCollection : "makeSH" CrvRecoPulseCollection : "CrvRecoPulses" @@ -34,12 +35,14 @@ 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 @@ -47,7 +50,7 @@ TEveEventDisplayUpstream : { CrvRecoPulseCollection : NULL CaloClusterCollection : NULL CaloHitCollection : NULL - MCTrajectoryCollection : "g4run" + MCTrajectoryCollection : "BeamFilter" #"g4run" HelixSeedCollection : NULL KalSeedCollection : [NULL] TrkExtTrajCollection : NULL @@ -57,6 +60,8 @@ TEveEventDisplayUpstream : { addCosmicSeedFit : false addMCTraj : true } + particles : [11,13,2212,2112,211,22,212] + } TEveEventDisplayHelix : { @@ -66,6 +71,7 @@ TEveEventDisplayHelix : { showBuilding : false showDSOnly : true showEvent : true + isMCOnly : false filler : { ComboHitCollection : "makeSH" CrvRecoPulseCollection : NULL @@ -84,6 +90,7 @@ TEveEventDisplayHelix : { addTrkExtTrajs : false addMCTraj : true } + particles : [11,13,2212,2112,211,22,212] } TEveEventDisplayCosmics : { @@ -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] } diff --git a/TEveEventDisplay/src/Collection_Filler.cc b/TEveEventDisplay/src/Collection_Filler.cc index 0880af0be6..606c6c601e 100644 --- a/TEveEventDisplay/src/Collection_Filler.cc +++ b/TEveEventDisplay/src/Collection_Filler.cc @@ -1,9 +1,5 @@ -#include -#include -#include -#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{ @@ -29,7 +25,7 @@ namespace mu2e{ {} - + /*------------Function to turn InputTag to string for track labels:-------------*/ template std::string TurnNameToString( const T& value ) { @@ -37,7 +33,9 @@ namespace mu2e{ 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(chTag_); @@ -67,7 +65,7 @@ namespace mu2e{ data.track_list.push_back(data.kalseedcol); std::string name = TurnNameToString(tag); - std::cout<<"adding "<(mctrajTag_); data.mctrajcol = chH.product(); } diff --git a/TEveEventDisplay/src/Geom_Interface.cc b/TEveEventDisplay/src/Geom_Interface.cc index 723cc31713..2533d0f5f5 100644 --- a/TEveEventDisplay/src/Geom_Interface.cc +++ b/TEveEventDisplay/src/Geom_Interface.cc @@ -1,24 +1,4 @@ -#include -#include -// ... libRIO -#include -#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; @@ -95,7 +75,6 @@ namespace mu2e{ static std::vector substrings { "Ceiling", "backfill", "dirt", "concrete", "VirtualDetector", "pipeType","ExtShield", "PSShield"}; - //,"CRSAluminium","CRV","CRS", for(auto& i: substrings) hideNodesByName(node,i,kFALSE, 0); static std::vector materials { "MBOverburden", "CONCRETE"}; for(auto& i: materials) hideNodesByMaterial(node,i,kFALSE); @@ -129,10 +108,11 @@ namespace mu2e{ } } + //Useful function to extract heirarchy of tracker (not used anywhere) void Geom_Interface::TrackerVolumeHeirarchy( TGeoNode * node, std::vector &TransformList ){ std::string _name = (node->GetVolume()->GetName()); if( _name == "HallAir") { - cout<<"HallAir Origin IS "<GetMotherVolume()->GetName(); + std::cout<<"HallAir Origin IS "<GetMotherVolume()->GetName(); TGeoVolume *vol = node->GetVolume(); TGeoBBox *shape = (TGeoBBox*)vol->GetShape(); Double_t master[3]; @@ -144,7 +124,7 @@ namespace mu2e{ } } if( _name == "DS3Vacuum") { - cout<<"DS3 Origin IS "<GetMotherVolume()->GetName(); + std::cout<<"DS3 Origin IS "<GetMotherVolume()->GetName(); TGeoVolume *vol = node->GetVolume(); TGeoBBox *shape = (TGeoBBox*)vol->GetShape(); Double_t master[3]; @@ -156,7 +136,7 @@ namespace mu2e{ } } if( _name == "TrackerMother") { - cout<<"Tracker Origin IS "<GetMotherVolume()->GetName(); + std::cout<<"Tracker Origin IS "<GetMotherVolume()->GetName(); TGeoVolume *vol = node->GetVolume(); TGeoBBox *shape = (TGeoBBox*)vol->GetShape(); Double_t master[3]; diff --git a/TEveEventDisplay/src/TEveEventDisplay_module.cc b/TEveEventDisplay/src/TEveEventDisplay_module.cc index 9870df56d3..142da1c275 100644 --- a/TEveEventDisplay/src/TEveEventDisplay_module.cc +++ b/TEveEventDisplay/src/TEveEventDisplay_module.cc @@ -37,9 +37,11 @@ namespace mu2e fhicl::Atom showBuilding{Name("showBuilding"), Comment("set false to remove building"),false}; fhicl::Atom showDSOnly{Name("showDSOnly"), Comment(""),true}; fhicl::Atom showEvent{Name("showEvent"), Comment(""),true}; - + fhicl::Atom isMCOnly{Name("isMCOnly"), Comment(""),false}; fhicl::Atom accumulate{Name("accumulate"), Comment(""),false}; fhicl::Table filler{Name("filler"),Comment("fill collections")}; + //fhicl::Table particles{Name("particles"),Comment("particles to plot")}; + fhicl::Sequenceparticles{Name("particles"),Comment("PDGcodes to plot")}; }; typedef art::EDAnalyzer::Table Parameters; @@ -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 _particles; TEveMu2eMainWindow *_frame; fhicl::ParameterSet _pset; bool foundEvent = false; @@ -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()) {} @@ -95,6 +101,7 @@ namespace mu2e } _frame = new TEveMu2eMainWindow(gClient->GetRoot(), 1000,600, _pset); _frame->StartProjectionTabs(); + _frame->SetParticleOpts(_particles); } @@ -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; } } diff --git a/TEveEventDisplay/src/TEveMu2eCRV.cc b/TEveEventDisplay/src/TEveMu2eCRV.cc index ed01e0ef25..1f833b6821 100644 --- a/TEveEventDisplay/src/TEveMu2eCRV.cc +++ b/TEveEventDisplay/src/TEveMu2eCRV.cc @@ -1,12 +1,10 @@ #include "TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" -#include -#include 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); diff --git a/TEveEventDisplay/src/TEveMu2eCRVEvent.cc b/TEveEventDisplay/src/TEveMu2eCRVEvent.cc index 7015c80167..b99adabfca 100644 --- a/TEveEventDisplay/src/TEveMu2eCRVEvent.cc +++ b/TEveEventDisplay/src/TEveMu2eCRVEvent.cc @@ -5,29 +5,32 @@ namespace mu2e{ TEveMu2eCRVEvent::TEveMu2eCRVEvent(){} - std::string TEveMu2eCRVEvent::DataTitle(const std::string &pstr, int n){ - std::string dstr=" hit#" + std::to_string(n) + "\nLayer: "; - std::string strlab=pstr+dstr; - return (strlab); + /*------------Function to build title:-------------*/ + std::string TEveMu2eCRVEvent::DataTitle(const std::string &pstr, int n){ + std::string dstr=" hit#" + std::to_string(n) + "\nLayer: "; + std::string strlab=pstr+dstr; + return (strlab); } - + + /*------------Function to 3D draw hits:-------------*/ void TEveMu2eCRVEvent::DrawHit3D(const std::string &pstr, Int_t n, CLHEP::Hep3Vector pointInMu2e, TEveElementList *HitList) - { + { this->SetTitle((DataTitle(pstr, n)).c_str()); this->SetNextPoint(pointInMu2e.x(), pointInMu2e.y(), pointInMu2e.z()); - this->SetMarkerColor(mColor); - this->SetMarkerSize(mSize); + this->SetMarkerColor(mColor_); + this->SetMarkerSize(mSize_); this->SetPickable(kTRUE); HitList->AddElement(this); } - + + /*------------Function to 2D draw hits:-------------*/ void TEveMu2eCRVEvent::DrawHit2D(const std::string &pstr, Int_t n, CLHEP::Hep3Vector pointInMu2e, TEveElementList *HitList) { this->SetTitle((DataTitle(pstr, n)).c_str()); hep3vectorTocm(pointInMu2e); this->SetNextPoint(pointInMu2e.x(), pointInMu2e.y(), pointInMu2e.z()); - this->SetMarkerColor(mColor); - this->SetMarkerSize(mSize); + this->SetMarkerColor(mColor_); + this->SetMarkerSize(mSize_); this->SetPickable(kTRUE); HitList->AddElement(this); } diff --git a/TEveEventDisplay/src/TEveMu2eCalorimeter.cc b/TEveEventDisplay/src/TEveMu2eCalorimeter.cc index 37311e035f..232a00cc49 100644 --- a/TEveEventDisplay/src/TEveMu2eCalorimeter.cc +++ b/TEveEventDisplay/src/TEveMu2eCalorimeter.cc @@ -1,13 +1,11 @@ #include "TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" -#include "GeometryService/inc/DetectorSystem.hh" -#include -#include + using namespace mu2e; namespace mu2e{ TEveMu2eCalorimeter::TEveMu2eCalorimeter(){}; - + + /*------------Function to construct calorimeter (for 2D only):-------------*/ void TEveMu2eCalorimeter::DrawCaloDetector(art::Run const& run, TGeoVolume* topvol, TEveElementList *orthodet0, TEveElementList *orthodet1){ TGeoMaterial *mat = new TGeoMaterial("CsI", 28.085,14,2.33); TGeoMedium *CsI = new TGeoMedium("CsI",2, mat); diff --git a/TEveEventDisplay/src/TEveMu2eCluster.cc b/TEveEventDisplay/src/TEveMu2eCluster.cc index c902b39efd..fc2f32ba10 100644 --- a/TEveEventDisplay/src/TEveMu2eCluster.cc +++ b/TEveEventDisplay/src/TEveMu2eCluster.cc @@ -1,19 +1,21 @@ #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" + using namespace mu2e; namespace mu2e{ TEveMu2eCluster::TEveMu2eCluster(){} + /*------------Function to make object title:-------------*/ std::string TEveMu2eCluster::DataTitle(const std::string &pstr, double edep){ std::string dstr= "\nLayer: "; std::string strlst=pstr+dstr+std::to_string(edep); return(strlst); } + /*------------Function to draw cluster and optional hits:-------------*/ void TEveMu2eCluster::DrawCluster(const std::string &pstr, CLHEP::Hep3Vector cog, int energylevel, TEveElementList *ClusterList, std::vector hits, bool addHits) { - double edep = fCaloCluster.energyDep(); + double edep = fCaloCluster_.energyDep(); this->SetTitle((DataTitle(pstr, edep)).c_str()); hep3vectorTocm(cog); Int_t mSize = 3; @@ -25,7 +27,6 @@ namespace mu2e{ this->SetPickable(kTRUE); if(addHits){ - TEvePointSet *teve_hit2D = new TEvePointSet(); for(unsigned int h =0 ; h < hits.size();h++) { teve_hit2D->SetNextPoint(hits[h].x(), hits[h].y(), hits[h].z()); @@ -35,11 +36,10 @@ namespace mu2e{ ClusterList->AddElement(teve_hit2D); } } - - ClusterList->AddElement(this); } + /*------------Function to draw hits:-------------*/ void TEveMu2eCluster::DrawCrystalHits(const std::string &pstr, CLHEP::Hep3Vector cog, TEveElementList *ClusterList){ hep3vectorTocm(cog); Int_t mSize = 2; diff --git a/TEveEventDisplay/src/TEveMu2eCustomHelix.cc b/TEveEventDisplay/src/TEveMu2eCustomHelix.cc index cb8adb0979..1ab8e1632d 100644 --- a/TEveEventDisplay/src/TEveMu2eCustomHelix.cc +++ b/TEveEventDisplay/src/TEveMu2eCustomHelix.cc @@ -1,68 +1,48 @@ #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h" -#include "GlobalConstantsService/inc/GlobalConstantsHandle.hh" -#include "GlobalConstantsService/inc/ParticleDataTable.hh" using namespace mu2e; namespace mu2e{ TEveMu2eCustomHelix::TEveMu2eCustomHelix(){}; - - TEveMu2eCustomHelix::TEveMu2eCustomHelix(HelixSeed hseed){fHelixSeed = hseed;}; - TEveMu2eCustomHelix::TEveMu2eCustomHelix(KalSeed kseed){ - fKalSeed = kseed; // why is a deep copy being made? FIXME - auto const& fseg = fKalSeed.segments().front(); // this is the segment at the earliest point, impossible to know if it's what the user wants FIXME! - this->Momentum = fseg.mom(); - this->PDGcode = fKalSeed.particle(); - auto const& ptable = mu2e::GlobalConstantsHandle(); - this->Charge = ptable->particle(fKalSeed.particle()).ref().charge(); - this->Mass = ptable->particle(fKalSeed.particle()).ref().mass().value(); - // the following uses deprecated legacy functions and should be refactored away FIXME - this->Radius = fabs(1.0/fseg.helix().omega()); // radius only makes sense if there is a magnetic field, this implementation restricts the display to helices FIXME - this->Time = fKalSeed.t0().t0(); - }; + /*------------Function to build Infor after contruction:-------------*/ void TEveMu2eCustomHelix::SetSeedInfo(KalSeed seed) { - // this function is identical to the constructor above, it should be consolidated FIXME - fKalSeed = seed; // class variables have no underscore, violates Mu2e coding guidelines FIXME - auto const& fseg = fKalSeed.segments().front(); - this->Momentum = fseg.mom(); - this->PDGcode = fKalSeed.particle(); + fKalSeed_ = seed; + auto const& fseg = fKalSeed_.segments().front(); + this->Momentum_ = fseg.mom(); + this->PDGcode_ = fKalSeed_.particle(); auto const& ptable = mu2e::GlobalConstantsHandle(); - this->Charge = ptable->particle(fKalSeed.particle()).ref().charge(); - this->Mass = ptable->particle(fKalSeed.particle()).ref().mass().value(); - this->Radius = fabs(1.0/fseg.helix().omega()); - this->Time = fKalSeed.t0().t0(); - } - - void TEveMu2eCustomHelix::SetPostionAndDirectionFromHelixSeed(double zpos){// how is this function used? Does the user really want helix seed info? FIXME! - fHelixSeed.helix().position(Position); - fHelixSeed.helix().direction(zpos, Direction); + this->Charge_ = ptable->particle(fKalSeed_.particle()).ref().charge(); + this->Mass_ = ptable->particle(fKalSeed_.particle()).ref().mass().value(); + this->Radius_ = fabs(1.0/fseg.helix().omega()); + this->Time_ = fKalSeed_.t0().t0(); } + /*------------Function tobuild position and direction based on Kal output:-------------*/ void TEveMu2eCustomHelix::SetPostionAndDirectionFromKalRep(double zpos){ - auto const& fseg = fKalSeed.segments().front(); // find the segment nearest zpos. This should be iterative FIXME + auto const& fseg = fKalSeed_.segments().front(); // find the segment nearest zpos. This should be iterative FIXME auto pos = fseg.position3(); auto vel = fseg.velocity(); double tz = fseg.tref() + (zpos-pos.Z())/vel.Z(); - auto zseg = fKalSeed.nearestSeg(tz); + auto zseg = fKalSeed_.nearestSeg(tz); pos = zseg->position3(); vel = zseg->velocity(); tz = zseg->tref() + (zpos-pos.Z())/vel.Z(); - this->Momentum = zseg->mom(); + this->Momentum_ = zseg->mom(); // these next assume a helix FIXME auto hel = zseg->centralHelix(); - Position = hel.position3(tz); // class variables have no underscore, violates Mu2e coding guidelines FIXME - Direction = hel.direction(tz); // class variables have no underscore, violates Mu2e coding guidelines FIXME + Position_ = hel.position3(tz); + Direction_ = hel.direction(tz); } - void TEveMu2eCustomHelix::SetMomentumExt(){ - this->Momentum = fTrkExtTraj.front().momentum().mag(); // Not sure what this is supposed to do FIXME + /*void TEveMu2eCustomHelix::SetMomentumExt(){ + this->Momentum_ = fTrkExtTraj.front().momentum().mag(); // Not sure what this is supposed to do FIXME } void TEveMu2eCustomHelix::SetParticleExt(){ - this->PDGcode = 11; + this->PDGcode_ = 11; - } + }*/ } diff --git a/TEveEventDisplay/src/TEveMu2eDataInterface.cc b/TEveEventDisplay/src/TEveMu2eDataInterface.cc index 385511be07..b8da1c6e06 100644 --- a/TEveEventDisplay/src/TEveMu2eDataInterface.cc +++ b/TEveEventDisplay/src/TEveMu2eDataInterface.cc @@ -1,19 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" -#include "TrkReco/inc/TrkUtilities.hh" +#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h" using namespace mu2e; namespace mu2e{ + /*------------Function delete previous event from display:-------------*/ template void DataLists(T data, bool Redraw, bool accumulate, std::string title, TEveElementList **List3D, TEveElementList **List2D = 0, U projection = 0){ if(data == 0 && Redraw){ if (*List3D != 0){ @@ -46,33 +37,35 @@ namespace mu2e{ } } - -template void maxminE(L data, double &max, double &min){ - auto order = std::minmax_element(data->begin(), data->end(), - [] (auto const& lhs, auto const& rhs) { return lhs.energyDep() < rhs.energyDep(); }); - int min_pos = order.first - data->begin(); - int max_pos = order.second - data->begin(); - min = data->at(min_pos).energyDep(); - max = data->at(max_pos).energyDep(); - } -template void maxminT(L data, double &max, double &min){ - auto order = std::minmax_element(data->begin(), data->end(), - [] (auto const& lhs, auto const& rhs) { return lhs.time() < rhs.time(); }); - int min_pos = order.first - data->begin(); - int max_pos = order.second - data->begin(); - min = data->at(min_pos).time(); - max = data->at(max_pos).time(); + /*------------Function to get max and min energy in an event from the colour scheme:-------------*/ + template void maxminE(L data, double &max, double &min){ + auto order = std::minmax_element(data->begin(), data->end(), + [] (auto const& lhs, auto const& rhs) { return lhs.energyDep() < rhs.energyDep(); }); + int min_pos = order.first - data->begin(); + int max_pos = order.second - data->begin(); + min = data->at(min_pos).energyDep(); + max = data->at(max_pos).energyDep(); + } + /*------------Function to get max and min time for time selection:-------------*/ + template void maxminT(L data, double &max, double &min){ + auto order = std::minmax_element(data->begin(), data->end(), + [] (auto const& lhs, auto const& rhs) { return lhs.time() < rhs.time(); }); + int min_pos = order.first - data->begin(); + int max_pos = order.second - data->begin(); + min = data->at(min_pos).time(); + max = data->at(max_pos).time(); + } + /*------------Function to get CRV information since the words are different:-------------*/ + template void maxminCRV(L data, double &max, double &min){ + auto order = std::minmax_element(data->begin(), data->end(), + [] (auto const& lhs, auto const& rhs) { return lhs.GetPulseTime() < rhs.GetPulseTime(); }); + int min_pos = order.first - data->begin(); + int max_pos = order.second - data->begin(); + min = data->at(min_pos).GetPulseTime(); + max = data->at(max_pos).GetPulseTime(); } -template void maxminCRV(L data, double &max, double &min){ - auto order = std::minmax_element(data->begin(), data->end(), - [] (auto const& lhs, auto const& rhs) { return lhs.GetPulseTime() < rhs.GetPulseTime(); }); - int min_pos = order.first - data->begin(); - int max_pos = order.second - data->begin(); - min = data->at(min_pos).GetPulseTime(); - max = data->at(max_pos).GetPulseTime(); -} - - + + /*------------Function to build energy list:-------------*/ template std::vector Energies(L data, int *energylevels[]){ std::vector energies = {0, 0}; double Max_Energy = 0; @@ -92,7 +85,8 @@ template void maxminCRV(L data, double &max, double &min){ return energies; } - + + /*------------Function to build time ordering:-------------*/ std::vector TEveMu2eDataInterface::getTimeRange(bool firstloop, const ComboHitCollection *chcol, const CrvRecoPulseCollection *crvcoincol, const CaloClusterCollection *clustercol, const CaloHitCollection *cryHitcol){ std::vector time = {-1, -1}; double max, min; @@ -131,8 +125,9 @@ template void maxminCRV(L data, double &max, double &min){ if (time.at(1) == -1){time.at(1) = 100;} return time; } - - void TEveMu2eDataInterface::AddCRVInfo(bool firstloop, const CrvRecoPulseCollection *crvcoincol, double min_time, double max_time, bool Redraw, bool accumulate){ + + /*------------Function to add CRV information to the display:-------------*/ + void TEveMu2eDataInterface::AddCRVInfo(bool firstloop, const CrvRecoPulseCollection *crvcoincol, double min_time, double max_time, bool Redraw, bool accumulate){ DataLists(crvcoincol, Redraw, accumulate, "CRVRecoPulse", &fCrvList3D, &fCrvList2D); if(crvcoincol!=0){ @@ -157,13 +152,14 @@ template void maxminCRV(L data, double &max, double &min){ gEve->Redraw3D(kTRUE); } } - - std::vector TEveMu2eDataInterface::AddComboHits(bool firstloop, const ComboHitCollection *chcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, double min_energy, double max_energy, double min_time, double max_time, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ + /*------------Function to add ComboHits to Tracker in 3D and 2D displays:-------------*/ + std::vector TEveMu2eDataInterface::AddComboHits(bool firstloop, const ComboHitCollection *chcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, double min_energy, double max_energy, double min_time, double max_time, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ + std::vector energies = {0,0}; DataLists(chcol, Redraw, accumulate, "ComboHit", &fHitsList3D, &fHitsList2D, tracker2Dproj); - TXYMgr->ImportElements(fHitsList2D, scene1); - TRZMgr->ImportElements(fHitsList2D, scene2); + TXYMgr->ImportElements(fHitsList2D, scene1); + TRZMgr->ImportElements(fHitsList2D, scene2); if(chcol!=0){ TEveElementList *HitList2D = new TEveElementList("ComboHits2D"); TEveElementList *HitList3D = new TEveElementList("ComboHits3D"); @@ -188,15 +184,9 @@ template void maxminCRV(L data, double &max, double &min){ fHitsList2D->AddElement(HitList2D); fHitsList3D->AddElement(HitList3D); - - //TXYMgr->ImportElements(HitList2D); - //TRZMgr->ImportElements(HitList3D); } } - - //tracker2Dproj->fXYMgr->ImportElements(HitList2D, tracker2Dproj->fDetXYScene); - //tracker2Dproj->fRZMgr->ImportElements(HitList2D, tracker2Dproj->fDetRZScene); - + TXYMgr->ImportElements(fHitsList2D, scene1); TRZMgr->ImportElements(fHitsList2D, scene2); gEve->AddElement(HitList3D); @@ -205,14 +195,14 @@ template void maxminCRV(L data, double &max, double &min){ return energies; } - + /*------------Function to add Calo Clusters to 3D and 2D display:-------------*/ std::vector TEveMu2eDataInterface::AddCaloClusters(bool firstloop, const CaloClusterCollection *clustercol, TEveMu2e2DProjection *calo2Dproj, bool Redraw, double min_energy, double max_energy, double min_time, double max_time, bool accumulate, TEveProjectionManager *CfXYMgr, TEveProjectionManager *CfRZMgr, TEveScene *scene1, TEveScene *scene2){ vector energies = {0, 0}; - std::cout<<"Time interval"<(clustercol, Redraw, accumulate, "CaloCluster", &fClusterList3D, &fClusterList2D_disk0, calo2Dproj); - DataLists(clustercol, Redraw, accumulate, "CaloCluster", &fClusterList3D, &fClusterList2D_disk1, calo2Dproj); - CfXYMgr->ImportElements(fClusterList2D_disk0, scene1); - CfRZMgr->ImportElements(fClusterList2D_disk1, scene2); + + DataLists(clustercol, Redraw, accumulate, "CaloCluster", &fClusterList3D, &fClusterList2D_disk0, calo2Dproj); + DataLists(clustercol, Redraw, accumulate, "CaloCluster", &fClusterList3D, &fClusterList2D_disk1, calo2Dproj); + CfXYMgr->ImportElements(fClusterList2D_disk0, scene1); + CfRZMgr->ImportElements(fClusterList2D_disk1, scene2); if(clustercol!=0){ TEveElementList *ClusterList3D = new TEveElementList("CaloClusters3D"); @@ -249,7 +239,6 @@ template void maxminCRV(L data, double &max, double &min){ teve_cluster3D->DrawCluster("CaloCluster3D, Cluster #" + to_string(i + 1) + ", Position =" + pos3D + ", Energy = " + to_string(cluster.energyDep()) + ", Time = " + to_string(cluster.time()), pointInMu2e, energylevels[i], ClusterList3D, hits, addHits); fClusterList3D->AddElement(ClusterList3D); - //fClusterList2D->AddElement(CrystalList2D); if(cluster.diskID()==0){ teve_cluster2D->DrawCluster("CaloCluster3D, Cluster #" + to_string(i + 1) + ", Position =" + pos2D + ", Energy = " + to_string(cluster.energyDep()) + ", Time = " + to_string(cluster.time()), pointInMu2e,energylevels[i], ClusterList2D_disk0, hits, addHits); fClusterList2D_disk0->AddElement(ClusterList2D_disk0); @@ -265,14 +254,13 @@ template void maxminCRV(L data, double &max, double &min){ } } } - gEve->AddElement(fClusterList3D); gEve->Redraw3D(kTRUE); } return energies; } - + /*------------Function to add Crystal hits to 2D and 3D Calo displays:-------------*/ void TEveMu2eDataInterface::AddCrystalHits(bool firstloop, const CaloHitCollection *cryHitcol, TEveMu2e2DProjection *calo2Dproj, double min_time, double max_time, bool Redraw, bool accumulate, TEveProjectionManager *CfXYMgr, TEveProjectionManager *CfRZMgr, TEveScene *scene1, TEveScene *scene2){ vector energies = {0, 0}; Calorimeter const &cal = *(GeomHandle()); @@ -304,65 +292,7 @@ template void maxminCRV(L data, double &max, double &min){ } } - void TEveMu2eDataInterface::AddHelixPieceWise2D(bool firstloop, std::tuple, std::vector> track_tuple, TEveMu2e2DProjection *tracker2Dproj, double min_time, double max_time, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ - - std::vector track_list = std::get<1>(track_tuple); - - std::vector names = std::get<0>(track_tuple); - std::vector colour; - for(unsigned int j=0; j< track_list.size(); j++){ - const KalSeedCollection* seedcol = track_list[j]; - colour.push_back(j+3); - DataLists(seedcol, Redraw, accumulate, "HelixTrack", &fTrackList3D, &fTrackList2D, tracker2Dproj); - TXYMgr->ImportElements(fTrackList2D, scene1); - TRZMgr->ImportElements(fTrackList2D, scene2); - if(seedcol!=0){ - for(unsigned int k = 0; k < seedcol->size(); k = k + 20){ - KalSeed kseed = (*seedcol)[k]; - TEveMu2eCustomHelix *line = new TEveMu2eCustomHelix(); - line->fKalSeed = kseed; - line->SetSeedInfo(kseed); - - unsigned int nSteps = 50; - double kStepSize = 61;//nSteps/(TrackerLength())+70; //+ 70;///TODO CaloLength() + - for(unsigned int i = 0 ; i< nSteps; i++){ - double zpos = (i*kStepSize)-TrackerLength()/2; - if(i==0) { - line->SetPostionAndDirectionFromKalRep(zpos); - CLHEP::Hep3Vector Pos(line->Position.x(), line->Position.y(), zpos+line->Position.z()); - double x = (Pos.x()+line->Direction.x()*line->Momentum); - double y = (Pos.y()+line->Direction.y()*line->Momentum); - double z = (Pos.z()); - CLHEP::Hep3Vector Point(x,y,z); - line->SetPoint(i,pointmmTocm(Point.x()), pointmmTocm(Point.y()), pointmmTocm(Point.z())); - } else { - line->SetPostionAndDirectionFromKalRep(zpos); - CLHEP::Hep3Vector Pos(line->Position.x(), line->Position.y(), zpos+line->Position.z()); - double x = (Pos.x()+line->Direction.x()*line->Momentum); - double y = (Pos.y()+line->Direction.y()*line->Momentum); - double z = (Pos.z()); - CLHEP::Hep3Vector Point(x,y,z); - line->SetNextPoint(pointmmTocm(Point.x()), pointmmTocm(Point.y()), pointmmTocm(Point.z())); - } - } - - line->SetLineColor(colour[j]); - line->SetLineWidth(3); - - const std::string title = "Helix: " + names[j] + "PDG Code = " + to_string(line->PDGcode) +", Momentum = " + to_string(line->Momentum)+ ", Time = " + to_string(line->Time); - line->SetTitle(Form(title.c_str())); - fTrackList2D->AddElement(line); - } - - TXYMgr->ImportElements(fTrackList2D, scene1); - TRZMgr->ImportElements(fTrackList2D, scene2); - gEve->AddElement(fTrackList3D); - gEve->Redraw3D(kTRUE); - } - - } - } - + /*------------Function to add Kalman Reco Helix to the display:-------------*/ void TEveMu2eDataInterface::AddHelixPieceWise3D(bool firstloop, std::tuple, std::vector> track_tuple, TEveMu2e2DProjection *tracker2Dproj, double min_time, double max_time, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ std::vector track_list = std::get<1>(track_tuple); @@ -386,7 +316,7 @@ template void maxminCRV(L data, double &max, double &min){ double fltLMax=segmentLast.fmax(); TEveMu2eCustomHelix *line = new TEveMu2eCustomHelix(); TEveMu2eCustomHelix *line_twoD = new TEveMu2eCustomHelix(); - line->fKalSeed = kseed; + line->fKalSeed_ = kseed; line->SetSeedInfo(kseed); for(size_t m=0; m void maxminCRV(L data, double &max, double &min){ fltLMax=(fltLMax+fltLMinNext)/2.0; } for(double fltL=fltLMin; fltL<=fltLMax; fltL+=1.0){ - GeomHandle det; + GeomHandle det; XYZVec pos; segment.helix().position(fltL,pos); CLHEP::Hep3Vector p = Geom::Hep3Vec(pos); @@ -418,7 +348,7 @@ template void maxminCRV(L data, double &max, double &min){ fTrackList2D->AddElement(line_twoD); line->SetPickable(kTRUE); - const std::string title = "Helix: " + names[j] + "PDG Code = " + to_string(line->PDGcode) +", Momentum = " + to_string(line->Momentum)+ ", Time = " + to_string(line->Time); + const std::string title = "Helix: " + names[j] + "PDG Code = " + to_string(line->PDGcode_) +", Momentum = " + to_string(line->Momentum_)+ ", Time = " + to_string(line->Time_); line->SetTitle(Form(title.c_str())); line->SetLineColor(colour[j]); line->SetLineWidth(3); @@ -434,68 +364,69 @@ template void maxminCRV(L data, double &max, double &min){ } } + /*------------Function to add No Field cosmic track fit to 2D and 3D display:-------------*/ void TEveMu2eDataInterface::AddCosmicTrack(bool firstloop, const CosmicTrackSeedCollection *cosmiccol, TEveMu2e2DProjection *tracker2Dproj, double min_time, double max_time, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ - if(cosmiccol !=0){ - DataLists(cosmiccol, Redraw, accumulate,"CosmicTrack", &fTrackList3D, &fTrackList2D, tracker2Dproj); - TXYMgr->ImportElements(fTrackList2D, scene1); - TRZMgr->ImportElements(fTrackList2D, scene2); - TEveMu2eStraightTrack *line = new TEveMu2eStraightTrack(); - TEveMu2eStraightTrack *line2D = new TEveMu2eStraightTrack(); - for(unsigned int ist = 0; ist < cosmiccol->size(); ++ist){ - - CosmicTrackSeed sts =(*cosmiccol)[ist]; - CosmicTrack st = sts._track; - - line->SetLineColor(kGreen); - - double endY = 0; - double startY = 0; - - endY = sts._straw_chits[sts._straw_chits.size()-1].pos().y(); - startY = sts._straw_chits[0].pos().y(); - - Float_t ty1 = startY; - Float_t ty2 = endY; - Float_t tx1 = st.MinuitParams.A0 - st.MinuitParams.A1*ty1; - Float_t tx2 = st.MinuitParams.A0 - st.MinuitParams.A1*ty2; - Float_t tz1 = st.MinuitParams.B0 - st.MinuitParams.B1*ty1; - Float_t tz2 = st.MinuitParams.B0 - st.MinuitParams.B1*ty2; - line->AddLine(pointmmTocm(tx1-3904), pointmmTocm(ty1), pointmmTocm(tz1+10171), pointmmTocm(tx2-3904), pointmmTocm(ty2), pointmmTocm(tz2+10171)); - const std::string title = "CosmicTrack #" + to_string(ist + 1) + ", Parameters: A0:" + to_string(st.MinuitParams.A0) + ", A1:" + to_string(st.MinuitParams.A1) + ", B0:" + to_string(st.MinuitParams.B0) + ", B1:" + to_string(st.MinuitParams.B1); - line->SetTitle(Form(title.c_str())); - - line2D->AddLine(tx1, ty1, tz1, tx2, ty2, tz2); - line2D->SetPickable(kTRUE); - line2D->SetLineColor(kGreen); - line2D->SetLineWidth(3); - fTrackList2D->AddElement(line2D); - - line->SetPickable(kTRUE); + if(cosmiccol !=0){ + DataLists(cosmiccol, Redraw, accumulate,"CosmicTrack", &fTrackList3D, &fTrackList2D, tracker2Dproj); + TXYMgr->ImportElements(fTrackList2D, scene1); + TRZMgr->ImportElements(fTrackList2D, scene2); + TEveMu2eStraightTrack *line = new TEveMu2eStraightTrack(); + TEveMu2eStraightTrack *line2D = new TEveMu2eStraightTrack(); + for(unsigned int ist = 0; ist < cosmiccol->size(); ++ist){ + + CosmicTrackSeed sts =(*cosmiccol)[ist]; + CosmicTrack st = sts._track; + + line->SetLineColor(kGreen); + + double endY = 0; + double startY = 0; + + endY = sts._straw_chits[sts._straw_chits.size()-1].pos().y(); + startY = sts._straw_chits[0].pos().y(); + + Float_t ty1 = startY; + Float_t ty2 = endY; + Float_t tx1 = st.MinuitParams.A0 - st.MinuitParams.A1*ty1; + Float_t tx2 = st.MinuitParams.A0 - st.MinuitParams.A1*ty2; + Float_t tz1 = st.MinuitParams.B0 - st.MinuitParams.B1*ty1; + Float_t tz2 = st.MinuitParams.B0 - st.MinuitParams.B1*ty2; + line->AddLine(pointmmTocm(tx1-3904), pointmmTocm(ty1), pointmmTocm(tz1+10171), pointmmTocm(tx2-3904), pointmmTocm(ty2), pointmmTocm(tz2+10171)); + const std::string title = "CosmicTrack #" + to_string(ist + 1) + ", Parameters: A0:" + to_string(st.MinuitParams.A0) + ", A1:" + to_string(st.MinuitParams.A1) + ", B0:" + to_string(st.MinuitParams.B0) + ", B1:" + to_string(st.MinuitParams.B1); + line->SetTitle(Form(title.c_str())); + + line2D->AddLine(tx1, ty1, tz1, tx2, ty2, tz2); + line2D->SetPickable(kTRUE); + line2D->SetLineColor(kGreen); + line2D->SetLineWidth(3); + fTrackList2D->AddElement(line2D); + + line->SetPickable(kTRUE); + + line->SetLineColor(kGreen); + line->SetLineWidth(3); + fTrackList3D->AddElement(line); - line->SetLineColor(kGreen); - line->SetLineWidth(3); - fTrackList3D->AddElement(line); + } - } - - tracker2Dproj->fXYMgr->ImportElements(fTrackList2D, tracker2Dproj->fDetXYScene); - tracker2Dproj->fRZMgr->ImportElements(fTrackList2D, tracker2Dproj->fDetRZScene); - - TXYMgr->ImportElements(fTrackList2D, scene1); - TRZMgr->ImportElements(fTrackList2D, scene2); - gEve->AddElement(fTrackList3D); - gEve->Redraw3D(kTRUE); + tracker2Dproj->fXYMgr->ImportElements(fTrackList2D, tracker2Dproj->fDetXYScene); + tracker2Dproj->fRZMgr->ImportElements(fTrackList2D, tracker2Dproj->fDetRZScene); + + TXYMgr->ImportElements(fTrackList2D, scene1); + TRZMgr->ImportElements(fTrackList2D, scene2); + gEve->AddElement(fTrackList3D); + gEve->Redraw3D(kTRUE); } } - //TODO - Note this function is untested and awaits compatibility in current Offline. We made it for future upgrades. + /*TODO - Note this function is untested and awaits compatibility in current Offline. We made it for future upgrades. void TEveMu2eDataInterface::AddTrackExitTrajectories(bool firstloop, const TrkExtTrajCollection *trkextcol, double min_time, double max_time, bool Redraw, bool accumulate) { DataLists(trkextcol, Redraw, accumulate, "TrackExitTraj", &fExtTrackList3D); if(trkextcol!=0){ for(unsigned int i = 0; i < trkextcol->size(); i++){ TrkExtTraj trkext = (*trkextcol)[i]; TEveMu2eCustomHelix *line = new TEveMu2eCustomHelix(); - line->fTrkExtTraj = trkext; + line->fTrkExtTraj_ = trkext; line->SetMomentumExt(); line->SetParticleExt(); @@ -509,7 +440,7 @@ template void maxminCRV(L data, double &max, double &min){ // tracker2Dproj->fXYMgr->ImportElements(fExtTrackList2D, tracker2Dproj->fDetXYScene); // tracker2Dproj->fRZMgr->ImportElements(fExtTrackList2D, tracker2Dproj->fDetRZScene); line->SetPickable(kTRUE); - const std::string title = "Helix #" + to_string(i + 1) + ", Momentum = " + to_string(line->Momentum); + const std::string title = "Helix #" + to_string(i + 1) + ", Momentum = " + to_string(line->Momentum_); line->SetTitle(Form(title.c_str())); line->SetLineColor(kRed); line->SetLineWidth(3); @@ -520,7 +451,5 @@ template void maxminCRV(L data, double &max, double &min){ gEve->Redraw3D(kTRUE); } -} - - + }*/ } diff --git a/TEveEventDisplay/src/TEveMu2eHit.cc b/TEveEventDisplay/src/TEveMu2eHit.cc index db3029af36..3126d64a70 100644 --- a/TEveEventDisplay/src/TEveMu2eHit.cc +++ b/TEveEventDisplay/src/TEveMu2eHit.cc @@ -1,16 +1,18 @@ #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" + using namespace mu2e; namespace mu2e{ TEveMu2eHit::TEveMu2eHit(){} + /*------------Function to build title:-------------*/ std::string TEveMu2eHit::DataTitle(const std::string &pstr, int n){ std::string dstr=" hit#" + std::to_string(n) + "\nLayer: "; std::string strlab=pstr+dstr; return (strlab); } + /*------------Function to 3D draw hits:-------------*/ void TEveMu2eHit::DrawHit3D(const std::string &pstr, Int_t n, CLHEP::Hep3Vector pointInMu2e, int energylevel, TEveElementList *HitList) { this->SetTitle((DataTitle(pstr, n)).c_str()); @@ -18,13 +20,13 @@ namespace mu2e{ this->SetNextPoint(pointInMu2e.x(), pointInMu2e.y(), pointInMu2e.z()); int colors[] = {-7, 3, -6, -1, 9, 0, -4, 10, 1}; this->SetMarkerColor(kSpring + colors[energylevel]); - this->SetMarkerSize(3); + this->SetMarkerSize(mSize_); this->SetPickable(kTRUE); - if(AddErrorBar){ + if(AddErrorBar_){ TEveLine *error = new TEveLine(); - auto const& p = fComboHit.pos(); - auto const& w = fComboHit.wdir(); - auto const& s = fComboHit.wireRes(); + auto const& p = fComboHit_.pos(); + auto const& w = fComboHit_.wdir(); + auto const& s = fComboHit_.wireRes(); double x1 = (p.x()+s*w.x()); double x2 = (p.x()-s*w.x()); double z1 = (p.z()+s*w.z()); @@ -40,13 +42,14 @@ namespace mu2e{ Hep3Vector inDet2 = det->toMu2e(vec2); error->SetPoint(0, pointmmTocm(inDet1.x()),pointmmTocm(inDet1.y()),pointmmTocm(inDet1.z())); error->SetNextPoint(pointmmTocm(inDet2.x()), pointmmTocm(inDet2.y()),pointmmTocm(inDet2.z())); - error->SetLineColor(kRed); + error->SetLineColor(kSpring); error->SetPickable(kTRUE); HitList->AddElement(error); } HitList->AddElement(this); } + /*------------Function to 2D draw hits:-------------*/ void TEveMu2eHit::DrawHit2D(const std::string &pstr, Int_t n, CLHEP::Hep3Vector pointInMu2e, int energylevel, TEveElementList *HitList) { this->SetTitle((DataTitle(pstr, n)).c_str()); @@ -54,14 +57,14 @@ namespace mu2e{ this->SetNextPoint(pointInMu2e.x(), pointInMu2e.y(), pointInMu2e.z()); int colors[] = {-7, 3, -6, -1, 9, 0, -4, 10, 1}; this->SetMarkerColor(kSpring + colors[energylevel]); - this->SetMarkerSize(mSize); + this->SetMarkerSize(mSize_); this->SetPickable(kTRUE); - if(AddErrorBar){ + if(AddErrorBar_){ TEveLine *error = new TEveLine(); - auto const& p = fComboHit.pos(); - auto const& w = fComboHit.wdir(); - auto const& s = fComboHit.wireRes(); + auto const& p = fComboHit_.pos(); + auto const& w = fComboHit_.wdir(); + auto const& s = fComboHit_.wireRes(); double x1 = (p.x()+s*w.x()); double x2 = (p.x()-s*w.x()); double z1 = (p.z()+s*w.z()); diff --git a/TEveEventDisplay/src/TEveMu2eMCInterface.cc b/TEveEventDisplay/src/TEveMu2eMCInterface.cc index 7e30a0a808..6b92ba554c 100644 --- a/TEveEventDisplay/src/TEveMu2eMCInterface.cc +++ b/TEveEventDisplay/src/TEveMu2eMCInterface.cc @@ -1,12 +1,10 @@ -#include -#include -#include -#include + #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCInterface.h" using namespace mu2e; namespace mu2e{ + /*------------Function to clear lists for new events:-------------*/ template void DataLists(T data, bool Redraw, bool accumulate, string title, TEveElementList **List3D, TEveElementList **List2D = 0, U projection = 0){ if(data == 0 && Redraw){ if (*List3D != 0){ @@ -40,6 +38,7 @@ namespace mu2e{ } } + /*------------Function to add straight line MC Trajectory i.e. for Comsics in No field:-------------*/ void TEveMu2eMCInterface::AddSimpleMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ DataLists(trajcol, Redraw, accumulate, "MC Trajectory", &fTrackList3D, &fTrackList2D, tracker2Dproj); if(trajcol!=0){ @@ -76,9 +75,17 @@ namespace mu2e{ } - void TEveMu2eMCInterface::AddFullMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2){ + /*------------Function to help user select a list of PDG codes to display:-------------*/ + int TEveMu2eMCInterface::Contains(std::vector v, int x) + { + return std::count(v.begin(), v.end(), x); + } + + /*------------ + Function to display MCTracjories of any shape, these are made up of a series of TEveLines, in the same way as Reco Helices: + -------------*/ + void TEveMu2eMCInterface::AddFullMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2, std::vector particleIds){ DataLists(trajcol, Redraw, accumulate, "MC Trajectory", &fTrackList3D, &fTrackList2D, tracker2Dproj);//TODO - remove proj - std::cout<<"Adding MCTraj "<ImportElements(fTrackList2D, scene1); TRZMgr->ImportElements(fTrackList2D, scene2); if(trajcol!=0){ @@ -87,49 +94,50 @@ namespace mu2e{ TEveMu2eCustomHelix *line_twoD = new TEveMu2eCustomHelix(); std::map,mu2e::MCTrajectory>::const_iterator trajectoryIter; - + unsigned int g = 0; for(trajectoryIter=trajcol->begin(); trajectoryIter!=trajcol->end(); trajectoryIter++) { + //if(!Contains(particleIds_,abs(trajectoryIter->first->pdgId()))) { continue;} + std::cout<<"Id's "< &points = trajectoryIter->second.points(); for(unsigned int i=0; i det; - CLHEP::Hep3Vector HitPos2D = det->toDetector(Pos); + CLHEP::Hep3Vector Pos(points[i].x(), points[i].y(), points[i].z()); + GeomHandle det; + CLHEP::Hep3Vector HitPos2D = det->toDetector(Pos); - if(i==0) { - - line->SetPoint(i,pointmmTocm(Pos.x()), pointmmTocm(Pos.y()),pointmmTocm(Pos.z())); - line_twoD->SetPoint(i,pointmmTocm(HitPos2D.x()), pointmmTocm(HitPos2D.y()),pointmmTocm(HitPos2D.z())); - } else { - - line->SetNextPoint(pointmmTocm(Pos.x()), pointmmTocm(Pos.y()),pointmmTocm(Pos.z())); - line_twoD->SetNextPoint(pointmmTocm(HitPos2D.x()), pointmmTocm(HitPos2D.y()),pointmmTocm(HitPos2D.z())); - } + if(i==0) { + line->SetPoint(i,pointmmTocm(Pos.x()), pointmmTocm(Pos.y()),pointmmTocm(Pos.z())); + line_twoD->SetPoint(i,pointmmTocm(HitPos2D.x()), pointmmTocm(HitPos2D.y()),pointmmTocm(HitPos2D.z())); + } else { + line->SetNextPoint(pointmmTocm(Pos.x()), pointmmTocm(Pos.y()),pointmmTocm(Pos.z())); + line_twoD->SetNextPoint(pointmmTocm(HitPos2D.x()), pointmmTocm(HitPos2D.y()),pointmmTocm(HitPos2D.z())); + } } string energy = to_string(points[0].kineticEnergy()); - string pdgId= to_string(trajectoryIter->first->pdgId()); - + //string pdgId= to_string(trajectoryIter->first->pdgId()); + std::cout<first->pdgId()<SetLineColor(kRed); line_twoD->SetLineWidth(3); fTrackList2D->AddElement(line_twoD); line->SetPickable(kTRUE); - const std::string title = "MCTrajectory PDG Code = " + pdgId + "Energy = " + energy ; + const std::string title = " MCTrajectory "+ energy;// + "PDG Code = " + pdgId + "Energy = " ; line->SetTitle(Form(title.c_str())); - line->SetLineColor(kRed); + if(abs(trajectoryIter->first->pdgId()) == 11) line->SetLineColor(kRed); //electrons + else if(abs(trajectoryIter->first->pdgId()) == 13) line->SetLineColor(kGreen); //muons + else if(abs(trajectoryIter->first->pdgId()) == 2112) line->SetLineColor(kYellow); //neutron + else if(abs(trajectoryIter->first->pdgId()) == 2212) line->SetLineColor(kRed); //proton + else line->SetLineColor(kCyan); //nuceli line->SetLineWidth(3); fTrackList3D->AddElement(line); - + g++; } TXYMgr->ImportElements(fTrackList2D, scene1); TRZMgr->ImportElements(fTrackList2D, scene2); gEve->AddElement(fTrackList3D); gEve->Redraw3D(kTRUE); - } } - } diff --git a/TEveEventDisplay/src/TEveMu2eMCTraj.cc b/TEveEventDisplay/src/TEveMu2eMCTraj.cc index a658e6d18a..4e0ef08fe3 100644 --- a/TEveEventDisplay/src/TEveMu2eMCTraj.cc +++ b/TEveEventDisplay/src/TEveMu2eMCTraj.cc @@ -1,13 +1,11 @@ #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCTraj.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" -#include "ConfigTools/inc/SimpleConfig.hh" -#include "GeometryService/inc/GeomHandle.hh" -#include "GeometryService/inc/DetectorSystem.hh" + using namespace mu2e; namespace mu2e{ TEveMu2eMCTraj::TEveMu2eMCTraj(){}; + /*------------Function to make track title:-------------*/ std::string TEveMu2eMCTraj::DataTitle(const std::string &pstr, Int_t n){ std::string dstr = ""; if (n != -1){dstr=" hit#" + std::to_string(n) + "\nLayer: ";} @@ -15,6 +13,7 @@ namespace mu2e{ return (strlab); } + /*------------Function to draw 3D line:-------------*/ void TEveMu2eMCTraj::DrawHit3D(const std::string &pstr, Int_t n, CLHEP::Hep3Vector pointInMu2e, TEveElementList *HitList) { this->SetTitle((DataTitle(pstr, n)).c_str()); @@ -26,6 +25,7 @@ namespace mu2e{ HitList->AddElement(this); } + /*------------Function to draw straight line:-------------*/ void TEveMu2eMCTraj::DrawSimpleLine(const std::string &pstr, CLHEP::Hep3Vector Start, CLHEP::Hep3Vector End, TEveElementList *HitList) {//For straight lines only @@ -46,6 +46,7 @@ namespace mu2e{ HitList->AddElement(this); } + /*------------Function to draw full trajectory:-------------*/ void TEveMu2eMCTraj::DrawFullLine(const std::string &pstr, CLHEP::Hep3Vector Start, CLHEP::Hep3Vector End, TEveElementList *HitList) { std::cout<<"Drawing Line"< -#include -#include -// ... libRIO -#include -// ... libGui -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -// ... libRGL -#include -#include -// ... libEve -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include //TEveMu2e: #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMainWindow.h" -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h" -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h" -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h" -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h" -#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eBField.h" namespace fhicl { @@ -46,6 +8,7 @@ namespace fhicl using namespace mu2e; + /*------------Function to make colour scheme:-------------*/ void setRecursiveColorTransp(TGeoVolume *vol, Int_t color, Int_t transp) { if(color>=0)vol->SetLineColor(color); @@ -59,17 +22,16 @@ using namespace mu2e; namespace mu2e{ TEveMu2eMainWindow::TEveMu2eMainWindow() : TGMainFrame(gClient->GetRoot(), 320, 320){} - + + /*------------Function to construct main frame, add buttons and GUI:-------------*/ TEveMu2eMainWindow::TEveMu2eMainWindow(const TGWindow* p, UInt_t w, UInt_t h, fhicl::ParameterSet _pset): TGMainFrame(p, w, h), fTeRun(0), fTeEvt(0), fTTEvt(0), - //fTHSlid(0), fTlRun(0), fTlEvt(0), fTlTEvt(0), - //fTlHSlid(0), br(0), clusterscheck(0), hitscheck(0), @@ -78,17 +40,22 @@ namespace mu2e{ cosmictrkscheck(0), mctrajcheck(0) { - + //Create TEve Manager: TEveManager::Create(); + //Create Browser : gEve->GetBrowser()->GetTabRight()->SetTab(0); gClient->GetRoot(); browser = gEve->GetBrowser(); + //Build GUI (function below) CreateGUI(); + //Build Multiple View Window: CreateMultiViews(); + //Add your Event: gEve->AddEvent(new TEveEventManager("Event", "Empty Event")); } + /*------------Function to create multiple windows for 2D projections:-------------*/ void TEveMu2eMainWindow::CreateMultiViews(){ gEve->GetBrowser()->GetTabRight()->SetTab(0); @@ -102,8 +69,6 @@ namespace mu2e{ fSplitFrame->GetFirst()->VSplit(410); fSplitFrame->GetSecond()->VSplit(410); // get top (main) split frame - - frm = fSplitFrame->GetFirst()->GetFirst(); frm->SetName("Calorimeter_XY_View"); fViewer0 = new TGLEmbeddedViewer(frm, fPad); @@ -210,6 +175,7 @@ namespace mu2e{ } + /*------------Function to create GUI buttons etc.:-------------*/ void TEveMu2eMainWindow::CreateGUI(){ FontStruct_t buttonfont = gClient->GetFontByName("-*-helvetica-medium-r-*-*-8-*-*-*-*-*-iso8859-1"); GCValues_t gval; @@ -368,15 +334,16 @@ namespace mu2e{ } -} - - void TEveMu2eMainWindow::StartProjectionTabs(){ - //pass_proj->CreateCRVProjection(CRV2Dproj); - pass_proj->CreateCaloProjection(calo2Dproj); - pass_proj->CreateTrackerProjection(tracker2Dproj); } + /*------------Function to create 2D Tabs:-------------*/ + void TEveMu2eMainWindow::StartProjectionTabs(){ + //pass_proj->CreateCRVProjection(CRV2Dproj); + pass_proj->CreateCaloProjection(calo2Dproj); + pass_proj->CreateTrackerProjection(tracker2Dproj); + } + /*------------Function to create Calo 2D tab:-------------*/ void TEveMu2eMainWindow::PrepareCaloProjectionTab(const art::Run& run){ calo2Dproj->fDetXYScene->DestroyElements(); calo2Dproj->fDetRZScene->DestroyElements(); @@ -406,7 +373,8 @@ namespace mu2e{ } - + + /*------------Function to create Tracker 2D tab:-------------*/ void TEveMu2eMainWindow::PrepareTrackerProjectionTab(const art::Run& run){ tracker2Dproj->fDetXYScene->DestroyElements(); tracker2Dproj->fDetRZScene->DestroyElements(); @@ -419,10 +387,8 @@ namespace mu2e{ Mu2eTracker->DrawTrackerDetector(run, topvol, orthodetsplit); gEve->AddGlobalElement(orthodet); - - + // ... Import elements of the list into the projected views - TfXYMgr->ImportElements(orthodetsplit); TfRZMgr->ImportElements(orthodetsplit); @@ -440,6 +406,7 @@ namespace mu2e{ tracker2Dproj->fDetRZScene->FindChild("OrthoDet [P]")->SetRnrState(kTRUE); } + /*------------Function to create CRV tab:-------------*/ void TEveMu2eMainWindow::PrepareCRVProjectionTab(const art::Run& run){ CRV2Dproj->fDetXYScene->DestroyElements(); @@ -472,6 +439,7 @@ namespace mu2e{ } + /*------------Function to import the GDML and make 3D geometry:-------------*/ void TEveMu2eMainWindow::SetRunGeometry(const art::Run& run, int _diagLevel, bool _showBuilding, bool _showDSOnly, bool _showCRV){ if(gGeoManager){ gGeoManager->GetListOfNodes()->Delete(); @@ -513,6 +481,7 @@ namespace mu2e{ geom->Draw("ogl"); } + /*------------Function to allow user to recheck the check box, and redraw data:-------------*/ void TEveMu2eMainWindow::RedrawDataProducts(std::string type){ if (type == "Clusters"){ *clusterenergy = pass_data->AddCaloClusters(_firstLoop, _emptydata.clustercol, calo2Dproj,true, fclustmin, fclustmax, ftimemin, ftimemax, _accumulate, CfXYMgr, CfRZMgr, proj0, proj1); @@ -523,7 +492,6 @@ namespace mu2e{ } if (type == "Tracks"){ pass_data->AddHelixPieceWise3D(_firstLoop, _emptydata.track_tuple, tracker2Dproj, ftimemin, ftimemax, true, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); - } if (type == "Cosmics"){ if(_data.crvcoincol!= 0){pass_data->AddCRVInfo(_firstLoop, _emptydata.crvcoincol, ftimemin, ftimemax, true, _accumulate);} @@ -532,14 +500,14 @@ namespace mu2e{ if(_data.cosmiccol!=0){pass_data->AddCosmicTrack(_firstLoop, _emptydata.cosmiccol, tracker2Dproj, ftimemin, ftimemax, true, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3);} } if (type == "MC Trajectories"){ - if(_data.mctrajcol!=0){pass_mc->AddFullMCTrajectory(_firstLoop, _emptydata.mctrajcol, tracker2Dproj, true, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3);} + if(_data.mctrajcol!=0){pass_mc->AddFullMCTrajectory(_firstLoop, _emptydata.mctrajcol, tracker2Dproj, true, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3, particles);} } gSystem->ProcessEvents(); gClient->NeedRedraw(fTeRun); gApplication->Run(true); } - + /*------------Function to call button options:-------------*/ Bool_t TEveMu2eMainWindow::ProcessMessage(Long_t msg, Long_t param1, Long_t param2){ switch (GET_MSG(msg)) { @@ -547,9 +515,6 @@ namespace mu2e{ case kC_TEXTENTRY: switch (GET_SUBMSG(msg)){ case kTE_TEXTCHANGED: - if (param1 == 1700){ - fTHSlid->SetPosition(atof(fTbh1->GetString())); - } if (param1 == 1701){ fclustmin = atof(_clustminenergy->GetString()); fclustmax = atof(_clustmaxenergy->GetString()); @@ -624,7 +589,7 @@ namespace mu2e{ } if(param1==1205){ if(mctrajcheck->IsDown()){ - pass_mc->AddFullMCTrajectory(_firstLoop, _data.mctrajcol, tracker2Dproj, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); + pass_mc->AddFullMCTrajectory(_firstLoop, _data.mctrajcol, tracker2Dproj, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3, particles); } if(!mctrajcheck->IsDown()){RedrawDataProducts("MC Trajectories");} } @@ -657,7 +622,8 @@ namespace mu2e{ return kTRUE; } - void TEveMu2eMainWindow::setEvent(const art::Event& event, bool firstLoop, Data_Collections &data, double time, bool accumulate, int &runn, int &eventn, bool &eventSelected) + /*------------Function to add the actual data to the plot (entrance from module):-------------*/ + void TEveMu2eMainWindow::setEvent(const art::Event& event, bool firstLoop, Data_Collections &data, double time, bool accumulate, int &runn, int &eventn, bool &eventSelected, bool isMCOnly) { _event=event.id().event(); _subrun=event.id().subRun(); @@ -672,42 +638,48 @@ namespace mu2e{ _data.crvcoincol = data.crvcoincol; _data.cryHitcol = data.cryHitcol; _data.cosmiccol = data.cosmiccol; - std::vector track_list = std::get<1>(data.track_tuple); - std::cout<<"in main "< times = pass_data->getTimeRange(firstLoop, data.chcol, data.crvcoincol, data.clustercol, data.cryHitcol); - - if(_data.crvcoincol!=0) pass_data->AddCRVInfo(firstLoop, data.crvcoincol, ftimemin, ftimemax, false, _accumulate); - hitenergy = new vector(2); - if(_data.chcol!=0) *hitenergy = pass_data->AddComboHits(firstLoop, data.chcol, tracker2Dproj, false, fhitmin, fhitmax,ftimemin, ftimemax, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); - - clusterenergy = new std::vector(2); - - if(_data.clustercol!=0) *clusterenergy = pass_data->AddCaloClusters(firstLoop, data.clustercol, calo2Dproj, false, fclustmin, fclustmax, ftimemin, ftimemax, _accumulate, CfXYMgr, CfRZMgr, proj0, proj1); - if (_data.cryHitcol!=0) pass_data->AddCrystalHits(firstLoop, data.cryHitcol, calo2Dproj, ftimemin, ftimemax, false, _accumulate, CfXYMgr, CfRZMgr, proj0, proj1); - pass_data->AddHelixPieceWise3D(firstLoop, data.track_tuple, tracker2Dproj, ftimemin, ftimemax, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); - if(_data.cosmiccol!=0) pass_data->AddCosmicTrack(firstLoop, data.cosmiccol, tracker2Dproj, ftimemin, ftimemax, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); - if(_data.mctrajcol!=0) pass_mc->AddFullMCTrajectory(firstLoop, data.mctrajcol, tracker2Dproj, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); + if(!isMCOnly){ + std::vector track_list = std::get<1>(data.track_tuple); + std::vector times = pass_data->getTimeRange(firstLoop, data.chcol, data.crvcoincol, data.clustercol, data.cryHitcol); + + if(_data.crvcoincol!=0) pass_data->AddCRVInfo(firstLoop, data.crvcoincol, ftimemin, ftimemax, false, _accumulate); + hitenergy = new vector(2); + + if(_data.chcol!=0) *hitenergy = pass_data->AddComboHits(firstLoop, data.chcol, tracker2Dproj, false, fhitmin, fhitmax,ftimemin, ftimemax, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); + + clusterenergy = new std::vector(2); + + if(_data.clustercol!=0) *clusterenergy = pass_data->AddCaloClusters(firstLoop, data.clustercol, calo2Dproj, false, fclustmin, fclustmax, ftimemin, ftimemax, _accumulate, CfXYMgr, CfRZMgr, proj0, proj1); + + if (_data.cryHitcol!=0) pass_data->AddCrystalHits(firstLoop, data.cryHitcol, calo2Dproj, ftimemin, ftimemax, false, _accumulate, CfXYMgr, CfRZMgr, proj0, proj1); + + if (_data.cryHitcol!=0) pass_data->AddHelixPieceWise3D(firstLoop, data.track_tuple, tracker2Dproj, ftimemin, ftimemax, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); + + if(track_list.size() !=0) pass_data->AddCosmicTrack(firstLoop, data.cosmiccol, tracker2Dproj, ftimemin, ftimemax, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3); + + _clustminenergy->Clear(); + _clustmaxenergy->Clear(); + _hitminenergy->Clear(); + _hitmaxenergy->Clear(); + _hitmintime->Clear(); + _hitmaxtime->Clear(); + _clustminenergy->AddText(0, (to_string(clusterenergy->at(0))).c_str()); + _clustmaxenergy->AddText(0, (to_string(clusterenergy->at(1))).c_str()); + + _hitminenergy->AddText(0, (to_string(hitenergy->at(0))).c_str()); + _hitmaxenergy->AddText(0, (to_string(hitenergy->at(1))).c_str()); + _hitmintime->AddText(0, (to_string(times.at(0))).c_str()); + _hitmaxtime->AddText(0, (to_string(times.at(1))).c_str()); + } + if(_data.mctrajcol!=0) pass_mc->AddFullMCTrajectory(firstLoop, data.mctrajcol, tracker2Dproj, false, _accumulate, TfXYMgr, TfRZMgr, proj2, proj3, particles); - gSystem->ProcessEvents(); gSystem->IgnoreInterrupt(); gSystem->IgnoreSignal(kSigTermination); gSystem->IgnoreSignal(kSigSegmentationViolation); gClient->NeedRedraw(fTeRun); - _clustminenergy->Clear(); - _clustmaxenergy->Clear(); - _hitminenergy->Clear(); - _hitmaxenergy->Clear(); - _hitmintime->Clear(); - _hitmaxtime->Clear(); - _clustminenergy->AddText(0, (to_string(clusterenergy->at(0))).c_str()); - _clustmaxenergy->AddText(0, (to_string(clusterenergy->at(1))).c_str()); - - _hitminenergy->AddText(0, (to_string(hitenergy->at(0))).c_str()); - _hitmaxenergy->AddText(0, (to_string(hitenergy->at(1))).c_str()); - _hitmintime->AddText(0, (to_string(times.at(0))).c_str()); - _hitmaxtime->AddText(0, (to_string(times.at(1))).c_str()); + gApplication->Run(true); gEve->Redraw3D(kTRUE); @@ -718,6 +690,7 @@ namespace mu2e{ } } + /*------------Function to fill event selection:-------------*/ void TEveMu2eMainWindow::fillEvent(bool firstLoop) { std::string eventInfoText; @@ -759,12 +732,14 @@ namespace mu2e{ this->Layout(); } + /*------------Function to find event:-------------*/ int TEveMu2eMainWindow::getEventToFind(bool &findEvent) const { findEvent=_findEvent; return _eventToFind; } + /*------------Function to check if closed:-------------*/ bool TEveMu2eMainWindow::isClosed() const { return _isClosed; diff --git a/TEveEventDisplay/src/TEveMu2eProjectionInterface.cc b/TEveEventDisplay/src/TEveMu2eProjectionInterface.cc index afc131135f..caf0be7fd8 100644 --- a/TEveEventDisplay/src/TEveMu2eProjectionInterface.cc +++ b/TEveEventDisplay/src/TEveMu2eProjectionInterface.cc @@ -2,6 +2,8 @@ using namespace mu2e; namespace mu2e{ + + /*------------Function to add CRV 2D projection to Display:-------------*/ void TEveMu2eProjectionInterface::CreateCRVProjection(TEveMu2e2DProjection *CRV2Dproj){ // Create detector and event scenes for ortho views CRV2Dproj->fDetXYScene = gEve->SpawnNewScene("CRV Top", ""); @@ -32,7 +34,7 @@ namespace mu2e{ } - + /*------------Function to add calo 2D projection to display:-------------*/ void TEveMu2eProjectionInterface::CreateCaloProjection(TEveMu2e2DProjection *calo2Dproj){ // Create detector and event scenes for ortho views calo2Dproj->fDetXYScene = gEve->SpawnNewScene("Calo XY D0 Scene", ""); @@ -78,7 +80,8 @@ namespace mu2e{ // gEve->GetBrowser()->GetTabRight()->SetTab(0); } - + + /*------------Function to add tracker 2D projection to display:-------------*/ void TEveMu2eProjectionInterface::CreateTrackerProjection(TEveMu2e2DProjection *tracker2Dproj){ // Create detector and event scenes for ortho views tracker2Dproj->fDetXYScene = gEve->SpawnNewScene("Tracker Det XY Scene", ""); diff --git a/TEveEventDisplay/src/TEveMu2eStraightTrack.cc b/TEveEventDisplay/src/TEveMu2eStraightTrack.cc index 9564502f42..d04f537354 100644 --- a/TEveEventDisplay/src/TEveMu2eStraightTrack.cc +++ b/TEveEventDisplay/src/TEveMu2eStraightTrack.cc @@ -5,7 +5,8 @@ namespace mu2e{ TEveMu2eStraightTrack::TEveMu2eStraightTrack(){}; - XYZVec TEveMu2eStraightTrack::GetPositon(){ return fCosmicTrackSeed->_track.MinuitEquation.Pos; } ; - XYZVec TEveMu2eStraightTrack::GetDirection(){ return fCosmicTrackSeed->_track.MinuitEquation.Dir; }; + /*------------Function to access position and direction:-------------*/ + XYZVec TEveMu2eStraightTrack::GetPositon(){ return fCosmicTrackSeed_->_track.MinuitEquation.Pos; } ; + XYZVec TEveMu2eStraightTrack::GetDirection(){ return fCosmicTrackSeed_->_track.MinuitEquation.Dir; }; } diff --git a/TEveEventDisplay/src/TEveMu2eTracker.cc b/TEveEventDisplay/src/TEveMu2eTracker.cc index a7138a18f8..fa146ebf56 100644 --- a/TEveEventDisplay/src/TEveMu2eTracker.cc +++ b/TEveEventDisplay/src/TEveMu2eTracker.cc @@ -1,12 +1,11 @@ #include "TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h" -#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" -#include -#include + using namespace mu2e; namespace mu2e{ TEveMu2eTracker::TEveMu2eTracker(){}; - + + /*------------Function to construct Tracker (for 2D only):-------------*/ void TEveMu2eTracker::DrawTrackerDetector(art::Run const& run, TGeoVolume* topvol, TEveElementList *orthodet){ GeomHandle trkr; diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h index c4968331b1..d8222837f3 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h @@ -16,16 +16,16 @@ namespace mu2e { public: #ifndef __CINT__ explicit TEveMu2eCRVEvent(); - TEveMu2eCRVEvent(CrvRecoPulse chit) : fCrvRecoPulse(chit){}; + TEveMu2eCRVEvent(CrvRecoPulse chit) : fCrvRecoPulse_(chit){}; virtual ~TEveMu2eCRVEvent(){}; - CrvCoincidenceCluster fCrvCoincidenceCluster; - CrvRecoPulse fCrvRecoPulse; + CrvCoincidenceCluster fCrvCoincidenceCluster_; + CrvRecoPulse fCrvRecoPulse_; - Int_t mColor = kBlue; - Int_t mSize= 1; - - bool AddErrorBar = true; + Int_t mColor_ = kBlue; + Int_t mSize_ = 1; + bool AddErrorBar_ = true; + void DrawHit2D(const std::string &pstr, Int_t b,CLHEP::Hep3Vector HitPos, TEveElementList *list); void DrawHit3D(const std::string &pstr, Int_t b,CLHEP::Hep3Vector HitPos, TEveElementList *list); std::string DataTitle(const std::string &pstr, int n); diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h index 37cef01c6c..47c0205dbb 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h @@ -2,28 +2,32 @@ #define TEveMu2eCluster_h #include +#include +#include #include "RecoDataProducts/inc/CaloCluster.hh" #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h" +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" #include #include -#include -#include + namespace mu2e { class TEveMu2eCluster: public TEvePointSet{ - CaloCluster fCaloCluster; - + public: #ifndef __CINT__ explicit TEveMu2eCluster(); - TEveMu2eCluster(CaloCluster cluster) : fCaloCluster(cluster){}; + TEveMu2eCluster(CaloCluster cluster) : fCaloCluster_(cluster){}; virtual ~TEveMu2eCluster(){}; - #endif + + CaloCluster fCaloCluster_; + void DrawCluster(const std::string &pstr, CLHEP::Hep3Vector COG, int energylevel, TEveElementList *list, std::vector hits, bool addHits); void DrawCrystalHits(const std::string &pstr, CLHEP::Hep3Vector COG, TEveElementList *list); - const CLHEP::Hep3Vector GetPositon() { return fCaloCluster.cog3Vector() ;} - double GetEnergy() { return fCaloCluster.energyDep();} + const CLHEP::Hep3Vector GetPositon() { return fCaloCluster_.cog3Vector() ;} + double GetEnergy() { return fCaloCluster_.energyDep();} std::string DataTitle(const std::string &pstr, double edep); + #endif ClassDef(TEveMu2eCluster, 0); }; } diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h index e30f655d69..e50eacac6a 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h @@ -7,6 +7,8 @@ #include "RecoDataProducts/inc/HelixSeed.hh" #include "RecoDataProducts/inc/KalSeed.hh" #include "RecoDataProducts/inc/TrkExtTraj.hh" +#include "GlobalConstantsService/inc/GlobalConstantsHandle.hh" +#include "GlobalConstantsService/inc/ParticleDataTable.hh" using namespace mu2e; @@ -16,14 +18,12 @@ namespace mu2e { #ifndef __CINT__ explicit TEveMu2eCustomHelix(); TEveMu2eCustomHelix(const TEveMu2eCustomHelix &helix); - TEveMu2eCustomHelix(HelixSeed hseed); - TEveMu2eCustomHelix(KalSeed kseed); virtual ~TEveMu2eCustomHelix(){}; #endif - KalSeed fKalSeed; - HelixSeed fHelixSeed; - TrkExtTraj fTrkExtTraj; + KalSeed fKalSeed_; + HelixSeed fHelixSeed_; + TrkExtTraj fTrkExtTraj_; void DrawHelixTrack(); void Draw2DProjection(); @@ -34,15 +34,14 @@ namespace mu2e { void SetMomentumExt(); void SetParticleExt(); - XYZVec Direction; - XYZVec Position; - double Momentum; - int PDGcode; - double Charge; - double Mass; - double Time; - double Radius; - bool _trajectory; + XYZVec Direction_; + XYZVec Position_; + double Momentum_; + int PDGcode_; + double Charge_; + double Mass_; + double Time_; + double Radius_; ClassDef( TEveMu2eCustomHelix, 0); }; } diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h index 0e5b44392e..20d7837adc 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eDataInterface.h @@ -1,6 +1,10 @@ #ifndef TEveMu2eDataInterface_h #define TEveMu2eDataInterface_h - +//ROOT +#include +#include +#include +#include //libGeom #include //TEve @@ -21,8 +25,12 @@ #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h" #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eStraightTrack.h" #include "TEveEventDisplay/src/dict_classes/GeomUtils.h" +//C++ +#include +#include +#include +#include - namespace mu2e{ class TEveMu2eDataInterface { public: diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h index 93c202043b..aa4eb5f934 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h @@ -10,23 +10,24 @@ //Mu2e General: #include "GeometryService/inc/GeomHandle.hh" #include "GeometryService/inc/DetectorSystem.hh" +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" namespace mu2e { class TEveMu2eHit : public TEvePointSet { public: #ifndef __CINT__ explicit TEveMu2eHit(); - TEveMu2eHit(ComboHit chit) : fComboHit(chit){}; + TEveMu2eHit(ComboHit chit) : fComboHit_(chit){}; virtual ~TEveMu2eHit(){}; - ComboHit fComboHit; - Int_t mSize= 1; - bool AddErrorBar = false; + ComboHit fComboHit_; + Int_t mSize_ = 3; + bool AddErrorBar_ = false; void DrawHit2D(const std::string &pstr, Int_t b,CLHEP::Hep3Vector HitPos, int energylevel, TEveElementList *list); void DrawHit3D(const std::string &pstr, Int_t b,CLHEP::Hep3Vector HitPos, int energylevel, TEveElementList *list); void DrawHitCollection(const std::string &pstr, size_t i, std::vector HitPos, int energylevel, TEveElementList *list); - XYZVec const GetPosition() { return fComboHit.pos();} - double GetEnergy(){ return fComboHit.energyDep();} + XYZVec const GetPosition() { return fComboHit_.pos();} + double GetEnergy(){ return fComboHit_.energyDep();} std::string DataTitle(const std::string &pstr, int n); #endif ClassDef(TEveMu2eHit, 0); diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCInterface.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCInterface.h index af8cc3ca0e..22e16c4e75 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCInterface.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCInterface.h @@ -1,7 +1,10 @@ #ifndef TEveMu2eMCInterface_h #define TEveMu2eMCInterface_h - -//libGeom +//ROOT +#include +#include +#include +#include #include //TEve #include @@ -20,19 +23,21 @@ #include "TEveEventDisplay/src/dict_classes/GeomUtils.h" namespace mu2e{ class TEveMu2eMCInterface { - public: - #ifndef __CINT__ - TEveMu2eMCInterface() : fTrackList2D(0),fTrackList3D(0){}; - TEveMu2eMCInterface(const TEveMu2eMCInterface &); - TEveMu2eMCInterface& operator=(const TEveMu2eMCInterface &); - virtual ~TEveMu2eMCInterface(){}; - void AddSimpleMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2); - void AddFullMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2); - #endif - TEveElementList *fTrackList2D; - TEveElementList *fTrackList3D; - - ClassDef(TEveMu2eMCInterface,0); + + public: + #ifndef __CINT__ + TEveMu2eMCInterface() : fTrackList2D(0),fTrackList3D(0){}; + TEveMu2eMCInterface(const TEveMu2eMCInterface &); + TEveMu2eMCInterface& operator=(const TEveMu2eMCInterface &); + virtual ~TEveMu2eMCInterface(){}; + void AddSimpleMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2); + int Contains(std::vector list, int x); + void AddFullMCTrajectory(bool firstloop, const MCTrajectoryCollection *trajcol, TEveMu2e2DProjection *tracker2Dproj, bool Redraw, bool accumulate, TEveProjectionManager *TXYMgr, TEveProjectionManager *TRZMgr, TEveScene *scene1, TEveScene *scene2, std::vector ids); + #endif + TEveElementList *fTrackList2D; + TEveElementList *fTrackList3D; + std::vector particleIds_; + ClassDef(TEveMu2eMCInterface,0); }; //end class def diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCTraj.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCTraj.h index 187c159678..3dee7d16ee 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCTraj.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMCTraj.h @@ -7,7 +7,10 @@ #include #include #include "RecoDataProducts/inc/ComboHit.hh" - +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" +#include "ConfigTools/inc/SimpleConfig.hh" +#include "GeometryService/inc/GeomHandle.hh" +#include "GeometryService/inc/DetectorSystem.hh" namespace mu2e { class TEveMu2eMCTraj : public TEvePointSet{ public: diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMainWindow.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMainWindow.h index 19ea6becbf..09fa22a818 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMainWindow.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eMainWindow.h @@ -1,33 +1,57 @@ #ifndef TEveMu2eMainWindow_h #define TEveMu2eMainWindow_h -#include -#include + +// ... libRIO +#include +#include +#include #include -#include -#include #include +// ... libGui +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// ... libRGL +#include +#include +#include +#include #include +// ... libEve +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //libGeom #include -#include -#include -//TEve -#include -#include -//fcl: -#include "fhiclcpp/types/Atom.h" -#include "fhiclcpp/types/Sequence.h" -#include "fhiclcpp/types/Table.h" //Mu2e: #include "art/Framework/Principal/Event.h" #include "art/Framework/Principal/Run.h" #include "ConfigTools/inc/SimpleConfig.hh" #include "GeometryService/inc/GeomHandle.hh" -#include "RecoDataProducts/inc/ComboHit.hh" -//TEveMu2e +//...TEveMu2e +#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eHit.h" +#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCluster.h" +#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCustomHelix.h" +#include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eCRVEvent.h" #include "TEveEventDisplay/src/dict_classes/Geom_Interface.h" -#include "TEveEventDisplay/src/dict_classes/Collection_Filler.h" #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2e2DProjection.h" #include "TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h" #include "TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h" @@ -59,32 +83,33 @@ namespace mu2e{ void CreateMultiViews(); void PrepareTrackerProjectionTab(const art::Run& run); - void PrepareCaloProjectionTab(const art::Run& run); - void PrepareCRVProjectionTab(const art::Run& run); + void SetParticleOpts(std::vector particles_) { particles = particles_;} + void CreateGUI(); void SetRunGeometry(const art::Run& run, int _diagLevel, bool _showBuilding, bool _showDSOnly, bool _showCRV); void RedrawDataProducts(std::string type); + Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2); - void setEvent(const art::Event& event, bool firstLoop, Data_Collections &data, double time, bool accumulate, int& runn, int& eventn, bool& update); + + void setEvent(const art::Event& event, bool firstLoop, Data_Collections &data, double time, bool accumulate, int& runn, int& eventn, bool& update, bool isMCOnly); void fillEvent(bool firstLoop=false); bool isClosed() const; int getEventToFind(bool &findEvent) const; - double texttime = -1; - std::vector *clusterenergy = 0; - std::vector *hitenergy = 0; - std::vector times; - #endif - + + //List of parameters: TGeoManager* geom = new TGeoManager("geom","Geom"); Geom_Interface *mu2e_geom =new Geom_Interface(); TEveMu2eDataInterface *pass_data = new TEveMu2eDataInterface(); TEveMu2eMCInterface *pass_mc = new TEveMu2eMCInterface(); TEveMu2eProjectionInterface *pass_proj = new TEveMu2eProjectionInterface(); - int eventToFind, runToFind; - bool usereventSelected = false; - TEveViewer *v; + + double texttime = -1; + std::vector *clusterenergy = 0; + std::vector *hitenergy = 0; + std::vector times; + TEvePad *fPad; TGSplitFrame *fSplitFrame; TGSplitFrame *frm; @@ -93,10 +118,9 @@ namespace mu2e{ TGLEmbeddedViewer *fViewer2; TGLEmbeddedViewer *fViewer3; TGLEmbeddedViewer *fViewer4; - TGLEmbeddedViewer *fActViewer; - TGTab *tab; + Bool_t fIsEmbedded; - TGCompositeFrame *test; + TEveViewer *fViewer[5]; TEveProjectionManager *fRPhiMgr; TEveProjectionManager *fRhoZMgr; @@ -114,32 +138,28 @@ namespace mu2e{ TEveScene *proj1 = 0; TEveScene *proj2 = 0; TEveScene *proj3 = 0; - TEveScene *fdetXY = 0; - TEveScene *fevtXY = 0; - TGLOverlayButton *but1, *but2, *but3, *but4, *but5, *but6; + + + bool usereventSelected = false; TGTextEntry *fTeRun,*fTeEvt, *fTTEvt, *fTeh1, *fTeh2, *fTeh3, *cminenergy, *cmaxenergy, *hminenergy, *hmaxenergy, *hmintime, *hmaxtime; - TGHSlider *fTHSlid; TGLabel *fTlRun,*fTlEvt, *fTlTEvt, *fTlHSlid, *celabel, *helabel,*timelabel, *spacer, *spacer1; - TGButtonGroup *br; - TGCheckButton *clusterscheck, *hitscheck, *trackscheck, *cosmicscheck, *cosmictrkscheck, *mctrajcheck; - Double_t hitMarkerSize_; - Double_t trkMaxR_; - Double_t trkMaxZ_; - Double_t trkMaxStepSize_; - Double_t camRotateCenterH_; - Double_t camRotateCenterV_; - Double_t camDollyDelta_; - Int_t HSId1; - TGTextBuffer *_eventNumber, *_subrunNumber, *_runNumber, *_time, *fTbh1, *fTbh2, *fTbh3, *_clustminenergy, *_clustmaxenergy, *_hitminenergy, *_hitmaxenergy, *_hitmintime, *_hitmaxtime; - int _eventToFind = 0; ///TODO - this or one above>? + TGButtonGroup *br; + TGCheckButton *clusterscheck, *hitscheck, *trackscheck, *cosmicscheck, *cosmictrkscheck, *mctrajcheck; + + TGTextBuffer *_eventNumber, *_subrunNumber, *_runNumber, *_time, *_clustminenergy, *_clustmaxenergy, *_hitminenergy, *_hitmaxenergy, *_hitmintime, *_hitmaxtime; + + int eventToFind, runToFind; + int _eventToFind = 0; bool _isClosed = false; bool _findEvent = true; bool _firstLoop = true; bool _accumulate = false; + TEveMu2e2DProjection *tracker2Dproj = new TEveMu2e2DProjection(); TEveMu2e2DProjection *calo2Dproj = new TEveMu2e2DProjection(); TEveMu2e2DProjection *CRV2Dproj = new TEveMu2e2DProjection(); + TEveMu2eCalorimeter *Mu2eCalo = new TEveMu2eCalorimeter(); TEveMu2eTracker *Mu2eTracker = new TEveMu2eTracker(); TEveMu2eCRV *Mu2eCRV = new TEveMu2eCRV(); @@ -155,8 +175,10 @@ namespace mu2e{ double fhitmax = -1; double ftimemin = -1; double ftimemax = -1; - - ClassDef(TEveMu2eMainWindow,0); + + std::vector particles; + #endif + ClassDef(TEveMu2eMainWindow,0); }; //end class def diff --git a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eStraightTrack.h b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eStraightTrack.h index cb753a29c7..e0528b0fda 100644 --- a/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eStraightTrack.h +++ b/TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2eStraightTrack.h @@ -8,15 +8,18 @@ namespace mu2e { class TEveMu2eStraightTrack: public TEveStraightLineSet{ - CosmicTrackSeed* fCosmicTrackSeed; + public: #ifndef __CINT__ explicit TEveMu2eStraightTrack(); virtual ~TEveMu2eStraightTrack(){}; - #endif + + CosmicTrackSeed* fCosmicTrackSeed_; + void DrawStraightTrack(); XYZVec GetPositon(); XYZVec GetDirection(); + #endif ClassDef( TEveMu2eStraightTrack, 0); }; } diff --git a/TEveEventDisplay/src/dict_classes/Collection_Filler.h b/TEveEventDisplay/src/dict_classes/Collection_Filler.h index 5860940085..86e9a0d9d0 100644 --- a/TEveEventDisplay/src/dict_classes/Collection_Filler.h +++ b/TEveEventDisplay/src/dict_classes/Collection_Filler.h @@ -1,5 +1,14 @@ #ifndef Collection_Filler_h #define Collection_Filler_h +//ROOT +#include +#include +#include +#include +#include +#include +#include +#include //Cosmics: #include "RecoDataProducts/inc/CosmicTrackSeed.hh" //Calo: @@ -18,16 +27,12 @@ //Art: #include "art/Framework/Principal/Event.h" #include "art/Framework/Principal/Run.h" +#include "art/Framework/Principal/SubRun.h" #include "fhiclcpp/types/Atom.h" #include "fhiclcpp/types/Sequence.h" #include "fhiclcpp/types/Table.h" - -#include -#include -#include -#include -#include -#include +//TEVeMu2e +#include "TEveEventDisplay/src/dict_classes/Collection_Filler.h" using namespace CLHEP; diff --git a/TEveEventDisplay/src/dict_classes/Geom_Interface.h b/TEveEventDisplay/src/dict_classes/Geom_Interface.h index 6329b20103..a710a56434 100644 --- a/TEveEventDisplay/src/dict_classes/Geom_Interface.h +++ b/TEveEventDisplay/src/dict_classes/Geom_Interface.h @@ -25,10 +25,27 @@ #include #include #include - +/*//Mu2e Calo Geom: #include "ConfigTools/inc/SimpleConfig.hh" #include "CalorimeterGeom/inc/Calorimeter.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"*/ +//ART +#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" + namespace mu2e{ class Geom_Interface { diff --git a/TEveEventDisplay/src/oldprolog.fcl b/TEveEventDisplay/src/oldprolog.fcl deleted file mode 100644 index f340e7227d..0000000000 --- a/TEveEventDisplay/src/oldprolog.fcl +++ /dev/null @@ -1,74 +0,0 @@ -# -# Prolog specific to creating primary (signal, signal-like or calibration) particles -# -#include "JobConfig/beam/prolog.fcl" -#include "EventGenerator/fcl/prolog.fcl" -#include "CommonMC/fcl/prolog.fcl" -#include "TrackerMC/fcl/prolog.fcl" -#include "CaloMC/fcl/prolog.fcl" -#include "CRVResponse/fcl/prolog.fcl" -#include "Filters/fcl/prolog.fcl" -# -BEGIN_PROLOG - -Primary: { - producers : { - g4run : @local::mu2e.physics.producers.g4run.muons - genCounter: { module_type: GenEventCounter } - @table::EventGenerator.producers - @table::CommonMC.producers - @table::TrackerMC.producers - @table::CaloDigiMC.producers - @table::CrvDAQPackage.producers -# dedicated digi maker for filter -# 2 stages now - makeSGS : { - module_type : MakeStrawGasSteps - KeepDeltasModule : "g4run" # don'e compress deltas on primary particles - } - makeSD:{ - @table::makeSD - } - compressDigiMCs : @local::DigiCompression.Primary - } - filters : { -# generator truncation filter; only needed for cosmic rays in principle - g4status: { - module_type: FilterStatusG4 - input: "g4run" - } -# digi filtering for Primary selection. - DigiFilter : { - module_type : StrawDigiMCFilter - StrawDigiMCCollection : "makeSD" - } -# shower filter for calorimeter selection - CaloFilter : { - module_type : CaloShowerSimFilter - } - } - analyzers: { - genCountLogger: { module_type: GenEventCountReader makeHistograms: false } - digiCompressionCheck : @local::DigiCompression.Check - } - GenAndG4 : [ generate, g4run, g4status ] - - EndPath : [ digiCompressionCheck, Output ] - Output : { - module_type : RootOutput - SelectEvents : [ TriggerPath ] - fileName : @nil - # drop StepPoints from calorimeter - outputCommands : @local::DigiCompression.OutputCommands - } -} -# must define this outside the brackets due to internal dependence -Primary.TriggerPath : [ @sequence::Primary.GenAndG4, - @sequence::CommonMC.DigiSim, - @sequence::TrackerMC.DigiSim, - DigiFilter, - @sequence::CaloDigiMC.DigiSim, - @sequence::CrvDAQPackage.CrvResponseSequence, - compressDigiMCs ] - -END_PROLOG diff --git a/TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h b/TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h index b9dab970b9..c070a4787d 100644 --- a/TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h +++ b/TEveEventDisplay/src/shape_classes/TEveMu2eCRV.h @@ -11,7 +11,8 @@ #include #include #include -// ... libRIO +#include +//ROOT #include //CRV/CRS: #include "GeometryService/inc/GeomHandle.hh" @@ -20,6 +21,7 @@ #include "CosmicRayShieldGeom/inc/CRSScintillatorModule.hh" //TEveMu2e: #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2e2DProjection.h" +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" namespace mu2e{ class TEveMu2eCRV diff --git a/TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h b/TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h index dec33a3008..e0f0fee871 100644 --- a/TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h +++ b/TEveEventDisplay/src/shape_classes/TEveMu2eCalorimeter.h @@ -11,6 +11,8 @@ #include #include #include +#include +#include // ... libRIO #include //Calorimeter: @@ -23,7 +25,9 @@ #include "CalorimeterGeom/inc/Disk.hh" //TEveMu2e: #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2e2DProjection.h" - +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" +//Mu2e: +#include "GeometryService/inc/DetectorSystem.hh" namespace mu2e{ class TEveMu2eCalorimeter { diff --git a/TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h b/TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h index a967fa5561..05a3e9b46a 100644 --- a/TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h +++ b/TEveEventDisplay/src/shape_classes/TEveMu2eTracker.h @@ -10,6 +10,8 @@ #include #include #include +#include +#include // ... libRIO #include //Tracker @@ -17,6 +19,7 @@ #include "GeometryService/inc/GeomHandle.hh" //TEveMu2e: #include "TEveEventDisplay/src/TEveMu2e_base_classes/TEveMu2e2DProjection.h" +#include "TEveEventDisplay/src/dict_classes/GeomUtils.h" namespace mu2e {