22 #include "NovaDAQConventions/DAQConventions.h" 30 #include "Utilities/AssociationUtil.h" 31 #include "Utilities/func/MathUtil.h" 62 produces< std::vector<nussand::NusSandObj> >();
63 produces< art::Assns<nussand::NusSandObj, rb::Cluster> >();
79 if(slicevec->empty()) {
80 LOG_WARNING(
"NusSandbox") <<
"No Slices in the input file";
89 std::unique_ptr< std::vector<nussand::NusSandObj> > outputObjects(
new std::vector<nussand::NusSandObj>);
94 const double beamx = beamdir.X();
95 const double beamy = beamdir.Y();
96 const double beamz = beamdir.Z();
103 for(
size_t slcIdx = 0; slcIdx < slicevec->size(); ++slcIdx){
112 if(!fmpVert.isValid()) {
114 outputObjects->push_back(sandbox);
119 std::vector< art::Ptr<rb::Vertex> >
v = fmpVert.at(slcIdx);
120 if(v.size() != 1)
continue;
122 if(!fmpTrack.isValid()) {
124 outputObjects->push_back(sandbox);
135 double ezxFinal = 0.;
136 double ezyFinal = 0.;
138 std::vector< art::Ptr<rb::Track> > tracks = fmpTrack.at(slcIdx);
139 for(
size_t trkIdx = 0; trkIdx < tracks.size(); ++trkIdx){
143 TVector3 tDir = track->
Dir().Unit();
149 for(
size_t hitIdx = 0; hitIdx < track->
NXCell(); ++hitIdx){
155 TVector3 tdirx = track->
Dir().Unit();
156 xFinal +=
fabs(tDir.X());
158 exFinal +=
fabs(tDir.X())*xtrkE;
159 ezxFinal += tDir.Z()*xtrkE;
163 for(
size_t hitIdx = 0; hitIdx < track->
NYCell(); ++hitIdx){
168 yFinal +=
fabs(tDir.Y());
170 eyFinal +=
fabs(tDir.Y())*ytrkE;
171 ezyFinal += tDir.Z()*ytrkE;
174 LOG_INFO(
"NusSandbox") <<
"Not a geo::kX or geo::kY view. Don't do anything!";
190 double beamTrkXZ = ((xFinal*xbeam + zxFinal*zxbeam)/fTXZ);
191 double beamTrkYZ = ((yFinal*ybeam + zyFinal*zybeam)/fTYZ);
192 double beamTrkEXZ = ((exFinal*xbeam + ezxFinal*zxbeam)/fTEXZ);
193 double beamTrkEYZ = ((eyFinal*ybeam + ezyFinal*zybeam)/fTEYZ);
205 outputObjects->push_back(sandbox);
209 evt.
put(std::move(outputObjects));
210 evt.
put(std::move(assoc));
virtual geo::View_t View() const
kXorY for 3D clusters.
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.
void produce(art::Event &evt)
void SetSumTY(float sumty)
sum of track direction YZ-view unit vectors
art::Ptr< rb::CellHit > XCell(unsigned int xIdx) const
Get the ith cell in the x-view.
fvar< T > fabs(const fvar< T > &x)
void SetAngSumTY(float angsumty)
angle with respect to beam of sum of track direction XZ-view unit vectors
void SetCosSumTY(float cossumty)
cosine angle with respect to beam of sum of track direction YZ-view unit vectors
virtual ~FillNusSandbox()
Vertical planes which measure X.
Sandbox to make objects for nu_s analysis in CAF.
DEFINE_ART_MODULE(TestTMapFile)
void SetCosEWSumTX(float cosewsumtx)
cosine angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
Horizontal planes which measure Y.
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
ProductID put(std::unique_ptr< PROD > &&product)
void SetCosEWSumTY(float cosewsumty)
cosine angle with respect to beam of energy-weighted sum of track direction YZ-view unit vectors ...
art::Ptr< rb::CellHit > YCell(unsigned int yIdx) const
Get the ith cell in the y-view.
virtual TVector3 Dir() const
Unit vector describing prong direction.
rb::RecoHit RecoHit(const art::Ptr< rb::CellHit > &chit) const
Return calibrated hit based on assumed W coordinate.
bool IsCalibrated() const
You MUST check here before accessing PECorr, MIP or GeV.
Vertex location in position and time.
void SetAngSumTX(float angsumtx)
angle with respect to beam of sum of track direction XZ-view unit vectors
#define LOG_WARNING(category)
void SetAngEWSumTY(float angewsumty)
angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
void SetEWSumTY(float ewsumty)
energy-weighted sum of track direction YZ-view unit vectors
unsigned int NYCell() const
Number of cells in the y-view.
TVector3 NuMIBeamDirection() const
Direction of neutrinos from the NuMI beam (unit vector)
FillNusSandbox(fhicl::ParameterSet const &pset)
void SetCosSumTX(float cossumtx)
cosine angle with respect to beam of sum of track direction XZ-view unit vectors
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
double pythag(double x, double y)
2D Euclidean distance
unsigned int NXCell() const
Number of cells in the x-view.
void SetEWSumTX(float ewsumtx)
energy-weighted sum of track direction XZ-view unit vectors
bool IsNoise() const
Is the noise flag set?
void SetAngEWSumTX(float angewsumtx)
angle with respect to beam of energy-weighted sum of track direction XZ-view unit vectors ...
void SetSumTX(float sumtx)
sum of track direction XZ-view unit vectors
double Weight(unsigned int globalIdx) const
Weight assigned to the cell.
Encapsulate the geometry of one entire detector (near, far, ndos)