Project

General

Profile

Reading one ROOT file and finding out what's what

Finding run/rerun for data sets

On one of the virtual machines, get the "samweb" program defined.

-bash-4.1$ source /grid/fermiapp/products/common/etc/setups.sh
-bash-4.1$ setup fife_utils

List the files generated in the dataset gm2pro_daq_full_run1_9d_5036C

-bash-4.1$ samweb -e gm2 list-definition-files gm2pro_daq_full_run1_9d_5036C_goldList > gm2pro_daq_full_run1_9d_5036C_goldList.txt
-bash-4.1$ head gm2pro_daq_full_run1_9d_5036C_goldList.txt 
gm2offline_full_16840857_16369.00147.root
gm2offline_full_16841317_16399.00289.root
gm2offline_full_16841245_16356.00010.root
gm2offline_full_16841386_16399.00427.root
gm2offline_full_16840877_16365.00341.root
gm2offline_full_16840971_16372.00400.root
gm2offline_full_16841278_16372.00252.root
gm2offline_full_16841271_16399.00254.root
gm2offline_full_16841126_16372.00431.root
gm2offline_full_16841230_16377.00312.root

Get heist set up and confirm that it is available.

This is a pythonic way to access g-2 data.

Once you log in to one of the virtual machines, there are a few commands to run to get the software set up. You may want to run these automatically on login, but note that the version number can change, so if you want to use the most recent version, heed the message from the first command.

Here are three commands that will get you going:

. /cvmfs/gm2.opensciencegrid.org/prod/g-2/setup
setup gm2 v9_22_00 -q prof
. /gm2/app/users/jstaplet/heist/setup_heist

Here is a screenshot of these commands in action, along with testing that heist is available from ipython.

-bash-4.1$ . /cvmfs/gm2.opensciencegrid.org/prod/g-2/setup
g-2 software

--> To list gm2 releases, type
ups list -aK+ gm2

--> To use the latest release, do
setup gm2 v9_22_00 -q prof

For more information, see 
  https://cdcvs.fnal.gov/redmine/projects/g-2/wiki/SoftwareReleases

-bash-4.1$ setup gm2 v9_22_00 -q prof
-bash-4.1$ . /gm2/app/users/jstaplet/heist/setup_heist
-bash-4.1$ ipython
Python 2.7.14 (default, Jan 10 2018, 09:46:06) 
Type "copyright", "credits" or "license" for more information.

IPython 5.8.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import heist

In [2]: 

Read a test file and see what is available

Here are a few lines of python to open a file for reading, and then to list the types of data available.

from heist import *
fileName = "/gm2/app/users/jstaplet/test.root" 
reader = ArtFileReader(fileName)
reader.ls()

The first example in the gm2ilratio/spelunking directory 01-listing.py contains those lines. Here is what happens when you run that script.

