Project

General

Profile

Muon Monitor Simulations » History » Version 4

« Previous - Version 4/13 (diff) - Next » - Current version
Tyler Rehak, 08/13/2018 01:06 AM


Muon Monitor Simulations

ACNET Variables

Instructions for Plotting Muon Monitor Data

This is a living document originally intended for personal use, so there may be some rough edges and room for improvement, but hopefully this will help anyone interested in this work skip past my original obstacles. -- Tyler Rehak, August 2018

Utilizing MINOS Data Files

Since some files are accessible via ifdb for 30 days, the preferred method for plotting data is to utilize the data files stored by MINOS. Instructions for using ifdb instead are listed at the bottom.

My working directory is /minerva/app/users/trehak/ifdb/

First steps:

MINOS_SETUP_DIR_GRID=/grid/fermiapp/minos/minossoft/setup
source $MINOS_SETUP_DIR_GRID/setup_minossoft_FNALU.sh -r R3.11

cd muoninfo
srt_setup -a

Edit /MuonMonInfo/MuonInfoDump.cxx as follows:
 Line 59, set output directory and file name
 Line 231, set the list of desired devices
 Lines 258-311, if you want to include looping over all the pixel data

make all

Multiple files can be used on the command line, but don't try to use all the files for a single year. Note that the output can easily be several GB, but it will be greatly reduced once it's processed with the rest of the steps included in here and then you can delete the original output csv if you need the space.

loon -b -q  dump_muonmon.C /minos/app/BEAMDATA_CF/MBEAM/2015/B150512_000000.mbeam.root

Example command for a full day of data:

nohup loon -b -q dump_muonmon.C /minos/app/BEAMDATA_CF/MBEAM/B180225_000000.mbeam.root /minos/app/BEAMDATA_CF/MBEAM/B180225_040000.mbeam.root /minos/app/BEAMDATA_CF/MBEAM/B180225_080000.mbeam.root /minos/app/BEAMDATA_CF/MBEAM/B180225_129000.mbeam.root /minos/app/BEAMDATA_CF/MBEAM/B180225_160000.mbeam.root /minos/app/BEAMDATA_CF/MBEAM/B180225_200000.mbeam.root >> out.log &

Note the format of the input minos files: /minos/app/BEAMDATA_CF/MBEAM/year/Byymmdd_hh0000.mbeam.root and each file is a 4 hour block.

You should ls /minos/app/BEAMDATA_CF/MBEAM/year/ just to be sure there were no changes in that convention in the year you are looking for. For example, last time I checked, 2018 root files were in /minos/app/BEAMDATA_CF/MBEAM/

I recommend using some python scripts to generate the loon arguments if you want data from more than a few files.

Example for 1 file from each day for several months:

s="loon -b -q dump_muonmon.C " 
for i in range(17,32):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2015/B15100"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2015/B1510"+str(i)+"_000000.mbeam.root " 

for i in range(15,31):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2016/B16110"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2016/B1611"+str(i)+"_000000.mbeam.root " 

for i in range(1,32):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2016/B16120"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2016/B1612"+str(i)+"_000000.mbeam.root " 

for i in range(1,32):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B17010"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B1701"+str(i)+"_000000.mbeam.root " 

for i in range(1,29):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B17020"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B1702"+str(i)+"_000000.mbeam.root " 

for i in range(1,32):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B17030"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B1703"+str(i)+"_000000.mbeam.root " 

for i in range(1,31):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B17040"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2017/B1704"+str(i)+"_000000.mbeam.root " 

for i in range(1,32):
    if (i<10):
        s+="/minos/app/BEAMDATA_CF/MBEAM/2015/B15050"+str(i)+"_000000.mbeam.root " 
    else:
        s+="/minos/app/BEAMDATA_CF/MBEAM/2015/B1505"+str(i)+"_000000.mbeam.root " 

Now go find the out.csv output as set in /MuonMonInfo/MuonInfoDump.cxx. Need to add a header into the first line (or add this step to MuonInfoDump if you want).

My most common header command was:

nohup sed -i '1s|^|TIME/C,TRTGTD/D,MM1XAV,MM2XAV,MM3XAV,MM1YAV,MM2YAV,MM3YAV,MTGTHS,MTGTVS,NSLINA,NSLINB,NSLINC,NSLIND,HRNDIR,MM1CNT,MM1GPD,MM1INT,MM1GPR,MM1RTD,MM2CNT,MM2GPD,MM2INT,MM2GPR,MM2RTD,MM3CNT,MM3GPD,MM3INT,MM3GPR,MM3RTD,MGSMPD104,MGSMPD105,MGSMPD106\n|' out.csv &

