288 std::cout <<
" begin analyze " << std::endl;
289 art::ServiceHandle<geo::Geometry> geom;
293 std::cout <<
" after clearing " << std::endl;
298 std::cout <<
" after clearing " << std::endl;
307 std::cout <<
"Processing event " <<
NEvents+1 <<
" for TPC Noise Analysis " <<
" Run " <<
fRun <<
", " <<
"Event " <<
fEvent <<
"." << std::endl;
314 art::Handle< std::vector<raw::RawDigit> > RawDigitHandle;
319 for(
const auto& RawDigit : *RawDigitHandle)
322 unsigned int DataSize = RawDigit.Samples();
323 std::vector<short> RawADC;
324 RawADC.resize(DataSize);
328 std::vector<short> SortedADC(RawADC);
329 std::sort(SortedADC.begin(),SortedADC.end(),[](
const auto&
left,
const auto&
right){
return std::fabs(
left) < std::fabs(
right);});
330 float median(SortedADC.at(SortedADC.size()/2));
333 float mean(
float(std::accumulate(SortedADC.begin(),SortedADC.end(),0))/float(SortedADC.size()));
334 std::vector<geo::WireID> widVec = geom->ChannelToWire(RawDigit.Channel());
335 size_t plane = widVec[0].Plane;
336 size_t wire = widVec[0].Wire;
340 std::vector<float> ADCLessPed;
341 ADCLessPed.resize(SortedADC.size());
342 std::transform(SortedADC.begin(),SortedADC.end(),ADCLessPed.begin(),std::bind(std::minus<float>(),std::placeholders::_1,median));
345 float rms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.end(), ADCLessPed.begin(), 0.) / float(ADCLessPed.size())));
348 unsigned int MinBins((1.0 - 0.01)*ADCLessPed.size());
355 float truncrms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.begin() + MinBins, ADCLessPed.begin(), 0.) / float(MinBins)));
358 std::vector<double> power(DataSize);
359 std::vector<double> RawLessPed;
360 RawLessPed.resize(RawADC.size());
361 std::transform(RawADC.begin(),RawADC.end(),RawLessPed.begin(),std::bind(std::minus<double>(),std::placeholders::_1,median));
362 fFFT->getFFTPower(RawLessPed, power);
366 if(plane==0&&wire!=32&&wire<3000) {
373 fPed.push_back(median);
377 if(plane==2) {
fRawRMSC.push_back(rms); }
378 if(plane==0&&wire!=32&&wire<3000) {
fRawRMSI1.push_back(rms); }
379 if(plane==1) {
fRawRMSI2.push_back(rms); }
382 fChannel.push_back(RawDigit.Channel());
385 float intI1=0, intI2=0, intC=0;
389 for (
unsigned int j=0; j< rpi1.size(); j++) intI1+=rpi1.at(j);
390 for (
unsigned int j=0; j< rpi2.size(); j++) intI2+=rpi2.at(j);
391 for (
unsigned int j=0; j< rpc.size(); j++) intC+=rpc.at(j);
393 std::cout <<
" integral i1 " << intI1 <<
" integral i2 " << intI2 <<
" integral c " << intC << std::endl;
397 art::Handle< std::vector<raw::RawDigit> > IntrinsicHandle;
403 for(
const auto& RawDigit : *IntrinsicHandle)
406 unsigned int DataSize = RawDigit.Samples();
407 std::vector<short> RawADC;
408 RawADC.resize(DataSize);
412 std::vector<short> SortedADC(RawADC);
413 std::sort(SortedADC.begin(),SortedADC.end(),[](
const auto&
left,
const auto&
right){
return std::fabs(
left) < std::fabs(
right);});
414 float median(SortedADC.at(SortedADC.size()/2));
417 float mean(
float(std::accumulate(SortedADC.begin(),SortedADC.end(),0))/float(SortedADC.size()));
420 std::vector<short> ADCLessPed;
421 ADCLessPed.resize(SortedADC.size());
422 std::transform(SortedADC.begin(),SortedADC.end(),ADCLessPed.begin(),std::bind(std::minus<float>(),std::placeholders::_1,median));
425 float rms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.end(), ADCLessPed.begin(), 0.) / float(ADCLessPed.size())));
428 unsigned int MinBins((1.0 - 0.2)*ADCLessPed.size());
435 float truncrms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.begin() + MinBins, ADCLessPed.begin(), 0.) / float(MinBins)));
438 std::vector<double> power(DataSize);
439 std::vector<double> RawLessPed;
440 RawLessPed.resize(RawADC.size());
441 std::transform(RawADC.begin(),RawADC.end(),RawLessPed.begin(),std::bind(std::minus<double>(),std::placeholders::_1,median));
442 fFFT->getFFTPower(RawLessPed, power);
443 std::vector<geo::WireID> widVec = geom->ChannelToWire(RawDigit.Channel());
444 size_t plane = widVec[0].Plane;
466 art::Handle< std::vector<raw::RawDigit> > CoherentHandle;
471 for(
const auto& RawDigit : *CoherentHandle)
475 unsigned int DataSize = RawDigit.Samples();
476 std::vector<short> RawADC;
477 RawADC.resize(DataSize);
481 std::vector<short> SortedADC(RawADC);
482 std::sort(SortedADC.begin(),SortedADC.end(),[](
const auto&
left,
const auto&
right){
return std::fabs(
left) < std::fabs(
right);});
483 float median(SortedADC.at(SortedADC.size()/2));
489 float mean(
float(std::accumulate(SortedADC.begin(),SortedADC.end(),0))/float(SortedADC.size()));
492 std::vector<short> ADCLessPed;
493 ADCLessPed.resize(SortedADC.size());
494 std::transform(SortedADC.begin(),SortedADC.end(),ADCLessPed.begin(),std::bind(std::minus<float>(),std::placeholders::_1,median));
497 float rms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.end(), ADCLessPed.begin(), 0.) / float(ADCLessPed.size())));
500 unsigned int MinBins((1.0 - 0.2)*ADCLessPed.size());
507 float truncrms(std::sqrt(std::inner_product(ADCLessPed.begin(), ADCLessPed.begin() + MinBins, ADCLessPed.begin(), 0.) / float(MinBins)));
510 std::vector<double> power(DataSize);
511 std::vector<double> RawLessPed;
512 RawLessPed.resize(RawADC.size());
513 std::transform(RawADC.begin(),RawADC.end(),RawLessPed.begin(),std::bind(std::minus<double>(),std::placeholders::_1,median));
514 fFFT->getFFTPower(RawLessPed, power);
515 std::vector<geo::WireID> widVec = geom->ChannelToWire(RawDigit.Channel());
516 size_t plane = widVec[0].Plane;
std::string fRawDigitModuleLabel
std::vector< double > fCoherentRMSI1
std::vector< float > fRawMeanI1
std::vector< double > fIntrinsicRMSI1
std::vector< double > fCoherentRMSI2
std::vector< float > fRawMeanI2
std::vector< double > fIntrinsicRMSC
std::vector< std::vector< float > > fCoherentPowerI2
std::vector< std::vector< float > > fRawPowerI1
std::string fIntrinsicInstance
std::vector< double > fCoherentRMSC
std::vector< unsigned short int > fChannel
std::vector< double > fRawRMSC
std::vector< double > fRawRMSI2
std::vector< std::vector< float > > fRawPowerI2
std::vector< double > fRawRMSTrim
std::vector< float > fPed
std::vector< double > fIntrinsicRMSTrim
std::string fCoherentInstance
std::vector< float > fRawMeanC
std::vector< std::vector< float > > fCoherentPowerI1
std::vector< std::vector< float > > fIntrinsicPowerC
std::vector< double > fIntrinsicRMSI2
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
std::vector< double > fCoherentRMSTrim
std::vector< float > fIntrinsicMean
std::vector< std::vector< float > > fRawPowerC
std::vector< float > fCoherentMean
std::vector< std::vector< float > > fIntrinsicPowerI2
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
std::vector< std::vector< float > > fCoherentPowerC
std::vector< std::vector< float > > fIntrinsicPowerI1
std::vector< double > fRawRMSI1
BEGIN_PROLOG could also be cout
std::string fRawDigitProcess