Public Member Functions | Private Member Functions | Private Attributes | List of all members
tpc_monitor::IcebergTpcMonitor Class Reference
Inheritance diagram for tpc_monitor::IcebergTpcMonitor:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 IcebergTpcMonitor (fhicl::ParameterSet const &pset)
 
virtual ~IcebergTpcMonitor ()
 
void beginJob ()
 
void beginRun (const art::Run &run)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void analyze (const art::Event &evt)
 
int FEMBchanToHistogramMap (int, int)
 
void endJob ()
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

float rmsADC (std::vector< short > &uncompressed)
 
float meanADC (std::vector< short > &uncompressed)
 
void calculateFFT (TH1D *hist_waveform, TH1D *graph_frequency)
 
void FillChannelHistos (TProfile *h1, double mean, double sigma, int &ndeadchannels, int &nnoisychannels_sigma, int &nnoisychannels_counts)
 

Private Attributes

std::string fRawDigitLabel
 
std::string fTPCInput
 
std::string fTPCInstance
 
unsigned int fEvent
 
unsigned int fRun
 
unsigned int fSubRun
 
unsigned int fNUCh
 
unsigned int fNVCh
 
unsigned int fNZ0Ch
 
unsigned int fNZ1Ch
 
unsigned int fUChanMin
 
unsigned int fUChanMax
 
unsigned int fVChanMin
 
unsigned int fVChanMax
 
unsigned int fZ0ChanMin
 
unsigned int fZ0ChanMax
 
unsigned int fZ1ChanMin
 
unsigned int fZ1ChanMax
 
unsigned int fNticks
 
unsigned int fNofAPA
 
unsigned int fChansPerAPA
 
float fSampleRate
 
float fBinWidth
 
std::vector< TH1F * > fChanMeanDistU
 
std::vector< TH1F * > fChanRMSDistU
 
std::vector< TH1F * > fChanMeanDistV
 
std::vector< TH1F * > fChanRMSDistV
 
std::vector< TH1F * > fChanMeanDistZ
 
std::vector< TH1F * > fChanRMSDistZ
 
std::vector< TH1F * > fStuckCodeOffFrac
 
std::vector< TH1F * > fStuckCodeOnFrac
 
std::vector< TProfile * > fChanStuckCodeOffFracU
 
std::vector< TProfile * > fChanStuckCodeOnFracU
 
std::vector< TProfile * > fChanStuckCodeOffFracV
 
std::vector< TProfile * > fChanStuckCodeOnFracV
 
std::vector< TProfile * > fChanStuckCodeOffFracZ
 
std::vector< TProfile * > fChanStuckCodeOnFracZ
 
std::vector< TH2F * > fChanFFTU
 
std::vector< TH2F * > fChanFFTV
 
std::vector< TH2F * > fChanFFTZ
 
std::vector< TProfile * > fChanRMSU_pfx
 
std::vector< TProfile * > fChanMeanU_pfx
 
std::vector< TProfile * > fChanRMSV_pfx
 
std::vector< TProfile * > fChanMeanV_pfx
 
std::vector< TProfile * > fChanRMSZ_pfx
 
std::vector< TProfile * > fChanMeanZ_pfx
 
std::vector< TH2F * > fPersistentFFT_by_APA
 
std::vector< TProfile * > fFFT_by_Fiber_pfx
 
int fRebinX
 
int fRebinY
 
unsigned int nADC_comp
 
unsigned int nADC_uncomp
 
unsigned int nADC_uncompPed
 
TH1F * fNTicksTPC
 
int fNoiseLevelMinNCountsU
 
int fNoiseLevelMinNCountsV
 
int fNoiseLevelMinNCountsZ
 
double fNoiseLevelNSigma
 
TH1F * fNDeadChannelsHisto
 
TH1F * fNNoisyChannelsHistoFromNSigma
 
TH1F * fNNoisyChannelsHistoFromNCounts
 
TH1F * fNDeadChannelsList
 
TH1F * fNNoisyChannelsListFromNSigma
 
TH1F * fNNoisyChannelsListFromNCounts
 
TH1F * fNDeadChannelsHistoU
 
TH1F * fNNoisyChannelsHistoFromNSigmaU
 
TH1F * fNNoisyChannelsHistoFromNCountsU
 
TH1F * fNDeadChannelsHistoV
 
TH1F * fNNoisyChannelsHistoFromNSigmaV
 
TH1F * fNNoisyChannelsHistoFromNCountsV
 
TH1F * fNDeadChannelsHistoZ
 
TH1F * fNNoisyChannelsHistoFromNSigmaZ
 
TH1F * fNNoisyChannelsHistoFromNCountsZ
 
geo::GeometryCore const * fGeom = &*(art::ServiceHandle<geo::Geometry>())
 
std::vector< unsigned int > fApaLabelNum
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 66 of file IcebergTpcMonitor_module.cc.

Constructor & Destructor Documentation

tpc_monitor::IcebergTpcMonitor::IcebergTpcMonitor ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 211 of file IcebergTpcMonitor_module.cc.

212  : EDAnalyzer(parameterSet), fRebinX(1), fRebinY(1), fApaLabelNum{1} {
213  this->reconfigure(parameterSet);
214  }
void reconfigure(fhicl::ParameterSet const &pset)
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::vector< unsigned int > fApaLabelNum
tpc_monitor::IcebergTpcMonitor::~IcebergTpcMonitor ( )
virtual

Definition at line 219 of file IcebergTpcMonitor_module.cc.

219 {}

Member Function Documentation

void tpc_monitor::IcebergTpcMonitor::analyze ( const art::Event evt)

Definition at line 477 of file IcebergTpcMonitor_module.cc.

