24 fPEX (((nPlane/2)+(nPlane%2))*nCell),
25 fPEY (((nPlane/2)+(nPlane%2))*nCell),
26 fPur (PEOnly ? 0 : nPlane*nCell),
27 fPurX(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
28 fPurY(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
29 fLab (PEOnly ? 0 : nPlane*nCell),
30 fLabX(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
31 fLabY(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
32 fT (PEOnly ? 0 : nPlane*nCell),
33 fTX (PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
34 fTY (PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
35 fObj (PEOnly ? 0 : nPlane*nCell),
36 fObjX(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
37 fObjY(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
38 fNu (PEOnly ? 0 : nPlane*nCell),
39 fNuX (PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
40 fNuY (PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
41 fVie (PEOnly ? 0 : nPlane*nCell),
42 fVieX(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
43 fVieY(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
44 fHit (PEOnly ? 0 : nPlane*nCell),
45 fHitX(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
46 fHitY(PEOnly ? 0 : ((nPlane/2)+(nPlane%2))*nCell),
56 for(
const auto& pe:
fPE){
66 const float& pe,
unsigned int&
view,
unsigned int& hitID,
68 const double purity = 0.0,
const int object = 0,
71 const float scale = 2100.0;
82 fHit[pmIndex] = hitID;
97 fHitX[pmIdxS] = hitID;
109 fNuY[pmIdxS] = nuIdx;
111 fHitY[pmIdxS] = hitID;
122 const unsigned int&
cell,
123 const unsigned int&
view )
138 const unsigned int&
cell)
const 148 const unsigned int&
cell,
149 const unsigned int&
view)
168 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
169 for(
unsigned int iPlane = 0; iPlane <
fNPlane; iPlane += 2){
178 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
179 for(
unsigned int iPlane = 1; iPlane <
fNPlane; iPlane += 2){
194 const std::vector<float> *pPEXY;
199 else pPEXY = (&
fPEY);
200 unsigned int index = 0;
203 for(
unsigned int iPlane = 0; iPlane <
NPlanePerView(); ++iPlane){
204 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
208 ofs << batch <<
" " <<
view <<
" " << iPlane <<
":";
209 ofs.write(cells, fNCell);
218 else pPEXY = (&
fPEY);
219 unsigned int index = 0;
222 for(
unsigned int iPlane = 0; iPlane <
NPlanePerView(); ++iPlane){
223 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
227 ofs << batch <<
" " <<
view <<
" " << iPlane <<
":";
228 ofs.write(cells, fNCell);
243 for(
unsigned int iPlane = 0; iPlane <
fNPlane; ++iPlane){
244 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
247 hist->SetBinContent(iPlane+1,
265 for(
unsigned int iPlane = 0; iPlane <
fNPlane; ++iPlane){
266 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
271 if(pe > 0 && lab < 1) lab = 0.1;
275 hist->SetBinContent(iPlane+1,
292 for(
unsigned int iPlane = 0; iPlane <
fNPlane; ++iPlane){
293 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
302 hist->SetBinContent(iPlane+1,
318 for(
unsigned int iPlane = 0; iPlane < ((
fNPlane/2)+(
fNPlane%2)); ++iPlane){
319 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
324 hist->SetBinContent(iPlane+1, iCell+1, pe);
333 bool time =
false)
const 339 for(
unsigned int iPlane = 0; iPlane < ((
fNPlane/2)+(
fNPlane%2)); ++iPlane){
340 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
346 if(pe > 0 && lab < 1) lab = 0.1;
351 hist->SetBinContent(iPlane+1, iCell+1, value);
361 bool nuID =
false)
const 367 for(
unsigned int iPlane = 0; iPlane < ((
fNPlane/2)+(
fNPlane%2)); ++iPlane){
368 for(
unsigned int iCell = 0; iCell <
fNCell; ++iCell){
374 if ( pe > 0 && nu == 0 ) nu = 0.1;
376 double value = ( nuID ) ? nu : obj;
379 hist->SetBinContent(iPlane+1, iCell+1, value);
389 os <<
"PixelMap with " << m.
NPixel() <<
" pixels, " 390 << m.
NPlane() <<
" planes" 391 <<
" by " << m.
NCell() <<
" cells" ;
401 if (useGeV) peCorrChunk = 1.322e-4 / 255.0;
402 else peCorrChunk = 2.0/255.0;
404 float truncateCorr = ceil(n/peCorrChunk);
405 if (truncateCorr > 255)
return (
unsigned char)255;
406 else return (
unsigned char)truncateCorr;
412 if (n > 0)
return (
unsigned char)1;
413 else return (
unsigned char)0;
419 int channels(2), planes(0), cells(0);
422 std::vector<unsigned char> pixels(
channels*planes*cells);
426 for (
int iChan = 0; iChan <
channels; ++iChan)
428 for (
int iPlane = 0; iPlane < planes; ++iPlane)
430 for (
int iCell = 0; iCell < cells; ++iCell)
432 int i = iCell + cells*(iPlane + planes*iChan);
433 unsigned char lab = (iChan == 0) ?
434 fLabX.at(iCell + cells*iPlane) :
435 fLabY.at(iCell + cells*iPlane);
436 unsigned char obj = (iChan == 0) ?
437 fObjX.at(iCell + cells*iPlane) :
438 fObjY.at(iCell + cells*iPlane);
440 unsigned char pix = (useLabels) ? lab : obj;
451 int channels(2), planes(0), cells(0);
454 std::vector<unsigned char> pixels(
channels*planes*cells);
455 for (
int iChan = 0; iChan <
channels; ++iChan)
457 for (
int iPlane = 0; iPlane < planes; ++iPlane)
459 for (
int iCell = 0; iCell < cells; ++iCell)
461 int i = iCell + cells*(iPlane + planes*iChan);
462 float val = (iChan == 0) ?
463 fPEX.at(iCell + cells*iPlane) :
464 fPEY.at(iCell + cells*iPlane);
477 std::vector<unsigned int>* cells,
478 std::vector<unsigned int>*
chan,
479 std::vector<unsigned char>*
values,
486 unsigned int entries = 0;
487 for (
int iChan = 0; iChan <
channels; ++iChan)
489 for (
int iPlane = 0; iPlane <
nplanes; ++iPlane)
491 for (
int iCell = 0; iCell <
ncells; ++iCell)
493 float val = (iChan == 0) ?
494 fPEX.at(iCell + ncells*iPlane) :
495 fPEY.at(iCell + ncells*iPlane);
496 if (val == 0)
continue;
498 values->push_back(pix);
499 planes->push_back(iPlane);
500 cells->push_back(iCell);
501 chan->push_back(iChan);
int FirstCell(const unsigned int &view) const
unsigned int fOccupiedPixelsX
Number of non-zero entries in pixel map. Counted when the Add function is called. ...
std::vector< unsigned char > PixelMapToObjVector(bool useLabels) const
TH2F * SingleViewToTH2(const unsigned int &view, TString name) const
std::vector< float > fT
Vector of Time of hits.
std::vector< float > fPEY
Vector of Y PE measurements for pixels.
unsigned int NPixel() const
Total number of pixels in map.
unsigned int fOccupiedPixels
Number of non-zero entries in pixel map. Counted when the Add function is called. ...
unsigned int NPlane() const
Length in planes.
std::ostream & operator<<(std::ostream &os, const PixelMapProducer &p)
unsigned int fNPlane
Number of planes, length of pixel map.
std::vector< int > fObjX
Vector of X Particle Idx of hits.
void FillInputVector(float *input) const
void Add(const unsigned int &plane, const unsigned int &cell, const float &pe, unsigned int &view, unsigned int &hitID, const float &time, const HitType label, const double purity, const int object, const int nuIdx)
std::vector< unsigned int > fVieX
Vector of X hit view.
unsigned int FirstView() const
std::vector< int > fObjY
Vector of Y Particle Idx of hits.
Defines an enumeration for prong classification.
::xsd::cxx::tree::time< char, simple_type > time
unsigned char ConvertHitsToChar(float n) const
std::vector< int > fNu
Vector of Nu Index of hits.
TH2F * ToLabTH2(TString name) const
std::vector< float > fPE
Vector of PE measurements for pixels.
unsigned int PixelMapToVectors(std::vector< unsigned int > *planes, std::vector< unsigned int > *cells, std::vector< unsigned int > *chan, std::vector< unsigned char > *values, bool useGeV) const
TH2F * ToTH2(TString name) const
std::map< ToFCounter, std::vector< unsigned int > > channels
std::vector< HitType > fLabY
Vector of Y Truth labels for pixels.
std::vector< unsigned int > fHit
Vector of hit IDs.
std::vector< unsigned int > fHitY
Vector of Y hit IDs.
const XML_Char int const XML_Char * value
std::vector< unsigned char > PixelMapToVector(bool useGeV) const
std::vector< int > fObj
Vector of Particle Idx of hits.
std::vector< float > fPEX
Vector of X PE measurements for pixels.
std::vector< unsigned int > fVie
Vector of hit view.
unsigned int fOccupiedPixelsY
Number of non-zero entries in pixel map. Counted when the Add function is called. ...
std::vector< unsigned int > fVieY
Vector of Y hit view.
TH2F * ToObjTH2(TString name) const
unsigned int NPlanePerView() const
Length in planes per view.
TH2F * SingleViewToObjTH2(const unsigned int &view, TString name, bool nuID) const
unsigned int fNCell
Number of cells, width of pixel map.
std::vector< float > fTX
Vector of X Time of hits.
void ToFile(std::ofstream &ofs, int batch, bool hits=false) const
Return the pixel map as a 2D histogram for visualization.
unsigned int LocalToIndex(const unsigned int &plane, const unsigned int &cell) const
Take local plane, cell (within map) and return index in fPE vector.
unsigned char ConvertToChar(float n, bool useGeV) const
std::vector< float > fTY
Vector of Y Time of hits.
std::vector< int > fNuX
Vector of X Nu Index of hits.
PixelMap, basic input to CVN neural net.
std::vector< double > fPurY
Vector of Y purity for pixels.
std::vector< unsigned int > fHitX
Vector of X hit IDs.
assert(nhit_max >=nhit_nbins)
std::vector< HitType > fLabX
Vector of X Truth labels for pixels.
unsigned int GlobalToIndexSingle(const unsigned int &plane, const unsigned int &cell, const unsigned int &view)
Take global plane, cell (detector) and return index in fPE vector.
unsigned int GlobalToIndex(const unsigned int &plane, const unsigned int &cell, const unsigned int &view)
Take global plane, cell (detector) and return index in fPE vector.
TH2F * SingleViewToLabTH2(const unsigned int &view, TString name, bool time) const
std::vector< HitType > fLab
Vector of Truth labels for pixels.
std::vector< int > fNuY
Vector of Y Nu Index of hits.
bool IsWithin(const unsigned int &plane, const unsigned int &cell, const unsigned int &view=0)
std::vector< double > fPur
Vector of purity for pixels.
std::vector< double > fPurX
Vector of X purity for pixels.
unsigned int NCell() const
Width in cells.