A full header with all the pixels is at the bottom of this page.

root

Get back into the /ifdb/muoninfo directory
Generate a ntuple from the csv using minosntuple.c. Be sure to change the input/output files as needed.
Backup existing minos.root beforehand if desired.

.x minosntuple

Run the following macro. It adds columns for a proper Unix timestamp and corrected monitor signals. It's on its own due to how I was learning and patching things together originally. Feel free to combine it into one of the other macros, but I like the discrete steps of each macro.

.x upd.c

Edit allerrors.c as follows:
 Input and output files
 Line 97, set x seconds for (time>t0+x). x determines how much data to include in each error bar. If running lots of days, each with a single 4 hour file, I like to just do the full 14400 seconds.

Note that errors.c was the first attempt at computing error bars, and then it grew to encompass most all values. You may want to use errors.c if you only grabbed the muon monitor signals and not the other devices.

Backup existing allerrors.c output (allerrors.root) if desired

.x allerrors.c

Now use allerrors.root to plot as desired.
Several graphing macros I worked on are in /ifdb/muoninfo. The most comprehensive is graphall.c
Note that my graphing macros were built for root v6, and I know there were some errors when using them with root v5. I usually downloaded allerrors.root (usually a small file) and ran the graphing macros locally.
At this point, you can delete the original out.csv and work solely with allerrors.root and minos.root.

Utilizing Data from ifdb

Note that there is a 30 day restriction on this data, so the above method with MINOS data is preferred and more recently supported.

/minerva/app/users/trehak/ifdb

source setup.sh

Edit getifdata.cpp as follows:
 Line 15 and 16, set start and end times according to Unix epoch
 Line 18, set any devices names you want recorded
 Line 32, set the interval to grab data. Over long periods, suggest using every few hours or so. Note that it is possible to simply provide a list of discrete times (see line 83 for example)
 Line 43, set the header string of the csv. You can generate it with python:

s=""#var string from line 18
t="" 
new="" 
s=s.replace("@","")
s=s.replace("]","")
s=s.replace("[","")
s=s.replace("E:","")
for i,c in enumerate(s):
    new+=c
    if c!=',':
        t+=c
    else:
        new+=t+'_t,'
        t="" 

new+=','

make getifdata

Backup existing out.csv if desired

./getifdata

Check out.csv, especially the header. For example using: head -5 out.csv

Use removeduplicates.py on out.csv to remove extraneous data points (this can be fixed in getifdata if you care)

Backup existing ifdb.root if desired

Generate root file:

root
.x ifntuple.c

Open ifdb.root and plot away

Header Command for MINOS Data

Full header with all devices for use with the MINOS files method:

