Changeset 4513


Ignore:
Timestamp:
08/05/04 15:03:07 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4511 r4513  
    2121 2004/08/05: Thomas Bretz
    2222
    23    * manalysis/MGeomApply.cc:
     23   * manalysis/MGeomApply.cc, mimage/MCameraSmooth.[h,cc]:
    2424     - removed dependancy on MBlindPixel
     25
     26   * macros/sql/readrbk.C, msql/MSQLServer.cc:
     27     - fixed some memory leaks - the result of TSQLServer::Query
     28       must be deleted
     29
     30   * mbase/MTaskInteractive.cc:
     31     - added some comments
     32
     33   * mmain/MBrowser.cc:
     34     - fixed a bug which caused '/data/MAGIC' not to be shown in
     35       the dir-list
     36
     37   * mmc/MMcEvt.hxx:
     38     - added some more particle ids
     39
    2540
    2641
  • trunk/MagicSoft/Mars/macros/sql/readrbk.C

    r4443 r4513  
    5151    TSQLRow *row;
    5252
    53     TList rows;
     53    Bool_t rc = kFALSE;
    5454    while (row=res->Next())
    5555    {
    5656        if ((*row)[0])
    57             return kTRUE;
     57        {
     58            rc = kTRUE;
     59            break;
     60        }
    5861    }
    5962
    60     return kFALSE;
     63    delete res;
     64
     65    return rc;
    6166}
    6267
     
    146151        query += "\");";
    147152
    148         if (!serv->Query(query))
     153        TSQLResult *res = serv->Query(query);
     154        if (!res)
    149155            cout << "ERROR: " << query << endl << endl;
    150156        else
     157        {
     158            delete res;
    151159            num++;
     160        }
    152161
    153162        entry = "";
  • trunk/MagicSoft/Mars/mbase/MTaskInteractive.cc

    r4452 r4513  
    7272// --------------------------------------------------------------------------
    7373//
     74// Default Constructor. Takes name and title of the interactive task
    7475//
    7576MTaskInteractive::MTaskInteractive(const char *name, const char *title) :
     
    8485}
    8586
     87// --------------------------------------------------------------------------
     88//
     89// Destructor. Free all resources.
     90//
    8691MTaskInteractive::~MTaskInteractive()
    8792{
     
    9196}
    9297
     98// --------------------------------------------------------------------------
     99//
     100// Calls the function and returns its return value.
     101// Called by PreProcess, Process, PostProcess and ReInit.
     102//
    93103inline Int_t MTaskInteractive::Return(Int_t no, void *params)
    94104{
     
    107117}
    108118
     119// --------------------------------------------------------------------------
     120//
     121// Generalized function to set the functions of your interactive task.
     122// Called by SetPreProcess, SetProcess, SetPostProcess and SetReInit
     123//
    109124Bool_t MTaskInteractive::Set(void *fcn, Int_t no, const char *params)
    110125{
     
    138153}
    139154
     155// --------------------------------------------------------------------------
     156//
     157//
     158//
    140159void MTaskInteractive::Free(Int_t no)
    141160{
  • trunk/MagicSoft/Mars/mmain/MBrowser.cc

    r3069 r4513  
    137137
    138138    const TGPicture *pic0 = fList->GetPicture("magic_t.xpm");
    139     if (!pic0)
     139    if (pic0)
    140140    {
     141        dir->GetListBox()->Resize(100, 150);
    141142        TGTreeLBEntry *entry = new TGTreeLBEntry(dir->GetListBox()->GetContainer(),
    142143                                                 new TGString("/data/MAGIC"), pic0, 6000,
     
    144145        TGLayoutHints *laylb = new TGLayoutHints(kLHintsLeft|kLHintsTop, 14, 0, 0, 0);
    145146        dir->AddEntry(entry, laylb);
    146         // Note necessary - deleted in ~TGLBContainer: fList->Add(laylb);
    147         fList->Add(entry);
     147        // Not necessary - deleted in ~TGLBContainer: fList->Add(laylb);
     148        // fList->Add(laylb);
    148149    }
    149150
  • trunk/MagicSoft/Mars/msql/MSQLServer.cc

    r3415 r4513  
    3131//  many features usefull working with relational tables.
    3232//
     33//  Use it like TSQlServer:
     34//    new MSQLServer("mysql://localhost:3306", "hercules", "stdmagicpassword");
     35//    // now start your TBrowser
     36//    new TBrowser;
     37//
    3338////////////////////////////////////////////////////////////////////////
    3439#include "MSQLServer.h"
     
    7277    const TString desc((*row)[1]);
    7378
    74     //cout << "Column Type: " << desc << endl;
     79    delete res;
    7580
    7681    const Bool_t isnum =
     
    119124        num++;
    120125    }
     126
     127    delete res;
    121128
    122129    if (!isnum)
     
    297304    TSQLResult *res = fServ->Query(query);
    298305    if (res)
     306    {
    299307        PrintTable(res);
     308        delete res;
     309    }
    300310    else
    301311        cout << "Query failed: " << query << endl;
     
    519529
    520530    if (res->GetFieldCount()!=1)
     531    {
     532        delete res;
    521533        return (PrintError("GetEntry - Number of columns != 1", query), "");
     534    }
    522535
    523536    if (res->GetRowCount()>1)
     537    {
     538        delete res;
    524539        return (PrintError("GetEntry - Number of rows > 1", query), "");
     540    }
    525541
    526542    if (res->GetRowCount()==0)
     543    {
     544        delete res;
    527545        return "";
     546    }
    528547
    529548    const char *fld = res->Next()->GetField(0);
    530549    if (!fld)
     550    {
     551        delete res;
    531552        return (PrintError("GetEntry - Entry is empty", query), "");
    532 
    533     return TString(fld);
    534 }
     553    }
     554
     555    const TString rc(fld);
     556    delete res;
     557    return rc;
     558}
  • trunk/MagicSoft/include-Classes/MMcFormat/MMcEvt.hxx

    r3894 r4513  
    1414    enum ParticleId_t
    1515    {
    16         kGAMMA    1,
     16        kGAMMA    =  1,
    1717        kPOSITRON =  2,
    1818        kELECTRON =  3,
     19        kANTIMUON =  5,
     20        kMUON     =  6,
     21        kPI0      =  7,
     22        kNEUTRON  = 13,
    1923        kPROTON =   14,
    2024        kHELIUM =  402,
     
    145149      case kPOSITRON: return "Positron";
    146150      case kELECTRON: return "Electron";
     151      case kANTIMUON: return "Anti-Muon";
     152      case kMUON:     return "Muon";
     153      case kPI0:      return "Pi-0";
     154      case kNEUTRON:  return "Neutron";
    147155      case kPROTON:   return "Proton";
    148156      case kHELIUM:   return "Helium";
     
    151159      }
    152160
    153       return Form("%d", fPartId);
     161      return Form("Id:%d", fPartId);
     162  }
     163  TString GetParticleSymbol() const
     164  {
     165      switch (fPartId)
     166      {
     167      case kGAMMA:    return "\\gamma";
     168      case kPOSITRON: return "e^{+}";
     169      case kELECTRON: return "e^{-}";
     170      case kANTIMUON: return "\\mu^{+}";
     171      case kMUON:     return "\\mu^{-}";
     172      case kPI0:      return "\\pi^{0}";
     173      case kNEUTRON:  return "n";
     174      case kPROTON:   return "p";
     175      case kHELIUM:   return "He";
     176      case kOXYGEN:   return "O";
     177      case kIRON:     return "Fe";
     178      }
     179
     180      return Form("Id:%d", fPartId);
    154181  }
    155182  TString GetEnergyStr() const
Note: See TracChangeset for help on using the changeset viewer.