8 #include "TMVA/Reader.h" 21 #include "Utilities/AssociationUtil.h" 65 produces< std::vector<qeef::QePId> >();
66 produces< art::Assns<qeef::QePId, rb::Cluster> >();
92 fknn1trkfile = knnlibpath+
"TMVAClassification_KNN_qe_1track.weights.xml";
93 fknn2trkfile = knnlibpath+
"TMVAClassification_KNN_qe_2track.weights.xml";
97 fknn1trkfile = knnlibpath+
"TMVAClassification_KNN_qe_1track.nd.weights.xml";
98 fknn2trkfile = knnlibpath+
"TMVAClassification_KNN_qe_2track.nd.weights.xml";
100 else{
std::cerr <<
"This file isn't near or far detector, algorithm doesn't work on any other" <<
std::endl;}
126 std::unique_ptr< std::vector<qeef::QePId> > qeefOut(
new std::vector<qeef::QePId>);
139 for(
size_t isl =0; isl < slices->size(); ++isl){
144 if(slice->
IsNoise() || !trkAss.isValid()){
continue; }
150 const std::vector<art::Ptr<rb::Track> > tracks = trkAss.at(isl);
153 if(tracks.size() < 3 && tracks.size() > 0){
162 std::vector<art::Ptr<rb::CellHit> > trkHits;
165 for(
size_t itrk = 0; itrk < tracks.size(); ++itrk){
169 if(track->
Is3D()){ ++n3dtrk; }
172 for(
unsigned int ihit = 0; ihit < track->
NCell(); ++ihit){
173 trkHits.push_back(track->
Cell(ihit));
182 if((n3dtrk == 1 && tracks.size() == 1) ||
183 (n3dtrk >=1 && tracks.size() == 2)){
187 for(
unsigned int slhit = 0; slhit < slice->
NCell(); ++slhit){
190 for(
unsigned int trhit = 0; trhit < trkHits.size(); ++trhit){
191 if(slice->
Cell(slhit) == trkHits[trhit]){
196 if(!intrk){ nontrkHits.
Add(slice->
Cell(slhit)); }
211 std::vector<art::Ptr<numue::NumuE> > numuEnergy = eAss.at(isl);
212 if(numuEnergy.size() > 0){
215 float angleQEE = numuEnergy[0]->AngleQEE();
216 float errAngleQEE = numuEnergy[0]->AngleQEError();
217 float trkQEE = numuEnergy[0]->TrkQEE();
220 if( angleQEE < 0.0 || angleQEE > 40 || errAngleQEE < 0.0 || errAngleQEE > 40 || trkQEE > 20){
226 ediff = (angleQEE - trkQEE)/trkQEE;
227 ediffZ = (angleQEE - trkQEE)/errAngleQEE;
229 if(tracks.size() == 1){
231 if(nontrkHits.
NCell() > 0){
237 std::vector<float> knnInputs(3);
239 knnInputs[1] =
ediff;
241 double kNN =
knn1trk->EvaluateMVA(knnInputs,
"KNN method");
252 if(bestId == 1){ nonmuId = 0; }
256 if(nontrkHits.
NCell() > 0){
263 std::vector<float> knnInputs(4);
265 knnInputs[1] =
ediff;
268 double kNN =
knn2trk->EvaluateMVA(knnInputs,
"KNN method");
292 qeefOut->push_back(qepid);
298 evt.
put(std::move(qeefOut));
299 evt.
put(std::move(qeAss));
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
std::string EnvExpansion(const std::string &inString)
Function to expand environment variables.
void SetEdiff(double diff)
A collection of associated CellHits.
void produce(art::Event &evt)
DEFINE_ART_MODULE(TestTMapFile)
virtual void Add(const art::Ptr< rb::CellHit > &cell, double weight=1)
QeFinder(fhicl::ParameterSet const &pset)
ProductID put(std::unique_ptr< PROD > &&product)
void SetEdiffZ(double diffZ)
Far Detector at Ash River, MN.
T get(std::string const &key) const
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
void SetDedx(double Dedx)
void SetOffTrkE(double E)
Near Detector in the NuMI cavern.
A QE Event Finder for muons.
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
A module for finding numu CC QE interactions.
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
bool IsNoise() const
Is the noise flag set?
Encapsulate the geometry of one entire detector (near, far, ndos)
virtual bool Is3D() const
unsigned int HighestPIDTrack(const std::vector< art::Ptr< rb::Track > > &sliceTracks, const std::string &remidModuleLabel, const art::Event &e)