analysis tools tutorial: demonstration/example/exercise ketevi a. assamagan cern, september 20 th,...
DESCRIPTION
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 notTRANSCRIPT
![Page 1: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/1.jpg)
Analysis Tools Tutorial: Demonstration/Example/Exer
cise
Ketevi A. AssamaganCERN, September 20th,
2004
![Page 2: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/2.jpg)
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/AnalysisCommonuse AnalysisExamples AnalysisExamples-*
PhysicsAnalysis/AnalysisCommon Now do “cmt config”, “source setup.sh” and “cmt broadcast gmake” cd ../run cp ~ketevi/w0/aod/PoolFileCatalog.xml .
![Page 3: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/3.jpg)
Pre-SelectionYou retrieve the electron AOD
container from POOLYou iterate over the containerFor 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
![Page 4: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/4.jpg)
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); }
![Page 5: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/5.jpg)
Creating Your Own Containers MuonContainer * muonContainer = new MuonContainer();
Muon * newMuon = new Muon(); newMuonset_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); photonContainerpush_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
![Page 6: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/6.jpg)
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"
![Page 7: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/7.jpg)
Analysis Tools, Utilities
CombinationPermutationDeltaR matchingSelectorFilterSpecial Utilities NavigationAssociation
The following tools are currently available
![Page 8: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/8.jpg)
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<const ParticleJetContainer>
comb(jetTDS,2); std::vector<const IParticleContainer::value_type*> 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); } } }
![Page 9: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/9.jpg)
Analysis Permutation AnalysisUtils::Permutation<const BJetContainer>
permute(bjetTDS,2); std::vector<const BJetContainer:value_type*> bb; … while (permute.get(bb)) {
IParticleContainer::const_iterator wjjItr = m_WjjContainer->begin();
IParticleContainer::const_iterator wjjItrE = m_WjjContainer->end();
…}
![Page 10: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/10.jpg)
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) {
o mLog << MSG::ERROR << "Can't get handle on analysis tools" << endreq;
o return StatusCode::FAILURE; } m_analysisTools=dynamic_cast<IAnalysisTools
*>(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 returnedbool findAMatch = m_analysisTools->matchR((*elecItr), mcpartTES, element, deltaRMatch, (*elecItr)->pdgId());
![Page 11: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/11.jpg)
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”
![Page 12: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/12.jpg)
Filter• The filter uses the Selector• For example, you search for Wjj
decay in MC truth collection• Available but not yet in the repository• Code, use case, example provided by
S. Binet
![Page 13: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/13.jpg)
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));
![Page 14: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/14.jpg)
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<CaloCell,double>* cellToken = new
NavigationToken<CaloCell,double>(); jet->fillToken(*cellToken); NavigationToken<CaloCell, double>::const_iterator c = cellToken->begin();NavigationToken<CaloCell,double>::const_iterator cend = cellToken->end(); for(; c != cend; ++c) {
o const CaloCell* thisCell = *c; o double weight = jet->getParameter(thisCell); // o double weight = (*c).second; o double et = weight * thisCell->et();
![Page 15: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/15.jpg)
AssociationFor 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
(Wjj MC, Wjj reconstructed) P. Loch, S. Binet
![Page 16: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/16.jpg)
The CompositeParticle class CompositeParticle :
public ParticleBase, public Navigable<IParticleContainer,double>, public P4PxPyPzE {};
CompositeParticle* W = new CompositeParticle();Wadd(jetContainer,jet1);Wadd(jetContainer,jet2);double wMass = Wm();HepLorentzVector p = Whlv();
Navigationif (Wcontains(jet1)) { Navigate to CaloCell (see page 21) }
Composite of other CompositesCompositeParticle * Z1 = new CompositeParticle();Z1add(electronContainer, e1, e2);CompositeParticle * Z2 = new CompositeParticle();Z2add(MuonContainer,mu1,mu2);CompositeParticle * theHiggs = new
CompositeParticle();theHiggsadd(zContainer,Z1,Z2);double higgsMass = theHiggsm();
![Page 17: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/17.jpg)
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= …;tJetset4Mom(HepLorentzVector(px,py,pz,e));
![Page 18: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/18.jpg)
The Particle Classes class Muon : public ParticleBase,
public P4IPtCotThPhiM, public Navigable<Rec::TrackParticleContainer,double> { …};
class MuonContainer : public DataVector<Muon> {...}; For the public methods available to you, look in ParticleEvent
![Page 19: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/19.jpg)
The TrackParticle Look in Particle 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< TrackCollection > m_originalTrack; …;};
![Page 20: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/20.jpg)
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 Ze+e- and histogram m_ee
(8) Compile, build and run the code
(9) Plot the Zee invariant mass
![Page 21: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/21.jpg)
Exercise 2(1) Repackage exercise 1 into a private
method, say zee()(2) Add a private method Wjj(), for Wjj
reconstruction(3) Add a private method tWj for the top
reconstruction(4) Add a private method for tWb
reconstruction
![Page 22: Analysis Tools Tutorial: Demonstration/Example/Exercise Ketevi A. Assamagan CERN, September 20 th, 2004](https://reader035.vdocuments.site/reader035/viewer/2022062413/5a4d1b3f7f8b9ab0599a001e/html5/thumbnails/22.jpg)
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