Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao...

20
Jul. 27, 2005 BESIII Software MeetingIHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University

Transcript of Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao...

Page 1: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 1

Physics Analysis with ROOT

July 27, 2005

Yajun MaoSchool of Physics, Peking University

Page 2: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 2

Outline

Physics Analysis in General

An New Approach

Examples as in HERMES

Summary

Page 3: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 3

Physics Analysis in General

DST orDST

Global tracks

PIDs

Tracks in Sub-detectors

Hits in sub-detectors

4-mom, 4-vertex, pid, tof,…

Beam 、 DAQ…

… …

More detailed info for pid

Partial tracks in sub-det…

Hits in sub-detecors …

Beam status, lum, DAQ status,…

PhysicsAnalysis

NTUPLE

Run#Event#… …Particle#1 info

Particle#2 info… …Particle#N info

Mother particle infoGrand-Mother particle info… …

Page 4: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 4

What’s the Problem?Straightforward between DST & NTUPLE

Only good for simple case,

what if we need some additional information?

what if we want to check other accompany particles?

No good means to find some deep hiding bugs

Broken data structure

Easy to make mistake

Hard to share analysis code, low efficiency…

1

32

45

7

6

Page 5: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 5

A Possible Solution

Split the analysis to several steps

Take the analysis as event filtering

Keep the whole event in each steps, not only those selected tracks

Use a consistent data structure

Code re-usable to other analysis

Less bugs for more people’s use

Higher efficiency, could concentrate in physics, rather than programming

Page 6: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 6

From Track To Particle?

Define a class for particle

Cut away the connection to a special experiment

More general sharing

A track is a measured particle

such as particle 1, 2 ,3 ,4 ,5

but a particle doesn’t to be a track for example, particle 6, 7

a photon is not a track too

1

32

45

7

6

Page 7: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 7

A Class for Particles: HParticle

HParticle

TParticle

TAttLine TAtt3DTObject

Page 8: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 8

The TParticle Class(1)

Int_t fPdgCode; // PDG code of the particle Int_t fStatusCode; // generation status code Int_t fMother[2]; // Indices of the mother particles Int_t fDaughter[2]; // Indices of the daughter particles Float_t fWeight; // particle weight

Double_t fCalcMass; // Calculated mass

Double_t fPx; // x component of momentum Double_t fPy; // y component of momentum Double_t fPz; // z component of momentum Double_t fE; // Energy

Double_t fVx; // x of production vertex Double_t fVy; // y of production vertex Double_t fVz; // z of production vertex Double_t fVt; // t of production vertex

Double_t fPolarTheta; // Polar angle of polarisation Double_t fPolarPhi; // azymutal angle of polarisation

TParticlePDG* fParticlePDG; //! reference to the particle record in PDG database

Page 9: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 9

The TParticle Class(2) Int_t GetStatusCode () const { return fStatusCode; } Int_t GetPdgCode () const { return fPdgCode; } Int_t GetFirstMother () const { return fMother[0]; } Int_t GetMother (Int_t i) const { return fMother[i]; } Int_t GetSecondMother () const { return fMother[1]; } Int_t GetFirstDaughter() const { return fDaughter[0]; } Int_t GetDaughter (Int_t i) const { return fDaughter[i]; } Int_t GetLastDaughter () const { return fDaughter[1]; } Double_t GetCalcMass () const { return fCalcMass; } Double_t GetMass () { return GetPDG()->Mass();}

Int_t GetNDaughters () const { return fDaughter[1]>0 ? fDaughter[1]-fDaughter[0]+1 : 0;} void GetPolarisation(TVector3 &v); Float_t GetWeight () const { return fWeight;} TParticlePDG* GetPDG (Int_t mode = 0);

Int_t Beauty () { return GetPDG()->Beauty(); } Int_t Charm () { return GetPDG()->Charm(); } Int_t Strangeness () { return GetPDG()->Strangeness();}

void Momentum(TLorentzVector &v) { v.SetPxPyPzE(fPx,fPy,fPz,fE);} void ProductionVertex(TLorentzVector &v) { v.SetXYZT(fVx,fVy,fVz,fVt);}

// ****** redefine several most oftenly used // methods of LORENTZ_VECTOR

Double_t Vx () const { return fVx;} Double_t Vy () const { return fVy;} Double_t Vz () const { return fVz;} Double_t T () const { return fT;} … …

Page 10: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 10

The HParticle Class(1)

Float_t fLifeTime; // Life time of this particle

TVector3 fDecayVertex; // the decay vertex of the particle

Float_t fDaughterDCA; // the closest approach of 2 daughter tracks

Int_t fTrackIndex; // index of track associated to the particle

Int_t fIndex; // index of this particle

Int_t fAcceptanceOK; // if the track is in acceptance;

Float_t fLengthOfFlight; // The length of flight before it decays

Int_t fDaughterIndex[3]; // indices of Daughters;

Float_t fRecoMassWin[2]; // Reconstructed mass windows(in GeV)

Int_t fDaughterAllIndex[15]; // indices including grand daughters;

Double_t fUserVariable[10]; // User Defined Variables;

Page 11: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 11

The HParticle Class(2) //!-------------- reconstruction related ---------------- // The particle is reconstructed from its daugthers d1, d2, void Reconstruction(HParticle* d1, HParticle* d2);

// The particle is reconstructed from its daugthers d1, d2, d3 void Reconstruction(HParticle* d1, HParticle* d2, HParticle* d3);

// Set a window for reconstructed mass void SetRecoMassWin(Float_t xmin, Float_t xmax) {fRecoMassWin[0]=xmin;fRecoMassWin[1]=xmax; }

// Get the window for reconstructed mass Float_t GetRecoMassWin(Int_t i) { return fRecoMassWin[i]; }

// find the distance of closest approach with other particle Float_t DCA(HParticle *d, TVector3 &pos);

// Get index of i-th all daughters of this particle // GetDaugtherAllIndex(0) returns the number of all daughters Int_t GetDaughterAllIndex(Int_t i) { return fDaughterAllIndex[i]; }

void SetDaughterAllIndex(Int_t i, Int_t idx){fDaughterAllIndex[i] = idx; }

// Check if particle d exists in this particle Bool_t Exist(HParticle *d);

//!-------------- decay related ---------------- // Simulate the particle decays to its daughters d1, d2 void Decay(HParticle *d1, HParticle *d2); ……

Page 12: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 12

How To Use HParticle In case of simulation //define lambda TVector3 p(px,py,pz); TVector3 v(vx,vy,vz); HParticle *Lambda = new HParticle(3212,p,v); // define a proton HParticle *Proton = new HParticle(2212); // define a pion- HParticle *PiMinus = new HParticle(-211); // simulate decay Lambda->Decay(Proton,PiMinus)

In case of reconstruction //define proton TVector3 ProtonP(px1,py1,pz1); TVector3 ProtonV(vx1,vy1,vz1); HParticle *Proton = new HParticle(2212,ProtonP,ProtonV); //define pion- TVector3 PiMinusP(px2,py2,pz2); TVector3 PiMinusV(vx2,vy2,vz2); HParticle *PiMinus = new HParticle(-211,PiMinusP,PiMinusV); //define lambda HParticle *Lambda = new HParticle(3212); // reconstruct lambda from proton and pion- Lambda->Reconstruction(Proton,PiMinus)

Page 13: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 13

Physics Analysis with HParticle

DST orDST

Physical EventReconstruction

DST Structure

DST Structure

HParticle Container

Apply Rough CutROOT TTree

Header Part. 1 Part. N

Only one HParticle Object In TClonesArray

Drawable Drawable

~200GB ~2GB ~20MB

Page 14: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 14

HERMES Data FlowHERMES DST(ADAMO Tables)

g1Track g1Beam g1Target g1DAQ smRICH … …

ROOT Converter

ROOT Ttree Burst

g1Beam g1Target g1DAQ Event … …. … …

g1Track smRICH smTrack … ….

Event ReconstructionFor a physical process

TTree Event

g1Track smRICH smTrack Particles… …

Page 15: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 15

PPbar Selection // create an instance of ReconHERMES ReconHERMES *process = new ReconHERMES();

// create dummy particles you have interest to study HParticle PPbar(9003); HParticle Proton(2212); HParticle Pbar(-2212); PPbar.SetRecoMassWin(1.8,3.0); //Set Mass window for PPbar

// Loop over all events in this burst for(Int_t j=0; j<Nevt; j++){

process->SetEventNum(j); // set to current event process->TrackToHParticle(Particles); // convert tracks to HParticle objects

// only process those events which contain all necessary final states if(process->EventOK(Particles,Nfinal,finalPDG)){

TOrdCollection PPbars;

// reconstruct PPbar from Particles and put result in PPbars process->Reconstruction(Particles,&PPbars,&PPbar,&Proton,&Pbar);

// need at least 1 PPbar for this analysis if(PPbars.GetSize()>0){ Particles->AddAll(&PPbars); //save Particles here } }

Page 16: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 16

Structure After PPbar Selection

Page 17: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 17

Rough Cut and NTuples // create a dummy particle you have interest to study HParticle PPbar(9003);

// create an instance of ReconHERMES ReconHERMES *process = new ReconHERMES();

for(Int_t i=0; i<Tot1; i++){ T->GetEntry(i);

Int_t NParticle = Particles->GetEntries(); Int_t NTrack = g1Tracks->GetEntries(); // Find associate information to be saved for (Int_t j=NTrack; j<NParticle; j++){ HParticle *fPPbar = (HParticle *)Particles->At(j); if( fPPbar->GetPdgCode() == fakepart.GetPdgCode()){ // find one candidate Int_t index_proton = fPPbar->GetDaughterIndex(0); Int_t index_pbar= fPPbar->GetDaughterIndex(1); HParticle *fProton = (HParticle *)Particles->At(index_proton); HParticle *fPbar = (HParticle *)Particles->At(index_pbar);

// put cut here // save data } }

Page 18: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 18

Structure After Rough Cut

Page 19: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 19

Highlights of HParticle

1) Inherit from ROOT TParticle class

2) Use PDG data base for particle property

3) Use PDG numbering scheme

4) Include its vertex in 4-D phase space

5) Include its momentum in 4-D phase space

6) Could handle a new particle

7) Could be reconstructed from its 2/3-body daughters

8) Could decay to its 2/3-body daughters

9) In case of reconstruction, provide daughter DCA

10) In case of decay, provide track intersected with z=z0 plane

Page 20: Jul. 27, 2005 BESIII Software Meeting , IHEP 1 Physics Analysis with ROOT July 27, 2005 Yajun Mao School of Physics, Peking University.

Jul. 27, 2005 BESIII Software Meeting,IHEP 20

SummaryA new analysis procedure was developed based on HParticle class

Could handle very complicated physical process in a rather clear/simply way

Same data structure for different processes

Could check data in each step with ROOT browser, easy to find bugs

Easy to add additional info in the events

Simple/clear naming scheme for variables

Most of the codes can be shared