22 #include "art_root_io/TFileDirectory.h" 23 #include "art_root_io/TFileService.h" 115 fTrainTree = tfs->make<TTree>(
"CVNTrainTree",
"Training records");
132 std::vector< art::Ptr< cvn::PixelMap > > pixelmaplist;
134 auto pixelmapListHandle = evt.
getHandle< std::vector< cvn::PixelMap > >(itag1);
135 if (pixelmapListHandle)
139 if(pixelmaplist.size() == 0)
return;
144 std::vector<art::Ptr<simb::MCTruth> > mclist;
146 if (mctruthListHandle)
167 nuEnergy = truthN.
Nu().
E();
168 lepEnergy = truthN.
Lepton().
E();
177 bool isFid = (fabs(vtx.X())<310 && fabs(vtx.Y())<550 && vtx.Z()>50 && vtx.Z()<1244);
181 float recoNueEnergy = 0.;
182 float recoNumuEnergy = 0.;
183 float recoNutauEnergy = 0.;
204 double eventWeight = 1.;
206 double mvaResult = 0.;
212 recoNumuEnergy, recoNutauEnergy, eventWeight, *pixelmaplist[0]);
214 int topPDG = labels.
GetPDG();
238 std::stringstream
name;
239 name <<
"PixelMap_r" << evt.
run() <<
"_s" << evt.
subRun()<<
"_e" << evt.
event() <<
"_sl" << slice;
240 std::stringstream nameL;
241 nameL <<
"PixelTruthMap_r" << evt.
run() <<
"_s" << evt.
subRun()<<
"_e" << evt.
event() <<
"_sl" << slice;
242 std::stringstream nameX;
243 nameX <<
"PixelMap_X_r" << evt.
run() <<
"_s" << evt.
subRun()<<
"_e" << evt.
event() <<
"_sl" << slice;
244 std::stringstream nameY;
245 nameY <<
"PixelMap_Y_r" << evt.
run() <<
"_s" << evt.
subRun()<<
"_e" << evt.
event() <<
"_sl" << slice;
246 std::stringstream nameZ;
247 nameZ <<
"PixelMap_Z_r" << evt.
run() <<
"_s" << evt.
subRun()<<
"_e" << evt.
event() <<
"_sl" << slice;
253 hist->SetName(name.str().c_str());
254 histL->SetName(nameL.str().c_str());
255 histX->SetName(nameX.str().c_str());
256 histY->SetName(nameY.str().c_str());
257 histZ->SetName(nameZ.str().c_str());
261 TH2F* histWrite = tfs->make<TH2F>(*hist);
263 TH2F* histWriteL = tfs->make<TH2F>(*histL);
264 histWriteL->GetZaxis()->SetRangeUser(0,10);
266 TH2F* histWriteX = tfs->make<TH2F>(*histX);
268 TH2F* histWriteY = tfs->make<TH2F>(*histY);
270 TH2F* histWriteZ = tfs->make<TH2F>(*histZ);
double E(const int i=0) const
EventNumber_t event() const
const simb::MCNeutrino & GetNeutrino() const
const TLorentzVector & EndPosition() const
unsigned short GetNPizeros()
unsigned int fTopologyHits
Handle< PROD > getHandle(SelectorBase const &) const
TH2F * SingleViewToTH2(const unsigned int &view) const
const simb::MCParticle & Nu() const
void WriteMapTH2(const art::Event &evt, int slice, const PixelMap &pm)
Function to extract TH2 from PixelMap and write to TFile.
unsigned short GetNNeutrons()
std::string fEnergyNueLabel
enum cvn::Interaction InteractionType
unsigned short GetTopologyType()
EDAnalyzer(fhicl::ParameterSet const &pset)
Utility class for truth labels.
InteractionType GetInteractionType(simb::MCNeutrino &truth)
std::string fPixelMapInput
unsigned short GetNProtons()
void Run(const art::Event &evt, std::vector< double > &result, double &wgt)
TH2F * ToTH2() const
Return the pixel map as a 2D histogram for visualization.
unsigned short GetTopologyTypeAlt()
PixelMap fPMap
PixelMap for the event.
def train(model, train_files, valid_files, maskpatterns, epochs, batchsize, info)
void GetTopology(const art::Ptr< simb::MCTruth > truth, unsigned int nTopologyHits)
const simb::MCParticle & Lepton() const
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
std::string fEnergyNumuLabel
SubRunNumber_t subRun() const
CVNEventDump(fhicl::ParameterSet const &pset)
void analyze(const art::Event &evt) override
std::string fGenieGenModuleLabel
void reconfigure(const fhicl::ParameterSet &pset)
Something else. Tau? Hopefully we don't use this.
The TrainingData objects contains a PixelMap and the output class type, and any other bit that goes i...
PixelMap, basic input to CVN neural net.
std::string fEnergyNutauLabel
Position4_t fNuLorentzVector
auto const & get(AssnsNode< L, R, D > const &r)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
unsigned short GetNPions()
Event generator information.
void SetTopologyInformation(int pdg, int nproton, int npion, int npizero, int nneutron, int toptype, int toptypealt)