Public Member Functions | Private Member Functions | Private Attributes | List of all members
gar::evd::RawDataDrawer Class Reference

Aid in the rendering of RawData objects. More...

#include <RawDataDrawer.h>

Public Member Functions

 RawDataDrawer ()
 
 ~RawDataDrawer ()
 
void RawDigit3D (art::Event const &evt, evdb::View3D *view)
 Draws raw digit content in 2D wire plane representation. More...
 

Private Member Functions

void FillQHisto (gar::raw::RawDigit const &dig, TH1F *histo)
 
void DrawRawDigit3D (art::Event const &evt, evdb::View3D *view)
 Performs the 3D drawing. More...
 
void GetRawDigits (art::Event const &evt, std::vector< const raw::RawDigit * > &digits)
 Makes sure raw::RawDigit's are available for the current settings. More...
 

Private Attributes

TH1F * fEventTQHist
 Charge vs time for all digits in an event. More...
 
TH1F * fDigitTQHist
 Charge vs time for a single channel in an event. More...
 

Detailed Description

Aid in the rendering of RawData objects.

Definition at line 27 of file RawDataDrawer.h.

Constructor & Destructor Documentation

gar::evd::RawDataDrawer::RawDataDrawer ( )

Definition at line 70 of file RawDataDrawer.cxx.

71  {
72  fEventTQHist = (TH1F*) new TH1F("eventTQHist","ADC Sum vs Time, All Channels;time (ticks);ADC Sum",100,0,10000);
73  fDigitTQHist = (TH1F*) new TH1F("digitTQHist","ADC Sum vs Time, One Channel;time (ticks);ADC Sum",100,0,10000);
74  }
TH1F * fDigitTQHist
Charge vs time for a single channel in an event.
Definition: RawDataDrawer.h:67
TH1F * fEventTQHist
Charge vs time for all digits in an event.
Definition: RawDataDrawer.h:66
gar::evd::RawDataDrawer::~RawDataDrawer ( )

Definition at line 77 of file RawDataDrawer.cxx.

78  {
79  }

Member Function Documentation

void gar::evd::RawDataDrawer::DrawRawDigit3D ( art::Event const &  evt,
evdb::View3D *  view 
)
private

Performs the 3D drawing.

void gar::evd::RawDataDrawer::FillQHisto ( gar::raw::RawDigit const &  dig,
TH1F *  histo 
)
private

Definition at line 82 of file RawDataDrawer.cxx.

