Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.root
*.art
*.bz2

Empty file added .muse
Empty file.
32 changes: 32 additions & 0 deletions fcl/RunDisplay.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "fcl/minimalMessageService.fcl"
#include "fcl/standardServices.fcl"
process_name : RunDisplay

source : {
module_type : RootInput
}

services : @local::Services.Reco
physics: {
analyzers: {

neweventdisplay: {
module_type: REveEventDisplay
showCRV : false
filler : {
diagLevel : 0
ComboHitCollection : "makeSH"
CaloClusterCollection : "CaloClusterFast"
KalSeedCollection : ["KFFDeM"]
addHits : true
addClusters : true
addKalSeeds : true
FillAll : false
}
}

}
}

physics.EndPath : [ neweventdisplay ]
services.TFileService.fileName: "EventDisplay.root"
26 changes: 26 additions & 0 deletions fcl/prolog.fcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BEGIN_PROLOG

REveEventDisplayBase : {
module_type : REveEventDisplay

showCRV : false
filler : {
diagLevel : 0
ComboHitCollection : "makeSH"
CaloClusterCollection : "CaloClusterFast"
KalSeedCollection : ["KFFDeM"]
addHits : true
addClusters : true
addKalSeeds : true
FillAll : false
}
}

REveDis : {
analyzers : {
REveEventDisplayBase : @local::REveEventDisplayBase
}

seqBase : [REveEventDisplayBase]
}
END_PROLOG
59 changes: 59 additions & 0 deletions inc/CollectionFiller.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef CollectionFiller_hh
#define CollectionFiller_hh

//Art:
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Run.h"
#include "fhiclcpp/types/Atom.h"
#include "fhiclcpp/types/Sequence.h"
#include "fhiclcpp/types/Table.h"

#include<TObject.h>
#include <TROOT.h>
#include <TGComboBox.h>
#include <TGListBox.h>


#include "DataCollections.hh"

namespace ots{

enum RecoDataProductName {ComboHits, CaloClusters, KalSeeds};

class CollectionFiller
{
public:
struct Config{
using Name=fhicl::Name;
using Comment=fhicl::Comment;
fhicl::Atom<int> diagLevel{Name("diagLevel"), Comment("for info"),0};
fhicl::Atom<art::InputTag>chTag{Name("ComboHitCollection"),Comment("chTag"), "makePH"};
fhicl::Atom<art::InputTag>cluTag{Name("CaloClusterCollection"),Comment("cluTag")};
fhicl::Sequence<art::InputTag>kalSeedTag{Name("KalSeedCollection"),Comment("kalseedTag")};
fhicl::Atom<bool> addHits{Name("addHits"), Comment("set to add the hits"),false};
fhicl::Atom<bool> addClusters{Name("addClusters"), Comment("set to add caloclusters"),false};
fhicl::Atom<bool> addKalSeeds{Name("addKalSeeds"), Comment("set to add kalseeds"),false};
fhicl::Atom<bool> FillAll{Name("FillAll"), Comment("to see all available products"), false};
};

explicit CollectionFiller(const Config& conf);
CollectionFiller(const CollectionFiller &);
CollectionFiller& operator=(const CollectionFiller &);

art::InputTag chTag_;
art::InputTag cluTag_;
std::vector<art::InputTag> kalSeedTag_;
art::Event *_event;
art::Run *_run;
bool addHits_, addClusters_, addKalSeeds_, FillAll_;
void FillRecoCollections(const art::Event& evt, DataCollections &data, RecoDataProductName code);
virtual ~CollectionFiller(){};

private:
Config _conf;

};

}

#endif
42 changes: 42 additions & 0 deletions inc/DataCollections.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef _DataCollections_hh
#define _DataCollections_hh

#include "RecoDataProducts/inc/CaloCluster.hh"
#include "RecoDataProducts/inc/ComboHit.hh"
#include "RecoDataProducts/inc/KalSeed.hh"
//Art/FCL:
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Run.h"
#include "fhiclcpp/types/Atom.h"
#include "fhiclcpp/types/Sequence.h"
#include "fhiclcpp/types/Table.h"

#include <TObject.h>
#include <TROOT.h>
#include <TGComboBox.h>
#include <TGListBox.h>
#include <iostream>
#include <vector>
#include <tuple>
#include <string>

namespace ots{
class DataCollections
{
public:
explicit DataCollections(){};
DataCollections(const DataCollections &){};
DataCollections& operator=(const DataCollections &);

//RecoDataProducts:
const mu2e::ComboHitCollection *chcol = 0;
const mu2e::CaloClusterCollection* clustercol = 0;
const mu2e::KalSeedCollection* kalSeedcol = 0;
std::vector<const mu2e::KalSeedCollection*> track_list;
std::vector<std::string> track_labels;
std::tuple<std::vector<std::string>, std::vector<const mu2e::KalSeedCollection*>> track_tuple;
virtual ~DataCollections(){};

};
}
#endif
38 changes: 38 additions & 0 deletions inc/EventDisplayManager.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef _MockEventDisplayManager_hh
#define _MockEventDisplayManager_hh

