13 #include "TMarker3DBox.h" 14 #include "TPolyLine3D.h" 15 #include "TPolyMarker3D.h" 24 #include "DAQChannelMap/HardwareDisplay.h" 44 void writeErrMsg(
const char*
fcn,
48 <<
" failed with message:\n" 81 std::vector<const rawdata::RawDigit*> rawhits;
84 for (
unsigned int i=0;
i<rawhits.size(); ++
i) {
86 double q = rawhits[
i]->ADC();
87 if (thisto!=0) thisto->Fill(t);
93 if (t>drawopt->
fTimeRange[0] && t<drawopt->fTimeRange[1]) {
117 std::vector<const rb::Cluster*> slicesToNavigate = nav->
SlicesToNavigate(evt);
120 std::set<std::pair<uint32_t, int16_t>> unfiltHits;
122 int n = slicesToNavigate.size();
123 for(
int i=0 ;
i <
n; ++
i ){
131 for(
int c = 0,
nc = slicesToNavigate[
i]->NCell();
c <
nc; ++
c){
134 unfiltHits.emplace(chit.
Channel(), chit.
TDC());
141 std::vector< const rawdata::RawDigit*> rawhits;
144 for (
unsigned int i=0;
i<rawhits.size(); ++
i) {
145 unsigned int ch = rawhits[
i]->DaqChannel();
146 unsigned int diblock = (ch&0x0FC00000)>>22;
147 unsigned int dcm = (ch&0x003F0000)>>16;
148 unsigned int feb = (ch&0x0000FF00)>>8;
149 unsigned int pix = (ch&0x000000FF)>>0;
151 hd.
DAQToXY(diblock, dcm, feb, pix, &ix, &iy);
156 q = rawhits[
i]->ADC();
163 int co = this->
HitColor(rawhits[
i], unfiltHits, &ghosted);
166 if (ghosted)
continue;
170 TBox& b1 = view->
AddBox(ix-0.5*sf,iy-0.5*sf,ix+0.5*sf,iy+0.5*sf);
171 b1.SetFillStyle(1001);
173 b1.SetBit(kCannotPick);
176 TBox& b2 = view->
AddBox(ix-0.5*sf,iy-0.5*sf,ix+0.5*sf,iy+0.5*sf);
178 if (ghosted) b2.SetLineColor(17);
179 else b2.SetLineColor(14);
180 b2.SetBit(kCannotPick);
198 l.SetBit(kCannotPick);
209 l.SetBit(kCannotPick);
214 sprintf(buff,
"DB%.2u",
i);
217 TText&
t = view->
AddText(ix,-1,buff);
224 sprintf(buff,
"DCM%.2u",
i);
227 TText&
t = view->
AddText(-1,iy,buff);
248 std::vector<const rb::Cluster*> slicesToNavigate = nav->
SlicesToNavigate(evt);
249 std::set<std::pair<uint32_t, int16_t>> unfiltHits;
251 for(
int i=0,
n = slicesToNavigate.size();
i <
n; ++
i ){
258 for(
int c = 0,
nc = slicesToNavigate[
i]->NCell();
c <
nc; ++
c){
260 unfiltHits.emplace(chit.
Channel(), chit.
TDC());
272 for(
bool drawDimmed: {
true,
false}){
273 std::vector< const rawdata::RawDigit*> rawhits;
276 for (
unsigned int i=0;
i<rawhits.size(); ++
i) {
281 std::cerr <<
"*- Illegal plane number " << plane
283 << std::hex << rawhits[
i]->DaqChannel()
291 std::cerr <<
"*- Illegal cell number " << cell
292 <<
" in plane " << plane
293 <<
"*- DaqChannel = " 294 << std::hex << rawhits[
i]->DaqChannel()
302 double tpos = 0.0, zpos = 0.0;
334 if (xzview!=0) v = xzview;
335 if (yzview!=0) v = yzview;
340 q = rawhits[
i]->ADC();
348 if(
DimFiltered(rawhits[i], unfiltHits) != drawDimmed)
continue;
351 int co = this->
HitColor( rawhits[i], unfiltHits, &ghosted);
354 if (ghosted)
continue;
358 TBox& b1 = v->
AddBox(zpos-sf*dz,tpos-sf*dt,zpos+sf*dz,tpos+sf*dt);
359 b1.SetFillStyle(1001);
361 b1.SetBit(kCannotPick);
364 TBox& b2 = v->
AddBox(zpos-dz,tpos-dt,zpos+dz,tpos+dt);
366 if (ghosted) b2.SetLineColor(17);
367 else b2.SetLineColor(14);
368 b2.SetBit(kCannotPick);
378 const std::set<std::pair<uint32_t, int16_t>>& unfiltHits,
383 for (
unsigned int i=0;
i<rawhits.size(); ++
i) {
387 q = rawhits[
i]->ADC();
391 int icell = cmap->
GetCell(rawhits[i]);
395 geom->
CellInfo(iplane, icell, &v, xyz, dxyz);
398 int co = this->
HitColor(rawhits[i], unfiltHits, &ghosted);
399 if (ghosted)
continue;
440 std::vector<const rb::Cluster*> slicesToNavigate = nav->
SlicesToNavigate(evt);
441 std::set<std::pair<uint32_t, int16_t>> unfiltHits;
443 for (
int i=0,
n = slicesToNavigate.size();
i<
n; ++
i){
451 for(
int c=0,
nc=slicesToNavigate[
i]->NCell();
c<
nc; ++
c){
453 unfiltHits.emplace(chit.
Channel(), chit.
TDC());
457 std::vector< const rawdata::RawDigit*> rawhits;
475 double* zmin,
double*
zmax)
491 std::vector<const rawdata::RawDigit*>& rawhits)
496 std::vector<const rawdata::RawDigit*>
temp;
504 temp.reserve(rdcol->size());
505 for(
const T& dig: *rdcol) temp.push_back(&dig);
524 std::vector<const rawdata::RawDigit*>& rawhits)
529 std::vector<const rawdata::RawDigit*>
temp;
532 std::vector<art::Handle<std::vector<rawdata::RawDigit>>> rdcol_vec;
535 if(rdcol_vec.empty())
return false;
537 for(
const art::Handle<std::vector<rawdata::RawDigit>>& digs: rdcol_vec)
539 temp.push_back(&dig);
557 std::vector<const rawdata::RawDigit*>& rawhits)
565 std::vector<const rawdata::RawDigit*> digs;
566 if(GetRawDigits<rawdata::RawDigit>(evt,
571 rawhits.insert(rawhits.end(), digs.begin(), digs.end());
579 std::vector<const rawdata::RawDigit*> digs;
580 if(GetRawDigits<rb::CellHit>(evt,
585 rawhits.insert(rawhits.end(), digs.begin(), digs.end());
591 <<
": Could not find any hits. Looked under labels";
609 std::vector< art::Handle< std::vector<rawdata::RawTrigger> > > rtcol;
613 for(
size_t rtc = 0; rtc < rtcol.size(); ++rtc){
614 for(
unsigned int i=0;
i < rtcol[rtc]->size(); ++
i){
622 writeErrMsg(
"GetRawTrigger", e);
635 const std::set<std::pair<uint32_t, int16_t>>& unfiltered,
643 double q = hit->
ADC();
658 if(colors->
Background(0) == kWhite)
return 18;
else return 12;
661 switch (drawopt->
fColor) {
679 const std::set<std::pair<uint32_t, int16_t>>& unfiltered)
682 if(!nav->DimHits() && !nav->DimOthers() )
return false;
699 sf *= 3.0*
sqrt(q/q0);
727 double arms[8][2] = {
737 double body[9][2] = {
749 for (i=0; i<8; ++
i) {
750 if (leg[i][0]<xlo) xlo = leg[
i][0];
751 if (leg[i][0]>xhi) xhi = leg[
i][0];
752 if (leg[i][1]<ylo) ylo = leg[
i][1];
753 if (leg[i][1]>yhi) yhi = leg[
i][1];
755 for (i=0; i<8; ++
i) {
756 if (arms[i][0]<xlo) xlo = arms[
i][0];
757 if (arms[i][0]>xhi) xhi = arms[
i][0];
758 if (arms[i][1]<ylo) ylo = arms[
i][1];
759 if (arms[i][1]>yhi) yhi = arms[
i][1];
761 for (i=0; i<8; ++
i) {
762 if (body[i][0]<xlo) xlo = body[
i][0];
763 if (body[i][0]>xhi) xhi = body[
i][0];
764 if (body[i][1]<ylo) ylo = body[
i][1];
765 if (body[i][1]>yhi) yhi = body[
i][1];
768 double sf = h/
fabs(yhi-ylo);
770 double z0 = z-sf*
fabs(xhi-xlo)-2.0;
772 for (i=0; i<8; ++
i) {
773 leg[
i][0] = z0+sf*(leg[
i][0]-
xlo);
774 leg[
i][1] = y0+sf*(leg[
i][1]-
ylo);
776 for (i=0; i<8; ++
i) {
777 arms[
i][0] = z0+sf*(arms[
i][0]-
xlo);
778 arms[
i][1] = y0+sf*(arms[
i][1]-
ylo);
780 for (i=0; i<9; ++
i) {
781 body[
i][0] = z0+sf*(body[
i][0]-
xlo);
782 body[
i][1] = y0+sf*(body[
i][1]-
ylo);
794 for (i=0; i<8; ++
i) {
795 l.SetPoint(i,x,leg[i][1],leg[i][0]);
797 for (i=0; i<8; ++
i) {
798 a.SetPoint(i,x,arms[i][1],arms[i][0]);
800 for (i=0; i<9; ++
i) {
801 b.SetPoint(i,x,body[i][1],body[i][0]);
bool DimFiltered(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered)
void RawDigitHardware(const art::Event &evt, evdb::View2D *view)
std::vector< float > fTimeRange
static const int kSUPPRESS_GHOSTED_HITS
diblock
print "ROW IS " print row
void GetCenter(double *xyz, double localz=0.0) const
unsigned int fXmax
Width of entire view.
std::map< std::string, double > xmax
int32_t TDC() const
The time of the last baseline sample.
fvar< T > fabs(const fvar< T > &x)
void RawDigit2D(const art::Event &evt, evdb::View2D *xzview, evdb::View2D *yzview)
double fXmax
X range spanned by the hits.
unsigned int fNdcmSide
Number of DMC's per diblock on side of detector.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void swap(PtrVector &other)
TMarker3DBox & AddMarker3DBox(double x, double y, double z, double dx, double dy, double dz, double th=0.0, double ph=0.0)
void GetLimits(double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
TLine & AddLine(double x1, double y1, double x2, double y2)
const CellGeo * Cell(int icell) const
Define a color scale for displaying numeric data.
Vertical planes which measure X.
unsigned int Ncells() const
Number of cells in this plane.
bool InBounds(double x) const
::xsd::cxx::tree::exception< char > exception
std::vector< std::string > fCellHitsModules
A collection of drawable 2-D objects.
static const int kSCALE_HITS_BY_CHARGE
int GetColor(double x) const
void DAQToXY(unsigned int db, unsigned int dcm, unsigned int feb, unsigned int pix, unsigned int *ix, unsigned int *iy)
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
const PlaneGeo * Plane(unsigned int i) const
static const int kOUTLINE_CELLS
void RawDigit3D(const art::Event &evt, evdb::View3D *view)
Horizontal planes which measure Y.
void CellInfo(unsigned int ip, unsigned int ic, View_t *view=0, double *pos=0, double *dpos=0) const
static const int kSUPPRESS_DIMMED_HITS
TPolyLine3D & AddPolyLine3D(int n, int c, int w, int s)
static const int kCOLOR_BY_TIME
bool FullEventMode() const
TBox & AddBox(double x1, double y1, double x2, double y2)
unsigned int fNdiblocks
Number of diblocks in detector.
View_t View() const
Which coordinate does this plane measure.
std::vector< std::string > fRawDigitsModules
void push_back(Ptr< U > const &p)
std::vector< std::string > fRawDigitsInstances
void GetRawDigitsAllLabels(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)
unsigned int fNfebRows
Number of FEB rows in a DCM.
int GetRawTrigger(const art::Event &evt, art::PtrVector< rawdata::RawTrigger > &rawtrigger)
ColorScale & Scale(const std::string &nm)
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Geometry information for a single readout plane.
TText & AddText(double x, double y, const char *text)
void FillTQHisto(const art::Event &evt, TH1F *thisto, TH1F *qhisto)
void getManyByType(std::vector< Handle< PROD >> &results) const
unsigned int fNdcmTop
Number of DMC's per diblock on top of detector.
unsigned short GetPlane(const rawdata::RawDigit *dig)
double ScaleFactor(double t, double q)
int CurrentSliceIndex() const
static const int kCOLOR_BY_CHARGE
double DetHalfHeight() const
void StickFigure(evdb::View3D *view, double x, double y, double z)
Class to aid in the rendering of RawData objects.
static double kUSEC_PER_TDC
unsigned int fYmax
Height of entire view.
static const int kMASK_BAD_CHANNELS
A rawdata::RawDigit with channel information decoded.
double fYmax
Y range spanned by the hits.
double DetHalfWidth() const
int16_t ADC(uint32_t i) const
Plot hits (Raw, Calib, ...) as a tower in 3D.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
unsigned int fNfebCols
Number of FEB columns in a DCM.
int Apply(art::PtrVector< rawdata::RawDigit > &rd)
void Draw3DHitBoxes(std::vector< const rawdata::RawDigit * > &hits, const std::set< std::pair< uint32_t, int16_t >> &unfiltHits, evdb::View3D *view)
unsigned short GetCell(const rawdata::RawDigit *dig)
Global drawing options that apply to all displays.
double fZmax
Z range spanned by the hits.
A collection of 3D drawable objects.
bool GetRawDigits(const art::Event &evt, const std::string &which, const std::string &instance, std::vector< const rawdata::RawDigit * > &rawhits)
unsigned int NPlanes() const
unsigned int fNpixCols
Number of pixel columns in an FEB.
static const int kRAW_HITS
Encapsulate the cell geometry.
std::vector< std::string > fCellHitsInstances
int HitColor(const rawdata::RawDigit *hit, const std::set< std::pair< uint32_t, int16_t >> &unfiltered, int *ghosted)
unsigned int fNpixRows
Number of pixel rows in an FEB.
Encapsulate the geometry of one entire detector (near, far, ndos)
std::vector< const rb::Cluster * > SlicesToNavigate(const art::Event &evt)
int fOutline
Which outlines to draw.
Global drawing options that apply to all displays.
bool GetRawDigitsMulti(const art::Event &evt, std::vector< const rawdata::RawDigit * > &rawhits)