6 # Some example tools for use in data prep.
8 # April 2018. Some protoDUNE-specific tools are moved to protodune_dataprep_tools.fcl
10 ################################################################################
12 ################################################################################
15 tool_type: FclIndexRangeTool
17 events: { begin:0 end:0 labels: [] } # Event range for selection and plotting.
20 ################################################################################
21 # Ranges for channel-tick plots.
22 ################################################################################
24 # tools.tickRanges is defined in DuneCommon/fcl/dunecommon_tools.fcl
26 tools.tickRanges.plotTicks: { begin:3000 end:4000 labels:["Plot ticks"] }
27 tools.tickRanges.plotAllTicks: { begin:0 end:0 labels:["All ticks"] }
29 ################################################################################
30 # DUNE default clock data.
31 ################################################################################
33 data.dune_ClockUnit: "Mtick"
34 data.dune_TriggerClockRate: 50000000.0
36 ################################################################################
38 ################################################################################
40 # Dump ADC channel contents to the log file.
41 tools.adcChannelDumper: {
42 tool_type: AdcChannelDumper
49 # Write all ROIs to a TTree.
50 tools.adcRoiTreeMaker: {
51 tool_type: AdcRoiToTree
53 OutFile: "adcrois.root"
57 ################################################################################
59 ################################################################################
61 # FEMB multiplicity for a single-APA detector.
62 tools.apa_evtviewNfemb: {
63 tool_type: AdcEventViewer
65 EventHists: ["hnfemb:21:0:21"]
66 EventGraphs: ["event:events:1:nfemb:0:21"]
69 ClockUnit: @local::data.dune_ClockUnit
70 ClockRate: @local::data.dune_TriggerClockRate
73 ################################################################################
75 ################################################################################
77 # Add ADC info to names and titles, e.g.
78 # MyTitle = "Run %RUN%-%SUBRUN% event %EVENT% channel %CHAN%"
79 # MyFileName = "run%0RUN%-%0SUBRUN%_evt%0EVENT%_cha%0CHAN%"
80 tools.adcStringBuilder: {
81 tool_type: StandardAdcChannelStringTool
90 TrigNames: [ "flag 0", "flag 1", "flag 2", "flag 3", "flag 4",
91 "flag 5", "flag 6", "flag 7", "random", "flag 9",
92 "flag 10", "flag 11", "beam", "CRT", "NGT"]
95 # Dump raw ADC channel waveform to a histogram.
97 tool_type: AdcChannelPlotter
100 HistName: "adc_%TYPE%_ev%EVENT%_ch%CHAN%"
101 HistTitle: "ADC %TYPE% run %RUN% event %EVENT% channel %CHAN%"
117 # Dump prepared ADC channel waveform to a histogram.
118 tools.adcPlotPrepared: {
119 tool_type: AdcChannelPlotter
121 HistTypes: ["prepared"]
122 HistName: "adc_%TYPE%_ev%EVENT%_ch%CHAN%"
123 HistTitle: "ADC %TYPE% run %RUN% event %EVENT% channel %CHAN%"
139 # Dump ADC channel distribution to a histogram.
140 tools.adcPlotRawDist: {
141 tool_type: AdcChannelPlotter
143 HistTypes: ["rawdist"]
144 HistName: "adc_%TYPE%_ev%EVENT%_ch%CHAN%"
145 HistTitle: "ADC %TYPE% run %RUN% event %EVENT% channel %CHAN%"
161 # Fit ADC distribution to get pedestal.
162 tools.def_adcPedestalFit: {
163 tool_type: AdcPedestalFitter
172 RemoveStickyCode: false
173 HistName: "adcped_ev%0EVENT%_ch%0CHAN%"
174 HistTitle: "ADC pedestal fit for run %RUN% event %EVENT% channel %CHAN%"
185 # Dump ADC map raw contents to the log file.
186 tools.adcRawDumper: {
187 tool_type: AdcDataDumper
189 Prefix: "ADC raw dump for "
191 ShowChannelCount: true
192 ShowTickCounts: false
202 # Dump ADC map contents to the log file.
204 tool_type: AdcDataDumper
206 Prefix: "ADC dump for "
208 ShowChannelCount: true
209 ShowTickCounts: false
219 # Create png files showing ADC contents (ADC vs. channel vs. time).
220 tools.preparedAdcPlotter: {
221 tool_type: AdcDataPlotter
223 DataType: 0 # 0 for prepared, 1 for raw-pedestal
232 SkipChannelStatus: []
234 ChannelLineModulus: 2560
235 ChannelLinePattern: [0, 800, 1600, 2080]
236 ChannelLinePatternSolid: []
238 HistName: "hadcprp_evt%EVENT%_ch_%CHAN1%"
239 HistTitle: "Prepared ADC for run %RUN% event %EVENT%"
243 PlotFileName: "adcprep_evt%EVENT%_ch%CHAN1%-%CHAN2%.png"
244 RootFileName: "" # or "adc_evt%EVENT%.root"
246 tools.signalAdcPlotter: {
247 tool_type: AdcDataPlotter
249 DataType: 2 # 0 for prepared, 1 for raw-pedestal
258 SkipChannelStatus: []
260 ChannelLineModulus: 2560
261 ChannelLinePattern: [0, 800, 1600, 2080]
262 ChannelLinePatternSolid: []
264 HistName: "hadcsig_evt%EVENT%_ch_%CHAN1%"
265 HistTitle: "Signal ADC for run %RUN% event %EVENT%"
269 PlotFileName: "adcsig_evt%EVENT%_ch%CHAN1%-%CHAN2%.png"
270 RootFileName: "" # or "adc_evt%EVENT%.root"
272 tools.rawAdcPlotter: {
273 tool_type: AdcDataPlotter
275 DataType: 1 # 0 for prepared, 1 for raw-pedestal
284 SkipChannelStatus: []
286 ChannelLineModulus: 2560
287 ChannelLinePattern: [0, 800, 1600, 2080]
288 ChannelLinePatternSolid: []
290 HistName: "hadcraw_evt%EVENT%_ch_%CHAN1%"
291 HistTitle: "Raw ADC for run %RUN% event %EVENT%"
295 PlotFileName: "adcrawRun%0RUN%Event%0EVENT%Chan%CHAN1%-%CHAN2%.png"
296 RootFileName: "" # or "adc_evt%EVENT%.root"
299 ################################################################################
301 ################################################################################
303 # Pedestal for each channel.
304 tools.adcChannelPedestalPlotter: {
305 tool_type: AdcChannelMetric
309 PedestalReference: ""
310 MetricSummaryView: ""
314 MetricLabel: "Pedestal"
317 ChannelLineModulus: 0
318 ChannelLinePattern: []
319 ChannelLinePatternSolid: []
320 HistName: "hchped_%0RUN%_%0EVENT%_%0CHAN1%_%0CHAN2%"
321 HistTitle: "ADC pedestals for run %RUN% event %EVENT%"
324 PlotFileName: "hchped_run%0RUN%_evt%0EVENT%_chans%0CHAN1%-%0CHAN2%.png"
329 # Pedestal RMS for each channel.
330 tools.adcChannelPedestalRmsPlotter: {
331 tool_type: AdcChannelMetric
335 PedestalReference: ""
336 MetricSummaryView: ""
343 ChannelLineModulus: 0
344 ChannelLinePattern: []
345 ChannelLinePatternSolid: []
346 HistName: "hchpedrms_%0RUN%_%0EVENT%_%0CHAN1%_%0CHAN2%"
347 HistTitle: "ADC pedestal RMS for run %RUN% event %EVENT%"
350 PlotFileName: "hchpedrms_run%0RUN%_evt%0EVENT%_chans%0CHAN1%-%0CHAN2%.png"
356 tools.adcChannelSamplelRmsPlotter: @local::tools.adcChannelPedestalRmsPlotter
357 tools.adcChannelSamplelRmsPlotter.Metric: samRms
358 tools.adcChannelSamplelRmsPlotter.MetricLabel: "RMS [ke]"
359 tools.adcChannelSamplelRmsPlotter.HistName: "hchsamrms_%0RUN%_%0EVENT%_%0CHAN1%_%0CHAN2%"
360 tools.adcChannelSamplelRmsPlotter.HistTitle: "ADC sample RMS for run %RUN% event %EVENT%"
361 tools.adcChannelSamplelRmsPlotter.PlotFileName: "hchsamrms_run%0RUN%_evt%0EVENT%_chans%0CHAN1%-%0CHAN2%.png"
364 tools.adcChannelSignalRmsPlotter: @local::tools.adcChannelPedestalRmsPlotter
365 tools.adcChannelSignalRmsPlotter.Metric: sigRms
366 tools.adcChannelSignalRmsPlotter.MetricLabel: "RMS [ke]"
367 tools.adcChannelSignalRmsPlotter.HistName: "hchsigrms_%0RUN%_%0EVENT%_%0CHAN1%_%0CHAN2%"
368 tools.adcChannelSignalRmsPlotter.HistTitle: "ADC signal RMS for run %RUN% event %EVENT%"
369 tools.adcChannelSignalRmsPlotter.PlotFileName: "hchsigrms_run%0RUN%_evt%0EVENT%_chans%0CHAN1%-%0CHAN2%.png"
372 tools.adcChannelNotSignalRmsPlotter: @local::tools.adcChannelPedestalRmsPlotter
373 tools.adcChannelNotSignalRmsPlotter.Metric: nsgRms
374 tools.adcChannelNotSignalRmsPlotter.MetricLabel: "RMS [ke]"
375 tools.adcChannelNotSignalRmsPlotter.HistName: "hchnsgrms_%0RUN%_%0EVENT%_%0CHAN1%_%0CHAN2%"
376 tools.adcChannelNotSignalRmsPlotter.HistTitle: "ADC not-signal RMS for run %RUN% event %EVENT%"
377 tools.adcChannelNotSignalRmsPlotter.PlotFileName: "hchnsgrms_run%0RUN%_evt%0EVENT%_chans%0CHAN1%-%0CHAN2%.png"
380 adcPlotDftTemplate: {
381 tool_type: AdcChannelDftPlotter
386 SampleFreq: @local::adcSampleFreq
393 PlotChannelRanges: [] # Empty makes one plot for each channel
394 PlotChannelGroups: [] # Empty makes one plot for each channel
395 PlotOverlayGroups: 1 # Rnages in a group are drawn on the same pad.
403 tools.adcPlotDftMag: @local::adcPlotDftTemplate
404 tools.adcPlotDftMag.Variable: magnitude
405 tools.adcPlotDftMag.SampleFreq: @local::adcSampleFreq
406 tools.adcPlotDftMag.YMax: 50
407 tools.adcPlotDftMag.HistName: "hdftmags_run%0RUN%_evt%0EVENT%_ch%0CHAN%"
408 tools.adcPlotDftMag.HistTitle: "DFT amplitudes for run %RUN% event %EVENT% channel %CHAN%"
409 tools.adcPlotDftMag.PlotName: "dftmag_run%0RUN%_evt%0EVENT%_ch%0CHAN%.png"
412 tools.adcPlotDftPhase: @local::adcPlotDftTemplate
413 tools.adcPlotDftPhase.Variable: phase
414 tools.adcPlotDftPhase.HistName: "hdftphas_run%0RUN%_evt%0EVENT%_ch%0CHAN%"
415 tools.adcPlotDftPhase.HistTitle: "DFT phases for run %RUN% event %EVENT% channel %CHAN%"
416 tools.adcPlotDftPhase.PlotName: "dftpha_run%0RUN%_evt%0EVENT%_ch%0CHAN%.png"
419 tools.adcPlotDftPower: @local::adcPlotDftTemplate
420 tools.adcPlotDftPower.Variable: power
421 tools.adcPlotDftPower.YMax: 10000
422 tools.adcPlotDftPower.NBinX: 50
423 tools.adcPlotDftPower.HistName: "hdftpower_run%0RUN%_evt%0EVENT%_ch%0CHAN%"
424 tools.adcPlotDftPower.HistTitle: "DFT power for run %RUN% event %EVENT% channel %CHAN%"
425 tools.adcPlotDftPower.HistSummaryTitles:["DFT power for run %RUN%", "DFT power for run %RUN% event %EVENT%"]
426 tools.adcPlotDftPower.PlotName: "dftpower_run%0RUN%_evt%0EVENT%_ch%0CHAN%.png"
427 tools.adcPlotDftPower.PlotSummaryNames: ["dftpowtlog_run%0RUN%.{png,tpad}", ""]
431 tools.adcPlotDftTickPower: @local::tools.adcPlotDftPower
432 tools.adcPlotDftTickPower.Variable: "power/tick"
433 tools.adcPlotDftTickPower.YMax: -2.0
434 tools.adcPlotDftTickPower.NBinX: 50
435 tools.adcPlotDftTickPower.HistName: "hdftpowt_run%0RUN%_evt%0EVENT%_ch%0CHAN%"
436 tools.adcPlotDftTickPower.HistTitle: "DFT power for run %RUN% event %EVENT% channel %CHAN%"
437 tools.adcPlotDftTickPower.PlotName: "dftpowt_run%0RUN%_evt%0EVENT%_ch%0CHAN%.png"
438 tools.adcPlotDftPower.PlotSummaryNames: []
440 # DFT power/tick with log scale.
441 tools.adcPlotDftTickPowerLog: @local::tools.adcPlotDftTickPower
442 tools.adcPlotDftTickPowerLog.YMinLog: 0.01
443 tools.adcPlotDftTickPowerLog.YMax: 100.0
444 tools.adcPlotDftTickPowerLog.HistName: "hdftpowtlog_run%0RUN%_evt%0EVENT%_ch%0CHAN%"
445 tools.adcPlotDftTickPowerLog.PlotName: "dftpowtlog_run%0RUN%_evt%0EVENT%_ch%0CHAN%.png"
446 tools.adcPlotDftPower.PlotSummaryNames: []
448 ################################################################################
449 # Data prep reconstruction tools.
450 ################################################################################
452 # Extract raw data from a digit.
454 tool_type: AcdDigitReader
458 # Fill sample from 12-bit ADC data.
459 tools.adcSampleFiller: {
460 tool_type: AdcSampleFiller
466 # Fill sample and apply calibration.
467 # May 2020: Switch to fix01 of calib based on 2018-dec data.
468 tools.adcSampleCalibration: {
469 tool_type: FloatArrayGainCalibration
473 AdcUnderflowDefault: 0
474 AdcOverflowDefault: 4095
475 GainTool: "areaGain_calib20191213_dec18ext"
479 # Perform deconvolution with SignalShapingService.
480 tools.adcVintageDeconvoluter: {
481 tool_type: VintageDeconvoluter
485 # Subtract baseline after deconvolution
486 tools.adcSubtractBaseline: {
487 tool_type: SubtractBaseline
493 # Find one ROI signals that includes all samples.
494 tools.adcKeepAllSignalFinder: {
495 tool_type: AdcKeepAllSignalFinder
500 # Scale samples from ke to ADC count.
501 tools.adcScaleKeToAdc: {
502 tool_type: AdcSampleScaler
506 OutputUnit: "ADC count"
509 # Scale samples from ke to ADC count.
510 tools.adcScaleAdcToKe: {
511 tool_type: AdcSampleScaler
514 InputUnit: "ADC count"
515 OutputUnit: "ke/tick"
518 # Find ADC signals with simple threshold algorithm.
519 tools.adcThresholdSignalFinder: {
520 tool_type: AdcThresholdSignalFinder
522 Threshold: "3.0" # Works for MC may2018
529 # Find calibrated signals with simple threshold algorithm.
530 tools.calibThresholdSignalFinder: @local::tools.adcThresholdSignalFinder
531 tools.calibThresholdSignalFinder.Threshold: 0.5
533 # Find ADC signals with Dune 35t algorithm.
534 tools.adcDuneSignalFinder: {
535 tool_type: DuneAdcSignalFinder
544 # Dynamic signal finder.
545 tools.adcNoiseSignalFinder: {
546 tool_type: AdcNoiseSignalFinder
551 ThresholdRatioTol: 0.1
558 tools.calibNoiseSignalFinder: @local::tools.adcNoiseSignalFinder
559 tools.calibNoiseSignalFinder.ThresholdMin: 0.2
563 tool_type: AdcChannelFFT
575 tool_type: AdcChannelFFT
585 # Fetch ROI info and hists.
586 tools.adcRoiViewer: {
587 tool_type: AdcRoiViewer
595 PulserStepCharge: 0.0
605 ChannelLineModulus: 0
606 ChannelLinePattern: []
607 ChannelLinePatternSolid: []
614 ChanSumRootFileName: ""
617 tools.adcRoiFitter: {
618 tool_type: AdcRoiViewer
626 PulserStepCharge: 0.0
636 ChannelLineModulus: 0
637 ChannelLinePattern: []
638 ChannelLinePatternSolid: []
645 ChanSumRootFileName: ""
649 # Build ROI w.r.t. local baseline
650 tools.adcDPhase3x1x1LocalRoiBuilder: {
651 tool_type: AdcDPhase3x1x1LocalRoiBuilder
653 BinsToAverageForPedestal: 100
655 UseStandardDeviation: true
656 NConsecBinsAboveThreshold1: 9
659 NConsecBinsAboveThreshold2: 4
667 tools.adcDPhase3x1x1RoiBuilder: {
668 tool_type: AdcDPhase3x1x1RoiBuilder
670 BinsToAverageForRMS: 100
672 UseStandardDeviation: false
673 NConsecBinsAboveThreshold1: 30
676 NConsecBinsAboveThreshold2: 10
683 # Split data keeping ROIs.
685 tool_type: AdcRoiSlicer
692 # Split data keeping not ROIs.
693 tools.adcSliceNotRoi: {
694 tool_type: AdcRoiSlicer