Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:58

0001 #!/usr/bin/perl
0002 
0003 use lib "./lib";
0004 
0005 use warnings;
0006 use strict;
0007 $|++;
0008 
0009 use ConnectionFile;
0010 use Getopt::Long;
0011 
0012 my $all = 0;
0013 my $printlist = 0;
0014 GetOptions('all' => \$all,
0015        'list' => \$printlist);
0016 
0017 my $list = {
0018         'HV' => \&define_HV,
0019         'LV' => \&define_LV,
0020         'ESS' => \&define_ESS,
0021         'PTM' => \&define_PTM,
0022         'LASER' => \&define_Laser,
0023         'MGPA' => \&define_MGPA,
0024         'CONSTRUCTION' => \&define_Construction,
0025         'XTALCALIB' => \&define_Xtal_Calibrations,
0026         'MONCALIB' => \&define_Monitoring_Calibrations
0027        };
0028 
0029 if ($printlist) {
0030   print "Valid conditions groups:\n";
0031   foreach (keys %{$list}) {
0032     print "\t$_\n";
0033   }
0034   exit;
0035 }
0036 
0037 if ($all) {
0038   @ARGV = keys %{$list};
0039 }
0040 
0041 die "No groups to define, exiting.\n" unless @ARGV;
0042 
0043 print "Connecting to DB...";
0044 my $condDB = ConnectionFile::connect();
0045 print "Done.\n";
0046 
0047 print "Defining conditions tables...\n";
0048 my $count = 0;
0049 foreach (@ARGV) {
0050   print "Defining conditions for group $_\n";
0051   my $sub = $list->{uc $_} || warn "$_ not defined\n";
0052   &{$sub}();
0053   $count++;
0054 }
0055 print "Done.  $count groups defined\n";
0056 
0057 ###
0058 ###   HV
0059 ###
0060 sub define_HV {
0061   print "\tHV_vMon\n";
0062   $condDB->new_cond_type(-name=>"HV_vMon",
0063              -description=>"The high voltage, monitored value",
0064              -units=>"volts",
0065              -datatype=>"float",
0066              -hasError=>0);
0067 
0068   print "\tHV_v0\n";
0069   $condDB->new_cond_type(-name=>"HV_v0",
0070              -description=>"The high voltage, set value",
0071              -units=>"volts",
0072              -datatype=>"float",
0073              -hasError=>0);
0074 
0075   print "\tHV_iMon\n";
0076   $condDB->new_cond_type(-name=>"HV_iMon",
0077              -description=>"The high voltage current, monitored value",
0078              -units=>"amperes",
0079              -datatype=>"float",
0080              -hasError=>0);
0081 
0082   print "\tHV_vMon\n";
0083   $condDB->new_cond_type(-name=>"HV_i0",
0084              -description=>"The high voltage current, set value",
0085              -units=>"amperes",
0086              -datatype=>"float",
0087              -hasError=>0);
0088 
0089   print "\tHV_status\n";
0090   $condDB->new_cond_type(-name=>"HV_status",
0091              -description=>"The high voltage status string",
0092              -units=>undef,
0093              -datatype=>"string",
0094              -hasError=>0);
0095 
0096   print "\tHV_T_board\n";
0097   $condDB->new_cond_type(-name=>"HV_T_board",
0098              -description=>"The high voltage board temperature",
0099              -units=>"degrees C",
0100              -datatype=>"float",
0101              -hasError=>0);
0102 }
0103 
0104 ###
0105 ###   Low Voltage
0106 ###
0107 
0108 sub define_LV {
0109   print "\tLV_vMon\n";
0110   $condDB->new_cond_type(-name=>"LV_vMon",
0111              -description=>"The low voltage, monitored value",
0112              -units=>"volts",
0113              -datatype=>"float",
0114              -hasError=>0);
0115 
0116   print "\tLV_outReg\n";
0117   $condDB->new_cond_type(-name=>"LV_outReg",
0118              -description=>"The low voltage ???",
0119              -units=>"???",
0120              -datatype=>"float",
0121              -hasError=>0);
0122 
0123   print "\tLV_iMon\n";
0124   $condDB->new_cond_type(-name=>"LV_iMon",
0125              -description=>"The low voltage current, monitored value",
0126              -units=>"amperes",
0127              -datatype=>"float",
0128              -hasError=>0);
0129 }
0130 
0131 ###
0132 ###   ESS
0133 ###
0134 sub define_ESS {
0135   print "\tESS_temp\n";
0136   $condDB->new_cond_type(-name=>"ESS_temp",
0137              -description=>"ESS temperature",
0138              -units=>"deg C",
0139              -datatype=>"float",
0140              -hasError=>0);
0141 
0142   print "\tESS_WLD\n";
0143   $condDB->new_cond_type(-name=>"ESS_WLD",
0144              -description=>"ESS WLD ???",
0145              -units=>"???",
0146              -datatype=>"float",
0147              -hasError=>0);
0148 }
0149 
0150 ###
0151 ###   PTM
0152 ###
0153 
0154 sub define_PTM {
0155   print "\tPTM_H\n";
0156   $condDB->new_cond_type(-name=>"PTM_H",
0157              -description=>"Humidity sensors on the modules",
0158              -units=>"???",
0159              -datatype=>"float",
0160              -hasError=>0);
0161 
0162   print "\tPTM_H_amb\n";
0163   $condDB->new_cond_type(-name=>"PTM_H_amb",
0164              -description=>"Ambient humidity",
0165              -units=>"???",
0166              -datatype=>"float",
0167              -hasError=>0);
0168 
0169   print "\tPTM_T_amb\n";
0170   $condDB->new_cond_type(-name=>"PTM_T_amb",
0171              -description=>"Ambient temperature",
0172              -units=>"deg C",
0173              -datatype=>"float",
0174              -hasError=>0);
0175 
0176   print "\tPTM_T_grid\n";
0177   $condDB->new_cond_type(-name=>"PTM_T_grid",
0178              -description=>"Module grid temperature",
0179              -units=>"deg C",
0180              -datatype=>"float",
0181              -hasError=>0);
0182 
0183   print "\tPTM_T_screen\n";
0184   $condDB->new_cond_type(-name=>"PTM_T_screen",
0185              -description=>"Module screen temperature",
0186              -units=>"deg C",
0187              -datatype=>"float",
0188              -hasError=>0);
0189 
0190   print "\tPTM_T_water_in\n";
0191   $condDB->new_cond_type(-name=>"PTM_T_water_in",
0192              -description=>"Super-module water in temperature",
0193              -units=>"deg C",
0194              -datatype=>"float",
0195              -hasError=>0);
0196 
0197   print "\tPTM_T_water_out\n";
0198   $condDB->new_cond_type(-name=>"PTM_T_water_out",
0199              -description=>"Super-module water out temperature",
0200              -units=>"deg C",
0201              -datatype=>"float",
0202              -hasError=>0);
0203 }
0204 
0205 
0206 ###
0207 ###   Laser
0208 ###
0209 
0210 sub define_Laser {
0211   foreach my $color (qw/red green blue/) {
0212     print "\tLaser_PN_ratio_$color\n";
0213     $condDB->new_cond_type(-name=>"Laser_PN_ratio_$color",
0214                -description=>"The PN ratio to describe the stability of the $color laser",
0215                -units=>"???",
0216                -datatype=>"float",
0217                -hasError=>1);
0218   }
0219 
0220 # foreach my $color (qw/red green blue/) {
0221 #   print "\tLaser_pulse_max_laser_ref_$color\n";
0222 #   $condDB->new_cond_type(-name=>"Laser_pulse_max_laser_ref_$color",
0223 #            -description=>"Laser pulse max laser/ref, $color laser",
0224 #            -units=>"???",
0225 #            -datatype=>"float",
0226 #            -hasError=>1);
0227 
0228 
0229 #   print "\tLaser_pulse_max_laser_pin_$color\n";
0230 #   $condDB->new_cond_type(-name=>"Laser_pulse_max_laser_pin_$color",
0231 #            -description=>"Laser pulse max laser/pin, $color laser",
0232 #            -units=>"???",
0233 #            -datatype=>"float",
0234 #            -hasError=>1);
0235 # }
0236 
0237   print "\tLaser_pulse_fit_params\n";
0238   $condDB->new_cond_type(-name=>"Laser_pulse_fit_params",
0239              -description=>"Laser pulse fit parameters 0-3",
0240              -units=>"???",
0241              -datatype=>"float",
0242              -datasize=>4,
0243              -hasError=>1);
0244 
0245   foreach my $color (qw/red green blue/) {
0246     print "\tLaser_corr_$color\n";
0247     $condDB->new_cond_type(-name=>"Laser_corr_$color",
0248                -description=>"Laser monitoring calculated correction,  $color laser",
0249                -units=>"???",
0250                -datatype=>"float",
0251                -hasError=>1);
0252   }
0253 
0254   foreach my $color (qw/red green blue/) {
0255     print "\tLaser_width_$color\n";
0256     $condDB->new_cond_type(-name=>"Laser_width_$color",
0257                -description=>"The width of the laser pulse measured with MATACQ",
0258                -units=>"???",
0259                -datatype=>"float",
0260                -hasError=>0);
0261   }
0262 
0263   print "\tLaser_test_pulse\n";
0264   $condDB->new_cond_type(-name=>"Laser_test_pulse",
0265              -description=>"The test pulse amplitude",
0266              -units=>"???",
0267              -datatype=>"float",
0268              -hasError=>0);
0269 }
0270 
0271 ###
0272 ###   MGPA
0273 ###
0274 sub define_MGPA {
0275   print "\tMGPA_gain_intercal_g12g6\n";
0276   $condDB->new_cond_type(-name=>"MGPA_gain_intercal_g12g6",
0277              -description=>"Values of the relative gain ".
0278              "calibration of the MGPA, gain 12 / ".
0279              "gain 6",
0280              -units=>"???",
0281              -datatype=>"float",
0282              -hasError=>0);
0283 
0284   print "\tMGPA_gain_intercal_g6g1\n";
0285   $condDB->new_cond_type(-name=>"MGPA_gain_intercal_g6g1",
0286              -description=>"Values of the relative gain ".
0287              "calibration of the MGPA, gain 6 / ".
0288              "gain 1",
0289              -units=>"???",
0290              -datatype=>"float",
0291              -hasError=>0);
0292 }
0293 
0294 ###
0295 ###   DCU
0296 ###
0297 # For the test beam 2004 data only
0298 sub define_DCU {
0299   print "\tDCU_capsule_temp\n";
0300   $condDB->new_cond_type(-name=>"DCU_capsule_temp",
0301              -description=>"From the capsule thermister",
0302              -units=>"deg C",
0303              -datatype=>"float",
0304              -hasErrors=>"0");
0305 }
0306 
0307 ###
0308 ###   Coefficients from the Construction DB
0309 ###
0310 sub define_Construction {
0311   print "\tAPD_T_coeff\n";
0312   $condDB->new_cond_type(-name=>"APD_T_coeff",
0313              -description=>"1/M dM/dT",
0314              -units=>"1/deg C",
0315              -datatype=>"float",
0316              -hasError=>0);
0317 
0318   print "\tAPD_V_coeff\n";
0319   $condDB->new_cond_type(-name=>"APD_V_coeff",
0320              -description=>"(1/M)(dM/dV) for the capsule attached to the crystal",
0321              -units=>"1/V",
0322              -datatype=>"float",
0323              -hasError=>0);
0324 
0325   print "\tXtal_T_coeff\n";
0326   $condDB->new_cond_type(-name=>"Xtal_T_coeff",
0327              -description=>"Temperature coefficient of the crystal",
0328              -units=>"value/degrees C",
0329              -datatype=>"float",
0330              -hasError=>0);
0331 
0332   print "\tXtal_alpha\n";
0333   $condDB->new_cond_type(-name=>"Xtal_alpha",
0334              -description=>"The alpha coefficients due to irradiation of the crystal",
0335              -units=>"???",
0336              -datatype=>"float",
0337              -hasError=>0);
0338 }
0339 
0340 ###
0341 ###   Crystal Calibration sets
0342 ###
0343 sub define_Xtal_Calibrations {
0344   print "\tXtal_intercal_lab\n";
0345   $condDB->new_cond_type(-name=>"Xtal_intercal_lab",
0346              -description=>"Calibration constant from lab measurements",
0347              -units=>"???",
0348              -datatype=>"float",
0349              -hasError=>0);
0350 
0351   print "\tXtal_intercal_milano\n";
0352   $condDB->new_cond_type(-name=>"Xtal_intercal_milano",
0353              -description=>"Calibration constant from lab measurements, Milano group",
0354              -units=>"???",
0355              -datatype=>"float",
0356              -hasError=>0);
0357 }
0358 
0359 
0360 ###
0361 ###   Other Calibrations, corrections
0362 ###
0363 sub define_Monitoring_Calibrations {
0364   print "\tPN_lin_corr_g16\n";
0365   $condDB->new_cond_type(-name=>"PN_lin_corr_g16",
0366              -description=>"Linearity corrections for MGPA gain 16 PN diodes responses",
0367              -units=>"???",
0368              -datatype=>"float",
0369              -datasize=>3,
0370              -hasError=>0);
0371 
0372   print "\tPN_lin_corr_g1\n";
0373   $condDB->new_cond_type(-name=>"PN_lin_corr_g1",
0374              -description=>"Linearity corrections for MGPA gain 1 PN diodes responses",
0375              -units=>"???",
0376              -datatype=>"float",
0377              -datasize=>3,
0378              -hasError=>0);
0379 
0380   foreach my $gain (qw/1 6 12/) {
0381     print "\tAPD_lin_corr_g${gain}\n";
0382     $condDB->new_cond_type(-name=>"APD_lin_corr_g${gain}",
0383                -description=>"Linearity corrections for APD diode response with MGPA gain $gain",
0384                -units=>"???",
0385                -datatype=>"float",
0386                -datasize=>3,
0387                -hasError=>0);
0388   }
0389 }