#addtool  -pretend -definebyquery -label LAP.ThreePi.20120706 -set_dvodb LAP.20120706 -set_minidvodb_group LAP.slice06.part2.cam -set_minidvodb -set_label LAP.slice06.part2.cam -stage cam -uncensored -ra_min 90 -ra_max 120 -decl_min -35 -decl_max 20 -dbname gpc1 -simple | wc

#addtool  -pretend -definebyquery -label LAP.ThreePi.20120706 -set_dvodb LAP.20120706 -set_minidvodb_group LAP.slice06.cam -set_minidvodb -set_label LAP.slice06.cam -stage cam -uncensored -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75 -dbname gpc1 -simple | wc


$label1 = "LAP.PV3.20140730.final";
#$label2 = "LAP.ThreePi.20130717.pole3";
#$label3 = "LAP.ThreePi.20130717.pole3.CNP";
@labels = ($label1,$label2,$label3);
@labels = ($label1);
@segments = (0,1,2,3,4,5,6,7,8);
@segments1 = ( -35, -22,-10,2,14,26,38,50,62);
@segments2 = ( -22,-10,2,14,26,38,50,62,75);


@slices = ("00","02","04","06","08","10","12","14","16","18","20","22");
foreach $label (@labels) { 
foreach $slice (@slices) {
   
#$slice = $slices[0];
#$slice = $slices[1];
    foreach $num (@segments) {

	$dvodb = "LAP.PV3.20140730";
	$minidvodb_group = "LAP.PV3.slice$slice.$segments[$num].skycal";
	$dvodb_label = "$minidvodb_group";
	$ra_min = $slice*15.0;
	$ra_max = ($slice+2)*15.0;
	$dec_min = $segments1[$num];
	$dec_max = $segments2[$num];
#	print "$dvodb $minidvodb_group $ra_min $ra_max $dec_min $dec_max\n";

	
	$com =  "addtool -definebyquery  -label $label -set_dvodb $dvodb -set_minidvodb_group $minidvodb_group -set_minidvodb -set_label $dvodb_label -stage skycal -uncensored -ra_min $ra_min -ra_max $ra_max -dec_min $dec_min -dec_max $dec_max -dbname gpc1";
	print "$com\n";
	`$com`;
    }


}
$com2 = "addtool -definebyquery  -label $label -set_dvodb $dvodb -set_minidvodb_group LAP.PV3.pole.skycal -set_minidvodb -set_label LAP.PV3.pole.skycal -stage skycal -uncensored -ra_min 0 -ra_max 360 -dec_min 75 -dec_max 90 -dbname gpc1";
print "$com2\n";
`$com2`;
}