84  {
85 
86  gar::raw::ADCvector_t uncompressed;
87  uncompressed.resize(dig.Samples());
88  short ped = dig.Pedestal();
89  gar::raw::Uncompress(dig.ADCs(),uncompressed,ped,dig.Compression());
90  for(size_t t = 0; t < uncompressed.size(); ++t)
91  histo->Fill(t, 1. * uncompressed[t] - 1. * dig.Pedestal());
92 
93  return;
94  }//end loop over raw hits
std::vector< ADC_t > ADCvector_t
Definition: RawTypes.h:13
void Uncompress(const gar::raw::ADCvector_t &adc, gar::raw::ADCvector_t &uncompressed, gar::raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:183
void gar::evd::RawDataDrawer::GetRawDigits ( art::Event const &  evt,
std::vector< const raw::RawDigit * > &  digits 
)
private

Makes sure raw::RawDigit's are available for the current settings.

Definition at line 206 of file RawDataDrawer.cxx.

208  {
209  digits.clear();
210 
212 
213  std::vector<const raw::RawDigit*> temp;
214 
215  try{
216  evt.getView(rawopt->fRawDataLabel, temp);
217  for(size_t t = 0; t < temp.size(); ++t){
218  digits.push_back(temp[t]);
219  }
220  }
221  catch(cet::exception& e){
222  writeErrMsg("GetDigits", e);
223  }
224 
225  return;
226  } // RawDataDrawer::GetRawDigits()
const double e
TCEvent evt
Definition: DataStructs.cxx:7
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void gar::evd::RawDataDrawer::RawDigit3D ( art::Event const &  evt,
evdb::View3D *  view 
)

Draws raw digit content in 2D wire plane representation.

Parameters
evtsource for raw digits
viewtarget rendered object
planenumber of the plane to be drawn
bZoomToRoIwhether to render only te region of interest

This function performs pre-rendering of the raw digit content into a 3D view of the yzt space The material for rendering is created and sent to view object for actual rendering.

Definition at line 99 of file RawDataDrawer.cxx.

101  {
102  // Check if we're supposed to draw raw hits at all
106  auto fTime = gar::providerFrom<detinfo::DetectorClocksServiceGAr>();
107  auto detProp = gar::providerFrom<detinfo::DetectorPropertiesService>();
108 
109  double driftVelocity = detProp->DriftVelocity(detProp->Efield(),
110  detProp->Temperature());
111 
112  if(rawopt->fDrawRawOrReco > 0) return;
113 
114  std::vector<const raw::RawDigit*> rawhits;
115  this->GetRawDigits(evt, rawhits);
116 
117  fEventTQHist->Reset();
118  fDigitTQHist->Reset();
119 
120  //auto const& colorSet = cdopt->RawQ();
121 
122  gar::raw::ADCvector_t uncompressed;
123  for(auto dig : rawhits){
124 
125  this->FillQHisto(*dig, fEventTQHist);
126  if(dig->Channel() == rawopt->fChannel)
127  this->FillQHisto(*dig, fDigitTQHist);
128 
129  // draw the digit as time, y, z with the latter coordinates
130  // given by the channel map.
131  float xyz[3];
132 
133  geom->ChannelToPosition((unsigned int)dig->Channel(),
134  xyz);
135 
136  //std::cout << "RDGeo: " << dig->Channel() << " " << xyz[0] << " " << xyz[1] << " " << xyz[2] << std::endl;
137  double chanposx = xyz[0];
138 
139  // draw hit channels on the readout planes in gray. No timing or x information.
140  //int c = kGray;
141  //int s=1;
142  //int w=1;
143  //TPolyLine3D& rdpos = view->AddPolyLine3D(2,c,w,s);
144  //rdpos.SetPoint(0,xyz[2],xyz[0],xyz[1]);
145  //rdpos.SetPoint(1,xyz[2]+1,xyz[0],xyz[1]);
146  //// std::cout << "adding a raw digit: " << xyz[0] << " " << xyz[1] << " " << xyz[2] << std::endl;
147 
148  // loop over the ADC values for this digit and draw the value if it
149  // is above the threshold
150  //TMarker3DBox *box = nullptr;
151 
152  uncompressed.resize(dig->Samples());
153  short ped = dig->Pedestal();
154  gar::raw::Uncompress(dig->ADCs(),uncompressed,ped,dig->Compression());
155 
156  for(size_t t = 0; t < dig->Samples(); ++t){
157  if(uncompressed[t] < rawopt->fMinSignal) continue;
158 
159  double driftdistance = fTime->TPCTick2Time(t) * driftVelocity;
160 
161  if (chanposx < 0)
162  {
163  xyz[0] = chanposx + driftdistance;
164  }
165  else
166  {
167  xyz[0] = chanposx - driftdistance;
168  }
169 
170  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
171  // somehow these boxes don't work -- draw short lines instead
172  //box = &(view->AddMarker3DBox(xyz[2],
173  // xyz[0],
174  // xyz[1],
175  // 0.5, // the extent is 1/2 tick
176  // 0.5 * 0.3, // to fix geom->ChannelPitch(),
177  // 0.5 * 0.3 // to fix geom->ChannelPitch()
178  // ));
179  //box->SetFillStyle(1001);
180  ////auto tmpcolor = colorSet.GetColor(uncompressed[t]);
181  //box->SetFillColor(kGreen);
182  //box->SetBit(kCannotPick);
183 
184  //std::cout << "adding a raw digit: " << xyz[0] << " " << xyz[1] << " " << xyz[2] << std::endl;
185 
186  // try drawing with polylines, little green segments
187 
188 
189  int c2 = kGreen;
190  int s2=1;
191  int w2=1;
192 
193  // nb. coordinates are so Y is up, but ROOT thinks Z is up, so report (z,x,y)
194 
195  TPolyLine3D& rdpos = view->AddPolyLine3D(2,c2,w2,s2);
196  rdpos.SetPoint(0,xyz[2],xyz[0]-0.3,xyz[1]);
197  rdpos.SetPoint(1,xyz[2],xyz[0]+0.3,xyz[1]);
198 
199  } // end loop over ADC values for the digit
200  }//end loop over raw digits
201 
202  return;
203  }
std::vector< ADC_t > ADCvector_t
Definition: RawTypes.h:13
void GetRawDigits(art::Event const &evt, std::vector< const raw::RawDigit * > &digits)
Makes sure raw::RawDigit&#39;s are available for the current settings.
TH1F * fDigitTQHist
Charge vs time for a single channel in an event.
Definition: RawDataDrawer.h:67
TH1F * fEventTQHist
Charge vs time for all digits in an event.
Definition: RawDataDrawer.h:66
double fMinSignal
minimum ADC count to display a time bin
void Uncompress(const gar::raw::ADCvector_t &adc, gar::raw::ADCvector_t &uncompressed, gar::raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:183
void FillQHisto(gar::raw::RawDigit const &dig, TH1F *histo)
TCEvent evt
Definition: DataStructs.cxx:7

Member Data Documentation

TH1F* gar::evd::RawDataDrawer::fDigitTQHist
private

Charge vs time for a single channel in an event.

Definition at line 67 of file RawDataDrawer.h.

TH1F* gar::evd::RawDataDrawer::fEventTQHist
private

Charge vs time for all digits in an event.

Definition at line 66 of file RawDataDrawer.h.


The documentation for this class was generated from the following files: