Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
calib::DCMTimingOffset Class Reference
Inheritance diagram for calib::DCMTimingOffset:
art::EDFilter art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::Table< UserConfig >
 

Public Member Functions

 DCMTimingOffset (fhicl::ParameterSet const &p)
 
virtual ~DCMTimingOffset ()
 
virtual bool filter (art::Event &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob ()
 
void endJob ()
 
virtual bool beginRun (art::Run &run)
 
virtual bool endSubRun (art::SubRun &srun)
 
virtual bool endRun (art::Run &r)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

std::string fDCMLabel
 Where to find dcm stats. More...
 
int fNumDCM
 Number of DCMs calibration will be performed on. More...
 
int fMinDCM
 Number of lowest DCM in calibration set. More...
 
int fMaxDCM
 Number of highest DCM in calibration set. More...
 
int fMinCount
 Minimum number of counts for a DCM pair. More...
 
bool fInitialized = false
 Flag if initialization has happened. More...
 
bool fOverrideRef
 override default of fixing calibration of dcm 6 with an offset of 0 More...
 
int fRefDCMTop = 6
 DCM number to use as reference for top chain, default is 6. More...
 
int fRefDCMSide = 7
 DCM number to use as reference for side chain, default is 7. More...
 
float fRefOffsetTop = 0.0
 absolute offset, in ns, to fix refence DCM to for top chain, default is 0.0 More...
 
float fRefOffsetSide = 0.0
 absolute offset, in ns, to fix refence DCM to for side chain, default is 0.0 More...
 
bool fIsMC
 
bool fSaveRunCalibration
 
int fMinSubrun
 
fhicl::ParameterSet fPSetND
 
fhicl::ParameterSet fPSetFD
 
fhicl::ParameterSet fPSetTB
 
std::vector< std::vector< int > > countDCMOffsetArray
 
std::vector< std::vector< float > > sumSquareDCMOffsetArray
 
std::vector< std::vector< float > > sumDCMOffsetArray
 
std::vector< std::vector< float > > meanDCMOffsetArray
 
std::vector< std::vector< float > > weightDCMOffsetArray
 
std::vector< float > absoluteDCMOffset
 
std::vector< float > absoluteDCMErrors
 
std::vector< intcountDCMUse
 
uint32_t minTime
 
uint32_t maxTime
 
std::vector< std::vector< int > > countDCMOffsetArrayRun
 
std::vector< std::vector< float > > sumSquareDCMOffsetArrayRun
 
std::vector< std::vector< float > > sumDCMOffsetArrayRun
 
std::vector< std::vector< float > > meanDCMOffsetArrayRun
 
std::vector< std::vector< float > > weightDCMOffsetArrayRun
 
std::vector< float > absoluteDCMOffsetRun
 
std::vector< float > absoluteDCMErrorsRun
 
std::vector< intcountDCMUseRun
 
uint32_t minTimeRun
 
uint32_t maxTimeRun
 
int subrunCount
 
std::map< int, std::vector< caldp::DCMOffset > > offsetMap
 

Detailed Description

Definition at line 61 of file DCMTimingOffset_module.cc.

Member Typedef Documentation

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

using art::EDFilter::WorkerType = WorkerT<EDFilter>
inherited

Definition at line 38 of file EDFilter.h.

Constructor & Destructor Documentation

calib::DCMTimingOffset::DCMTimingOffset ( fhicl::ParameterSet const &  p)
explicit

Definition at line 134 of file DCMTimingOffset_module.cc.

References art::InRun, and reconfigure().

137  {
138  this->reconfigure(pset);
139 
140  produces< std::vector<caldp::DCMOffset>, art::InRun >();
141  produces< caldp::DCMSummary, art::InRun >();
142 
143  }
void reconfigure(const fhicl::ParameterSet &pset)
calib::DCMTimingOffset::~DCMTimingOffset ( )
virtual

Definition at line 163 of file DCMTimingOffset_module.cc.

164  {
165  // Clean up dynamic memory and other resources here.
166  }

Member Function Documentation

void calib::DCMTimingOffset::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 169 of file DCMTimingOffset_module.cc.

References cet::sqlite::max(), maxTime, min(), and minTime.

Referenced by filter().

170  {
171 
172 
173 
174 
175  //We want to be able to handle any time possible.
178  }
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
bool calib::DCMTimingOffset::beginRun ( art::Run run)
virtual

Reimplemented from art::EDFilter.

Definition at line 181 of file DCMTimingOffset_module.cc.

References absoluteDCMErrors, absoluteDCMErrorsRun, absoluteDCMOffset, absoluteDCMOffsetRun, ana::assert(), countDCMOffsetArray, countDCMOffsetArrayRun, countDCMUse, countDCMUseRun, geo::GeometryBase::DetId(), fInitialized, fIsMC, fMaxDCM, fMinCount, fMinDCM, fNumDCM, fOverrideRef, fPSetFD, fPSetND, fPSetTB, fRefDCMSide, fRefDCMTop, fRefOffsetSide, fRefOffsetTop, geom(), fhicl::ParameterSet::get(), nova::dbi::RunHistory::GetDataType(), MECModelEnuComparisons::i, novadaq::cnv::kFARDET, nova::dbi::kMCOnly, novadaq::cnv::kNEARDET, novadaq::cnv::kTESTBEAM, cet::sqlite::max(), maxTimeRun, meanDCMOffsetArray, meanDCMOffsetArrayRun, min(), minTimeRun, rh, subrunCount, sumDCMOffsetArray, sumDCMOffsetArrayRun, sumSquareDCMOffsetArray, sumSquareDCMOffsetArrayRun, weightDCMOffsetArray, and weightDCMOffsetArrayRun.

Referenced by filter().

182  {
183  //for first run determine detector, initialize arrays, do not repeat
184  if(!fInitialized){
185  fInitialized = true;
187  fIsMC = (rh->GetDataType() == nova::dbi::kMCOnly);
188 
191 
192  //get fcl parameters based on detector
194 
195  fhicl::ParameterSet pset;
196  switch(geom->DetId()){
198  pset = fPSetND;
199  break;
201  pset = fPSetFD;
202  break;
204  pset = fPSetTB;
205  break;
206  default:
207  assert(0 && "Unknown detector");
208  }
209 
210  fOverrideRef = pset.get< bool >("OverrideRef");
211  fMinDCM = pset.get< int >("MinDCM");
212  fMaxDCM = pset.get< int >("MaxDCM");
213  fMinCount = pset.get< int >("MinCount");
214  if (fOverrideRef){
215  fRefDCMTop = pset.get< int >("RefDCMTop");
216  fRefDCMSide = pset.get< int >("RefDCMSide");
217  fRefOffsetTop = pset.get< float >("RefOffsetTop");
218  fRefOffsetSide = pset.get< float >("RefOffsetSide");
219  }
220 
221  //assert parameters make sense
222  assert(fMaxDCM >= fMinDCM);
223  assert((fRefDCMTop >= fMinDCM) && (fRefDCMTop <= fMaxDCM));
224  assert((fRefDCMSide >= fMinDCM) && (fRefDCMSide <= fMaxDCM));
225  fNumDCM = fMaxDCM - fMinDCM + 1;
226 
227 
230  sumDCMOffsetArray.resize(fNumDCM);
231  meanDCMOffsetArray.resize(fNumDCM);
233  absoluteDCMOffset.resize(fNumDCM);
234  absoluteDCMErrors.resize(fNumDCM);
235  countDCMUse.resize(fNumDCM);
236 
237  for (int i=0; i<fNumDCM; ++i){
238  countDCMOffsetArray[i].resize(fNumDCM);
239  sumSquareDCMOffsetArray[i].resize(fNumDCM);
240  sumDCMOffsetArray[i].resize(fNumDCM);
241  meanDCMOffsetArray[i].resize(fNumDCM);
242  weightDCMOffsetArray[i].resize(fNumDCM);
243  }
244  }
245 
246  //clear arrays for the run to be safe
247  countDCMOffsetArrayRun.clear();
249  sumDCMOffsetArrayRun.clear();
250  meanDCMOffsetArrayRun.clear();
251  weightDCMOffsetArrayRun.clear();
252  absoluteDCMOffsetRun.clear();
253  absoluteDCMErrorsRun.clear();
254  countDCMUseRun.clear();
255 
256  //resize run arrays
257  countDCMOffsetArrayRun.resize(fNumDCM);
258  sumSquareDCMOffsetArrayRun.resize(fNumDCM);
259  sumDCMOffsetArrayRun.resize(fNumDCM);
260  meanDCMOffsetArrayRun.resize(fNumDCM);
261  weightDCMOffsetArrayRun.resize(fNumDCM);
262  absoluteDCMOffsetRun.resize(fNumDCM);
263  absoluteDCMErrorsRun.resize(fNumDCM);
264  countDCMUseRun.resize(fNumDCM);
265 
266  for (int i=0; i<fNumDCM; ++i){
267  countDCMOffsetArrayRun[i].resize(fNumDCM);
268  sumSquareDCMOffsetArrayRun[i].resize(fNumDCM);
269  sumDCMOffsetArrayRun[i].resize(fNumDCM);
270  meanDCMOffsetArrayRun[i].resize(fNumDCM);
271  weightDCMOffsetArrayRun[i].resize(fNumDCM);
272  }
273 
274  subrunCount = 0;
275 
276  return true;
277  }
std::vector< std::vector< float > > meanDCMOffsetArray
TH2 * rh
Definition: drawXsec.C:5
std::vector< std::vector< float > > weightDCMOffsetArrayRun
int fRefDCMTop
DCM number to use as reference for top chain, default is 6.
std::vector< float > absoluteDCMOffset
int fMinCount
Minimum number of counts for a DCM pair.
int fRefDCMSide
DCM number to use as reference for side chain, default is 7.
std::vector< float > absoluteDCMOffsetRun
Far Detector at Ash River, MN.
int fMinDCM
Number of lowest DCM in calibration set.
float fRefOffsetTop
absolute offset, in ns, to fix refence DCM to for top chain, default is 0.0
std::vector< std::vector< float > > weightDCMOffsetArray
T get(std::string const &key) const
Definition: ParameterSet.h:231
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
std::vector< float > absoluteDCMErrorsRun
Near Detector in the NuMI cavern.
std::vector< float > absoluteDCMErrors
std::vector< std::vector< float > > sumDCMOffsetArray
int fMaxDCM
Number of highest DCM in calibration set.
float fRefOffsetSide
absolute offset, in ns, to fix refence DCM to for side chain, default is 0.0
std::vector< std::vector< int > > countDCMOffsetArrayRun
std::vector< int > countDCMUseRun
std::vector< std::vector< float > > meanDCMOffsetArrayRun
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
bool fOverrideRef
override default of fixing calibration of dcm 6 with an offset of 0
std::vector< std::vector< float > > sumDCMOffsetArrayRun
void geom(int which=0)
Definition: geom.C:163
bool fInitialized
Flag if initialization has happened.
assert(nhit_max >=nhit_nbins)
int fNumDCM
Number of DCMs calibration will be performed on.
std::vector< std::vector< float > > sumSquareDCMOffsetArrayRun
nova::dbi::DataType GetDataType()
Definition: RunHistory.h:452
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
std::vector< std::vector< float > > sumSquareDCMOffsetArray
std::vector< std::vector< int > > countDCMOffsetArray
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDFilter::currentContext ( ) const
protectedinherited
void calib::DCMTimingOffset::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 479 of file DCMTimingOffset_module.cc.

References genie::units::A, absoluteDCMErrors, absoluteDCMOffset, daqchannelmap::AFULLAFULL_DIBLOCK, febshutoff_auto::chan, convert(), confusionMatrixTree::count, countDCMOffsetArray, countDCMUse, om::cout, febshutoff_auto::dcm, DEFINE_ART_MODULE(), geo::GeometryBase::DetId(), APDHVSetting::dummy, allTimeWatchdog::endl, fclose(), fIsMC, fMaxDCM, fMinCount, fMinDCM, fNumDCM, fRefDCMSide, fRefDCMTop, fRefOffsetSide, fRefOffsetTop, fSaveRunCalibration, geom(), daqchannelmap::DAQChannelMap::getInstance(), daqchannelmap::DAQChannelMap::getNumberOfDCM(), MECModelEnuComparisons::i, calib::j, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, art::TFileDirectory::make(), meanDCMOffsetArray, minTime, num, offsetMap, shutoffs::runs, sigma(), std::sqrt(), sum, sumDCMOffsetArray, sumSquareDCMOffsetArray, APDHVSetting::temp, weightDCMOffsetArray, submit_syst::x, and submit_syst::y.

Referenced by filter().

480  {
481 std::cout<<"I am cleaning up"<<std::endl;
482  //figure out dcms per diblock from geometry
485  const int NDCMDB = cmap->getNumberOfDCM(daqchannelmap::AFULLAFULL_DIBLOCK);
486 
487  //make summary plots of calibration performance
489 
490  const int runs = offsetMap.size();
491  const int num= fNumDCM;
492  TGraphErrors* grAbsDCM[num];
493  TGraphErrors* grAbsRuns[runs];
494  TGraph* grStatsDCM[num];
495  TGraph* grStatsRuns[runs];
496  TGraphErrors* grAbs;
497  TGraphErrors* grAbsDiff;
498  TGraph* grStats;
499  TGraphErrors* grRelDiff;
500  TH2F* fHistoRelMap;
501  TH1F* fHistoRelDiff;
502  TH2F* fHistoRelDiffMap;
503 
504  double runDCM[num][runs];
505  double runDCMOffset[num][runs];
506  double runDCMOffsetE[num][runs];
507  double runDCMStats[num][runs];
508 
509  grRelDiff = tfs->make<TGraphErrors>();
510  gDirectory->Append(grRelDiff);
511  grRelDiff->SetName("grRelDiff");
512  grRelDiff->SetTitle("Relative offset drift vs diblock gap");
513  grRelDiff->Set(55);
514 
515  grAbsDiff = tfs->make<TGraphErrors>();
516  gDirectory->Append(grAbsDiff);
517 
518 
519  grAbs = tfs->make<TGraphErrors>();
520  gDirectory->Append(grAbs);
521  grStats = tfs->make<TGraph>();
522  gDirectory->Append(grStats);
523  fHistoRelMap = tfs->make<TH2F>("fHistoRelMap","Relative offsets (ns), all runs, DCM Y- DCM X;dcm X;dcm Y",
524  fNumDCM,(double)fMinDCM-0.5,(double)fMaxDCM+0.5,fNumDCM,(double)fMinDCM-0.5,(double)fMaxDCM+0.5);
525  fHistoRelDiffMap = tfs->make<TH2F>("fHistoRelDiffMap","Relative offsets differences (ns), all runs, DCM Y- DCM X - expected;dcm X;dcm Y",
526  fNumDCM,(double)fMinDCM-0.5,(double)fMaxDCM+0.5,fNumDCM,(double)fMinDCM-0.5,(double)fMaxDCM+0.5);
527  fHistoRelDiff = tfs->make<TH1F>("fHistoRelDiff","DCM i - DCM j - expected;diff (ns);count",201,-100.5,100.5);
528 
529  for (int i=0; i< runs; ++i){
530  grAbsRuns[i] = tfs->make<TGraphErrors>();
531  gDirectory->Append(grAbsRuns[i]);
532  grStatsRuns[i] = tfs->make<TGraph>();
533  gDirectory->Append(grStatsRuns[i]);
534  }
535  for (int i=0; i< num; ++i){
536  grAbsDCM[i] = tfs->make<TGraphErrors>();
537  gDirectory->Append(grAbsDCM[i]);
538  grStatsDCM[i] = tfs->make<TGraph>();
539  gDirectory->Append(grStatsDCM[i]);
540  }
541 
542  //expected pattern of DCM offsets within each FD diblock based on measured cable delays. This is used to plot accuracy of calibration. If
543  //the expected offsets change this should be updated.
544  double dcmoffsetExpectedFDDiblock[12] = {-203.125,-164.0625,-125.0,-78.125,-39.0625,0.0,0.0,-39.0625,-78.125,-125.0,-164.0625,-203.125};
545 
546  //expected pattern of DCM offsets for all ND DCMs based on measured cable delays. There is not a repeatable diblock pattern so all
547  //DCMs are listed. This is used to plot accuracy of calibration. If the expected offsets change this should be updated.
548  double dcmoffsetExpectedND[14] = {-101.5625,-70.3125,-30.25,0.0,-101.5625,-70.3125,-30.25,0.0,-101.5625,-70.3125,-30.25,0.0,-101.5625,-62.5};
549 
550  //initialize bins of the relative offset map so that empty bins can be distinguished from 0
551  for(int i=0;i<fNumDCM;++i){
552  for(int j=0;j<fNumDCM;++j){
553  fHistoRelMap->SetBinContent(j+1,i+1,-5000.0);
554  }
555  }
556 
557  //calculate mean and standard deviation for all relative offset pairs
558  for(int i=0; i<fNumDCM-1; ++i){
559  for(int j=i+1; j<fNumDCM; ++j){
560  float sum = sumDCMOffsetArray[i][j];
561  int count = countDCMOffsetArray[i][j];
562  float sumSqr = sumSquareDCMOffsetArray[i][j];
563  if (count >= fMinCount){
564  meanDCMOffsetArray[i][j] = sum/count;
565  float sigma = sqrt((count*sumSqr - sum*sum)/(count*(count-1.0)));
566  weightDCMOffsetArray[i][j] = 1.0/(sigma*sigma);
567  fHistoRelMap->SetBinContent(j+1,i+1,sum/count);
568  double expected = 0.0;
569  if (geom->DetId() == novadaq::cnv::kFARDET) expected = dcmoffsetExpectedFDDiblock[i%12]-dcmoffsetExpectedFDDiblock[j%12];
570  else if (geom->DetId() == novadaq::cnv::kNEARDET) expected = dcmoffsetExpectedND[i]-dcmoffsetExpectedND[j];
571  fHistoRelDiffMap->SetBinContent(j+1,i+1,(sum/count)-expected);
572  fHistoRelDiff->Fill((sum/count)-expected);
573  }
574  else {
575  meanDCMOffsetArray[i][j] = 0;
576  weightDCMOffsetArray[i][j] = 0;
577  }
578  }
579  }
580 
581 
582  int refIndxTop = fRefDCMTop - fMinDCM;
583  int refIndxSide = fRefDCMSide - fMinDCM;
584  TMatrixD A;
585  A.ResizeTo(fNumDCM, fNumDCM);
586  double y[num];
587  for (int x=0; x<num; ++x) y[x]=0.;
588 
589  //see docdb-XXXX, solve a system of linear equations that corresponds to minimizing the chhi squared for the absolute offsets. Fill matrix in this step
590  for(int i=0; i<fNumDCM; ++i){
591  double temp[num];
592  for (int x=0; x<num; ++x) temp[x]=0.;
593  for(int j=0; j<fNumDCM; ++j){
594  if (i==j) continue;
595  if (j<i){
596  temp[i] += weightDCMOffsetArray[j][i]*2.0;
597  temp[j] += -weightDCMOffsetArray[j][i]*2.0;
598  y[i] += meanDCMOffsetArray[j][i]*weightDCMOffsetArray[j][i]*2.0;
599  }
600  if (j>i){
601  temp[i] += weightDCMOffsetArray[i][j]*2.0;
602  temp[j] += -weightDCMOffsetArray[i][j]*2.0;
603  y[i] += -meanDCMOffsetArray[i][j]*weightDCMOffsetArray[i][j]*2.0;
604  }
605  }
606 
607  if (i == refIndxTop){
608  for (int j=0; j<fNumDCM; ++j) temp[j] = 0.0;
609  temp[refIndxTop]=1.0;
610  }
611  if (i == refIndxSide){
612  for (int j=0; j<fNumDCM; ++j) temp[j] = 0.0;
613  temp[refIndxSide]=1.0;
614  }
615 
616  y[i]*=-1.0;
617  TVectorD tempvec;
618  tempvec.Use(fNumDCM,temp);
619  TMatrixDRow(A,i) = tempvec;
620  }
621 
622  y[refIndxTop] = fRefOffsetTop;
623  y[refIndxSide] = fRefOffsetSide;
624  TVectorD yvec;
625  yvec.Use(fNumDCM,y);
626 
627  //calculate uncertainties
628  for(int i=0; i<fNumDCM; ++i){
629  for(int j=0; j<fNumDCM; ++j){
630  if (i==j) continue;
631  if (j<i) absoluteDCMErrors[i] += 2.0*weightDCMOffsetArray[j][i];
632  else if (j>i) absoluteDCMErrors[i] += 2.0*weightDCMOffsetArray[i][j];
633  }
635  }
636  absoluteDCMErrors[refIndxTop] = 0.0;
637  absoluteDCMErrors[refIndxSide] = 0.0;
638 
639  //solve for absolute offsets
640  TDecompLU lu(A);
641  try{
642  lu.Decompose();
643  }
644  catch(...){
645  std::cout<<"ERROR: Could not perform matrix inversion to calculate absolute DCM offsets for the processed runs. The matrix inversion was performed over the range: "<<fMinDCM<<" to "<<fMaxDCM<<". If this set of runs had missing diblocks in this range the matrix inversion will be invalid. If this is not desired please adjust the DCM range in the FCL file. The program will exit now."<<std::endl;
646  return;
647  }
648  lu.Invert(A);
649  yvec *= A;
650 
651  //write results to csv file
652  const TString mcStr = fIsMC ? "_mc" : "";
653  FILE* fConstsCSV = fopen("calib_abs_dcm_delay_consts"+mcStr+".csv","w");
654 
655  fprintf(fConstsCSV, "#dcmoffset,sigma,stats,channel,tv\n");
656 
657  //there is a drift in the dcm offsets in diblocks 7-14. The cause is unknown for now offsets of each diblock are adjusted by hand to put them in
658  //the right place. This should not be necessary in the future when the cause in known and can be removed
659  double dbcorrectionFD[14] = {0.0,
660  0.0,
661  0.0,
662  0.0,
663  0.0,
664  0.0,
665  4.06,
666  3.88,
667  3.82,
668  4.24,
669  6.31,
670  7.29,
671  10.23,
672  11.47};
673 
674  //same style correction for the ND
675  double dbcorrectionND[14] = {15.55,
676  8.2,
677  0.0,
678  0.0};
679 
680  //Multipy by -1 since the correction facto is the opposite sign of the offset
681  //store channel as diblock*1000+dcm
682  //make CVS file with constants to put in DB
683  for (int i=0; i<fNumDCM; ++i){
684  int db = ((i+fMinDCM)/NDCMDB)+1;
685  int dcm = (i+fMinDCM)%NDCMDB;
686  if ((i+fMinDCM)%NDCMDB == 0){
687  db--;
688  dcm = NDCMDB;
689  }
690  if (geom->DetId() == novadaq::cnv::kFARDET) absoluteDCMOffset[i] = yvec[i] + dbcorrectionFD[db-1];
691  else if (geom->DetId() == novadaq::cnv::kNEARDET) absoluteDCMOffset[i] = yvec[i] + dbcorrectionND[db-1];
692  int chan = db*1000 + dcm;
693  fprintf(fConstsCSV, "%g,%g,%d,%d,%d\n",
694  (-1*absoluteDCMOffset[i]), absoluteDCMErrors[i], countDCMUse[i], chan, minTime);
695  }
696 
697  fclose(fConstsCSV);
698 
699  //save summary calibration histograms on run-by-run basis
700  if (fSaveRunCalibration){
701  int runcount= 0;
702  for (std::map<int, std::vector<caldp::DCMOffset> >::iterator itr = offsetMap.begin(); itr != offsetMap.end(); ++itr){
703  int rnum = itr->first;
704  std::vector<caldp::DCMOffset> offsets = itr->second;
705 
706  TString dummy;
707  std::ostringstream convert;
708  convert << rnum;
709  dummy = convert.str();
710  grAbsRuns[runcount]->SetName("grAbsOffset_run_"+dummy);
711  grAbsRuns[runcount]->SetTitle("Absolute DCM timing offsets (ns) for run: "+dummy);
712  grAbsRuns[runcount]->Set(offsets.size());
713  grStatsRuns[runcount]->SetName("grStatsOffset_run_"+dummy);
714  grStatsRuns[runcount]->SetTitle("Number of track segments used by dcm for run: "+dummy);
715  grStatsRuns[runcount]->Set(offsets.size());
716  for (unsigned int i=0; i<offsets.size(); ++i){
717  int tdcm = offsets[i].DCM();
718  double toffset = offsets[i].Offset();
719  double tsigma = offsets[i].Sigma();
720  int tstats = offsets[i].Stats();
721  grStatsRuns[runcount]->SetPoint(i,tdcm,tstats);
722  grAbsRuns[runcount]->SetPoint(i,tdcm,toffset);
723  grAbsRuns[runcount]->SetPointError(i,0.0,tsigma);
724  runDCM[tdcm-fMinDCM][runcount]=rnum;
725  runDCMOffset[tdcm-fMinDCM][runcount]=toffset;
726  runDCMOffsetE[tdcm-fMinDCM][runcount]=tsigma;
727  runDCMStats[tdcm-fMinDCM][runcount]=tstats;
728  }
729  runcount++;
730  }
731 
732  for(int i=0; i<num; ++i){
733  int tdcm = i + fMinDCM;
734  TString dummy;
735  std::ostringstream convert;
736  convert << tdcm;
737  dummy = convert.str();
738  grAbsDCM[i]->SetName("grAbsOffset_dcm_"+dummy);
739  grAbsDCM[i]->SetTitle("Absolute DCM timing offsets (ns) across all run for dcm: "+dummy);
740  grAbsDCM[i]->Set(runs);
741  grStatsDCM[i]->SetName("grStatsOffset_dcm_"+dummy);
742  grStatsDCM[i]->SetTitle("Number of track segments used for all runs by dcm: "+dummy);
743  grStatsDCM[i]->Set(runs);
744  for(int j=0; j<runs; ++j){
745  grAbsDCM[i]->SetPoint(j,runDCM[i][j],runDCMOffset[i][j]);
746  grAbsDCM[i]->SetPointError(j,0.0,runDCMOffsetE[i][j]);
747  grStatsDCM[i]->SetPoint(j,runDCM[i][j],runDCMStats[i][j]);
748  }
749  }
750  }
751 
752  grAbs->SetName("grAbsOffset_total");
753  grAbs->SetTitle("Absolute DCM timing offsets (ns), all runs");
754  grAbs->Set(num);
755  grStats->SetName("grStatsOffset_total");
756  grStats->SetTitle("Number of track segments used by dcm, all runs");
757  grStats->Set(num);
758  grAbsDiff->SetName("grAbsDiff_total");
759  grAbsDiff->SetTitle("Absolute DCM timing offset - expected value (ns), all runs");
760  grAbsDiff->Set(num);
761 
762  for(int i=0; i< fNumDCM; ++i){
763  if (geom->DetId() == novadaq::cnv::kFARDET) grAbsDiff->SetPoint(i,i+fMinDCM,absoluteDCMOffset[i]-dcmoffsetExpectedFDDiblock[i%12]);
764  else if (geom->DetId() == novadaq::cnv::kNEARDET) grAbsDiff->SetPoint(i,i+fMinDCM,absoluteDCMOffset[i]-dcmoffsetExpectedND[i]);
765  grAbsDiff->SetPointError(i,0.0,absoluteDCMErrors[i]);
766  grAbs->SetPoint(i,i+fMinDCM,absoluteDCMOffset[i]);
767  grAbs->SetPointError(i,0.0,absoluteDCMErrors[i]);
768  grStats->SetPoint(i,i+fMinDCM,countDCMUse[i]);
769  }
770 
771 
772  }
std::vector< std::vector< float > > meanDCMOffsetArray
virtual unsigned int getNumberOfDCM(DiBlock_TYPE dbt) const =0
How many DCMs does this diblock have?
T sqrt(T number)
Definition: d0nt_math.hpp:156
int fRefDCMTop
DCM number to use as reference for top chain, default is 6.
std::vector< float > absoluteDCMOffset
int fMinCount
Minimum number of counts for a DCM pair.
int fRefDCMSide
DCM number to use as reference for side chain, default is 7.
Float_t Y
Definition: plot.C:38
void convert(std::string dir="cc_numu/C12")
Definition: convert.C:107
fclose(fg1)
Far Detector at Ash River, MN.
int fMinDCM
Number of lowest DCM in calibration set.
static DAQChannelMap * getInstance(int detID)
float fRefOffsetTop
absolute offset, in ns, to fix refence DCM to for top chain, default is 0.0
std::vector< std::vector< float > > weightDCMOffsetArray
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
std::vector< float > absoluteDCMErrors
std::vector< std::vector< float > > sumDCMOffsetArray
int fMaxDCM
Number of highest DCM in calibration set.
const double j
Definition: BetheBloch.cxx:29
Identifier for diblocks using a 32/32 configuration.
float fRefOffsetSide
absolute offset, in ns, to fix refence DCM to for side chain, default is 0.0
static const double ns
Module that plots metrics from reconstructed cosmic ray data.
double sigma(TH1F *hist, double percentile)
OStream cout
Definition: OStream.cxx:6
static const double A
Definition: Units.h:82
T * make(ARGS...args) const
int num
Definition: f2_nu.C:119
void geom(int which=0)
Definition: geom.C:163
cmap::CMap class source code
Definition: CMap.cxx:17
std::map< int, std::vector< caldp::DCMOffset > > offsetMap
int fNumDCM
Number of DCMs calibration will be performed on.
Double_t sum
Definition: plot.C:31
#define for
Definition: msvc_pragmas.h:3
Float_t X
Definition: plot.C:38
std::vector< std::vector< float > > sumSquareDCMOffsetArray
list runs
Definition: shutoffs.py:47
std::vector< std::vector< int > > countDCMOffsetArray
bool calib::DCMTimingOffset::endRun ( art::Run r)
virtual

Reimplemented from art::EDFilter.

Definition at line 320 of file DCMTimingOffset_module.cc.

References genie::units::A, absoluteDCMErrorsRun, absoluteDCMOffsetRun, confusionMatrixTree::count, countDCMOffsetArrayRun, countDCMUseRun, om::cout, allTimeWatchdog::endl, fMaxDCM, fMinCount, fMinDCM, fMinSubrun, fNumDCM, fRefDCMSide, fRefDCMTop, fRefOffsetSide, fRefOffsetTop, fSaveRunCalibration, MECModelEnuComparisons::i, stan::math::inv(), calib::j, maxTimeRun, meanDCMOffsetArrayRun, minTimeRun, num, offsetMap, art::Run::put(), art::Run::run(), caldp::DCMOffset::SetDCM(), caldp::DCMSummary::SetDCMOffsetCountIndx(), caldp::DCMSummary::SetDCMOffsetSumIndx(), caldp::DCMSummary::SetDCMOffsetSumSquareIndx(), caldp::DCMSummary::SetDCMUseIndx(), caldp::DCMSummary::SetEndTime(), caldp::DCMOffset::SetEndTime(), caldp::DCMOffset::SetOffset(), caldp::DCMOffset::SetSigma(), caldp::DCMSummary::SetStartTime(), caldp::DCMOffset::SetStartTime(), caldp::DCMOffset::SetStats(), sigma(), std::sqrt(), subrunCount, sum, sumDCMOffsetArrayRun, sumSquareDCMOffsetArrayRun, APDHVSetting::temp, weightDCMOffsetArrayRun, submit_syst::x, and submit_syst::y.

Referenced by filter().

321  {
322  //perform timing calibration on a run basis if desired
323  if (!fSaveRunCalibration){
324  countDCMOffsetArrayRun.clear();
326  sumDCMOffsetArrayRun.clear();
327  meanDCMOffsetArrayRun.clear();
328  weightDCMOffsetArrayRun.clear();
329  absoluteDCMOffsetRun.clear();
330  absoluteDCMErrorsRun.clear();
331  countDCMUseRun.clear();
332  return false;
333  }
334 
335  if (subrunCount < fMinSubrun){
336  countDCMOffsetArrayRun.clear();
338  sumDCMOffsetArrayRun.clear();
339  meanDCMOffsetArrayRun.clear();
340  weightDCMOffsetArrayRun.clear();
341  absoluteDCMOffsetRun.clear();
342  absoluteDCMErrorsRun.clear();
343  countDCMUseRun.clear();
344  return false;
345  }
346  //Ptr to dcm timing offsets for the run
347  std::unique_ptr<std::vector<caldp::DCMOffset > >runOffsets(new std::vector<caldp::DCMOffset >);
348 
349  caldp::DCMSummary runsum;
350  runsum.SetStartTime(minTimeRun);
351  runsum.SetEndTime(maxTimeRun);
352 
353  //compute mean and standard deviation for each relative DCM pair in the matrix
354  for(int i=0; i<fNumDCM-1; ++i){
355  int iabs = i + fMinDCM - 1;
356  runsum.SetDCMUseIndx(iabs, countDCMUseRun[i]);
357  for(int j=i+1; j<fNumDCM; ++j){
358  int jabs = j + fMinDCM - 1;
359  float sum = sumDCMOffsetArrayRun[i][j];
361  float sumSqr = sumSquareDCMOffsetArrayRun[i][j];
362  runsum.SetDCMOffsetSumIndx(iabs,jabs,sum);
363  runsum.SetDCMOffsetSumSquareIndx(iabs,jabs,sumSqr);
364  runsum.SetDCMOffsetCountIndx(iabs,jabs,count);
365  if (count >= fMinCount){
366  meanDCMOffsetArrayRun[i][j] = sum/count;
367  float sigma = sqrt((count*sumSqr - sum*sum)/(count*(count-1.0)));
368  weightDCMOffsetArrayRun[i][j] = 1.0/(sigma*sigma);
369  }
370  else {
371  meanDCMOffsetArrayRun[i][j] = 0;
373  }
374  }
375  }
376 
377  const int num= fNumDCM;
378  int refIndxTop = fRefDCMTop - fMinDCM;
379  int refIndxSide = fRefDCMSide - fMinDCM;
380  TMatrixD A;
381  A.ResizeTo(fNumDCM, fNumDCM);
382  double y[num];
383  for (int x=0; x<num; ++x) y[x]=0.;
384 
385  //see docdb-XXXX, solve a system of linear equations that corresponds to minimizing the chhi squared for the absolute offsets. Fill matrix in this step
386  for(int i=0; i<fNumDCM; ++i){
387  double temp[num];
388  for (int x=0; x<num; ++x) temp[x]=0.;
389  for(int j=0; j<fNumDCM; ++j){
390  if (i==j) continue;
391  if (j<i){
392  temp[i] += weightDCMOffsetArrayRun[j][i]*2.0;
393  temp[j] += -weightDCMOffsetArrayRun[j][i]*2.0;
395  }
396  if (j>i){
397  temp[i] += weightDCMOffsetArrayRun[i][j]*2.0;
398  temp[j] += -weightDCMOffsetArrayRun[i][j]*2.0;
400  }
401  }
402 
403  if (i == refIndxTop){
404  for (int j=0; j<fNumDCM; ++j) temp[j] = 0.0;
405  temp[refIndxTop]=1.0;
406  }
407  if (i == refIndxSide){
408  for (int j=0; j<fNumDCM; ++j) temp[j] = 0.0;
409  temp[refIndxSide]=1.0;
410  }
411 
412  y[i]*=-1.0;
413  TVectorD tempvec;
414  tempvec.Use(fNumDCM,temp);
415  TMatrixDRow(A,i) = tempvec;
416  }
417 
418  y[refIndxTop] = fRefOffsetTop;
419  y[refIndxSide] = fRefOffsetSide;
420  TVectorD yvec;
421  yvec.Use(fNumDCM,y);
422 
423  //calculate uncertainties. Errors are highly correlated, this is an over estimate from the diagonal elements
424  for(int i=0; i<fNumDCM; ++i){
425  for(int j=0; j<fNumDCM; ++j){
426  if (i==j) continue;
428  else if (j>i) absoluteDCMErrorsRun[i] += 2.0*weightDCMOffsetArrayRun[i][j];
429  }
431  }
432  absoluteDCMErrorsRun[refIndxTop] = 0.0;
433  absoluteDCMErrorsRun[refIndxSide] = 0.0;
434 
435  //solve for absolute offsets
436  TDecompLU lu(A);
437  bool inv = true;
438  try{
439  lu.Decompose();
440  }
441  catch(...){
442  std::cout<<"WARNING: Could not perform matrix inversion to calculate absolute DCM offsets for run: "<<run.run()<<". The matrix inversion was performed over the range: "<<fMinDCM<<" to "<<fMaxDCM<<". If this run had missing diblocks in this range the matrix inversion will be invalid. If this is not desired please adjust the DCM range in the FCL file."<<std::endl;
443  inv = false;
444  }
445  if (inv) lu.Invert(A);
446  if (inv) yvec *= A;
447 
448  for (int i=0; i<fNumDCM; ++i){
449  if (!inv) break;
450  caldp::DCMOffset dcmOffset;
451  dcmOffset.SetDCM(i+fMinDCM);
452  dcmOffset.SetOffset(yvec[i]);
453  dcmOffset.SetSigma(absoluteDCMErrorsRun[i]);
454  dcmOffset.SetStats(countDCMUseRun[i]);
455  dcmOffset.SetStartTime(minTimeRun);
456  dcmOffset.SetEndTime(maxTimeRun);
457  runOffsets->push_back(dcmOffset);
458  offsetMap[run.run()].push_back(dcmOffset);
459  }
460 
461  countDCMOffsetArrayRun.clear();
463  sumDCMOffsetArrayRun.clear();
464  meanDCMOffsetArrayRun.clear();
465  weightDCMOffsetArrayRun.clear();
466  absoluteDCMOffsetRun.clear();
467  absoluteDCMErrorsRun.clear();
468  countDCMUseRun.clear();
469 
470  std::unique_ptr<caldp::DCMSummary> dsum(new caldp::DCMSummary(runsum));
471  run.put(std::move(dsum));
472 
473  run.put(std::move(runOffsets));
474 
475  return true;
476  }
void SetStartTime(uint32_t aStart)
Definition: DCMSummary.h:40
std::vector< std::vector< float > > weightDCMOffsetArrayRun
T sqrt(T number)
Definition: d0nt_math.hpp:156
int fRefDCMTop
DCM number to use as reference for top chain, default is 6.
void SetDCMUseIndx(int i, int val)
Definition: DCMSummary.h:50
int fMinCount
Minimum number of counts for a DCM pair.
void SetDCMOffsetSumIndx(int i, int j, float val)
Definition: DCMSummary.h:48
int fRefDCMSide
DCM number to use as reference for side chain, default is 7.
void SetStartTime(uint32_t aStart)
Set start time offset is valid for.
Definition: DCMOffset.h:43
std::vector< float > absoluteDCMOffsetRun
void SetOffset(float aOffset)
Set the timing offset (ns)
Definition: DCMOffset.h:37
void SetDCMOffsetSumSquareIndx(int i, int j, float val)
Definition: DCMSummary.h:49
int fMinDCM
Number of lowest DCM in calibration set.
void SetEndTime(uint32_t aEnd)
Set end time offset is valid for.
Definition: DCMOffset.h:45
float fRefOffsetTop
absolute offset, in ns, to fix refence DCM to for top chain, default is 0.0
std::vector< float > absoluteDCMErrorsRun
void SetDCM(int aDCM)
Set DCM.
Definition: DCMOffset.h:35
int fMaxDCM
Number of highest DCM in calibration set.
const double j
Definition: BetheBloch.cxx:29
float fRefOffsetSide
absolute offset, in ns, to fix refence DCM to for side chain, default is 0.0
std::vector< std::vector< int > > countDCMOffsetArrayRun
std::vector< int > countDCMUseRun
double sigma(TH1F *hist, double percentile)
Definition: run.py:1
OStream cout
Definition: OStream.cxx:6
std::vector< std::vector< float > > meanDCMOffsetArrayRun
static const double A
Definition: Units.h:82
void SetStats(int aStats)
Set number of track segments for dcm in analysis, quality measure.
Definition: DCMOffset.h:41
int num
Definition: f2_nu.C:119
std::vector< std::vector< float > > sumDCMOffsetArrayRun
void SetDCMOffsetCountIndx(int i, int j, int val)
Definition: DCMSummary.h:47
std::map< int, std::vector< caldp::DCMOffset > > offsetMap
int fNumDCM
Number of DCMs calibration will be performed on.
std::vector< std::vector< float > > sumSquareDCMOffsetArrayRun
void SetEndTime(uint32_t aEnd)
Set end time offset is valid for.
Definition: DCMSummary.h:42
Double_t sum
Definition: plot.C:31
void SetSigma(float aSigma)
Set uncertaint on offset (ns)
Definition: DCMOffset.h:39
fvar< T > inv(const fvar< T > &x)
Definition: inv.hpp:12
bool calib::DCMTimingOffset::endSubRun ( art::SubRun srun)
virtual

Reimplemented from art::EDFilter.

Definition at line 280 of file DCMTimingOffset_module.cc.

References countDCMOffsetArray, countDCMOffsetArrayRun, countDCMUse, countDCMUseRun, caldp::DCMSummary::DCMOffsetCountIndx(), caldp::DCMSummary::DCMOffsetSumIndx(), caldp::DCMSummary::DCMOffsetSumSquareIndx(), caldp::DCMSummary::DCMUseIndx(), caldp::DCMSummary::EndTime(), fDCMLabel, fMinDCM, fNumDCM, art::DataViewImpl::getByLabel(), calib::j, cet::sqlite::max(), maxTime, maxTimeRun, min(), minTime, minTimeRun, caldp::DCMSummary::StartTime(), subrunCount, sumDCMOffsetArray, sumDCMOffsetArrayRun, sumSquareDCMOffsetArray, and sumSquareDCMOffsetArrayRun.

Referenced by filter().

281  {
282  //get out summary dataproduct
283  //get the cosmic tracks associated with each event
285  srun.getByLabel(fDCMLabel,dcmsum);
286 
287  subrunCount++;
288 
289  //keep running tally of relative dcm timing offsets for the run and overall
290  for (int j=0; j<fNumDCM; ++j){
291  int jabs = j + fMinDCM - 1;
292  countDCMUseRun[j] += dcmsum->DCMUseIndx(jabs);
293  countDCMUse[j] += dcmsum->DCMUseIndx(jabs);
294  for (int k=j+1; k<fNumDCM; ++k){
295  int kabs = k +fMinDCM - 1;
296  sumDCMOffsetArrayRun[j][k]+= dcmsum->DCMOffsetSumIndx(jabs,kabs);
297  sumDCMOffsetArray[j][k]+= dcmsum->DCMOffsetSumIndx(jabs,kabs);
298  sumSquareDCMOffsetArrayRun[j][k] += dcmsum->DCMOffsetSumSquareIndx(jabs,kabs);
299  sumSquareDCMOffsetArray[j][k] += dcmsum->DCMOffsetSumSquareIndx(jabs,kabs);
300  countDCMOffsetArrayRun[j][k] += dcmsum->DCMOffsetCountIndx(jabs,kabs);
301  countDCMOffsetArray[j][k] += dcmsum->DCMOffsetCountIndx(jabs,kabs);
302  }
303  }
304 
305  //adjust validity time
306  uint32_t min = dcmsum->StartTime();
307  uint32_t max = dcmsum->EndTime();
308  if (max>maxTime) maxTime = max;
309  if (min<minTime) minTime = min;
310  if (max>maxTimeRun) maxTimeRun = max;
311  if (min<minTimeRun) minTimeRun = min;
312 
313 
314  return false;
315  }
std::string fDCMLabel
Where to find dcm stats.
int fMinDCM
Number of lowest DCM in calibration set.
std::vector< std::vector< float > > sumDCMOffsetArray
const double j
Definition: BetheBloch.cxx:29
std::vector< std::vector< int > > countDCMOffsetArrayRun
std::vector< int > countDCMUseRun
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
float DCMOffsetSumSquareIndx(int i, int j) const
Definition: DCMSummary.h:37
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
std::vector< std::vector< float > > sumDCMOffsetArrayRun
int DCMOffsetCountIndx(int i, int j) const
Definition: DCMSummary.h:35
float DCMOffsetSumIndx(int i, int j) const
Definition: DCMSummary.h:36
int fNumDCM
Number of DCMs calibration will be performed on.
std::vector< std::vector< float > > sumSquareDCMOffsetArrayRun
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
int DCMUseIndx(int i) const
Definition: DCMSummary.h:38
std::vector< std::vector< float > > sumSquareDCMOffsetArray
uint32_t StartTime() const
return start time offset is valid for
Definition: DCMSummary.h:27
uint32_t EndTime() const
return end time offset is valid for
Definition: DCMSummary.h:29
std::vector< std::vector< int > > countDCMOffsetArray
virtual bool calib::DCMTimingOffset::filter ( art::Event evt)
inlinevirtual

Implements art::EDFilter.

Definition at line 67 of file DCMTimingOffset_module.cc.

References beginJob(), beginRun(), endJob(), endRun(), endSubRun(), r(), and reconfigure().

67 {return false;}
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void calib::DCMTimingOffset::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 146 of file DCMTimingOffset_module.cc.

References fDCMLabel, fInitialized, fMaxDCM, fMinCount, fMinDCM, fMinSubrun, fOverrideRef, fPSetFD, fPSetND, fPSetTB, fSaveRunCalibration, fhicl::ParameterSet::get(), and string.

Referenced by DCMTimingOffset(), and filter().

147  {
148  fDCMLabel = pset.get< std::string >("DCMLabel");
149  fMinSubrun = pset.get< int>("MinSubrun");
150  fSaveRunCalibration = pset.get< bool >("SaveRunCalibration");
151  fOverrideRef = false;
152  fMinDCM = 0;
153  fMaxDCM = 0;
154  fMinCount = 0;
155  fInitialized = false;
156  fPSetND = pset.get<fhicl::ParameterSet>("nd");
157  fPSetFD = pset.get<fhicl::ParameterSet>("fd");
158  fPSetTB = pset.get<fhicl::ParameterSet>("tb");
159 
160  }
std::string fDCMLabel
Where to find dcm stats.
int fMinCount
Minimum number of counts for a DCM pair.
int fMinDCM
Number of lowest DCM in calibration set.
T get(std::string const &key) const
Definition: ParameterSet.h:231
int fMaxDCM
Number of highest DCM in calibration set.
bool fOverrideRef
override default of fixing calibration of dcm 6 with an offset of 0
bool fInitialized
Flag if initialization has happened.
enum BeamMode string
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

std::vector<float> calib::DCMTimingOffset::absoluteDCMErrors
private

Definition at line 105 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endJob().

std::vector<float> calib::DCMTimingOffset::absoluteDCMErrorsRun
private

Definition at line 117 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endRun().

std::vector<float> calib::DCMTimingOffset::absoluteDCMOffset
private

Definition at line 104 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endJob().

std::vector<float> calib::DCMTimingOffset::absoluteDCMOffsetRun
private

Definition at line 116 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endRun().

std::vector<std::vector<int> > calib::DCMTimingOffset::countDCMOffsetArray
private

Definition at line 99 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endSubRun().

std::vector<std::vector<int> > calib::DCMTimingOffset::countDCMOffsetArrayRun
private

Definition at line 111 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::vector<int> calib::DCMTimingOffset::countDCMUse
private

Definition at line 106 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endSubRun().

std::vector<int> calib::DCMTimingOffset::countDCMUseRun
private

Definition at line 118 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

std::string calib::DCMTimingOffset::fDCMLabel
private

Where to find dcm stats.

Definition at line 80 of file DCMTimingOffset_module.cc.

Referenced by endSubRun(), and reconfigure().

bool calib::DCMTimingOffset::fInitialized = false
private

Flag if initialization has happened.

Definition at line 85 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and reconfigure().

bool calib::DCMTimingOffset::fIsMC
private

Definition at line 91 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endJob().

int calib::DCMTimingOffset::fMaxDCM
private

Number of highest DCM in calibration set.

Definition at line 83 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), endRun(), and reconfigure().

