FACT++  1.0
int StateMachineSmartFACT::HandleFtmStaticData ( const EventImp d)
inlineprivate

Definition at line 1609 of file smartfact.cc.

References FTM::DimStaticData::fDeadTime, FTM::DimStaticData::fDelayTimeMarker, FTM::DimStaticData::fDelayTrigger, FTM::DimStaticData::fMultiplicity, FTM::DimStaticData::fMultiplicityCalib, FTM::DimStaticData::fMultiplicityPhysics, FTM::DimStaticData::fPrescaling, FTM::DimStaticData::fThreshold, FTM::DimStaticData::fTriggerInterval, FTM::DimStaticData::fTriggerSeqLPext, FTM::DimStaticData::fTriggerSeqLPint, FTM::DimStaticData::fTriggerSeqPed, FTM::DimStaticData::fWindowCalib, FTM::DimStaticData::fWindowPhysics, EventImp::GetJavaDate(), EventImp::GetQoS(), FTM::DimStaticData::HasClockConditioner(), FTM::DimStaticData::HasExt1(), FTM::DimStaticData::HasExt2(), FTM::DimStaticData::HasLPext(), FTM::DimStaticData::HasLPint(), FTM::DimStaticData::HasPedestal(), FTM::DimStaticData::HasTrigger(), FTM::DimStaticData::HasVeto(), i, if(), HTML::kWhite, HTML::kYellow, StateMachineSmartFACT::Statistics::max, StateMachineSmartFACT::Statistics::med, StateMachineSmartFACT::Statistics::min, and EventImp::Ref().

Referenced by StateMachineSmartFACT().

