source: trunk/Mars/datacenter/db/mcdefs.php@ 9872

Last change on this file since 9872 was 9617, checked in by Daniela Dorner, 14 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 7.4 KB
Line 
1<?php
2
3$timelimits = array
4 (
5 "Corsika" => "60",
6 "Ceres" => "2",
7 "SequenceFile" => "1",
8 "Callisto" => "1",
9 "Star" => "1",
10 );
11
12
13$checkwhere = array
14 (
15 "fParticleTypeName" => CheckWhere("fParticleTypeKEY"),
16 "fRunTypeName" => CheckWhere("fRunTypeKEY"),
17 "fAtmosphericModelName" => CheckWhere("fAtmosphericModelKEY"),
18 );
19
20$checkgroup = array
21 (
22 "fParticleTypeName" => CheckGroup("fParticleTypeKEY"),
23 "fRunTypeName" => CheckGroup("fRunTypeKEY"),
24 "fAtmosphericModelName" => CheckGroup("fAtmosphericModelKEY"),
25 );
26
27
28$checkstatusgroup = array
29 (
30 "Corsika" => CheckStatusGroup("Corsika"),
31 "Ceres" => CheckStatusGroup("Ceres"),
32 "SequenceFile" => CheckStatusGroup("SequenceFile"),
33 "Callisto" => CheckStatusGroup("Callisto"),
34 "Star" => CheckStatusGroup("Star"),
35 );
36
37
38
39$alias = array
40 (
41 "Run.File" => "Run.File",
42 "fSequenceNumber" => "Sequ",
43 "fNumEvents" => "#Evts",
44 "SUM(fNumEvents)" => "Evts",
45 "fParticleTypeName" => "Particle",
46 "fRunTypeName" => "RunType",
47 "fAtmosphericModelName" => "Atm.Model",
48 "fCorsikaInputCreated" => "Input",
49 "Corsika" => "Corsika",
50 "Ceres" => "Ceres",
51 "SequenceFile" => "SequenceFile",
52 "Callisto" => "Callisto",
53 "Star" => "Star",
54 "fZenithDistanceMin" => "Zd<br>Min",
55 "fZenithDistanceMax" => "Zd<br>Max",
56 "fAzimuthMin" => "Az<br>Min",
57 "fAzimuthMax" => "Az<br>Max",
58 "Min(fZenithDistanceMin)" => "ZDMin",
59 "Max(fZenithDistanceMax)" => "ZDMax",
60 "fEnergyMin" => "EMin<br>[GeV]",
61 "fEnergyMax" => "EMax<br>[GeV]",
62 "fImpactMax" => "Impact<br>[cm]",
63 "fViewConeMax" => "View<br>cone<br>[deg]",
64 "fEnergySlope" => "Slope",
65 "fStartingAltitude" => "Altitude<br>[g/sqcm]",
66 "fMirrorDiameter" => "Mirror<br>diam.<br>[cm]",
67 );
68
69
70$rightalign = array
71 (
72 $alias["fSequenceNumber"] => "1",
73 $alias["fNumEvents"] => "1",
74 $alias["fZenithDistanceMin"] => "1",
75 $alias["fZenithDistanceMax"] => "1",
76 $alias["fAzimuthMin"] => "1",
77 $alias["fAzimuthMax"] => "1",
78 $alias["fEnergyMin"] => "1",
79 $alias["fEnergyMax"] => "1",
80 $alias["fImpactMax"] => "1",
81 $alias["fViewConeMax"] => "1",
82 $alias["fEnergySlope"] => "1",
83 $alias["fStartingAltitude"] => "1",
84 $alias["fMirrorDiameter"] => "1",
85 "Time" => "1",
86 "Runs" => "1",
87 "Evts" => "1",
88);
89
90function GetCheck($fromtable, $val)
91{
92 $checks = array
93 (
94 "fParticleTypeName" => "ParticleType.fParticleTypeKEY",
95 "fRunTypeName" => "RunType.fRunTypeKEY",
96 "fAtmosphericModelName" => "AtmosphericModel.fAtmosphericModelKEY",
97 );
98
99 $check="";
100 if (!empty($checks[$val]))
101 $check=$checks[$val];
102 return $check;
103}
104
105
106function GetTable($fromtable, $val)
107{
108 $tables = array
109 (
110 "fNumEvents" => "CorsikaInfo.fNumEvents",
111 "fMCRunNumber" => "MCCorsikaRunData.fMCRunNumber",
112 "fRawFileAvail" => "RunProcessStatus.fRawFileAvail",
113 "SUM(fRunTime)/3600" => "'Time [h]'",
114 "SUM(fNumEvents)" => "'Evts'",
115 "fParticleTypeName" => "ParticleType.fParticleTypeName",
116 "fRunTypeName" => "RunType.fRunTypeName",
117 "fAtmosphericModelName" => "AtmosphericModel.fAtmosphericModelName",
118 "fAzimuthMin" => "CorsikaInfo.fAzimuthMin",
119 "fAzimuthMax" => "CorsikaInfo.fAzimuthMax",
120 "fZenithDistanceMin" => "CorsikaInfo.fZenithDistanceMin",
121 "fZenithDistanceMax" => "CorsikaInfo.fZenithDistanceMax",
122 "fEnergyMin" => "CorsikaInfo.fEnergyMin",
123 "fEnergyMax" => "CorsikaInfo.fEnergyMax",
124 "fImpactMax" => "CorsikaInfo.fImpactMax",
125 "fViewConeMax" => "CorsikaInfo.fViewConeMax",
126 "fEnergySlope" => "CorsikaInfo.fEnergySlope",
127 "fStartingAltitude" => "CorsikaInfo.fStartingAltitude",
128 "fMirrorDiameter" => "CorsikaInfo.fMirrorDiameter",
129 "Min(fZenithDistanceMin)" => "'ZDMin'",
130 "Max(fZenithDistanceMax)" => "'ZDMax'",
131 );
132
133 $table="";
134 if (!empty($tables[$val]))
135 $table=$tables[$val];
136 if ($val=="Run.File")
137 $table="'Run.File'";
138 if ($val=="Tel:Sequ")
139 $table="CONCAT('M', Sequences.fTelescopeNumber, ':', LPAD(Sequences.fSequenceFirst, 8, '0'))";
140 if ($val=="NumRuns")
141 $table="'# Runs'";
142 if ($val=="NumSequ")
143 $table="'# Sequ'";
144 if ($val=="NumDS")
145 $table="'# Datasets'";
146 if ($val=="# Files")
147 $table="'# Files'";
148 if ($val=="NumDays")
149 $table="'# days'";
150 if (empty($table))
151 $table=$val;
152 return $table;
153}
154
155
156function GetJoin($fromtable, $val)
157{
158 $joins = array
159 (
160 "fParticleTypeKEY" => " LEFT JOIN ParticleType USING(fParticleTypeKEY) ",
161 "fRunTypeKEY" => " LEFT JOIN RunType USING(fRunTypeKEY) ",
162 "fAtmosphericModelKEY" => " LEFT JOIN AtmosphericModel USING(fAtmosphericModelKEY) ",
163 "fParticleTypeName" => " LEFT JOIN ParticleType USING(fParticleTypeKEY) ",
164 "fRunTypeName" => " LEFT JOIN RunType USING(fRunTypeKEY) ",
165 "fAtmosphericModelName" => " LEFT JOIN AtmosphericModel USING(fAtmosphericModelKEY) ",
166 "CorsikaStatus" => " LEFT JOIN CorsikaStatus USING(fRunNumber, fFileNumber) ",
167 "CeresStatus" => " LEFT JOIN CeresStatus USING(fRunNumber, fFileNumber, fCeresSetupKEY) ",
168 "SequenceFileStatus" => " LEFT JOIN SequenceFileStatus USING(fSequenceNumber) ",
169 "CallistoStatus" => " LEFT JOIN CallistoStatus USING(fSequenceNumber, fCeresSetupKEY) ",
170 "StarStatus" => " LEFT JOIN StarStatus USING(fSequenceNumber, fCeresSetupKEY) ",
171 "Corsika" => " LEFT JOIN CorsikaStatus USING(fRunNumber, fFileNumber) ",
172 "Ceres" => " LEFT JOIN CeresStatus USING(fRunNumber, fFileNumber, fCeresSetupKEY) ",
173 "SequenceFile" => " LEFT JOIN SequenceFileStatus USING(fSequenceNumber) ",
174 "Callisto" => " LEFT JOIN CallistoStatus USING(fSequenceNumber, fCeresSetupKEY) ",
175 "Star" => " LEFT JOIN StarStatus USING(fSequenceNumber, fCeresSetupKEY) ",
176 );
177
178
179 $join="";
180 if (!empty($joins[$val]))
181 $join=$joins[$val];
182 return $join;
183}
184
185
186?>
Note: See TracBrowser for help on using the repository browser.