| 1 |
mocchiut |
1.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 |
mocchiut |
1.4 |
// |
| 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 |
mocchiut |
1.8 |
//#define CTX 121.2 |
| 20 |
|
|
//#define CTY 122.9 |
| 21 |
|
|
//#define CTZ -263.1 |
| 22 |
|
|
// |
| 23 |
|
|
// new param using em showers (E. Taddei paramters) |
| 24 |
|
|
// |
| 25 |
mocchiut |
1.15 |
//#define CTX 120.6 |
| 26 |
|
|
//#define CTY 122.3 |
| 27 |
|
|
//#define CTZ -263.1 |
| 28 |
mocchiut |
1.1 |
// |
| 29 |
mocchiut |
1.14 |
// new param using inclined protons and looking for Z alignment |
| 30 |
|
|
// |
| 31 |
|
|
#define CTX 120.6 |
| 32 |
|
|
#define CTY 122.3 |
| 33 |
|
|
#define CTZ -261.596 |
| 34 |
|
|
// |
| 35 |
mocchiut |
1.4 |
// Mechanical positions (used with option --use-standard-alig) |
| 36 |
|
|
// |
| 37 |
mocchiut |
1.9 |
#define MECHCTX 120.5 |
| 38 |
|
|
#define MECHCTY 121.5 |
| 39 |
mocchiut |
1.4 |
#define MECHCTZ -261.81 |
| 40 |
|
|
// |
| 41 |
|
|
// just for testing purpose |
| 42 |
|
|
// |
| 43 |
|
|
//#define MECHCTX 0. |
| 44 |
|
|
//#define MECHCTY 0. |
| 45 |
|
|
//#define MECHCTZ -263.1 |
| 46 |
|
|
// |
| 47 |
|
|
#include <sstream> |
| 48 |
|
|
#include <fstream> |
| 49 |
|
|
#include <string.h> |
| 50 |
mocchiut |
1.1 |
#include <TObject.h> |
| 51 |
mocchiut |
1.4 |
#include <TMath.h> |
| 52 |
mocchiut |
1.1 |
#include <TClonesArray.h> |
| 53 |
|
|
#include <TArrayI.h> |
| 54 |
mocchiut |
1.4 |
#include <TSystem.h> |
| 55 |
|
|
#include <GLTables.h> |
| 56 |
mocchiut |
1.1 |
// |
| 57 |
|
|
extern "C" int millim_(Int_t *, Float_t *); |
| 58 |
|
|
struct shift { |
| 59 |
|
|
Float_t shift; |
| 60 |
|
|
}; |
| 61 |
|
|
// |
| 62 |
|
|
|
| 63 |
|
|
/** |
| 64 |
|
|
* \brief Calorimeter level1 class |
| 65 |
|
|
* |
| 66 |
|
|
* This class contains level1 calorimeter variables |
| 67 |
|
|
* |
| 68 |
|
|
**/ |
| 69 |
|
|
class CaloLevel1 : public TObject { |
| 70 |
|
|
|
| 71 |
|
|
private: |
| 72 |
|
|
|
| 73 |
|
|
public: |
| 74 |
|
|
// |
| 75 |
|
|
Int_t istrip; ///< total number of strip hit |
| 76 |
|
|
// |
| 77 |
|
|
// Number of strip with energy > emip and their value coded with view plane and strip number: |
| 78 |
|
|
// view x[y] plane PP strip SS with energy mmmm.iip = +[-] ( PP*10^6 + SS*10^4 + mmmm.iip ) |
| 79 |
|
|
// |
| 80 |
|
|
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 |
| 81 |
|
|
// |
| 82 |
pam-fi |
1.17 |
CaloLevel1* GetCaloLevel1(){return this;} ///< returns pointer to this object |
| 83 |
mocchiut |
1.1 |
// |
| 84 |
|
|
// |
| 85 |
|
|
Float_t GetEstrip(Int_t view, Int_t plane, Int_t strip); ///< returns saved MIP value for the indicated strip. |
| 86 |
|
|
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. |
| 87 |
mocchiut |
1.11 |
Float_t DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip, Bool_t &saturated); ///< returns saved MIP value for the entry number "entry" of the TArrayI. |
| 88 |
mocchiut |
1.2 |
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.). |
| 89 |
|
|
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 ). |
| 90 |
mocchiut |
1.11 |
Float_t qtotpl(Int_t nplane, Bool_t &saturation); ///< Returns energy released on plane nplane (where 0<= nplane <= 43, 0 = 1Y, 1 = 1X, 2 = 2Y, 3 = 2X, etc. etc.). |
| 91 |
|
|
Float_t qtotpl(Int_t view, Int_t plane, Bool_t &saturation); ///< Returns energy released on view "view" (0 = X, 1 = Y) and plane "plane" ( 0 <= plane <= 21 ). |
| 92 |
mocchiut |
1.1 |
// |
| 93 |
mocchiut |
1.12 |
void Clear(Option_t *t=""); |
| 94 |
mocchiut |
1.1 |
// |
| 95 |
pam-fi |
1.17 |
Float_t GetXalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTX;} ///< return X alignement paramenter |
| 96 |
|
|
Float_t GetYalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTY;} ///< return Y alignement paramenter |
| 97 |
|
|
Float_t GetZalig(){printf(" Obsolete! Use CaloStrip class instead\n");return CTZ;} ///< return Z alignement paramenter |
| 98 |
mocchiut |
1.3 |
// |
| 99 |
mocchiut |
1.1 |
CaloLevel1(); ///< Constructor. |
| 100 |
|
|
// |
| 101 |
|
|
ClassDef(CaloLevel1,1); |
| 102 |
|
|
}; |
| 103 |
|
|
|
| 104 |
|
|
/** |
| 105 |
|
|
* \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 |
| 106 |
|
|
* |
| 107 |
|
|
*/ |
| 108 |
|
|
class CaloStrip : public TObject { |
| 109 |
|
|
|
| 110 |
|
|
private: |
| 111 |
mocchiut |
1.4 |
CaloLevel1 *c1; //< pointer to level1 object |
| 112 |
|
|
Float_t fE; //< energy in mip of the strip |
| 113 |
|
|
Float_t fX; //< X position in cm of the strip |
| 114 |
|
|
Float_t fY; //< Y position in cm of the strip |
| 115 |
|
|
Float_t fZ; //< Z position in cm of the strip |
| 116 |
|
|
Int_t fView; ///< view [1-2] |
| 117 |
|
|
Int_t fPlane; ///< plane [1-22] |
| 118 |
|
|
Int_t fStrip; ///< strip [1-96] |
| 119 |
|
|
Bool_t ismech; ///< true = using mechanical alignement, false using experimental alignement parameters |
| 120 |
mocchiut |
1.7 |
static Float_t UXal; ///< used X alignement parameter |
| 121 |
|
|
static Float_t UYal; ///< used Y alignement parameter |
| 122 |
|
|
static Float_t UZal; ///< used Z alignement parameter |
| 123 |
|
|
static Bool_t paramload; |
| 124 |
mocchiut |
1.18 |
Bool_t debug; |
| 125 |
|
|
// |
| 126 |
|
|
|
| 127 |
mocchiut |
1.1 |
public: |
| 128 |
|
|
// |
| 129 |
|
|
// METHODS |
| 130 |
|
|
// |
| 131 |
|
|
CaloStrip(); ///< Default Constructor. |
| 132 |
|
|
// |
| 133 |
mocchiut |
1.5 |
CaloStrip(Bool_t usemechanicalalignement); ///< Default Constructor. |
| 134 |
|
|
// |
| 135 |
mocchiut |
1.1 |
CaloStrip(CaloLevel1 *c1); ///< Constructor. |
| 136 |
|
|
// |
| 137 |
mocchiut |
1.5 |
CaloStrip(CaloLevel1 *c1, Bool_t usemechanicalalignement); ///< Constructor. |
| 138 |
|
|
// |
| 139 |
pam-fi |
1.17 |
Float_t GetE(){return fE;} ///< Get energy in MIP for setted strip |
| 140 |
mocchiut |
1.4 |
// |
| 141 |
pam-fi |
1.17 |
Float_t GetX(){return fX;} ///< Get X strip position |
| 142 |
|
|
Float_t GetY(){return fY;} ///< Get Y strip position |
| 143 |
|
|
Float_t GetZ(){return fZ;} /// Get Z strip position |
| 144 |
|
|
// |
| 145 |
|
|
Float_t GetXalig(){ return UXal;} ///< return X alignement paramenter |
| 146 |
|
|
Float_t GetYalig(){ return UYal;} ///< return Y alignement paramenter |
| 147 |
|
|
Float_t GetZalig(){ return UZal;} ///< return Z alignement paramenter |
| 148 |
|
|
// |
| 149 |
|
|
Int_t GetView(){return (fView-1);} ///< Get strip view [0-1] |
| 150 |
|
|
Int_t GetPlane(){return (fPlane-1);} ///< Get strip plane [0-21] |
| 151 |
|
|
Int_t GetStrip(){return (fStrip-1);} ///< Get strip number [0-95] |
| 152 |
mocchiut |
1.4 |
// |
| 153 |
mocchiut |
1.16 |
Int_t GetSiSensor(); ///< Return the sensor number, -1 means dead area |
| 154 |
|
|
// |
| 155 |
mocchiut |
1.4 |
void Set(Int_t view, Int_t plane, Int_t strip); ///< Set strip giving view [0-1], plane [0-22] and number [0-95] |
| 156 |
mocchiut |
1.1 |
// |
| 157 |
mocchiut |
1.4 |
void Set(Float_t X, Float_t Y, Float_t Z); ///< Set strip giving position in PAMELA ref sys [cm] |
| 158 |
mocchiut |
1.1 |
// |
| 159 |
pam-fi |
1.17 |
void UseMechanicalAlig(){ ismech = true; UXal = MECHCTX; UYal = MECHCTY; UZal = MECHCTZ;} ///< Tells CaloStrip to use mechanical alignement parameters |
| 160 |
mocchiut |
1.4 |
void UseStandardAlig(); ///< Tells CaloStrip to use default parameters it will find querying the DB. If connection fails uses parameters hard-coded in this file |
| 161 |
pam-fi |
1.17 |
void SetAlig(Float_t XALIG, Float_t YALIG, Float_t ZALIG){ ismech = false; UXal = XALIG; UYal = YALIG; UZal = ZALIG;}///< User defined alignement parameters |
| 162 |
|
|
Bool_t IsMechanicalAlig(){return ismech;} ///< True is using mechanical alignement parameters, false otherwise |
| 163 |
mocchiut |
1.1 |
// |
| 164 |
mocchiut |
1.18 |
void SetDebug(Bool_t dbg){debug=dbg;} ///< Turn on/off debug flag [default = false] |
| 165 |
|
|
// |
| 166 |
mocchiut |
1.13 |
void Clear(Option_t *t=""); ///< clear variables |
| 167 |
mocchiut |
1.1 |
// |
| 168 |
pam-fi |
1.17 |
CaloStrip* GetCaloStrip(){return this;} ///< returns pointer to this object |
| 169 |
mocchiut |
1.1 |
// |
| 170 |
mocchiut |
1.18 |
ClassDef(CaloStrip,3); |
| 171 |
mocchiut |
1.1 |
// |
| 172 |
|
|
}; |
| 173 |
|
|
|
| 174 |
|
|
#endif |