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