9 #ifndef LEDCalibrationAna_H 10 #define LEDCalibrationAna_H 1 37 #include "TLorentzVector.h" 101 std::map<uint32_t, std::vector<double> >
fAreas;
185 uint32_t Channel = it->first;
187 std::stringstream histname;
189 histname<<
"ch"<<Channel<<
"area";
193 for(
size_t j=0; j!=it->second.size(); ++j)
195 HistArea->Fill(it->second.at(j));
198 std::stringstream fitname;
200 fitname<<
"ch"<<Channel<<
"fit";
202 double Max = HistArea->GetMaximum();
203 double Mid = HistArea->GetBinContent(
fAreaDivs/2.);
205 TF1 * GausFit =
new TF1(fitname.str().c_str(),
206 "gaus(0)+gaus(3)+gaus(6)",
215 GausFit->SetParLimits(0,0,1.1*Max);
216 GausFit->SetParLimits(1,0,
fAreaMax);
217 GausFit->SetParLimits(2,0,
fAreaMax);
219 GausFit->SetParLimits(3,0,1.1*Max);
220 GausFit->FixParameter(4,0);
221 GausFit->SetParLimits(5,0,(fAreaMin+
fAreaMax)/2.);
223 GausFit->SetParLimits(6,0,1.1*Max);
224 GausFit->FixParameter(7,0);
225 GausFit->SetParLimits(8,0,(fAreaMin+
fAreaMax)/2.);
228 HistArea->Fit(GausFit);
230 double Mean = GausFit->GetParameter(1);
231 double Width = GausFit->GetParameter(2);
233 double MeanErr = GausFit->GetParError(1);
234 double WidthErr = GausFit->GetParError(2);
236 double NPE = pow(Mean,2)/pow(Width,2);
237 double SPEScale = Mean / NPE;
239 double NPEError = NPE * pow(2.*(pow(MeanErr/Mean,2) + pow(WidthErr/Width,2)),0.5);
240 double SPEError = SPEScale * pow(2.*pow(WidthErr/Width,2) + pow(MeanErr/Mean,2),0.5);
242 std::cout <<
"Channel " << Channel<<
":\tSPE Scale \t"<<SPEScale<<
"\t +/- \t" << SPEError<<
",\t NPE \t" << NPE<<
"\t +/- \t"<< NPEError <<std::endl;
253 auto const* ts = lar::providerFrom<detinfo::DetectorClocksService>();
267 std::map<uint32_t, std::vector<int> > OrgOpDigitByChannel;
269 for(
size_t i=0; i!=OpDetWaveformHandle->size(); ++i)
271 OrgOpDigitByChannel[
ShaperToChannel(OpDetWaveformHandle->at(i).ChannelNumber())].push_back(i);
274 std::vector<uint32_t> FrameNumbersForTrig;
275 std::vector<uint32_t> TimeSlicesForTrig;
279 double TimeStamp = OpDetWaveformHandle->at(OrgOpDigitByChannel[
fTriggerChannel][i] ).TimeStamp();
280 uint32_t Frame = ts->OpticalClock().Frame(TimeStamp);
281 uint32_t TimeSlice = ts->OpticalClock().Sample(TimeStamp);
282 FrameNumbersForTrig.push_back(Frame);
283 TimeSlicesForTrig.push_back(TimeSlice);
286 for(
size_t i=0; i!=OpDetWaveformHandle->size(); ++i)
288 double TimeStamp = OpDetWaveformHandle->at(i).TimeStamp();
289 uint32_t Frame = ts->OpticalClock().Frame(TimeStamp);
290 uint32_t TimeSlice = ts->OpticalClock().Sample(TimeStamp);
291 fShaper = OpDetWaveformHandle->at(i).ChannelNumber();
297 for(
size_t j=0; j!=FrameNumbersForTrig.size(); ++j)
299 if( (Frame == FrameNumbersForTrig.at(j))
311 fOffset = TimeSlice-TimeSlicesForTrig.at(j);
315 for(
size_t k=0; k!=NPulses; ++k)
353 static std::map<uint32_t, uint32_t> ShaperToChannelMap;
354 if(ShaperToChannelMap.size()==0)
358 for(
size_t i=0; i!=40; ++i)
360 ShaperToChannelMap[i]=i;
364 return ShaperToChannelMap[Shaper];
pmtana::AlgoThreshold fThreshAlg
void AddRecoAlgo(pmtana::PMTPulseRecoBase *algo, PMTPedestalBase *ped_algo=nullptr)
A method to set pulse reconstruction algorithm.
void analyze(const art::Event &)
size_t GetNPulse() const
A getter for the number of reconstructed pulses from the input waveform.
pmtana::PulseRecoManager fPulseRecoMgr
#define DEFINE_ART_MODULE(klass)
bool Reconstruct(const pmtana::Waveform_t &) const
Implementation of ana_base::analyze method.
T get(std::string const &key) const
EventNumber_t event() const
EDAnalyzer(Table< Config > const &config)
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Class definition file of AlgoThreshold.
void SetDefaultPedAlgo(pmtana::PMTPedestalBase *algo)
A method to set a choice of pedestal estimation method.
std::map< uint32_t, std::vector< double > > fAreas
virtual ~LEDCalibrationAna()
TTree * fPulseTreeNonCoinc
Class definition file of PedAlgoEdges.
uint32_t ShaperToChannel(uint32_t Shaper)
LEDCalibrationAna(const fhicl::ParameterSet &)
const pulse_param & GetPulse(size_t index=0) const
art framework interface to geometry description
Class definition file of PulseRecoManager.
pmtana::PedAlgoEdges fPedAlg