WorkBook 9.6 How to Pick Events (Interactive and CRAB3)

To avoid the current (Aug 2016 onwards) issues (it doesnt seem to parse correctly), do the output lines directly with edmCopyPickMerge ie:

edmCopyPickMerge outputFile=pickevents.root eventsToProcess=248038:12714964,XXX:YYYY,MMM:ZZZZ inputFiles=/store/data/Run2015A/MET/RECO/PromptReco-v1/000/248/038/00000/546E74FC-5D14-E511-9DCE-02163E0145BA.root

27 Sep 2016

edmCopyPickMerge outputFile=pickevents.root eventsToProcess=278817:66:3428691 inputFiles=/store/data/Run2016G/DoubleEG/RECO/PromptReco-v1/000/278/817/00000/C0276B9E-9F63-E611-AF6C-02163E011976.root


27-Sep-2016 17:22:59 CEST  Initiating request to open file root://
[2016-09-27 17:23:01.081517 +0200][Error  ][XRootD            ] [] Handling error while processing kXR_open (file: /eos/cms/store/data/Run2016G/DoubleEG/RECO/PromptReco-v1/000/278/817/00000/C0276B9E-9F63-E611-AF6C-02163E011976.root, mode: 0660, flags: kXR_open_read kXR_async kXR_retstat ): [ERROR] Error response.
%MSG-w XrdAdaptorInternal:  file_open 27-Sep-2016 17:23:01 CEST pre-events
Failed to open file at URL root://
[2016-09-27 17:23:01.082416 +0200][Error  ][XRootD            ] [] Handling error while processing kXR_open (file: /eos/cms/store/data/Run2016G/DoubleEG/RECO/PromptReco-v1/000/278/817/00000/C0276B9E-9F63-E611-AF6C-02163E011976.root?tried=, mode: 0660, flags: kXR_open_read kXR_async kXR_retstat ): [ERROR] Error response.
%MSG-w XrdAdaptorInternal:  file_open 27-Sep-2016 17:23:01 CEST pre-events
Failed to open file at URL root://
27-Sep-2016 17:23:01 CEST  Fallback request to file root://
%MSG-w XrdAdaptor:  file_open 27-Sep-2016 17:23:05 CEST pre-events
Data is served from instead of original site
27-Sep-2016 17:23:08 CEST  Successfully opened file root://
Begin processing the 1st record. Run 278817, Event 3428691, LumiSection 66 at 27-Sep-2016 17:23:15.544 CEST
27-Sep-2016 17:23:16 CEST  Closed file root://


MessageLogger Summary

 type     category        sev    module        subroutine        count    total
 ---- -------------------- -- ---------------- ----------------  -----    -----
    1 XrdAdaptor           -w file_open                              1        1
    2 XrdAdaptorInternal   -w file_open                              2        2
    3 fileAction           -s file_close                             1        1
    4 fileAction           -s file_open                              3        3

 type    category    Examples: run/evt        run/evt          run/evt
 ---- -------------------- ---------------- ---------------- ----------------
    1 XrdAdaptor           pre-events                        
    2 XrdAdaptorInternal   pre-events       pre-events       
    3 fileAction           PostEndRun                        
    4 fileAction           pre-events       pre-events       pre-events

Severity    # Occurrences   Total Occurrences
--------    -------------   -----------------
Warning                 3                   3
System                  4                   4

with output file in /afs/ as:
-rw-r--r--. 1 davec zh 2.7M Sep 27 17:23 pickevents.root

NOTE: would not run edmCopyPickMerge in /afs/ since data created with later version of CMSSW (CMSSW_8_0_17).

23 Aug 2016 with CRAB3 works (must use CMSSW_7_4_7 or higher), BUT the output file now gets stored at a web address given by the job log file.
INFO 2016-08-22 12:28:09,431:     
Log file is /afs/

Output dataset:         /SinglePhoton/davec-crab_pickEvents-260540-27375c23c7a5bb979eff0a77ed96ed1b/USER

Output dataset DAS URL:

Enter, into DAS, the output dataset url:
or, into the web page url locator

Click on 'files' (see DAS screen below)

Get new screen for:


Comments from DAS page

