Skip to content

BeamSpot Trends Over the Years

francescobrivio edited this page May 13, 2024 · 1 revision

BeamSpot Trends

It's good practice to keep the following twiki updated with the BeamSpot trends over the data taking periods:

If a the BeamSpot has been computed for a ReReco it's good practice to use those values for plotting the BeamSpot trends. Alternatively, when no ReReco-fit has been performed, the values can simply be taken from the PCL workflows.

Dump Beamspot Fits from PCL

There are 4 PCL workflows writing to different tags:

PCL workflow Destination Tags Comment
HP by Lumi BeamSpotObjects_PCL_byLumi_v0_prompt <-- Production!
HP by Run BeamSpotObjects_2009_v1_express, BeamSpotObjects_PCL_byRun_v0_hlt, BeamSpotObjects_PCL_byRun_v0_prompt
(legacy) by Lumi BeamSpotObjects_LegacyPCL_byLumi_v0_prompt
(legacy) by Run BeamSpotObjects_LegacyPCL_byRun_v0_prompt

It's good practice to use the production PCL workflow which is the "HP byLumi BS" since 2018.

How to:

  1. Download the needed packages:

    cmsrel CMSSW_X_Y_Z  
    cd CMSSW_X_Y_Z/src
    cmsenv
    git-cms-addpkg CondTools/BeamSpot
    git-cms-addpkg RecoVertex/BeamSpotProducer
    cd RecoVertex/BeamSpotProducer/python
    git clone https://github.com/MilanoBicocca-pix/BeamspotTools.git
    cd $CMSSW_BASE/src
    scram b -r -j8
    
  2. Dump the PCL values into txt file using the CondTools/BeamSpot/test/BeamSpotRcdRead_cfg.py script:

    • Edit the process.source to set the desired firstRun and firstLuminosityBlock parameters from which the script will start dumping the values
      • Note: In case you set a (Run, LS) value that does not correspond to an exact IOV in the tag, the program will insert the beamspot values from the previous IOV as first value in the txt file (this is dictated by how IOVs are seen in the CMSSW fwk), you can simply delete them by hand from the txt file
    • Edit process.BeamSpotRead with the desired output name of the txt file
    • Edit process.TFileService with the desired output name for the ROOT file
      • The ROOT file is not really needed for the next steps, but it's produced by default by the script
    • Run with:
      cmsRun CondTools/BeamSpot/test/BeamSpotRcdRead_cfg.py
      
      • Note: The program will run until it reaches process.maxEvents, but you can kill it with Ctrl+C if you want to stop early (only BeamSpot results analyzed till that moment are dumped into the txt file)
  3. Use RecoVertex/BeamSpotProducer/python/BeamspotTools/test/test_workflow_Run2016B.py to merge in LS ranges and create the final output txt and root file for plotting.

    • Edit the files to read the newly produced txt file
    • Edit the maxLumi parameter to set the maximum number of LS that can be merged together if no large drifts are observed
      • Set it to 1 if producing plots for single data-taking Era
      • Set it to 20 (or even 60) if producing plots for a full data-taking year
    • Edit the output histo_file
    • Run with:
      python3 test_workflow_Run2016B.py
      
    • This will produce the plots in both ROOT and pdf formats
  4. Additionally you can re-produce the plots in a nicer style using the RecoVertex/BeamSpotProducer/python/BeamspotTools/plot/plotRehauling.py

Clone this wiki locally