Skip to content

macro to make temp graph from root files produced by CaloTemp.#1286

Open
asasikum wants to merge 1 commit intosPHENIX-Collaboration:masterfrom
asasikum:master
Open

macro to make temp graph from root files produced by CaloTemp.#1286
asasikum wants to merge 1 commit intosPHENIX-Collaboration:masterfrom
asasikum:master

Conversation

@asasikum
Copy link
Contributor

@asasikum asasikum commented Feb 6, 2026

This code creates a 1D distribution of temperature vs runnumber/runid by averaging the temperatures of the towers in the root file made by Calotemp macro.
how to run: root -l makeAvgTempVsRun.C
You have to edit the input file directory, file names of the input an output accordingly. This macro by default analyzes the case of inner hcal.

Pull Request Summary: Temperature vs Run Number Analysis Macro

Motivation & Context

This macro enables systematic analysis of HCAL temperatures across multiple runs by processing the 2D temperature profiles (TProfile2D) produced by the CaloTemp macro. It aggregates per-tower temperature data into per-run averages, facilitating detector performance monitoring and characterization of thermal conditions during data-taking periods.

Key Changes

  • New macro added: makeAvgTempVsRun.C (116 lines)
  • Core functionality:
    • Reads a run list file and processes corresponding temperature ROOT files
    • Iterates over all bins in the 2D temperature profile, filtering by a configurable temperature range (default 10–30°C)
    • Computes per-run average temperature, tracking the number of valid towers used
    • Outputs results in three formats: 1D histogram (with run labels), TGraph (run number vs. average temperature), and CSV file
    • Generates two visualization canvases displaying temperature trends
    • Configurable parameters: input directory, run list file, temperature range, and output file names

Potential Risk Areas

  • Hard-coded file naming convention: The macro assumes files follow the pattern HCALIN_temp_<run>.root. Any changes to the CaloTemp macro's output naming will break this workflow.
  • Silent error handling: Runs with missing or unopenable files are skipped without summary statistics. Users may not realize significant data loss.
  • Output file overwrite: TFile is created with RECREATE mode, silently overwriting existing results without confirmation.
  • Temperature range defaults: The hardcoded 10–30°C range is appropriate for inner HCal but commented lines suggest potential OHCAL support with different acceptable ranges. Misuse on incompatible detectors could go undetected.
  • CSV edge case: Runs with zero valid towers (nused = 0) are recorded with avg_temp_C = 0.0, which may not be distinguishable from legitimate zero values.
  • Memory management: Dynamic allocation of ROOT objects (TH1D, TGraph, TCanvas) without explicit cleanup; relies on ROOT's implicit cleanup.

Possible Future Improvements

  • Add summary statistics (e.g., "Processed X runs, skipped Y, used Z valid towers total")
  • Extend configuration to cleanly support multiple detector types (IHCAL, OHCAL) without commented alternatives
  • Implement validation checks on temperature ranges and run numbers before processing
  • Add optional CSV header with metadata (date, temperature bounds, detector, etc.)
  • Consider batch processing or parallelization for large run lists
  • Add optional PNG export functionality (currently commented out)

Note: AI-generated code review summaries can contain errors. Please verify critical implementation details against the actual code and project requirements before merging.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

📝 Walkthrough

Walkthrough

A new ROOT macro computes per-run average HCAL temperatures from 2D temperature profiles. It processes a run list, filters bins within a specified temperature range, generates CSV output with run numbers and average temperatures, and produces ROOT histograms and TGraphs for visualization.

Changes

Cohort / File(s) Summary
HCAL temperature analysis macro
calibrations/calo/hcal_calib_year2/makeTemp/makeAvgTempVsRun.C
New function makeAvgTempVsRun() that reads HCAL temperature profiles from run-specific ROOT files, computes per-run averages within a specified temperature range, writes CSV output with run numbers and tower counts, and generates ROOT histograms and TGraph visualizations. Includes error handling for missing files and profiles.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sphenix-jenkins-ci
Copy link

For repository maintainers, please start the CI check manually (feedback)

This is an automatic message to assist manually starting CI check for this pull request, commit d2414f1a8d18106f5f602c5de65633c8cfeb6fcc. macros pull request require a manual start for CI checks, in particular selecting which coresoftware and calibrations versions to check against this macros pull request.

sPHENIX software maintainers: please make your input here and start the Build:

build

Note:

  1. if needed, fill in the pull request ID for the coresoftware pull request, e.g. origin/pr/1697/merge for PR#1697 in sha_coresoftware. Default is to check with the master branch.
  2. click Build button at the end of the long web page to start the test

Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant