Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Analysis with DSTs N. Amapane – INFN Torino CMS Software Tutorial November 4, 2004."— Presentation transcript:

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

2 CMS Software Tutorial 2Outline 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

3 CMS Software Tutorial 3Disclaimer 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

4 CMS Software Tutorial 4Introduction 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!

5 CMS Software Tutorial 5 What 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

6 CMS Software Tutorial 6 Algorithm 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

7 CMS Software Tutorial 7RecQuery 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");

8 CMS Software Tutorial 8 Setting the Configuration Parameters 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.2 overrides GlobalPixelSeedGenerator:ptCut = 2.0 3) In the code See next slide overwrites 2)

9 CMS Software Tutorial 9 Setting the Configuration Let Setting parameters: Setting components: q.setParameter("ConeSize", 0.77); RecQuery myTF("TrackFinder"); q.setComponent("TrackReconstructor", myTF); RecQuery q("AlgorithmName");

10 CMS Software Tutorial 10RecCollections 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

11 CMS Software Tutorial 11RecCollection A RecCollection ”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 myobjects(RecQuery(“Name_of_algorithm”)); cout << myobjects.config() << endl; cout << myobjects.exists() << endl; cout << myobjects.size() << endl; RecCollection ::const_iterator it; MyRecObj inherits from RecObj

12 CMS Software Tutorial 12RecCollection RecQuery q("TrackReconstructor"); RecCollection c(q); const Track& t1 = c.front(); // providing c.size()>0 const Track& t2 = c[2]; // providing c.size()>2 typedef RecCollection ::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 c(q); const Track& t1 = c.front(); // providing c.size()>0 const Track& t2 = c[2]; // providing c.size()>2 typedef RecCollection ::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;

13 CMS Software Tutorial 13FilteredRecCollection 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 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 c(q,f); FilteredRecCollection ::Range r = c.range(); FilteredRecCollection ::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;

14 CMS Software Tutorial 14 ReadOnly Mode Adding the line RecAlgoName:Request = ReadOnly to 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.

15 CMS Software Tutorial 15 DST 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

16 CMS Software Tutorial 16 DST Contents (I) Level-1 trigger HLT trigger MET from EcalPlusHcalTowers with correction MET from CaloRecHits MET from MC particles MET from ICJets with Type1 correction MET from KTJets with Type2 correction MET from L1TriggerMET L2 Muons L3 Muons StandAlone Muons Global Muons Isolated Muons Iterative cone (0.5) jets Iterative cone (0.7) jets Iterative cone (0.5) calibrated (JetPlusTrack) jets Iterative cone (0.5) calibrated (GammaJet) jets Kt recom (4) jets Kt recom (1) jets B-Jets CombinedBTagging

17 CMS Software Tutorial 17 DST Contents (II) EcalPlusHcalTowers EgammaBasicClusters EgammaClusters EgammaSuperClusters EgammaEndcapClusters EgammaGtfTracks Level2 barrel candidates Level2 endcap candidates Offline barrel candidates Offline endcap candidates Taus PixelTauJetFinder Taus TauConeJetFinder HLT electron tracks Offline electron tracks HLT photon candidates Offline photon candidates HLT electron candidates Offline electron candidates Egamma MC information Tracker tracks CombinatorialTrackFinder Pixel tracks PixelTrackFinder Vertices PrincipalVertexFinder Vertices PVFPrimaryVertexFinder

18 CMS Software Tutorial 18 Exercise

19 CMS Software Tutorial 19Task 500 H  ee  events; m H = 300 GeV Read a DST Extract MC, Level-1 Trigger, HLT, muon and electron information Fill histograms Fill ROOT tree Plot fill p T 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

20 CMS Software Tutorial 20 Muon Reconstruction For the time being we have four different muon reconstruction algorithms implemented: StandAloneMuonReconstructor GlobalMuonReconstructor L2MuonReconstructor L3MuonReconstructor All four algorithms are RecAlgorithm inheriting from RecAlgorithm RecMuon inherits from TTrack (RecObj) Easy access to reconstructed muons RecQuery q(" "); RecCollection theCollection(q); for (RecCollection ::const_iterator it = theCollection.begin(); it != theCollection.end(); ++it) cout << "Muon: " << (*it) << endl;

21 CMS Software Tutorial 21 Electron Reconstruction Offline electrons: Simply add to your BuildFile: Offline reconstruction of electrons and photons: EgammaCandidateFinder EgammaOfflineElectronFinder EgammaOfflinePhotonFinder EgammaOfflineElectronTracking #include “ElectronPhoton/EgammaOfflineReco/interface/OfflineElectronReco.h” RecCollection theCollection(OfflineElectronReco::defaultQuery()); for (RecCollection ::const_iterator it = theCollection.begin(); it != theCollection.end(); ++it) cout << ”Electron: " << (*it) << endl;

22 CMS Software Tutorial 22 First Step wget http://home.cern.ch/amapane/ORCATutorial/goDSThttp://home.cern.ch/amapane/ORCATutorial/goDST chmod +x goDST./goDST

23 CMS Software Tutorial 23 Second Step cd ORCA_8_1_3/src/Workspace You will find the following files: BuildFile orcarc ORCAExercise.cpp MyAnalysis.h MyAnalysis.cc Try to understand the code! Modify MyAnalysis.cc scram brecompile eval `scram runtime -csh`set runtime environment Tutorial -c orcarcrun executable rootstart ROOT

24 CMS Software Tutorial 24Homework Plot the invariant mass of the Higgs (and win the Nobel Prize)


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

Similar presentations


Ads by Google