-- RaphaelGomesDeSouza - 2019-07-03

Getting the CMS VM Image

You must download the VM Virtual Box. Make sure that the version you downloaded is working with your CMS VM Image. You can read more [[http://opendata-dev.web.cern.ch/docs/cms-virtual-machine-2011][here].

You should use the CMS SHELL in the CMS Open Data VM 1.5.1 version as you can see [[http://opendata-dev.web.cern.ch/docs/cms-getting-started-2011][here]. With other versions (CMS-OpenData-1.2.0" or "CMS-OpenData-1.3.0) you can use the normal terminal. If you use the terminal they cant construct because the SL7


Using Docker Container

In Ubuntu 18 has a problem when you try install the Virtual Box VM 5.2 an use CMS Open Data VM 1.5.1. You may should see this:


Probably due to inconmpatibility with versions of Ubuntu and Virtual box.

So is another way using Docker container. You can see how to use that in this page. As you can see in the page, you can fetch a CMSSW image, and create and start a container using the docker run command:

docker run --name opendata -it clelange/cmssw:5_3_32 /bin/bash

but with that you will not be able to use ROOT. To do so, you must use the command:

sudo docker run --name opendata -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix clelange/cmssw:5_3_32 /bin/bash

and you will able to use ROOT.

To list the containers you created use the command:

sudo docker container ls -a

To open a container, just use the command with the ID of the container that tou can see in hte list of the containers you crearted.

sudo docker attach <ID_Container>


After you emulate you CMS Open Data ova with success, you must created a CMSSW environment and change to the CMSSW_5_3_32/src/ directory: (Notice that you use the container you do not need to use the the commands below)

cmsrel CMSSW_5_3_32
cd CMSSW_5_3_32/src/

Launch the CMS analysis environment.


Create a working directory for the demo analyzer, change to that directory and create a "skeleton" for the analyzer:

mkdir Demo
cd Demo
mkedanlzr DemoAnalyzer

Compile the code:

cd DemoAnalyzer
scram b

You can ignore the message

****WARNING: No need to export library once you have declared your library as plugin. Please cleanup src/Demo/DemoAnalyzer/BuildFile by removing the section.

or take action and remove the indicated section from BuildFile.xml.

Change the file name in the configuration file demoanalyzer_cfg.py in the DemoAnalyzer directory: i.e. replace file:myfile.root with root://eospublic.cern.ch//eos/opendata/cms/Run2011A/ElectronHad/AOD/12Oct2013-v1/20001/001F9231-F141-E311-8F76-003048F00942.root Change the max number of events to 10 (i.e change -1 to 10 in process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1)).

Move two directories back using:

cd ../..

And then run:

cmsRun Demo/DemoAnalyzer/demoanalyzer_cfg.py

You can consider your VM "validated" i.e it gets access to and compiles the CMS software, and reads the CMS Open Data files if you get an output like:

16-Mar-2016 15:45:13 CET Initiating request to open file root://eospublic.cern.ch//eos/opendata/cms/Run2011A/ElectronHad/AOD/12Oct2013-v1/20001/001F9231-F141-E311-8F76-003048F00942.root

16-Mar-2016 15:45:17 CET Successfully opened file root://eospublic.cern.ch//eos/opendata/cms/Run2011A/ElectronHad/AOD/12Oct2013-v1/20001/001F9231-F141-E311-8F76-003048F00942.root

Begin processing the 1st record. Run 166782, Event 340184599, LumiSection 309 at 16-Mar-2016 15:45:40.234 CET

Begin processing the 2nd record. Run 166782, Event 340185007, LumiSection 309 at 16-Mar-2016 15:45:40.235 CET

Begin processing the 3rd record. Run 166782, Event 340187903, LumiSection 309 at 16-Mar-2016 15:45:40.236 CET

Begin processing the 4th record. Run 166782, Event 340227487, LumiSection 309 at 16-Mar-2016 15:45:40.237 CET

Begin processing the 5th record. Run 166782, Event 340210607, LumiSection 309 at 16-Mar-2016 15:45:40.237 CET

Begin processing the 6th record. Run 166782, Event 340256207, LumiSection 309 at 16-Mar-2016 15:45:40.238 CET

Begin processing the 7th record. Run 166782, Event 340165759, LumiSection 309 at 16-Mar-2016 15:45:40.239 CET

Begin processing the 8th record. Run 166782, Event 340396487, LumiSection 309 at 16-Mar-2016 15:45:40.239 CET

Begin processing the 9th record. Run 166782, Event 340390767, LumiSection 309 at 16-Mar-2016 15:45:40.241 CET

Begin processing the 10th record. Run 166782, Event 340435263, LumiSection 309 at 16-Mar-2016 15:45:40.241 CET

Acessing track information

The track information in AOD format can be accessed in the "Tracks Collection". In the miniAOD format this information is in pat::PackedCandidate. The loop used to get all tracks is below.

for(View<pat::PackedCandidate>::const_iterator iTrack1 = tracks->begin(); iTrack1 != tracks->end(); ++iTrack1 ) 
   <cuts in iTrack1>
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r9 - 2019-08-07 - RaphaelGomesDeSouza
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Sandbox 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