go-hep.org/x/hep@v0.38.1/fads/datamodel.go (about)

     1  // Copyright ©2017 The go-hep Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package fads
     6  
     7  import (
     8  	"go-hep.org/x/hep/fmom"
     9  	"go-hep.org/x/hep/hepmc"
    10  )
    11  
    12  type Particle interface {
    13  	P4() fmom.P4
    14  	Charge() int32
    15  }
    16  
    17  type MissingEt struct {
    18  	MET float64 // missing transverse energy
    19  	Phi float64 // missing energy azimuthal angle
    20  }
    21  
    22  // scalar sum of transverse momenta
    23  type ScalarHt float64
    24  
    25  // rho energy density
    26  type Rho float64
    27  
    28  // type mcParticle struct {
    29  // 	Pid    int32 // pdg id number
    30  // 	Status int32 // particle status
    31  // 	IsPU   byte  // 0 or 1 for particles from pile-up interactions
    32  //
    33  // 	M1 int // particle 1st mother
    34  // 	M2 int // particle 2nd mother
    35  // 	D1 int // particle 1st daughter
    36  // 	D2 int // particle 2nd daughter
    37  //
    38  // 	McCharge int     // particle charge
    39  // 	Mass     float64 // particle mass
    40  //
    41  // 	Mom fmom.PxPyPzE // particle momentum (px,py,pz,e)
    42  //
    43  // 	Pt  float64 // particle transverse momentum
    44  // 	Eta float64 // particle pseudo-rapidity
    45  // 	Phi float64 // particle azimuthal angle
    46  //
    47  // 	Rapidity float64 // particle rapidity
    48  //
    49  // 	Pos [4]float64 // particle vertex position (t,x,y,z)
    50  // }
    51  //
    52  // func (mc *mcParticle) P4() fmom.P4 {
    53  // 	return &mc.Mom
    54  // }
    55  //
    56  // func (mc *mcParticle) Charge() int32 {
    57  // 	return int32(mc.McCharge)
    58  // }
    59  
    60  type Photon struct {
    61  	Mom    fmom.PtEtaPhiM // photon momentum (mass=0.0)
    62  	EhoEem float64        // ratio of the hadronic over electromagnetic energy deposited in the calorimeter
    63  
    64  	McPart *hepmc.Particle // generated particle
    65  }
    66  
    67  func (pho *Photon) P4() fmom.P4 {
    68  	return &pho.Mom
    69  }
    70  
    71  func (pho *Photon) Charge() int32 {
    72  	return 0
    73  }
    74  
    75  type Electron struct {
    76  	Mom       fmom.PtEtaPhiM // electron momentum (mass=0.0)
    77  	EleCharge int32          // electron charge
    78  	EhoEem    float64        // ratio of the hadronic versus electromagnetic energy deposited in the calorimeter
    79  
    80  	McPart *hepmc.Particle // generated particle
    81  }
    82  
    83  func (ele *Electron) P4() fmom.P4 {
    84  	return &ele.Mom
    85  }
    86  
    87  func (ele *Electron) Charge() int32 {
    88  	return ele.EleCharge
    89  }
    90  
    91  type Muon struct {
    92  	Mom      fmom.PtEtaPhiM // muon momentum (mass=0.0)
    93  	MuCharge int32          // muon charge
    94  
    95  	McPart *hepmc.Particle // generated particle
    96  }
    97  
    98  func (muon *Muon) P4() fmom.P4 {
    99  	return &muon.Mom
   100  }
   101  
   102  func (muon *Muon) Charge() int32 {
   103  	return muon.MuCharge
   104  }
   105  
   106  type Jet struct {
   107  	Mom       fmom.PtEtaPhiM // jet momentum
   108  	JetCharge int32          // jet charge
   109  
   110  	DEta float64 // jet radius in pseudo-rapidity
   111  	DPhi float64 // jet radius in azimuthal angle
   112  
   113  	BTag   byte // 0 or 1 for a jet that has been tagged as containing a heavy quark
   114  	TauTag byte // 0 or 1 for a jet that has been tagged as a tau
   115  
   116  	Constituents []Particle        // pointers to constituents
   117  	McParts      []*hepmc.Particle // pointers to generated particles
   118  }
   119  
   120  func (jet *Jet) P4() fmom.P4 {
   121  	return &jet.Mom
   122  }
   123  
   124  func (jet *Jet) Charge() int32 {
   125  	return jet.JetCharge
   126  }
   127  
   128  type Track struct {
   129  	Pid       int32          // HEP ID number
   130  	Mom       fmom.PtEtaPhiM // track momentum (mass=0.0)
   131  	TrkCharge int32          // track charge
   132  
   133  	Eta float64 // track pseudo-rapidity at the tracker edge
   134  	Phi float64 // track azimuthal angle at the tracker edge
   135  
   136  	X float64 // track vertex position
   137  	Y float64 // track vertex position
   138  	Z float64 // track vertex position
   139  
   140  	Xout float64 // track vertex position at the tracker edge
   141  	Yout float64 // track vertex position at the tracker edge
   142  	Zout float64 // track vertex position at the tracker edge
   143  
   144  	McPart *hepmc.Particle // pointer to generated particle
   145  }
   146  
   147  func (trk *Track) P4() fmom.P4 {
   148  	return &trk.Mom
   149  }
   150  
   151  func (trk *Track) Charge() int32 {
   152  	return trk.TrkCharge
   153  }
   154  
   155  type Tower struct {
   156  	Mom  fmom.EtEtaPhiM // calorimeter tower momentum
   157  	Ene  float64        // calorimeter tower energy
   158  	Eem  float64        // calorimeter tower electromagnetic energy
   159  	Ehad float64        // calorimter tower hadronic energy
   160  
   161  	Edges [4]float64 // calorimeter tower edges
   162  
   163  	McParts []*hepmc.Particle // pointers to generated particles
   164  }
   165  
   166  func (tower *Tower) P4() fmom.P4 {
   167  	return &tower.Mom
   168  }
   169  
   170  type Candidate struct {
   171  	Pid            int32   // HEP ID number
   172  	Status         int32   // particle status
   173  	M1, M2, D1, D2 int32   // particle mothers and daughters
   174  	CandCharge     int32   // particle charge
   175  	CandMass       float64 // particle mass
   176  
   177  	IsPU          byte   // 0 or 1 for particles from pile-up interactions
   178  	IsConstituent byte   // 0 or 1 for particles being constituents
   179  	BTag          uint32 // b-tag information (bit-mask)
   180  	TauTag        uint32 // tau-tag information (bit-mask)
   181  
   182  	Eem  float64 // electromagnetic energy
   183  	Ehad float64 // hadronic energy
   184  
   185  	Edges [4]float64
   186  	DEta  float64
   187  	DPhi  float64
   188  
   189  	Mom  fmom.PxPyPzE
   190  	Pos  fmom.PxPyPzE
   191  	Area fmom.PxPyPzE
   192  
   193  	Candidates []Candidate
   194  }
   195  
   196  func (cand *Candidate) Clone() *Candidate {
   197  	c := *cand
   198  	c.Candidates = make([]Candidate, 0, len(cand.Candidates))
   199  	for i := range cand.Candidates {
   200  		cc := &cand.Candidates[i]
   201  		c.Add(cc)
   202  	}
   203  
   204  	return &c
   205  }
   206  
   207  func (cand *Candidate) P4() fmom.P4 {
   208  	return &cand.Mom
   209  }
   210  
   211  func (cand *Candidate) Charge() int32 {
   212  	return cand.CandCharge
   213  }
   214  
   215  func (cand *Candidate) Add(c *Candidate) {
   216  	cand.Candidates = append(cand.Candidates, *c)
   217  }
   218  
   219  func (cand *Candidate) Overlaps(o *Candidate) bool {
   220  	if cand == o {
   221  		return true
   222  	}
   223  
   224  	for i := range cand.Candidates {
   225  		cc := &cand.Candidates[i]
   226  		if cc.Overlaps(o) {
   227  			return true
   228  		}
   229  	}
   230  
   231  	for i := range o.Candidates {
   232  		cc := &o.Candidates[i]
   233  		if cc.Overlaps(cand) {
   234  			return true
   235  		}
   236  	}
   237  
   238  	return false
   239  }
   240  
   241  // Classifier classifies candidates into categories
   242  type Classifier interface {
   243  	Category(cand *Candidate) int
   244  }