Changeset 11563
- Timestamp:
- 07/24/11 12:34:50 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersFTM.h
r11538 r11563 175 175 kMaxDelayTrigger = 0x3ff, ///< (4ns * x + 8ns) 176 176 kMaxTriggerInterval = 0x3ff, ///< 177 kMaxIntensity = 0x7f, 177 178 kMaxSequence = 0x1f, 178 179 kMaxDAC = 0xfff, … … 206 207 uint16_t fTriggerInterval; /// [ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit 207 208 uint16_t fTriggerSequence; /// Ratio between trigger types send as artificial trigger (in this order) 3x5bit 208 uint8_t fEnableL pExt; /// Enable for LED group 1/2 (LightPulserEnable)209 uint8_t fIntensityL pExt; /// Intensity of LEDs (0-127)210 uint8_t fEnableL pInt; /// Enable for LED group 1/2 (LightPulserEnable)211 uint8_t fIntensityL pInt; /// Intensity of LEDs (0-127)209 uint8_t fEnableLPext; /// Enable for LED group 1/2 (LightPulserEnable) 210 uint8_t fIntensityLPext; /// Intensity of LEDs (0-127) 211 uint8_t fEnableLPint; /// Enable for LED group 1/2 (LightPulserEnable) 212 uint8_t fIntensityLPint; /// Intensity of LEDs (0-127) 212 213 uint32_t fDummy0; 213 214 uint16_t fMultiplicityPhysics; /// Required trigger multiplicity for physcis triggers (0-40) … … 259 260 void EnableAllFTU() { for (int i=0; i<4; i++) fActiveFTU[i] = 0x3ff; } 260 261 void DisableAllFTU() { for (int i=0; i<4; i++) fActiveFTU[i] = 0; } 262 263 void EnableLPint(LightPulserEnable group, bool enable) 264 { 265 if (enable) 266 fEnableLPint |= group; 267 else 268 fEnableLPint &= ~group; 269 } 270 271 void EnableLPext(LightPulserEnable group, bool enable) 272 { 273 if (enable) 274 fEnableLPext |= group; 275 else 276 fEnableLPext &= ~group; 277 } 261 278 262 279 void ToggleFTU(int i) { fActiveFTU[i/10] ^= (1<<(i%10)); } -
trunk/FACT++/src/ftmctrl.cc
r11520 r11563 955 955 } 956 956 957 bool EnableLP(FTM::StaticData::GeneralSettings lp, FTM::StaticData::LightPulserEnable group, bool enable) 958 { 959 if (lp!=FTM::StaticData::kLPint && lp!=FTM::StaticData::kLPext) 960 return false; 961 962 FTM::StaticData data(fStaticData); 963 964 if (lp==FTM::StaticData::kLPint) 965 data.EnableLPint(group, enable); 966 967 if (lp==FTM::StaticData::kLPext) 968 data.EnableLPext(group, enable); 969 970 CmdSendStatDat(data); 971 972 return true; 973 } 974 975 bool SetIntensity(FTM::StaticData::GeneralSettings lp, uint16_t intensity) 976 { 977 if (intensity>FTM::StaticData::kMaxIntensity) 978 return false; 979 980 if (lp!=FTM::StaticData::kLPint && lp!=FTM::StaticData::kLPext) 981 return false; 982 983 FTM::StaticData data(fStaticData); 984 985 if (lp==FTM::StaticData::kLPint) 986 data.fIntensityLPint = intensity; 987 988 if (lp==FTM::StaticData::kLPext) 989 data.fIntensityLPext = intensity; 990 991 CmdSendStatDat(data); 992 993 return true; 994 } 995 957 996 bool EnablePixel(int16_t idx, bool enable) 958 997 { … … 1523 1562 } 1524 1563 1564 int EnableLP(const EventImp &evt, FTM::StaticData::GeneralSettings lp, FTM::StaticData::LightPulserEnable group) 1565 { 1566 if (!CheckEventSize(evt.GetSize(), "EnableLP", 1)) 1567 return T::kSM_FatalError; 1568 1569 if (!fFTM.EnableLP(lp, group, evt.GetBool())) 1570 T::Warn("EnableLP - Invalid light pulser id."); 1571 1572 return T::GetCurrentState(); 1573 } 1574 1575 int SetIntensity(const EventImp &evt, FTM::StaticData::GeneralSettings lp) 1576 { 1577 if (!CheckEventSize(evt.GetSize(), "SetIntensity", 2)) 1578 return T::kSM_FatalError; 1579 1580 if (!fFTM.SetIntensity(lp, evt.GetShort())) 1581 T::Warn("SetIntensity - Value out of range."); 1582 1583 return T::GetCurrentState(); 1584 } 1585 1525 1586 int Enable(const EventImp &evt, FTM::StaticData::GeneralSettings type) 1526 1587 { … … 1914 1975 ("Enable clock conidtioner output in favor of time marker output" 1915 1976 "|Enable[bool]:Enable clock conditioner (yes/no)"); 1977 1978 T::AddEvent("ENABLE_GROUP1_LPINT", "B:1", FTM::kIdle) 1979 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup1)) 1980 (""); 1981 T::AddEvent("ENABLE_GROUP1_LPEXT", "B:1", FTM::kIdle) 1982 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup1)) 1983 (""); 1984 T::AddEvent("ENABLE_GROUP2_LPINT", "B:1", FTM::kIdle) 1985 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPint, FTM::StaticData::kGroup2)) 1986 (""); 1987 T::AddEvent("ENABLE_GROUP2_LPEXT", "B:1", FTM::kIdle) 1988 (bind(&StateMachineFTM::EnableLP, this, placeholders::_1, FTM::StaticData::kLPext, FTM::StaticData::kGroup2)) 1989 (""); 1990 T::AddEvent("SET_INTENSITY_LPINT", "S:1", FTM::kIdle) 1991 (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPint)) 1992 (""); 1993 T::AddEvent("SET_INTENSITY_LPEXT", "S:1", FTM::kIdle) 1994 (bind(&StateMachineFTM::SetIntensity, this, placeholders::_1, FTM::StaticData::kLPext)) 1995 (""); 1996 1916 1997 1917 1998 T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::kIdle) … … 2124 2205 // Trigger sequence ped:lp1:lp2 2125 2206 // (data. is used here as an abbreviation for FTM::StaticData:: 2126 if (!CheckConfigVal<bool> (conf, true, "enable-trigger.", *it) || 2127 !CheckConfigVal<bool> (conf, true, "enable-external-1.", *it) || 2128 !CheckConfigVal<bool> (conf, true, "enable-external-2.", *it) || 2129 !CheckConfigVal<bool> (conf, true, "enable-veto.", *it) || 2130 !CheckConfigVal<bool> (conf, true, "enable-clock-conditioner.", *it) || 2131 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger-sequence-ped.", *it) || 2132 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger-sequence-lp-ext.", *it) || 2133 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger-sequence-lp-int.", *it) || 2134 !CheckConfigVal<uint16_t>(conf, data.kMaxTriggerInterval, "trigger-interval.", *it) || 2135 !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity, "multiplicity-physics.", *it) || 2136 !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity, "multiplicity-calib.", *it) || 2137 !CheckConfigVal<uint16_t>(conf, data.kMaxWindow, "coincidence-window-physics.", *it) || 2138 !CheckConfigVal<uint16_t>(conf, data.kMaxWindow, "coincidence-window-calib.", *it) || 2139 !CheckConfigVal<uint16_t>(conf, data.kMaxDeadTime, "dead-time.", *it) || 2140 !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTrigger, "trigger-delay.", *it) || 2141 !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTimeMarker, "time-marker-delay.", *it) || 2142 !CheckConfigVal<uint16_t>(conf, 0xffff, "ftu-report-interval.", *it) || 2207 if (!CheckConfigVal<bool> (conf, true, "trigger.enable-trigger.", *it) || 2208 !CheckConfigVal<bool> (conf, true, "trigger.enable-external-1.", *it) || 2209 !CheckConfigVal<bool> (conf, true, "trigger.enable-external-2.", *it) || 2210 !CheckConfigVal<bool> (conf, true, "trigger.enable-veto.", *it) || 2211 !CheckConfigVal<bool> (conf, true, "trigger.enable-clock-conditioner.", *it) || 2212 !CheckConfigVal<bool> (conf, true, "light-pulser.external.enable-group1.", *it) || 2213 !CheckConfigVal<bool> (conf, true, "light-pulser.external.enable-group2.", *it) || 2214 !CheckConfigVal<bool> (conf, true, "light-pulser.internal.enable-group1.", *it) || 2215 !CheckConfigVal<bool> (conf, true, "light-pulser.internal.enable-group2.", *it) || 2216 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger.sequence.pedestal.", *it) || 2217 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger.sequence.lp-ext.", *it) || 2218 !CheckConfigVal<uint16_t>(conf, data.kMaxSequence, "trigger.sequence.lp-int.", *it) || 2219 !CheckConfigVal<uint16_t>(conf, data.kMaxTriggerInterval, "trigger.sequence.interval.", *it) || 2220 !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity, "trigger.multiplicity-physics.", *it) || 2221 !CheckConfigVal<uint16_t>(conf, data.kMaxMultiplicity, "trigger.multiplicity-calib.", *it) || 2222 !CheckConfigVal<uint16_t>(conf, data.kMaxWindow, "trigger.coincidence-window-physics.", *it) || 2223 !CheckConfigVal<uint16_t>(conf, data.kMaxWindow, "trigger.coincidence-window-calib.", *it) || 2224 !CheckConfigVal<uint16_t>(conf, data.kMaxDeadTime, "trigger.dead-time.", *it) || 2225 !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTrigger, "trigger.delay.", *it) || 2226 !CheckConfigVal<uint16_t>(conf, data.kMaxDelayTimeMarker, "trigger.time-marker-delay.", *it) || 2227 !CheckConfigVal<uint16_t>(conf, 0xffff, "ftu-report-interval.", *it) || 2228 !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity, "light-pulser.external.intensity.", *it) || 2229 !CheckConfigVal<uint16_t>(conf, data.kMaxIntensity, "light-pulser.internal.intensity.", *it) || 2143 2230 0) 2144 2231 return 2; 2145 2232 2146 data.Enable(data.kTrigger, conf.GetDef<bool>("enable-trigger.", *it)); 2147 data.Enable(data.kExt1, conf.GetDef<bool>("enable-external-1.", *it)); 2148 data.Enable(data.kExt2, conf.GetDef<bool>("enable-external-2.", *it)); 2149 data.Enable(data.kVeto, conf.GetDef<bool>("enable-veto.", *it)); 2150 data.Enable(data.kClockConditioner, conf.GetDef<bool>("enable-clock-conditioner.", *it)); 2233 data.Enable(data.kTrigger, conf.GetDef<bool>("trigger.enable-trigger.", *it)); 2234 data.Enable(data.kExt1, conf.GetDef<bool>("trigger.enable-external-1.", *it)); 2235 data.Enable(data.kExt2, conf.GetDef<bool>("trigger.enable-external-2.", *it)); 2236 data.Enable(data.kVeto, conf.GetDef<bool>("trigger.enable-veto.", *it)); 2237 data.Enable(data.kClockConditioner, conf.GetDef<bool>("trigger.enable-clock-conditioner.", *it)); 2238 2239 data.EnableLPint(data.kGroup1, conf.GetDef<bool>("light-pulser.internal.enable-group1.", *it)); 2240 data.EnableLPint(data.kGroup2, conf.GetDef<bool>("light-pulser.internal.enable-group2.", *it)); 2241 data.EnableLPext(data.kGroup1, conf.GetDef<bool>("light-pulser.external.enable-group1.", *it)); 2242 data.EnableLPext(data.kGroup2, conf.GetDef<bool>("light-pulser.external.enable-group2.", *it)); 2151 2243 2152 2244 // [ms] Interval between two artificial triggers (no matter which type) minimum 1ms, 10 bit 2153 data.fTriggerInterval = conf.GetDef<uint16_t>("trigger-interval.", *it); 2154 data.fMultiplicityPhysics = conf.GetDef<uint16_t>("multiplicity-physics.", *it); 2155 data.fMultiplicityCalib = conf.GetDef<uint16_t>("multiplicity-calib.", *it); 2156 data.fWindowPhysics = conf.GetDef<uint16_t>("coincidence-window-physics.", *it); /// (4ns * x + 8ns) 2157 data.fWindowCalib = conf.GetDef<uint16_t>("coincidence-window-calib.", *it); /// (4ns * x + 8ns) 2158 data.fDelayTrigger = conf.GetDef<uint16_t>("trigger-delay.", *it); /// (4ns * x + 8ns) 2159 data.fDelayTimeMarker = conf.GetDef<uint16_t>("time-marker-delay.", *it); /// (4ns * x + 8ns) 2160 data.fDeadTime = conf.GetDef<uint16_t>("dead-time.", *it); /// (4ns * x + 8ns) 2245 data.fIntensityLPint = conf.GetDef<uint16_t>("light-pulser.internal.intensity.", *it); 2246 data.fIntensityLPext = conf.GetDef<uint16_t>("light-pulser.external.intensity.", *it); 2247 data.fTriggerInterval = conf.GetDef<uint16_t>("trigger.sequence.interval.", *it); 2248 data.fMultiplicityPhysics = conf.GetDef<uint16_t>("trigger.multiplicity-physics.", *it); 2249 data.fMultiplicityCalib = conf.GetDef<uint16_t>("trigger.multiplicity-calib.", *it); 2250 data.fWindowPhysics = conf.GetDef<uint16_t>("trigger.coincidence-window-physics.", *it); /// (4ns * x + 8ns) 2251 data.fWindowCalib = conf.GetDef<uint16_t>("trigger.coincidence-window-calib.", *it); /// (4ns * x + 8ns) 2252 data.fDelayTrigger = conf.GetDef<uint16_t>("trigger.delay.", *it); /// (4ns * x + 8ns) 2253 data.fDelayTimeMarker = conf.GetDef<uint16_t>("trigger.time-marker-delay.", *it); /// (4ns * x + 8ns) 2254 data.fDeadTime = conf.GetDef<uint16_t>("trigger.dead-time.", *it); /// (4ns * x + 8ns) 2161 2255 2162 2256 data.SetPrescaling(conf.GetDef<uint16_t>("ftu-report-interval.", *it)); 2163 2257 2164 const uint16_t seqped = conf.GetDef<uint16_t>("trigger -sequence-ped.",*it);2165 const uint16_t seqint = conf.GetDef<uint16_t>("trigger -sequence-lp-int.", *it);2166 const uint16_t seqext = conf.GetDef<uint16_t>("trigger -sequence-lp-ext.", *it);2258 const uint16_t seqped = conf.GetDef<uint16_t>("trigger.sequence.pedestal.", *it); 2259 const uint16_t seqint = conf.GetDef<uint16_t>("trigger.sequence.lp-int.", *it); 2260 const uint16_t seqext = conf.GetDef<uint16_t>("trigger.sequence.lp-ext.", *it); 2167 2261 2168 2262 data.SetSequence(seqped, seqint, seqext); … … 2171 2265 data.EnableAllPixel(); 2172 2266 2173 const vector<uint16_t> pat1 = conf.Vec<uint16_t>(" disable-patch.default");2174 const vector<uint16_t> pat2 = conf.Vec<uint16_t>(" disable-patch."+*it);2175 2176 const vector<uint16_t> pix1 = conf.Vec<uint16_t>(" disable-pixel.default");2177 const vector<uint16_t> pix2 = conf.Vec<uint16_t>(" disable-pixel."+*it);2267 const vector<uint16_t> pat1 = conf.Vec<uint16_t>("trigger.disable-patch.default"); 2268 const vector<uint16_t> pat2 = conf.Vec<uint16_t>("trigger.disable-patch."+*it); 2269 2270 const vector<uint16_t> pix1 = conf.Vec<uint16_t>("trigger.disable-pixel.default"); 2271 const vector<uint16_t> pix2 = conf.Vec<uint16_t>("trigger.disable-pixel."+*it); 2178 2272 2179 2273 vector<uint16_t> pat, pix; … … 2188 2282 { 2189 2283 ostringstream str; 2190 str << " disable-patch.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPatchIdx << "!";2284 str << "trigger.disable-patch.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPatchIdx << "!"; 2191 2285 T::Error(str); 2192 2286 return 2; … … 2199 2293 { 2200 2294 ostringstream str; 2201 str << " disable-pixel.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPixelIdx << "!";2295 str << "trigger.disable-pixel.*=" << *ip << " exceeds allowed maximum of " << FTM::StaticData::kMaxPixelIdx << "!"; 2202 2296 T::Error(str); 2203 2297 return 2; … … 2360 2454 ("run-type", vars<string>(), "") 2361 2455 ("sampling-frequency.*", var<uint16_t>(), "") 2362 ("enable-trigger.*", var<bool>(), "") 2363 ("enable-external-1.*", var<bool>(), "") 2364 ("enable-external-2.*", var<bool>(), "") 2365 ("enable-veto.*", var<bool>(), "") 2366 ("enable-clock-conditioner.*", var<bool>(), "") 2367 ("trigger-interval.*", var<uint16_t>(), "") 2368 ("trigger-sequence-ped.*", var<uint16_t>(), "") 2369 ("trigger-sequence-lp-int.*", var<uint16_t>(), "") 2370 ("trigger-sequence-lp-ext.*", var<uint16_t>(), "") 2371 ("multiplicity-physics.*", var<uint16_t>(), "") 2372 ("multiplicity-calib.*", var<uint16_t>(), "") 2373 ("coincidence-window-physics.*", var<uint16_t>(), "") 2374 ("coincidence-window-calib.*", var<uint16_t>(), "") 2375 ("dead-time.*", var<uint16_t>(), "") 2376 ("trigger-delay.*", var<uint16_t>(), "") 2377 ("time-marker-delay.*", var<uint16_t>(), "") 2378 ("diable-pixel.*", vars<uint16_t>(), "") 2379 ("diable-patch.*", vars<uint16_t>(), "") 2380 ("ftu-report-interval.*", var<uint16_t>(), "") 2456 ("trigger.enable-trigger.*", var<bool>(), "") 2457 ("trigger.enable-external-1.*", var<bool>(), "") 2458 ("trigger.enable-external-2.*", var<bool>(), "") 2459 ("trigger.enable-veto.*", var<bool>(), "") 2460 ("trigger.enable-clock-conditioner.*", var<bool>(), "") 2461 ("trigger.sequence.interval.*", var<uint16_t>(), "") 2462 ("trigger.sequence.pedestal.*", var<uint16_t>(), "") 2463 ("trigger.sequence.lp-int.*", var<uint16_t>(), "") 2464 ("trigger.sequence.lp-ext.*", var<uint16_t>(), "") 2465 ("trigger.multiplicity-physics.*", var<uint16_t>(), "") 2466 ("trigger.multiplicity-calib.*", var<uint16_t>(), "") 2467 ("trigger.coincidence-window-physics.*", var<uint16_t>(), "") 2468 ("trigger.coincidence-window-calib.*", var<uint16_t>(), "") 2469 ("trigger.dead-time.*", var<uint16_t>(), "") 2470 ("trigger.delay.*", var<uint16_t>(), "") 2471 ("trigger.time-marker-delay.*", var<uint16_t>(), "") 2472 ("trigger.disable-pixel.*", vars<uint16_t>(), "") 2473 ("trigger.disable-patch.*", vars<uint16_t>(), "") 2474 ("ftu-report-interval.*", var<uint16_t>(), "") 2475 ("light-pulser.external.enable-group1.*", var<bool>(), "") 2476 ("light-pulser.external.enable-group2.*", var<bool>(), "") 2477 ("light-pulser.internal.enable-group1.*", var<bool>(), "") 2478 ("light-pulser.internal.enable-group2.*", var<bool>(), "") 2479 ("light-pulser.external.intensity.*", var<uint16_t>(), "") 2480 ("light-pulser.internal.intensity.*", var<uint16_t>(), "") 2381 2481 ; 2382 2482
Note:
See TracChangeset
for help on using the changeset viewer.