Index: trunk/MagicSoft/Mars/datacenter/db/mcdefs.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/mcdefs.php	(revision 9498)
+++ trunk/MagicSoft/Mars/datacenter/db/mcdefs.php	(revision 9599)
@@ -1,15 +1,11 @@
 <?php
-
-$needs = array
-    (
-     "fCorsikaInputCreated" => "MCRunProcessStatus.fMCRunNumber",
-     "fCorsikaFileAvail"    => "MCRunProcessStatus.fCorsikaInputCreated",
-     );
-
 
 $timelimits = array
     (
-     "fCorsikaInputCreated" => "1",
-     "fCorsikaFileAvail"    => "60",
+     "Corsika" => "60",
+     "Ceres" => "1",
+     "SequenceFile" => "1",
+     "Callisto" => "1",
+     "Star" => "1",
      );
 
@@ -18,4 +14,5 @@
     (
      "fParticleTypeName"                 => CheckWhere("fParticleTypeKEY"),
+     "fRunTypeName"                      => CheckWhere("fRunTypeKEY"),
      "fAtmosphericModelName"             => CheckWhere("fAtmosphericModelKEY"),
     );
@@ -24,4 +21,5 @@
     (
      "fParticleTypeName"                 => CheckGroup("fParticleTypeKEY"),
+     "fRunTypeName"                      => CheckGroup("fRunTypeKEY"),
      "fAtmosphericModelName"             => CheckGroup("fAtmosphericModelKEY"),
     );
@@ -30,6 +28,9 @@
 $checkstatusgroup = array
     (
-     "fCorsikaInputCreated" => CheckStatusGroup("fCorsikaInputCreatedStatus"),
-     "fCorsikaFileAvail" => CheckStatusGroup("fCorsikaFileAvailStatus"),
+     "Corsika"      => CheckStatusGroup("Corsika"),
+     "Ceres"        => CheckStatusGroup("Ceres"),
+     "SequenceFile" => CheckStatusGroup("SequenceFile"),
+     "Callisto"     => CheckStatusGroup("Callisto"),
+     "Star"         => CheckStatusGroup("Star"),
     );
 
@@ -38,30 +39,33 @@
 $alias = array
     (
-//     "fRunNumber"                       => "Run#",
-     "Run#"                    => "Run#",
-     "fNumEvents"              => "#Evts",
-     "SUM(fNumEvents)"         => "Evts",
-     "fParticleTypeName"       => "Particle",
-     "fAtmosphericModelName"   => "Atm.Model",
-     "fCorsikaInputCreated"    => "Input",
-     "fCorsikaFileAvail"       => "Corsika",
-     "fStartTime"              => "Process",
-     "fFailedTime"             => "Failed",
-     "fReturnCode"             => "Ret<br>Code",
-     "fProgramId"              => "Prgr<br>Id",
-     "fZenithDistanceMin"      => "Zd<br>Min",
-     "fZenithDistanceMax"      => "Zd<br>Max",
-     "fAzimuthMin"             => "Az<br>Min",
-     "fAzimuthMax"             => "Az<br>Max",
-     "Min(fZenithDistanceMin)" => "ZDMin",
-     "Max(fZenithDistanceMax)" => "ZDMax",
-     "fEnergyMin"              => "EMin<br>[GeV]",
-     "fEnergyMax"              => "EMax<br>[GeV]",
-     "fImpactMax"              => "Impact<br>[cm]",
-     "fViewConeMax"            => "View<br>cone<br>[deg]",
-     "fEnergySlope"            => "Slope",
-     "fNumReUseShower"         => "#ShowerReUse",
-     "fStartingAltitude"       => "Altitude<br>[g/sqcm]",
-     "fMirrorDiameter"         => "Mirror<br>diam.<br>[cm]",
+     "Run.File"                 => "Run.File",
+     "fNumEvents"               => "#Evts",
+     "SUM(fNumEvents)"          => "Evts",
+     "fParticleTypeName"        => "Particle",
+     "fRunTypeName"             => "RunType",
+     "fAtmosphericModelName"    => "Atm.Model",
+     "fCorsikaInputCreated"     => "Input",
+     "Corsika"                  => "Corsika",
+     "Ceres"                    => "Ceres",
+     "SequenceFile"             => "SequenceFile",
+     "Callisto"                 => "Callisto",
+     "Star"                     => "Star",
+     "fStartTime"               => "Process",
+     "fFailedTime"              => "Failed",
+     "fReturnCode"              => "Ret<br>Code",
+     "fProgramId"               => "Prgr<br>Id",
+     "fZenithDistanceMin"       => "Zd<br>Min",
+     "fZenithDistanceMax"       => "Zd<br>Max",
+     "fAzimuthMin"              => "Az<br>Min",
+     "fAzimuthMax"              => "Az<br>Max",
+     "Min(fZenithDistanceMin)"  => "ZDMin",
+     "Max(fZenithDistanceMax)"  => "ZDMax",
+     "fEnergyMin"               => "EMin<br>[GeV]",
+     "fEnergyMax"               => "EMax<br>[GeV]",
+     "fImpactMax"               => "Impact<br>[cm]",
+     "fViewConeMax"             => "View<br>cone<br>[deg]",
+     "fEnergySlope"             => "Slope",
+     "fStartingAltitude"        => "Altitude<br>[g/sqcm]",
+     "fMirrorDiameter"          => "Mirror<br>diam.<br>[cm]",
     );
 
@@ -80,5 +84,4 @@
      $alias["fViewConeMax"]              => "1",
      $alias["fEnergySlope"]              => "1",
-     $alias["fNumReUseShower"]           => "1",
      $alias["fStartingAltitude"]         => "1",
      $alias["fMirrorDiameter"]           => "1",
@@ -92,6 +95,7 @@
     $checks = array
         (
-         "fParticleTypeName"         => $fromtable . ".fParticleTypeKEY",
-         "fAtmosphericModelName"     => $fromtable . ".fAtmosphericModelKEY",
+         "fParticleTypeName"         => "ParticleType.fParticleTypeKEY",
+         "fRunTypeName"              => "RunType.fRunTypeKEY",
+         "fAtmosphericModelName"     => "AtmosphericModel.fAtmosphericModelKEY",
         );
 
@@ -117,17 +121,17 @@
          "fProgramId"                        => "fProgramId",
          "fParticleTypeName"                 => "ParticleType.fParticleTypeName",
+         "fRunTypeName"                      => "RunType.fRunTypeName",
          "fAtmosphericModelName"             => "AtmosphericModel.fAtmosphericModelName",
-         "fAzimuthMin"                       => $fromtable . ".fAzimuthMin",
-         "fAzimuthMax"                       => $fromtable . ".fAzimuthMax",
-         "fZenithDistanceMin"                => $fromtable . ".fZenithDistanceMin",
-         "fZenithDistanceMax"                => $fromtable . ".fZenithDistanceMax",
-         "fEnergyMin"                        => $fromtable . ".fEnergyMin",
-         "fEnergyMax"                        => $fromtable . ".fEnergyMax",
-         "fImpactMax"                        => $fromtable . ".fImpactMax",
-         "fViewConeMax"                      => $fromtable . ".fViewConeMax",
-         "fEnergySlope"                      => $fromtable . ".fEnergySlope",
-         "fNumReUseShower"                   => $fromtable . ".fNumReUseShower",
-         "fStartingAltitude"                 => $fromtable . ".fStartingAltitude",
-         "fMirrorDiameter"                   => $fromtable . ".fMirrorDiameter",
+         "fAzimuthMin"                       => "CorsikaInfo.fAzimuthMin",
+         "fAzimuthMax"                       => "CorsikaInfo.fAzimuthMax",
+         "fZenithDistanceMin"                => "CorsikaInfo.fZenithDistanceMin",
+         "fZenithDistanceMax"                => "CorsikaInfo.fZenithDistanceMax",
+         "fEnergyMin"                        => "CorsikaInfo.fEnergyMin",
+         "fEnergyMax"                        => "CorsikaInfo.fEnergyMax",
+         "fImpactMax"                        => "CorsikaInfo.fImpactMax",
+         "fViewConeMax"                      => "CorsikaInfo.fViewConeMax",
+         "fEnergySlope"                      => "CorsikaInfo.fEnergySlope",
+         "fStartingAltitude"                 => "CorsikaInfo.fStartingAltitude",
+         "fMirrorDiameter"                   => "CorsikaInfo.fMirrorDiameter",
          "Min(fZenithDistanceMin)"           => "'ZDMin'",
          "Max(fZenithDistanceMax)"           => "'ZDMax'",
@@ -137,6 +141,6 @@
     if (!empty($tables[$val]))
         $table=$tables[$val];
-    if ($val=="Tel:Run/File")
-        $table="'Tel:Run/File'";
+    if ($val=="Run.File")
+        $table="'Run.File'";
     if ($val=="Tel:Sequ")
         $table="CONCAT('M', Sequences.fTelescopeNumber, ':', LPAD(Sequences.fSequenceFirst, 8, '0'))";
@@ -147,4 +151,6 @@
     if ($val=="NumDS")
         $table="'# Datasets'";
+    if ($val=="# Files")
+        $table="'# Files'";
     if ($val=="NumDays")
         $table="'# days'";
@@ -160,5 +166,11 @@
         (
          "fParticleTypeName"           => " LEFT JOIN ParticleType         USING(fParticleTypeKEY) ",
+         "fRunTypeName"                => " LEFT JOIN RunType              USING(fRunTypeKEY) ",
          "fAtmosphericModelName"       => " LEFT JOIN AtmosphericModel     USING(fAtmosphericModelKEY) ",
+         "Corsika"                     => " LEFT JOIN CorsikaStatus        USING(fRunNumber, fFileNumber) ",
+         "Ceres"                       => " LEFT JOIN CeresStatus          USING(fRunNumber, fFileNumber, fCeresSetupKEY) ",
+         "SequenceFile"                => " LEFT JOIN SequenceFileStatus   USING(fSequenceNumber) ",
+         "Callisto"                    => " LEFT JOIN CallistoStatus       USING(fSequenceNumber, fCeresSetupKEY) ",
+         "Star"                        => " LEFT JOIN StarStatus           USING(fSequenceNumber, fCeresSetupKEY) ",
         );
 
