go-hep.org/x/hep@v0.38.1/lcio/bits.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 lcio
     6  
     7  // Flags are bit patterns describing detector and simulation states.
     8  type Flags uint32
     9  
    10  // Flags for SimCalorimeterHit (CH)
    11  const (
    12  	BitsChLong   Flags = 1 << 31 // long(1) - short(0), (position)
    13  	BitsChBarrel Flags = 1 << 30 // barrel(1) - endcap(0)
    14  	BitsChID1    Flags = 1 << 29 // cellid1 stored
    15  	BitsChPDG    Flags = 1 << 28 // PDG(1) - no PDG(0) (detailed shower contributions) // DEPRECATED: use ChBitStep
    16  	BitsChStep   Flags = 1 << 28 // detailed shower contributions
    17  )
    18  
    19  // Flags for the (raw) Calorimeter hits
    20  const (
    21  	BitsRChLong        Flags = 1 << 31 // long(1) - short(0), incl./excl. position
    22  	BitsRChBarrel      Flags = 1 << 30 // barrel(1) - endcap(0)
    23  	BitsRChID1         Flags = 1 << 29 // cellid1 stored
    24  	BitsRChNoPtr       Flags = 1 << 28 // 1: pointer tag not added
    25  	BitsRChTime        Flags = 1 << 27 // 1: time information stored
    26  	BitsRChEnergyError Flags = 1 << 26 // 1: store energy error
    27  )
    28  
    29  // Flags for the (raw) tracker data (pulses)
    30  const (
    31  	BitsTRawID1 Flags = 1 << 31 // cellid1 stored
    32  	BitsTRawCM  Flags = 1 << 30 // covariant matrix stored(1) - not stored(0)
    33  )
    34  
    35  // Flags for the raw tracker hit
    36  const (
    37  	BitsRThID1 Flags = 1 << 31 // cellid1 stored
    38  )
    39  
    40  // Flags for the tracker hit plane
    41  const (
    42  	BitsThPID1 Flags = 1 << 31 // cellid1 stored
    43  )
    44  
    45  // Flags for the tracker hit z-cylinder
    46  const (
    47  	BitsThZID1 Flags = 1 << 31 // cellid1 stored
    48  )
    49  
    50  // Flags for the SimTrackerHit
    51  const (
    52  	BitsThBarrel   Flags = 1 << 31 // barrel(1) - endcap(0)
    53  	BitsThMomentum Flags = 1 << 30 // momentum of particle stored(1) - not stored(0)
    54  	BitsThID1      Flags = 1 << 29 // cellid1 stored
    55  )
    56  
    57  // Flags for the Tracks
    58  const (
    59  	BitsTrHits Flags = 1 << 31 // hits stored(1) - not stored(0)
    60  )
    61  
    62  // Flags for the Cluster
    63  const (
    64  	BitsClHits Flags = 1 << 31 // hits stored(1) - not stored(0)
    65  )
    66  
    67  // Flags for the TPCHit
    68  const (
    69  	BitsTPCRaw   Flags = 1 << 31 // raw data stored(1) - not stored(0)
    70  	BitsTPCNoPtr Flags = 1 << 30 // 1: pointer tag not added (needed for TrackerHit)
    71  )
    72  
    73  // Flags for Relation
    74  const (
    75  	BitsRelWeighted Flags = 1 << 31 // relation has weights
    76  )
    77  
    78  // Flags for GenericObject
    79  const (
    80  	BitsGOFixed Flags = 1 << 31 // is fixed size
    81  )
    82  
    83  // Test returns whether the given bit is != 0
    84  func (flags Flags) Test(bit Flags) bool {
    85  	return flags&bit != 0
    86  }