-bash-4.1$ python 01-listing.py 
Successfully opened file /gm2/app/users/jstaplet/test.root
Initialized ArtFileReader event at Run16461 SubRun432 Event1
  gm2strawtracker::StrawDCADigitArtRecordgm2strawtracker::StrawDigitArtRecordintart::Assns_driftDistReco_straws_offline
  gm2strawtracker::StrawDCADigitArtRecordgm2strawtracker::TrackCandidateArtRecordvoidart::Assns_driftDistReco_straws_offline
  art::TriggerResults_TriggerResults__offline
  double_timeCorrectorDAQ_corrector_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker1_offline
  gm2calo::CaloQHistArtRecord_kqUnpacker_Qunpacker1_offline
  gm2calo::CaloQHistArtRecord_qQUnpacker_Qunpacker1_offline
  gm2calo::CaloQHistArtRecord_tqUnpacker_Qunpacker1_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker10_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker11_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker12_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker13_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker14_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker15_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker16_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker17_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker18_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker19_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker2_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker20_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker21_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker22_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker23_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker24_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker25_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker26_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker3_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker4_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker5_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker6_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker7_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker8_offline
  gm2calo::CaloQHistArtRecord_cqUnpacker_Qunpacker9_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector1_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector10_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector11_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector12_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector13_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector14_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector15_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector16_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector17_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector18_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector19_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector2_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector20_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector21_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector22_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector23_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector24_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector25_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector26_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector27_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector28_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector3_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector4_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector5_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector6_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector7_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector8_offline
  gm2calo::CaloRiderViewArtRecord_outFillPedestalCorrector_corrector9_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker1_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker10_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker11_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker12_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker13_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker14_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker15_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker16_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker17_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker18_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker19_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker2_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker20_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker21_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker22_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker23_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker24_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker25_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker26_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker27_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker3_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker4_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker5_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker6_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker7_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker8_offline
  gm2calo::CaloRiderViewArtRecord_smRawUnpacker_unpacker9_offline
  gm2common::GPSArtRecord_GPSUnpacker_GPSUnpacker0_offline
  UnpackedEvents_strawUnpacker_straws_offline
  gm2aux::IBMSBeamProfileArtRecords_ibmsProcessor_ibmsProcessor_offline
  gm2aux::IBMSRawArtRecords_ibmsUnpacker_unpacker_offline
  gm2aux::KickerBazookaArtRecords_kickerBazooka_bazooka_offline
  gm2aux::KickerIntegratedBazookaArtRecords_kickerBazooka_integratedBazooka_offline
  gm2aux::KickerSecondaryVoltageArtRecords_kickerSecondaryVoltage_sv_offline
  gm2aux::QIntegralArtRecords_t0Integrator__offline
  gm2aux::QIntegralArtRecords_t0PulseProcessor__offline
  gm2aux::QuadHVArtRecords_quadHV_quadHV_offline
  gm2aux::T0SyncPulseArtRecords_t0SyncProcessor__offline
  gm2calo::AMCHeaders_async_unpacker_offline
  gm2calo::AMCHeaders_headerUnpacker_unpacker_offline
  gm2calo::AMCHeaders_rawUnpacker_unpacker_offline
  gm2calo::AMCHeaders_smRawUnpacker_unpacker_offline
  gm2calo::CDFHeaders_cccUnpacker_unpacker_offline
  gm2calo::CDFHeaders_utcaUnpacker_unpacker_offline
  gm2calo::CaloCPArtRecords_CPUnpacker_unpacker_offline
  gm2calo::CaloCalibrationConstants_energyCalibratorDAQ_calibrator_offline
  gm2calo::CaloCalibrationConstants_longTermGainCorrectionDAQ_corrector_offline
  gm2calo::CaloClusterViewArtRecords_hitClusterDAQ_cluster_offline
  gm2calo::CaloClusterViewArtRecords_timingClusterDAQ_cluster_offline
  gm2calo::CaloCrystalHitViewArtRecords_energyCalibratorDAQ_calibrator_offline
  gm2calo::CaloCrystalHitViewArtRecords_inFillGainCorrector_corrector_offline
  gm2calo::CaloCrystalHitViewArtRecords_longTermGainCorrectionDAQ_corrector_offline
  gm2calo::CaloCrystalHitViewArtRecords_timeCorrectorDAQ_corrector_offline
  gm2calo::CaloCrystalHitViewArtRecords_timeOffsetCorrectorDAQ_corrector_offline
  gm2calo::CaloCrystalHitViewArtRecords_islandFitterDAQ_fitter_offline
  gm2calo::CaloCrystalHitViewArtRecords_riderFitter_fitter_offline
  gm2calo::CaloIslandViewArtRecords_pedestalCorrectorDAQ_corrector_offline
  gm2calo::CaloIslandViewArtRecords_smislandUnpacker_unpacker_offline
  gm2calo::CaloIslandViewArtRecords_tIslandUnpacker_unpacker_offline
  gm2calo::CaloQPedestalArtRecords_QHistSum_QHistRecon_offline
  gm2calo::CaloSplashArtRecords_splashFinder__offline
  gm2calo::CaloSplashArtRecords_splashFinderT0__offline
  gm2calo::CaloSumArtRecords_ZSUnpacker_unpacker_offline
  gm2calo::ClusterArtRecords_hitClusterDAQ_cluster_offline
  gm2calo::ClusterArtRecords_timingClusterDAQ_cluster_offline
  gm2calo::CrystalHitArtRecords_energyCalibratorDAQ_calibrator_offline
  gm2calo::CrystalHitArtRecords_inFillGainCorrector_corrector_offline
  gm2calo::CrystalHitArtRecords_longTermGainCorrectionDAQ_corrector_offline
  gm2calo::CrystalHitArtRecords_timeCorrectorDAQ_corrector_offline
  gm2calo::CrystalHitArtRecords_timeOffsetCorrectorDAQ_corrector_offline
  gm2calo::CrystalHitArtRecords_islandFitterDAQ_fitter_offline
  gm2calo::CrystalHitArtRecords_riderFitter_fitter_offline
  gm2calo::GpuCTagArtRecords_islandUnpacker_unpacker_offline
  gm2calo::GpuCTagArtRecords_smislandUnpacker_unpacker_offline
  gm2calo::GpuCTagArtRecords_tIslandUnpacker_unpacker_offline
  gm2calo::IslandArtRecords_smislandUnpacker_unpacker_offline
  gm2calo::IslandArtRecords_tIslandUnpacker_unpacker_offline
  gm2calo::LaserEventArtRecords_laserEventAggregator_aggregator_offline
  gm2calo::LaserEventArtRecords_laserShotCorrector_corrector_offline
  gm2calo::LaserEventArtRecords_laserEventSorter_eofLaser_offline
  gm2calo::LaserEventArtRecords_laserEventSorter_inFillLaser_offline
  gm2calo::LaserEventArtRecords_laserEventSorter_outOfFillLaser_offline
  gm2calo::LaserEventArtRecords_laserEventSorter_syncLaser_offline
  gm2calo::LaserFillInfoArtRecords_fillInfoAggregator_aggregator_offline
  gm2calo::LaserMonitorArtRecords_islandLaserMonitors_pulseProcessor_offline
  gm2calo::LaserMonitorArtRecords_islandSourceMonitors_pulseProcessor_offline
  gm2calo::LaserMonitorArtRecords_riderLaserMonitors_pulseProcessor_offline
  gm2calo::LaserMonitorArtRecords_riderSourceMonitors_pulseProcessor_offline
  gm2calo::RiderAsyncChannelHeaders_async_unpacker_offline
  gm2calo::RiderAsyncWaveformHeaders_async_unpacker_offline
  gm2calo::RiderChannelHeaders_headerUnpacker_unpacker_offline
  gm2calo::RiderChannelHeaders_rawUnpacker_unpacker_offline
  gm2calo::RiderChannelHeaders_smRawUnpacker_unpacker_offline
  gm2calo::RiderWaveformHeaders_headerUnpacker_unpacker_offline
  gm2calo::RiderWaveformHeaders_rawUnpacker_unpacker_offline
  gm2calo::RiderWaveformHeaders_smRawUnpacker_unpacker_offline
  gm2ccc::EncoderFC7ArtRecords_cccUnpacker_unpacker_offline
  gm2ccc::FanoutFC7ArtRecords_cccUnpacker_unpacker_offline
  gm2ccc::TriggerFC7ArtRecords_cccUnpacker_unpacker_offline
  gm2midastoart::MidasEventHeaderArtRecords_MidasBankInput__offline
  gm2reconeast::BSTCorrectionArtRecords_crystalTimeAlignment_corrector_offline
  gm2reconeast::CaloGlobalFitViewArtRecords_energyCalibrator_calibrator_offline
  gm2reconeast::CaloGlobalFitViewArtRecords_globalFit_fitter_offline
  gm2reconeast::CaloGlobalFitViewArtRecords_energyPartition_partition_offline
  gm2reconeast::GlobalFitArtRecords_energyCalibrator_calibrator_offline
  gm2reconeast::GlobalFitArtRecords_globalFit_fitter_offline
  gm2reconeast::GlobalFitArtRecords_energyPartition_partition_offline
  gm2strawtracker::DecayVertexArtRecords_vertices_backwards_offline
  gm2strawtracker::DecayVertexArtRecords_vertices_forwards_offline
  gm2strawtracker::StrawClusterArtRecords_clustering_straws_offline
  gm2strawtracker::StrawDCADigitArtRecords_driftDistReco_straws_offline
  gm2strawtracker::StrawDigitArtRecords_deadTime_straws_offline
  gm2strawtracker::StrawDigitArtRecords_digitizer_straws_offline
  gm2strawtracker::StrawRawDigitArtRecords_strawRawDigitizer_straws_offline
  gm2strawtracker::StrawSeedArtRecords_trackCandidates_straws_offline
  gm2strawtracker::StrawTimeIslandArtRecords_timeIslands_straws_offline
  gm2strawtracker::TrackArtRecords_tracks_straws_offline
  gm2strawtracker::TrackCandidateArtRecords_t0Finder_straws_offline
  uint_ctagProducer_ctagLabel_offline

