9 #ifndef CALIBRATIONANALYSIS_H 10 #define CALIBRATIONANALYSIS_H 1 19 #include "art_root_io/TFileService.h" 20 #include "art_root_io/TFileDirectory.h" 118 fSampleFreq = clockData.OpticalClock().Frequency();
142 fPedestalMeanPerChannel = tfs->make< TH1D >(
"PedestalMeanPerChannel",
"Pedestal Means;Channel Number;Pedestal Mean (ADC)", 711, 0.5, 711.5);
143 fPedestalSigmaPerChannel = tfs->make< TH1D >(
"PedestalSigmaPerChannel",
"Pedestal Sigma;Channel Number;Pedestal Sigma (ADC)", 711, 0.5, 711.5);
144 fIntegratedSignalMeanPerChannel = tfs->make< TH1D >(
"IntegratedSignalMeanPerChannel",
"Integrated Signal Means;Channel Number; Integrated SignalMean (ADC)", 711, 0.5, 711.5);
146 fFractionSamplesNearMaximumPerChannel = tfs->make< TH1D >(
"FractionSamplesNearMaximumPerChannel",
"Fraction of Samples Near Maximum;Channel Number;Fraction Near Maximum", 711, 0.5, 711.5);
148 fNumberOfWaveformsProcessedPerChannel = tfs->make< TH1D >(
"NumberOfWaveformsProcessedPerChannel",
"Number of Waveforms Processed per Channel;Channel Number;Fraction Near Maximum", 711, 0.5, 711.5);
150 fFirstOpHitTimeMean = tfs->make< TH1D >(
"FirstOpHitTimeMean",
"Mean of first OpHit time per Channel;Channel Number;First OpHit time mean (ticks)", 711, 0.5, 711.5);
152 fSecondOpHitTimeMean = tfs->make< TH1D >(
"SecondOpHitTimeMean",
"Mean of second OpHit time per Channel;Channel Number;Second OpHit time mean (ticks)", 711, 0.5, 711.5);
154 fFirstSecondDiffOpHitTimeMean = tfs->make< TH1D >(
"FirstSecondDiffOpHitTimeMean",
"Mean of first-second OpHit time difference per Channel;Channel Number;(second - first) OpHit time mean (ticks)", 711, 0.5, 711.5);
156 fNumberOfOpHitsPerChannelPerEvent = tfs->make< TH1D >(
"NumberOfOpHitsPerChannelPerEvent",
"Number of OpHits in one channel per event;Number of OpHits;", 16, -0.5, 15.5);
190 double adjustedFirstOpHitTimeMean =
fFirstOpHitTimeMean->GetBinContent(iter->first)/(iter->second);
193 double adjustedSecondOpHitTimeMean =
fSecondOpHitTimeMean->GetBinContent(iter->first)/(iter->second);
213 auto waveformHandle = evt.
getHandle< std::vector< raw::OpDetWaveform > >(itag1);
219 for (
size_t i = 0; i < waveformHandle->size(); i++)
231 TString histName =
TString::Format(
"avgwaveform_channel_%03i", channel);
235 double PedestalMean = 0;
236 double PedestalVariance = 0;
237 double IntegratedSignalMean = 0;
246 PedestalMean += pulse[
tick];
248 if(pulse[tick] > 4000)
258 PedestalVariance += ( pulse[
tick] - PedestalMean)*( pulse[
tick] - PedestalMean);
260 IntegratedSignalMean += pulse[
tick] - PedestalMean;
264 PedestalVariance /= (pulse.size() - 1);
265 double PedestalSigma = sqrt(PedestalVariance);
281 std::map< int, int > OpHitCountPerEvent;
286 if(OpHitHandle->size() > 0)
287 std::cout <<
"OpHitHandle->size() = " << OpHitHandle->size() <<
std::endl;
289 for(
size_t i=0; i!=OpHitHandle->size(); ++i)
292 int channel = OpHitHandle->at(i).OpChannel();
297 double firstophitpeaktime;
298 double secondophitpeaktime;
300 if(OpHitCountPerEvent[channel] == 1){
301 firstophitpeaktime = OpHitHandle->at(i).PeakTime();
306 else if(OpHitCountPerEvent[channel] == 2){
307 secondophitpeaktime = OpHitHandle->at(i).PeakTime();
314 for (
auto iter = OpHitCountPerEvent.begin(); iter != OpHitCountPerEvent.end(); iter++){
TH1D * fFirstSecondDiffOpHitTimeMean
void analyze(art::Event const &) override
TH1D * fIntegratedSignalMeanPerChannel
TH1D * fPedestalMeanPerChannel
Handle< PROD > getHandle(SelectorBase const &) const
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
TH1D * fNumberOfOpHitsPerChannelPerEvent
TH1D * fFractionSamplesNearMaximumPerChannel
virtual ~CalibrationAnalysis()
EDAnalyzer(fhicl::ParameterSet const &pset)
std::map< int, int > waveformCount
TH1D * fNumberOfWaveformsProcessedPerChannel
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
TH1D * fPedestalSigmaPerChannel
std::map< int, double > FirstHitTimePerChannel
std::string fInstanceName
TH1D * fFirstOpHitTimeMean
CalibrationAnalysis(fhicl::ParameterSet const &)
TH1D * fSecondOpHitTimeMean
std::map< int, int > OpHitCount
QTextStream & endl(QTextStream &s)
std::map< int, TH1D * > averageWaveforms