Commit 2f26d5eb authored by Fabio Ravera's avatar Fabio Ravera
Browse files

Merge branch 'chipContainer' into 'Dev'

Added clang format to Ph2_ACF

See merge request cms_tk_ph2/Ph2_ACF!147
parents 8788a3ff f5b30ff8
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
# AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
# AllowAllArgumentsOnNextLine: false
# AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
# AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
# AfterCaseLabel: true
AfterClass: true
# AfterControlStatement: true
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
ColumnLimit: 200
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
# SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
# StatementMacros:
# - Q_UNUSED
# - QT_REQUIRE_VERSION
TabWidth: 4
UseTab: Never
...
......@@ -3,7 +3,7 @@
Amc13Controller::Amc13Controller()
{
fAmc13Interface = nullptr;
fAmc13 = nullptr;
fAmc13 = nullptr;
}
Amc13Controller::~Amc13Controller()
......@@ -12,34 +12,36 @@ Amc13Controller::~Amc13Controller()
delete fAmc13Interface;
}
void Amc13Controller::InitializeAmc13 ( const std::string& pFilename, std::ostream& os )
void Amc13Controller::InitializeAmc13(const std::string& pFilename, std::ostream& os)
{
if ( pFilename.find ( ".xml" ) != std::string::npos )
parseAmc13xml (pFilename, os);
else LOG (ERROR) << "Could not parse settings file " << pFilename << " - it is not .xml!";
if(pFilename.find(".xml") != std::string::npos)
parseAmc13xml(pFilename, os);
else
LOG(ERROR) << "Could not parse settings file " << pFilename << " - it is not .xml!";
}
void Amc13Controller::ConfigureAmc13 ( std::ostream& os )
void Amc13Controller::ConfigureAmc13(std::ostream& os)
{
os << BOLDGREEN << "Configuring Amc13!" << RESET << std::endl;
// no need to pass the Amc13 memory description as there is only 1, I just keep it for reference and update accordingly!
// no need to pass the Amc13 memory description as there is only 1, I just keep it for reference and update
// accordingly!
fAmc13Interface->ConfigureAmc13();
}
void Amc13Controller::HaltAmc13 ( std::ostream& os )
void Amc13Controller::HaltAmc13(std::ostream& os)
{
os << BOLDGREEN << "Halting Amc13!" << RESET << std::endl;
fAmc13Interface->HaltAMC13();
}
void Amc13Controller::parseAmc13xml (const std::string& pFilename, std::ostream& os)
void Amc13Controller::parseAmc13xml(const std::string& pFilename, std::ostream& os)
{
pugi::xml_document doc;
int i, j;
int i, j;
pugi::xml_parse_result result = doc.load_file ( pFilename.c_str() );
pugi::xml_parse_result result = doc.load_file(pFilename.c_str());
if ( !result )
if(!result)
{
os << "ERROR :\n Unable to open the file : " << pFilename << std::endl;
os << "Error description : " << result.description() << std::endl;
......@@ -48,28 +50,25 @@ void Amc13Controller::parseAmc13xml (const std::string& pFilename, std::ostream&
os << "\n";
for ( i = 0; i < 80; i++ )
os << "*";
for(i = 0; i < 80; i++) os << "*";
os << "\n";
for ( j = 0; j < 40; j++ )
os << " ";
for(j = 0; j < 40; j++) os << " ";
os << BOLDRED << "AMC13 Settings " << RESET << std::endl;
for ( i = 0; i < 80; i++ )
os << "*";
for(i = 0; i < 80; i++) os << "*";
os << "\n";
// no clue why I have to loop but that's what it is!
for ( pugi::xml_node cAmc13node = doc.child ( "HwDescription" ).child ( "AMC13" ); cAmc13node; cAmc13node = cAmc13node.next_sibling ("AMC13") )
for(pugi::xml_node cAmc13node = doc.child("HwDescription").child("AMC13"); cAmc13node; cAmc13node = cAmc13node.next_sibling("AMC13"))
{
os << BOLDCYAN << cAmc13node.name() << RESET << std::endl;
// now create a new AMC13 Description Object
if ( fAmc13 != nullptr ) delete fAmc13;
if(fAmc13 != nullptr) delete fAmc13;
fAmc13 = new Amc13Description();
......@@ -77,80 +76,90 @@ void Amc13Controller::parseAmc13xml (const std::string& pFilename, std::ostream&
std::string cAddressT1, cAddressT2;
// finally find the connection nodes and construct the proper Amc13FWInterface
for ( pugi::xml_node Amc13Connection = cAmc13node.child ( "connection" ); Amc13Connection; Amc13Connection = Amc13Connection.next_sibling ("connection") )
for(pugi::xml_node Amc13Connection = cAmc13node.child("connection"); Amc13Connection; Amc13Connection = Amc13Connection.next_sibling("connection"))
{
if ( std::string (Amc13Connection.attribute ( "id" ).value() ) == "T1")
if(std::string(Amc13Connection.attribute("id").value()) == "T1")
{
cUri1 = std::string (Amc13Connection.attribute ( "uri" ).value() );
cAddressT1 = std::string (Amc13Connection.attribute ( "address_table" ).value() );
cUri1 = std::string(Amc13Connection.attribute("uri").value());
cAddressT1 = std::string(Amc13Connection.attribute("address_table").value());
}
else if ( std::string (Amc13Connection.attribute ( "id" ).value() ) == "T2" )
else if(std::string(Amc13Connection.attribute("id").value()) == "T2")
{
cUri2 = std::string (Amc13Connection.attribute ( "uri" ).value() );
cAddressT2 = std::string (Amc13Connection.attribute ( "address_table" ).value() );
cUri2 = std::string(Amc13Connection.attribute("uri").value());
cAddressT2 = std::string(Amc13Connection.attribute("address_table").value());
}
os << BOLDBLUE << "|" << "----" << "Board Id: " << BOLDYELLOW << Amc13Connection.attribute ("id").value() << BOLDBLUE << " URI: " << BOLDYELLOW << Amc13Connection.attribute ("uri").value() << BOLDBLUE << " Address Table: " << BOLDYELLOW << Amc13Connection.attribute ("address_table").value() << RESET << std::endl;
os << BOLDBLUE << "|"
<< "----"
<< "Board Id: " << BOLDYELLOW << Amc13Connection.attribute("id").value() << BOLDBLUE << " URI: " << BOLDYELLOW << Amc13Connection.attribute("uri").value() << BOLDBLUE
<< " Address Table: " << BOLDYELLOW << Amc13Connection.attribute("address_table").value() << RESET << std::endl;
}
// here loop over the Register nodes and add them to the AMC13Description object!
for ( pugi::xml_node Amc13RegNode = cAmc13node.child ( "Register" ); Amc13RegNode; Amc13RegNode = Amc13RegNode.next_sibling ("Register") )
for(pugi::xml_node Amc13RegNode = cAmc13node.child("Register"); Amc13RegNode; Amc13RegNode = Amc13RegNode.next_sibling("Register"))
{
std::string regname = std::string (Amc13RegNode.attribute ( "name" ).value() );
std::string regname = std::string(Amc13RegNode.attribute("name").value());
os << BOLDCYAN << "|" << "----" << Amc13RegNode.name() << " " << Amc13RegNode.attribute ( "tounge" ).name() << " : " << Amc13RegNode.attribute ( "tounge" ).value() << " - name: " << regname << " " << BOLDRED << convertAnyInt (Amc13RegNode.first_child().value() ) << RESET << std:: endl;
os << BOLDCYAN << "|"
<< "----" << Amc13RegNode.name() << " " << Amc13RegNode.attribute("tounge").name() << " : " << Amc13RegNode.attribute("tounge").value() << " - name: " << regname << " " << BOLDRED
<< convertAnyInt(Amc13RegNode.first_child().value()) << RESET << std::endl;
if ( std::string (Amc13RegNode.attribute ("tounge").value() ) == "T1" )
fAmc13->setReg (1 , regname, convertAnyInt ( Amc13RegNode.first_child().value() ) );
else if ( std::string (Amc13RegNode.attribute ("tounge").value() ) == "T2" )
fAmc13->setReg (2 , regname, convertAnyInt ( Amc13RegNode.first_child().value() ) );
if(std::string(Amc13RegNode.attribute("tounge").value()) == "T1")
fAmc13->setReg(1, regname, convertAnyInt(Amc13RegNode.first_child().value()));
else if(std::string(Amc13RegNode.attribute("tounge").value()) == "T2")
fAmc13->setReg(2, regname, convertAnyInt(Amc13RegNode.first_child().value()));
}
// now get all the properties and add to the Amc13Description object
fAmc13->setAMCMask ( parseAMCMask ( cAmc13node.child ( "AMCmask" ), os ) );
fAmc13->setTrigger ( parseTrigger ( cAmc13node.child ( "Trigger" ), os ) );
fAmc13->setAMCMask(parseAMCMask(cAmc13node.child("AMCmask"), os));
fAmc13->setTrigger(parseTrigger(cAmc13node.child("Trigger"), os));
for (pugi::xml_node cBGOnode = cAmc13node.child ( "BGO" ); cBGOnode; cBGOnode = cBGOnode.next_sibling ("BGO") )
fAmc13->addBGO ( parseBGO ( cBGOnode, os ) );
for(pugi::xml_node cBGOnode = cAmc13node.child("BGO"); cBGOnode; cBGOnode = cBGOnode.next_sibling("BGO")) fAmc13->addBGO(parseBGO(cBGOnode, os));
//now just parse the TTC Simulator Node!
for (pugi::xml_node cBGOnode = cAmc13node.child ( "TTCSimulator" ); cBGOnode; cBGOnode = cBGOnode.next_sibling ("TTCSimulator") )
// now just parse the TTC Simulator Node!
for(pugi::xml_node cBGOnode = cAmc13node.child("TTCSimulator"); cBGOnode; cBGOnode = cBGOnode.next_sibling("TTCSimulator"))
{
int cTTCSimulator = convertAnyInt (cBGOnode.first_child().value() );
int cTTCSimulator = convertAnyInt(cBGOnode.first_child().value());
bool cTTCSim;
if (cTTCSimulator == 0 ) cTTCSim = false;
else cTTCSim = true;
if(cTTCSimulator == 0)
cTTCSim = false;
else
cTTCSim = true;
fAmc13->setTTCSimulator (cTTCSim);
os << BOLDCYAN << "|" << "----" << cBGOnode.name() << " " << cTTCSimulator << RESET << std::endl;
fAmc13->setTTCSimulator(cTTCSim);
os << BOLDCYAN << "|"
<< "----" << cBGOnode.name() << " " << cTTCSimulator << RESET << std::endl;
// now instantiate the AMC13Interface & provide it with the correct HWDescription object so I don't need to pass it around all the time!
if ( fAmc13Interface != nullptr ) delete fAmc13Interface;
// now instantiate the AMC13Interface & provide it with the correct HWDescription object so I don't need to
// pass it around all the time!
if(fAmc13Interface != nullptr) delete fAmc13Interface;
fAmc13Interface = new Amc13Interface (cUri1, cAddressT1, cUri2, cAddressT2);
fAmc13Interface->setAmc13Description (fAmc13);
fAmc13Interface = new Amc13Interface(cUri1, cAddressT1, cUri2, cAddressT2);
fAmc13Interface->setAmc13Description(fAmc13);
}
}
}
std::vector<int> Amc13Controller::parseAMCMask (pugi::xml_node pNode, std::ostream& os)
std::vector<int> Amc13Controller::parseAMCMask(pugi::xml_node pNode, std::ostream& os)
{
std::vector<int> cVec;
if (std::string (pNode.name() ) == "AMCmask")
if(std::string(pNode.name()) == "AMCmask")
{
//for ( pugi::xml_node cNode = pNode.child( "AMCmask" ); cNode; cNode = cNode.next_sibling("AMCmask") )
// for ( pugi::xml_node cNode = pNode.child( "AMCmask" ); cNode; cNode = cNode.next_sibling("AMCmask") )
//{
std::string cList = std::string (pNode.attribute ("enable").value() );
std::string ctoken;
std::stringstream cStr (cList);
std::string cList = std::string(pNode.attribute("enable").value());
std::string ctoken;
std::stringstream cStr(cList);
os << BOLDCYAN << "|" << "----" << "List of Enabled AMCs: ";
os << BOLDCYAN << "|"
<< "----"
<< "List of Enabled AMCs: ";
while (std::getline (cStr, ctoken, ',') )
while(std::getline(cStr, ctoken, ','))
{
cVec.push_back (convertAnyInt ( ctoken.c_str() ) );
cVec.push_back(convertAnyInt(ctoken.c_str()));
os << GREEN << ctoken << BOLDCYAN << ", ";
}
......@@ -160,28 +169,38 @@ std::vector<int> Amc13Controller::parseAMCMask (pugi::xml_node pNode, std::ostr
return cVec;
}
BGO* Amc13Controller::parseBGO (pugi::xml_node pNode, std::ostream& os)
BGO* Amc13Controller::parseBGO(pugi::xml_node pNode, std::ostream& os)
{
BGO* cBGO = nullptr;
if ( std::string (pNode.name() ) == "BGO")
if(std::string(pNode.name()) == "BGO")
{
cBGO = new BGO ( convertAnyInt (pNode.attribute ( "command" ).value() ), bool (convertAnyInt (pNode.attribute ( "repeat" ).value() ) ), convertAnyInt (pNode.attribute ( "prescale" ).value() ), convertAnyInt (pNode.attribute ( "bx" ).value() ) );
os << BOLDCYAN << "|" << "----" << "BGO : command " << cBGO->fCommand << " repeat " << cBGO->fRepeat << " Prescale " << cBGO->fPrescale << " start BX " << cBGO->fBX << RESET << std::endl;
cBGO = new BGO(convertAnyInt(pNode.attribute("command").value()),
bool(convertAnyInt(pNode.attribute("repeat").value())),
convertAnyInt(pNode.attribute("prescale").value()),
convertAnyInt(pNode.attribute("bx").value()));
os << BOLDCYAN << "|"
<< "----"
<< "BGO : command " << cBGO->fCommand << " repeat " << cBGO->fRepeat << " Prescale " << cBGO->fPrescale << " start BX " << cBGO->fBX << RESET << std::endl;
}
return cBGO;
}
Trigger* Amc13Controller::parseTrigger ( pugi::xml_node pNode, std::ostream& os )
Trigger* Amc13Controller::parseTrigger(pugi::xml_node pNode, std::ostream& os)
{
Trigger* cTrg = nullptr;
if ( std::string (pNode.name() ) == "Trigger" )
if(std::string(pNode.name()) == "Trigger")
{
cTrg = new Trigger (bool (pNode.attribute ("local").value() ), convertAnyInt (pNode.attribute ( "mode" ).value() ), convertAnyInt ( pNode.attribute ( "rate" ).value() ), convertAnyInt ( pNode.attribute ( "burst" ).value() ), convertAnyInt ( pNode.attribute ( "rules" ).value() ) );
os << BOLDGREEN << "|" << "----" << "Trigger Config : Local " << cTrg->fLocal << " Mode " << cTrg->fMode << " Rate " << cTrg->fRate << " Burst " << cTrg->fBurst << " Rules " << cTrg->fRules << RESET << std::endl;
cTrg = new Trigger(bool(pNode.attribute("local").value()),
convertAnyInt(pNode.attribute("mode").value()),
convertAnyInt(pNode.attribute("rate").value()),
convertAnyInt(pNode.attribute("burst").value()),
convertAnyInt(pNode.attribute("rules").value()));
os << BOLDGREEN << "|"
<< "----"
<< "Trigger Config : Local " << cTrg->fLocal << " Mode " << cTrg->fMode << " Rate " << cTrg->fRate << " Burst " << cTrg->fBurst << " Rules " << cTrg->fRules << RESET << std::endl;
}
return cTrg;
......
#ifndef _AMC13_CONTROLLER_H__
#define _AMC13_CONTROLLER_H__
#include "pugixml/pugixml.hpp"
#include "../Utils/ConsoleColor.h"
#include "Amc13Interface.h"
#include "Amc13Description.h"
#include "Amc13Interface.h"
#include "pugixml/pugixml.hpp"
#include <iostream>
#include <map>
#include <string>
......@@ -15,29 +15,30 @@ class Amc13Controller
Amc13Controller();
~Amc13Controller();
void InitializeAmc13 ( const std::string& pFilename, std::ostream& os );
void ConfigureAmc13 ( std::ostream& os );
void HaltAmc13 ( std::ostream& os );
public:
void InitializeAmc13(const std::string& pFilename, std::ostream& os);
void ConfigureAmc13(std::ostream& os);
void HaltAmc13(std::ostream& os);
Amc13Interface* fAmc13Interface;
public:
Amc13Interface* fAmc13Interface;
Amc13Description* fAmc13;
private:
// Private methods for parsing!
void parseAmc13xml (const std::string& pFilename, std::ostream& os);
void parseAmc13xml(const std::string& pFilename, std::ostream& os);
// low level helpers to parse specific xml TAGS
std::vector<int> parseAMCMask (pugi::xml_node pNode, std::ostream& os);
BGO* parseBGO (pugi::xml_node pNode, std::ostream& os);
Trigger* parseTrigger ( pugi::xml_node pNode, std::ostream& os);
std::vector<int> parseAMCMask(pugi::xml_node pNode, std::ostream& os);
BGO* parseBGO(pugi::xml_node pNode, std::ostream& os);
Trigger* parseTrigger(pugi::xml_node pNode, std::ostream& os);
// a little helper to deal with strings
uint32_t convertAnyInt ( const char* pRegValue )
uint32_t convertAnyInt(const char* pRegValue)
{
if ( std::string ( pRegValue ).find ( "0x" ) != std::string::npos ) return static_cast<uint32_t> ( strtoul ( pRegValue, 0, 16 ) );
else return static_cast<uint32_t> ( strtoul ( pRegValue, 0, 10 ) );
if(std::string(pRegValue).find("0x") != std::string::npos)
return static_cast<uint32_t>(strtoul(pRegValue, 0, 16));
else
return static_cast<uint32_t>(strtoul(pRegValue, 0, 10));
}
};
......
......@@ -13,7 +13,7 @@ Amc13Description::~Amc13Description()
{
delete fTrigger;
for (auto& cBGO : fBGOs) delete cBGO;
for(auto& cBGO: fBGOs) delete cBGO;
fBGOs.clear();
fAMCMask.clear();
......@@ -21,88 +21,85 @@ Amc13Description::~Amc13Description()
fT2map.clear();
}
uint32_t Amc13Description::getReg ( int pTounge, std::string& pReg )
uint32_t Amc13Description::getReg(int pTounge, std::string& pReg)
{
RegMap cMap = (pTounge == 1) ? fT1map : fT2map;
auto cReg = cMap.find (pReg);
auto cReg = cMap.find(pReg);
if (cReg == std::end ( cMap ) ) LOG (INFO) << "The AMC13 does not have a register " << pReg << " in the memory map for Tounge " << pTounge ;
else return cReg->second;
if(cReg == std::end(cMap))
LOG(INFO) << "The AMC13 does not have a register " << pReg << " in the memory map for Tounge " << pTounge;
else
return cReg->second;
}
void Amc13Description::setReg ( int pTounge, std::string& pReg, uint32_t pValue)
void Amc13Description::setReg(int pTounge, std::string& pReg, uint32_t pValue)
{
RegMap cMap = (pTounge == 1) ? fT1map : fT2map;
auto cReg = cMap.find (pReg);
auto cReg = cMap.find(pReg);
if ( cReg == std::end (cMap) ) cMap.insert ( {pReg, pValue} );
else cReg->second = pValue;
if(cReg == std::end(cMap))
cMap.insert({pReg, pValue});
else
cReg->second = pValue;
}
void Amc13Description::setAMCMask (const std::vector<int>& pMask)
{
fAMCMask = pMask;
}
void Amc13Description::setAMCMask(const std::vector<int>& pMask) { fAMCMask = pMask; }
void Amc13Description::setTrigger (bool pLocal, int pMode, int pRate, int pBurst, int pRules)
void Amc13Description::setTrigger(bool pLocal, int pMode, int pRate, int pBurst, int pRules)
{
if (fTrigger != nullptr)
if(fTrigger != nullptr)
{
LOG (INFO) << "Warning, overwriting another Trigger object!" ;
LOG(INFO) << "Warning, overwriting another Trigger object!";
delete fTrigger;
}
fTrigger = new Trigger (pLocal, pMode, pRate, pBurst, pRules);
fTrigger = new Trigger(pLocal, pMode, pRate, pBurst, pRules);
}
void Amc13Description::setTrigger ( Trigger* pTrigger )
void Amc13Description::setTrigger(Trigger* pTrigger)
{
if ( fTrigger != nullptr )
if(fTrigger != nullptr)
{
LOG (INFO) << "Warning, overwriting another Trigger object!" ;
LOG(INFO) << "Warning, overwriting another Trigger object!";
delete fTrigger;
}
fTrigger = pTrigger;
}
Trigger* Amc13Description::getTrigger()
{
return fTrigger;
}
Trigger* Amc13Description::getTrigger() { return fTrigger; }
void Amc13Description::setTTCSimulator (bool pSimulate)
{
fSimulate = pSimulate;
}
void Amc13Description::addBGO (int pCommand, bool pRepeat, int pPrescale, int pBX)
void Amc13Description::setTTCSimulator(bool pSimulate) { fSimulate = pSimulate; }
void Amc13Description::addBGO(int pCommand, bool pRepeat, int pPrescale, int pBX)
{
int cSize = fBGOs.size();
if (cSize > 4) LOG (INFO) << "Warning, AMC13XG only supports 4 user-defined BGOs - adding this one will have no effect!" ;
if(cSize > 4)
LOG(INFO) << "Warning, AMC13XG only supports 4 user-defined BGOs - adding this one will have no effect!";
else
{
BGO* cBGO = new BGO (pCommand, pRepeat, pPrescale, pBX);
fBGOs.push_back (cBGO);
BGO* cBGO = new BGO(pCommand, pRepeat, pPrescale, pBX);
fBGOs.push_back(cBGO);
}
}
void Amc13Description::addBGO ( BGO* pBGO)
void Amc13Description::addBGO(BGO* pBGO)
{
int cSize = fBGOs.size();
if (cSize > 4) LOG (INFO) << "Warning, AMC13XG only supports 4 user-defined BGOs - adding this one will have no effect!" ;
if(cSize > 4)
LOG(INFO) << "Warning, AMC13XG only supports 4 user-defined BGOs - adding this one will have no effect!";
else
fBGOs.push_back ( pBGO );
fBGOs.push_back(pBGO);
}
BGO* Amc13Description::getBGO (int pPos)
BGO* Amc13Description::getBGO(int pPos)
{
if (pPos > 3)
if(pPos > 3)
{
LOG (INFO) << "AMC13XG only supports 4 custom BGOs, ID > 3 is not allowed!" ;
LOG(INFO) << "AMC13XG only supports 4 custom BGOs, ID > 3 is not allowed!";
return nullptr;
}
else return fBGOs.at (pPos);
else
return fBGOs.at(pPos);
}
#ifndef _AMC13_DESCRIPTION_h__
#define _AMC13_DESCRIPTION_h__
#include "../Utils/easylogging++.h"
#include <iostream>
#include <map>
#include <st