| 1 |
/** |
| 2 |
* \file inc/CaloLevel1.h |
| 3 |
* \author Emiliano Mocchiutti |
| 4 |
*/ |
| 5 |
#ifndef CaloLevel1_h |
| 6 |
#define CaloLevel1_h |
| 7 |
// |
| 8 |
// default position used only in CaloStrip for the moment |
| 9 |
// |
| 10 |
// |
| 11 |
// old param |
| 12 |
// |
| 13 |
//#define CTX 121.1 |
| 14 |
//#define CTY 122.6 |
| 15 |
//#define CTZ -263.1 |
| 16 |
// |
| 17 |
// new param |
| 18 |
// |
| 19 |
#define CTX 121.2 |
| 20 |
#define CTY 122.9 |
| 21 |
#define CTZ -263.1 |
| 22 |
// |
| 23 |
// Mechanical positions (used with option --use-standard-alig) |
| 24 |
// |
| 25 |
#define MECHCTX 121. |
| 26 |
#define MECHCTY 122. |
| 27 |
#define MECHCTZ -261.81 |
| 28 |
// |
| 29 |
// just for testing purpose |
| 30 |
// |
| 31 |
//#define MECHCTX 0. |
| 32 |
//#define MECHCTY 0. |
| 33 |
//#define MECHCTZ -263.1 |
| 34 |
// |
| 35 |
#include <sstream> |
| 36 |
#include <fstream> |
| 37 |
#include <string.h> |
| 38 |
#include <TObject.h> |
| 39 |
#include <TMath.h> |
| 40 |
#include <TClonesArray.h> |
| 41 |
#include <TArrayI.h> |
| 42 |
#include <TSystem.h> |
| 43 |
#include <GLTables.h> |
| 44 |
// |
| 45 |
extern "C" int millim_(Int_t *, Float_t *); |
| 46 |
struct shift { |
| 47 |
Float_t shift; |
| 48 |
}; |
| 49 |
// |
| 50 |
|
| 51 |
/** |
| 52 |
* \brief Calorimeter level1 class |
| 53 |
* |
| 54 |
* This class contains level1 calorimeter variables |
| 55 |
* |
| 56 |
**/ |
| 57 |
class CaloLevel1 : public TObject { |
| 58 |
|
| 59 |
private: |
| 60 |
|
| 61 |
public: |
| 62 |
// |
| 63 |
Int_t istrip; ///< total number of strip hit |
| 64 |
// |
| 65 |
// Number of strip with energy > emip and their value coded with view plane and strip number: |
| 66 |
// view x[y] plane PP strip SS with energy mmmm.iip = +[-] ( PP*10^6 + SS*10^4 + mmmm.iip ) |
| 67 |
// |
| 68 |
TArrayI estrip; ///< MIP values for each strip with energy > emin coded with view plane and strip number. NOTICE: precision is limited to the 5 most significative ciphers |
| 69 |
// |
| 70 |
CaloLevel1* GetCaloLevel1(){return this;}; ///< returns pointer to this object |
| 71 |
// |
| 72 |
// |
| 73 |
Float_t GetEstrip(Int_t view, Int_t plane, Int_t strip); ///< returns saved MIP value for the indicated strip. |
| 74 |
Float_t DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip); ///< returns saved MIP value for the entry number "entry" of the TArrayI. |
| 75 |
Float_t qtotpl(Int_t nplane); ///< Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
| 76 |
Float_t qtotpl(Int_t view, Int_t plane); ///< Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
| 77 |
// |
| 78 |
void Clear(); |
| 79 |
// |
| 80 |
Float_t GetXalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTX;}; ///< return X alignement paramenter |
| 81 |
Float_t GetYalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTY;}; ///< return Y alignement paramenter |
| 82 |
Float_t GetZalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTZ;}; ///< return Z alignement paramenter |
| 83 |
// |
| 84 |
CaloLevel1(); ///< Constructor. |
| 85 |
// |
| 86 |
ClassDef(CaloLevel1,1); |
| 87 |
}; |
| 88 |
|
| 89 |
/** |
| 90 |
* \brief Calorimeter strip class, needed to perform operation on a strip level, for example to retrieve the position of the strips or to retrieve the closest strip to a cerain position |
| 91 |
* |
| 92 |
*/ |
| 93 |
class CaloStrip : public TObject { |
| 94 |
|
| 95 |
private: |
| 96 |
CaloLevel1 *c1; //< pointer to level1 object |
| 97 |
Float_t fE; //< energy in mip of the strip |
| 98 |
Float_t fX; //< X position in cm of the strip |
| 99 |
Float_t fY; //< Y position in cm of the strip |
| 100 |
Float_t fZ; //< Z position in cm of the strip |
| 101 |
Int_t fView; ///< view [1-2] |
| 102 |
Int_t fPlane; ///< plane [1-22] |
| 103 |
Int_t fStrip; ///< strip [1-96] |
| 104 |
Bool_t ismech; ///< true = using mechanical alignement, false using experimental alignement parameters |
| 105 |
static Float_t UXal; ///< used X alignement parameter |
| 106 |
static Float_t UYal; ///< used Y alignement parameter |
| 107 |
static Float_t UZal; ///< used Z alignement parameter |
| 108 |
static Bool_t paramload; |
| 109 |
// |
| 110 |
|
| 111 |
public: |
| 112 |
// |
| 113 |
// METHODS |
| 114 |
// |
| 115 |
CaloStrip(); ///< Default Constructor. |
| 116 |
// |
| 117 |
CaloStrip(Bool_t usemechanicalalignement); ///< Default Constructor. |
| 118 |
// |
| 119 |
CaloStrip(CaloLevel1 *c1); ///< Constructor. |
| 120 |
// |
| 121 |
CaloStrip(CaloLevel1 *c1, Bool_t usemechanicalalignement); ///< Constructor. |
| 122 |
// |
| 123 |
Float_t GetE(){return fE;}; ///< Get energy in MIP for setted strip |
| 124 |
// |
| 125 |
Float_t GetX(){return fX;}; ///< Get X strip position |
| 126 |
Float_t GetY(){return fY;}; ///< Get Y strip position |
| 127 |
Float_t GetZ(){return fZ;}; /// Get Z strip position |
| 128 |
// |
| 129 |
Float_t GetXalig(){ return UXal;}; ///< return X alignement paramenter |
| 130 |
Float_t GetYalig(){ return UYal;}; ///< return Y alignement paramenter |
| 131 |
Float_t GetZalig(){ return UZal;}; ///< return Z alignement paramenter |
| 132 |
// |
| 133 |
Int_t GetView(){return (fView-1);}; ///< Get strip view [0-1] |
| 134 |
Int_t GetPlane(){return (fPlane-1);}; ///< Get strip plane [0-22] |
| 135 |
Int_t GetStrip(){return (fStrip-1);}; ///< Get strip number [0-95] |
| 136 |
// |
| 137 |
void Set(Int_t view, Int_t plane, Int_t strip); ///< Set strip giving view [0-1], plane [0-22] and number [0-95] |
| 138 |
// |
| 139 |
void Set(Float_t X, Float_t Y, Float_t Z); ///< Set strip giving position in PAMELA ref sys [cm] |
| 140 |
// |
| 141 |
void UseMechanicalAlig(){ ismech = true; UXal = MECHCTX; UYal = MECHCTY; UZal = MECHCTZ;}; ///< Tells CaloStrip to use mechanical alignement parameters |
| 142 |
void UseStandardAlig(); ///< Tells CaloStrip to use default parameters it will find querying the DB. If connection fails uses parameters hard-coded in this file |
| 143 |
void SetAlig(Float_t XALIG, Float_t YALIG, Float_t ZALIG){ ismech = false; UXal = XALIG; UYal = YALIG; UZal = ZALIG;};///< User defined alignement parameters |
| 144 |
Bool_t IsMechanicalAlig(){return ismech;}; ///< True is using mechanical alignement parameters, false otherwise |
| 145 |
// |
| 146 |
void Clear(); ///< clear variables |
| 147 |
// |
| 148 |
CaloStrip* GetCaloStrip(){return this;}; ///< returns pointer to this object |
| 149 |
// |
| 150 |
ClassDef(CaloStrip,2); |
| 151 |
// |
| 152 |
}; |
| 153 |
|
| 154 |
#endif |