149 const string myname =
"AdcDetectorPlotter::view: ";
152 if (
m_LogLevel >= 2 ) cout << myname <<
"Begin call " << state.reportCount
153 <<
"/" << state.jobCount <<
"." <<
endl;
154 if ( acds.size() == 0 ) {
155 cout << myname <<
"WARNING: Channel map is empty. No data extracted." <<
endl;
160 string hname =
"hdet";
165 string sttlx =
"Drift coordinate [cm]";
173 string sttly =
"Wire coordinate [cm]";
174 if ( state.reportCount ) {
175 if ( acdFirst.
run() != state.run ||
176 acdFirst.
subRun() != state.subrun ||
177 acdFirst.
event() != state.event ) {
178 cout << myname <<
"ERROR: Received unexpected event ID. Clearing data." <<
endl;
179 cout << myname <<
"State: " << state.event <<
"-" << state.subrun <<
"-" << state.event <<
endl;
180 cout << myname <<
" Data: " << acdFirst.
event() <<
"-" << acdFirst.
subRun() <<
"-" << acdFirst.
event() <<
endl;
181 state.reportCount = 0;
184 if ( state.reportCount == 0 ) {
185 if (
m_LogLevel >= 2 ) cout << myname <<
" Starting new event." <<
endl;
186 initializeState(state, acdFirst);
192 TGraph* pg =
new TGraph;
193 pg->SetTitle(sttl.c_str());
194 pg->GetXaxis()->SetTitle(sttlx.c_str());
195 pg->GetYaxis()->SetTitle(sttly.c_str());
196 state.ppad->add(pg,
"P");
197 state.ppad->graph()->Expand(512);
198 state.ppad->setRangeX(xmin, xmax);
204 TGraph* pgw =
new TGraph;
205 pgw->SetMarkerColor(cols.
red());
206 pgw->Expand(wins.size());
207 for (
Index iwin=0; iwin<wins.size(); ++iwin ) {
209 pgw->SetPoint(iwin, xsign*win.
x, win.
z);
211 state.ppad->add(pgw,
"P");
214 TGraph* pgc =
new TGraph;
215 pgc->SetMarkerColor(cols.
green());
216 pgc->Expand(wins.size());
217 for (
Index iwin=0; iwin<wins.size(); ++iwin ) {
219 pgc->SetPoint(iwin, xsign*(win.
x + win.
driftMax), win.
z);
221 state.ppad->add(pgc,
"P");
224 if ( spttl.size() ) {
225 state.pttl.reset(
new TLatex(0.01, 0.015, spttl.c_str()));
226 state.pttl->SetNDC();
227 state.pttl->SetTextFont(42);
228 state.pttl->SetTextSize(0.030);
229 state.ppad->add(state.pttl.get());
233 TGraph* pgr = state.ppad->graph();
234 if ( pgr ==
nullptr ) {
235 cout <<
"ERROR: Graph not found." <<
endl;
239 cout << myname <<
" Adding to existing event. Graph point count is " << pgr->GetN() <<
endl;
244 for (
const AdcChannelDataMap::value_type& iacd : acds ) {
246 cout << myname <<
"WARNING: Channel map has invalid channels. No plot is created." <<
endl;
248 Tick ntick = iacd.second.samples.size();
249 if ( ntick > maxtick ) maxtick = ntick;
253 AdcIndex nchan = chanLast + 1 - chanFirst;
254 if (
m_LogLevel >= 2 ) cout << myname <<
" Input channel count is " << nchan <<
endl;
256 for (
const AdcChannelDataMap::value_type& iacd : acds ) {
257 if (
m_LogLevel >= 3 ) cout << myname <<
" Filling with channel " << iacd.first <<
endl;
267 if ( state.ppad->graph()->GetN() == 0 ) {
268 cout << myname <<
"Graph has no points. Adding one to avoid root exception." <<
endl;
271 if (
m_LogLevel >= 2 ) cout << myname <<
" Graph point count: " << state.ppad->graph()->GetN() <<
endl;
virtual bool IsBad(raw::ChannelID_t channel) const =0
Returns whether the specified channel is bad in the current run.
const lariov::ChannelStatusProvider * m_pChannelStatusProvider
DataMap & setStatus(int stat)
StatePtr getState() const
int addChannel(const AdcChannelData &acd, double xfac) const
const AdcChannelStringTool * m_adcStringBuilder
std::vector< WireInfo > WireInfoVector
static Index badChannel()
QTextStream & endl(QTextStream &s)