1610  {
1611  if (!CheckDataSize(d, "FtmControl:StaticData", sizeof(FTM::DimStaticData)))
1612  return GetCurrentState();
1613 
1614  // If the FTM is in state Configuring, the clock conditioner
1615  // is always reported to be unlocked
1616  fFtmControlState = d.GetQoS();
1617 
1618  const FTM::DimStaticData &dat = d.Ref<FTM::DimStaticData>();
1619 
1620  vector<uint16_t> vecp(dat.fThreshold, dat.fThreshold+160);
1621  vector<uint16_t> vecb(dat.fMultiplicity, dat.fMultiplicity+40);
1622 
1623  WriteCam(d, "cam-ftmcontrol-thresholds-patch", vecp, 1000);
1624  WriteCam(d, "cam-ftmcontrol-thresholds-board", vecb, 100);
1625 
1626  const Statistics statp(vecp);
1627  const Statistics statb(vecb);
1628 
1629  fFtmPatchThresholdMed = statp.med;
1630  fFtmBoardThresholdMed = statb.med;
1631 
1632  ostringstream out;
1633  out << d.GetJavaDate() << '\n';
1634  out << HTML::kWhite << '\t' << statb.min << '\n';
1635  out << HTML::kWhite << '\t' << statb.med << '\n';
1636  out << HTML::kWhite << '\t' << statb.max << '\n';
1637  ofstream(fPath+"/thresholds-board.data") << out.str();
1638 
1639  out.str("");
1640  out << d.GetJavaDate() << '\n';
1641  out << HTML::kWhite << '\t' << statp.min << '\n';
1642  out << HTML::kWhite << '\t' << statp.med << '\n';
1643  out << HTML::kWhite << '\t' << statp.max << '\n';
1644  ofstream(fPath+"/thresholds-patch.data") << out.str();
1645 
1646  out.str("");
1647  out << d.GetJavaDate() << '\n';
1648  out << HTML::kWhite << '\t' << statb.med << '\n';
1649  out << HTML::kWhite << '\t' << statp.med << '\n';
1650  ofstream(fPath+"/thresholds.data") << out.str();
1651 
1652  out.str("");
1653  out << d.GetJavaDate() << '\n';
1654  out << HTML::kWhite << '\t' << dat.fTriggerInterval << '\n';
1655  out << HTML::kWhite << '\t';
1656  if (dat.HasPedestal())
1657  out << dat.fTriggerSeqPed;
1658  else
1659  out << "&ndash;";
1660  out << ':';
1661  if (dat.HasLPext())
1662  out << dat.fTriggerSeqLPext;
1663  else
1664  out << "&ndash;";
1665  out << ':';
1666  if (dat.HasLPint())
1667  out << dat.fTriggerSeqLPint;
1668  else
1669  out << "&ndash;";
1670  out << '\n';
1671 
1672  out << HTML::kWhite << '\t' << (dat.HasTrigger()?"on":"off") << " / " << (dat.HasExt1()?"on":"off") << " / " << (dat.HasExt2()?"on":"off") << '\n';
1673  out << HTML::kWhite << '\t' << (dat.HasVeto()?"on":"off") << " / " << (dat.HasClockConditioner()?"time cal":"marker") << '\n';
1674  out << HTML::kWhite << '\t' << dat.fMultiplicityPhysics << " / " << dat.fMultiplicityCalib << '\n';
1675  out << HTML::kWhite << '\t' << dat.fWindowPhysics << '\t' << dat.fWindowCalib << '\n';
1676  out << HTML::kWhite << '\t' << dat.fDelayTrigger << '\t' << dat.fDelayTimeMarker << '\n';
1677  out << HTML::kWhite << '\t' << dat.fDeadTime << '\n';
1678 
1679  int64_t vp = dat.fPrescaling[0];
1680  for (int i=1; i<40; i++)
1681  if (vp!=dat.fPrescaling[i])
1682  vp = -1;
1683 
1684  if (vp<0)
1685  out << HTML::kYellow << "\tdifferent\n";
1686  else
1687  out << HTML::kWhite << '\t' << 0.5*vp << "\n";
1688 
1689  ofstream(fPath+"/ftm.data") << out.str();
1690 
1691  // Active FTUs: IsActive(i)
1692  // Enabled Pix: IsEnabled(i)
1693 
1694  return GetCurrentState();
1695  }
bool HasTrigger() const
Definition: HeadersFTM.h:415
uint16_t fTriggerSeqPed
Definition: HeadersFTM.h:390
int GetCurrentState() const
return the current state of the machine
static const string kYellow
Definition: smartfact.cc:75
bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false)
Definition: smartfact.cc:669
int i
Definition: db_dim_client.c:21
bool HasPedestal() const
Definition: HeadersFTM.h:416
uint16_t fMultiplicityPhysics
Intensity of LEDs (0-127)
Definition: HeadersFTM.h:397
uint16_t fWindowPhysics
Definition: HeadersFTM.h:400
uint32_t fDeadTime
Definition: HeadersFTM.h:405
uint16_t fDelayTimeMarker
Definition: HeadersFTM.h:404
uint16_t fPrescaling[40]
Definition: HeadersFTM.h:412
uint16_t fMultiplicity[40]
Definition: HeadersFTM.h:411
static const string kWhite
Definition: smartfact.cc:74
bool HasExt1() const
Definition: HeadersFTM.h:420
virtual int GetQoS() const
Definition: EventImp.h:58
uint16_t fWindowCalib
Definition: HeadersFTM.h:401
uint64_t GetJavaDate() const
Definition: EventImp.cc:303
uint16_t fTriggerInterval
Definition: HeadersFTM.h:386
uint16_t fMultiplicityCalib
Definition: HeadersFTM.h:398
bool HasClockConditioner() const
Definition: HeadersFTM.h:422
uint16_t fTriggerSeqLPint
Definition: HeadersFTM.h:388
bool HasLPext() const
Definition: HeadersFTM.h:417
uint16_t fDelayTrigger
Definition: HeadersFTM.h:403
uint16_t fThreshold[160]
Definition: HeadersFTM.h:410
uint16_t fTriggerSeqLPext
Definition: HeadersFTM.h:389
bool HasVeto() const
Definition: HeadersFTM.h:421
if(extraDns) new Dns
const T & Ref(size_t offset=0) const
Definition: EventImp.h:82
void WriteCam(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
Definition: smartfact.cc:758
bool HasLPint() const
Definition: HeadersFTM.h:418
bool HasExt2() const
Definition: HeadersFTM.h:419

+ Here is the call graph for this function:

+ Here is the caller graph for this function: