| 1 | 
/** | 
| 2 | 
 * \file CaloEnergy.h | 
| 3 | 
 * \authors Emiliano Mocchiutti & Giovanna Jerse | 
| 4 | 
 */ | 
| 5 | 
#ifndef caloenergy_h | 
| 6 | 
#define caloenergy_h | 
| 7 | 
 | 
| 8 | 
#include <PamLevel2.h> | 
| 9 | 
 | 
| 10 | 
#include <TTree.h> | 
| 11 | 
#include <TFriendElement.h> | 
| 12 | 
#include <TChain.h> | 
| 13 | 
#include <TFile.h> | 
| 14 | 
#include <TList.h> | 
| 15 | 
#include <TKey.h> | 
| 16 | 
#include <TSystemFile.h> | 
| 17 | 
#include <TSystemDirectory.h> | 
| 18 | 
#include <TSQLServer.h> | 
| 19 | 
 | 
| 20 | 
#include <iostream> | 
| 21 | 
 | 
| 22 | 
using namespace std; | 
| 23 | 
 | 
| 24 | 
/** | 
| 25 | 
 * | 
| 26 | 
 */ | 
| 27 | 
class CaloEnergy : public TObject { | 
| 28 | 
 | 
| 29 | 
 private: | 
| 30 | 
    // | 
| 31 | 
    PamLevel2 *L2; | 
| 32 | 
    Bool_t debug; | 
| 33 | 
    // | 
| 34 | 
    // needed to avoid reprocessing the same event over and over to obtain the variables | 
| 35 | 
    // | 
| 36 | 
    UInt_t OBT; | 
| 37 | 
    UInt_t PKT; | 
| 38 | 
    UInt_t atime; | 
| 39 | 
    TString sntr; | 
| 40 | 
    UInt_t AOBT; | 
| 41 | 
    UInt_t APKT; | 
| 42 | 
    UInt_t aatime; | 
| 43 | 
    TString asntr; | 
| 44 | 
    // | 
| 45 | 
    Float_t fM; | 
| 46 | 
    Float_t fM1; | 
| 47 | 
    Float_t fPl; | 
| 48 | 
    Float_t fConv_r; | 
| 49 | 
    Bool_t fLong; | 
| 50 | 
    // | 
| 51 | 
    Float_t fEnergy; | 
| 52 | 
    Float_t fCount; | 
| 53 | 
    Int_t fMax_plane; | 
| 54 | 
    // | 
| 55 | 
    Float_t xe1; | 
| 56 | 
    Float_t xe2; | 
| 57 | 
    Float_t xe3; | 
| 58 | 
    Float_t xe4; | 
| 59 | 
    Float_t xe5; | 
| 60 | 
    Float_t xe6; | 
| 61 | 
    Float_t z1; | 
| 62 | 
    Float_t yo1; | 
| 63 | 
    Float_t yo2; | 
| 64 | 
    Float_t yo3; | 
| 65 | 
    Float_t yo4; | 
| 66 | 
    Float_t yo5; | 
| 67 | 
    Float_t yo6; | 
| 68 | 
    Float_t z2; | 
| 69 | 
    Float_t xo1; | 
| 70 | 
    Float_t xo2; | 
| 71 | 
    Float_t xo3; | 
| 72 | 
    Float_t xo4; | 
| 73 | 
    Float_t xo5; | 
| 74 | 
    Float_t xo6; | 
| 75 | 
    Float_t z3; | 
| 76 | 
    Float_t ye1; | 
| 77 | 
    Float_t ye2; | 
| 78 | 
    Float_t ye3; | 
| 79 | 
    Float_t ye4; | 
| 80 | 
    Float_t ye5; | 
| 81 | 
    Float_t ye6; | 
| 82 | 
    Float_t z4; | 
| 83 | 
    Float_t trk_z[22][2];   | 
| 84 | 
    Float_t en; | 
| 85 | 
    Int_t view; | 
| 86 | 
    Int_t plane; | 
| 87 | 
    Int_t strip; | 
| 88 | 
    Float_t energyxe;  | 
| 89 | 
    Float_t energyyo;  | 
| 90 | 
    Float_t energyxo;  | 
| 91 | 
    Float_t energyye;  | 
| 92 | 
    Float_t en_xep[11]; | 
| 93 | 
    Float_t en_yop[11]; | 
| 94 | 
    Float_t en_xop[11]; | 
| 95 | 
    Float_t en_yep[11]; | 
| 96 | 
    Float_t enstrip[2][22][96];     | 
| 97 | 
    // | 
| 98 | 
    Bool_t fXosel; | 
| 99 | 
    Bool_t fXesel; | 
| 100 | 
    Bool_t fYosel;     | 
| 101 | 
    Bool_t fYesel; | 
| 102 | 
    Bool_t fSel; | 
| 103 | 
    // | 
| 104 | 
    Bool_t fSimu; | 
| 105 | 
    void DefineGeometry(); | 
| 106 | 
 | 
| 107 | 
 public: | 
| 108 | 
    // | 
| 109 | 
    CaloEnergy(); | 
| 110 | 
    CaloEnergy(PamLevel2 *L2); | 
| 111 | 
    CaloEnergy(PamLevel2 *L2, Bool_t simulation); | 
| 112 | 
    ~CaloEnergy(){ Delete(); }; | 
| 113 | 
    // | 
| 114 | 
    void SetDebug(Bool_t d){ debug=d; }; | 
| 115 | 
    // | 
| 116 | 
    void Clear(); | 
| 117 | 
    void Clear(Option_t *option){Clear();}; | 
| 118 | 
    void Delete(); | 
| 119 | 
    void Delete(Option_t *option){Delete();}; | 
| 120 | 
    // | 
| 121 | 
    void Process(); | 
| 122 | 
    void Process(TString section);  | 
| 123 | 
    void Print(); | 
| 124 | 
    void Print(Option_t *option){Print();}; | 
| 125 | 
    // | 
| 126 | 
    Bool_t IsInsideAcceptance(TString section); | 
| 127 | 
    Bool_t IsInsideAcceptance(TString section, Bool_t fast); | 
| 128 | 
    // | 
| 129 | 
    Bool_t IsInsideXE(){return(IsInsideAcceptance("XE"));}; | 
| 130 | 
    Bool_t InsideXEcheck(){return fXesel;}; | 
| 131 | 
    Bool_t IsInsideXO(){return(IsInsideAcceptance("XO"));}; | 
| 132 | 
    Bool_t InsideXOcheck(){return fXosel;}; | 
| 133 | 
    Bool_t IsInsideYE(){return(IsInsideAcceptance("YE"));}; | 
| 134 | 
    Bool_t InsideYEcheck(){return fYesel;}; | 
| 135 | 
    Bool_t IsInsideYO(){return(IsInsideAcceptance("YO"));}; | 
| 136 | 
    Bool_t InsideYOcheck(){return fYosel;}; | 
| 137 | 
    // | 
| 138 | 
    Float_t GetEnergy(){ Process(); return fEnergy;}; | 
| 139 | 
    Float_t GetEnergy(TString section){ Process(section); return fEnergy;}; | 
| 140 | 
    Float_t GetCount(){ return fCount;}; | 
| 141 | 
    // | 
| 142 | 
    void UseLongitudinalFitEnergy(){ fPl = 0; fLong = true;}; | 
| 143 | 
    void UseMeasuredEnergyUpToMax(){ fLong = false;}; | 
| 144 | 
    void SetMargin(Float_t margin){fM = margin; fM1 = fM - 0.122 -0.096; if ( fM1 < 0. ) fM1 = 0.;}; | 
| 145 | 
    void SetMaxPlaneOffset(Int_t noplanes){fPl = noplanes;}; | 
| 146 | 
    // | 
| 147 | 
    void SetConversionFactor(Float_t conv_r){ fConv_r = conv_r;}; | 
| 148 | 
    // | 
| 149 | 
    ClassDef(CaloEnergy,1); | 
| 150 | 
}; | 
| 151 | 
 | 
| 152 | 
#endif | 
| 153 | 
 |