int calib::DCMTimingOffset::fMinCount
private

Minimum number of counts for a DCM pair.

Definition at line 84 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), endRun(), and reconfigure().

int calib::DCMTimingOffset::fMinDCM
private

Number of lowest DCM in calibration set.

Definition at line 82 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), endRun(), endSubRun(), and reconfigure().

int calib::DCMTimingOffset::fMinSubrun
private

Definition at line 93 of file DCMTimingOffset_module.cc.

Referenced by endRun(), and reconfigure().

int calib::DCMTimingOffset::fNumDCM
private

Number of DCMs calibration will be performed on.

Definition at line 81 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), endRun(), and endSubRun().

bool calib::DCMTimingOffset::fOverrideRef
private

override default of fixing calibration of dcm 6 with an offset of 0

Definition at line 86 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and reconfigure().

fhicl::ParameterSet calib::DCMTimingOffset::fPSetFD
private

Definition at line 95 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and reconfigure().

fhicl::ParameterSet calib::DCMTimingOffset::fPSetND
private

Definition at line 95 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and reconfigure().

fhicl::ParameterSet calib::DCMTimingOffset::fPSetTB
private

Definition at line 95 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and reconfigure().

int calib::DCMTimingOffset::fRefDCMSide = 7
private

DCM number to use as reference for side chain, default is 7.

Definition at line 88 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endRun().

int calib::DCMTimingOffset::fRefDCMTop = 6
private

DCM number to use as reference for top chain, default is 6.

Definition at line 87 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endRun().

float calib::DCMTimingOffset::fRefOffsetSide = 0.0
private

absolute offset, in ns, to fix refence DCM to for side chain, default is 0.0

Definition at line 90 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endRun().

float calib::DCMTimingOffset::fRefOffsetTop = 0.0
private

absolute offset, in ns, to fix refence DCM to for top chain, default is 0.0

Definition at line 89 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endRun().

bool calib::DCMTimingOffset::fSaveRunCalibration
private

Definition at line 92 of file DCMTimingOffset_module.cc.

Referenced by endJob(), endRun(), and reconfigure().

uint32_t calib::DCMTimingOffset::maxTime
private

Definition at line 108 of file DCMTimingOffset_module.cc.

Referenced by beginJob(), and endSubRun().

uint32_t calib::DCMTimingOffset::maxTimeRun
private

Definition at line 120 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::meanDCMOffsetArray
private

Definition at line 102 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endJob().

std::vector<std::vector<float> > calib::DCMTimingOffset::meanDCMOffsetArrayRun
private

Definition at line 114 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endRun().

uint32_t calib::DCMTimingOffset::minTime
private

Definition at line 107 of file DCMTimingOffset_module.cc.

Referenced by beginJob(), endJob(), and endSubRun().

uint32_t calib::DCMTimingOffset::minTimeRun
private

Definition at line 119 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::map<int, std::vector<caldp::DCMOffset> > calib::DCMTimingOffset::offsetMap
private

Definition at line 124 of file DCMTimingOffset_module.cc.

Referenced by endJob(), and endRun().

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

Referenced by evgen::GENIEFilter::filter().

int calib::DCMTimingOffset::subrunCount
private

Definition at line 122 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::sumDCMOffsetArray
private

Definition at line 101 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::sumDCMOffsetArrayRun
private

Definition at line 113 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::sumSquareDCMOffsetArray
private

Definition at line 100 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endJob(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::sumSquareDCMOffsetArrayRun
private

Definition at line 112 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), endRun(), and endSubRun().

std::vector<std::vector<float> > calib::DCMTimingOffset::weightDCMOffsetArray
private

Definition at line 103 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endJob().

std::vector<std::vector<float> > calib::DCMTimingOffset::weightDCMOffsetArrayRun
private

Definition at line 115 of file DCMTimingOffset_module.cc.

Referenced by beginRun(), and endRun().


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