Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:54

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         'TOKENRING' => \&define_Token_Ring
0028        };
0029 
0030 unless (@ARGV or $all) {
0031   $printlist = 1;
0032 }
0033 
0034 if ($printlist) {
0035   print "Specify one of the following conditions groups or --all at the command line:\n";
0036   foreach (keys %{$list}) {
0037     print "\t$_\n";
0038   }
0039   exit;
0040 }
0041 
0042 if ($all) {
0043   @ARGV = keys %{$list};
0044 }
0045 
0046 print "Connecting to DB...";
0047 my $condDB = ConnectionFile::connect();
0048 print "Done.\n";
0049 
0050 print "Defining conditions tables...\n";
0051 my $count = 0;
0052 foreach (@ARGV) {
0053   print "Defining conditions for group $_\n";
0054   my $sub = $list->{uc $_} || warn "$_ not defined\n";
0055   &{$sub}();
0056   $count++;
0057 }
0058 print "Done.  $count groups defined\n";
0059 
0060 ###
0061 ###   HV
0062 ###
0063 sub define_HV {
0064   print "\tHV_vMon\n";
0065   $condDB->new_cond_type(-name=>"HV_vMon",
0066              -description=>"The high voltage, monitored value",
0067              -units=>"volts",
0068              -datatype=>"float",
0069              -hasError=>0);
0070 
0071   print "\tHV_v0\n";
0072   $condDB->new_cond_type(-name=>"HV_v0",
0073              -description=>"The high voltage, set value",
0074              -units=>"volts",
0075              -datatype=>"float",
0076              -hasError=>0);
0077 
0078   print "\tHV_iMon\n";
0079   $condDB->new_cond_type(-name=>"HV_iMon",
0080              -description=>"The high voltage current, monitored value",
0081              -units=>"amperes",
0082              -datatype=>"float",
0083              -hasError=>0);
0084 
0085   print "\tHV_vMon\n";
0086   $condDB->new_cond_type(-name=>"HV_i0",
0087              -description=>"The high voltage current, set value",
0088              -units=>"amperes",
0089              -datatype=>"float",
0090              -hasError=>0);
0091 
0092   print "\tHV_status\n";
0093   $condDB->new_cond_type(-name=>"HV_status",
0094              -description=>"The high voltage status string",
0095              -units=>undef,
0096              -datatype=>"string",
0097              -hasError=>0);
0098 
0099   print "\tHV_T_board\n";
0100   $condDB->new_cond_type(-name=>"HV_T_board",
0101              -description=>"The high voltage board temperature",
0102              -units=>"degrees C",
0103              -datatype=>"float",
0104              -hasError=>0);
0105 }
0106 
0107 ###
0108 ###   Low Voltage
0109 ###
0110 
0111 sub define_LV {
0112   print "\tLV_vMon\n";
0113   $condDB->new_cond_type(-name=>"LV_vMon",
0114              -description=>"The low voltage, monitored value",
0115              -units=>"volts",
0116              -datatype=>"float",
0117              -hasError=>0);
0118 
0119   print "\tLV_outReg\n";
0120   $condDB->new_cond_type(-name=>"LV_outReg",
0121              -description=>"The low voltage ???",
0122              -units=>"???",
0123              -datatype=>"float",
0124              -hasError=>0);
0125 
0126   print "\tLV_iMon\n";
0127   $condDB->new_cond_type(-name=>"LV_iMon",
0128              -description=>"The low voltage current, monitored value",
0129              -units=>"amperes",
0130              -datatype=>"float",
0131              -hasError=>0);
0132 }
0133 
0134 ###
0135 ###   ESS
0136 ###
0137 sub define_ESS {
0138   print "\tESS_temp\n";
0139   $condDB->new_cond_type(-name=>"ESS_temp",
0140              -description=>"ESS temperature",
0141              -units=>"deg C",
0142              -datatype=>"float",
0143              -hasError=>0);
0144 
0145   print "\tESS_WLD\n";
0146   $condDB->new_cond_type(-name=>"ESS_WLD",
0147              -description=>"ESS WLD ???",
0148              -units=>"???",
0149              -datatype=>"float",
0150              -hasError=>0);
0151 }
0152 
0153 ###
0154 ###   PTM
0155 ###
0156 
0157 sub define_PTM {
0158   print "\tPTM_H\n";
0159   $condDB->new_cond_type(-name=>"PTM_H",
0160              -description=>"Humidity sensors on the modules",
0161              -units=>"???",
0162              -datatype=>"float",
0163              -hasError=>0);
0164 
0165   print "\tPTM_H_amb\n";
0166   $condDB->new_cond_type(-name=>"PTM_H_amb",
0167              -description=>"Ambient humidity",
0168              -units=>"???",
0169              -datatype=>"float",
0170              -hasError=>0);
0171 
0172   print "\tPTM_T_amb\n";
0173   $condDB->new_cond_type(-name=>"PTM_T_amb",
0174              -description=>"Ambient temperature",
0175              -units=>"deg C",
0176              -datatype=>"float",
0177              -hasError=>0);
0178 
0179   print "\tPTM_T_grid\n";
0180   $condDB->new_cond_type(-name=>"PTM_T_grid",
0181              -description=>"Module grid temperature",
0182              -units=>"deg C",
0183              -datatype=>"float",
0184              -hasError=>0);
0185 
0186   print "\tPTM_T_screen\n";
0187   $condDB->new_cond_type(-name=>"PTM_T_screen",
0188              -description=>"Module screen temperature",
0189              -units=>"deg C",
0190              -datatype=>"float",
0191              -hasError=>0);
0192 
0193   print "\tPTM_T_water_in\n";
0194   $condDB->new_cond_type(-name=>"PTM_T_water_in",
0195              -description=>"Super-module water in temperature",
0196              -units=>"deg C",
0197              -datatype=>"float",
0198              -hasError=>0);
0199 
0200   print "\tPTM_T_water_out\n";
0201   $condDB->new_cond_type(-name=>"PTM_T_water_out",
0202              -description=>"Super-module water out temperature",
0203              -units=>"deg C",
0204              -datatype=>"float",
0205              -hasError=>0);
0206 }
0207 
0208 
0209 ###
0210 ###   Laser
0211 ###
0212 
0213 sub define_Laser {
0214   foreach my $color (qw/red green blue/) {
0215     print "\tLaser_PN_ratio_$color\n";
0216     $condDB->new_cond_type(-name=>"Laser_PN_ratio_$color",
0217                -description=>"The PN ratio to describe the stability of the $color laser",
0218                -units=>"???",
0219                -datatype=>"float",
0220                -hasError=>1);
0221   }
0222 
0223 # foreach my $color (qw/red green blue/) {
0224 #   print "\tLaser_pulse_max_laser_ref_$color\n";
0225 #   $condDB->new_cond_type(-name=>"Laser_pulse_max_laser_ref_$color",
0226 #            -description=>"Laser pulse max laser/ref, $color laser",
0227 #            -units=>"???",
0228 #            -datatype=>"float",
0229 #            -hasError=>1);
0230 
0231 
0232 #   print "\tLaser_pulse_max_laser_pin_$color\n";
0233 #   $condDB->new_cond_type(-name=>"Laser_pulse_max_laser_pin_$color",
0234 #            -description=>"Laser pulse max laser/pin, $color laser",
0235 #            -units=>"???",
0236 #            -datatype=>"float",
0237 #            -hasError=>1);
0238 # }
0239 
0240   print "\tLaser_pulse_fit_params\n";
0241   $condDB->new_cond_type(-name=>"Laser_pulse_fit_params",
0242              -description=>"Laser pulse fit parameters 0-3",
0243              -units=>"???",
0244              -datatype=>"float",
0245              -datasize=>4,
0246              -hasError=>1);
0247 
0248   foreach my $color (qw/red green blue/) {
0249     print "\tLaser_corr_$color\n";
0250     $condDB->new_cond_type(-name=>"Laser_corr_$color",
0251                -description=>"Laser monitoring calculated correction,  $color laser",
0252                -units=>"???",
0253                -datatype=>"float",
0254                -hasError=>1);
0255   }
0256 
0257   foreach my $color (qw/red green blue/) {
0258     print "\tLaser_width_$color\n";
0259     $condDB->new_cond_type(-name=>"Laser_width_$color",
0260                -description=>"The width of the laser pulse measured with MATACQ",
0261                -units=>"???",
0262                -datatype=>"float",
0263                -hasError=>0);
0264   }
0265 
0266   print "\tLaser_test_pulse\n";
0267   $condDB->new_cond_type(-name=>"Laser_test_pulse",
0268              -description=>"The test pulse amplitude",
0269              -units=>"???",
0270              -datatype=>"float",
0271              -hasError=>0);
0272 }
0273 
0274 ###
0275 ###   MGPA
0276 ###
0277 sub define_MGPA {
0278   print "\tMGPA_gain_intercal_g12g6\n";
0279   $condDB->new_cond_type(-name=>"MGPA_gain_intercal_g12g6",
0280              -description=>"Values of the relative gain ".
0281              "calibration of the MGPA, gain 12 / ".
0282              "gain 6",
0283              -units=>"???",
0284              -datatype=>"float",
0285              -hasError=>0);
0286 
0287   print "\tMGPA_gain_intercal_g6g1\n";
0288   $condDB->new_cond_type(-name=>"MGPA_gain_intercal_g6g1",
0289              -description=>"Values of the relative gain ".
0290              "calibration of the MGPA, gain 6 / ".
0291              "gain 1",
0292              -units=>"???",
0293              -datatype=>"float",
0294              -hasError=>0);
0295 }
0296 
0297 ###
0298 ###   DCU
0299 ###
0300 # For the test beam 2004 data only
0301 sub define_DCU {
0302   print "\tDCU_capsule_temp\n";
0303   $condDB->new_cond_type(-name=>"DCU_capsule_temp",
0304              -description=>"From the capsule thermister",
0305              -units=>"deg C",
0306              -datatype=>"float",
0307              -hasErrors=>"0");
0308 }
0309 
0310 ###
0311 ###   Token Ring
0312 ###
0313 sub define_Token_Ring {
0314   print "\tTR_Calib_T_Caps_Beta\n";
0315   $condDB->new_cndc_type(-name=>"TR_Calib_T_Caps_Beta",
0316              -description=>"Calibration of temperature sensors ".
0317              "near the capsules",
0318              -units=>"deg K",
0319              -datatype=>"float",
0320              -hasError=>0);
0321 
0322   print "\tTR_Calib_T_Caps_R25\n";
0323   $condDB->new_cndc_type(-name=>"TR_Calib_T_Caps_R25",
0324              -description=>"Calibration of temperature sensors ".
0325              "near the capsules",
0326              -units=>"Ohms",
0327              -datatype=>"float",
0328              -hasError=>0);
0329 
0330   print "\tTR_T_Caps\n";
0331   $condDB->new_cndc_type(-name=>"TR_T_Caps",
0332              -description=>"Tempeture on the capsules",
0333              -units=>"deg C",
0334              -datatype=>"float",
0335              -hasError=>0);
0336 
0337 
0338 
0339   print "\tTR_LV_T\n";
0340   $condDB->new_cndc_type(-name=>"TR_LV_T",
0341              -description=>"Temperature of the LVRB sensors",
0342              -units=>"deg C",
0343              -datatype=>"float",
0344              -hasError=>0);
0345 
0346 
0347   print "\tTR_IDARK_Caps\n";
0348   $condDB->new_cndc_type(-name=>"TR_IDark_Caps",
0349              -description=>"Dark current fo the capsules",
0350              -units=>"nA",
0351              -datatype=>"float",
0352              -hasError=>0);
0353 
0354   print "\tTR_LV_VFE_A\n";
0355   $condDB->new_cndc_type(-name=>"TR_VFE_A",
0356              -description=>"Analog LVRB VFE reading",
0357              -units=>"V",
0358              -datatype=>"float",
0359              -hasError=>0);
0360 
0361   print "\tTR_LV_VCC\n";
0362   $condDB->new_cndc_type(-name=>"TR_LV_VCC",
0363              -description=>"LVRB VCC",
0364              -units=>"V",
0365              -datatype=>"float",
0366              -hasError=>0);
0367 
0368   print "\tTR_LV_VFE_4_5_D\n";
0369   $condDB->new_cndc_type(-name=>"TR_LV_VFE_4_5_D",
0370              -description=>"Digital LVRB VFE 4 5",
0371              -units=>"V",
0372              -datatype=>"float",
0373              -hasError=>0);
0374 
0375   print "\tTR_LV_VFE_1_2_3_D\n";
0376   $condDB->new_cndc_type(-name=>"TR_LV_VFE_1_2_3_D",
0377              -description=>"Digital LVRB VFE 1 2 3",
0378              -units=>"V",
0379              -datatype=>"float",
0380              -hasError=>0);
0381 
0382   print "\tTR_LV_Buffer\n";
0383   $condDB->new_cndc_type(-name=>"TR_LV_Buffer",
0384              -description=>"LVRB buffer",
0385              -units=>"V",
0386              -datatype=>"float",
0387              -hasError=>0);
0388 
0389   print "\tTR_LV_Fenix\n";
0390   $condDB->new_cndc_type(-name=>"TR_LV_Fenix",
0391              -description=>"LVRB Fenix",
0392              -units=>"V",
0393              -datatype=>"float",
0394              -hasError=>0);
0395 
0396   print "\tTR_LV_4pt3_A\n";
0397   $condDB->new_cndc_type(-name=>"TR_LV_4pt3_A",
0398              -description=>"LVRB Analog 4.3",
0399              -units=>"V",
0400              -datatype=>"float",
0401              -hasError=>0);
0402 
0403   print "\tTR_LV_4pt3_D\n";
0404   $condDB->new_cndc_type(-name=>"TR_LV_4pt3_D",
0405              -description=>"LVRB Digital 4.3",
0406              -units=>"V",
0407              -datatype=>"float",
0408              -hasError=>0);
0409 
0410   print "\tTR_LV_OCM\n";
0411   $condDB->new_cndc_type(-name=>"TR_LV_OCM",
0412              -description=>"LVRB OCM",
0413              -units=>"V",
0414              -datatype=>"float",
0415              -hasError=>0);
0416 
0417   print "\tTR_LV_GOH\n";
0418   $condDB->new_cndc_type(-name=>"TR_LV_GOH",
0419              -description=>"LVRB GOH",
0420              -units=>"V",
0421              -datatype=>"float",
0422              -hasError=>0);
0423 
0424   print "\tTR_LV_INH\n";
0425   $condDB->new_cndc_type(-name=>"TR_LV_INH",
0426              -description=>"LVRB INH",
0427              -units=>"V",
0428              -datatype=>"float",
0429              -hasError=>0);
0430 
0431     print "\tTR_LV_DCU_T\n";
0432     $condDB->new_cndc_type(-name=>"TR_LV_DCU_T",
0433                -description=>"Temperature inside the DCU".
0434                "on the LVRB",
0435                -units=>"deg C",
0436                -datatype=>"float",
0437                -hasError=>0);
0438 
0439     print "\tTR_VFE_DCU_T\n";
0440     $condDB->new_cndc_type(-name=>"TR_VFE_DCU_T",
0441                -description=>"Temperature inside the DCU on the ".
0442                "VFE",
0443                -units=>"deg C",
0444                -datatype=>"float",
0445                -hasError=>0);
0446 }
0447 
0448 ###
0449 ###   Coefficients from the Construction DB
0450 ###
0451 sub define_Construction {
0452   print "\tAPD_T_coeff\n";
0453   $condDB->new_cond_type(-name=>"APD_T_coeff",
0454              -description=>"1/M dM/dT",
0455              -units=>"1/deg C",
0456              -datatype=>"float",
0457              -hasError=>0);
0458 
0459   print "\tAPD_V_coeff\n";
0460   $condDB->new_cond_type(-name=>"APD_V_coeff",
0461              -description=>"(1/M)(dM/dV) for the capsule attached to the crystal",
0462              -units=>"1/V",
0463              -datatype=>"float",
0464              -hasError=>0);
0465 
0466   print "\tXtal_T_coeff\n";
0467   $condDB->new_cond_type(-name=>"Xtal_T_coeff",
0468              -description=>"Temperature coefficient of the crystal",
0469              -units=>"value/degrees C",
0470              -datatype=>"float",
0471              -hasError=>0);
0472 
0473   print "\tXtal_alpha\n";
0474   $condDB->new_cond_type(-name=>"Xtal_alpha",
0475              -description=>"The alpha coefficients due to irradiation of the crystal",
0476              -units=>"???",
0477              -datatype=>"float",
0478              -hasError=>0);
0479 }
0480 
0481 ###
0482 ###   Crystal Calibration sets
0483 ###
0484 sub define_Xtal_Calibrations {
0485   print "\tXtal_intercal_lab\n";
0486   $condDB->new_cond_type(-name=>"Xtal_intercal_lab",
0487              -description=>"Calibration constant from lab measurements",
0488              -units=>"???",
0489              -datatype=>"float",
0490              -hasError=>0);
0491 
0492   print "\tXtal_intercal_milano\n";
0493   $condDB->new_cond_type(-name=>"Xtal_intercal_milano",
0494              -description=>"Calibration constant from lab measurements, Milano group",
0495              -units=>"???",
0496              -datatype=>"float",
0497              -hasError=>0);
0498 }
0499 
0500 
0501 ###
0502 ###   Other Calibrations, corrections
0503 ###
0504 sub define_Monitoring_Calibrations {
0505   print "\tPN_lin_corr_g16\n";
0506   $condDB->new_cond_type(-name=>"PN_lin_corr_g16",
0507              -description=>"Linearity corrections for MGPA gain 16 PN diodes responses",
0508              -units=>"???",
0509              -datatype=>"float",
0510              -datasize=>3,
0511              -hasError=>0);
0512 
0513   print "\tPN_lin_corr_g1\n";
0514   $condDB->new_cond_type(-name=>"PN_lin_corr_g1",
0515              -description=>"Linearity corrections for MGPA gain 1 PN diodes responses",
0516              -units=>"???",
0517              -datatype=>"float",
0518              -datasize=>3,
0519              -hasError=>0);
0520 
0521   foreach my $gain (qw/1 6 12/) {
0522     print "\tAPD_lin_corr_g${gain}\n";
0523     $condDB->new_cond_type(-name=>"APD_lin_corr_g${gain}",
0524                -description=>"Linearity corrections for APD diode response with MGPA gain $gain",
0525                -units=>"???",
0526                -datatype=>"float",
0527                -datasize=>3,
0528                -hasError=>0);
0529   }
0530 }