nohup sed -i '1s|^|TIME/C,TRTGTD/D,MM1XAV,MM2XAV,MM3XAV,MM1YAV,MM2YAV,MM3YAV,MTGTHS,MTGTVS,NSLINA,NSLINB,NSLINC,NSLIND,HRNDIR,MM1CNT,MM1GPD,MM1INT,MM1GPR,MM1RTD,MM2CNT,MM2GPD,MM2INT,MM2GPR,MM2RTD,MM3CNT,MM3GPD,MM3INT,MM3GPR,MM3RTD,MGSMPD104,MGSMPD105,MGSMPD106,MMA1DS104,MMA1DS105,MMA1DS106,MMA1DS107,MMA1DS108,MMA1DS109,MMA1DS110,MMA1DS111,MMA1DS112,MMA1DS113,MMA1DS114,MMA1DS115,MMA1DS116,MMA1DS117,MMA1DS118,MMA1DS119,MMA1DS120,MMA1DS121,MMA1DS122,MMA1DS123,MMA1DS124,MMA1DS125,MMA1DS126,MMA1DS127,MMA1DS128,MMA1DS129,MMA1DS130,MMA1DS131,MMA1DS132,MMA1DS133,MMA1DS134,MMA1DS135,MMA1DS136,MMA1DS152,MMA1DS153,MMA1DS154,MMA1DS155,MMA1DS156,MMA1DS157,MMA1DS158,MMA1DS159,MMA1DS160,MMA1DS161,MMA1DS162,MMA1DS163,MMA1DS164,MMA1DS165,MMA1DS166,MMA1DS167,MMA1DS168,MMA1DS169,MMA1DS170,MMA1DS171,MMA1DS172,MMA1DS173,MMA1DS174,MMA1DS175,MMA1DS176,MMA1DS177,MMA1DS178,MMA1DS179,MMA1DS180,MMA1DS181,MMA1DS182,MMA1DS183,MMA1DS184,MMA1DS185,MMA1DS186,MMA1DS187,MMA1DS188,MMA1DS189,MMA1DS190,MMA1DS191,MMA1DS192,MMA1DS193,MMA1DS194,MMA1DS195,MMA1DS196,MMA1DS197,MMA1DS198,MMA1DS199,MMA1PD104,MMA1PD105,MMA1PD106,MMA1PD107,MMA1PD108,MMA1PD109,MMA1PD110,MMA1PD111,MMA1PD112,MMA1PD113,MMA1PD114,MMA1PD115,MMA1PD116,MMA1PD117,MMA1PD118,MMA1PD119,MMA1PD120,MMA1PD121,MMA1PD122,MMA1PD123,MMA1PD124,MMA1PD125,MMA1PD126,MMA1PD127,MMA1PD128,MMA1PD129,MMA1PD130,MMA1PD131,MMA1PD132,MMA1PD133,MMA1PD134,MMA1PD135,MMA1PD136,MMA1PD152,MMA1PD153,MMA1PD154,MMA1PD155,MMA1PD156,MMA1PD157,MMA1PD158,MMA1PD159,MMA1PD160,MMA1PD161,MMA1PD162,MMA1PD163,MMA1PD164,MMA1PD165,MMA1PD166,MMA1PD167,MMA1PD168,MMA1PD169,MMA1PD170,MMA1PD171,MMA1PD172,MMA1PD173,MMA1PD174,MMA1PD175,MMA1PD176,MMA1PD177,MMA1PD178,MMA1PD179,MMA1PD180,MMA1PD181,MMA1PD182,MMA1PD183,MMA1PD184,MMA1PD185,MMA1PD186,MMA1PD187,MMA1PD188,MMA1PD189,MMA1PD190,MMA1PD191,MMA1PD192,MMA1PD193,MMA1PD194,MMA1PD195,MMA1PD196,MMA1PD197,MMA1PD198,MMA1PD199,MMA2DS104,MMA2DS105,MMA2DS106,MMA2DS107,MMA2DS108,MMA2DS109,MMA2DS110,MMA2DS111,MMA2DS112,MMA2DS113,MMA2DS114,MMA2DS115,MMA2DS116,MMA2DS117,MMA2DS118,MMA2DS119,MMA2DS120,MMA2DS121,MMA2DS122,MMA2DS123,MMA2DS124,MMA2DS125,MMA2DS126,MMA2DS127,MMA2DS128,MMA2DS129,MMA2DS130,MMA2DS131,MMA2DS132,MMA2DS133,MMA2DS134,MMA2DS135,MMA2DS136,MMA2DS152,MMA2DS153,MMA2DS154,MMA2DS155,MMA2DS156,MMA2DS157,MMA2DS158,MMA2DS159,MMA2DS160,MMA2DS161,MMA2DS162,MMA2DS163,MMA2DS164,MMA2DS165,MMA2DS166,MMA2DS167,MMA2DS168,MMA2DS169,MMA2DS170,MMA2DS171,MMA2DS172,MMA2DS173,MMA2DS174,MMA2DS175,MMA2DS176,MMA2DS177,MMA2DS178,MMA2DS179,MMA2DS180,MMA2DS181,MMA2DS182,MMA2DS183,MMA2DS184,MMA2DS185,MMA2DS186,MMA2DS187,MMA2DS188,MMA2DS189,MMA2DS190,MMA2DS191,MMA2DS192,MMA2DS193,MMA2DS194,MMA2DS195,MMA2DS196,MMA2DS197,MMA2DS198,MMA2DS199,MMA2PD104,MMA2PD105,MMA2PD106,MMA2PD107,MMA2PD108,MMA2PD109,MMA2PD110,MMA2PD111,MMA2PD112,MMA2PD113,MMA2PD114,MMA2PD115,MMA2PD116,MMA2PD117,MMA2PD118,MMA2PD119,MMA2PD120,MMA2PD121,MMA2PD122,MMA2PD123,MMA2PD124,MMA2PD125,MMA2PD126,MMA2PD127,MMA2PD128,MMA2PD129,MMA2PD130,MMA2PD131,MMA2PD132,MMA2PD133,MMA2PD134,MMA2PD135,MMA2PD136,MMA2PD152,MMA2PD153,MMA2PD154,MMA2PD155,MMA2PD156,MMA2PD157,MMA2PD158,MMA2PD159,MMA2PD160,MMA2PD161,MMA2PD162,MMA2PD163,MMA2PD164,MMA2PD165,MMA2PD166,MMA2PD167,MMA2PD168,MMA2PD169,MMA2PD170,MMA2PD171,MMA2PD172,MMA2PD173,MMA2PD174,MMA2PD175,MMA2PD176,MMA2PD177,MMA2PD178,MMA2PD179,MMA2PD180,MMA2PD181,MMA2PD182,MMA2PD183,MMA2PD184,MMA2PD185,MMA2PD186,MMA2PD187,MMA2PD188,MMA2PD189,MMA2PD190,MMA2PD191,MMA2PD192,MMA2PD193,MMA2PD194,MMA2PD195,MMA2PD196,MMA2PD197,MMA2PD198,MMA2PD199,MMA3DS104,MMA3DS105,MMA3DS106,MMA3DS107,MMA3DS108,MMA3DS109,MMA3DS110,MMA3DS111,MMA3DS112,MMA3DS113,MMA3DS114,MMA3DS115,MMA3DS116,MMA3DS117,MMA3DS118,MMA3DS119,MMA3DS120,MMA3DS121,MMA3DS122,MMA3DS123,MMA3DS124,MMA3DS125,MMA3DS126,MMA3DS127,MMA3DS128,MMA3DS129,MMA3DS130,MMA3DS131,MMA3DS132,MMA3DS133,MMA3DS134,MMA3DS135,MMA3DS136,MMA3DS152,MMA3DS153,MMA3DS154,MMA3DS155,MMA3DS156,MMA3DS157,MMA3DS158,MMA3DS159,MMA3DS160,MMA3DS161,MMA3DS162,MMA3DS163,MMA3DS164,MMA3DS165,MMA3DS166,MMA3DS167,MMA3DS168,MMA3DS169,MMA3DS170,MMA3DS171,MMA3DS172,MMA3DS173,MMA3DS174,MMA3DS175,MMA3DS176,MMA3DS177,MMA3DS178,MMA3DS179,MMA3DS180,MMA3DS181,MMA3DS182,MMA3DS183,MMA3DS184,MMA3DS185,MMA3DS186,MMA3DS187,MMA3DS188,MMA3DS189,MMA3DS190,MMA3DS191,MMA3DS192,MMA3DS193,MMA3DS194,MMA3DS195,MMA3DS196,MMA3DS197,MMA3DS198,MMA3DS199,MMA3PD104,MMA3PD105,MMA3PD106,MMA3PD107,MMA3PD108,MMA3PD109,MMA3PD110,MMA3PD111,MMA3PD112,MMA3PD113,MMA3PD114,MMA3PD115,MMA3PD116,MMA3PD117,MMA3PD118,MMA3PD119,MMA3PD120,MMA3PD121,MMA3PD122,MMA3PD123,MMA3PD124,MMA3PD125,MMA3PD126,MMA3PD127,MMA3PD128,MMA3PD129,MMA3PD130,MMA3PD131,MMA3PD132,MMA3PD133,MMA3PD134,MMA3PD135,MMA3PD136,MMA3PD152,MMA3PD153,MMA3PD154,MMA3PD155,MMA3PD156,MMA3PD157,MMA3PD158,MMA3PD159,MMA3PD160,MMA3PD161,MMA3PD162,MMA3PD163,MMA3PD164,MMA3PD165,MMA3PD166,MMA3PD167,MMA3PD168,MMA3PD169,MMA3PD170,MMA3PD171,MMA3PD172,MMA3PD173,MMA3PD174,MMA3PD175,MMA3PD176,MMA3PD177,MMA3PD178,MMA3PD179,MMA3PD180,MMA3PD181,MMA3PD182,MMA3PD183,MMA3PD184,MMA3PD185,MMA3PD186,MMA3PD187,MMA3PD188,MMA3PD189,MMA3PD190,MMA3PD191,MMA3PD192,MMA3PD193,MMA3PD194,MMA3PD195,MMA3PD196,MMA3PD197,MMA3PD198,MMA3PD199\n|' out.csv &