Tiesheng Dai & Steven Goldfarb US–ATLAS Muon Alignment & Calibration Software Workshop Boston University – 18 Dec 2008 ATLAS Cosmic Muon Reconstruction A Brief Tutorial
Jan 11, 2016
Tiesheng Dai & Steven GoldfarbUS–ATLAS Muon Alignment & Calibration Software Workshop
Boston University – 18 Dec 2008
Tiesheng Dai & Steven GoldfarbUS–ATLAS Muon Alignment & Calibration Software Workshop
Boston University – 18 Dec 2008
ATLAS Cosmic Muon ReconstructionA Brief Tutorial
ATLAS Cosmic Muon ReconstructionA Brief Tutorial
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 2
Primary Goals Find cosmic muon data Reconstruct that data in the Muon Spectrometer with athena Create and Modify Calibration N-Tuples and AANT Analyze the data in those N-Tuples
Primary Goals Find cosmic muon data Reconstruct that data in the Muon Spectrometer with athena Create and Modify Calibration N-Tuples and AANT Analyze the data in those N-Tuples
The TutorialThe Tutorial
What We Won’t Do Explain athena or the Muon reconstruction algorithms Spend much time on the technical issues of installation / running Run in batch or on the grid (or therefore over many events) Debug, calibrate & align the detector (exercise for the student)
What We Won’t Do Explain athena or the Muon reconstruction algorithms Spend much time on the technical issues of installation / running Run in batch or on the grid (or therefore over many events) Debug, calibrate & align the detector (exercise for the student)
AANT
Raw Data
CalibrationN-Tuple
athena
Wiki Instructionshttps://hep.pa.msu.edu/twiki/bin/view/AGLT2/MuonReco
Wiki Instructionshttps://hep.pa.msu.edu/twiki/bin/view/AGLT2/MuonReco
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 3
CERN Online Raw Data
/castor/cern.ch/grid/atlas/DAQ/2008
/castor/cern.ch/grid/atlas/DAQ/M7 (May-July 2008)
CERN Offline Data
/castor/cern.ch/grid/atlas/atlasdatadisk/data08_X/YX = 1beammag, calib, cos, cosmag, cvalid and idcomm, Y = RAW, AOD, ESD, CBNT, TAG
Common Castor Commands:nsls, rfdir, rfcp (see user guide in Software wiki pages)
AGLT2 (ATLAS Great Lakes Tier 2) /pnfs/aglt2.org/data/daits/mdaq/
NOTE: Muon Data Only (stripped to MDT, CSC, RPC, TGC, Trig)
DCACHE Commands: ls, dir, dccp
BNL (ATLAS Tier 1) [Muon Data Only of Run 91060] /pnfs/usatlas.bnl.gov/u06/daits/mdaq/
BU (ATLAS Tier 2) [Muon Data Only of Run 91060] NFS: /data4/bu/daits/mdaq/
More Information: http://atlas-runquery.cern.ch
Finding The DataFinding The Data
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 4
DQ2
https://twiki.cern.ch/twiki/bin/view/Atlas/WorkBookDQ2 Setting Up DQ2
CERN : /afs/cern.ch/atlas/offline/external/GRID/ddm/DQ2Clients/setup.[c]sh AGLT2 : $LCG_ENV/grid_env.[c]sh and $DQ2_ENV/setup.[c]sh BNL : /afs/usatlas.bnl.gov/lcg/current/etc/profile.d/grid_env.[c]sh;
/afs/usatlas.bnl.gov/Grid/Don-Quijote/DQ2Clients/setup.[c]sh
• DQ2_LOCAL_SITE_ID = BNL-OSG2_DATATAPE
Grid Certificate Needed for voms-enabled proxy https://www.racf.bnl.gov/docs/howto/grid
Some Basic Commands: List: dq2-ls –f data08_cos.00091060.physics_TGCwBeam.daq.RAW.o4 Copy: dq2-get data08_cos.00091060.physics_TGCwBeam.daq.RAW.o4
But, what are you doing copying a raw data set, anyway? Better to run on the grid, at CERN, or at a Tier 1 or Tier 2 site.
Finding The DataFinding The Data
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 5
The Scripts Tutorial Based on Scripts of Tiesheng
Installation of software and setup of environment Running of reconstruction and filling of n-tuples
Advantages Limited Time of Tutorial Simplicity & Robustness Provides Record of Full Procedure (Copy It!)
Where to Run the Scripts AGLT2 : ssh -Y myusername@AssignedNodeForYou (see mail of Bob Ball) OR ssh -Y [email protected] (X=1,2,3) CERN : ssh -Y [email protected] OR any CERN linux machine with AFS BNL : ssh -Y [email protected], rterm -i BU : ssh -Y [email protected] (no package checkout)
Installing & Running The SoftwareInstalling & Running The Software
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 6
The Installation ScriptThe Installation Script
Example Usage:~daits/public/scripts/installProdMuonRec 14.5.0.1 -checkout MuonSpectrometer/MuonCalib/MuonCalibNtuple
Directories AtlasProduction/
cmthome : requirements file and initial setup scripts; MuonSpectrometer : any packages that were checked out; InstallArea : libraries and links for checked out packages; data08list : 2008 data file lists; runCtrl : python jobOption files and full setup script; job : Scripts to process data.
Caution: Script will not overwrite any existing package unless “update” option used.
• Still, be careful if you are editing files in the packages
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 7
The Installed EnvironmentThe Installed Environment
Note
By default, the Tier Centers install the distribution kits. The script option –KITDIR allows the user to point to one of those kits explicitly. If AthenaProduction was not included in that kit, the script will find the right tag for the release and install it.
Note
By default, the Tier Centers install the distribution kits. The script option –KITDIR allows the user to point to one of those kits explicitly. If AthenaProduction was not included in that kit, the script will find the right tag for the release and install it.
The Run Scripts jobs/run_using_default
reads data directly (castor at CERN, DCACHE for BNL, AGL2) ESD not written
jobs/run_using_local_disk copies data to local area (/tmp/username) from DCACHE or castor
Both ESD writing turned off dataFileName and numberEvent can be specified as input to script
Examplemkdir test; cd test
../job/run_using_local_disk ! 10 Runs reconstruction on 10 events of the default data set
New Files Produced CalibrationNtuple.root ntuple.root (Muon AANT)
We’re Done!!! But, what did we do?
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 8
RunningRunning
Create cmthome/requirements According to the Machine / Environment
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 9
Inside InstallProdMuonRec (1)Inside InstallProdMuonRec (1)
use athena kit
kit location
install area
cvs kserver
Set up CMT environment for version of CMTsource $CMTDIR/$CMTVERS/mgr/setup.sh
Build the setup scriptscmt config
Install the package from the kit, using pacman
Example of a private installation:~daits/public/scripts/installProdMuonRec 14.5.0.1 -kitdir /afs/atlas.umich.edu/athena/
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 10
Inside InstallProdMuonRec (2)Inside InstallProdMuonRec (2)
Obtain AFS token (KERBEROS 4) if necessarykinit -4 [email protected]
Setting Up CVS and CMTCERN: CVSROOT=:gserver:isscvs.cern.ch:/local/reps/atlas; CMT=cmt
BNL: CVSROOT=/afs/usatlas.bnl.gov/software/cvs; CMT=bnl_cmt
AGLT2: CVSROOT=:kserver:atlas-sw.cern.ch:/atlascvs; CMT=cmt
BU Tier2: CVSROOT=:kserver:atlas-sw.cern.ch:/atlascvs; CMT=cmt
Setup ATHENA Environment Shell & athena Environment
/bin/sh
cd ~/work/p14.5.0.1
source ./runctrl/setup.sh
get AFS token if necessary
Check Out and Install Packages Explicit tag used when provided, else uses correct tag for Release
cmt show versions MuonSpectrometer/MuonReconstruction/MuonRecExample
Example checkout and build:cmt co –r MuonRecExample-01-01-20
MuonSpectrometer/MuonReconstruction/MuonRecExample (use bnl_cmt at BNL Tier 1)
cd ~/work/p14.5.0.1; unset CMTPATH; source cmthome/setup.sh –tag=32,14.5.0
cd MuonSpectrometer/MuonReconstruction/MuonRecExample/cmt;
source setup.sh; gmake
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 11
Inside InstallProdMuonRec (3)Inside InstallProdMuonRec (3)
Find and Link to Data File Lists According to user’s request
Generate Setup Script Example for AtlasProduction from Kit:
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 12
Inside InstallProdMuonRec (4)Inside InstallProdMuonRec (4)
Modify jobOptions to account for user’s requests, data sets, etc. MuonDataRec_myTopOptions.py
Generate run scripts for cosmics
Making Changes to the jobOptions and Running
mkdir myinstallarea/AtlasProduction/work
cd myinstallarea/AtlasProduction/work
source ../runCtrl/setup.sh
cp ../runCtrl/MuonDataRec_myTopOptions.py .Modify MuonDataRec_myTopOptions.py as you need.
athena.py –s MuonDataRec_myTopOptions.py
Running on More or Different Data Using Castor
https://twiki.cern.ch/twiki/bin/view/Atlas/WorkBookCastor
Using DCACHE https://www.racf.bnl.gov/Facility/dcache/ https://hep.pa.msu.edu/twiki/bin/view/AGLT2/DCacheNotes
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 13
Moving On After The TutorialMoving On After The Tutorial
MuonDataRec_myTopOptions.py Settings for Tutorial
ESD output : rec.doWriteESD = False MDT segment T0 fit : muonRecFlags.doSegmentT0Fit = False Alignment correction : muonRecFlags.useAlignmentCorrections = True Detector Control (run 91897 with CSC) : muonRecFlags.doCSCs=False
Read Multiple Data Files athenaCommonFlags.BSRDOInput.set_Value_and_Lock([ ‘FILE1’, ‘FILE2’,…])
MuonRecFlags.py Where to Find the File
MuonSpectrometer/MuonReconstruction/MuonRecExample/python/
Modify with Care
More Examples Modified files
~daits/public/demo_for_14.5.0.1
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 14
More On jobOptionsMore On jobOptions
MuonRecFlags.py Create New Flag: useMDTCalibSQLLite
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 15
Reading Calibration Constants From SQLLiteReading Calibration Constants From SQLLite
Add these lines after the useAlignmentCorrections flag to define this flag.
Add these lines after the useAlignmentCorrections flag to define this flag.
MuonReadCalib.py Change:
to:
MuonSpectrometer/MuonCalib/MuonCalibNtuple/MuonCalibNtuple/MuonEventNtupleBranch.h Add line: int dummyForTest;
before: int eventNumber;
MuonSpectrometer/MuonCalib/MuonCalibNtuple/src/MuonEventNtupleBranch.cxx Add line: branchCreator.createBranch( tree, "dummyForTest" , &dummyForTest, "/I“ );
before: branchCreator.createBranch( tree, "eventNumber" , &eventNumber, "/I" ); Add line: dummyForTest = 1;
before: runNumber = eventInfo.runNumber();
Build the Code~daits/public/scripts/installProdMuonRec 14.5.0.1 -checkout no -compile
MuonSpectrometer/MuonCalib/MuonCalibNtuple
Run the Code../job/run_using_local_disk
Take a Quick Look at the N-Tuple to See if it Worked~daits/public/scripts/generator_cppfile_for_calibNtuple CalibrationNtuple.root mytest
more mytest.h
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 16
Adding Content to the Calibration N-TupleAdding Content to the Calibration N-Tuple
Here it is!Here it is!
What To Use AANTP will NO LONGER be produced in central production Muon Calibration N-Tuple WILL be produced Tracking Contents
Moore Track Parameters in Calibration N-Tuple for 14.5.0.1 Muonboy Track Parameters in later releases (not yet segments)
Documentation Muon Calibration N-tuple
https://twiki.cern.ch/twiki/bin/view/Atlas/MuonCalibNtuple
Muon Spectrometer Nomenclaturehttps://hep.pa.msu.edu/twiki/pub/AGLT2/MuonReco/MS_Naming.ppt
Muon AANT for raw datahttps://twiki.cern.ch/twiki/bin/view/Atlas/MuonCommRawDataAna
Muon AANT for MOORE trackinghttps://twiki.cern.ch/twiki/bin/view/Atlas/MooreNtuple
Muon AANT for Muonboy trackinghttp://cern.ch/atlas-samusog/muonboy/DocNtuples/CBNT_Muon.html
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 17
More On the N-TuplesMore On the N-Tuples
User Analysis Example: mytest Create a work area for analysis and run Tiesheng’s script
mkdir ~/work/p14.5.0.1/anal; cd ~/work/p14.5.0.1/anal
~daits/public/scripts/generate_cppfile_for_calibNtuple ../test/CalibrationNtuple.root mytest
Modify mytest.h to include more ntuple files: Replace mytest::mytest(TTree *tree) by
Or copy ~daits/public/muon_calib_ntup_demo/mytest.h
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 18
Analyzing The Calibration N-TupleAnalyzing The Calibration N-Tuple
root -lTFile *my = new TFile(“../test/calibrationNtuple.root")my->ls()my->cd("PatternNtupleMaker")Segments->MakeClass(“mytest").q
root -lTFile *my = new TFile(“../test/calibrationNtuple.root")my->ls()my->cd("PatternNtupleMaker")Segments->MakeClass(“mytest").q
User Analysis Example: mytest (2) Add code to mytest.C
Here is an example from ~daits/public/muon_calib_ntup_demo/mytest.C
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 19
Analyzing The Calibration N-TupleAnalyzing The Calibration N-Tuple
Open new root file for outputOpen new root file for output
Write plots to root fileWrite plots to root file
Fill histogramsFill histograms
Book histogramsBook histograms
Make plotMake plot
User Analysis Example: mytest (3) Perform the Analysis
~daits/public/scripts/run_cppfile mytest
Take a look at All_plots.pdf and mytest.root
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 20
Analyzing The Calibration N-TupleAnalyzing The Calibration N-Tuple
root -l.L mytest.Cmytest pp.Loop().q
root -l.L mytest.Cmytest pp.Loop().q
Some Expert Code Decoding the Identifiers:
~daits/public/scripts/muonfixedid.h
(Code from Ed Diehl to decode muonfixedid into type, station, eta, phi)
Checking and Merging N-Tuples:~daits/public/scripts/checknt.sh
(also from Ed)
Other examples out there from other experts
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 21
Useful Analysis Tools for Calibration N-TupleUseful Analysis Tools for Calibration N-Tuple
Similar to Calibration N-Tuple Create mytest.h and mytest.C
~daits/public/scripts/generate_cppfile_for_muonNtuple ../test/ntuple.root mytest
Modify the files as in Examples from Tiesheng for 14.5.0.1:~daits/public/muon_AA_ntup_demo/
Chaining AANT files:TChain *f = new TChain("CollectionTree");
Running the Analysis~daits/public/scripts/run_cppfile mytest
Note: N-Tuples are often Athena version-dependent!
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 22
Analysis of Muon AANTAnalysis of Muon AANT
Who To Ask When You Have Questions or Problems
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 23
ExpertsExperts
Topic Contact
Questions Specific to the Tutorial Tiesheng Dai, Steven Goldfarb
General Muon Software Issues [email protected], Stephane Willocq, Rosy Nikolaidou, Ed Moyse, Kevin Black
Finding the Data http://atlas-runquery.cern.ch, Tiesheng Dai
MOORE Reconstruction [email protected], Niels van Eldik
Muonboy Reconstruction [email protected], [email protected]
ATLAS Database Technical Issues [email protected], Vakho Tsulaia, Emil Obreshenkov
Muon COOL Database Monica Verducci
MDT Calibration Database Oliver Kortner, Domizia Orestano
Calibration N-Tuple & Software Felix Rauscher, Ed Diehl
MDT Alignment Christoph Amelung (Endcap), Pierre-Francois Giraud (Barrel)
MDT Alignment Software Rob Harrington
TGC Issues Masaya Ishino
CSC Issues Woochun Park, Michael Schernau
RPC Issues Gabriele Chodini
What We Have Covered How to Find Raw Cosmic Muon Data How to Reconstruct that Data to Produce N-Tuples How to Add Information to those N-Tuples How to Analyze those N-Tuples
The Scripts Run them on the machine of your choice More Important: Copy them and use them as examples Available at CERN, BNL, AGLT2, BU
~daits/public/scripts/ ~daits/public/demo_for_14.5.0.1/ ~daits/public/muon_calib_ntup_demo/ ~daits/public/muon_AA_ntup_demo/
Enjoy!
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 24
SummarySummary
Merry Christmas and Happy New Year
Boston - 18 Dec 2008 T. Dai & S. Goldfarb - Univ of Michigan
MDT Config DB - Slide 25
Tiesheng’s Christmas CardTiesheng’s Christmas Card