Ignore:
Timestamp:
01/18/05 10:53:10 (20 years ago)
Author:
rico
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mtemp/mifae
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/Changelog

    r5775 r5879  
    1919                                                 -*-*- END OF LINE -*-*-
    2020
     21 2005/01/18 Javier Rico & Markus Gaug
     22    * programs/controlPlot.cc, programs/controlplot.datacard,
     23      programs/Makefile
     24     - correct bugs: cuts in the proper units; separate ON and OFF
     25       task lists since before it was reading who knows what
     26    * library/MControlPlots.[h,cc]
     27     - add Clear() method and remove some (minor) memory leaks
     28    * library/MIslands.cc
     29     - place call to SetOwner() in the correct place
     30       
    2131 2005/01/10 Javier Rico
    2232    * programs/makeHillas, programs/makehillas.datacard
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MControlPlots.cc

    r5379 r5879  
    6363    fCameraHisto[kOn] = NULL;
    6464    fCameraHisto[kOff] = NULL;
     65
    6566}
    6667// -------------------------------------------------------------------------
     
    7071MControlPlots::~MControlPlots()
    7172{
    72   if(fGeomCam)
    73     delete fGeomCam;
     73  Clear();
    7474
    7575  if(fCameraHisto[kOn])
     
    7979}
    8080
     81void MControlPlots::Clear(const Option_t *o)
     82{
     83
     84  if(fGeomCam)
     85    delete fGeomCam;
     86
     87  fGeomCam = NULL;
     88}
     89
    8190
    8291// -------------------------------------------------------------------------
     
    8695Int_t MControlPlots::PreProcess(MParList* pList)
    8796{
     97
     98  Reset();
     99
    88100  // FIXME! only valid for Magic geometry for the time being!
    89101  fGeomCam = new MGeomCamMagic;
     
    94106    *fLog << warn << AddSerialNumber("MIslands") << " [MIslands] not found... Some control plots will not be produced" << endl;
    95107  else
    96     fCameraHisto[fMode] = new MHCamera(*fGeomCam,"Survive","Pixels surviving Image Cleaning");
     108    { 
     109      if (fCameraHisto[fMode])
     110        {
     111          *fLog << err << GetDescriptor()
     112                << "Camera with mode " << fMode << " already existing " << endl;
     113          return kFALSE;
     114        }
     115      TString name = "";
     116      switch (fMode)
     117        {
     118        case kOn:
     119          name += "On";
     120          break;
     121        case kOff:
     122          name += "Off";
     123          break;
     124        }
     125      fCameraHisto[fMode] = new MHCamera(*fGeomCam,
     126                                         name.Data(),
     127                                         "Pixels surviving Image Cleaning");
     128    }
    97129  return kTRUE;
    98130}
     
    105137  if(!fIslands) return kTRUE;
    106138
    107   MImgIsland *imgIsl = new MImgIsland;
     139  MImgIsland *imgIsl = NULL;
    108140  TIter Next(fIslands->GetList());
    109141 
     
    111143  Int_t idPix = -1;
    112144 
    113   while ((imgIsl=(MImgIsland*)Next())) {
    114 
    115     pixNum = imgIsl->GetPixNum();
    116    
    117     for(Int_t k = 0; k<pixNum; k++)
    118       {
    119         idPix = imgIsl->GetPixList(k);
    120         fCameraHisto[fMode]->Fill(idPix,1);
    121         fCameraHisto[fMode]->SetUsed(idPix);
    122       }
    123   }
     145  while ((imgIsl=(MImgIsland*)Next()))
     146    {
     147      pixNum = imgIsl->GetPixNum();
     148     
     149      for(Int_t k = 0; k<pixNum; k++)
     150        {
     151          idPix = imgIsl->GetPixList(k);
     152          fCameraHisto[fMode]->Fill(idPix,1.);
     153          fCameraHisto[fMode]->SetUsed(idPix);
     154        }
     155    }
    124156
    125157  /*  for (UInt_t i=0;i<fGeomCam->GetNumPixels();i++)
     
    142174Int_t MControlPlots::PostProcess()
    143175{
    144   fCameraHisto[fMode]->SetEntries(fGeomCam->GetNumPixels());
    145 
    146176  if(!fProduceFile) return kTRUE;
    147177  if(fProduceFile && !fFileName.Length())
     
    165195  if(fCameraHisto[kOn] && fCameraHisto[kOff])
    166196    {     
    167       diff = new MHCamera(*fGeomCam,"Diff","Pixels surviving Image Cleaning");
     197      diff = new MHCamera(*fGeomCam,"Diff","Difference of pixels surviving Image Cleaning");
    168198
    169199      // Normalize Off to On
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MControlPlots.h

    r5170 r5879  
    1515{
    1616 public:
    17   enum OnOffMode_t {kOn=0,kOff};
     17  enum OnOffMode_t {kOn=0,kOff=1};
    1818 
    1919 private:
     
    3434  virtual ~MControlPlots();
    3535
     36  void Reset() { Clear(); }
     37  void Clear(const Option_t *o="");
     38
    3639  void SetFilename(TString fname)           {fFileName=fname;}
    3740  void SetMode(OnOffMode_t mode)            {fMode=mode;}
  • trunk/MagicSoft/Mars/mtemp/mifae/library/MIslands.cc

    r5186 r5879  
    2424
    2525    fIslands = new TList;
    26    
     26    fIslands->SetOwner();   
    2727}
    2828
     
    3333MIslands::~MIslands()
    3434{
    35    fIslands->SetOwner();
    3635   fIslands->Delete();
    3736}
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/Makefile

    r5775 r5879  
    1818include ../../../Makefile.conf.general
    1919
    20 PROGRAMS = makeHillas
     20PROGRAMS = makeHillas controlPlot
    2121#psffit falseSource srcPos optimizeCuts  controlPlot
    2222SOLIB    = $(MARSSYS)/libmars.so
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/controlPlot.cc

    r4395 r5879  
    6464//-----------------------------------------------------------------------------
    6565
    66 const TString defaultcard="srcpos.datacard";
     66const TString defaultcard="controlplot.datacard";
    6767const Float_t conver   = 189./0.6; // conversion factor degrees to mm
    6868
     
    112112  // include containers in parameter list
    113113  plist.AddToList(&tlist);
    114   plist.AddToList(&islands);
    115114                 
    116115  MF cut(filter);
     
    127126  MControlPlots controlplots(outputFile);
    128127  controlplots.SetProduceFile(kFALSE);
     128  controlplots.SetMode(MControlPlots::kOn);
    129129 
    130130  MContinue applycutS(&cutS);
     
    157157  if(widthcut.Length())
    158158    tlist.AddToList(&applycutW);
     159  if(filter.Length())
     160    tlist.AddToList(&applycut);
    159161  if(centercut.Length())
    160162    tlist.AddToList(&applycutC);
    161   if(filter.Length())
    162     tlist.AddToList(&applycut);
    163163  tlist.AddToList(&controlplots);
    164164
     
    175175    return;
    176176
     177
     178  // containers
     179  MParList  plist2; 
     180  MTaskList tlist2;
     181  MIslands  islands2;
     182
     183  // include containers in parameter list
     184  plist2.AddToList(&tlist2);
     185                 
     186  // tasks
    177187  MReadTree read2("Parameters", offFile);
    178188  read2.DisableAutoScheme(); 
    179   tlist.AddToListBefore(&read2, &read, "All");
    180   tlist.RemoveFromList(&read);
     189  tlist2.AddToList(&read2);
    181190
    182191  controlplots.SetMode(MControlPlots::kOff);
    183192  controlplots.SetProduceFile(kTRUE);
    184 
    185   if (!evtloop.Eventloop(nmaxevents))
     193  controlplots.Reset();
     194
     195  // include tasks in task list
     196  if(sizecut.Length())
     197    tlist2.AddToList(&applycutS);
     198  if(distcut.Length())
     199    tlist2.AddToList(&applycutD);
     200  if(lengthcut.Length())
     201    tlist2.AddToList(&applycutL);
     202  if(widthcut.Length())
     203    tlist2.AddToList(&applycutW);
     204  if(filter.Length())
     205    tlist2.AddToList(&applycut);
     206  if(centercut.Length())
     207    tlist2.AddToList(&applycutC);
     208  tlist2.AddToList(&controlplots);
     209
     210  // Eventloop
     211  MEvtLoop evtloop2;
     212  evtloop2.SetParList(&plist2);
     213  if (!evtloop2.Eventloop(nmaxevents))
    186214    return; 
    187 
    188   tlist.PrintStatistics();
     215 
     216  tlist2.PrintStatistics();
     217 
     218  // do off-data if input file was specified
     219  if(!offFile.Length())
     220    return;
     221
    189222}
     223
    190224//-----------------------------------------------------------------------
    191225 
     
    268302          ifun >> ch;
    269303          distcut+=ch;
     304          distcut+="*";
     305          distcut+=conver;
    270306          distcut+=") && (MHillasSrc.fDist<";
    271307          ifun >> ch;
    272308          distcut+=ch;
     309          distcut+="*";
     310          distcut+=conver;
    273311          distcut+=")";
    274312        }
     
    281319          ifun >> ch;
    282320          widthcut+=ch;
     321          widthcut+="*";
     322          widthcut+=conver;
    283323          widthcut+=") && (MHillas.fWidth<";
    284324          ifun >> ch;
    285325          widthcut+=ch;
     326          widthcut+="*";
     327          widthcut+=conver;
    286328          widthcut+=")";
    287329        }
     
    294336          ifun >> ch;
    295337          lengthcut+=ch;
     338          lengthcut+="*";
     339          lengthcut+=conver;
    296340          lengthcut+=") && (MHillas.fLength<";
    297341          ifun >> ch;
    298342          lengthcut+=ch;
     343          lengthcut+="*";
     344          lengthcut+=conver;
    299345          lengthcut+=")";
    300346        }
     
    304350            cout << "readDataCards Warning: overriding existing center cut" << endl;
    305351          char ch[10];
    306           centercut="sqrt(MHillas.fMeanX*MHillas.fMeanX+MHillas.fMeanY*MHillas.fMeanY) < 0.00317*";
     352          centercut="sqrt(MHillas.fMeanX*MHillas.fMeanX+MHillas.fMeanY*MHillas.fMeanY)<";
    307353          ifun >> ch;
    308354          centercut+=ch;
     355          centercut+="*";
     356          centercut+=conver;
    309357        }
    310358    }
  • trunk/MagicSoft/Mars/mtemp/mifae/programs/controlplot.datacard

    r4395 r5879  
    11
    22// Maximun number of on and off events to be processed)
    3 NEVENTS 99999999
     3NEVENTS 9999
    44
    55// On-data file name pattern
    6 ONFILES  ./srcPosPrueba.root
     6ONFILES /mnt/users/jrico/magic/hillasCrab_200411_new.root
    77
    88// Off-data file name pattern
    9 OFFFILES ./srcPosOffPrueba.root
     9OFFFILES /mnt/users/jrico/magic/hillasCrab_200411_new.root
    1010
    1111// output file name
    12 HITSFILE  ./rotateprueba2.ps
     12HITSFILE  ./prueba.ps
    1313
    1414//////////
     
    1616//////////
    1717
    18 // Size cut (lower and upper) in # of photons
    19 SIZECUT   2000   9999999
     18// Size cut (lower and upper)
     19SIZECUT  0   9999999
    2020
    2121// Dist cut (lower and upper) in degrees
    22 DISTCUT   0.2   1.1
     22DISTCUT   0.2 1.2
    2323
    2424// Width cut (lower and upper) in degrees
    25 WIDTHCUT  0  0.12
     25WIDTHCUT  0  0.15
    2626
    2727// Length cut (lower and upper) in degrees
    28 LENGTHCUT  0  0.26
     28LENGTHCUT  0  0.25
    2929
    3030// maxX and maxY upper cut in degrees
    31 CENTERCUT  1.1
     31CENTERCUT  1.2
    3232
    3333// Other Additional cut
Note: See TracChangeset for help on using the changeset viewer.