Commit d1d3fc0c authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

remove some bugs from sonarcube

parent 57bfd18d
......@@ -46,8 +46,9 @@ using namespace AGAPRO;
string Histogramer::gMotherClass = "Histogramer";
Histogramer::Histogramer() :
NarvalConsumer()
Histogramer::Histogramer(string trigname) :
NarvalConsumer(),
fTrigger(trigname.data())
{
}
......@@ -155,7 +156,7 @@ std::string Histogramer::GetCrystalNameFromID(const Int_t id)
return ss.str();
}
UShort_t Histogramer::GetCrystalIDFromName(const string name)
UShort_t Histogramer::GetCrystalIDFromName(const string &name)
{
string name_tmp(name);
......@@ -193,7 +194,7 @@ std::string Histogramer::GetSegmentNameFromID(const Int_t id)
{
string name;
if(id<=36){
if(id<36){
Int_t SegNr = (Int_t)id%6+1;
string Letter[6] = {"A","B","C","D","E","F"};
ostringstream ss;
......@@ -339,15 +340,20 @@ void Histogramer::FillHist2F(Hist2F *hist, Float_t valx, Float_t valy, Float_t w
ActorMap *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumber)
{
Log.ClearMessage();
Log.SetProcessMethod("NewHist2F");
fFrameIO.Print(Log());
int fd;
ostringstream SMZ;
ActorMap *map_ptr = nullptr;
int result;
bool SMZ_exists = TestSMZ(name);
if(SMZ_exists == false)
{
int result;
SMZ.str("");
SMZ << "curl http://localhost:5678/SMZs --data-binary '{";
SMZ << "\"name\":\""<< name <<"\", ";
......@@ -357,6 +363,11 @@ ActorMap *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumb
// cout<<SMZ.str()<<endl;
result = system(SMZ.str().data());
cout<<endl;
if(result==-1)
{
Log.SetLevel(LogMessage::kError);
cout << "Error in the SMZ creation: "<<SMZ.str() << dolog;
}
// create a new Transport Layer
SMZ.str("");
......@@ -378,6 +389,11 @@ ActorMap *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumb
// cout<<SMZ.str()<<endl;
result = system(SMZ.str().data());
cout<<endl;
if(result==-1)
{
Log.SetLevel(LogMessage::kError);
cout << "Error in the TL creation: "<<SMZ.str() << dolog;
}
// Connect a new Transport Layer to the SMZ
SMZ.str("");
......@@ -388,6 +404,11 @@ ActorMap *Histogramer::CreateNewSMz(const char *name, Int_t Size, Int_t PortNumb
// cout<<SMZ.str()<<endl;
result = system(SMZ.str().data());
cout<<endl;
if(result==-1)
{
Log.SetLevel(LogMessage::kError);
cout << "Error in the TL connexion: "<<SMZ.str() << dolog;
}
}
else
{
......
......@@ -103,35 +103,36 @@ public:
protected:
CycleServer cServer; // manager of cyclic operations
ADF::SharedFP *fFrameCrystal = nullptr; //! input and ouput frames
ADF::AgataFrameTrigger fTrigger; //! Trigger for the input frame
CycleServer cServer; //! manager of cyclic operations
string fOdirPrefix;
Int_t fReadEvts = 0;
UInt_t evnumber; // from last SetInput
UInt_t evnumber;
ULong64_t timestamp;
Int_t fBasePortNumber;
public:
static std::string gMotherClass; // Static string containing the name of the base class
std::string gActualClass; // Static string to choose daughter class at run time
static std::string gMotherClass; //! Static string containing the name of the base class
std::string gActualClass; //! Static string to choose daughter class at run time
UShort_t crystal_id; // Static string to define the crystal id
std::string crystal_name; // Static string to define the crystal name
UShort_t crystal_id; //! crystal id
std::string crystal_name; //! crystal name
//Level 1 : list of actors
//level 2 : list of observable per actor
vector < vector< void * > > fListOfHists;
vector < vector< void * > > fListOfHists; //! Level 1 : list of actors ; level 2 : list of observable per actor
public:
Histogramer();
Histogramer(string trigname);
virtual ~Histogramer();
static void process_config(const Char_t *, UInt_t *); //! to init globals (static) from a directory
virtual void process_initialise ( UInt_t *error_code ){return;} //! Constructor implementation
virtual void process_reset ( UInt_t *error_code ); //! Destructor implementation
static void process_config(const Char_t *, UInt_t *);
virtual void process_initialise ( UInt_t *error_code ){return;}
virtual void process_reset ( UInt_t *error_code );
virtual UInt_t ProcessBlock(ADF::FrameBlock &);
virtual UInt_t Process(){return 0;}
......@@ -139,10 +140,10 @@ public:
virtual void process_start (UInt_t *error_code);
virtual void process_stop (UInt_t *error_code);
virtual Int_t SetInput(){return 0;} //! to init your local variables with the ones from the buffers
virtual Int_t SetInput(){return 0;}
static std::string GetCrystalNameFromID(const Int_t id);
static UShort_t GetCrystalIDFromName(const string name);
static UShort_t GetCrystalIDFromName(const string &name);
static std::string GetSegmentNameFromID(const Int_t id);
static std::string GetCoreNameFromID(const Int_t id);
......
......@@ -45,9 +45,7 @@ using namespace ADF;
using namespace AGAPRO;
PreproHist::PreproHist() :
Histogramer(),
fFrameCrystal(NULL),
fTrigger("data:ccrystal")
Histogramer("data:ccrystal")
{
gActualClass = "PreproHist";
fBasePortNumber = 11;
......
......@@ -36,9 +36,6 @@ class PreproHist : public Histogramer
{
protected: //Evt properties
ADF::SharedFP *fFrameCrystal; //! input and ouput frames
ADF::AgataFrameTrigger fTrigger; //! Trigger for the input frame
ULong64_t fFirstTS = 0;
ULong64_t fLastTS = 0;
......@@ -49,8 +46,8 @@ protected: //Evt properties
Float_t *fTracesSG[kNSG];
Float_t *fTracesCC[kNCC];
ADF::GeSegment *seg;
ADF::GeCore *core;
ADF::GeSegment *seg = nullptr;
ADF::GeCore *core = nullptr;
Float_t SegE[kNSG]; // in keV
Float_t CoreE[kNCC]; // in keV
......
......@@ -45,9 +45,7 @@ using namespace ADF;
using namespace AGAPRO;
ProdHist::ProdHist() :
Histogramer(),
fFrameCrystal(NULL),
fTrigger("data:crystal")
Histogramer("data:crystal")
{
gActualClass = "ProdHist";
fBasePortNumber = 10;
......
......@@ -36,9 +36,6 @@ class ProdHist : public Histogramer
{
protected: //Evt properties
ADF::SharedFP *fFrameCrystal; //! input and ouput frames
ADF::AgataFrameTrigger fTrigger; //! Trigger for the input frame
ULong64_t fFirstTS = 0;
ULong64_t fLastTS = 0;
......@@ -52,8 +49,8 @@ protected: //Evt properties
Float_t *fTracesSG[kNSG];
Float_t *fTracesCC[kNCC];
ADF::GeSegment *seg;
ADF::GeCore *core;
ADF::GeSegment *seg = nullptr;
ADF::GeCore *core = nullptr;
Float_t SegE[kNSG]; // in keV
Float_t CoreE[kNCC]; // in keV
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment