Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004.

Similar presentations


Presentation on theme: "Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004."— Presentation transcript:

1 Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004

2 Exercise 0 Login to lxplus and setup CMT Go to your working area for this tutorial and checkout this package too: –cmt co PhysicsAnalysis/AnalysisCommon/SpecialUtils –Now you should have 3 packages checked out, namely: UserAnalysis AnalysisExamples SpecialUtils cd to the cmt directory of RecExCommon make sure that your requirements file have these 2 lines: use UserAnalysis UserAnalysis-* PhysicsAnalysis/AnalysisCommon use AnalysisExamples AnalysisExamples-* PhysicsAnalysis/AnalysisCommon  Now do “cmt config”, “source setup.sh” and “cmt broadcast gmake”  cd../run  cp ~ketevi/w0/aod/PoolFileCatalog.xml.

3 Pre-Selection  You retrieve the electron AOD container from POOL  You iterate over the container  For each “electron” in the container, you do some test  If the test is successful you save that electron in another container for further processing: pre-selection  You can record the container your pre- selection in StoreGate or not

4 Pre-Selection: example  m_userElectronContainer = new ElectronContainer(SG::VIEW_ELEMENTS);  sc = m_storeGate->record(m_userParticleContainer,m_userContainerName);  if (sc.isFailure()) { mLog << MSG::ERROR << "Unable to record user Electron Container in StoreGate" << endreq; return sc; } else mLog << MSG::DEBUG << "User container of electrons recorded in StoreGate." << endreq;  const ElectronContainer* elecTES=0;  sc=m_storeGate->retrieve( elecTES, m_aodContainerName);  if( sc.isFailure() || !elecTES ) { mLog << MSG::WARNING << "No AOD electron container found in TDS" << endreq; return StatusCode::SUCCESS; }  ElectronContainer::const_iterator elecItr = elecTES->begin();  ElectronContainer::const_iterator elecItrE = elecTES->end();  for (; elecItr != elecItrE; ++elecItr) { bool check = (*elecItr)->pt() > m_etElecCut; if (m_checkDataType) check = check && showerShapeCut(*elecItr); if (check) { … m_userElectronContainer->push_back(*elecItr); }

5 Creating Your Own Containers  MuonContainer * muonContainer = new MuonContainer(); Muon * newMuon = new Muon(); newMuon  set_IDTrack(…); … muonContainer->push_back(newMuon);  The muonContainer “owns” all the newMuon inside it: Delete muonContainer; will also delete all the newMuon  PhotonContainer* photonContainer= new PhotonContainer(SG::VIEW_ELEMENTS); photonContainer  push_back(newPhoton); photonContainer does not own the newPhoton inside it Delete photonContainer; will NOT delete the newPhotons  The AOD container that you retrieve from POOL owns its AOD  If you create your own container of pre-selected AOD, be careful: See previous transparency m_userElectronContainer->push_back(*elecItr); *elecItr is pointer to an Electron AOD in original electron AOD container: that container own *elecItr: m_userElectronContainer can NOT own *elecItr. So m_userElectronContainer must be previously created with “View elements”  Container ownerShip: SG::OWN_ELEMENTS, SG::VIEW_ELEMENTS

6 Pre-selection, selection cuts  Your analysis code is an ATHENA algorithm  Algorithms have properties, modifiable in job options  Your analysis cuts are properties of your analysis, properties that you set, adjust in your analysis job options:  In your analysis code: DoElectron::DoElectron(const std::string& name, ISvcLocator* pSvcLocator) : DoParticle(name, pSvcLocator) { declareProperty("ElectronEtCut", m_etElecCut = 10.0*GeV); declareProperty("ElectronEtaCut", m_etaElecCut = 2.5); declareProperty("ElectronCone", m_elecCone = 0.9); ….; }  In your jobOptions.py DoElectron = Algorithm( "DoElectron" ) DoElectron.DeltaRMatchCut = 0.2 DoElectron.MaxDeltaR = 0.9999 DoElectron.AODContainerName = "ElectronCollection“ DoElectron.TruthContainerName = "SpclMC" DoElectron.UserContainerName = "MyPreSelectedElectrons" DoElectron.ElectronEtCut = 5.0*GeV DoElectron.ElectronEtaCut = 2.5 DoElectron.ElectronCone = 0.9 DoElectron.NtupleLocID = "/FILE1/Electron/100" DoElectron.NtuplePrefix = "Electron" DoElectron.HistDirectoryName = "Electron"

7 Analysis Tools, Utilities  Combination  Permutation  DeltaR matching  Selector  Filter  Special Utilities  Navigation  Association The following tools are currently available

8 Analysis Combination Retrieve the container of AOD jets If the container has more than 2 jets, get all the combinations of 2 jets and do something: AnalysisUtils::Combination comb(jetTDS,2); std::vector jj; while (comb.get(jj)) { double mjj = (jj[0]->hlv()+jj[1]->hlv()).m(); m_jj->fill(mjj,m_eventWeight); if ( fabs(mjj-mW) < m_deltaMjj ) { CompositeParticle * Wjj = new CompositeParticle(); Wjj->add(jetTDS,jj[0],jj[1]); Wjj->set_charge(1); Wjj->set_pdgId(PDG::W_plus); Wjj->set_dataType(m_dataType); m_WjjContainer->push_back(Wjj); } } }

9 Analysis Permutation  AnalysisUtils::Permutation permute(bjetTDS,2);  std::vector bb;  …  while (permute.get(bb)) { IParticleContainer::const_iterator wjjItr = m_WjjContainer- >begin(); IParticleContainer::const_iterator wjjItrE = m_WjjContainer->end(); … }

10 DeltaR Matching  Get a handle on the tools in the initialize() method: IAlgTool *tmp_analysisTools; sc = toolSvc->retrieveTool("AnalysisTools",tmp_analysisTools); if (StatusCode::SUCCESS != sc) { omLog << MSG::ERROR << "Can't get handle on analysis tools" << endreq; oreturn StatusCode::FAILURE; } m_analysisTools=dynamic_cast (tmp_analysisTools);  int index = -1;  double deltaRMatch;  /// find a match to this electron in the MC truth container /// the index and deltaR are returned bool findAMatch = m_analysisTools->matchR((*elecItr), mcpartTES, index, deltaRMatch, (*elecItr)->pdgId());  /// the matched object and deltaR are returned bool findAMatch = m_analysisTools->matchR((*elecItr), mcpartTES, element, deltaRMatch, (*elecItr)->pdgId());

11 Selector  class DoMuon {... static bool criteria (const Muon *mu, DoMuon *self); };  bool DoMuon::criteria (const Muon *mu, DoMuon *self) {... bool findAMatch = self->m_analysisTools ->matchR(mu,self->m_mcpartTES,index,deltaRMatch,mu- >pdgId()); if (!findAMatch) return false;... return true; }  StatusCode DoMuon::doPreSelection() {... m_analysisTools->select(this,DoMuon::criteria,muonTES,"PreMu"); } A collection of selected objects is recorded in StoreGate with key=“PreMu”

12 Filter The filter uses the Selector For example, you search for W  jj decay in MC truth collection Available but not yet in the repository Code, use case, example provided by S. Binet

13 Special Utilities  General solutions to a subclass of problem  Objective is: each user does not have to write the same piece of code to do this  Example: use the W mass constraint for the pz solution of the neutrino momentum Return a container of neutrinos as IParticle, for example: for (; leptonItr != leptonItrE; ++leptonItr) { bool findNeutrino = NeutrinoUtils::candidatesFromWMass((*leptonItr), m_pxMiss, m_pyMiss, (*m_neutrinoContainer)); if (findNeutrino) { do something …} } Neutrino from tau -> a+b+missingPt – solution to the collinear appriximation: NeutrinoUtils::candidatesCollinearApproximation(IParticle*, IParticle* m_pxMiss, m_pyMiss, (*m_neutrinoContainer));

14 Navigation  Back navigation to ESD (see Tadashi’s demonstration)  Navigation to Constituents, for example:  CompositeParticle* W = new CompositeParticle();  W->add(jetContainer, jet1, jet2);  If (!W->contains(jet3)) { do something;}  NavigationToken * cellToken = new NavigationToken (); jet->fillToken(*cellToken); NavigationToken ::const_iterator c = cellToken->begin(); NavigationToken ::const_iterator cend = cellToken->end(); for(; c != cend; ++c) { oconst CaloCell* thisCell = *c; odouble weight = jet->getParameter(thisCell); // odouble weight = (*c).second; odouble et = weight * thisCell->et();

15 Association  For example, Jet to TrackParticle Association: relation but not belonging: –AssociationLink: 1-to-1 reconstructed-MC truth association soft-hard electron overlap –AssociationVector: 1-to-many –AssociationMap: many-to-many (W  jj MC, W  jj reconstructed) P. Loch, S. Binet

16 The CompositeParticle  class CompositeParticle : public ParticleBase, public Navigable, public P4PxPyPzE {};  CompositeParticle* W = new CompositeParticle(); W  add(jetContainer,jet1); W  add(jetContainer,jet2); double wMass = W  m(); HepLorentzVector p = W  hlv();  Navigation if (W  contains(jet1)) { Navigate to CaloCell (see page 21) }  Composite of other Composites CompositeParticle * Z1 = new CompositeParticle(); Z1  add(electronContainer, e1, e2); CompositeParticle * Z2 = new CompositeParticle(); Z2  add(MuonContainer,mu1,mu2); CompositeParticle * theHiggs = new CompositeParticle(); theHiggs  add(zContainer,Z1,Z2); double higgsMass = theHiggs  m();

17 The 4Momentum  Design already proposed by the RTF – implementation by Rousseau et al. Look at the CVS package offline/Event/FourMom  Particles: Electron, Muon, Photon, BJet, TauJet, ParticleJet, Neutrino & CompositeParticle:  Get methods: p(), m(), px(), hlv(), etc double mass = Z  m();  Set methods: TauJet * tJet = new TauJet(); double px = …; double py = …; double pz = …, double e= …; tJet  set4Mom(HepLorentzVector(px,py,pz,e));

18 The Particle Classes  class Muon : public ParticleBase, public P4IPtCotThPhiM, public Navigable { …};  class MuonContainer : public DataVector {...};  For the public methods available to you, look in ParticleEventParticleEvent

19 The TrackParticle  Look in ParticleParticle  class TrackParticle : public P4PxPyPzE, public NavigableTerminalNode, virtual public INavigable4Momentum { public: …; TrackParticle(const Trk::Track* parTrack, TrackParticleOrigin prtOrigin, const Vtx::RecVertex* recVertex); …; protected: //!< pointer to a TrkTrack ElementLink m_originalTrack; …; };

20 Exercise 1 (1)Go back the UserAnalysis package (2) Create a container of pre-selected electrons (3) Record this container into StoreGate (4) Retrieve the AOD electron container from StoreGate (5) Loop over AOD electron, do pre-selection and Insert pre-selected AOD electron in the new container created in step (2) (6) Retrieve the container of pre-selected electrons from StoreGate (7) Create Composite Z  e+e- and histogram m_ee (8) Compile, build and run the code (9) Plot the Z  ee invariant mass

21 Exercise 2 (1) Repackage exercise 1 into a private method, say zee() (2) Add a private method Wjj(), for W  jj reconstruction (3) Add a private method t  Wj for the top reconstruction (4) Add a private method for t  Wb reconstruction

22 Acknowledgements  All the participants of the UCL workshop, April 5-7 2004, London  All the participants of the Analysis Tools Meetings  H. Ma, F. Paige, S. Rajagopalan, P. Calafiura  D. Rousseau, D. Costanzo, F. Akesson, A. Wildauer, et al  K. Cranmer, P. Loch, T. Maeno, S. Binet, I. Hinchliffe


Download ppt "Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004."

Similar presentations


Ads by Google