34 #include "NovaTimingUtilities/TimingUtilities.h" 54 #include "TGraphAsymmErrors.h" 91 std::unique_ptr<BeamFolder>
bfp;
106 static constexpr
double 159 {
bfp->set_epsilon(0.01);
162 produces< sumdata::SpillData >();
163 produces< sumdata::POTSum, art::InSubRun >();
180 fOutTree = tfs->
make<TTree>(
"TimingCalib",
"Timing Calibaration");
202 std::unique_ptr< sumdata::POTSum >
p(
totpots);
203 sr.
put(std::move(p));
244 if(mcTruths.
failedToGet() || mcTruths->empty())
return;
258 if( trigv.failedToGet() )
259 throw cet::exception(
"MIN") <<
"failed to get valid trigger handle";
270 unsigned long int uevt_sec = unixTime.tv_sec;
271 unsigned long int uevt_nsec = unixTime.tv_nsec;
274 double DAQtime = uevt_sec + (0.000000001)*uevt_nsec;
281 double tor860time=0.;
289 bfp->GetNamedData((DAQtime)-
fBNBOffset,
"E:TOR860@,E:TOR875", &tor860, &tor860time, &tor875);
296 spilldata->deltaspilltimensec = diff*1e9;
298 unsigned long int time_closest_int = (
int) tor860time;
299 double time_closest_ns = (tor860time - time_closest_int)*1e9;
301 spilldata->spilltimesec = time_closest_int;
302 spilldata->spilltimensec = time_closest_ns;
308 double temppot = tor860;
310 if(temppot < 0.02) temppot = tor875;
313 if(temppot < 0.0) temppot = 0.0;
315 spilldata->spillpot = temppot;
322 spilldata->gpsspilltimesec = 0.;
323 spilldata->gpsspilltimensec = 0.;
331 ihorn += (thcurr - (+0.01));
333 spilldata->hornI = ihorn;
337 spilldata->isRHC =
false;
339 spilldata->isRHC =
true;
344 double HPTG1, VPTG1, HP875, VP875;
348 bfp->GetNamedData((DAQtime)-
fBNBOffset,
"E:HPTG1,E:VPTG1,E:HP875,E:VP875", &HPTG1, &VPTG1, &HP875, &VP875);
363 spilldata->posx = xp;
364 spilldata->posy = yp;
371 spilldata->goodbeam = 0;
383 spilldata->goodbeam = 1;
388 if(spilldata->goodbeam == 1){
408 else mf::LogInfo(
"MIN") <<
"Spill did not meet MaxDeltaT cut\n";
411 catch (WebAPIException we){
413 mf::LogError(
"MIN") <<
"Exception: " << we.what() <<
"\n";
425 std::size_t missVar = exceptionString.find(
"variable not found");
426 if(missVar != std::string::npos){
427 mf::LogInfo(
"MIN") <<
"***************We have a case of missing data\n"<<
428 "in the beam database! This isn't awesome, but \n"<<
429 "is probably ok and we have decided to not abort. \n"<<
430 "This decision was made on string comparisions and \n"<<
431 "is a bad hack.In the future, we should actually \n"<<
432 "throw different types of exceptions for different \n"<<
433 "types of problems!\n"<<
442 evt.
put(std::move(spilldata));
void endSubRun(art::SubRun &sr)
static constexpr double vp875station
std::unique_ptr< BeamFolder > bfp
static constexpr double z_mwtgt
Float_t y1[n_points_granero]
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
static constexpr double hp875station
static constexpr double z_vp875
Float_t x1[n_points_granero]
std::string pRawDataLabel
static constexpr double PI
simb::Origin_t Origin() const
enum simb::_ev_origin Origin_t
event origin types
void reconfigure(const fhicl::ParameterSet &pset)
::xsd::cxx::tree::exception< char > exception
static constexpr double z_mw876
This module reads IFDB DB and then stores BNB spill info.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
DEFINE_ART_MODULE(TestTMapFile)
static constexpr double hptg1station
bool convertNovaTimeToUnixTime(uint64_t const &inputNovaTime, struct timespec &outputUnixTime)
static constexpr double z_target_le
static constexpr double z_mw875
static constexpr double z_mtgt
static constexpr double z_hptg1
static constexpr double vp875offset
void beginSubRun(art::SubRun &sr)
uint8_t fTriggerMask_TriggerType
static constexpr Double_t foot
ProductID put(std::unique_ptr< PROD > &&product)
void produce(art::Event &evt)
static constexpr double z_hrndn
T get(std::string const &key) const
sumdata::POTSum * totpots
static constexpr double z_vptg1
static constexpr double hptg1offset
MIN(fhicl::ParameterSet const &pset)
static constexpr double vptg1offset
static constexpr double wirespacing
static constexpr Double_t mm
art::ServiceHandle< ifbeam_ns::IFBeam > ifbeam_handle
static constexpr double z_hptg2
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
unsigned long long fTriggerTimingMarker_TimeStart
ProductID put(std::unique_ptr< PROD > &&)
static constexpr double hp875offset
static constexpr double actrn1
static constexpr double z_hp875
static constexpr double tgtstation
static constexpr double vptg1station
static constexpr double z_vptg2
Event generator information.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
double totgoodpot
normalized by 10^12 POT
double totpot
normalized by 10^12 POT