33 #include "art_root_io/TFileService.h" 56 void SaveTree(std::vector<recob::Hit>
const& shwHits, std::vector<recob::Hit>
const& trkHits);
97 fOutTree = tfs->make<TTree>(
"cnnHitTree",
"cnnHitTree");
137 int trkLikeIdx = cluResults->getIndex(
"track");
138 int emLikeIdx = cluResults->getIndex(
"em");
139 if ((trkLikeIdx < 0) || (emLikeIdx < 0)) {
145 const auto & cnnOuts = cluResults->outputs();
146 for (
size_t i = 0; i < cnnOuts.size(); ++i){
148 double trkOrEm = cnnOuts[i][trkLikeIdx] + cnnOuts[i][emLikeIdx];
152 val = cnnOuts[i][trkLikeIdx] / trkOrEm;
154 weights.push_back(val);
166 std::vector<float> mvaWeights;
169 ReadMVA<4>(mvaWeights,
evt);
170 if(mvaWeights.size() == 0){
172 ReadMVA<3>(mvaWeights,
evt);
176 if(mvaWeights.size() != 0){
182 art::FindOneP<raw::RawDigit> rawDigits(inputHits,evt,
fHitLabel);
183 art::FindOneP<recob::Wire> recoWires(inputHits,evt,
fHitLabel);
190 auto const& hits = hitsFromClusters.at(
c);
193 for (
auto const &
h : hits){
196 auto digit = rawDigits.at(
h.key());
197 auto wire = recoWires.at(
h.key());
209 std::cout <<
"CNN output splitter: " <<
std::endl;
210 std::cout <<
" - Found " << showerHits.
size() <<
" shower-like hits" <<
std::endl;
211 std::cout <<
" - Found " << trackHits.
size() <<
" track-like hits" <<
std::endl;
231 for(
auto const shwHit : shwHits){
233 fOutCryo = shwHit.WireID().Cryostat;
234 fOutPlane = shwHit.WireID().planeID().Plane;
243 for(
auto const trkHit : trkHits){
245 fOutCryo = trkHit.WireID().Cryostat;
246 fOutPlane = trkHit.WireID().planeID().Plane;
EventNumber_t event() const
Handle< PROD > getHandle(SelectorBase const &) const
EDProducer(fhicl::ParameterSet const &pset)
std::string fMVAClusterLabel
static void declare_products(art::ProducesCollector &collector, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
ShowerHitSeparator(fhicl::ParameterSet const &pset)
Helper functions to create a hit.
A class handling a collection of hits and its associations.
#define DEFINE_ART_MODULE(klass)
void SaveTree(std::vector< recob::Hit > const &shwHits, std::vector< recob::Hit > const &trkHits)
T get(std::string const &key) const
void ReadMVA(std::vector< float > &weights, art::Event &evt)
SubRunNumber_t subRun() const
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
void put_into(art::Event &)
Moves the data into an event.
ProducesCollector & producesCollector() noexcept
size_t size() const
Returns the number of hits currently in the collection.
Declaration of signal hit object.
void reconfigure(fhicl::ParameterSet const &p)
art::Handle< std::vector< recob::Cluster > > fMVAClusters
void produce(art::Event &evt)
2D representation of charge deposited in the TDC/wire plane
std::vector< recob::Hit > const & peek() const
Returns a read-only reference to the current list of hits.
static std::unique_ptr< MVAReader > create(const art::Event &evt, const art::InputTag &tag)
QTextStream & endl(QTextStream &s)