#include <ROOT/REveElement.hxx>
#include <ROOT/REveScene.hxx>
#include <condition_variable>
#include <limits>
#include <mutex>
#include <stdexcept>
#include <iostream>
namespace ROOT::Experimental {
class REveManager;
}

namespace ots {

constexpr auto invalid_event = std::numeric_limits<unsigned>::max();

class MockEventDisplayManager : public ROOT::Experimental::REveElement {
public:
MockEventDisplayManager() = default; // ROOT needs a dictionary

explicit MockEventDisplayManager(ROOT::Experimental::REveManager* eveMgr,
std::condition_variable& cv,
std::mutex& m);

void NextEvent();
void QuitRoot();

private:
ROOT::Experimental::REveManager* eveMng_{nullptr};
std::condition_variable* cv_{nullptr};
std::mutex* m_{nullptr};
bool doneProcessingEvents_{false};
};
}

#endif /* MockEventDisplayManager_h */
81 changes: 81 additions & 0 deletions inc/REveMainWindow.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#ifndef _REveMainWindow_hh
#define _REveMainWindow_hh

#include <vector>
#include <string>
#include <iostream>
#include "TGeoManager.h"
#include "TClass.h"
#include "TRandom.h"
#include "TGeoTube.h"
#include "TGeoNode.h"
#include "TGeoSphere.h"
#include "TParticle.h"
#include "TApplication.h"
#include "TMatrixDSym.h"
#include "TVector.h"
#include "TMatrixDEigen.h"
#include "TTimer.h"
#include "TGeoMatrix.h"
#include "TError.h"
#include <TApplication.h>
#include <TSystem.h>
#include <TGTextEntry.h>
#include <ROOT/REveGeoShape.hxx>
#include <ROOT/REveScene.hxx>
#include <ROOT/REveViewer.hxx>
#include <ROOT/REveElement.hxx>
#include <ROOT/REveManager.hxx>
#include <ROOT/REveUtil.hxx>
#include <ROOT/REveGeoShape.hxx>
#include <ROOT/REveProjectionManager.hxx>
#include <ROOT/REveProjectionBases.hxx>
#include <ROOT/REvePointSet.hxx>
#include <ROOT/REveJetCone.hxx>
#include <ROOT/REveTrans.hxx>
#include <ROOT/RWebDisplayArgs.hxx>
#include <ROOT/REveTrack.hxx>
#include <ROOT/REveTrackPropagator.hxx>
#include <ROOT/REveEllipsoid.hxx>
#include "art/Framework/Principal/Event.h"
#include "DataCollections.hh"
#include "REveMu2eDataInterface.hh"

namespace REX = ROOT::Experimental;

namespace mu2e {
class REveMainWindow : public REX::REveElement {

public :
explicit REveMainWindow() { SetErrorHandler(DefaultErrorHandler); }
virtual ~REveMainWindow() {}
#ifndef __CINT__
REveMu2eDataInterface *pass_data;
void makeEveGeoShape(TGeoNode* n, REX::REveTrans& trans, REX::REveElement* holder, int j);

void showNodesByName(TGeoNode* n, const std::string& str, bool onOff, int _diagLevel, REX::REveTrans& trans, REX::REveElement* holder, int maxlevel, int level, bool shift);

void SolenoidsOnly(TGeoNode* node, REX::REveTrans& trans, REX::REveElement* holder, int maxlevel, int level);

void TestEventScene(REX::REveElement* event );
void makeGeometryScene(REX::REveManager *eveMng);
void showEvents(REX::REveManager *eveMng, REX::REveElement* &eventScene, bool firstLoop, DataCollections &data);//

void createProjectionStuff(REX::REveManager *eveMng);
void AddTrackerProjection(REX::REveManager *eveMng);
void projectScenes(REX::REveManager *eveMng,bool geomp, bool eventp);
void projectEvents(REX::REveManager *eveMng);
REX::REveProjectionManager *mngRhoPhi = nullptr;
REX::REveProjectionManager *mngRhoZ = nullptr;
REX::REveScene *rPhiGeomScene = nullptr, *rPhiEventScene = nullptr;
REX::REveScene *rhoZGeomScene = nullptr, *rhoZEventScene = nullptr;
REX::REveViewer *rphiView = nullptr;
REX::REveViewer *rhoZView = nullptr;
#endif
ClassDef(REveMainWindow, 0);

};

}
#endif

