analysis with dsts

24
Analysis with DSTs Analysis with DSTs N. Amapane – INFN Torino CMS Software Tutorial November 4, 2004

Upload: mac

Post on 15-Jan-2016

39 views

Category:

Documents


0 download

DESCRIPTION

Analysis with DSTs. N. Amapane – INFN Torino CMS Software Tutorial November 4, 2004. Outline. Introduction What are DSTs? COBRA framework interfaces RecQuery RecCollection/FileterdRecCollection Exercise How to read a DST and make an analysis. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Analysis with DSTs

Analysis with DSTsAnalysis with DSTs

N. Amapane – INFN Torino

CMS Software Tutorial

November 4, 2004

Page 2: Analysis with DSTs

CMS Software Tutorial 2

OutlineOutline

Introduction What are DSTs?

COBRA framework interfaces RecQuery RecCollection/FileterdRecCollection

Exercise How to read a DST and make an analysis

Most material shown here recycled form Norbert’s presentations

Page 3: Analysis with DSTs

CMS Software Tutorial 3

DisclaimerDisclaimer I assume that you know a bit of C++ and ORCA

This is not a ROOT tutorial

I will not talk about Grid tools to perform distributed analysis

I will not talk about how to handle METADATA and about data management in general

Pragmatic approach – I will skip some theory

ORCA is in a rapid development phase (try to use the latest greatest)

Today: ORCA_8_6_0

Page 4: Analysis with DSTs

CMS Software Tutorial 4

IntroductionIntroduction A database of digitized events contains:

MCinfo: MC generator, SimTrack, SimVertex SimHits: (simulated hits) Digis and Associations

Reconstruction starts from this data Consists in several hierarchical steps:

Data unpacking, apply calibration, reconstruct clusters or hits Reconstruction of tracks Reconstruction of vertexes Particle identification: e, , MET, jets, b and tagging

Reconstruction is very time consuming!

Page 5: Analysis with DSTs

CMS Software Tutorial 5

What are DSTsWhat are DSTs DSTs

Store the result of event reconstruction Provide compact information for analysis Consist of a set of homogeneous collections of

RecObjects Tracks, vertexes, muons, electrons, jets, b-jets, taus…

User Interface: RecQuery/RecConfig specify configuration RecCollection get reconstructed

objects FilteredRecCollection

Page 6: Analysis with DSTs

CMS Software Tutorial 6

Algorithm ConfigurationAlgorithm Configuration The configuration of an algorithm is decomposed

into Algorithm name Version identifier Fixed parameters directly used by the algorithm

Do not depend on the input data If they change the reconstruction result changes Modeled by ParameterSet

Calibration parameters directly used by the algorithm Depend on the input data If they change the reconstruction result changes Modeled by CalibrationSet

Configuration of the input algorithms (components) Modeled by ComponentSet

All these compose the RecConfig

Page 7: Analysis with DSTs

CMS Software Tutorial 7

RecQueryRecQuery User-friendly way to define RecConfigs

Only the algorithm name is mandatory All other fields are taken from the default Config

Only the parameters, components, or calibrations which need to be changed (or fixed) need to be set

You don't have to know the names of all parameters, only the ones you want to modify

For all other parameters, components and calibrations the default values are used.

You can put anything in a RecQuery, e.g. Parameter names not known to the RecAlgorithm

The check will be done when you use the RecQuery, and an exception will be thrown if it's not OK

Usage:RecQuery q("AlgorithmName"); or

RecQuery q("AlgorithmName", "Version");

Page 8: Analysis with DSTs

CMS Software Tutorial 8

Setting the ConfigurationSetting the ConfigurationParameters are taken from:

1) Default Configuration of the algorithm (defaultConfig) That’s the only place where parameter names and types are defined

2) .orcarc: Every parameter is configurable with the following syntax AlgorithmName:ParameterName = value AlgorithmName:ComponentName = NameOfTheAlgorithm overwrites 1) For components same sequence as for parameters in a recursive way:

AlgorithmName:ComponentName:ParameterName = value The most qualified line has precedence, i.e

CombinatorialTrackFinder:SeedGenerator:ptCut = 1.2overrides GlobalPixelSeedGenerator:ptCut = 2.0

3) In the code See next slide overwrites 2)

Page 9: Analysis with DSTs

CMS Software Tutorial 9

Setting the ConfigurationSetting the Configuration Let

Setting parameters:

Setting components:

q.setParameter("ConeSize", 0.77);

