| 1 | 
/** | 
| 2 | 
 * \file inc/CaloLevel2.h | 
| 3 | 
 * \author Emiliano Mocchiutti | 
| 4 | 
 */ | 
| 5 | 
#ifndef CaloLevel2_h | 
| 6 | 
#define CaloLevel2_h | 
| 7 | 
// | 
| 8 | 
#include <TObject.h> | 
| 9 | 
#include <TClonesArray.h> | 
| 10 | 
#include <TArrayF.h> | 
| 11 | 
// | 
| 12 | 
#include <CaloStruct.h> | 
| 13 | 
/** | 
| 14 | 
 * \brief Calorimeter track-related variables class | 
| 15 | 
 * | 
| 16 | 
 * This class contains track-related variables. One set of variables is saved for any given  | 
| 17 | 
 * track, including seltrigger event tracks.  | 
| 18 | 
 * | 
| 19 | 
 */ | 
| 20 | 
class CaloTrkVar : public TObject { | 
| 21 | 
 | 
| 22 | 
private: | 
| 23 | 
 | 
| 24 | 
public: | 
| 25 | 
    // | 
| 26 | 
    Int_t trkseqno; ///< tracker entry coming from tracker, -1 if selftrigger event. | 
| 27 | 
    // | 
| 28 | 
    // track related variables | 
| 29 | 
    // | 
| 30 | 
    Int_t ncore;     ///< SUM(j=1,2)SUM(i=1,PLmax) Nhit(i,j)*i , where Nhit(i,j) is the number of hits in a cylinder of radius 2 Rm (Moliere radius) around the track in the i-th plane (where the top plane is number 1 and the sum runs up to plane number PLmax, closest to the calculated electromagnetic shower maximum of the j-th view) | 
| 31 | 
    Int_t noint;      ///< SUM(j=1,2)SUM(i=1,22) TH(i,j)*i , where TH(i,j) = 1 if the i-th plane of the j-th view has a cluster along (less than 4 mm away) the track with a deposited energy typical of a proton (order of one MIP), otherwise TH(i,j) = 0 | 
| 32 | 
    Int_t ncyl;      ///< the number of strip hit in a cylinder of radius 8 strips around the shower axis | 
| 33 | 
    Int_t nlast;     ///< the same as "ncyl" but only for the last four planes and radius 4 strips. | 
| 34 | 
    Int_t npre;      ///< the same as "ncyl" but only for the first three planes | 
| 35 | 
    Int_t npresh;    ///< the same as "ncyl" but with radius 2 strips and only in the first four planes | 
| 36 | 
    Int_t ntr;       ///< the same as "ncyl" but with radius 4 strips | 
| 37 | 
    Int_t planetot;  ///< number of planes used to calculate the energy truncated mean "qmean" | 
| 38 | 
    Int_t nlow;      ///< the same as "nstrip" but below the calculated electromagnetic shower maximum | 
| 39 | 
    Int_t tibar[22][2];  ///< strip traversed by the trajectory as measured by the tracker | 
| 40 | 
    Float_t tbar[22][2]; ///< position in cm as measured by the tracker | 
| 41 | 
    Float_t qcore;   ///< SUM(j=1,2)SUM(i=1,PLmax) Qhit(i,j)*i , where Qhit(i,j) is the energy released (MIP) in a cylinder of radius 2 Rm (Moliere radius) around the track in the i-th plane (where the top plane is number 1 and the sum runs up to plane number PLmax, closest to the calculated electromagnetic shower maximum of the j-th view). | 
| 42 | 
    Float_t qcyl;    ///< the measured energy deposited in a cylinder of radius 8 strips around the shower axis | 
| 43 | 
    Float_t qlast;   ///< the same as "qcyl" but only for the last four planes and radius 4 strips. | 
| 44 | 
    Float_t qpre;    ///< the same as "qcyl" but only for the first three planes | 
| 45 | 
    Float_t qpresh;  ///< the same as "qcyl" but with radius 2 strips and only in the first four planes | 
| 46 | 
    Float_t qtr;     ///< the same as "qcyl" but with radius 4 strips | 
| 47 | 
    Float_t qtrack;  ///< the energy deposited in the strip closest to the track and the neighbouring strip on each side | 
| 48 | 
    Float_t qtrackx; ///< measured energy in clusters along the track in the x-view | 
| 49 | 
    Float_t qtracky; ///< measured energy in clusters along the track in the y-view | 
| 50 | 
    Float_t dxtrack; ///< measured energy outside the clusters along the track in the x-view | 
| 51 | 
    Float_t dytrack; ///< measured energy outside the clusters along the track in the y-view | 
| 52 | 
    Float_t qmean;   ///< the energy truncated mean that is the average energy deposit for the five planes with the smaller energy deposit of the whole calorimeter | 
| 53 | 
    Float_t qlow;    ///< the same as "qstrip" but below the calculated electromagnetic shower maximum | 
| 54 | 
    Float_t dX0l;    ///< tranversed X0 lenght | 
| 55 | 
    // | 
| 56 | 
    CaloTrkVar(); ///< Constructor. | 
| 57 | 
    /** | 
| 58 | 
     * \param trkvar Object of the class CaloTrkVar | 
| 59 | 
     */ | 
| 60 | 
    CaloTrkVar(const CaloTrkVar &trkvar); ///< copy values from trkvar to this | 
| 61 | 
    // | 
| 62 | 
    CaloTrkVar* GetCaloTrkVar(){return this;}; ///< returns pointer to this object | 
| 63 | 
    // | 
| 64 | 
    ClassDef(CaloTrkVar,1); | 
| 65 | 
    // | 
| 66 | 
}; | 
| 67 | 
 | 