Loop through events to see what is there

Once you open a ROOT file, you can loop through the events to do stuff. First, let's see whats what. Each "event" has a set of records. The record types are listed in the previous example. The "LaserFill" record gives us an important piece of information: fillType.

An event with fillType = 1 has data from a "fill" of muons. An event with fillType = 2 is a MIDAS asynchronous event which read out the laser data for the previous fill. After 8 real fills (16 events) there is an event that does NOT have a "LaserFill" record.

Here are a few lines of code to show this information for the first 100 events of the test file.

from heist import *

fileName = "/gm2/app/users/jstaplet/test.root" 
reader = ArtFileReader(fileName)

for evt in reader.event_loop(nmax=100):
    lsiar = evt.get_record('gm2calo::LaserFillInfoArtRecords_fillInfoAggregator_aggregator_offline')
    run = evt.get_run_ID()
    subrun = evt.get_subrun_ID()
    event = evt.get_event_ID()
    try:
        lsiar0 = lsiar[0]
    fillType = str(lsiar0.fillType)
    fillNum = str(lsiar0.fillNum)
    except TypeError:
    fillType = "?" 
    fillNum = "?" 
    print ("run=%5d | subrun=%4d | event=%4d | fillType=%s | fillNum=%3s"%(run, subrun, event, fillType, fillNum))

At the ipython prompt, run the file 02-events.py with the "run magic" to see what's what in the test file

In [53]: %run 02-events.py
Successfully opened file /gm2/app/users/jstaplet/test.root
Initialized ArtFileReader event at Run16461 SubRun432 Event1
run=16461 | subrun= 432 | event=   1 | fillType=2 | fillNum=  1
run=16461 | subrun= 432 | event=   2 | fillType=1 | fillNum=  2
run=16461 | subrun= 432 | event=   3 | fillType=2 | fillNum=  3
run=16461 | subrun= 432 | event=   4 | fillType=1 | fillNum=  4
run=16461 | subrun= 432 | event=   5 | fillType=2 | fillNum=  5
run=16461 | subrun= 432 | event=   6 | fillType=1 | fillNum=  6
run=16461 | subrun= 432 | event=   7 | fillType=2 | fillNum=  7
run=16461 | subrun= 432 | event=   8 | fillType=1 | fillNum=  8
run=16461 | subrun= 432 | event=   9 | fillType=2 | fillNum=  9
run=16461 | subrun= 432 | event=  10 | fillType=1 | fillNum= 10
run=16461 | subrun= 432 | event=  11 | fillType=2 | fillNum= 11
run=16461 | subrun= 432 | event=  12 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  13 | fillType=1 | fillNum= 13
run=16461 | subrun= 432 | event=  14 | fillType=2 | fillNum= 14
run=16461 | subrun= 432 | event=  15 | fillType=1 | fillNum= 15
run=16461 | subrun= 432 | event=  16 | fillType=2 | fillNum= 16
run=16461 | subrun= 432 | event=  17 | fillType=1 | fillNum= 17
run=16461 | subrun= 432 | event=  18 | fillType=2 | fillNum= 18
run=16461 | subrun= 432 | event=  19 | fillType=1 | fillNum= 19
run=16461 | subrun= 432 | event=  20 | fillType=2 | fillNum= 20
run=16461 | subrun= 432 | event=  21 | fillType=1 | fillNum= 21
run=16461 | subrun= 432 | event=  22 | fillType=2 | fillNum= 22
run=16461 | subrun= 432 | event=  23 | fillType=1 | fillNum= 23
run=16461 | subrun= 432 | event=  24 | fillType=2 | fillNum= 24
run=16461 | subrun= 432 | event=  25 | fillType=1 | fillNum= 25
run=16461 | subrun= 432 | event=  26 | fillType=2 | fillNum= 26
run=16461 | subrun= 432 | event=  28 | fillType=1 | fillNum= 28
run=16461 | subrun= 432 | event=  29 | fillType=2 | fillNum= 29
run=16461 | subrun= 432 | event=  30 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  31 | fillType=1 | fillNum= 31
run=16461 | subrun= 432 | event=  32 | fillType=2 | fillNum= 32
run=16461 | subrun= 432 | event=  33 | fillType=1 | fillNum= 33
run=16461 | subrun= 432 | event=  34 | fillType=2 | fillNum= 34
run=16461 | subrun= 432 | event=  35 | fillType=1 | fillNum= 35
run=16461 | subrun= 432 | event=  36 | fillType=2 | fillNum= 36
run=16461 | subrun= 432 | event=  37 | fillType=1 | fillNum= 37
run=16461 | subrun= 432 | event=  38 | fillType=2 | fillNum= 38
run=16461 | subrun= 432 | event=  39 | fillType=1 | fillNum= 39
run=16461 | subrun= 432 | event=  40 | fillType=2 | fillNum= 40
run=16461 | subrun= 432 | event=  41 | fillType=1 | fillNum= 41
run=16461 | subrun= 432 | event=  42 | fillType=2 | fillNum= 42
run=16461 | subrun= 432 | event=  43 | fillType=1 | fillNum= 43
run=16461 | subrun= 432 | event=  44 | fillType=2 | fillNum= 44
run=16461 | subrun= 432 | event=  45 | fillType=1 | fillNum= 45
run=16461 | subrun= 432 | event=  46 | fillType=2 | fillNum= 46
run=16461 | subrun= 432 | event=  47 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  48 | fillType=1 | fillNum= 48
run=16461 | subrun= 432 | event=  49 | fillType=2 | fillNum= 49
run=16461 | subrun= 432 | event=  50 | fillType=1 | fillNum= 50
run=16461 | subrun= 432 | event=  51 | fillType=2 | fillNum= 51
run=16461 | subrun= 432 | event=  52 | fillType=1 | fillNum= 52
run=16461 | subrun= 432 | event=  53 | fillType=2 | fillNum= 53
run=16461 | subrun= 432 | event=  54 | fillType=1 | fillNum= 54
run=16461 | subrun= 432 | event=  55 | fillType=2 | fillNum= 55
run=16461 | subrun= 432 | event=  56 | fillType=1 | fillNum= 56
run=16461 | subrun= 432 | event=  57 | fillType=2 | fillNum= 57
run=16461 | subrun= 432 | event=  58 | fillType=1 | fillNum= 58
run=16461 | subrun= 432 | event=  59 | fillType=2 | fillNum= 59
run=16461 | subrun= 432 | event=  60 | fillType=1 | fillNum= 60
run=16461 | subrun= 432 | event=  61 | fillType=2 | fillNum= 61
run=16461 | subrun= 432 | event=  62 | fillType=1 | fillNum= 62
run=16461 | subrun= 432 | event=  63 | fillType=2 | fillNum= 63
run=16461 | subrun= 432 | event=  64 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  65 | fillType=1 | fillNum= 65
run=16461 | subrun= 432 | event=  66 | fillType=2 | fillNum= 66
run=16461 | subrun= 432 | event=  67 | fillType=1 | fillNum= 67
run=16461 | subrun= 432 | event=  68 | fillType=2 | fillNum= 68
run=16461 | subrun= 432 | event=  69 | fillType=1 | fillNum= 69
run=16461 | subrun= 432 | event=  70 | fillType=2 | fillNum= 70
run=16461 | subrun= 432 | event=  71 | fillType=1 | fillNum= 71
run=16461 | subrun= 432 | event=  72 | fillType=2 | fillNum= 72
run=16461 | subrun= 432 | event=  73 | fillType=1 | fillNum= 73
run=16461 | subrun= 432 | event=  74 | fillType=2 | fillNum= 74
run=16461 | subrun= 432 | event=  75 | fillType=1 | fillNum= 75
run=16461 | subrun= 432 | event=  76 | fillType=2 | fillNum= 76
run=16461 | subrun= 432 | event=  77 | fillType=1 | fillNum= 77
run=16461 | subrun= 432 | event=  78 | fillType=2 | fillNum= 78
run=16461 | subrun= 432 | event=  79 | fillType=1 | fillNum= 79
run=16461 | subrun= 432 | event=  80 | fillType=2 | fillNum= 80
run=16461 | subrun= 432 | event=  81 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  82 | fillType=1 | fillNum= 82
run=16461 | subrun= 432 | event=  83 | fillType=2 | fillNum= 83
run=16461 | subrun= 432 | event=  84 | fillType=1 | fillNum= 84
run=16461 | subrun= 432 | event=  85 | fillType=2 | fillNum= 85
run=16461 | subrun= 432 | event=  86 | fillType=1 | fillNum= 86
run=16461 | subrun= 432 | event=  87 | fillType=2 | fillNum= 87
run=16461 | subrun= 432 | event=  88 | fillType=1 | fillNum= 88
run=16461 | subrun= 432 | event=  89 | fillType=2 | fillNum= 89
run=16461 | subrun= 432 | event=  90 | fillType=1 | fillNum= 90
run=16461 | subrun= 432 | event=  91 | fillType=2 | fillNum= 91
run=16461 | subrun= 432 | event=  92 | fillType=1 | fillNum= 92
run=16461 | subrun= 432 | event=  93 | fillType=2 | fillNum= 93
run=16461 | subrun= 432 | event=  94 | fillType=1 | fillNum= 94
run=16461 | subrun= 432 | event=  95 | fillType=2 | fillNum= 95
run=16461 | subrun= 432 | event=  96 | fillType=1 | fillNum= 96
run=16461 | subrun= 432 | event=  97 | fillType=2 | fillNum= 97
run=16461 | subrun= 432 | event=  98 | fillType=? | fillNum=  ?
run=16461 | subrun= 432 | event=  99 | fillType=1 | fillNum= 99
run=16461 | subrun= 432 | event= 100 | fillType=2 | fillNum=100
run=16461 | subrun= 432 | event= 101 | fillType=1 | fillNum=101
Reached maximum 100 events!

Get reconeast clusters for "real" fills

A wiggle plot histograms times of events in calorimeters. Each event from a real fill has a "recon east clusters" record, which is a list of clusters found during a fill. We can also get GPS timing information and the sequence index from other records, like so:

        gps_tag = heist.InputTag(quicktag='gm2common::GPSArtRecord_GPSUnpacker_GPSUnpacker0_offline')
        cluster_tag = heist.InputTag(
            quicktag='gm2reconeast::GlobalFitArtRecords_energyPartition_partition_offline'
        )

        artreader = heist.ArtFileReader(rootFileName)

        nClusterRecords =0

        with open(cdbFileName,'wb') as cdbFile:
            with open(edbFileName,'wb') as edbFile:
                for evt in artreader.event_loop(nmax=None):
                    evtRun, evtSubrun, event = evt.get_ID()
                    cluster_records = evt.get_record(cluster_tag)
                    if not cluster_records: continue
                    nClusterRecords += 1

                    # grab GPS times
                    gps_record = evt.get_record(gps_tag)
                    unixTimeFE, unixTimeFEFraction = gps_record.unixTimeFE,gps_record.unixTimeFEFraction

                    encoder_record = evt.get_records('gm2ccc::EncoderFC7ArtRecords_cccUnpacker_unpacker_offline')
                    sequenceIndex = int(encoder_record.data().sequenceIndex)