RecQuery myTF("TrackFinder"); q.setComponent("TrackReconstructor", myTF);

RecQuery q("AlgorithmName");

Page 10: Analysis with DSTs

CMS Software Tutorial 10

RecCollectionsRecCollections RecCollection addresses the off-line analysis use case:

iterating over reconstructed objects of some type and use them directly or for further reconstruction of higher-level objects.

The collection is homogeneous: All objects in the collection are reconstructed in the same way

Within the event In all events Reproducibly

Reconstruction is “expensive” and should not be wasted: Reconstruction is done “on demand” Reconstruction results are cached for further access Reconstruction results are made persistent if desired:

RecAlgoName:Persistent = true

Page 11: Analysis with DSTs

CMS Software Tutorial 11

RecCollectionRecCollection A RecCollection<T> ”reconstructs” objects of type T in the current event. RecCollection is a LazyObserver of RecEvent:

not reconstructed when dispatched, but only when asked for content RecCollections which are instantiated but not used "don't cost“ CPU

STL-vector-like interface: begin(), end(), size(), empty(), front(), back(), … Calling any of those triggers the actual reconstruction Since 8_6_0, semantics changes w.r.t. previous versions

Example:

RecCollection<MyRecObj> myobjects(RecQuery(“Name_of_algorithm”));

cout << myobjects.config() << endl;

cout << myobjects.exists() << endl;

cout << myobjects.size() << endl;RecCollection<MyRecObj>::const_iterator it;

MyRecObj inherits from RecObj

Page 12: Analysis with DSTs

CMS Software Tutorial 12

RecCollectionRecCollectionRecQuery q("TrackReconstructor");

RecCollection<Track> c(q);

const Track& t1 = c.front(); // providing c.size()>0

const Track& t2 = c[2]; // providing c.size()>2

typedef RecCollection<Track>::const_iterator RI;

for ( RI i = c.begin(); i != c.end(); ++i ) { const Track& track = *i; cout << track << endl; }

cout << c.name() << " : " << c.exists() << endl; cout << c.config() << endl;if ( !c.empty() ) cout << c.size() << endl;

RecQuery q("TrackReconstructor");

RecCollection<Track> c(q);

const Track& t1 = c.front(); // providing c.size()>0

const Track& t2 = c[2]; // providing c.size()>2

typedef RecCollection<Track>::const_iterator RI;

for ( RI i = c.begin(); i != c.end(); ++i ) { const Track& track = *i; cout << track << endl; }

cout << c.name() << " : " << c.exists() << endl; cout << c.config() << endl;if ( !c.empty() ) cout << c.size() << endl;

Page 13: Analysis with DSTs

CMS Software Tutorial 13

FilteredRecCollectionFilteredRecCollection FilteredRecCollection is a drop-in replacement for

RecCollection that adds filtering (selection) of the elements. It takes, in addition to the RecQuery argument, also a Filter<T> argument. The caller must make sure that the filter instance is not deleted during the lifetime of the FilteredRecCollection. The usual methods begin(), end(), range() and size(), etc. refer to the filtered subset of RecObjects.RecQuery q("TrackReconstructor","1.0");

Capri::Filter f; FilteredRecCollection<Track> c(q,f); FilteredRecCollection<Track>::Range r = c.range(); FilteredRecCollection<Track>::const_iterator RI;for ( RI i = r.first; i != r.second; ++i ) { const Track& track = *i; cout << track << endl; }cout << c.size() << endl; cout << c.config() << endl;

Page 14: Analysis with DSTs

CMS Software Tutorial 14

ReadOnly ModeReadOnly ModeAdding the line

RecAlgoName:Request = ReadOnlyto the “.orcarc” file will change the behavior of a RecCollection. In this mode only objects which are already stored in a dataset can be read and the reconstruction on-demand mechanism is switched off. In case the requested collection is not stored in the dataset, a warning will show up.

• ReadOnly affects the RecCollection, and all components automatically:

• If one asks for ReadOnly BJets, they will refer to the ReadOnly TTracks and ReadOnly CaloWhatevers.

• Other RecQueries for TTrack (not via BJets) will not be affected by this:

• CombinatorialTrackFinder:Request can be Auto, and user RecCollections for TTrack may be re-reconstructed.

Page 15: Analysis with DSTs

CMS Software Tutorial 15

DST WritingDST Writing Standard executable to run reconstruction and produce DST:

Examples/ExProduction/writeDST Takes Digi dataset as input

Simple way to choose DST contents: orcarc.writeDST Example: UseTkforDST = true

Page 16: Analysis with DSTs

CMS Software Tutorial 16

DST Contents (I)DST Contents (I)

Level-1 triggerHLT trigger

MET from EcalPlusHcalTowers with correctionMET from CaloRecHitsMET from MC particlesMET from ICJets with Type1 correctionMET from KTJets with Type2 correctionMET from L1TriggerMET

L2 MuonsL3 MuonsStandAlone MuonsGlobal MuonsIsolated Muons

Iterative cone (0.5) jetsIterative cone (0.7) jetsIterative cone (0.5) calibrated

(JetPlusTrack) jetsIterative cone (0.5) calibrated

(GammaJet) jetsKt recom (4) jetsKt recom (1) jets

B-Jets CombinedBTagging

Page 17: Analysis with DSTs

CMS Software Tutorial 17

DST Contents (II)DST Contents (II)

EcalPlusHcalTowersEgammaBasicClustersEgammaClustersEgammaSuperClustersEgammaEndcapClustersEgammaGtfTracksLevel2 barrel candidatesLevel2 endcap candidatesOffline barrel candidatesOffline endcap candidates

Taus PixelTauJetFinderTaus TauConeJetFinder

HLT electron tracksOffline electron tracksHLT photon candidatesOffline photon candidatesHLT electron candidatesOffline electron candidatesEgamma MC information

Tracker tracks CombinatorialTrackFinderPixel tracks PixelTrackFinderVertices PrincipalVertexFinderVertices PVFPrimaryVertexFinder

Page 18: Analysis with DSTs

CMS Software Tutorial 18

Exercise

Page 19: Analysis with DSTs

CMS Software Tutorial 19

TaskTask 500 H eeevents; mH = 300 GeV Read a DST Extract MC, Level-1 Trigger, HLT, muon and electron information Fill histograms Fill ROOT tree Plot fill pT spectrum of simulated and reconstructed leptons Plot di-muon/di-electron invariant mass Have a look at the interface of RecMuon and ElectronCandidate:

ORCA reference manual http://cmsdoc.cern.ch/swdev/snapshot/ORCA/ReferenceManual/html/classes.html

Optimize mass resolution: get best measurements for reconstructed muons and electrons

Plot Higgs mass

Page 20: Analysis with DSTs

CMS Software Tutorial 20

Muon ReconstructionMuon Reconstruction For the time being we have four different muon reconstruction

algorithms implemented: StandAloneMuonReconstructor GlobalMuonReconstructor L2MuonReconstructor L3MuonReconstructor

All four algorithms are RecAlgorithm<RecMuon> inheriting from RecAlgorithm<T>

RecMuon inherits from TTrack (RecObj) Easy access to reconstructed muons

RecQuery q("<Name of Reconstructor>");RecCollection<RecMuon> theCollection(q);for (RecCollection<RecMuon>::const_iterator it = theCollection.begin(); it != theCollection.end(); ++it)cout << "Muon: " << (*it) << endl;

Page 21: Analysis with DSTs

CMS Software Tutorial 21

Electron ReconstructionElectron Reconstruction Offline electrons: Simply add to your BuildFile:

<lib name=EgammaOfflineReco>

Offline reconstruction of electrons and photons: EgammaCandidateFinder EgammaOfflineElectronFinder EgammaOfflinePhotonFinder EgammaOfflineElectronTracking

#include “ElectronPhoton/EgammaOfflineReco/interface/OfflineElectronReco.h”RecCollection<ElectronCandidate> theCollection(OfflineElectronReco::defaultQuery());for (RecCollection<ElectronCandidate>::const_iterator it = theCollection.begin(); it != theCollection.end(); ++it)cout << ”Electron: " << (*it) << endl;

Page 22: Analysis with DSTs

CMS Software Tutorial 22

First StepFirst Step

wget http://home.cern.ch/amapane/ORCATutorial/goDST

chmod +x goDST

./goDST

Page 23: Analysis with DSTs

CMS Software Tutorial 23

Second StepSecond Stepcd ORCA_8_1_3/src/Workspace

You will find the following files:BuildFileorcarcORCAExercise.cppMyAnalysis.hMyAnalysis.ccTry to understand the code!

Modify MyAnalysis.cc

scram b recompileeval `scram runtime -csh` set runtime environmentTutorial -c orcarc run executableroot start ROOT

Page 24: Analysis with DSTs

CMS Software Tutorial 24

HomeworkHomework

Plot the invariant mass of the Higgs (and win the Nobel Prize)