PandaRoot
PndMdtID.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef PNDMDTID_HH
14 #define PNDMDTID_HH
15 
16 #include "Rtypes.h"
17 
18 class PndMdtID {
19  public:
20  // provide an unique number for a wire
21  static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iBox, Int_t iWire) { return iWire + 10 * iBox + 10000 * iLayer + 1000000 * iOct + 10000000 * iMod; }
22  // provide an unique number for a strip
23  static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iStrip) { return (iStrip + 2000) + (10000 * iLayer + 1000000 * iOct + 10000000 * iMod); }
24  // provide an unique number for a layer
25  static Int_t LayerID(Int_t iMod, Int_t iOct, Int_t iLayer) { return 10000 * iLayer + 1000000 * iOct + 10000000 * iMod; }
26  static Int_t LayerID(Int_t detID) { return detID / 10000 * 10000; }
27  // inverse operation
28  static Short_t Module(Int_t detID) { return (detID / 10000000); }
29  static Short_t Sector(Int_t detID) { return ((detID / 1000000) % 10); }
30  static Short_t Layer(Int_t detID) { return ((detID / 10000) % 100); }
31  static Short_t Box(Int_t detID) { return ((detID / 10) % 1000); }
32  static Short_t Wire(Int_t detID) { return (detID % 10); }
33  static Short_t Strip(Int_t detID) { return (detID % 10000 - 2000); }
34  static Bool_t isWire(Int_t detID) { return detID % 10000 < 2000; }
35  static Bool_t isStrip(Int_t detID) { return detID % 10000 >= 2000; }
36 
37  private:
38  PndMdtID();
39  ~PndMdtID();
40 };
41 
42 #endif
static Short_t Box(Int_t detID)
Definition: PndMdtID.h:31
static Bool_t isWire(Int_t detID)
Definition: PndMdtID.h:34
static Short_t Module(Int_t detID)
Definition: PndMdtID.h:28
static Short_t Layer(Int_t detID)
Definition: PndMdtID.h:30
static Int_t LayerID(Int_t iMod, Int_t iOct, Int_t iLayer)
Definition: PndMdtID.h:25
static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iBox, Int_t iWire)
Definition: PndMdtID.h:21
static Short_t Sector(Int_t detID)
Definition: PndMdtID.h:29
static Short_t Strip(Int_t detID)
Definition: PndMdtID.h:33
static Bool_t isStrip(Int_t detID)
Definition: PndMdtID.h:35
static Int_t LayerID(Int_t detID)
Definition: PndMdtID.h:26
static Int_t Identifier(Int_t iMod, Int_t iOct, Int_t iLayer, Int_t iStrip)
Definition: PndMdtID.h:23
static Short_t Wire(Int_t detID)
Definition: PndMdtID.h:32