This is in sample file 03-reconeast.py, which shows the following:

In [7]: %run 03-reconeast.py
Successfully opened file /gm2/app/users/jstaplet/test.root
Initialized ArtFileReader event at Run16461 SubRun432 Event1
run=16461 subrun= 432 event=   2 sequenceIndex=3 unixTime=1525841356 unixTimeFraction=1748654973 nClusters=    3
run=16461 subrun= 432 event=   4 sequenceIndex=4 unixTime=1525841356 unixTimeFraction=1791316797 nClusters=    4
run=16461 subrun= 432 event=   6 sequenceIndex=5 unixTime=1525841356 unixTimeFraction=1834550470 nClusters=    5
run=16461 subrun= 432 event=   8 sequenceIndex=6 unixTime=1525841356 unixTimeFraction=1877265570 nClusters=    6
run=16461 subrun= 432 event=  10 sequenceIndex=7 unixTime=1525841356 unixTimeFraction=1920334046 nClusters=    7
run=16461 subrun= 432 event=  13 sequenceIndex=0 unixTime=1525841356 unixTimeFraction=2764705723 nClusters=    0
run=16461 subrun= 432 event=  15 sequenceIndex=1 unixTime=1525841356 unixTimeFraction=2807600723 nClusters=    1
run=16461 subrun= 432 event=  19 sequenceIndex=3 unixTime=1525841356 unixTimeFraction=2893742232 nClusters=    3
run=16461 subrun= 432 event=  21 sequenceIndex=4 unixTime=1525841356 unixTimeFraction=2936571744 nClusters=    4
run=16461 subrun= 432 event=  23 sequenceIndex=5 unixTime=1525841356 unixTimeFraction=2979743289 nClusters=    5
run=16461 subrun= 432 event=  25 sequenceIndex=6 unixTime=1525841356 unixTimeFraction=3022260581 nClusters=    6
run=16461 subrun= 432 event=  28 sequenceIndex=7 unixTime=1525841356 unixTimeFraction=3065425760 nClusters=    7
run=16461 subrun= 432 event=  31 sequenceIndex=0 unixTime=1525841357 unixTimeFraction=3336470399 nClusters=    0
run=16461 subrun= 432 event=  33 sequenceIndex=1 unixTime=1525841357 unixTimeFraction=3379176308 nClusters=    1
run=16461 subrun= 432 event=  35 sequenceIndex=2 unixTime=1525841357 unixTimeFraction=3422281214 nClusters=    2
run=16461 subrun= 432 event=  39 sequenceIndex=4 unixTime=1525841357 unixTimeFraction=3508367778 nClusters=    4
run=16461 subrun= 432 event=  41 sequenceIndex=5 unixTime=1525841357 unixTimeFraction=3551190641 nClusters=    5
run=16461 subrun= 432 event=  43 sequenceIndex=6 unixTime=1525841357 unixTimeFraction=3593998260 nClusters=    6
run=16461 subrun= 432 event=  45 sequenceIndex=7 unixTime=1525841357 unixTimeFraction=3637071249 nClusters=    7
run=16461 subrun= 432 event=  48 sequenceIndex=0 unixTime=1525841358 unixTimeFraction= 186463455 nClusters=    0
run=16461 subrun= 432 event=  50 sequenceIndex=1 unixTime=1525841358 unixTimeFraction= 229597836 nClusters=    1
run=16461 subrun= 432 event=  52 sequenceIndex=2 unixTime=1525841358 unixTimeFraction= 272487714 nClusters=    2
run=16461 subrun= 432 event=  54 sequenceIndex=3 unixTime=1525841358 unixTimeFraction= 315393890 nClusters=    3
run=16461 subrun= 432 event=  58 sequenceIndex=5 unixTime=1525841358 unixTimeFraction= 401027048 nClusters=    5
run=16461 subrun= 432 event=  60 sequenceIndex=6 unixTime=1525841358 unixTimeFraction= 444300509 nClusters=    6
run=16461 subrun= 432 event=  62 sequenceIndex=7 unixTime=1525841358 unixTimeFraction= 487066342 nClusters=    7
run=16461 subrun= 432 event=  65 sequenceIndex=0 unixTime=1525841359 unixTimeFraction= 757845374 nClusters=    0
run=16461 subrun= 432 event=  67 sequenceIndex=1 unixTime=1525841359 unixTimeFraction= 800891235 nClusters=    1
run=16461 subrun= 432 event=  69 sequenceIndex=2 unixTime=1525841359 unixTimeFraction= 843624586 nClusters=    2
run=16461 subrun= 432 event=  71 sequenceIndex=3 unixTime=1525841359 unixTimeFraction= 886911688 nClusters=    3
run=16461 subrun= 432 event=  73 sequenceIndex=4 unixTime=1525841359 unixTimeFraction= 929452931 nClusters=    4
run=16461 subrun= 432 event=  77 sequenceIndex=6 unixTime=1525841359 unixTimeFraction=1015442341 nClusters=    6
run=16461 subrun= 432 event=  79 sequenceIndex=7 unixTime=1525841359 unixTimeFraction=1058491855 nClusters=    7
run=16461 subrun= 432 event=  82 sequenceIndex=0 unixTime=1525841359 unixTimeFraction=1903154982 nClusters=    0
run=16461 subrun= 432 event=  84 sequenceIndex=1 unixTime=1525841359 unixTimeFraction=1945890063 nClusters=    1
run=16461 subrun= 432 event=  86 sequenceIndex=2 unixTime=1525841359 unixTimeFraction=1989045401 nClusters=    2
run=16461 subrun= 432 event=  88 sequenceIndex=3 unixTime=1525841359 unixTimeFraction=2031900861 nClusters=    3
run=16461 subrun= 432 event=  90 sequenceIndex=4 unixTime=1525841359 unixTimeFraction=2074921141 nClusters=    4
run=16461 subrun= 432 event=  92 sequenceIndex=5 unixTime=1525841359 unixTimeFraction=2117834564 nClusters=    5
run=16461 subrun= 432 event=  96 sequenceIndex=7 unixTime=1525841359 unixTimeFraction=2203746470 nClusters=    7
run=16461 subrun= 432 event=  99 sequenceIndex=0 unixTime=1525841360 unixTimeFraction=2474423689 nClusters=    0
run=16461 subrun= 432 event= 101 sequenceIndex=1 unixTime=1525841360 unixTimeFraction=2517161695 nClusters=    1
Reached maximum 100 events!