Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcShower.h
Go to the documentation of this file.
1#ifndef ROOT_THcShower
2#define ROOT_THcShower
3
5// //
6// THcShower //
7// //
9
10#include "TClonesArray.h"
12#include "THcHitList.h"
13#include "THcShowerPlane.h"
14#include "THcShowerArray.h"
15#include "THcShowerHit.h"
16#include "TMath.h"
17
19
20public:
21 THcShower( const char* name, const char* description = "",
22 THaApparatus* a = NULL );
23 virtual ~THcShower();
24 virtual void Clear( Option_t* opt="" );
25 virtual Int_t Decode( const THaEvData& );
26 virtual EStatus Init( const TDatime& run_time );
29
31
32 Int_t GetNHits() const { return fNhits; }
33
34 Int_t GetNBlocks(Int_t NLayer) const { return fNBlocks[NLayer];}
35
36 Double_t GetXPos(Int_t NLayer, Int_t NRow) const {
37 return fXPos[NLayer][NRow];
38 }
39
40 Double_t GetYPos(Int_t NLayer, Int_t Side) const {
41
42 //Side = 0 for postive (right) side
43 //Side = 1 for negative (left) side
44
45 return fYPos[2*NLayer+(1-Side)];
46 }
47
48 Double_t GetZPos(Int_t NLayer) const {return fLayerZPos[NLayer];}
49
50 Double_t GetBlockThick(Int_t NLayer) {return BlockThick[NLayer];}
51
52 Int_t GetPedLimit(Int_t NBlock, Int_t NLayer, Int_t Side) {
53 if (Side!=0&&Side!=1) {
54 cout << "*** Wrong Side in GetPedLimit:" << Side << " ***" << endl;
55 return -1;
56 }
57 Int_t nelem = 0;
58 for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
59 nelem += NBlock;
60 return ( Side == 0 ? fShPosPedLimit[nelem] : fShNegPedLimit[nelem]);
61 }
62
63 Double_t GetGain(Int_t NBlock, Int_t NLayer, Int_t Side) {
64 if (Side!=0&&Side!=1) {
65 cout << "*** Wrong Side in GetGain:" << Side << " ***" << endl;
66 return -1;
67 }
68 Int_t nelem = 0;
69 for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
70 nelem += NBlock;
71 return ( Side == 0 ? fPosGain[nelem] : fNegGain[nelem]);
72 }
73
74 Double_t GetPedDefault(Int_t NBlock, Int_t NLayer, Int_t Side) {
75 if (Side!=0&&Side!=1) {
76 cout << "*** Wrong Side in GetPedDefault:" << Side << " ***" << endl;
77 return -1;
78 }
79 Int_t nelem = 0;
80 for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
81 nelem += NBlock;
82 return ( Side == 0 ? fPedPosDefault[nelem] : fPedNegDefault[nelem] );
83 }
84
85 Double_t GetWindowMin(Int_t NBlock, Int_t NLayer, Int_t Side) {
86 if (Side!=0&&Side!=1) {
87 cout << "*** Wrong Side in GetWindowMin:" << Side << " ***" << endl;
88 return -1;
89 }
90 Int_t nelem = 0;
91 for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
92 nelem += NBlock;
93 return ( Side == 0 ? fPosAdcTimeWindowMin[nelem] : fNegAdcTimeWindowMin[nelem] );
94 }
95
96 Double_t GetWindowMax(Int_t NBlock, Int_t NLayer, Int_t Side) {
97 if (Side!=0&&Side!=1) {
98 cout << "*** Wrong Side in GetWindowMax:" << Side << " ***" << endl;
99 return -1;
100 }
101 Int_t nelem = 0;
102 for (Int_t i=0; i<NLayer; i++) nelem += fNBlocks[i];
103 nelem += NBlock;
104 return ( Side == 0 ? fPosAdcTimeWindowMax[nelem] : fNegAdcTimeWindowMax[nelem] );
105 }
106
108 return fADCMode;
109 }
126 return fShMinPeds;
127 }
128
130 return fNLayers;
131 }
133 return fNBlocks[layer];
134 }
135
136 //Coordinate correction for HMS single PMT modules.
137 //PMT attached at right (positive) side.
138
140 return TMath::Exp(y/fAcor)/(1. + y*y/fBcor);
141 }
142
143 //Coordinate correction for HMS double PMT modules.
144 //
145
147 if (side!=0&&side!=1) {
148 cout << "THcShower::Ycor : wrong side " << side << endl;
149 return 0.;
150 }
151 Int_t sign = 1 - 2*side;
152 // return (fCcor + sign*y)/(fCcor + sign*y/fDcor);
153 return (fCcor[side] + sign*y)/(fCcor[side] + sign*y/fDcor[side]);
154 }
155
156 // Coordinate correction for SHMS Preshower modules.
157 //
158
160
161 if (side!=0&&side!=1) {
162 cout << "THcShower::YcorPr : wrong side " << side << endl;
163 return 0.;
164 }
165
166 Float_t cor;
167
168 // Check if the hit coordinate matches the fired block's side.
169
170 if ((y < 0. && side == 1) || (y > 0. && side == 0))
171 cor = 1./(1. + TMath::Power(TMath::Abs(y)/fAcor, fBcor));
172 else
173 cor = 1.;
174
175 return cor;
176 }
177
178 // Get part of energy deposited in the cluster matched to the given
179 // spectrometer Track, limited by a range of layers.
180
181 Float_t GetShEnergy(THaTrack*, UInt_t NLayers, UInt_t L0=0);
182
183 THcShower(); // for ROOT I/O
184
185protected:
186
189 Int_t fADCMode; // != 0 if using FADC
190 // 1 == Use the pulse int - pulse ped
191 // 2 == Use the sample integral - known ped
192 // 3 == Use the sample integral - sample ped
193 static const Int_t kADCStandard=0;
195 static const Int_t kADCSampleIntegral=2;
196 static const Int_t kADCSampIntDynPed=3;
204
205 Int_t fAnalyzePedestals; // Flag for pedestal analysis.
206
207 Int_t* fShPosPedLimit; // [fNTotBlocks] ADC limits for pedestal calc.-s.
209
210 Int_t fShMinPeds; // Min.number of events to analyze pedestals.
211
212 Double_t* fPosGain; // [fNTotBlocks] Gain constants from calibration
214
215 // Per-event data
216
217 Int_t fNhits; // Total number of hits
218 Int_t fNclust; // Number of clusters
219 Int_t fNclustTrack; // NUmber of cluster that match best track
220 Int_t fNclustArrayTrack; // NUmber of cluster that match best track
221 Int_t fSizeClustArray; // NUmber of blocks in cluster which matches the best track
222 Int_t fNblockHighEnergy; // NUmber of array block (1-224) that has the highest energy in cluster
223 Double_t fXclustTrack; // X pos of cluster that match best track
224 Double_t fXTrack; // X pos of best track that match cluster
225 Double_t fYclustTrack; // Y pos of cluster that match best track
226 Double_t fYTrack; // Y pos of best track that match cluster
227 Double_t fXclustArrayTrack; // X pos of cluster that match best track
228 Double_t fXTrackArray; // X pos of best track that match cluster
229 Double_t fYclustArrayTrack; // Y pos of cluster that match best track
230 Double_t fYTrackArray; // Y pos of best track that match cluster
231 Int_t fNtracks; // Number of shower tracks, i.e. number of
232 // cluster-to-track association
233 Double_t fEtot; // Total energy
234 Double_t fEtotNorm; // Total energy divided by spec central momentum
235 Double_t fEtrack; // Cluster energy associated to the best track
236 Double_t fEtrackNorm; // Cluster energy divided by momentum for the best track
237 Double_t fEPRtrack; // Preshower part of cluster energy of the best track
238 Double_t fEPRtrackNorm; // Preshower part of cluster energy divided by momentum for the best track
239 Double_t fETotTrackNorm; // Total energy divided by momentum of the best track
240
241 THcShowerClusterList* fClusterList; // List of hit clusters
242
243
244 // Geometrical parameters.
245
247 UInt_t fNLayers; // Number of layers in the calorimeter
248 UInt_t fNTotLayers; // Number of layers including array
249 UInt_t fHasArray; // If !=0 fly's eye array behind preshower
250 Double_t* fLayerZPos; // Z positions of fronts of layers
251 // Following apply to just sideways readout layers
252 Double_t* BlockThick; // Thickness of blocks
253 UInt_t* fNBlocks; // [fNLayers] number of blocks per layer
254 UInt_t fNTotBlocks; // Total number of shower counter blocks
255 Double_t** fXPos; // [fNLayers] X,Y,Z positions of blocks
258 UInt_t fNegCols; // # of columns with neg. side PMTs only.
259 Double_t fSlop; // Track to cluster vertical slop distance.
260 Int_t fvTest; // fiducial volume test flag for tracking
261 Double_t fvDelta; // Exclusion band width for fiducial volume
262
263 Double_t fvXmin; // Fiducial volume limits
267
268 Int_t fdbg_raw_cal; // Shower debug flags
273 Int_t fdbg_init_cal; // No counterpart in engine, added to debug
274 // calorimeter initialization
275
276 Double_t fAcor; // Coordinate correction constants
278 Double_t fCcor[2]; // for positive ad negative side PMTs
280
281 THcShowerPlane** fPlanes; // [fNLayers] Shower Plane objects
283
285 void DeleteArrays();
286 virtual Int_t ReadDatabase( const TDatime& date );
287 virtual Int_t DefineVariables( EMode mode = kDefine );
288
289 void Setup(const char* name, const char* description);
290
291 // Cluster to track association method.
293
294 void ClusterHits(THcShowerHitSet& HitSet, THcShowerClusterList* ClusterList);
295
296 virtual Int_t End(THaRunBase *r = 0);
297
298 friend class THcShowerPlane; //to access debug flags.
299 friend class THcShowerArray; //to access debug flags.
300
301 ClassDef(THcShower,0) // Shower counter detector
302};
303
305
306// Various helper functions to accumulate hit related quantities.
307
313
314// Methods to calculate coordinates and energy depositions for a given cluster.
315
321Double_t clEplane(THcShowerCluster* cluster, Int_t iplane, Int_t side);
322
323#endif
int Int_t
unsigned int UInt_t
bool Bool_t
float Float_t
double Double_t
const char Option_t
THcShowerHitSet THcShowerCluster
vector< THcShowerCluster * > THcShowerClusterList
set< THcShowerHit * > THcShowerHitSet
Double_t addZ(Double_t x, THcShowerHit *h)
Double_t addE(Double_t x, THcShowerHit *h)
Double_t addY(Double_t x, THcShowerHit *h)
Double_t clE(THcShowerCluster *cluster)
Double_t clEplane(THcShowerCluster *cluster, Int_t iplane, Int_t side)
Double_t clX(THcShowerCluster *cluster)
Double_t addX(Double_t x, THcShowerHit *h)
Double_t clEpr(THcShowerCluster *cluster)
Double_t clZ(THcShowerCluster *cluster)
Double_t addEpr(Double_t x, THcShowerHit *h)
Double_t clY(THcShowerCluster *cluster)
Builds a Hall C ENGx1INE style list of raw hits from raw data.
Definition THcHitList.h:27
ClassDef(THcHitList, 0)
Fly's eye array of shower blocks.
One plane of shower blocks with side readout.
Generic segmented shower detector.
Definition THcShower.h:18
Double_t fEPRtrackNorm
Definition THcShower.h:238
Double_t * GetPosAdcTimeWindowMax()
Definition THcShower.h:116
Double_t * fPosAdcTimeWindowMax
Definition THcShower.h:199
Int_t * fShPosPedLimit
Definition THcShower.h:207
Int_t fdbg_clusters_cal
Definition THcShower.h:271
Int_t fNtracks
Definition THcShower.h:231
Double_t * fYPos
Definition THcShower.h:256
Double_t fXclustTrack
Definition THcShower.h:223
static const Int_t kADCSampleIntegral
Definition THcShower.h:195
Double_t * fNegGain
Definition THcShower.h:213
Int_t MatchCluster(THaTrack *, Double_t &, Double_t &)
Double_t fvDelta
Definition THcShower.h:261
UInt_t fNTotBlocks
Definition THcShower.h:254
Double_t GetXPos(Int_t NLayer, Int_t NRow) const
Definition THcShower.h:36
Double_t * fZPos
Definition THcShower.h:257
Int_t GetPedLimit(Int_t NBlock, Int_t NLayer, Int_t Side)
Definition THcShower.h:52
char ** fLayerNames
Definition THcShower.h:246
Double_t fSlop
Definition THcShower.h:259
Int_t fShMinPeds
Definition THcShower.h:210
Float_t YcorPr(Double_t y, Int_t side)
Definition THcShower.h:159
virtual Int_t End(THaRunBase *r=0)
void Setup(const char *name, const char *description)
Definition THcShower.cxx:67
Double_t fvXmax
Definition THcShower.h:264
Int_t fNblockHighEnergy
Definition THcShower.h:222
virtual EStatus Init(const TDatime &run_time)
Double_t fYclustArrayTrack
Definition THcShower.h:229
virtual Int_t ReadDatabase(const TDatime &date)
Double_t * fNegAdcTimeWindowMin
Definition THcShower.h:198
UInt_t fHasArray
Definition THcShower.h:249
Double_t fXTrackArray
Definition THcShower.h:228
Float_t GetShEnergy(THaTrack *, UInt_t NLayers, UInt_t L0=0)
Double_t fEtrack
Definition THcShower.h:235
Double_t GetWindowMin(Int_t NBlock, Int_t NLayer, Int_t Side)
Definition THcShower.h:85
Double_t * BlockThick
Definition THcShower.h:252
Double_t GetZPos(Int_t NLayer) const
Definition THcShower.h:48
Double_t GetWindowMax(Int_t NBlock, Int_t NLayer, Int_t Side)
Definition THcShower.h:96
UInt_t fNTotLayers
Definition THcShower.h:248
void ClusterHits(THcShowerHitSet &HitSet, THcShowerClusterList *ClusterList)
Double_t GetAdcTdcOffset()
Definition THcShower.h:122
void DeleteArrays()
Int_t fADCMode
Definition THcShower.h:189
Int_t GetNBlocks(Int_t NLayer) const
Definition THcShower.h:34
Double_t fEtot
Definition THcShower.h:233
Double_t GetYPos(Int_t NLayer, Int_t Side) const
Definition THcShower.h:40
static const Int_t kADCSampIntDynPed
Definition THcShower.h:196
THcShowerPlane ** fPlanes
Definition THcShower.h:281
Float_t Ycor(Double_t y, Int_t side)
Definition THcShower.h:146
Double_t * fPosGain
Definition THcShower.h:212
Double_t fXTrack
Definition THcShower.h:224
Float_t Ycor(Double_t y)
Definition THcShower.h:139
void ClearEvent()
Int_t * fPedNegDefault
Definition THcShower.h:202
Double_t fvXmin
Definition THcShower.h:263
Double_t GetPedDefault(Int_t NBlock, Int_t NLayer, Int_t Side)
Definition THcShower.h:74
virtual Int_t FineProcess(TClonesArray &tracks)
THcShowerArray * fArray
Definition THcShower.h:282
THcShowerClusterList * fClusterList
Definition THcShower.h:241
static const Int_t kADCStandard
Definition THcShower.h:193
Double_t * fPosAdcTimeWindowMin
Definition THcShower.h:197
static const Int_t kADCDynamicPedestal
Definition THcShower.h:194
Double_t fDcor[2]
Definition THcShower.h:279
Double_t fYTrack
Definition THcShower.h:226
Int_t fdbg_raw_cal
Definition THcShower.h:268
Double_t fvYmin
Definition THcShower.h:265
virtual ~THcShower()
Int_t GetADCMode()
Definition THcShower.h:107
Int_t fNclust
Definition THcShower.h:218
Int_t * fPedPosDefault
Definition THcShower.h:201
Double_t GetGain(Int_t NBlock, Int_t NLayer, Int_t Side)
Definition THcShower.h:63
Double_t fXclustArrayTrack
Definition THcShower.h:227
Double_t * GetNegAdcTimeWindowMin()
Definition THcShower.h:113
Double_t ** fXPos
Definition THcShower.h:255
Double_t fBcor
Definition THcShower.h:277
Int_t GetNLayers()
Definition THcShower.h:129
Double_t fYclustTrack
Definition THcShower.h:225
Double_t * fLayerZPos
Definition THcShower.h:250
Int_t fNhits
Definition THcShower.h:217
Int_t GetMinPeds()
Definition THcShower.h:125
Int_t fdbg_tracks_cal
Definition THcShower.h:272
Double_t fAcor
Definition THcShower.h:276
Double_t fCcor[2]
Definition THcShower.h:278
Int_t fdbg_init_cal
Definition THcShower.h:273
Double_t fvYmax
Definition THcShower.h:266
UInt_t fNegCols
Definition THcShower.h:258
UInt_t * fNBlocks
Definition THcShower.h:253
Double_t * GetNegAdcTimeWindowMax()
Definition THcShower.h:119
Double_t fEtotNorm
Definition THcShower.h:234
Double_t GetBlockThick(Int_t NLayer)
Definition THcShower.h:50
Double_t fYTrackArray
Definition THcShower.h:230
Int_t GetNHits() const
Definition THcShower.h:32
Double_t fEtrackNorm
Definition THcShower.h:236
Int_t fvTest
Definition THcShower.h:260
Int_t fEvent
Definition THcShower.h:188
Double_t fEPRtrack
Definition THcShower.h:237
Double_t * fNegAdcTimeWindowMax
Definition THcShower.h:200
Int_t * fShNegPedLimit
Definition THcShower.h:208
Double_t GetNormETot()
virtual Int_t CoarseProcess(TClonesArray &tracks)
virtual void Clear(Option_t *opt="")
virtual Int_t Decode(const THaEvData &)
UInt_t fNLayers
Definition THcShower.h:247
Int_t GetNBlocks(Int_t layer)
Definition THcShower.h:132
Double_t fAdcTdcOffset
Definition THcShower.h:203
Int_t fAnalyzePedestals
Definition THcShower.h:205
Int_t fSizeClustArray
Definition THcShower.h:221
Int_t fNclustArrayTrack
Definition THcShower.h:220
Bool_t * fPresentP
Definition THcShower.h:187
Int_t fdbg_decoded_cal
Definition THcShower.h:269
Double_t fETotTrackNorm
Definition THcShower.h:239
Int_t fNclustTrack
Definition THcShower.h:219
virtual Int_t DefineVariables(EMode mode=kDefine)
Double_t * GetPosAdcTimeWindowMin()
Definition THcShower.h:110
Int_t fdbg_sparsified_cal
Definition THcShower.h:270
Double_t y[n]
Double_t Exp(Double_t x)
Double_t Power(Double_t x, Double_t y)
Double_t Abs(Double_t d)
TArc a
void tracks()