51 changes: 51 additions & 0 deletions inc/REveMu2eDataInterface.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef REveMu2eDataInterface_hh
#define REveMu2eDataInterface_hh
#include <ROOT/REveElement.hxx>
#include <ROOT/REvePointSet.hxx>
#include <ROOT/REveManager.hxx>
#include <ROOT/REveLine.hxx>
#include <ROOT/REveScene.hxx>
#include <ROOT/REveTrackPropagator.hxx>
#include "RecoDataProducts/inc/CaloCluster.hh"
#include "RecoDataProducts/inc/ComboHit.hh"
#include "RecoDataProducts/inc/KalSeed.hh"
#include "RecoDataProducts/inc/ComboHit.hh"
#include "GeometryService/inc/GeomHandle.hh"
#include "CalorimeterGeom/inc/CaloGeomUtil.hh"
#include "CalorimeterGeom/inc/Calorimeter.hh"
#include "GeometryService/inc/DetectorSystem.hh"
#include "Mu2eInterfaces/inc/Detector.hh"
#include "DataProducts/inc/XYZVec.hh"
#include <TApplication.h>
#include <TEvePad.h>
#include <TObject.h>
#include <TSystem.h>
#include <limits>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace mu2e;
namespace REX = ROOT::Experimental;
namespace mu2e{
class REveMu2eDataInterface {
public:

explicit REveMu2eDataInterface(){};
explicit REveMu2eDataInterface(const REveMu2eDataInterface &);
REveMu2eDataInterface& operator=(const REveMu2eDataInterface &);
virtual ~REveMu2eDataInterface() = default;
#ifndef __CINT__
REX::REveElement *fClusters;
void AddComboHits(REX::REveManager *&eveMng,bool firstloop, const mu2e::ComboHitCollection *clustercol,REX::REveElement* &hitlist, REX::REveProjectionManager *mngRhoPhi, REX::REveProjectionManager *mngRhoZ, REX::REveScene *rPhiGeomScene, REX::REveScene *rhoZGeomScene);
void AddCaloClusters(REX::REveManager *&eveMng,bool firstloop, const mu2e::CaloClusterCollection *hitcol, REX::REveElement* &clusterlist, REX::REveProjectionManager *mngRhoPhi, REX::REveProjectionManager *mngRhoZ, REX::REveScene *rPhiGeomScene, REX::REveScene *rhoZGeomScene);
void AddKalSeedCollection(REX::REveManager *&eveMng,bool firstloop, std::tuple<std::vector<std::string>, std::vector<const KalSeedCollection*>> track_tuple,REX::REveElement* &tracklist, REX::REveProjectionManager *mngRhoPhi, REX::REveProjectionManager *mngRhoZ, REX::REveScene *rPhiGeomScene, REX::REveScene *rhoZGeomScene);
#endif
ClassDef(REveMu2eDataInterface, 0);
};
}


#endif


57 changes: 57 additions & 0 deletions src/CollectionFiller.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include <TObject.h>
#include <TSystem.h>
#include <TFile.h>
#include "CollectionFiller.hh"
#include "art/Framework/Principal/SubRun.h"

using namespace mu2e;
namespace mu2e{

CollectionFiller::CollectionFiller(const Config& conf) :
chTag_(conf.chTag()),
cluTag_(conf.cluTag()),
kalSeedTag_(conf.kalSeedTag()),
addHits_(conf.addHits()),
addClusters_(conf.addClusters()),
addKalSeeds_(conf.addKalSeeds()),
FillAll_(conf.FillAll())
{}

template <typename T> std::string TurnNameToString( const T& value )
{
std::ostringstream ss;
ss << value;
return ss.str();
}


void CollectionFiller::FillRecoCollections(const art::Event& evt, DataCollections &data, RecoDataProductName CollectionName){
if(FillAll_ or (CollectionName == ComboHits)){
auto chH = evt.getValidHandle<mu2e::ComboHitCollection>(chTag_);
data.chcol = chH.product();
}
if(FillAll_ or (CollectionName == CaloClusters)){
auto chH = evt.getValidHandle<mu2e::CaloClusterCollection>(cluTag_);
data.clustercol = chH.product();
}
if(FillAll_ or (CollectionName==KalSeeds)){

for(const auto &tag : kalSeedTag_){
auto chH = evt.getValidHandle<mu2e::KalSeedCollection>(tag);
data.kalSeedcol = chH.product();
data.track_list.push_back(data.kalSeedcol);

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

}
data.track_tuple = std::make_tuple(data.track_labels,data.track_list);
std::cout<<"size "<<data.track_list.size()<<std::endl;
}
}

}



Loading