Index: trunk/MagicSoft/Mars/macros/readCT1.C
===================================================================
--- trunk/MagicSoft/Mars/macros/readCT1.C	(revision 689)
+++ trunk/MagicSoft/Mars/macros/readCT1.C	(revision 695)
@@ -1,44 +1,66 @@
 void readCT1()
 {
-    MParList  *plist = new MParList() ;
+    MParList plist;
 
-    MCT1ReadAscii *readct1 = new MCT1ReadAscii("CT1_99_on1.dat") ;
+    MGeomCamMagic camct1;
+    MHillas       hillas;
+    MTaskList     tlist;
 
-    if (!readct1->PreProcess(plist))
+    plist->AddToList(&camct1);
+    plist->AddToList(&hillas);
+    plist->AddToList(&tlist);
+
+    MCT1ReadAscii readct1("CT1_99_on1.dat") ;
+    MHillasCalc hcalc;
+
+    tlist.AddToList(&readct1);
+    tlist.AddToList(&hcalc);
+
+    MEvtLoop evtloop;
+    evtloop.SetParList(&plist);
+
+    if (!evtloop.PreProcess())
         return;
 
-    MCerPhotEvt *phevt = (MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
+    MCerPhotEvt &phevt = *(MCerPhotEvt*)plist->FindObject("MCerPhotEvt");
 
     Int_t icount = 0 ;
-    MCamDisplay display(0) ;
+    MCamDisplay display(&camct1) ;
 
-    while ( readct1->Process() )
+    while (readct1.Process())
     {
         cout << "Event: " << icount++  << endl  ;
 
-        if (icount >= 45 )
-        {
-            display->DrawPhotNum( phevt ) ;
+        if (icount < 45 )
+            continue;
 
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
+        display.DrawPhotNum(&phevt);
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
 
-            phevt->CleanLevel1() ;
-            phevt->CleanLevel2() ;
-            display->DrawPhotNum( phevt ) ;
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
+        phevt.CleanLevel1();
+        phevt.CleanLevel2();
+        display.DrawPhotNum(&phevt);
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
 
-            phevt->CleanLevel3() ;
+        phevt.CleanLevel3();
 
-            display->DrawPhotNum( phevt ) ;
-            gClient->HandleInput();
-            if(getchar()=='q')
-                break;
-        }
+        hcalc.Process();
+
+        hillas.Print();
+        hillas.Draw();
+
+        display.DrawPhotNum(&phevt);
+
+        gClient->HandleInput();
+        if(getchar()=='q')
+            break;
+
+        hillas.Clear();
     } 
 
-    readct1->PostProcess();
+    evtloop.PostProcess();
 }