| 68 | 
/** | 
| 69 | 
 * \brief Calorimeter level2 class | 
| 70 | 
 * | 
| 71 | 
 * This class contains level2 calorimeter variables | 
| 72 | 
 * | 
| 73 | 
**/ | 
| 74 | 
class CaloLevel2 : public TObject { | 
| 75 | 
 private: | 
| 76 | 
    TClonesArray *CaloTrk; ///< track related variables | 
| 77 | 
 | 
| 78 | 
 public: | 
| 79 | 
    // | 
| 80 | 
    // general variables | 
| 81 | 
    // | 
| 82 | 
    Int_t good;    ///< no errors (perr, swerr and crc are checked) | 
| 83 | 
    Int_t perr[4]; ///< processing errors (one for each calorimeter section) | 
| 84 | 
    Int_t swerr[4];///< DSP status word  | 
| 85 | 
    Int_t crc[4];  ///< CRC errors on data | 
| 86 | 
    Int_t selftrigger;///< self-trigger flag (1 selftrigger event, 0 normal event) | 
| 87 | 
    // | 
| 88 | 
    // common variables (not related to tracks) | 
| 89 | 
    // | 
| 90 | 
    Int_t nstrip;      ///< total number of strip hit | 
| 91 | 
    Int_t nx22;        ///< number of strip hit in the last silicon plane of the calorimeter (x view number 22) | 
| 92 | 
    Int_t planemax[2]; ///< plane of maximum energy release (x and y) | 
| 93 | 
    Float_t qtot;      ///< total energy detected (MIP) | 
| 94 | 
    Float_t qx22;      ///< energy detected in the last silicon plane of the calorimeter (x view number 22) | 
| 95 | 
    Float_t qmax;      ///< the maximum energy detected in a strip | 
| 96 | 
    Float_t qq[4];     ///< the energy released in the first half of each of the four calorimeter sections | 
| 97 | 
    // | 
| 98 | 
    // Fit variables | 
| 99 | 
    // | 
| 100 | 
    Int_t npcfit[2];     ///< number of point used to perform the fit for the two views | 
| 101 | 
    Int_t cibar[22][2];  ///< strip traversed by the trajectory as measured by the calorimeter | 
| 102 | 
    Float_t cbar[22][2]; ///< position in cm as measured by the calorimeter | 
| 103 | 
    Float_t impx;        ///< the x impact position on the first plane as determined by the track fitted in the calorimeter | 
| 104 | 
    Float_t impy;        ///< the y impact position on the first plane as determined by the track fitted in the calorimeter | 
| 105 | 
    Float_t tanx;        ///< the tangent of the angle in the x direction as determined by the track fitted in the calorimeter | 
| 106 | 
    Float_t tany;        ///< the tangent of the angle in the x direction as determined by the track fitted in the calorimeter | 
| 107 | 
    Float_t varcfit[2];  ///< variance of the calorimeter fit for the two views | 
| 108 | 
    // | 
| 109 | 
    // Energy variables | 
| 110 | 
    // | 
| 111 | 
    Float_t elen;  ///< energy in GeV assuming an electron interaction (from simulations). | 
| 112 | 
    Float_t selen; ///< sigma of the energy | 
| 113 | 
    // | 
| 114 | 
    // track related variables: inline methods | 
| 115 | 
    // | 
| 116 | 
    Int_t ntrk()                                       {return CaloTrk->GetEntries();};  ///< number of saved blocks of track-related variables | 
| 117 | 
    Int_t trkseqno(Int_t entry)                        {return (((CaloTrkVar *)CaloTrk->At(entry))->trkseqno);}; ///< extract trkseqno | 
| 118 | 
    Int_t ncore(Int_t entry)                           {return (((CaloTrkVar *)CaloTrk->At(entry))->ncore);}; ///< extract ncore | 
| 119 | 
    Int_t noint(Int_t entry)                           {return (((CaloTrkVar *)CaloTrk->At(entry))->noint);}; ///< extract noint | 
| 120 | 
    Int_t ncyl(Int_t entry)                            {return (((CaloTrkVar *)CaloTrk->At(entry))->ncyl);}; ///< extract ncyl | 
| 121 | 
    Int_t nlast(Int_t entry)                           {return (((CaloTrkVar *)CaloTrk->At(entry))->nlast);}; ///< extract nlast | 
| 122 | 
    Int_t npre(Int_t entry)                            {return (((CaloTrkVar *)CaloTrk->At(entry))->npre);}; ///< extract npre | 
| 123 | 
    Int_t npresh(Int_t entry)                          {return (((CaloTrkVar *)CaloTrk->At(entry))->npresh);}; ///< extract npresh | 
| 124 | 
    Int_t ntr(Int_t entry)                             {return (((CaloTrkVar *)CaloTrk->At(entry))->ntr);}; ///< extract ntr | 
| 125 | 
    Int_t nlow(Int_t entry)                            {return (((CaloTrkVar *)CaloTrk->At(entry))->nlow);}; ///< extract nlow | 
| 126 | 
    Int_t planetot(Int_t entry)                        {return (((CaloTrkVar *)CaloTrk->At(entry))->planetot);}; ///< extract planetot | 
| 127 | 
    Int_t tibar(Int_t entry, Int_t plane, Int_t view)  {return (((CaloTrkVar *)CaloTrk->At(entry))->tibar[plane][view]);}; ///< extract tibar | 
| 128 | 
    Float_t tbar(Int_t entry, Int_t plane, Int_t view) {return (((CaloTrkVar *)CaloTrk->At(entry))->tbar[plane][view]);}; ///< extract tbar | 
| 129 | 
    Float_t qcore(Int_t entry)                         {return (((CaloTrkVar *)CaloTrk->At(entry))->qcore);}; ///< extract qcore | 
| 130 | 
    Float_t qcyl(Int_t entry)                          {return (((CaloTrkVar *)CaloTrk->At(entry))->qcyl);}; ///< extract qcyl | 
| 131 | 
    Float_t qlast(Int_t entry)                         {return (((CaloTrkVar *)CaloTrk->At(entry))->qlast);}; ///< extract qlast | 
| 132 | 
    Float_t qpre(Int_t entry)                          {return (((CaloTrkVar *)CaloTrk->At(entry))->qpre);}; ///< extract qpre | 
| 133 | 
    Float_t qpresh(Int_t entry)                        {return (((CaloTrkVar *)CaloTrk->At(entry))->qpresh);}; ///< extract qpresh | 
| 134 | 
    Float_t qtr(Int_t entry)                           {return (((CaloTrkVar *)CaloTrk->At(entry))->qtr);}; ///< extract qtr | 
| 135 | 
    Float_t qtrack(Int_t entry)                        {return (((CaloTrkVar *)CaloTrk->At(entry))->qtrack);}; ///< extract qtrack | 
| 136 | 
    Float_t qtrackx(Int_t entry)                       {return (((CaloTrkVar *)CaloTrk->At(entry))->qtrackx);}; ///< extract qtrackx | 
| 137 | 
    Float_t qtracky(Int_t entry)                       {return (((CaloTrkVar *)CaloTrk->At(entry))->qtracky);}; ///< extract qtracky | 
| 138 | 
    Float_t dxtrack(Int_t entry)                       {return (((CaloTrkVar *)CaloTrk->At(entry))->dxtrack);}; ///< extract dxtrack | 
| 139 | 
    Float_t dytrack(Int_t entry)                       {return (((CaloTrkVar *)CaloTrk->At(entry))->dytrack);}; ///< extract dytrack | 
| 140 | 
    Float_t qmean(Int_t entry)                         {return (((CaloTrkVar *)CaloTrk->At(entry))->qmean);}; ///< extract qmean | 
| 141 | 
    Float_t qlow(Int_t entry)                          {return (((CaloTrkVar *)CaloTrk->At(entry))->qlow);}; ///< extract qlow | 
| 142 | 
    Float_t dX0l(Int_t entry)                          {return (((CaloTrkVar *)CaloTrk->At(entry))->dX0l);}; ///< extract dX0l | 
| 143 | 
    // | 
| 144 | 
    // Number of strip with energy > emip and their value coded with view plane and strip number: | 
| 145 | 
    // view x[y] plane PP strip SS with energy mmmm.iip = +[-] ( PP*10^6 + SS*10^4 + mmmm.iip ) | 
| 146 | 
    // | 
| 147 | 
    TArrayF estrip; ///< MIP values for each strip with energy > emin coded with view plane and strip number; view x[y] plane PP strip SS with energy mmmm.iip = +[-] ( PP*10^6 + SS*10^4 + mmmm.iip ) | 
| 148 | 
    // | 
| 149 | 
    // METHODS | 
| 150 | 
    // | 
| 151 | 
    void GetElectronEnergy(Float_t &energy, Float_t &sigma); ///< returns energy and sigma using qtot and assuming the particle being an electron | 
| 152 | 
    Float_t GetEstrip(Int_t view, Int_t plane, Int_t strip); ///< returns saved MIP value for the indicated strip | 
| 153 | 
    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 TArrayF. | 
| 154 | 
    CaloTrkVar *GetCaloTrkVar(Int_t notrack);  ///< returns a pointer to the CaloTrkVar class containing track related variables | 
| 155 | 
    // | 
| 156 | 
    TClonesArray *GetTrackArray(){return CaloTrk;}; | 
| 157 | 
    CaloLevel2* GetCaloLevel2(){return this;}; ///< returns pointer to this object | 
| 158 | 
    // | 
| 159 | 
    void GetLevel2Struct(cCaloLevel2 *l2) const; | 
| 160 | 
    void Clear(); | 
| 161 | 
    // | 
| 162 | 
    // constructor | 
| 163 | 
    // | 
| 164 | 
    CaloLevel2(); ///< Constructor. | 
| 165 | 
    // | 
| 166 | 
    friend class CaloProcessing; | 
| 167 | 
    // | 
| 168 | 
    ClassDef(CaloLevel2,1); | 
| 169 | 
}; | 
| 170 | 
 | 
| 171 | 
#endif |