File indexing completed on 2024-04-06 12:23:16
0001 <?php
0002
0003
0004
0005
0006
0007
0008 require_once 'common.php';
0009
0010 error_reporting(E_ALL);
0011 ini_set("display_errors","on");
0012
0013
0014 $conn = connect("");
0015
0016
0017 function & connect($location) {
0018 $params = get_conn_params($location);
0019 $db_user = $params['user'];
0020 $db_pass = $params['pass'];
0021 $db_sid = $params['sid'];
0022
0023 $conn = oci_connect($db_user, $db_pass, $db_sid);
0024
0025 if (! $conn ) {
0026 echo "<h1>ERROR</h1>";
0027 echo "<p>Connection to DB failed.</p>";
0028 exit;
0029 }
0030
0031 $stmt = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
0032 oci_execute($stmt);
0033
0034 return $conn;
0035 }
0036
0037
0038 function get_loc_list() {
0039 global $conn;
0040
0041 $sql = "SELECT DISTINCT location FROM location_def";
0042 $stmt = oci_parse($conn, $sql);
0043 oci_execute($stmt);
0044 oci_fetch_all($stmt, $results);
0045
0046 return array_values($results['LOCATION']);
0047 }
0048
0049
0050 function get_sm_list() {
0051 global $conn;
0052
0053 $sql = "SELECT DISTINCT cv.id1 SM FROM run_dat rdat
0054 JOIN channelview cv ON rdat.logic_id = cv.logic_id
0055 AND cv.name = 'EB_supermodule'
0056 AND cv.name = cv.maps_to";
0057 $stmt = oci_parse($conn, $sql);
0058 oci_execute($stmt);
0059 oci_fetch_all($stmt, $results);
0060
0061 return array_values($results['SM']);
0062 }
0063
0064
0065
0066 function get_runtype_list() {
0067 global $conn;
0068
0069 $sql = "SELECT DISTINCT run_type FROM run_type_def";
0070 $stmt = oci_parse($conn, $sql);
0071 oci_execute($stmt);
0072 oci_fetch_all($stmt, $results);
0073
0074 return array_values($results['RUN_TYPE']);
0075 }
0076
0077
0078 function get_rungentag_list() {
0079 global $conn;
0080
0081 $sql = "SELECT DISTINCT gen_tag FROM run_tag";
0082 $stmt = oci_parse($conn, $sql);
0083 oci_execute($stmt);
0084 oci_fetch_all($stmt, $results);
0085
0086 return array_values($results['GEN_TAG']);
0087 }
0088
0089
0090 function get_run_num_extents() {
0091 global $conn;
0092
0093 $sql = "SELECT MIN(riov.run_num) min_run, MAX(riov.run_num) max_run
0094 FROM run_iov riov
0095 JOIN run_tag rtag ON riov.tag_id = rtag.tag_id
0096 JOIN run_type_def rdef ON rdef.def_id = rtag.run_type_id
0097 WHERE rdef.run_type != 'TEST'";
0098 $stmt = oci_parse($conn, $sql);
0099 oci_execute($stmt);
0100 return oci_fetch_assoc($stmt);
0101 }
0102
0103
0104 function get_run_date_extents() {
0105 global $conn;
0106
0107 $sql = "SELECT MIN(riov.run_start) min_start, MAX(riov.run_start) max_start
0108 FROM run_iov riov
0109 JOIN run_tag rtag ON riov.tag_id = rtag.tag_id
0110 JOIN run_type_def rdef ON rdef.def_id = rtag.run_type_id
0111 WHERE rdef.run_type != 'TEST'";
0112
0113 $stmt = oci_parse($conn, $sql);
0114 oci_execute($stmt);
0115 return oci_fetch_assoc($stmt);
0116 }
0117
0118
0119
0120 function get_runselect_headers() {
0121 return array('RUN_NUM' => 'Run Number',
0122 'SM' => 'SM',
0123 'LOCATION' => 'Location',
0124 'RUN_TYPE' => 'Run Type',
0125 'CONFIG_TAG' => 'Run Config',
0126 'CONFIG_VER' => 'Config Ver',
0127 'RUN_GEN_TAG' => 'Gen Tag',
0128 'RUN_START' => 'Run Start',
0129 'RUN_END' => 'Run End',
0130 'NUM_EVENTS' => 'Events');
0131 }
0132
0133
0134
0135
0136 function build_runselect_sql($params) {
0137 $selectfrom = "select loc.location, rtype.run_type, rconfig.config_tag, rconfig.config_ver, rtag.gen_tag run_gen_tag,
0138 riov.iov_id run_iov_id, riov.run_num, riov.run_start, riov.run_end, riov.db_timestamp run_db_timestamp,
0139 rdat.num_events, cv.id1 SM
0140 from location_def loc
0141 join run_tag rtag on rtag.location_id = loc.def_id
0142 join run_type_def rtype on rtype.def_id = rtag.run_type_id
0143 join run_iov riov on riov.tag_id = rtag.tag_id
0144 left join run_dat rdat on rdat.iov_id = riov.iov_id
0145 left join run_config_dat rconfig on rconfig.iov_id = riov.iov_id
0146 left join channelview cv on rdat.logic_id = cv.logic_id
0147 and cv.name = 'EB_supermodule'
0148 and cv.name = cv.maps_to";
0149
0150 $where = " WHERE loc.location = :location ";
0151
0152 $binds = array(':location' => $params['location']);
0153
0154 if ($params['SM'] != 'Any') {
0155 $where .= " AND (cv.id1 = :SM OR cv.name = 'ECAL')";
0156 $binds[':SM'] = $params['SM'];
0157 }
0158 if ($params['SM'] != 'Any'&& $params['CRYSTAL'] != 'Any' && $params['run_type'] == 'BEAM') {
0159 $selectfrom .=" left join run_h4_table_position_dat rtbdat on rtbdat.iov_id = riov.iov_id
0160 left join channelview cv2 on rtbdat.logic_id = cv2.logic_id
0161 and cv2.name = 'EB_crystal_number'
0162 and cv2.name = cv2.maps_to";
0163 $where .= " AND cv2.id1=:SM AND cv2.id2 = :CRYSTAL ";
0164 $binds[':SM'] = $params['SM'];
0165 $binds[':CRYSTAL'] = $params['CRYSTAL'];
0166 }
0167
0168 if ($params['run_type'] == 'All except TEST') {
0169 $where .= " AND rtype.run_type != 'TEST'";
0170 } else if ($params['run_type'] != 'All') {
0171 $where .= " AND rtype.run_type = :run_type ";
0172 $binds[':run_type'] = $params['run_type'];
0173 }
0174
0175 if ($params['run_gen_tag'] != 'All') {
0176 $where .= " AND rtag.gen_tag = :run_gen_tag ";
0177 $binds[':run_gen_tag'] = $params['run_gen_tag'];
0178 }
0179
0180 if ($params['run_select'] == 'run_range') {
0181 $where .= " AND riov.run_num >= :min_run AND riov.run_num <= :max_run ";
0182 $binds[':min_run'] = $params['min_run'];
0183 $binds[':max_run'] = $params['max_run'];
0184 } elseif ($params['run_select'] == 'date_range') {
0185 $where .= " AND riov.run_start >= :min_start AND riov.run_start <= :max_start ";
0186 $binds[':min_start'] = $params['min_start'];
0187 $binds[':max_start'] = $params['max_start'];
0188 }
0189
0190 $run_order = $params['run_order'];
0191 $orderby = " order by riov.run_num $run_order, rtype.run_type asc, rconfig.config_tag asc, rtag.gen_tag asc";
0192
0193 $sql = $selectfrom.$where.$orderby;
0194
0195 if ($params['run_select'] == 'last_100') {
0196 $sql = "select * from ($sql) where rownum < 101";
0197 }
0198
0199 return array('sql' => $sql, 'binds' => $binds);
0200 }
0201
0202
0203 function fetch_sum_events($runselect_output) {
0204 global $conn;
0205
0206 $sql = $runselect_output['sql'];
0207 $binds = $runselect_output['binds'];
0208
0209 $sql = "select sum(num_events) total_events from ($sql)";
0210
0211 $stmt = oci_parse($conn, $sql);
0212
0213 foreach($binds as $handle => $var) {
0214 oci_bind_by_name($stmt, $handle, $binds[$handle]);
0215 }
0216
0217 oci_execute($stmt);
0218 $row = oci_fetch_row($stmt);
0219 return $row[0];
0220 }
0221
0222
0223
0224
0225 function get_monselect_headers() {
0226 return array('SUBRUN_NUM' => 'Subrun',
0227 'GEN_TAG' => 'General Tag',
0228 'MON_VER' => 'Monitoring Version',
0229 'SUBRUN_START' => 'Subrun Start',
0230 'SUBRUN_END' => 'Subrun End',
0231 'NUM_EVENTS' => 'Num Events');
0232 }
0233
0234
0235
0236 function get_lmfselect_headers() {
0237 return array('SUBRUN_NUM' => 'Subrun',
0238 'GEN_TAG' => 'General Tag',
0239 'SUBRUN_START' => 'Subrun Start',
0240 'SUBRUN_END' => 'Subrun End');
0241 }
0242
0243
0244
0245 function fetch_mon_data($run_iov_id) {
0246 global $conn;
0247
0248 $sql = "select miov.iov_id, miov.subrun_num, miov.subrun_start, miov.subrun_end, mtag.gen_tag, mver.mon_ver,
0249 mdat.num_events, mdat.task_list, mdat.task_outcome,
0250 dat_exists('MON', miov.iov_id) dat_exists
0251 from mon_run_iov miov
0252 join mon_run_tag mtag on mtag.tag_id = miov.tag_id
0253 join mon_version_def mver on mver.def_id = mtag.mon_ver_id
0254 join mon_run_dat mdat on mdat.iov_id = miov.iov_id
0255 where miov.run_iov_id = :run_iov_id
0256 order by miov.subrun_num asc";
0257
0258 $stmt = oci_parse($conn, $sql);
0259
0260 oci_bind_by_name($stmt, ':run_iov_id', $run_iov_id);
0261 oci_execute($stmt);
0262 oci_fetch_all($stmt, $results);
0263
0264 return $results;
0265 }
0266
0267
0268
0269 function fetch_las_data($run_iov_id) {
0270 global $conn;
0271
0272 $sql = "select liov.iov_id, liov.subrun_num, liov.subrun_start, liov.subrun_end, ltag.gen_tag,
0273 dat_exists('LMF', liov.iov_id) dat_exists
0274 from lmf_run_iov liov
0275 join lmf_run_tag ltag on ltag.tag_id = liov.tag_id
0276 where liov.run_iov_id = :run_iov_id
0277 order by liov.subrun_num asc";
0278
0279 $stmt = oci_parse($conn, $sql);
0280
0281 oci_bind_by_name($stmt, ':run_iov_id', $run_iov_id);
0282 oci_execute($stmt);
0283 oci_fetch_all($stmt, $results);
0284
0285 return $results;
0286 }
0287
0288
0289
0290 function get_dcuselect_headers() {
0291 return array('SINCE' => 'Valid Since',
0292 'TILL' => 'Valid Until',
0293 'GEN_TAG' => 'General Tag');
0294 }
0295
0296
0297
0298 function fetch_dcu_data($run_iov_id) {
0299 global $conn;
0300
0301
0302 $sql = "select diov.iov_id, diov.since, diov.till, dtag.gen_tag,
0303 dat_exists('DCU', diov.iov_id) dat_exists
0304 from dcu_iov diov, dcu_tag dtag, run_iov riov, run_tag rtag
0305 where diov.tag_id = dtag.tag_id
0306 and riov.iov_id = :run_iov_id
0307 and riov.tag_id = rtag.tag_id
0308 and rtag.location_id = dtag.location_id
0309 and ((diov.till >= riov.run_start and diov.till <= riov.run_end)
0310 or (diov.since >= riov.run_start and diov.till <= riov.run_end)
0311 or (diov.since <= riov.run_end and diov.since >= riov.run_start)
0312 or (riov.run_start >= diov.since and riov.run_end <= diov.till))
0313 order by diov.since asc";
0314
0315 $stmt = oci_parse($conn, $sql);
0316
0317 oci_bind_by_name($stmt, ':run_iov_id', $run_iov_id);
0318 oci_execute($stmt);
0319 oci_fetch_all($stmt, $results);
0320
0321 return $results;
0322 }
0323
0324 function get_beamselect_headers() {
0325 return array('BEAM_FILE' => 'Beam File',
0326 'ENERGY' => 'Energy',
0327 'PARTICLE' => 'Particle',
0328 'SPECIAL_SETTINGS' => 'Special Settings');
0329 }
0330
0331 function fetch_all_beam_data( $run_num, $loc) {
0332 global $conn;
0333
0334 if ($loc == 'H4B') {
0335 $beamtable = "RUN_H4_BEAM_DAT";
0336 } elseif ($loc == 'H2') {
0337 $beamtable = "RUN_H2_BEAM_DAT";
0338 } else {
0339 return array();
0340 }
0341
0342 $sql = "select * from $beamtable bdat, run_iov riov where bdat.iov_id=riov.iov_id and riov.run_num = :run ";
0343
0344 $stmt = oci_parse($conn, $sql);
0345
0346 oci_bind_by_name($stmt, ':run', $run_num);
0347 oci_execute($stmt);
0348 oci_fetch_all($stmt, $results);
0349
0350 return $results;
0351 }
0352
0353 function fetch_beam_data($run, $loc) {
0354 global $conn;
0355
0356 if ($loc == 'H4B') {
0357 $beamtable = "RUN_H4_BEAM_DAT";
0358 $beamcol = "\"XBH4.BEAM:LAST_FILE_LOADED\"";
0359 } elseif ($loc == 'H2') {
0360 $beamtable = "RUN_H2_BEAM_DAT";
0361 $beamcol = "\"XBH2.BEAM:LAST_FILE_LOADED\"";
0362 } else {
0363 return array();
0364 }
0365
0366 $sql = "select * from
0367 (select rownum R, riov.run_num, bdat.$beamcol beam_file, bdef.energy, bdef.particle, bdef.special_settings
0368 from ($beamtable bdat
0369 join run_iov riov on bdat.iov_id = riov.iov_id)
0370 left outer join beamfile_to_energy_def bdef on bdef.beam_file = bdat.$beamcol
0371 where riov.run_num <= :run
0372 order by riov.run_num desc)
0373 where rownum = 1 ";
0374
0375 $stmt = oci_parse($conn, $sql);
0376
0377 oci_bind_by_name($stmt, ':run', $run);
0378 oci_execute($stmt);
0379 oci_fetch_all($stmt, $results);
0380
0381 return $results;
0382 }
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393 function build_mon_dataset_sql($table, $where = NULL, $order = NULL) {
0394 $sql = "SELECT
0395 riov.run_num run,
0396 cv2.id1,
0397 cv.id2,
0398 cv.id3,
0399 dat.*
0400 FROM ( $table dat
0401 JOIN channelview cv ON cv.logic_id = dat.logic_id AND cv.name = cv.maps_to
0402 JOIN mon_run_iov miov ON miov.iov_id = dat.iov_id
0403 JOIN run_iov riov ON riov.iov_id = miov.run_iov_id )
0404 LEFT OUTER JOIN run_dat rdat ON rdat.iov_id = riov.iov_id
0405 LEFT OUTER JOIN channelview cv2 ON cv2.logic_id = rdat.logic_id AND cv2.name = cv2.maps_to
0406 WHERE miov.iov_id = :iov_id";
0407
0408 if ($where) {
0409 $sql .= " AND ".$where;
0410 }
0411
0412 if ($order) {
0413 $sql .= " ORDER BY ".join(", ", $order);
0414 } else {
0415 $sql .= " ORDER BY run, id1, id2, id3";
0416 }
0417
0418 return $sql;
0419 }
0420
0421
0422
0423 function fetch_mon_dataset_headers($table) {
0424 global $conn;
0425
0426 $headers = array();
0427 $headers['RUN'] = 'Run';
0428
0429 $table_meta = fetch_table_meta($table);
0430 $field_meta = fetch_field_meta($table);
0431 $chan_meta = fetch_channel_meta($table_meta['LOGIC_ID_NAME']);
0432
0433 foreach(array('ID1NAME' => 'ID1', 'ID2NAME' => 'ID2', 'ID3NAME' => 'ID3') as $name => $col) {
0434 if ($chan_meta[$name]) {
0435 $headers[$col] = $chan_meta[$name];
0436 }
0437 }
0438
0439 foreach($field_meta as $field => $meta) {
0440 $headers[$field] = $meta['LABEL'];
0441 }
0442
0443 return $headers;
0444 }
0445
0446
0447
0448 function fetch_mon_dataset_data($table, $iov_id, $where = NULL, $additional_binds = NULL, $order = NULL) {
0449 global $conn;
0450
0451 $sql = build_mon_dataset_sql($table, $where, $order);
0452 $stmt = oci_parse($conn, $sql);
0453
0454 oci_bind_by_name($stmt, ':iov_id', $iov_id);
0455
0456 if ($additional_binds) {
0457 foreach ($additional_binds as $bind_var => $bind_val) {
0458 oci_bind_by_name($stmt, $bind_var, $bind_val);
0459 }
0460 }
0461
0462 oci_execute($stmt);
0463 oci_fetch_all($stmt, $results);
0464 return $results;
0465 }
0466
0467
0468
0469 function fetch_table_meta($table) {
0470 global $conn;
0471
0472 $sql = "select * from cond_table_meta where table_name = :1";
0473 $stmt = oci_parse($conn, $sql);
0474 oci_bind_by_name($stmt, ':1', $table);
0475 oci_execute($stmt);
0476 $results = oci_fetch_assoc($stmt);
0477 return $results;
0478 }
0479
0480
0481
0482 function fetch_field_meta($table) {
0483 global $conn;
0484
0485 $sql = "select f.*
0486 from cond_table_meta t
0487 join cond_field_meta f on f.tab_id = t.def_id
0488 where t.table_name = :1
0489 order by table_name, field_name";
0490
0491 $stmt = oci_parse($conn, $sql);
0492 oci_bind_by_name($stmt, ':1', $table);
0493 oci_execute($stmt);
0494 $results = array();
0495 while ($row = oci_fetch_assoc($stmt)) {
0496 $field = $row['FIELD_NAME'];
0497 unset($row['FIELD_NAME']);
0498 $results[$field] = $row;
0499 }
0500 return $results;
0501 }
0502
0503
0504
0505 function fetch_channel_meta($name) {
0506 global $conn;
0507
0508 $sql = "select * from viewdescription where name = :1";
0509
0510 $stmt = oci_parse($conn, $sql);
0511 oci_bind_by_name($stmt, ':1', $name);
0512 oci_execute($stmt);
0513 $results = oci_fetch_assoc($stmt);
0514 return $results;
0515 }
0516
0517
0518
0519 function fetch_field_array($prefix) {
0520 global $conn;
0521
0522 $sql = "select table_name, field_name
0523 from cond_table_meta t
0524 join cond_field_meta f on f.tab_id = t.def_id
0525 where t.table_name like :1 and f.is_plottable = 1
0526 order by table_name, field_name";
0527
0528 $stmt = oci_parse($conn, $sql);
0529
0530 $like = $prefix.'%';
0531
0532 oci_bind_by_name($stmt, ':1', $like);
0533 oci_execute($stmt);
0534
0535 $results = array();
0536 while ($row = oci_fetch_array($stmt)) {
0537 if (!isset($results[$row[0]])) { $results[$row[0]] = array(); }
0538 array_push($results[$row[0]], $row[0].".".$row[1]);
0539 }
0540
0541 return $results;
0542 }
0543
0544 function fetch_plot_data($table, $field, $iov_id) {
0545 global $conn;
0546
0547 $sql = "select $field from $table where iov_id = :iov_id";
0548
0549 $stmt = oci_parse($conn, $sql);
0550
0551 oci_bind_by_name($stmt, ':iov_id', $iov_id);
0552 oci_execute($stmt);
0553
0554 oci_fetch_all($stmt, $results);
0555
0556 return $results;
0557 }
0558
0559 function db_fetch_plot_params($table, $field) {
0560 global $conn;
0561
0562 $sql = "select t.filled_by, t.content_explanation table_content, t.logic_id_name, t.map_by_logic_id_name, t.logic_id_explanation,
0563 f.is_plottable, f.field_type, f.content_explanation field_content, f.label, f.histo_min, f.histo_max
0564 from cond_table_meta t join cond_field_meta f on t.def_id = f.tab_id
0565 where t.table_name = :1 and f.field_name = :2";
0566
0567 $stmt = oci_parse($conn, $sql);
0568
0569 oci_bind_by_name($stmt, ':1', $table);
0570 oci_bind_by_name($stmt, ':2', $field);
0571
0572 oci_execute($stmt);
0573
0574 if ($row = oci_fetch_assoc($stmt)) {
0575 return $row;
0576 } else {
0577 return 0;
0578 }
0579 }
0580
0581
0582 function db_make_rootplot($table, $field, $iov_id, $plottype, $name) {
0583 global $conn;
0584
0585 $plot_params = db_fetch_plot_params($table, $field);
0586 $fmt = "png";
0587 $title = $plot_params['FIELD_CONTENT'];
0588 $chan_name = $plot_params['LOGIC_ID_NAME'];
0589 $map_name = $plot_params['MAP_BY_LOGIC_ID_NAME'];
0590
0591 if ($plottype == 'histo_all') {
0592 $type = 'TH1F'; $grp = 0;
0593 $sql = "select $field from $table where iov_id = :iov_id";
0594 $xtitle = $plot_params['LABEL'];
0595 $ytitle = "";
0596 } elseif ($plottype == 'histo_grp') {
0597 $type = 'TH1F'; $grp = 1;
0598 $sql = "select vd.id1name, cv.id1, d.$field from $table d, channelview cv, viewdescription vd
0599 where d.iov_id = :iov_id
0600 and d.logic_id = cv.logic_id
0601 and cv.name = cv.maps_to
0602 and cv.name = vd.name
0603 order by cv.id1, cv.id2, cv.id3";
0604 $xtitle = $plot_params['LABEL'];
0605 $ytitle = "";
0606 } elseif ($plottype == 'graph_all') {
0607 $type = 'TGraph'; $grp = 0;
0608 $sql = "select rownum, $field
0609 from (select d.$field from $table d, channelview cv
0610 where d.iov_id = :iov_id
0611 and d.logic_id = cv.logic_id
0612 and cv.name = cv.maps_to
0613 order by cv.id1, cv.id2, cv.id3)";
0614 $xtitle = $plot_params['LOGIC_ID_EXPLANATION'];
0615 $ytitle = $plot_params['LABEL'];
0616 } elseif ($plottype == 'graph_grp') {
0617 $type = 'TGraph'; $grp = 1;
0618 $sql = "select id1name, id1, rownum, $field
0619 from (select vd.id1name, cv.id1, d.$field from $table d, channelview cv, viewdescription vd
0620 where d.iov_id = :iov_id
0621 and d.logic_id = cv.logic_id
0622 and cv.name = cv.maps_to
0623 and cv.name = vd.name
0624 order by cv.id1, cv.id2, cv.id3)";
0625 $xtitle = $plot_params['LOGIC_ID_EXPLANATION'];
0626 $ytitle = $plot_params['LABEL'];
0627 } elseif ($plottype == 'map_all') {
0628
0629 $type = 'Map'; $grp = 1;
0630 $sql = "select id1name, id1, rownum, $field
0631 from (select vd.id1name, cv.id1, d.$field from $table d, channelview cv, viewdescription vd
0632 where d.iov_id = :iov_id
0633 and d.logic_id = cv.logic_id
0634 and cv.name = 'EB_crystal_number'
0635 and cv.name = vd.name
0636 order by cv.id1, cv.id2, cv.id3)";
0637 $xtitle = "";
0638 $ytitle = "";
0639 } else { die("Unknown plottype"); }
0640
0641 $stmt = oci_parse($conn, $sql);
0642
0643 oci_bind_by_name($stmt, ':iov_id', $iov_id);
0644 oci_execute($stmt);
0645
0646 $n = 0;
0647 $names = array();
0648 $rptitle = $title;
0649 $rpname = $name;
0650
0651 while ($row = oci_fetch_row($stmt)) {
0652
0653 if ($grp) {
0654 $grp_name = array_shift($row);
0655 $curr_grp = array_shift($row);
0656 }
0657
0658
0659 if ($n != 0 && $grp && ($last_grp != $curr_grp)) {
0660 array_push($names, $rpname);
0661 pclose($rootplot);
0662 }
0663
0664
0665 if ($n == 0 ||
0666 ($grp && ($last_grp != $curr_grp))) {
0667
0668 if ($grp) {
0669 $rptitle = $title." ($grp_name $curr_grp)";
0670 $rpname = $name.".$grp_name$curr_grp";
0671 }
0672
0673 $histo_min = $plot_params['HISTO_MIN'];
0674 $histo_max = $plot_params['HISTO_MAX'];
0675
0676 $rootplot = get_rootplot_handle("-T \"$rptitle\" -X \"$xtitle\" -Y \"$ytitle\" $type $fmt $rpname $histo_min $histo_max");
0677 if ( ! $rootplot || get_rootplot_error() ) { return 0; }
0678 }
0679
0680
0681 $dataline = join(' ', $row)."\n";
0682
0683 fwrite($rootplot, $dataline);
0684
0685
0686 $n++;
0687 if ($grp) { $last_grp = $curr_grp; }
0688 }
0689
0690 array_push($names, $rpname);
0691 pclose($rootplot);
0692
0693 if ($n == 0) {
0694 echo "N is zero";
0695 }
0696
0697 if (get_rootplot_error() || $n == 0) {
0698 return 0;
0699 }
0700
0701 return $names;
0702 }
0703
0704 ?>