477  {
478  // Get channel map
480  // TODO Use MF_LOG_DEBUG
481  MF_LOG_INFO("IcebergTpcMonitor")
482  << "-------------------- TPC IcebergTpcMonitor -------------------";
483 
484  // called once per event
485 
486  fEvent = event.id().event();
487  fRun = event.run();
488  fSubRun = event.subRun();
489  std::cout << "EventNumber = " << fEvent << std::endl;
490 
491  // Get the objects holding raw information: RawDigit for TPC data
493  auto RawTPC = event.getHandle< std::vector<raw::RawDigit> >(itag1);
494 
495  // Get RDStatus handle
496 
497  auto RDStatusHandle = event.getHandle< std::vector<raw::RDStatus> >(itag1);
498 
499  // Fill pointer vectors - more useful form for the raw data
500  // a more usable form
501  std::vector< art::Ptr<raw::RawDigit> > RawDigits;
502  art::fill_ptr_vector(RawDigits, RawTPC);
503 
504  // example of retrieving RDStatus word and flags
505 
506  for ( auto const& rdstatus : (*RDStatusHandle) )
507  {
508  if (rdstatus.GetCorruptDataDroppedFlag())
509  {
510  MF_LOG_INFO("IcebergTpcMonitor_module: ") << "Corrupt Data Dropped Flag set in RDStatus";
511  }
512  //std::cout << "RDStatus: Corrupt Data dropped " << rdstatus.GetCorruptDataDroppedFlag() << std::endl;
513  //std::cout << "RDStatus: Corrupt Data kept " << rdstatus.GetCorruptDataKeptFlag() << std::endl;
514  //std::cout << "RDStatus: Status Word " << rdstatus.GetStatWord() << std::endl;
515  }
516 
517  // Loop over all RawRCEDigits (entire channels)
518  for(auto const & dptr : RawDigits) {
519  const raw::RawDigit & digit = *dptr;
520 
521  // Get the channel number for this digit
522  uint32_t chan = digit.Channel();
523  // number of samples in uncompressed ADC
524  int nSamples = digit.Samples();
525  fNTicksTPC->Fill(nSamples);
526  unsigned int apa = std::floor( chan/fChansPerAPA );
527  //int pedestal = (int)digit.GetPedestal();
528  int pedestal = 0;
529 
530  std::vector<short> uncompressed(nSamples);
531  // with pedestal
532  raw::Uncompress(digit.ADCs(), uncompressed, pedestal, digit.Compression());
533 
534  // number of compressed ADCs
535  nADC_comp=digit.NADC();
536  // number of ADC uncompressed
537  nADC_uncomp=uncompressed.size();
538  // subtract pedestals
539  std::vector<short> uncompPed(nSamples);
540 
541  int nstuckoff=0;
542  int nstuckon=0;
543  for (int i=0; i<nSamples; i++)
544  {
545  auto adc=uncompressed.at(i);
546  auto adcl6b = adc & 0x3F;
547  if (adcl6b == 0) ++nstuckoff;
548  if (adcl6b == 0x3F) ++nstuckon;
549  uncompPed.at(i) = adc - pedestal;
550  }
551  float fracstuckoff = ((float) nstuckoff)/((float) nSamples);
552  float fracstuckon = ((float) nstuckon)/((float) nSamples);
553 
554  // number of ADC uncompressed without pedestal
555  nADC_uncompPed=uncompPed.size();
556 
557  // wavefrom histogram
558  int FiberID = channelMap->FiberIdFromOfflineChannel(chan);
559  TH1D* histwav=new TH1D(Form("wav%d",(int)chan),Form("wav%d",(int)chan),nSamples,0,nSamples);
560 
561  for(int k=0;k<(int)nADC_uncompPed;k++) {
562  histwav->SetBinContent(k+1, uncompPed.at(k));
563  // Fill Persistent waveform by fiber -- skip as it takes too much RAM
564  //fPersistentWav_by_Fiber.at(FiberID)->Fill(k+1, uncompPed.at(k));
565  }
566 
567  // Do FFT for single waveforms
568  TH1D* histfft=new TH1D(Form("fft%d",(int)chan),Form("fft%d",(int)chan),nSamples,0,nSamples*fBinWidth);
569  calculateFFT(histwav, histfft);
570  // Fill persistent/overlay FFT for each fiber/FEMB
571  for(int k=0;k<(int)nADC_uncompPed/2;k++) {
572  fPersistentFFT_by_APA.at(apa)->Fill((k+0.5)*fBinWidth, histfft->GetBinContent(k+1)); // offline apa number. Plot labels are online
573  fFFT_by_Fiber_pfx.at(FiberID % 120)->Fill((k+0.5)*fBinWidth, histfft->GetBinContent(k+1));
574  }
575 
576  // summary stuck code fraction distributions by APA -- here the APA is the offline APA number. The plot labels contain the mapping
577 
578  fStuckCodeOffFrac[apa]->Fill(fracstuckoff);
579  fStuckCodeOnFrac[apa]->Fill(fracstuckon);
580 
581  // Mean and RMS
582  float mean = meanADC(uncompPed);
583  float rms = rmsADC(uncompPed);
584 
585  // U View, induction Plane
586  if( fGeom->View(chan) == geo::kU){
587  fChanMeanU_pfx[apa]->Fill(chan, mean, 1);
588  fChanRMSU_pfx[apa]->Fill(chan, rms, 1);
589  fChanMeanDistU[apa]->Fill(mean);
590  fChanRMSDistU[apa]->Fill(rms);
591  fChanStuckCodeOffFracU[apa]->Fill(chan,fracstuckoff,1);
592  fChanStuckCodeOnFracU[apa]->Fill(chan,fracstuckon,1);
593 
594  //fft
595  for(int l=0;l<nSamples/2;l++) {
596  //for the 2D histos
597  fChanFFTU[apa]->Fill(chan, (l+0.5)*fBinWidth, histfft->GetBinContent(l+1));
598  }
599 
600  }// end of U View
601 
602  // V View, induction Plane
603  if( fGeom->View(chan) == geo::kV){
604  fChanRMSV_pfx[apa]->Fill(chan, rms, 1);
605  fChanMeanV_pfx[apa]->Fill(chan, mean, 1);
606  fChanMeanDistV[apa]->Fill(mean);
607  fChanRMSDistV[apa]->Fill(rms);
608  fChanStuckCodeOffFracV[apa]->Fill(chan,fracstuckoff,1);
609  fChanStuckCodeOnFracV[apa]->Fill(chan,fracstuckon,1);
610 
611  //fft
612  for(int l=0;l<nSamples/2;l++) {
613  //for the 2D histos
614  fChanFFTV[apa]->Fill(chan, (l+0.5)*fBinWidth, histfft->GetBinContent(l+1));
615  }
616 
617  }// end of V View
618 
619  // Z View, collection Plane
620  if( fGeom->View(chan) == geo::kZ){
621  fChanMeanZ_pfx[apa]->Fill(chan, mean, 1);
622  fChanRMSZ_pfx[apa]->Fill(chan, rms, 1);
623  fChanMeanDistZ[apa]->Fill(mean);
624  fChanRMSDistZ[apa]->Fill(rms);
625  fChanStuckCodeOffFracZ[apa]->Fill(chan,fracstuckoff,1);
626  fChanStuckCodeOnFracZ[apa]->Fill(chan,fracstuckon,1);
627 
628  //fft
629  for(int l=0;l<nSamples/2;l++) {
630  //for the 2D histos
631  fChanFFTZ[apa]->Fill(chan, (l+0.5)*fBinWidth, histfft->GetBinContent(l+1));
632  }
633 
634  }// end of Z View
635 
636  histwav->Delete();
637  histfft->Delete();
638 
639  } // RawDigits
640 
641  return;
642  }
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
Definition: RawDigit.h:210
std::vector< TProfile * > fFFT_by_Fiber_pfx
void calculateFFT(TH1D *hist_waveform, TH1D *graph_frequency)
float rmsADC(std::vector< short > &uncompressed)
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Definition: RawDigit.h:213
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
double rms(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:40
Planes which measure V.
Definition: geo_types.h:130
std::vector< TProfile * > fChanStuckCodeOnFracV
std::vector< TProfile * > fChanRMSZ_pfx
ChannelID_t Channel() const
DAQ channel this raw data was read from.
Definition: RawDigit.h:212
std::vector< raw::RawDigit > RawDigits
Definition: HDF5Utils.h:23
int16_t adc
Definition: CRTFragment.hh:202
Planes which measure Z direction.
Definition: geo_types.h:132
static QStrList * l
Definition: config.cpp:1044
unsigned int FiberIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global fiber ID.
std::vector< TProfile * > fChanRMSU_pfx
Planes which measure U.
Definition: geo_types.h:129
std::vector< TProfile * > fChanMeanU_pfx
std::vector< TProfile * > fChanStuckCodeOnFracU
size_t NADC() const
Number of elements in the compressed ADC sample vector.
Definition: RawDigit.h:207
#define MF_LOG_INFO(category)
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
float meanADC(std::vector< short > &uncompressed)
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
Definition: RawDigit.h:216
std::vector< TProfile * > fChanStuckCodeOnFracZ
std::vector< TProfile * > fChanRMSV_pfx
std::vector< TProfile * > fChanStuckCodeOffFracZ
std::vector< TProfile * > fChanStuckCodeOffFracU
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
Definition: raw.cxx:776
std::vector< TProfile * > fChanMeanV_pfx
std::vector< TProfile * > fChanStuckCodeOffFracV
std::vector< TProfile * > fChanMeanZ_pfx
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
QTextStream & endl(QTextStream &s)
void tpc_monitor::IcebergTpcMonitor::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 224 of file IcebergTpcMonitor_module.cc.

224  {
226  unsigned int UChMin;
227  unsigned int UChMax;
228  unsigned int VChMin;
229  unsigned int VChMax;
230  unsigned int ZChMin;
231  unsigned int ZChMax;
232 
233  // Accquiring geometry data
235  //fNofAPA = 1; // iceberg has just one APA. Should come out of the geometry
237 
238  // loop through channels in the first APA to find the channel boundaries for each view
239  // will adjust for desired APA after
240  fUChanMin = 0;
241  fZ1ChanMax = fChansPerAPA - 1;
242  for ( unsigned int c = fUChanMin + 1; c < fZ1ChanMax; c++ ){
243  if ( fGeom->View(c) == geo::kV && fGeom->View(c-1) == geo::kU ){
244  fVChanMin = c;
245  fUChanMax = c - 1;
246  }
247  if ( fGeom->View(c) == geo::kZ && fGeom->View(c-1) == geo::kV ){
248  fZ0ChanMin = c;
249  fVChanMax = c-1;
250  }
251  if ( fGeom->View(c) == geo::kZ && fGeom->ChannelToWire(c)[0].TPC == fGeom->ChannelToWire(c-1)[0].TPC + 1 ){
252  fZ1ChanMin = c;
253  fZ0ChanMax = c-1;
254  }
255  }
256 
257 
261  fNZ1Ch=fZ1ChanMax-fZ1ChanMin+1;
262 
263  mf::LogVerbatim("IcebergTpcMonitor")
264  <<"U: "<< fNUCh<<" V: "<<fNVCh<<" Z0: "<<fNZ0Ch << " Z1: " <<fNZ1Ch << std::endl;
265 
266  //Mean/RMS by offline channel for each view in each APA
267  for(unsigned int i=0;i<fNofAPA;i++)
268  {
269  UChMin=fUChanMin + i*fChansPerAPA;
270  UChMax=fUChanMax + i*fChansPerAPA;
271  VChMin=fVChanMin + i*fChansPerAPA;
272  VChMax=fVChanMax + i*fChansPerAPA;
273  ZChMin=fZ0ChanMin + i*fChansPerAPA;
274  //ZChMax=fZ0ChanMax + i*fChansPerAPA;
275  ZChMax=fZ1ChanMax + i*fChansPerAPA; //including unused channels
276 
277  //std::cout<<"UCh:"<<UChMin<<" - "<<UChMax<<std::endl;
278  //std::cout<<"VCh:"<<VChMin<<" - "<<VChMax<<std::endl;
279  //std::cout<<"ZCh:"<<ZChMin<<" - "<<ZChMax<<std::endl;
280 
281  // summaries for all views
282 
283  unsigned int j=fApaLabelNum.at(i);
284 
285  fStuckCodeOffFrac.push_back(tfs->make<TH1F>(Form("fStuckCodeOffFrac%d",j),Form("Stuck-Off Code Fraction APA%d",j),100,0,1));
286  fStuckCodeOnFrac.push_back(tfs->make<TH1F>(Form("fStuckCodeOnFrac%d",j),Form("Stuck-On Code Fraction APA%d",j),100,0,1));
287 
288  // U view
289  fChanRMSU_pfx.push_back(tfs->make<TProfile>(Form("fChanRMSU%d_pfx", j),Form("Profiled RMS vs Channel(Plane U, APA%d)", j), UChMax - UChMin + 1, UChMin-0.5, UChMax+0.5, "s"));
290  fChanMeanU_pfx.push_back(tfs->make<TProfile>(Form("fChanMeanU%d_pfx",j),Form("Profiled MEAN vs Channel(Plane U, APA%d)",j), UChMax - UChMin + 1, UChMin-0.5, UChMax+0.5, "s"));
291  fChanFFTU.push_back(tfs->make<TH2F>(Form("fChanFFTU%d", j),Form("fChanFFT (Plane U, APA%d)", j), UChMax - UChMin + 1, UChMin-0.5, UChMax+0.5, fNticks/2,0,fNticks/2*fBinWidth));
292  fChanMeanDistU.push_back(tfs->make<TH1F>(Form("fChanMeanDistU%d",j),Form("Means of Channels in (Plane U, APA%d)",j), 1000, 0, 16383));
293  fChanRMSDistU.push_back(tfs->make<TH1F>(Form("fChanRMSDistU%d",j),Form("RMSs of Channels in (Plane U, APA%d)",j), 100, 0, 50));
294  fChanStuckCodeOffFracU.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOffFracU%d",j),Form("Stuck-Off Code Fraction (Plane U, APA%d)",j), UChMax - UChMin + 1, UChMin-0.5, UChMax+0.5, "s"));
295  fChanStuckCodeOnFracU.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOnFracU%d",j),Form("Stuck-On Code Fraction (Plane U, APA%d)",j), UChMax - UChMin + 1, UChMin-0.5, UChMax+0.5, "s"));
296 
297  // V view
298  fChanRMSV_pfx.push_back(tfs->make<TProfile>(Form("fChanRMSV%d_pfx",j),Form("Profiled RMS vs Channel(Plane V, APA%d)",j), VChMax - VChMin + 1, VChMin-0.5, VChMax+0.5, "s"));
299  fChanMeanV_pfx.push_back(tfs->make<TProfile>(Form("fChanMeanV%d_pfx",j),Form("Profiled Mean vs Channel(Plane V, APA%d)",j), VChMax - VChMin + 1, VChMin-0.5, VChMax+0.5, "s"));
300  fChanFFTV.push_back(tfs->make<TH2F>(Form("fChanFFTV%d", j),Form("fChanFFT (Plane V, APA%d)", j), VChMax - VChMin + 1, VChMin-0.5, VChMax+0.5, fNticks/2,0,fNticks/2*fBinWidth));
301  fChanMeanDistV.push_back(tfs->make<TH1F>(Form("fChanMeanDistV%d",j),Form("Means of Channels in (Plane V, APA%d)",j), 1000, 0, 16383));
302  fChanRMSDistV.push_back(tfs->make<TH1F>(Form("fChanRMSDistV%d",j),Form("RMSs of Channels in (Plane V, APA%d)",j), 100, 0, 50));
303  fChanStuckCodeOffFracV.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOffFracV%d",j),Form("Stuck-Off Code Fraction (Plane V, APA%d)",j), VChMax - VChMin + 1, VChMin-0.5, VChMax+0.5, "s"));
304  fChanStuckCodeOnFracV.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOnFracV%d",j),Form("Stuck-On Code Fraction (Plane V, APA%d)",j), VChMax - VChMin + 1, VChMin-0.5, VChMax+0.5, "s"));
305 
306  // Z view
307  fChanRMSZ_pfx.push_back(tfs->make<TProfile>(Form("fChanRMSZ%d_pfx",j),Form("Profiled RMS vs Channel(Plane Z, APA%d)",j), ZChMax - ZChMin + 1, ZChMin-0.5, ZChMax+0.5, "s"));
308  fChanMeanZ_pfx.push_back(tfs->make<TProfile>(Form("fChanMeanZ%d_pfx",j),Form("Profiled Mean vs Channel(Plane Z, APA%d)",j), ZChMax - ZChMin + 1, ZChMin-0.5, ZChMax+0.5, "s"));
309  fChanFFTZ.push_back(tfs->make<TH2F>(Form("fChanFFTZ%d", j),Form("fChanFFT (Plane Z, APA%d)", j), ZChMax - ZChMin + 1, ZChMin-0.5, ZChMax+0.5, fNticks/2,0,fNticks/2*fBinWidth));
310  fChanMeanDistZ.push_back(tfs->make<TH1F>(Form("fChanMeanDistZ%d",j),Form("Means of Channels in (Plane Z, APA%d)",j), 1000, 0, 16383));
311  fChanRMSDistZ.push_back(tfs->make<TH1F>(Form("fChanRMSDistZ%d",j),Form("RMSs of Channels in (Plane Z, APA%d)",j), 100, 0, 50));
312  fChanStuckCodeOffFracZ.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOffFracZ%d",j),Form("Stuck-Off Code Fraction (Plane Z, APA%d)",j), ZChMax - ZChMin + 1, ZChMin-0.5, ZChMax+0.5, "s"));
313  fChanStuckCodeOnFracZ.push_back(tfs->make<TProfile>(Form("fChanStuckCodeOnFracZ%d",j),Form("Stuck-On Code Fraction (Plane Z, APA%d)",j), ZChMax - ZChMin + 1, ZChMin-0.5, ZChMax+0.5, "s"));
314 
315  // Set titles
316  fChanRMSU_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanRMSU_pfx[i]->GetYaxis()->SetTitle("raw RMS");
317  fChanMeanU_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanMeanU_pfx[i]->GetYaxis()->SetTitle("raw Mean");
318  fChanRMSV_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanRMSV_pfx[i]->GetYaxis()->SetTitle("raw RMS");
319  fChanMeanV_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanMeanV_pfx[i]->GetYaxis()->SetTitle("raw Mean");
320  fChanRMSZ_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanRMSZ_pfx[i]->GetYaxis()->SetTitle("raw RMS");
321  fChanMeanZ_pfx[i]->GetXaxis()->SetTitle("Chan"); fChanMeanZ_pfx[i]->GetYaxis()->SetTitle("raw Mean");
322  fChanFFTU[i]->GetXaxis()->SetTitle("Chan"); fChanFFTU[i]->GetYaxis()->SetTitle("kHz");
323  fChanFFTV[i]->GetXaxis()->SetTitle("Chan"); fChanFFTV[i]->GetYaxis()->SetTitle("kHz");
324  fChanFFTZ[i]->GetXaxis()->SetTitle("Chan"); fChanFFTZ[i]->GetYaxis()->SetTitle("kHz");
325  fChanStuckCodeOffFracU[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOffFracZ[i]->GetYaxis()->SetTitle("Fraction");
326  fChanStuckCodeOnFracU[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOnFracZ[i]->GetYaxis()->SetTitle("Fraction");
327  fChanStuckCodeOffFracV[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOffFracZ[i]->GetYaxis()->SetTitle("Fraction");
328  fChanStuckCodeOnFracV[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOnFracZ[i]->GetYaxis()->SetTitle("Fraction");
329  fChanStuckCodeOffFracZ[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOffFracZ[i]->GetYaxis()->SetTitle("Fraction");
330  fChanStuckCodeOnFracZ[i]->GetXaxis()->SetTitle("Chan"); fChanStuckCodeOnFracZ[i]->GetYaxis()->SetTitle("Fraction");
331 
332  fChanMeanDistU[i]->GetXaxis()->SetTitle("Mean (ADC counts)");
333  fChanRMSDistU[i]->GetXaxis()->SetTitle("RMS (ADC counts)");
334  fChanMeanDistV[i]->GetXaxis()->SetTitle("Mean (ADC counts)");
335  fChanRMSDistV[i]->GetXaxis()->SetTitle("RMS (ADC counts)");
336  fChanMeanDistZ[i]->GetXaxis()->SetTitle("Mean (ADC counts)");
337  fChanRMSDistZ[i]->GetXaxis()->SetTitle("RMS (ADC counts)");
338 
339  // Rebin histograms
340  //std::cout<<"RebinX = "<<fRebinX<<" RebinY = "<<fRebinY<<std::endl;
341  fChanFFTU[i]->Rebin2D(fRebinX, fRebinY);
342  fChanFFTV[i]->Rebin2D(fRebinX, fRebinY);
343  fChanFFTZ[i]->Rebin2D(fRebinX, fRebinY);
344  }
345 
346  // protodune, but the first 10 are Iceberg labels
347 
348  // unsigned int fembmap_by_fiberID[120] =
349  // {
350  // 703,727,715,723,721,706,726,716,704,709,
351  // 308,303,317,312,307,302,316,311,306,301,505,510,515,520,504,509,514,519,503,508,513,518,502,507,512,517,501,506,511,516,220,215,210,205,219,
352  // 214,209,204,218,213,208,203,217,212,207,202,216,211,206,201,605,610,615,620,604,609,614,619,603,608,613,618,602,607,612,617,601,606,611,616,120,115,110,105,119,114,109,104,118,113,
353  // 108,103,117,112,107,102,116,111,106,101,405,410,415,420,404,409,414,419,403,408,413,418,402,407,412,417,401,406,411,416
354  // };
355  // latest Run 2 FEMB placement
356  std::pair<std::string, std::string> fembmapstr_by_fiberID[10] =
357  {
358  {"727", "WIB1-FEMB1"}, {"726", "WIB3-FEMB1"},{"716","WIB2-FEMB1"},{"723","WIB1-FEMB2"},{"703","WIB3-FEMB3"},
359  {"FM015", "WIB1-FEMB4"},{"FM012","WIB2-FEMB4"},{"FM140","WIB3-FEMB4"},{"721","WIB1-FEMB3"},{"706","WIB2-FEMB3"}
360  };
361 
362 
363  // FFT's by fiber
364  for(int i=0;i<10;i++) {
365  // re-order by Z - plane channels
366  unsigned int z_i = (i > 4) ? 14 - i : i;
367  // unsigned int imb = fembmap_by_fiberID[i];
368  std::pair<std::string, std::string> fembstr = fembmapstr_by_fiberID[i];
369  //fPersistentFFT_by_Fiber.push_back(tfs->make<TH2F>(Form("Persistent_FFT_FEMB_%d", imb), Form("FFT FEMB%d WIB%d", imb, ( (i/4) % 5)+1), fNticks/2, 0, fNticks/2*fBinWidth, 150, -100, 50));
370  //fPersistentFFT_by_Fiber[i]->GetXaxis()->SetTitle("Frequency [kHz]"); fPersistentFFT_by_Fiber[i]->GetYaxis()->SetTitle("Amplitude [dB]");
371  // still keep the profiled FFT's by FEMB
372  // fFFT_by_Fiber_pfx.push_back(tfs->make<TProfile>(Form("Profiled_FFT_FEMB_%02d", imb), Form("Profiled FFT FEMB_%d WIB%d", imb, ( (i/4) %5)+1), fNticks/2, 0, fNticks/2*fBinWidth, -100, 50));
373  fFFT_by_Fiber_pfx.push_back(tfs->make<TProfile>(Form("Profiled_FFT_FEMB_%02d", z_i+1), Form("Profiled FFT FEMB_%s %s", fembstr.first.c_str(), fembstr.second.c_str()), fNticks/2, 0, fNticks/2*fBinWidth, -100, 50));
374  fFFT_by_Fiber_pfx[i]->GetXaxis()->SetTitle("Frequency [kHz]"); fFFT_by_Fiber_pfx[i]->GetYaxis()->SetTitle("Amplitude [dB]");
375  }
376  // persistent FFT now by APA
377  for (unsigned int i=0;i<fNofAPA;++i)
378  {
379  fPersistentFFT_by_APA.push_back(tfs->make<TH2F>(Form("Persistent_FFT_APA_%d", fApaLabelNum[i]), Form("FFT APA%d ", fApaLabelNum[i]), fNticks/2, 0, fNticks/2*fBinWidth, 150, -100, 50));
380  fPersistentFFT_by_APA[i]->GetXaxis()->SetTitle("Frequency [kHz]");
381  fPersistentFFT_by_APA[i]->GetYaxis()->SetTitle("Amplitude [dB]");
382  }
383 
384  fNTicksTPC = tfs->make<TH1F>("NTicksTPC","NTicks in TPC Channels",100,0,20000);
385 
386  // Dead/noisy channels
387  fNDeadChannelsHisto = tfs->make<TH1F>("fNDeadChannelsHisto","Number of dead channels",fNofAPA+1,0,fNofAPA+1);
388  fNDeadChannelsHisto->GetYaxis()->SetTitle("Number of dead channels");
389  fNNoisyChannelsHistoFromNSigma = tfs->make<TH1F>("fNNoisyChannelsHistoFromNSigma","Number of noisy channels",fNofAPA+1,0,fNofAPA+1);
390  fNNoisyChannelsHistoFromNSigma->GetYaxis()->SetTitle("Number of noisy channels");
391  fNNoisyChannelsHistoFromNCounts = tfs->make<TH1F>("fNNoisyChannelsHistoFromNCounts",Form("Number of noisy channels above counts %i-%i-%i (U-V-Z)", fNoiseLevelMinNCountsU, fNoiseLevelMinNCountsV, fNoiseLevelMinNCountsZ), fNofAPA+1,0,fNofAPA+1);
392  fNNoisyChannelsHistoFromNCounts->GetYaxis()->SetTitle("Number of noisy channels");
393 
394  fNDeadChannelsHistoU = tfs->make<TH1F>("fNDeadChannelsHistoU","Number of dead channels (Plane U)",fNofAPA+1,0,fNofAPA+1);
395  fNDeadChannelsHistoU->GetYaxis()->SetTitle("Number of dead channels (Plane U)");
396  fNNoisyChannelsHistoFromNSigmaU = tfs->make<TH1F>("fNNoisyChannelsHistoFromNSigmaU","Number of noisy channels (Plane U)",fNofAPA+1,0,fNofAPA+1);
397  fNNoisyChannelsHistoFromNSigmaU->GetYaxis()->SetTitle("Number of noisy channels (Plane U)");
398  fNNoisyChannelsHistoFromNCountsU = tfs->make<TH1F>("fNNoisyChannelsHistoFromNCountsU",Form("Number of noisy channels above %i counts (Plane U)", fNoiseLevelMinNCountsU), fNofAPA+1,0,fNofAPA+1);
399  fNNoisyChannelsHistoFromNCountsU->GetYaxis()->SetTitle("Number of noisy channels (Plane U)");
400 
401  fNDeadChannelsHistoV = tfs->make<TH1F>("fNDeadChannelsHistoV","Number of dead channels (Plane V)",fNofAPA+1,0,fNofAPA+1);
402  fNDeadChannelsHistoV->GetYaxis()->SetTitle("Number of dead channels (Plane V)");
403  fNNoisyChannelsHistoFromNSigmaV = tfs->make<TH1F>("fNNoisyChannelsHistoFromNSigmaV","Number of noisy channels (Plane V)",fNofAPA+1,0,fNofAPA+1);
404  fNNoisyChannelsHistoFromNSigmaV->GetYaxis()->SetTitle("Number of noisy channels (Plane V)");
405  fNNoisyChannelsHistoFromNCountsV = tfs->make<TH1F>("fNNoisyChannelsHistoFromNCountsV",Form("Number of noisy channels above %i counts (Plane V)", fNoiseLevelMinNCountsV), fNofAPA+1,0,fNofAPA+1);
406  fNNoisyChannelsHistoFromNCountsV->GetYaxis()->SetTitle("Number of noisy channels (Plane V)");
407 
408  fNDeadChannelsHistoZ = tfs->make<TH1F>("fNDeadChannelsHistoZ","Number of dead channels (Plane Z)",fNofAPA+1,0,fNofAPA+1);
409  fNDeadChannelsHistoZ->GetYaxis()->SetTitle("Number of dead channels (Plane Z)");
410  fNNoisyChannelsHistoFromNSigmaZ = tfs->make<TH1F>("fNNoisyChannelsHistoFromNSigmaZ","Number of noisy channels (Plane Z)",fNofAPA+1,0,fNofAPA+1);
411  fNNoisyChannelsHistoFromNSigmaZ->GetYaxis()->SetTitle("Number of noisy channels (Plane Z)");
412  fNNoisyChannelsHistoFromNCountsZ = tfs->make<TH1F>("fNNoisyChannelsHistoFromNCountsZ",Form("Number of noisy channels above %i counts (Plane Z)", fNoiseLevelMinNCountsZ), fNofAPA+1,0,fNofAPA+1);
413  fNNoisyChannelsHistoFromNCountsZ->GetYaxis()->SetTitle("Number of noisy channels (Plane Z)");
414 
415  fNDeadChannelsList = tfs->make<TH1F>("fNDeadChannelsList","List of dead channels",fGeom->Nchannels()+1,fUChanMin,fGeom->Nchannels()+1);
416  fNDeadChannelsList->GetXaxis()->SetTitle("Channel ID");
417  fNNoisyChannelsListFromNSigma = tfs->make<TH1F>("fNNoisyChannelsListFromNSigma","List of noisy channels",fGeom->Nchannels()+1,fUChanMin,fGeom->Nchannels()+1);
418  fNNoisyChannelsListFromNSigma->GetXaxis()->SetTitle("Channel ID");
419  fNNoisyChannelsListFromNCounts = tfs->make<TH1F>("fNNoisyChannelsListFromNCounts",Form("Number of noisy channels above counts %i-%i-%i (U-V-Z)", fNoiseLevelMinNCountsU, fNoiseLevelMinNCountsV, fNoiseLevelMinNCountsZ),fGeom->Nchannels()+1,fUChanMin,fGeom->Nchannels()+1);
420  fNNoisyChannelsListFromNCounts->GetXaxis()->SetTitle("Channel ID");
421 
422  for(unsigned int i=0;i<fNofAPA;i++){
423  unsigned int j=fApaLabelNum.at(i);
424  TString apastring = Form("APA %i", j);
425  fNDeadChannelsHisto->GetXaxis()->SetBinLabel(j+1, apastring.Data());
426  fNNoisyChannelsHistoFromNSigma->GetXaxis()->SetBinLabel(j+1, apastring.Data());
427  fNNoisyChannelsHistoFromNCounts->GetXaxis()->SetBinLabel(j+1, apastring.Data());
428 
429  fNDeadChannelsHistoU->GetXaxis()->SetBinLabel(j+1, apastring.Data());
430  fNNoisyChannelsHistoFromNSigmaU->GetXaxis()->SetBinLabel(j+1, apastring.Data());
431  fNNoisyChannelsHistoFromNCountsU->GetXaxis()->SetBinLabel(j+1, apastring.Data());
432  fNDeadChannelsHistoV->GetXaxis()->SetBinLabel(j+1, apastring.Data());
433  fNNoisyChannelsHistoFromNSigmaV->GetXaxis()->SetBinLabel(j+1, apastring.Data());
434  fNNoisyChannelsHistoFromNCountsV->GetXaxis()->SetBinLabel(j+1, apastring.Data());
435  fNDeadChannelsHistoZ->GetXaxis()->SetBinLabel(j+1, apastring.Data());
436  fNNoisyChannelsHistoFromNSigmaZ->GetXaxis()->SetBinLabel(j+1, apastring.Data());
437  fNNoisyChannelsHistoFromNCountsZ->GetXaxis()->SetBinLabel(j+1, apastring.Data());
438  }
439  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::vector< TProfile * > fFFT_by_Fiber_pfx
Planes which measure V.
Definition: geo_types.h:130
std::vector< TProfile * > fChanStuckCodeOnFracV
std::vector< TProfile * > fChanRMSZ_pfx
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
Planes which measure Z direction.
Definition: geo_types.h:132
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
std::vector< TProfile * > fChanRMSU_pfx
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
Planes which measure U.
Definition: geo_types.h:129
std::vector< unsigned int > fApaLabelNum
std::vector< TProfile * > fChanMeanU_pfx
std::vector< TProfile * > fChanStuckCodeOnFracU
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
std::vector< TProfile * > fChanStuckCodeOnFracZ
std::vector< TProfile * > fChanRMSV_pfx
std::vector< TProfile * > fChanStuckCodeOffFracZ
std::vector< TProfile * > fChanStuckCodeOffFracU
std::vector< TProfile * > fChanMeanV_pfx
std::vector< TProfile * > fChanStuckCodeOffFracV
std::vector< TProfile * > fChanMeanZ_pfx
QTextStream & endl(QTextStream &s)
void tpc_monitor::IcebergTpcMonitor::beginRun ( const art::Run run)

Definition at line 442 of file IcebergTpcMonitor_module.cc.

442  {
443  // place to read databases or run independent info
444  }
void tpc_monitor::IcebergTpcMonitor::calculateFFT ( TH1D *  hist_waveform,
TH1D *  graph_frequency 
)
private

Definition at line 677 of file IcebergTpcMonitor_module.cc.

677  {
678 
679  int n_bins = hist_waveform->GetNbinsX();
680  TH1* hist_transform = 0;
681 
682  // Create hist_transform from the input hist_waveform
683  hist_transform = hist_waveform->FFT(hist_transform, "MAG");
684  hist_transform -> Scale (1.0 / float(n_bins));
685  int nFFT=hist_transform->GetNbinsX();
686 
687  double frequency;
688  double amplitude;
689  double amplitudeLog;
690 
691  // Loop on the hist_transform to fill the hist_transform_frequency
692  for (int k = 0; k < nFFT/2; k++){
693 
694  frequency = (k+0.5)*fBinWidth; // kHz
695  amplitude = hist_transform->GetBinContent(k+1);
696  amplitudeLog = 20*log10(amplitude); // dB
697  hist_frequency->Fill(frequency, amplitudeLog);
698  }
699 
700  hist_transform->Delete();
701 
702  }
Scale(size_t pos, T factor) -> Scale< T >
void tpc_monitor::IcebergTpcMonitor::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 792 of file IcebergTpcMonitor_module.cc.

792  {
793 
794  // Find dead/noisy channels. Do this separately for each APA and for each view.
795  std::vector<double> fURMS_mean; std::vector<double> fURMS_sigma;
796  std::vector<double> fVRMS_mean; std::vector<double> fVRMS_sigma;
797  std::vector<double> fZRMS_mean; std::vector<double> fZRMS_sigma;
798  for(unsigned int i = 0; i < fNofAPA; i++){
799  // U plane
800  TH1F* h1 = (TH1F*)fChanRMSDistU.at(i);
801  fURMS_mean.push_back(h1->GetMean());
802  fURMS_sigma.push_back(h1->GetRMS());
803  // V plane
804  TH1F* h2 = (TH1F*)fChanRMSDistV.at(i);
805  fVRMS_mean.push_back(h2->GetMean());
806  fVRMS_sigma.push_back(h2->GetRMS());
807  // Z plane
808  TH1F* h3 = (TH1F*)fChanRMSDistZ.at(i);
809  fZRMS_mean.push_back(h3->GetMean());
810  fZRMS_sigma.push_back(h3->GetRMS());
811  }
812 
813  std::vector<int> fUdch_vec; std::vector<int> fUnch_vec; std::vector<int> fUcch_vec;
814  std::vector<int> fVdch_vec; std::vector<int> fVnch_vec; std::vector<int> fVcch_vec;
815  std::vector<int> fZdch_vec; std::vector<int> fZnch_vec; std::vector<int> fZcch_vec;
816 
817  for(unsigned int i = 0; i < fNofAPA; i++){
818  int ndeadchannels = 0; int nnoisychannels = 0; int nnoisychannels_counts = 0;
819 
820  // U plane
821  TProfile* h1 = (TProfile*)fChanRMSU_pfx.at(i);
822  FillChannelHistos(h1, fURMS_mean.at(i), fURMS_sigma.at(i), ndeadchannels, nnoisychannels, nnoisychannels_counts);
823  fUdch_vec.push_back(ndeadchannels);
824  fUnch_vec.push_back(nnoisychannels);
825  fUcch_vec.push_back(nnoisychannels_counts);
826 
827  // V plane
828  ndeadchannels = 0; nnoisychannels = 0; nnoisychannels_counts = 0;
829  TProfile* h2 = (TProfile*)fChanRMSV_pfx.at(i);
830  FillChannelHistos(h2, fVRMS_mean.at(i), fVRMS_sigma.at(i), ndeadchannels, nnoisychannels, nnoisychannels_counts);
831  fVdch_vec.push_back(ndeadchannels);
832  fVnch_vec.push_back(nnoisychannels);
833  fVcch_vec.push_back(nnoisychannels_counts);
834 
835  // Z plane
836  ndeadchannels = 0; nnoisychannels = 0; nnoisychannels_counts = 0;
837  TProfile* h3 = (TProfile*)fChanRMSZ_pfx.at(i);
838  FillChannelHistos(h3, fZRMS_mean.at(i), fZRMS_sigma.at(i), ndeadchannels, nnoisychannels, nnoisychannels_counts);
839  fZdch_vec.push_back(ndeadchannels);
840  fZnch_vec.push_back(nnoisychannels);
841  fZcch_vec.push_back(nnoisychannels_counts);
842  }
843 
844  // Fill summary histograms
845  for(unsigned int i = 0; i < fNofAPA; i++){
846  unsigned int j=fApaLabelNum.at(i);
847  int nch = fUdch_vec.at(i) + fVdch_vec.at(i) + fZdch_vec.at(i);
848  fNDeadChannelsHisto->SetBinContent(j+1, nch);
849  nch = fUnch_vec.at(i) + fVnch_vec.at(i) + fZnch_vec.at(i);
850  fNNoisyChannelsHistoFromNSigma->SetBinContent(j+1, nch);
851  nch = fUcch_vec.at(i) + fVcch_vec.at(i) + fZcch_vec.at(i);
852  fNNoisyChannelsHistoFromNCounts->SetBinContent(j+1, nch);
853 
854  fNDeadChannelsHistoU->SetBinContent(j+1, fUdch_vec.at(i));
855  fNDeadChannelsHistoV->SetBinContent(j+1, fVdch_vec.at(i));
856  fNDeadChannelsHistoZ->SetBinContent(j+1, fZdch_vec.at(i));
857 
858  fNNoisyChannelsHistoFromNSigmaU->SetBinContent(j+1, fUnch_vec.at(i));
859  fNNoisyChannelsHistoFromNSigmaV->SetBinContent(j+1, fVnch_vec.at(i));
860  fNNoisyChannelsHistoFromNSigmaZ->SetBinContent(j+1, fZnch_vec.at(i));
861 
862  fNNoisyChannelsHistoFromNCountsU->SetBinContent(j+1, fUcch_vec.at(i));
863  fNNoisyChannelsHistoFromNCountsV->SetBinContent(j+1, fVcch_vec.at(i));
864  fNNoisyChannelsHistoFromNCountsZ->SetBinContent(j+1, fZcch_vec.at(i));
865  }
866 
867  // myfileU.close();
868  // myfileV.close();
869  // myfileZ.close();
870  return;
871  }
std::vector< TProfile * > fChanRMSZ_pfx
std::vector< TProfile * > fChanRMSU_pfx
void FillChannelHistos(TProfile *h1, double mean, double sigma, int &ndeadchannels, int &nnoisychannels_sigma, int &nnoisychannels_counts)
std::vector< unsigned int > fApaLabelNum
std::vector< TProfile * > fChanRMSV_pfx
int tpc_monitor::IcebergTpcMonitor::FEMBchanToHistogramMap ( int  FEMBchan,
int  coord 
)

Definition at line 761 of file IcebergTpcMonitor_module.cc.

761  {
762  //to see the reason for this channel mapping, check DocDB 4064 Table 5
763  //for one FEMB, this dictates the coordinates on the histogram as a 4X32 block.
764  int FEMBchanToHistogram[128][2] = { {0,0},{0,1},{0,2},{0,3},{0,4},//for U
765  {0,10},{0,11},{0,12},{0,13},{0,14},//for V
766  {0,20},{0,21},{0,22},{0,23},{0,24},{0,25},//for Z
767  {0,5},{0,6},{0,7},{0,8},{0,9},//for U
768  {0,15},{0,16},{0,17},{0,18},{0,19},//for V
769  {0,26},{0,27},{0,28},{0,29},{0,30},{0,31},//for Z
770  {1,20},{1,21},{1,22},{1,23},{1,24},{1,25},//for Z
771  {1,10},{1,11},{1,12},{1,13},{1,14},//for V
772  {1,0},{1,1},{1,2},{1,3},{1,4},//for U
773  {1,26},{1,27},{1,28},{1,29},{1,30},{1,31},//for Z
774  {1,15},{1,16},{1,17},{1,18},{1,19},//for V
775  {1,5},{1,6},{1,7},{1,8},{1,9},//for U
776  {2,0},{2,1},{2,2},{2,3},{2,4},//for U
777  {2,10},{2,11},{2,12},{2,13},{2,14},//for V
778  {2,20},{2,21},{2,22},{2,23},{2,24},{2,25},//for Z
779  {2,5},{2,6},{2,7},{2,8},{2,9},//for U
780  {2,15},{2,16},{2,17},{2,18},{2,19},//for V
781  {2,26},{2,27},{2,28},{2,29},{2,30},{2,31},//for Z
782  {3,20},{3,21},{3,22},{3,23},{3,24},{3,25},//for Z
783  {3,10},{3,11},{3,12},{3,13},{3,14},//for V
784  {3,0},{3,1},{3,2},{3,3},{3,4},//for U
785  {3,26},{3,27},{3,28},{3,29},{3,30},{3,31},//for Z
786  {3,15},{3,16},{3,17},{3,18},{3,19},//for V
787  {3,5},{3,6},{3,7},{3,8},{3,9} };//for U
788  return FEMBchanToHistogram[FEMBchan][coord];
789  }
auto coord(Vector &v, unsigned int n) noexcept
Returns an object to manage the coordinate n of a vector.
void tpc_monitor::IcebergTpcMonitor::FillChannelHistos ( TProfile *  h1,
double  mean,
double  sigma,
int &  ndeadchannels,
int &  nnoisychannels_sigma,
int &  nnoisychannels_counts 
)
private

Definition at line 706 of file IcebergTpcMonitor_module.cc.

706  {
707 
708  double rms_threshold = mean + fNoiseLevelNSigma*sigma;
709  TString htitle = h1->GetTitle();
710 
711  for(Int_t j=1; j <= h1->GetNbinsX(); j++){
712 
713  int fChannelID = h1->GetBinCenter(j);
714  double fChannelValue = h1->GetBinContent(j);
715 
716  if(fChannelValue == 0){ // dead channel
717  ndeadchannels++;
718  fNDeadChannelsList->SetBinContent(fChannelID, 1.0);
719  }
720  else{
721  if(fChannelValue > rms_threshold){ // noisy channel far away from mean
722  nnoisychannels_sigma++;
723  fNNoisyChannelsListFromNSigma->SetBinContent(fChannelID, 1.0);
724  }
725  if(htitle.Contains("Plane U"))
726  {
727  if (fChannelValue > fNoiseLevelMinNCountsU)
728  { // noisy U channel above count threshold
729  nnoisychannels_counts++;
730  fNNoisyChannelsListFromNCounts->SetBinContent(fChannelID, 1.0);
731  }
732  }
733  else if(htitle.Contains("Plane V"))
734  {
735  if (fChannelValue > fNoiseLevelMinNCountsV)
736  { // noisy V channel above count threshold
737  nnoisychannels_counts++;
738  fNNoisyChannelsListFromNCounts->SetBinContent(fChannelID, 1.0);
739  }
740  }
741  else if(htitle.Contains("Plane Z"))
742  {
743  if (fChannelValue > fNoiseLevelMinNCountsZ)
744  { // noisy Z channel above count threshold
745  nnoisychannels_counts++;
746  fNNoisyChannelsListFromNCounts->SetBinContent(fChannelID, 1.0);
747  }
748  }
749  else{
750  mf::LogVerbatim("IcebergTpcMonitor::FillChannelHistos")
751  << " Unknown histogram title: " << htitle.Data() << std::endl;
752  }
753  }
754  }
755 
756  return;
757  }
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16
QTextStream & endl(QTextStream &s)
float tpc_monitor::IcebergTpcMonitor::meanADC ( std::vector< short > &  uncompressed)
private

Definition at line 664 of file IcebergTpcMonitor_module.cc.

665  {
666  int n = uncomp.size();
667  float sum = 0.;
668  for(int i = 0; i < n; i++)
669  {
670  if (uncomp[i]!=0) sum += abs(uncomp[i]);
671  }
672  return sum / n;
673  }
T abs(T value)
std::void_t< T > n
void tpc_monitor::IcebergTpcMonitor::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 447 of file IcebergTpcMonitor_module.cc.

447  {
448 
449  // reconfigure without recompiling
450  // read in the parameters from the .fcl file
451  // allows for interactive changes of the parameter values
452 
453  fTPCInput = p.get< std::string >("TPCInputModule");
454  fTPCInstance = p.get< std::string >("TPCInstanceName");
455  fRebinX = p.get<int>("RebinFactorX");
456  fRebinY = p.get<int>("RebinFactorY");
457  fNoiseLevelMinNCountsU = p.get<int>("NoiseLevelMinNCountsU");
458  fNoiseLevelMinNCountsV = p.get<int>("NoiseLevelMinNCountsV");
459  fNoiseLevelMinNCountsZ = p.get<int>("NoiseLevelMinNCountsZ");
460  fNoiseLevelNSigma = p.get<double>("NoiseLevelNSigma");
461  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob();
462  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataForJob(clockData);
463  fNticks = detProp.NumberTimeSamples();
464 
465  std::cout<< "Number of Ticks = "<< fNticks <<std::endl;
466  //get sampling rate
467  fSampleRate = sampling_rate(clockData);
468  std::cout<<"Sampling rate = "<<fSampleRate<<std::endl;
469  // width of frequencyBin in kHz
470  fBinWidth = 1.0/(fNticks*fSampleRate*1.0e-6);
471  std::cout<<"Bin Width (kHz) = "<<fBinWidth<<std::endl;
472  return;
473  }
std::string string
Definition: nybbler.cc:12
p
Definition: test.py:223
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
QTextStream & endl(QTextStream &s)
float tpc_monitor::IcebergTpcMonitor::rmsADC ( std::vector< short > &  uncompressed)
private

Definition at line 646 of file IcebergTpcMonitor_module.cc.

647  {
648  int n = uncomp.size();
649  float sum = 0.;
650  for(int i = 0; i < n; i++){
651  if(uncomp[i]!=0) sum += uncomp[i];
652  }
653  float mean = sum / n;
654  sum = 0;
655  for(int i = 0; i < n; i++)
656  {
657  if (uncomp[i]!=0) sum += (uncomp[i]-mean)*(uncomp[i]-mean);
658  }
659  return sqrt(sum / n);
660  }
std::void_t< T > n
double mean(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:16

Member Data Documentation

std::vector<unsigned int> tpc_monitor::IcebergTpcMonitor::fApaLabelNum
private

Definition at line 204 of file IcebergTpcMonitor_module.cc.

float tpc_monitor::IcebergTpcMonitor::fBinWidth
private

Definition at line 117 of file IcebergTpcMonitor_module.cc.

std::vector<TH2F*> tpc_monitor::IcebergTpcMonitor::fChanFFTU
private

Definition at line 140 of file IcebergTpcMonitor_module.cc.

std::vector<TH2F*> tpc_monitor::IcebergTpcMonitor::fChanFFTV
private

Definition at line 141 of file IcebergTpcMonitor_module.cc.

std::vector<TH2F*> tpc_monitor::IcebergTpcMonitor::fChanFFTZ
private

Definition at line 142 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanMeanDistU
private

Definition at line 120 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanMeanDistV
private

Definition at line 122 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanMeanDistZ
private

Definition at line 124 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanMeanU_pfx
private

Definition at line 146 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanMeanV_pfx
private

Definition at line 148 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanMeanZ_pfx
private

Definition at line 150 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanRMSDistU
private

Definition at line 121 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanRMSDistV
private

Definition at line 123 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fChanRMSDistZ
private

Definition at line 125 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanRMSU_pfx
private

Definition at line 145 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanRMSV_pfx
private

Definition at line 147 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanRMSZ_pfx
private

Definition at line 149 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fChansPerAPA
private

Definition at line 111 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOffFracU
private

Definition at line 132 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOffFracV
private

Definition at line 134 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOffFracZ
private

Definition at line 136 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOnFracU
private

Definition at line 133 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOnFracV
private

Definition at line 135 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fChanStuckCodeOnFracZ
private

Definition at line 137 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fEvent
private

Definition at line 88 of file IcebergTpcMonitor_module.cc.

std::vector<TProfile*> tpc_monitor::IcebergTpcMonitor::fFFT_by_Fiber_pfx
private

Definition at line 158 of file IcebergTpcMonitor_module.cc.

geo::GeometryCore const* tpc_monitor::IcebergTpcMonitor::fGeom = &*(art::ServiceHandle<geo::Geometry>())
private

Definition at line 202 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNDeadChannelsHisto
private

Definition at line 178 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNDeadChannelsHistoU
private

Definition at line 185 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNDeadChannelsHistoV
private

Definition at line 189 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNDeadChannelsHistoZ
private

Definition at line 193 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNDeadChannelsList
private

Definition at line 181 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNCounts
private

Definition at line 180 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNCountsU
private

Definition at line 187 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNCountsV
private

Definition at line 191 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNCountsZ
private

Definition at line 195 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNSigma
private

Definition at line 179 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNSigmaU
private

Definition at line 186 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNSigmaV
private

Definition at line 190 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsHistoFromNSigmaZ
private

Definition at line 194 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsListFromNCounts
private

Definition at line 183 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNNoisyChannelsListFromNSigma
private

Definition at line 182 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNofAPA
private

Definition at line 110 of file IcebergTpcMonitor_module.cc.

int tpc_monitor::IcebergTpcMonitor::fNoiseLevelMinNCountsU
private

Definition at line 172 of file IcebergTpcMonitor_module.cc.

int tpc_monitor::IcebergTpcMonitor::fNoiseLevelMinNCountsV
private

Definition at line 173 of file IcebergTpcMonitor_module.cc.

int tpc_monitor::IcebergTpcMonitor::fNoiseLevelMinNCountsZ
private

Definition at line 174 of file IcebergTpcMonitor_module.cc.

double tpc_monitor::IcebergTpcMonitor::fNoiseLevelNSigma
private

Definition at line 175 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNticks
private

Definition at line 108 of file IcebergTpcMonitor_module.cc.

TH1F* tpc_monitor::IcebergTpcMonitor::fNTicksTPC
private

Definition at line 169 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNUCh
private

Definition at line 95 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNVCh
private

Definition at line 96 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNZ0Ch
private

Definition at line 97 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fNZ1Ch
private

Definition at line 98 of file IcebergTpcMonitor_module.cc.

std::vector<TH2F*> tpc_monitor::IcebergTpcMonitor::fPersistentFFT_by_APA
private

Definition at line 155 of file IcebergTpcMonitor_module.cc.

std::string tpc_monitor::IcebergTpcMonitor::fRawDigitLabel
private

Definition at line 83 of file IcebergTpcMonitor_module.cc.

int tpc_monitor::IcebergTpcMonitor::fRebinX
private

Definition at line 161 of file IcebergTpcMonitor_module.cc.

int tpc_monitor::IcebergTpcMonitor::fRebinY
private

Definition at line 162 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fRun
private

Definition at line 89 of file IcebergTpcMonitor_module.cc.

float tpc_monitor::IcebergTpcMonitor::fSampleRate
private

Definition at line 114 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fStuckCodeOffFrac
private

Definition at line 128 of file IcebergTpcMonitor_module.cc.

std::vector<TH1F*> tpc_monitor::IcebergTpcMonitor::fStuckCodeOnFrac
private

Definition at line 129 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fSubRun
private

Definition at line 90 of file IcebergTpcMonitor_module.cc.

std::string tpc_monitor::IcebergTpcMonitor::fTPCInput
private

Definition at line 84 of file IcebergTpcMonitor_module.cc.

std::string tpc_monitor::IcebergTpcMonitor::fTPCInstance
private

Definition at line 85 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fUChanMax
private

Definition at line 101 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fUChanMin
private

Definition at line 100 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fVChanMax
private

Definition at line 103 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fVChanMin
private

Definition at line 102 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fZ0ChanMax
private

Definition at line 105 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fZ0ChanMin
private

Definition at line 104 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fZ1ChanMax
private

Definition at line 107 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::fZ1ChanMin
private

Definition at line 106 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::nADC_comp
private

Definition at line 165 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::nADC_uncomp
private

Definition at line 166 of file IcebergTpcMonitor_module.cc.

unsigned int tpc_monitor::IcebergTpcMonitor::nADC_uncompPed
private

Definition at line 167 of file IcebergTpcMonitor_module.cc.


The documentation for this class was generated from the following file: