| 1 |
/** |
| 2 |
* \file CaloAxis.h |
| 3 |
* \author Elena Vannuccini |
| 4 |
*/ |
| 5 |
#if !defined(__CINT__) || defined(__MAKECINT__) |
| 6 |
|
| 7 |
#include <TString.h> |
| 8 |
#include <TH1F.h> |
| 9 |
#include <TH2F.h> |
| 10 |
#include <TMath.h> |
| 11 |
#include <TLine.h> |
| 12 |
#include <TPolyMarker.h> |
| 13 |
#include <TSelector.h> |
| 14 |
#include <TFile.h> |
| 15 |
|
| 16 |
#include <stdlib.h> |
| 17 |
#include <iostream> |
| 18 |
using namespace std; |
| 19 |
|
| 20 |
#include <PamLevel2.h> |
| 21 |
|
| 22 |
#endif |
| 23 |
//=============================================================================== |
| 24 |
// |
| 25 |
// |
| 26 |
// |
| 27 |
// |
| 28 |
//=============================================================================== |
| 29 |
/** |
| 30 |
* \brief Class to store the calorimeter hit pattern on the x or y view |
| 31 |
*/ |
| 32 |
class CaloEvent : public TObject{ |
| 33 |
|
| 34 |
public: |
| 35 |
// calo event |
| 36 |
vector<int> ids; //strip 0-95 |
| 37 |
vector<int> idp; //plane 0-21 |
| 38 |
vector<float> q; // signal |
| 39 |
vector<float> zcoord; |
| 40 |
vector<float> xycoord; |
| 41 |
|
| 42 |
|
| 43 |
void Add(int iis, int iip, float fq, float fz, float fxy); |
| 44 |
int GetN(){ return (int)(q.size()); }; |
| 45 |
|
| 46 |
void Reset(); |
| 47 |
void Delete(){ Reset(); }; |
| 48 |
|
| 49 |
~CaloEvent(){ Delete(); }; |
| 50 |
|
| 51 |
CaloEvent(){ Reset(); }; |
| 52 |
CaloEvent( CaloLevel1* calo, int view, Bool_t usemechanicalalignement){ Set(calo,view,usemechanicalalignement); }; |
| 53 |
CaloEvent( CaloLevel1* calo, int view){ Set(calo,view); }; |
| 54 |
|
| 55 |
void Set(CaloLevel1* calo, int view, Bool_t usemechanicalalignement); |
| 56 |
void Set(CaloLevel1* calo, int view){ Set(calo,view,0); }; |
| 57 |
|
| 58 |
ClassDef(CaloEvent,1); |
| 59 |
|
| 60 |
}; |
| 61 |
//=============================================================================== |
| 62 |
// |
| 63 |
// |
| 64 |
// |
| 65 |
// |
| 66 |
//=============================================================================== |
| 67 |
/** |
| 68 |
* \brief Class to fit an axis through a calorimeter event. |
| 69 |
* |
| 70 |
* The fit consists in an iterative procedure, where some hits are iterativelly |
| 71 |
* excluded according to a given tolerance. Two methods are implemented to get the axis: |
| 72 |
* CaloAxis::FitAxis(...) -- optimized for non-interacting particles |
| 73 |
* CaloAxis::FitShower(...) -- optimized for interacting particles |
| 74 |
* |
| 75 |
*/ |
| 76 |
class CaloAxis : public TObject { |
| 77 |
|
| 78 |
public: |
| 79 |
|
| 80 |
CaloEvent *cevent; |
| 81 |
|
| 82 |
// fitted points |
| 83 |
vector<float> x;///< independent coordinates (z) |
| 84 |
vector<float> y;///< dependente coordinate (x/y) |
| 85 |
vector<float> w;///< fit weight |
| 86 |
vector<float> q;///< signal |
| 87 |
|
| 88 |
Float_t par[2];///< axis parameters: y = par[0] + x*par[1] |
| 89 |
Float_t covpar[2][2];///< parameter covariance matrix |
| 90 |
|
| 91 |
TPolyMarker *sel; |
| 92 |
TLine *axis; |
| 93 |
|
| 94 |
float cog[22]; ///< baricenter (hits associated to the axis only) |
| 95 |
float qpl[22]; ///< total charge in each plane (hits associated to the axis only) |
| 96 |
|
| 97 |
void Init(); |
| 98 |
|
| 99 |
void Set(CaloLevel1* calo, Int_t view){ cevent->Set(calo,view,0); }; |
| 100 |
void Set(CaloLevel1* calo, Int_t view, Bool_t usemechanicalalignement){ cevent->Set(calo,view,usemechanicalalignement); }; |
| 101 |
|
| 102 |
CaloAxis(){ cevent = new CaloEvent(); Init(); }; |
| 103 |
CaloAxis(CaloLevel1* calo, Int_t view){ cevent = new CaloEvent(); Init(); Set(calo,view); }; |
| 104 |
CaloAxis(CaloLevel1* calo, Int_t view, Bool_t usemechanicalalignement){ cevent = new CaloEvent(); Init(); Set(calo,view,usemechanicalalignement); }; |
| 105 |
|
| 106 |
void Reset(); |
| 107 |
|
| 108 |
void Delete(){ Reset(); delete cevent; }; |
| 109 |
~CaloAxis(){ Delete(); }; |
| 110 |
|
| 111 |
void Add(float xin, float yin); |
| 112 |
void Add(float xin, float yin, float qin); |
| 113 |
void Add(float xin, float yin, float qin, float win); |
| 114 |
|
| 115 |
int Fit(); |
| 116 |
|
| 117 |
void Print(); |
| 118 |
|
| 119 |
float GetPar(Int_t i){return par[i];}; |
| 120 |
int GetN(){return (int)(x.size());}; |
| 121 |
float* GetX(); |
| 122 |
float* GetY(); |
| 123 |
float* GetQ(); |
| 124 |
float GetChi2(); |
| 125 |
float GetQaxis(); ///< signal along the axis |
| 126 |
float GetQaxis(float toll); ///< signal along the axis |
| 127 |
float GetCOG(Int_t ip){ if(ip>=0 && ip<22)return cog[ip]; else return 0;}; ///< COG vs plane |
| 128 |
float GetQ(Int_t ip) { if(ip>=0 && ip<22)return qpl[ip]; else return 0;}; ///< signal vs plane |
| 129 |
float GetQstrip(); ///< average signal per strip |
| 130 |
float GetYfit(float x){ return par[0]+x*par[1]; }; ///< extrapolated axis coordinate |
| 131 |
|
| 132 |
float GetXmin(); |
| 133 |
float GetXmax(); |
| 134 |
|
| 135 |
void Draw(int col); |
| 136 |
void Draw(){ Draw(5); }; |
| 137 |
|
| 138 |
int FitAxis( CaloLevel1* calo , Int_t view , Float_t toll , Bool_t usemechanicalalignement ); |
| 139 |
int FitAxis( CaloLevel1* calo , Int_t view , Float_t toll ){ return FitAxis(calo,view,toll,0); }; |
| 140 |
|
| 141 |
int FitShower( CaloLevel1* calo , Int_t view , Float_t toll , Bool_t usemechanicalalignement ); |
| 142 |
int FitShower( CaloLevel1* calo , Int_t view , Float_t toll ){ return FitShower(calo,view,toll,0); }; |
| 143 |
|
| 144 |
ClassDef(CaloAxis,1); |
| 145 |
|
| 146 |
|
| 147 |
}; |
| 148 |
|
| 149 |
|
| 150 |
//=============================================================================== |
| 151 |
// |
| 152 |
// |
| 153 |
// |
| 154 |
// |
| 155 |
//=============================================================================== |