Closed mattbellis closed 3 years ago
Hello,
There is a python "helper" class to query and perform actions in McM. You can find some examples here: https://github.com/cms-PdmV/mcm_scripts Here are the newest tutorial slides: https://indico.cern.ch/event/894961/contributions/3774016/attachments/2005333/3349474/McM_Scripting_2020_03_18.pdf
If you just want to query requests with that dataset, this will do:
import json
import sys
sys.path.append('/afs/cern.ch/cms/PPD/PdmV/tools/McM/')
from rest import McM
mcm = McM(dev=False)
dataset = 'TTToHadronic_TuneCP5_13TeV-powheg-pythia8'
requests = mcm.get('requests', query='dataset_name=%s' % (dataset))
for req in requests:
print(req['prepid'])
# Uncomment line below to see a full request dictionary
# print(json.dumps(req, indent=2, sort_keys=True))
Just run it somewhere where /afs
is accessible and cern-get-sso-cookie
program is present, for example, lxplus.
This is amazing!!!!!!!!!!!!!!!!!!!!!!! Thank you @justinasr !!!! It just worked for me!!!!!
Off to write a script to parse the json output!!!!
Seriously, this is life-changing. :D I think very few people know about this because I've asked around and no one seems to know that this is possible. This is so. cool.
Glad it helped! McM scripting is no secret, just requires some effort to write your own script :)
Hi McM developers,
Sorry if this already exists and I can't find it, but is there a command-line tool, similar to dasclient/dasgoclient, with which I can query the McM database? I'd like to be able to pass in a dataset like (for example)
and get out cross-section used, number of events produced, and any weighting, for example. These are all numbers I need for my final analysis. I can use the website, but I have many of these datasets and a script would be super helpful for doing this all automatically. Thanks so much!