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

bugs and smells corrections from sonarQube

parent a960ef26
......@@ -23,7 +23,7 @@
#include "BashColor.h"
BashColor::BashColor()
{
{
fColor = "";
fType = "0;3";
}
......
......@@ -39,20 +39,32 @@ ReadMezzAFP::ReadMezzAFP():
fSourceOfFrames(aMByte,ConfAgent::kRead),
fPath("./"),
fBaseForName("AFP_"),
fCurrentFile(0x0),
fCurrentFile(NULL),
fCurrentFileNumber(0u),
fMaxSize(kMaxInt_t),
fConfMode(-1),
fListOfFile(),
NewCrystal(false),
fEndOfFrame("EndOfFrame"),
crystal_id(0),
crystal_status(0),
evnumber(0),
timestamp(0),
FirstTimeStamp(0),
LastTimeStamp(0),
fTraceLengthRaw(0),
segMezz(NULL),
coreMezz(NULL),
fFrameCrystal_Out(NULL),
fTrigger("data:crystal"),
fdebug(false),
fBashColor(new BashColor()),
fUseKeyFilter(false),
fLastKeyIsRead(false),
fKeyToLink(NULL),
fKeyFilterBuffer(NULL),
fNextEvtNbr(0),
fNextTS(0),
fNEvts(0),
fNIgnoredEvts(0),
fBitFlipMezzLength(0),
......@@ -856,6 +868,8 @@ int ReadMezzAFP::ReadEvent()
ID = i;
int Status = 0;
int ener32 = dbuffer[2];
ener32 = (ener32 << 16) | dbuffer[1];
......@@ -867,54 +881,54 @@ int ReadMezzAFP::ReadEvent()
std::cout<<"SlotId = "<<SlotId<<std::endl;
std::cout<<"ID = "<<ID<<std::endl;
}
else {
float Ener = float(ener32)/(1<<16);
int Status = dbuffer[3];
int CompType = dbuffer[6];
int CompTraceLen = dbuffer[7];
if(SlotId==1 && (ID==0 || ID==1))
{
CoreE[ID] = Ener;
CoreStatus[ID] = Status;
CoreID[ID] = ID;
}
else if(SlotId==1) {;}
else
{
SegE[SegId] = Ener;
SegStatus[SegId] = Status;
SegID[SegId] = SegId;
}
float Ener = float(ener32)/(1<<16);
Status = dbuffer[3];
int CompType = dbuffer[6];
int CompTraceLen = dbuffer[7];
if(fdebug)
{
if(SlotId==1 && !(ID==0 || ID==1)) break;
if(SlotId==1 && (ID==0 || ID==1))
{
CoreE[ID] = Ener;
CoreStatus[ID] = Status;
CoreID[ID] = ID;
}
else if(SlotId==1) {;}
else
{
SegE[SegId] = Ener;
SegStatus[SegId] = Status;
SegID[SegId] = SegId;
}
fBashColor->SetInfoOut();
std::cout<<std::endl;
if(SlotId!=1)
if(fdebug)
{
std::cout<<"trace ID = "<<ID<<std::endl;
std::cout<<"Seg ID = "<<SegId<<std::endl;
if(SlotId==1 && !(ID==0 || ID==1)) break;
fBashColor->SetInfoOut();
std::cout<<std::endl;
if(SlotId!=1)
{
std::cout<<"trace ID = "<<ID<<std::endl;
std::cout<<"Seg ID = "<<SegId<<std::endl;
}
else std::cout<<"core ID = "<<ID<<std::endl;
std::cout<<"Ener = "<<Ener<<std::endl;
std::cout<<"Status = "<<Status<<std::endl;
std::cout<<"CompType = "<<CompType<<std::endl;
std::cout<<"CompTraceLen = "<<CompTraceLen<<std::endl;
std::cout<<std::endl;
fBashColor->ResetColor();
}
else std::cout<<"core ID = "<<ID<<std::endl;
std::cout<<"Ener = "<<Ener<<std::endl;
std::cout<<"Status = "<<Status<<std::endl;
std::cout<<"CompType = "<<CompType<<std::endl;
std::cout<<"CompTraceLen = "<<CompTraceLen<<std::endl;
std::cout<<std::endl;
fBashColor->ResetColor();
}
dbuffer += mezzanineChanHeader;
PosInBuff += mezzanineChanHeader;
unsigned short tmp16;
for(unsigned int j=0 ; j<fTraceLengthRaw ; j++)
{
tmp16 = dbuffer[j];
unsigned short tmp16 = dbuffer[j];
tmp16 &= 0x3FFF; // keep 14 bits
tmp16 ^= 0x2000; // reverse highest ADC bit
// tmp16 = 0x3FFF - tmp16; // change sign
......
......@@ -30,7 +30,7 @@ GammaFilter::GammaFilter() : BaseFilter()
GammaFilter::GammaFilter(Axis_t xmin, Axis_t xmax, Float_t eff, Float_t PT, Float_t dop)
{
Axis_t lxmin, lxmax;
fCompton = fEfficiency = fDoppler = NULL;
fComptonShape = NULL;
// check without saying anything
lxmin = xmin; lxmax = xmax;
......
......@@ -22,17 +22,6 @@
#include "CXBashColor.h"
CXBashColor::CXBashColor()
{
fColor = "";
fType = "0;3";
}
CXBashColor::~CXBashColor()
{
}
void CXBashColor::SetType(bType type)
{
switch (type) {
......
......@@ -59,11 +59,11 @@ public:
};
public:
CXBashColor();
virtual ~CXBashColor();
CXBashColor(){;}
virtual ~CXBashColor(){;}
std::string fColor;
std::string fType;
std::string fColor = "";
std::string fType = "0;3";
void SetType(bType type);
void SetColor(BColor col);
......
......@@ -861,7 +861,7 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
// Info("HandleKey","key pressed : %d %d",px,py);
TObject* obj = 0;
TObject* obj = nullptr;
TIter next(GetListOfPrimitives());
if (!fEnabledShortcuts) return kTRUE;
......@@ -993,7 +993,6 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
gPad->Modified();
gPad->Update();
} else if (fSelected->InheritsFrom("TH1")) {
TObject* obj = 0;
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it())) {
((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() + 50);
......@@ -1018,7 +1017,6 @@ Bool_t CXCanvas::HandleKey(Int_t px, Int_t py)
Modified();
Update();
} else if (fSelected->InheritsFrom("TH1")) {
TObject* obj = 0;
TIter it(((TH1*)fSelected)->GetListOfFunctions());
while ((obj = it()))((TF1*)obj)->SetNpx(((TF1*)obj)->GetNpx() - 50);
Modified();
......
This diff is collapsed.
......@@ -216,13 +216,9 @@ void CXHist2DPlayer::AddToStoredList(TObject *o){
void CXHist2DPlayer::UpdateStoredList(){
fStoredSpectraBox->RemoveAll();
TGTextLBEntry *entry;
for(int i=0 ; i<fListOfStoredSpectra->GetEntries() ; i++){
entry = new TGTextLBEntry(fStoredSpectraBox->GetContainer(), new TGString(fListOfStoredSpectra->At(i)->GetName()), fStoredSpectraBox->GetNumberOfEntries()+1);
TGTextLBEntry *entry = new TGTextLBEntry(fStoredSpectraBox->GetContainer(), new TGString(fListOfStoredSpectra->At(i)->GetName()), fStoredSpectraBox->GetNumberOfEntries()+1);
entry->SetBackgroundColor((Pixel_t)0x90f269);
fStoredSpectraBox->AddEntry((TGLBEntry *)entry, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX));
}
......
......@@ -55,7 +55,7 @@ CXLevelSchemePlayer::CXLevelSchemePlayer(const char* name, const char *title) :
gSystem->mkdir(fENSDFDataDir.Data(),kTRUE);
TSystemDirectory dir(fENSDFDataDir,fENSDFDataDir);
if(dir.GetListOfFiles() == nullptr || (dir.GetListOfFiles() != nullptr && dir.GetListOfFiles()->GetEntries()<=2) ){
if(dir.GetListOfFiles() == nullptr || dir.GetListOfFiles()->GetEntries()<=2 ){
TString temp = Form("%s/DataBase/LevelScheme/README",getenv("GWSYS"));
fBashColor->InfoMessage(Form("No ENSDF data found in %s, follow the procedure explained in %s to download the data from the ENSDF web site",fENSDFDataDir.Data(),temp.Data()));
}
......
......@@ -47,7 +47,7 @@ private:
Float_t fMinLifeTime;
Float_t fMaxLifeTime;
TH1 *fCurrentHist;
TH1 *fCurrentHist = nullptr;
Color_t fColorWheel[48];
......
......@@ -124,6 +124,7 @@ BaseLSPlayer::BaseLSPlayer(LevelScheme* levelScheme) :
fIsOnAxis(true),
fIsTipsOn(true),
fIsLSSelected(false),
fContextMenu(NULL),
fCColorSelectedLink(BasePeak::gGateColor.k0),
fPositionLabels(0.),
fLog("BaseLSPlayer")
......
......@@ -40,6 +40,7 @@ CSFilter::CSFilter()
: TNamed(),
fCondition(1),
fDimension(1),
fPeakList(NULL),
fLog("CSFilter")
{
// default constructor
......
......@@ -130,7 +130,8 @@ using namespace Gw;
GLSPlayer:: GLSPlayer(LevelScheme* levelScheme) :
BaseLSPlayer(levelScheme),
fCSManager(new CSManager(Form("%s_%s", "CSManager", levelScheme->GetName()),
Form("%s %s", "CS Manager for", levelScheme->GetName())))
Form("%s %s", "CS Manager for", levelScheme->GetName()))),
fCSDefaultName(NULL)
{
fLog.GetProcessName() = "GLSPlayer";
SetName("GLSPlayer");
......
......@@ -316,8 +316,10 @@ Peak1D::Peak1D(const Peak1D& p) : BasePeak(p),
fSubPeakIntegral(p.fSubPeakIntegral),
fBkgFlag(p.fBkgFlag),
fBinWidth(p.fBkgFlag),
fCPolyline(0x0),
fDrawAs(p.fDrawAs),
fIsAGammaSourceRay(p.fIsAGammaSourceRay),
fGammaSourceRay(0x0),
fLog("Peak1D"),
fEfficiencyGraph(p.fEfficiencyGraph),
fEfficiencyFunc(p.fEfficiencyFunc),
......
......@@ -524,7 +524,7 @@ void AgataEventDisplay::UpdateElements()
AgataHitDisplay* quadHits = static_cast<AgataHitDisplay*> (fQuadHitList->At(i));
AgataTrackDisplay* lineTracks = static_cast<AgataTrackDisplay*> (fLineTrackList->At(i));
if (!fGUIFlag || (fGUIFlag && fRefreshButton->IsOn())) {
if (!fGUIFlag || fRefreshButton->IsOn()) {
quadHits->ResetHits();
lineTracks->ResetTracks();
}
......
......@@ -51,6 +51,7 @@ BaseEventDisplay::BaseEventDisplay()
fCurrentEventId(0),
fFirstEventDone(false),
fMaxEnergy(4000),
fTopVolume(NULL),
fLog("BaseEventDisplay")
{
// default constructor
......
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