CMS provides several ways to download invidual LFNs:
using xrootd CMS tool. Here is an example how you can do it (you may use any CMSSW release):

    source /afs/
    source /afs/ ===> NOT NEEDED with CRAB3
    cmsrel CMSSW_6_0_0
    cd CMSSW_6_0_0
    xrdcp root:// /some/local/path

    opened directly in CMSSW with:

    fileNames = cms.untracked.vstring('root://')

My commands to get file:

In area CMSSW_7_4_7/src/
source /afs/
csh ====> since cmsenv not set up as an alias in bash but only in csh
xrdcp root:// /afs/

/<2>work/d/davec $ ls *pick*.root
-rw-r--r--. 1 davec zh 3.3M Aug 23 11:02 pickevents_1.root

22 Aug 2016

Using the interactive version of does not work. However using the expected screen output format does work !
WorkBook comments:
To run the script interactively do the following, for example  "/MET/Run2015A-PromptReco-v1/RECO" 248038:25:12714964
*/MET/Run2015A-PromptReco-v1/RECO = is the dataset you want to pick events from. You can only do one per job.
248038:25:12714964 is one event you want to pick. The syntax is Run:Lumi:Event 
(one could also put more than one event by separating the different events with a comma: Run1:Lumi1:Event1, Run2:Lumi2:Event2. 
or "/MET/Run2015A-PromptReco-v1/RECO" events.txt
where events.txt is a text file that contains = 176163:41:69046624 = ( and others if desired, but one by line ) 

The screen output would look like this:
edmCopyPickMerge outputFile=pickevents.root \
eventsToProcess=248038:12714964 \

In this case, the user can either paste the above edmCopyPickMerge output 
run with the --runInteractive flag which will run it for you (warning, this can take a long time).

This will create a ROOT file called pickevents.root in the same directory you executed the command from. 
Also note that edmCopyPickMerge script locates configuration file and then uses it with cmsRun. 

Pre Aug 2016

Use single-event.txt with
NOTE NOTE - may need to run the single-event.txt file more than once if trying to get events from CASTOR, staging issue perhaps???

more single-event.txt:

cmsRun \
inputFiles=/store/data/Run2010B/Photon/RAW/v1/000/146/944/2CB08BA6-34CC-DF11-99F8-003048F118AC.root \
eventsToProcess=146944:254:200578359,146944:254:200582259,146944:255:201078861,146944:255:201078862,146944:255:201135456 \
  • This picks three events using the format run:lumi:event with each event separated by a comma.
  • change '/store/' which is for castor data to 'file:full....afs...address' for local files


import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing

options = VarParsing ('analysis')
# add a list of strings for events to process
options.register ('eventsToProcess',
                                  "Events to process")

process = cms.Process("PickEvent")
process.source = cms.Source ("PoolSource",
          fileNames = cms.untracked.vstring (options.inputFiles),
          eventsToProcess = cms.untracked.VEventRange (options.eventsToProcess)                               

process.Out = cms.OutputModule("PoolOutputModule",
        fileName = cms.untracked.string (options.outputFile)

process.end = cms.EndPath(process.Out)

To run single-event.txt and get the data:

chmod u+x single-event.txt  <= to make it an executable
./single-event.txt                     <= to run and get single event data

Locating files to access a single event or lumi section

Use command line syntax on lxplus, ie:
dbsql "find file where dataset=/Photon/Run2011A-May10ReReco-v1/RECO and run=163657 and lumi=34"

Using DBS instance at: file


Old DBS data search methods

DBS notes on searching for data

-- DavidCockerill - 2016-09-29
Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng DAS2.png r1 manage 98.8 K 2016-08-23 - 15:45 DavidCockerill DAS2.png
PDFpdf DBS-data-searching-for-HEEP.pdf r1 manage 973.7 K 2011-04-26 - 14:52 DavidCockerill  
PNGpng Screenshot-CMS_Data_Aggregation_Service_-_Mozilla_Firefox.png r1 manage 98.7 K 2016-08-23 - 10:44 DavidCockerill DAS-screenvies
Texttxt r1 manage 0.8 K 2011-04-15 - 18:08 DavidCockerill  
Texttxt single-event.txt r1 manage 0.3 K 2011-04-15 - 18:15 DavidCockerill  
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2016-09-30 - DavidCockerill
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback