From c60053f6ccdbf19f1aed6d76bb00172ed61aecc2 Mon Sep 17 00:00:00 2001 From: marian Date: Wed, 2 Mar 2011 17:35:34 +0000 Subject: [PATCH] Coverity fix (Jens) --- TPC/AliTPCCalibViewer.cxx | 13 +- TPC/AliTPCMonitor.cxx | 3 +- TPC/AliTPCMonitorAltro.cxx | 15 +- TPC/AliTPCMonitorAltro.h | 9 +- TPC/AliTPCMonitorConfig.cxx | 44 ++-- TPC/AliTPCMonitorConfig.h | 17 +- TPC/AliTPCMonitorDialog.cxx | 431 ++++++++++++++++++------------------ 7 files changed, 257 insertions(+), 275 deletions(-) diff --git a/TPC/AliTPCCalibViewer.cxx b/TPC/AliTPCCalibViewer.cxx index 81ffb656845..a8d972d55c3 100644 --- a/TPC/AliTPCCalibViewer.cxx +++ b/TPC/AliTPCCalibViewer.cxx @@ -1773,7 +1773,10 @@ TString* AliTPCCalibViewer::Fit(const char* drawCommand, const char* formula, co if (i < dim) centries = fTree->Draw(((TObjString*)formulaTokens->At(i))->GetName(), cutStr.Data(), "goff"); else centries = fTree->Draw(drawStr.Data(), cutStr.Data(), "goff"); - if (entries != centries) return new TString("An ERROR has occured during fitting!"); + if (entries != centries) { + delete [] values; + return new TString("An ERROR has occured during fitting!"); + } values[i] = new Double_t[entries]; memcpy(values[i], fTree->GetV1(), entries*sizeof(Double_t)); } @@ -1800,10 +1803,10 @@ TString* AliTPCCalibViewer::Fit(const char* drawCommand, const char* formula, co returnFormula.Append(" )"); delete formulaTokens; delete fitter; - for (Int_t i = 0; i < dim + 1; i++){ - delete [] values[i]; - } - delete [] values; + for (Int_t i = 0; i < dim + 1; i++){ + delete [] values[i]; + } + delete [] values; return preturnFormula; } diff --git a/TPC/AliTPCMonitor.cxx b/TPC/AliTPCMonitor.cxx index e62279be2c7..0265f5d1048 100755 --- a/TPC/AliTPCMonitor.cxx +++ b/TPC/AliTPCMonitor.cxx @@ -951,6 +951,7 @@ void AliTPCMonitor::FillGlobal(Int_t sector) { pad = fMapHand->GetPad( hw); row = fMapHand->GetPadRow(hw); + if (row==-1) continue; padmax = fMapHand->GetNumofPads(row); if (sector%36>17) fMirror=-1; else fMirror=1; @@ -2126,7 +2127,7 @@ Int_t AliTPCMonitor::GetRCUPatch(Int_t runid, Int_t eqid) const if(runid>=0) { if ( eqid<768 || eqid>983 ) return 0; //no TPC eqid - if(eqid>=1000) return 0; +// if(eqid>=1000) return 0; patch = fMapEqidsRcu[eqid] ; } else diff --git a/TPC/AliTPCMonitorAltro.cxx b/TPC/AliTPCMonitorAltro.cxx index 61ad7218469..8c9344b0621 100755 --- a/TPC/AliTPCMonitorAltro.cxx +++ b/TPC/AliTPCMonitorAltro.cxx @@ -63,7 +63,7 @@ AliTPCMonitorAltro::AliTPCMonitorAltro(UInt_t* memory, Int_t size, Int_t fformat fTrailerBlockPos(0), fTrailerPos(0), fNextPos(0), - ffilename(new Char_t[256]) + ffilename() { // Constructor: Set different CDH offsets for ROOT (0) and date format // Data offset can be changed via SetDataOffset(Int_t val) @@ -93,10 +93,9 @@ AliTPCMonitorAltro::AliTPCMonitorAltro(const AliTPCMonitorAltro &altro) : fTrailerBlockPos(altro.fTrailerBlockPos), fTrailerPos(altro.fTrailerPos), fNextPos(altro.fNextPos), - ffilename(new Char_t[strlen(altro.ffilename)+1]) + ffilename(altro.ffilename) { // copy constructor - strcpy(ffilename,altro.ffilename); } @@ -123,8 +122,7 @@ AliTPCMonitorAltro &AliTPCMonitorAltro::operator =(const AliTPCMonitorAltro& alt fTrailerBlockPos=altro.fTrailerBlockPos; fTrailerPos=altro.fTrailerPos; fNextPos=altro.fNextPos; - ffilename = new Char_t[strlen(altro.ffilename)+1]; - strcpy(ffilename,altro.ffilename); + ffilename = altro.ffilename; } return *this; } @@ -135,7 +133,6 @@ AliTPCMonitorAltro::~AliTPCMonitorAltro() { // Destructor if(fallocate40BitArray == true) delete[] f40BitArray; if(fallocate10BitArray == true) delete[] f10BitArray; - delete[] ffilename; } //_____________________________________________________________________________________________ @@ -229,9 +226,9 @@ void AliTPCMonitorAltro::Decodeto10Bit(Int_t equipment) ofstream datout; if(fwrite10bit) { - Char_t nameout[256] ; sprintf(nameout,"%s_PayloadEquipmentId_%03i.txt",ffilename,equipment); - datout.open(nameout); - AliInfo(Form("AliTPCMonitorAltro::decodeto10Bit : Write Data to %s",nameout)); + TString nameout=Form("%s_PayloadEquipmentId_%03i.txt",ffilename.Data(),equipment); + datout.open(nameout.Data()); + AliInfo(Form("AliTPCMonitorAltro::decodeto10Bit : Write Data to %s",nameout.Data())); if(foffset==0) datout << "Payload without CDH in 10bit words " << endl; else datout << "CDH in 32 bit hex words words (" << foffset << " lines ) followed by payload in 10 bit words " << endl; for(Int_t ih = 0; ih< foffset ; ih++) diff --git a/TPC/AliTPCMonitorAltro.h b/TPC/AliTPCMonitorAltro.h index a10ef927142..99b6b0d04a2 100755 --- a/TPC/AliTPCMonitorAltro.h +++ b/TPC/AliTPCMonitorAltro.h @@ -17,7 +17,8 @@ //// ///////////////////////////////////////////////////////////////////////// -#include "TNamed.h" +#include +#include class AliTPCMonitorAltro : public TNamed { public: @@ -39,7 +40,7 @@ class AliTPCMonitorAltro : public TNamed { Short_t *Get10BitArray(); Int_t Get40BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()];} //hier �ndern Int_t Get10BitArraySize() const { return fmemory[fsize-GetRCUTrailerSize()]*4;} //number of 10 bit words from trailer - Char_t* GetActFileName() const { return ffilename;} + const Char_t* GetActFileName() const { return ffilename.Data();} static Int_t GetHwMaskFEC() { return fgkHwMaskFEC;} static Int_t GetHwMaskBranch() { return fgkHwMaskBranch;} @@ -65,7 +66,7 @@ class AliTPCMonitorAltro : public TNamed { void SetWrite10Bit(Int_t wr) { fwrite10bit =wr ;} - void SetActFilename(Char_t* name){ snprintf(ffilename,256,"%s",name); } + void SetActFilename(const Char_t* name){ ffilename=name; } void SetVerbose(Int_t val) { fverb=val;} private: @@ -89,7 +90,7 @@ class AliTPCMonitorAltro : public TNamed { Int_t fTrailerPos; // trailer position Int_t fNextPos; // position of next trailer - Char_t* ffilename; // name of processed file + TString ffilename; // name of processed file static const Int_t fgk24BitOn = 16777215; // bit masks for first 24 bits of 32 for decoding 32 bit words static const Int_t fgk16BitOn = 65535; // bit masks for first 24 bits of 24 diff --git a/TPC/AliTPCMonitorConfig.cxx b/TPC/AliTPCMonitorConfig.cxx index a4c89c8ed2a..1d778b8675f 100755 --- a/TPC/AliTPCMonitorConfig.cxx +++ b/TPC/AliTPCMonitorConfig.cxx @@ -54,9 +54,9 @@ AliTPCMonitorConfig::AliTPCMonitorConfig(const Char_t* name, const Char_t* title fSectorLast(-1), fSectorLastDisplayed(-1), fSectorArr(new Int_t[36]), - fFileLast(new Char_t[256]), + fFileLast(), fFileLastSet(0), - fFileCurrent(new Char_t[256]), + fFileCurrent(), fEventNext(1), fEventNextID(1), fEventProcessed(0), @@ -107,9 +107,9 @@ AliTPCMonitorConfig::AliTPCMonitorConfig(const AliTPCMonitorConfig &config) : fSectorLast(config.fSectorLast), fSectorLastDisplayed(config.fSectorLastDisplayed), fSectorArr(new Int_t[36]), - fFileLast(new Char_t[strlen(config.fFileLast)+1]), + fFileLast(config.fFileLast), fFileLastSet(config.fFileLastSet), - fFileCurrent(new Char_t[strlen(config.fFileCurrent)+1]), + fFileCurrent(config.fFileCurrent), fEventNext(config.fEventNext), fEventNextID(config.fEventNextID), fEventProcessed(config.fEventProcessed), @@ -145,8 +145,6 @@ AliTPCMonitorConfig::AliTPCMonitorConfig(const AliTPCMonitorConfig &config) : fProcOneSector(config.fProcOneSector) { // copy constructor - strcpy(fFileLast,config.fFileLast); - strcpy(fFileCurrent,config.fFileCurrent); for(Int_t i =0; i<36; i++) { fSectorArr[i] = 0;} for(Int_t i =0; i<10;i++) { fComponents[i] =0.0;} @@ -194,12 +192,8 @@ AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& fFitPulse=config.fFitPulse; fProcOneSector=config.fProcOneSector; - fFileLast = new Char_t[strlen(config.fFileLast)+1]; - strcpy(fFileLast,config.fFileLast); - - - fFileCurrent = new Char_t[strlen(config.fFileCurrent)+1]; - strcpy(fFileCurrent,config.fFileCurrent); + fFileLast = config.fFileLast; + fFileCurrent = config.fFileCurrent; fSectorArr = new Int_t[36]; for(Int_t i =0; i<36; i++) { fSectorArr[i] = 0;} fComponents = new Float_t[10]; for(Int_t i =0; i<10;i++) { fComponents[i] =0.0;} @@ -214,8 +208,6 @@ AliTPCMonitorConfig &AliTPCMonitorConfig::operator =(const AliTPCMonitorConfig& AliTPCMonitorConfig::~AliTPCMonitorConfig() { // Destructor - delete[] fFileLast; - delete[] fFileCurrent; delete[] fSectorArr; delete[] fComponents; } @@ -280,7 +272,7 @@ void AliTPCMonitorConfig::SetBaseConfig(Float_t* confarr) } //_______________________________________________________________________________________________________________ -void AliTPCMonitorConfig::ReadConfig(Char_t* nameconf) +void AliTPCMonitorConfig::ReadConfig(const Char_t* nameconf) { // Read base configuration from file // Update main window size @@ -363,26 +355,24 @@ void AliTPCMonitorConfig::PrintConfig() cout << " Data Format :: " << fFormat << endl; cout << " File current :: " << fFileCurrent << endl; - if(fFileLastSet) { cout << " File last :: " << fFileLast << endl; } + if(fFileLastSet) { cout << " File last :: " << fFileLast.Data() << endl; } return; } //______________________________________________________________________________________________________________ -Char_t* AliTPCMonitorConfig::GetLastProcFile() +const Char_t* AliTPCMonitorConfig::GetLastProcFile() { // Return name of last processed file // Get from file if written if(!fFileLastSet) { - Char_t fnlast[256]; - sprintf(fnlast,"AliTPCMonitorLastFile.txt"); - ifstream datin(fnlast); + ifstream datin("AliTPCMonitorLastFile.txt"); if(!datin.is_open()) { AliWarning("Could not read file containing name of last processed file: Check permissions and path"); - sprintf(fFileLast,"%s",""); - fFileLastSet=0; - return fFileLast; + fFileLast=""; + fFileLastSet=0; + return fFileLast.Data(); } datin >> fFileLast; datin.close(); @@ -392,15 +382,13 @@ Char_t* AliTPCMonitorConfig::GetLastProcFile() } //_______________________________________________________________________________________________________________ -void AliTPCMonitorConfig::SetLastProcFile(Char_t* file) +void AliTPCMonitorConfig::SetLastProcFile(const Char_t* file) { // Set name of last processed file // Write name to a file - sprintf(fFileLast,file); - Char_t fnlast[256]; - sprintf(fnlast,"AliTPCMonitorLastFile.txt"); - ofstream datout(fnlast); + fFileLast=file; + ofstream datout("AliTPCMonitorLastFile.txt"); if(!datout) { AliWarning("Could not write file containing name of last processed file: Check permissions and path");} datout << fFileLast << endl; datout.close(); diff --git a/TPC/AliTPCMonitorConfig.h b/TPC/AliTPCMonitorConfig.h index bc2b8714f03..c929c00c98d 100755 --- a/TPC/AliTPCMonitorConfig.h +++ b/TPC/AliTPCMonitorConfig.h @@ -20,7 +20,8 @@ //// ///////////////////////////////////////////////////////////////////////// -#include "TNamed.h" +#include +#include class AliTPCMonitorConfig: public TNamed { @@ -52,10 +53,10 @@ class AliTPCMonitorConfig: public TNamed Int_t GetFormat() const { return fFormat ;} - Char_t* GetFile() const { return fFileCurrent;} + const Char_t* GetFile() const { return fFileCurrent.Data();} Int_t GetFitPulse() const { return fFitPulse ;} - Char_t* GetLastProcFile(); + const Char_t* GetLastProcFile(); Int_t GetMaxHwAddr() const { return fMaxHwAddr ; } Int_t GetLastSector() const { return fSectorLast;} @@ -92,7 +93,7 @@ class AliTPCMonitorConfig: public TNamed void SetBaseConfig(float* ConfArr); - void SetLastProcFile(Char_t* val); + void SetLastProcFile(const Char_t* val); void SetEventProcessed(Int_t val) { fEventProcessed=val;} @@ -104,7 +105,7 @@ class AliTPCMonitorConfig: public TNamed void SetTimeBins(Int_t val) { fTimeBins = val ; } - void SetFile(Char_t* val) { sprintf(fFileCurrent,val);} + void SetFile(const Char_t* val) { fFileCurrent=val; } void SetLastSector(Int_t val) { fSectorLast = val;} @@ -133,7 +134,7 @@ class AliTPCMonitorConfig: public TNamed void PrintConfig(); - void ReadConfig(Char_t* nameconf); + void ReadConfig(const Char_t* nameconf); void ResetSectorArray() { for(Int_t i=0;i<36; i++) fSectorArr[i]=0;} private: @@ -147,10 +148,10 @@ class AliTPCMonitorConfig: public TNamed Int_t* fSectorArr; // Array of processed sectors // Current and Last Files and Dirs - Char_t* fFileLast; // Name of last processed file/stream + TString fFileLast; // Name of last processed file/stream Int_t fFileLastSet ; // Flag showing if last file name was set - Char_t* fFileCurrent; // Current file/stream name + TString fFileCurrent; // Current file/stream name Int_t fEventNext; // Process next event -> do not stay in current event Int_t fEventNextID; // Next event ID to be processed (if event id does not exist search for next existing event) diff --git a/TPC/AliTPCMonitorDialog.cxx b/TPC/AliTPCMonitorDialog.cxx index cf15bbfe2a0..bf659762bf9 100755 --- a/TPC/AliTPCMonitorDialog.cxx +++ b/TPC/AliTPCMonitorDialog.cxx @@ -40,7 +40,7 @@ New TPC monitoring package from Stefan Kniege. The monitoring package can be sta - + #include #include "AliTPCMonitorDialog.h" #include "TGTab.h" @@ -60,34 +60,34 @@ New TPC monitoring package from Stefan Kniege. The monitoring package can be sta ClassImp(AliTPCMonitorDialog) //_____________________________________________________________________________________________ AliTPCMonitorDialog::AliTPCMonitorDialog(TGWindow *p, TGWindow *main, UInt_t w, - UInt_t h, UInt_t options, Int_t version,AliTPCMonitor* monitor): + UInt_t h, UInt_t options, Int_t version,AliTPCMonitor* monitor): //fQObject(0), - fFrameMain(new TGTransientFrame(p, main, w, h, options)), - fFrameComp(0), - fFrameHor(new TGHorizontalFrame(fFrameMain, 60, 20, kFixedWidth)), - fFrameGroup(0), - fOkButton(new TGTextButton(fFrameHor, "&Ok", 1)), - fListBox(0), - fTab(new TGTab(fFrameMain, 300, 300)), - fLayout1(new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)), - fLayout2(new TGLayoutHints(kLHintsBottom | kLHintsRight , 2, 2, 5, 1)), - fLayout3(new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5)), - fMonitor(monitor), - fWidth(w), - fHeight(h), - fOptions(options), - fVersion(version), - fClient(p), - fMain(main) +fFrameMain(new TGTransientFrame(p, main, w, h, options)), +fFrameComp(0), +fFrameHor(new TGHorizontalFrame(fFrameMain, 60, 20, kFixedWidth)), +fFrameGroup(0), +fOkButton(new TGTextButton(fFrameHor, "&Ok", 1)), +fListBox(0), +fTab(new TGTab(fFrameMain, 300, 300)), +fLayout1(new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2)), +fLayout2(new TGLayoutHints(kLHintsBottom | kLHintsRight , 2, 2, 5, 1)), +fLayout3(new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5)), +fMonitor(monitor), +fWidth(w), +fHeight(h), +fOptions(options), +fVersion(version), +fClient(p), +fMain(main) { - // Constructor for Dialog window. - // Create a dialog window.depending on the version it is called with.. + // Constructor for Dialog window. + // Create a dialog window.depending on the version it is called with.. // Verrion 0: Choose DATA Format // Version 1: Choose FEC components to display // Version 2: Choose Ranges for base and max adc calculation - + fFrameMain->Connect("CloseWindow()", "AliTPCMonitorDialog", this, "DoClose()"); - fFrameMain->DontCallClose(); + fFrameMain->DontCallClose(); fFrameMain->SetCleanup(kDeepCleanup); fOkButton->Connect("Clicked()", "AliTPCMonitorDialog", this, "DoOK()"); fFrameHor->AddFrame(fOkButton, fLayout1); @@ -121,7 +121,7 @@ fMain(dialog.GetMainFrame()) { // copy constructor (actually none forseen for this class) fFrameMain->Connect("CloseWindow()", "AliTPCMonitorDialog", this, "DoClose()"); - fFrameMain->DontCallClose(); + fFrameMain->DontCallClose(); fFrameMain->SetCleanup(kDeepCleanup); fOkButton->Connect("Clicked()", "AliTPCMonitorDialog", this, "DoOK()"); fFrameHor->AddFrame(fOkButton, fLayout1); @@ -129,7 +129,7 @@ fMain(dialog.GetMainFrame()) fFrameMain->AddFrame( fFrameHor, fLayout2); fTab->Connect("Selected(Int_t)", "AliTPCMonitorDialog", this, "DoTab(Int_t)"); CreateDialogVersion(dialog.GetVersion()); - + } //_____________________________________________________________________________ @@ -137,36 +137,36 @@ AliTPCMonitorDialog &AliTPCMonitorDialog::operator =(const AliTPCMonitorDialog& { // assignement operator (actually none forseen for this class) if(this!=&dialog) - { - fFrameMain = new TGTransientFrame(dialog.GetClient(), dialog.GetMainFrame(), dialog.GetWidth(), dialog.GetHeight()); - fFrameComp = 0; - fFrameHor = new TGHorizontalFrame(fFrameMain, 60, 20, kFixedWidth); - fFrameGroup = 0; - fOkButton = new TGTextButton(fFrameHor, "&Ok", 1); - fListBox = 0; - fTab = new TGTab(fFrameMain, 300, 300); - fLayout1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2); - fLayout2 = new TGLayoutHints(kLHintsBottom | kLHintsRight , 2, 2, 5, 1); - fLayout3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5); - fMonitor = dialog.GetMonitor(); - fWidth = dialog.GetWidth(); - fHeight = dialog.GetHeight(); - fOptions = dialog.GetOptions(); - fClient = dialog.GetClient(); - fVersion = dialog.GetVersion(); - fMain = dialog.GetMainFrame(); - fFrameMain->Connect("CloseWindow()", "AliTPCMonitorDialog", this, "DoClose()"); - fFrameMain->DontCallClose(); - fFrameMain->SetCleanup(kDeepCleanup); - fOkButton->Connect("Clicked()", "AliTPCMonitorDialog", this, "DoOK()"); - fFrameHor->AddFrame(fOkButton, fLayout1); - fFrameHor->Resize(150, fOkButton->GetDefaultHeight()); - fFrameMain->AddFrame( fFrameHor, fLayout2); - fTab->Connect("Selected(Int_t)", "AliTPCMonitorDialog", this, "DoTab(Int_t)"); - CreateDialogVersion(dialog.GetVersion()); - } - return *this; - } + { + fFrameMain = new TGTransientFrame(dialog.GetClient(), dialog.GetMainFrame(), dialog.GetWidth(), dialog.GetHeight()); + fFrameComp = 0; + fFrameHor = new TGHorizontalFrame(fFrameMain, 60, 20, kFixedWidth); + fFrameGroup = 0; + fOkButton = new TGTextButton(fFrameHor, "&Ok", 1); + fListBox = 0; + fTab = new TGTab(fFrameMain, 300, 300); + fLayout1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 2, 2, 2, 2); + fLayout2 = new TGLayoutHints(kLHintsBottom | kLHintsRight , 2, 2, 5, 1); + fLayout3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5); + fMonitor = dialog.GetMonitor(); + fWidth = dialog.GetWidth(); + fHeight = dialog.GetHeight(); + fOptions = dialog.GetOptions(); + fClient = dialog.GetClient(); + fVersion = dialog.GetVersion(); + fMain = dialog.GetMainFrame(); + fFrameMain->Connect("CloseWindow()", "AliTPCMonitorDialog", this, "DoClose()"); + fFrameMain->DontCallClose(); + fFrameMain->SetCleanup(kDeepCleanup); + fOkButton->Connect("Clicked()", "AliTPCMonitorDialog", this, "DoOK()"); + fFrameHor->AddFrame(fOkButton, fLayout1); + fFrameHor->Resize(150, fOkButton->GetDefaultHeight()); + fFrameMain->AddFrame( fFrameHor, fLayout2); + fTab->Connect("Selected(Int_t)", "AliTPCMonitorDialog", this, "DoTab(Int_t)"); + CreateDialogVersion(dialog.GetVersion()); + } + return *this; +} @@ -174,104 +174,95 @@ AliTPCMonitorDialog &AliTPCMonitorDialog::operator =(const AliTPCMonitorDialog& void AliTPCMonitorDialog::CreateDialogVersion(Int_t version) { // Create a dialog window depending on the version passed - - Char_t tmp[256]; + if(version==1) - { + { // Choose DATA Format //////////////////////////////////////////////////// - TGTextButton *bt; - TGCompositeFrame* tf = fTab->AddTab("Select Format"); - fFrameComp = new TGCompositeFrame(tf, 60, 20, kVerticalFrame); - fFrameComp->AddFrame(bt = new TGTextButton(fFrameComp, "Select Entry", 1), fLayout3); - - bt->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); - fFrameComp->AddFrame(fListBox = new TGListBox(fFrameComp, 1), fLayout3); - tf->AddFrame(fFrameComp, fLayout3); - sprintf(tmp, "ROOT file "); fListBox->AddEntry(tmp, 0); - sprintf(tmp, "DATE file "); fListBox->AddEntry(tmp, 1); - sprintf(tmp, "DATE file/stream "); fListBox->AddEntry(tmp, 2); - - fListBox->Resize(200, 80); - - } + TGTextButton *bt; + TGCompositeFrame* tf = fTab->AddTab("Select Format"); + fFrameComp = new TGCompositeFrame(tf, 60, 20, kVerticalFrame); + fFrameComp->AddFrame(bt = new TGTextButton(fFrameComp, "Select Entry", 1), fLayout3); + + bt->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); + fFrameComp->AddFrame(fListBox = new TGListBox(fFrameComp, 1), fLayout3); + tf->AddFrame(fFrameComp, fLayout3); + fListBox->AddEntry("ROOT file ", 0); + fListBox->AddEntry("DATE file ", 1); + fListBox->AddEntry("DATE file/stream ", 2); + + fListBox->Resize(200, 80); + + } else if(version==2) - { + { // choose component to be displayed ///////////////////////////////////// - fFrameGroup = new TGGroupFrame(fFrameMain, "Components", kVerticalFrame); - fFrameGroup->SetTitlePos(TGGroupFrame::kRight); // right aligned - fFrameMain->AddFrame(fFrameGroup, fLayout3); - fFrameGroup->SetLayoutManager(new TGMatrixLayout(fFrameGroup, 0, 2, 10)); + fFrameGroup = new TGGroupFrame(fFrameMain, "Components", kVerticalFrame); + fFrameGroup->SetTitlePos(TGGroupFrame::kRight); // right aligned + fFrameMain->AddFrame(fFrameGroup, fLayout3); + fFrameGroup->SetLayoutManager(new TGMatrixLayout(fFrameGroup, 0, 2, 10)); + + const Char_t names[6][40] ={ + "FEC (global)", + "RCU (patch) ", + "Branch ", + "FEC (local) ", + "Connector ", + "Chip " + }; + for (Int_t j = 0; j < 6; j++) + { + fFrameGroup->AddFrame(new TGLabel(fFrameGroup, new TGHotString(names[j]))); + + fBuf[j] = new TGTextBuffer(10); + fBuf[j]->AddText(0, "all"); + + fEnt[j] = new TGTextEntry(fFrameMain, fBuf[j]); + fEnt[j]->Resize(50, fEnt[j]->GetDefaultHeight()); + fEnt[j]->SetFont("-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1"); + fFrameGroup->AddFrame(fEnt[j]); - Char_t buff[100]; - Char_t names[6][40] ={ - "FEC (global)", - "RCU (patch) ", - "Branch ", - "FEC (local) ", - "Connector ", - "Chip " - }; - for (Int_t j = 0; j < 6; j++) - { - sprintf(buff, "%s", names[j]); - fFrameGroup->AddFrame(new TGLabel(fFrameGroup, new TGHotString(buff))); - - fBuf[j] = new TGTextBuffer(10); - fBuf[j]->AddText(0, "all"); - - fEnt[j] = new TGTextEntry(fFrameMain, fBuf[j]); - fEnt[j]->Resize(50, fEnt[j]->GetDefaultHeight()); - fEnt[j]->SetFont("-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1"); - fFrameGroup->AddFrame(fEnt[j]); - - } - TGTextButton* bt2 =0; - fFrameGroup->AddFrame(bt2 = new TGTextButton(fFrameGroup, "Select Config", 2), fLayout3); - bt2->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); - fFrameGroup->Resize(); } + TGTextButton* bt2 =0; + fFrameGroup->AddFrame(bt2 = new TGTextButton(fFrameGroup, "Select Config", 2), fLayout3); + bt2->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); + fFrameGroup->Resize(); + } else if(version==3) - { + { // choose component to be displayed ///////////////////////////////////// - fFrameGroup = new TGGroupFrame(fFrameMain, "Ranges BASE/MAX/SUM ", kVerticalFrame); - fFrameGroup->SetTitlePos(TGGroupFrame::kRight); - fFrameMain->AddFrame(fFrameGroup, fLayout3); - fFrameGroup->SetLayoutManager(new TGMatrixLayout(fFrameGroup, 0, 2, 10)); + fFrameGroup = new TGGroupFrame(fFrameMain, "Ranges BASE/MAX/SUM ", kVerticalFrame); + fFrameGroup->SetTitlePos(TGGroupFrame::kRight); + fFrameMain->AddFrame(fFrameGroup, fLayout3); + fFrameGroup->SetLayoutManager(new TGMatrixLayout(fFrameGroup, 0, 2, 10)); + + const Char_t names[3][40] = { + "baseline", + "maximum adc", + "sum adc ", + }; + + for (Int_t j = 0; j < 3; j++) { + fFrameGroup->AddFrame(new TGLabel(fFrameGroup, new TGHotString(names[j]))); - Char_t buff[100]; - Char_t names[3][40] = { - "baseline", - "maximum adc", - "sum adc ", - }; + fBuf[j] = new TGTextBuffer(30); + if(j==0) fBuf[j]->AddText(0,Form("%i,%i",fMonitor->GetRangeBaseMin() , fMonitor->GetRangeBaseMax())); + if(j==1) fBuf[j]->AddText(0,Form("%i,%i",fMonitor->GetRangeMaxAdcMin(), fMonitor->GetRangeMaxAdcMax())); + if(j==2) fBuf[j]->AddText(0,Form("%i,%i",fMonitor->GetRangeSumMin() , fMonitor->GetRangeSumMax())); - Char_t namebas[40]; sprintf(namebas,"%i,%i",fMonitor->GetRangeBaseMin() , fMonitor->GetRangeBaseMax() ); - Char_t namemax[40]; sprintf(namemax,"%i,%i",fMonitor->GetRangeMaxAdcMin(), fMonitor->GetRangeMaxAdcMax()); - Char_t namesum[40]; sprintf(namesum,"%i,%i",fMonitor->GetRangeSumMin() , fMonitor->GetRangeSumMax() ); + fEnt[j] = new TGTextEntry(fFrameMain, fBuf[j]); + fEnt[j]->Resize(100, fEnt[j]->GetDefaultHeight()); + fEnt[j]->SetFont("-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1"); + fFrameGroup->AddFrame(fEnt[j]); - for (Int_t j = 0; j < 3; j++) { - sprintf(buff, "%s", names[j]); - fFrameGroup->AddFrame(new TGLabel(fFrameGroup, new TGHotString(buff))); - - fBuf[j] = new TGTextBuffer(30); - if(j==0) fBuf[j]->AddText(0,namebas); - if(j==1) fBuf[j]->AddText(0,namemax); - if(j==2) fBuf[j]->AddText(0,namesum); - - fEnt[j] = new TGTextEntry(fFrameMain, fBuf[j]); - fEnt[j]->Resize(100, fEnt[j]->GetDefaultHeight()); - fEnt[j]->SetFont("-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1"); - fFrameGroup->AddFrame(fEnt[j]); - - } - TGTextButton* bt2 =0; - fFrameGroup->AddFrame(bt2 = new TGTextButton(fFrameGroup, "Select Config", 3), fLayout3); - bt2->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); - fFrameGroup->Resize(100,300); } + TGTextButton* bt2 =0; + fFrameGroup->AddFrame(bt2 = new TGTextButton(fFrameGroup, "Select Config", 3), fLayout3); + bt2->Connect("Clicked()", "AliTPCMonitorDialog", this, "HandleButtons()"); + fFrameGroup->Resize(100,300); + } TGLayoutHints *fL5 = new TGLayoutHints(kLHintsBottom | kLHintsExpandX | - kLHintsExpandY, 2, 2, 5, 1); + kLHintsExpandY, 2, 2, 5, 1); fFrameMain->AddFrame(fTab, fL5); fFrameMain->MapSubwindows(); fFrameMain->Resize(); @@ -287,7 +278,7 @@ void AliTPCMonitorDialog::CreateDialogVersion(Int_t version) AliTPCMonitorDialog::~AliTPCMonitorDialog() { // Delete test dialog widgets. - fFrameMain->DeleteWindow(); + fFrameMain->DeleteWindow(); } //_____________________________________________________________________________________________ @@ -299,90 +290,90 @@ void AliTPCMonitorDialog::HandleButtons(Int_t id) id = btn->WidgetId(); } - switch (id) + switch (id) + { + case 1: { - case 1: - { - // Select Format - Int_t fsel = fListBox->GetSelected(); - if(fsel==-1) { AliError("Warning: No Format selected "); } - TGLBEntry* libentr = (TGLBEntry*)fListBox->GetEntry(fsel); - AliInfo(Form("Selected Format : %i : %s",fsel,libentr->GetTitle())); - fMonitor->SetFormat(fsel); - - break; - } - case 2: + // Select Format + Int_t fsel = fListBox->GetSelected(); + if(fsel==-1) { AliError("Warning: No Format selected "); } + TGLBEntry* libentr = (TGLBEntry*)fListBox->GetEntry(fsel); + AliInfo(Form("Selected Format : %i : %s",fsel,libentr->GetTitle())); + fMonitor->SetFormat(fsel); + + break; + } + case 2: + { + // Select FEE Component + Int_t compsel=1; + Int_t fComponents[10]; + for(Int_t j = 0; j < 6; j++) { - // Select FEE Component - Int_t compsel=1; - Int_t fComponents[10]; - for(Int_t j = 0; j < 6; j++) - { - TString s1 = fEnt[j]->GetDisplayText(); - if(s1=="all"){ fComponents[j] = -1; } - else { fComponents[j] = (int)atoi(s1.Data()); } - if( - (j==0 && (fComponents[j] < -1 || fComponents[j]>5000)) || - (j==1 && (fComponents[j] < -1 || fComponents[j]>5 )) || - (j==2 && (fComponents[j] < -1 || fComponents[j]>1 )) || - (j==3 && (fComponents[j] < -1 || fComponents[j]>25 )) || - (j==4 && (fComponents[j] < -1 || fComponents[j]>6 )) || - (j==5 && (fComponents[j] < -1 || fComponents[j]>8 )) ) - { - compsel =0; - AliError("Settings out of range ( version 2) "); - } - } - if(compsel==1) - { - if(fMonitor!=0 && fMonitor->GetEventProcessed() )fMonitor->ShowSel((Int_t*)fComponents); - else AliError("No event processed up to now"); - } - break; + TString s1 = fEnt[j]->GetDisplayText(); + if(s1=="all"){ fComponents[j] = -1; } + else { fComponents[j] = (int)atoi(s1.Data()); } + if( + (j==0 && (fComponents[j] < -1 || fComponents[j]>5000)) || + (j==1 && (fComponents[j] < -1 || fComponents[j]>5 )) || + (j==2 && (fComponents[j] < -1 || fComponents[j]>1 )) || + (j==3 && (fComponents[j] < -1 || fComponents[j]>25 )) || + (j==4 && (fComponents[j] < -1 || fComponents[j]>6 )) || + (j==5 && (fComponents[j] < -1 || fComponents[j]>8 )) ) + { + compsel =0; + AliError("Settings out of range ( version 2) "); + } } - case 3: + if(compsel==1) { - // Set Configuration (base, max, sum) - Int_t fConfigArr[6]; - - string s1((TString)fEnt[0]->GetDisplayText().Data()); - string s2((TString)fEnt[1]->GetDisplayText().Data()); - string s3((TString)fEnt[2]->GetDisplayText().Data()); - - Int_t error = 1; - - if(s1.find(",")!=string::npos){ - string sub11 = s1.substr(0,s1.find(",")) ;fConfigArr[0] = atoi(sub11.data()); - string sub12 = s1.substr(s1.find(",")+1,s1.length() ) ;fConfigArr[1] = atoi(sub12.data()); - if(fConfigArr[0]SetRangeBase(fConfigArr[0],fConfigArr[1]); - error=0; - } - } - if(s2.find(",")!=string::npos){ - string sub21 = s2.substr(0,s2.find(",")) ;fConfigArr[2] = atoi(sub21.data()); - string sub22 = s2.substr(s2.find(",")+1,s2.length() ) ;fConfigArr[3] = atoi(sub22.data()); - if(fConfigArr[2]SetRangeMax(fConfigArr[2],fConfigArr[3]); - error=0; - } - } - - if(s3.find(",")!=string::npos){ - string sub31 = s3.substr(0,s3.find(",")) ;fConfigArr[4] = atoi(sub31.data()); - string sub32 = s3.substr(s3.find(",")+1,s3.length() ) ;fConfigArr[5] = atoi(sub32.data()); - if(fConfigArr[4]SetRangeSum(fConfigArr[4],fConfigArr[5]); - error=0; - } - } - if(error!=0) AliError("Settings out of range (version 3)"); - break; + if(fMonitor!=0 && fMonitor->GetEventProcessed() )fMonitor->ShowSel((Int_t*)fComponents); + else AliError("No event processed up to now"); } - default: break; } + case 3: + { + // Set Configuration (base, max, sum) + Int_t fConfigArr[6]; + + string s1((TString)fEnt[0]->GetDisplayText().Data()); + string s2((TString)fEnt[1]->GetDisplayText().Data()); + string s3((TString)fEnt[2]->GetDisplayText().Data()); + + Int_t error = 1; + + if(s1.find(",")!=string::npos){ + string sub11 = s1.substr(0,s1.find(",")) ;fConfigArr[0] = atoi(sub11.data()); + string sub12 = s1.substr(s1.find(",")+1,s1.length() ) ;fConfigArr[1] = atoi(sub12.data()); + if(fConfigArr[0]SetRangeBase(fConfigArr[0],fConfigArr[1]); + error=0; + } + } + if(s2.find(",")!=string::npos){ + string sub21 = s2.substr(0,s2.find(",")) ;fConfigArr[2] = atoi(sub21.data()); + string sub22 = s2.substr(s2.find(",")+1,s2.length() ) ;fConfigArr[3] = atoi(sub22.data()); + if(fConfigArr[2]SetRangeMax(fConfigArr[2],fConfigArr[3]); + error=0; + } + } + + if(s3.find(",")!=string::npos){ + string sub31 = s3.substr(0,s3.find(",")) ;fConfigArr[4] = atoi(sub31.data()); + string sub32 = s3.substr(s3.find(",")+1,s3.length() ) ;fConfigArr[5] = atoi(sub32.data()); + if(fConfigArr[4]SetRangeSum(fConfigArr[4],fConfigArr[5]); + error=0; + } + } + if(error!=0) AliError("Settings out of range (version 3)"); + break; + } + default: + break; + } } //_____________________________________________________________________________________________ @@ -396,7 +387,7 @@ void AliTPCMonitorDialog::DoClose() const { // Close the dialog window printf("\nTerminating dialog: via window manager\n"); - CloseWindow(); + CloseWindow(); // Close the Ged editor if it was activated. if (TVirtualPadEditor::GetPadEditor(kFALSE) != 0) TVirtualPadEditor::Terminate(); @@ -414,10 +405,10 @@ void AliTPCMonitorDialog::DoOK() { // Call from OK button printf("\nTerminating dialog: OK pressed\n"); - + // The same effect can be obtained by using a singleshot timer: TTimer::SingleShot(150, "AliTPCMonitorDialog", this, "CloseWindow()"); - + // Close the Ged editor if it was activated. if (TVirtualPadEditor::GetPadEditor(kFALSE) != 0) TVirtualPadEditor::Terminate(); -- 2.39.3