240 likes | 505 Views
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.
E N D
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 Most material shown here recycled form Norbert’s presentations
Disclaimer • 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
Introduction • 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, g, m, MET, jets, b and t tagging • Reconstruction is very time consuming!
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
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 theRecConfig
RecQuery • 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 usethe RecQuery, and an exception will be thrown if it's not OK • Usage: RecQuery q("AlgorithmName"); or RecQuery q("AlgorithmName", "Version");
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)
Setting the Configuration RecQuery q("AlgorithmName"); • Let • Setting parameters: • Setting components: q.setParameter("ConeSize", 0.77); RecQuery myTF("TrackFinder"); q.setComponent("TrackReconstructor", myTF);
RecCollections • 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
RecCollection • 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: MyRecObj inherits from RecObj RecCollection<MyRecObj> myobjects(RecQuery(“Name_of_algorithm”)); cout << myobjects.config() << endl; cout << myobjects.exists() << endl; cout << myobjects.size() << endl; RecCollection<MyRecObj>::const_iterator it;
RecCollection 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;
FilteredRecCollection • 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;
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 ReadOnlyCaloWhatevers. • 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.
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
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-JetsCombinedBTagging DST Contents (I)
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 DST Contents (II)
Task • 500 H eemmevents; 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
Muon 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;
Electron 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;
First Step wget http://home.cern.ch/amapane/ORCATutorial/goDST chmod +x goDST ./goDST
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! ModifyMyAnalysis.cc scram b recompile eval `scram runtime -csh` set runtime environment Tutorial -c orcarc run executable root start ROOT
Homework Plot the invariant mass of the Higgs (and win the Nobel Prize)