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

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