Neutral Particle Spectrometer analysis code
Loading...
Searching...
No Matches
THcNPSCalorimeter.h
Go to the documentation of this file.
1#ifndef ROOT_THcNPSCalorimeter
2#define ROOT_THcNPSCalorimeter
3
5// //
6// THcNPSCalorimeter //
7// //
9//#include <tuple>
10#include "TClonesArray.h"
12#include "THcHitList.h"
13#include "THcNPSArray.h"
14#include "THcNPSShowerHit.h"
15#include "THcNPSAnalyzer.h"
16#include "THcNPSCluster.h"
17#include "TMath.h"
18
20
21public:
22 THcNPSCalorimeter( const char* name, const char* description = "",
23 THaApparatus* a = NULL );
24 virtual ~THcNPSCalorimeter();
25 virtual void Clear( Option_t* opt="" );
26 virtual Int_t Decode( const THaEvData& );
27 virtual EStatus Init( const TDatime& run_time );
30
32
33 Int_t GetNHits() const { return fNhits; }
34
36 return fADCMode;
37 }
42 return fShMinPeds;
43 }
44
45 Int_t GetNClusters() { return fClusters.size(); }
46 vector<THcNPSCluster> GetClusters() { return fClusters; }
47
48 /* ---- C.Y. I thing these A,B,C,D, layer correction is ONLY for HMS and pre-shower but NOT for NPS
49 //Coordinate correction for HMS single PMT modules.
50 //PMT attached at right (positive) side.
51
52 Float_t Ycor(Double_t y) {
53 return TMath::Exp(y/fAcor)/(1. + y*y/fBcor);
54 }
55
56 //Coordinate correction for HMS double PMT modules.
57 //
58
59 Float_t Ycor(Double_t y, Int_t side) {
60 if (side!=0&&side!=1) {
61 cout << "THcNPSCalorimeter::Ycor : wrong side " << side << endl;
62 return 0.;
63 }
64 Int_t sign = 1 - 2*side;
65 // return (fCcor + sign*y)/(fCcor + sign*y/fDcor);
66 return (fCcor[side] + sign*y)/(fCcor[side] + sign*y/fDcor[side]);
67 }
68
69 // Coordinate correction for SHMS Preshower modules.
70 //
71
72 Float_t YcorPr(Double_t y, Int_t side) {
73
74 if (side!=0&&side!=1) {
75 cout << "THcNPSCalorimeter::YcorPr : wrong side " << side << endl;
76 return 0.;
77 }
78
79 Float_t cor;
80
81 // Check if the hit coordinate matches the fired block's side.
82
83 if ((y < 0. && side == 1) || (y > 0. && side == 0))
84 cor = 1./(1. + TMath::Power(TMath::Abs(y)/fAcor, fBcor));
85 else
86 cor = 1.;
87
88 return cor;
89 }
90 -------------------------------*/
91
92 // Get part of energy deposited in the cluster matched to the given
93 // spectrometer Track, limited by a range of layers.
94
95 // Float_t GetShEnergy(THaTrack*, UInt_t NLayers, UInt_t L0=0);
96
97 THcNPSCalorimeter(); // for ROOT I/O
98
99protected:
100
101 // Cluster array
102 std::vector<THcNPSCluster> fClusters;
103
104 // M. Mathison Sep. 11, 2023: Added cluster variables for root output
105
106 std::vector<Double_t> fClusterX;
107 std::vector<Double_t> fClusterY;
108 std::vector<Double_t> fClusterZ;
109 std::vector<Double_t> fClusterT;
110 std::vector<Double_t> fClusterE;
111
112 // DJH: VTP stuff
113 static const Int_t fnVTP = 5;
115 std::vector<UInt_t> fVTPTriggerTime;
116 std::vector<Int_t> fVTPTriggerCrate;
117 std::vector<UInt_t> fVTPTriggerType0;
118 std::vector<UInt_t> fVTPTriggerType1;
119 std::vector<UInt_t> fVTPTriggerType2;
120 std::vector<UInt_t> fVTPTriggerType3;
121 std::vector<UInt_t> fVTPTriggerType4;
122 std::vector<UInt_t> fVTPTriggerType5;
123
124 std::vector<UInt_t> fVTPClusterEnergy;
125 std::vector<UInt_t> fVTPClusterTime;
126 std::vector<UInt_t> fVTPClusterSize;
127 std::vector<UInt_t> fVTPClusterX;
128 std::vector<UInt_t> fVTPClusterY;
129
130 // DJH: VLD stuff
131 static const Int_t fnVLD = 10;
133
134 std::vector<UInt_t> fVLDLoChannelMask;
135 std::vector<UInt_t> fVLDHiChannelMask;
136 std::vector<UInt_t> fVLDColumn;
137 std::vector<UInt_t> fVLDRow;
138 std::vector<UInt_t> fVLDPMT;
139
140 //C.Y. Feb 22, 2021 : Added output filestream for the purpose of
141 //writing to file (and plotting a 2D grid of) the blocks
142 //that participate on cluster formation
143 ofstream *fOutFile;
144 Int_t fMakeGrid; //If true (1), the write fOutFile to make 2D Grid
145
146 //calorimeter geometry (to determine total number of elements)
149
152 Int_t fADCMode; // != 0 if using FADC
153 // 1 == Use the pulse int - pulse ped
154 // 2 == Use the sample integral - known ped
155 // 3 == Use the sample integral - sample ped
156 static const Int_t kADCStandard=0;
158 static const Int_t kADCSampleIntegral=2;
159 static const Int_t kADCSampIntDynPed=3;
162
163 Int_t fAnalyzePedestals; // Flag for pedestal analysis.
164
165 Int_t fShMinPeds; // Min.number of events to analyze pedestals.
166
167 // Per-event data
168
169 Int_t fNhits; // Total number of hits
170 Int_t fNclust; // Number of clusters
171 Int_t fNblockHighEnergy; // NUmber of array block (1-224) that has the highest energy in cluster
172 Double_t fEtot; // Total energy
173 Double_t fEtotNorm; // Total energy divided by spec central momentum
174 Double_t fEtrack; // Cluster energy associated to the best track
175 Double_t fEtrackNorm; // Cluster energy divided by momentum for the best track
176 Double_t fEPRtrack; // Preshower part of cluster energy of the best track
177 Double_t fEPRtrackNorm; // Preshower part of cluster energy divided by momentum for the best track
178 Double_t fETotTrackNorm; // Total energy divided by momentum of the best track
179
180 THcNPSShowerClusterList* fClusterList; // List of hit clusters
181
182 // For making fake NPS data
183 Int_t quadrant; //variable to store [0-9] corresponding to different quadrants on NPS
184 Int_t fCalReplicate; // 1: translate data to a random quadrant
185 // 2: reflect data to a random quadrant
187
189
190 // Geometrical parameters.
191
193 UInt_t fNTotLayers; // Number of layers including array
194 UInt_t fHasArray; // If !=0 fly's eye array behind preshower
195 UInt_t fNegCols; // # of columns with neg. side PMTs only.
196 Double_t fSlop; // Track to cluster vertical slop distance.
197 Int_t fvTest; // fiducial volume test flag for tracking
198 Double_t fvDelta; // Exclusion band width for fiducial volume
199
200 Double_t fvXmin; // Fiducial volume limits
204
205 Int_t fdbg_raw_cal; // Shower debug flags
210 Int_t fdbg_init_cal; // No counterpart in engine, added to debug
211 // calorimeter initialization
212
213 /* --C.Y. I think this can be removed (need to ask S. Wood)
214 Double_t fAcor; // Coordinate correction constants
215 Double_t fBcor;
216 Double_t fCcor[2]; // for positive ad negative side PMTs
217 Double_t fDcor[2];
218 */
219
221
223 void DeleteArrays();
224 virtual Int_t ReadDatabase( const TDatime& date );
225 virtual Int_t DefineVariables( EMode mode = kDefine );
226
227 void Setup(const char* name, const char* description);
228
229 std::string fKwPrefix;
230
231 // Cluster to track association method.
232 // Int_t MatchCluster(THaTrack*, Double_t&, Double_t&);
233
234 void ClusterHits(THcNPSShowerHitSet& HitSet, THcNPSShowerClusterList* ClusterList);
235
236 //C.Y. Feb 09, 2021 : create method for NPS clustering using cellular automata
238
239 virtual Int_t End(THaRunBase *r = 0);
240
241 // friend class THcShowerPlane; //to access debug flags.
242 friend class THcNPSArray; //to access debug flags.
243
244 ClassDef(THcNPSCalorimeter,0) // Shower counter detector
245};
246
248
249// Various helper functions to accumulate hit related quantities.
250
257
258// Methods to calculate coordinates and energy depositions for a given cluster.
259
266//Double_t clEplane(THcNPSShowerCluster* cluster, Int_t iplane, Int_t side);
267
268#endif
int Int_t
unsigned int UInt_t
bool Bool_t
double Double_t
const char Option_t
Double_t addX(Double_t x, THcNPSShowerHit *h)
Double_t clT(THcNPSShowerCluster *cluster)
Double_t clX(THcNPSShowerCluster *cluster)
Double_t addE(Double_t x, THcNPSShowerHit *h)
Double_t addT(Double_t x, THcNPSShowerHit *h)
Double_t clE(THcNPSShowerCluster *cluster)
Double_t addEpr(Double_t x, THcNPSShowerHit *h)
Double_t clY(THcNPSShowerCluster *cluster)
Double_t addZ(Double_t x, THcNPSShowerHit *h)
Double_t clZ(THcNPSShowerCluster *cluster)
Double_t clEpr(THcNPSShowerCluster *cluster)
Double_t addY(Double_t x, THcNPSShowerHit *h)
vector< THcNPSShowerCluster * > THcNPSShowerClusterList
THcNPSShowerHitSet THcNPSShowerCluster
set< THcNPSShowerHit * > THcNPSShowerHitSet
ClassDef(THcHitList, 0)
Fly's eye array of shower blocks.
Definition THcNPSArray.h:33
Generic segmented shower detector.
std::vector< Double_t > fClusterZ
THcNPSShowerClusterList * fClusterList
std::vector< UInt_t > fVLDColumn
static const Int_t kADCDynamicPedestal
virtual Int_t End(THaRunBase *r=0)
void ClusterHits(THcNPSShowerHitSet &HitSet, THcNPSShowerClusterList *ClusterList)
std::vector< THcNPSCluster > fClusters
virtual void Clear(Option_t *opt="")
std::vector< UInt_t > fVTPClusterY
std::vector< UInt_t > fVTPTriggerType2
std::vector< UInt_t > fVLDRow
std::vector< UInt_t > fVTPClusterEnergy
virtual EStatus Init(const TDatime &run_time)
void Setup(const char *name, const char *description)
std::vector< UInt_t > fVTPClusterTime
static const Int_t fnVLD
std::vector< UInt_t > fVTPTriggerType4
std::vector< UInt_t > fVTPClusterSize
static const Int_t kADCSampIntDynPed
static const Int_t kADCSampleIntegral
std::vector< UInt_t > fVTPTriggerType3
std::vector< Int_t > fVTPTriggerCrate
std::vector< Double_t > fClusterE
std::vector< UInt_t > fVTPTriggerType1
std::vector< UInt_t > fVLDPMT
std::vector< UInt_t > fVTPClusterX
virtual Int_t DefineVariables(EMode mode=kDefine)
vector< THcNPSCluster > GetClusters()
static const Int_t kADCStandard
THcNPSAnalyzer * fAnalyzer
virtual Int_t Decode(const THaEvData &)
std::vector< Double_t > fClusterY
std::vector< UInt_t > fVTPTriggerType0
std::vector< UInt_t > fVLDHiChannelMask
static const Int_t fnVTP
std::vector< Double_t > fClusterT
std::vector< Double_t > fClusterX
std::vector< UInt_t > fVLDLoChannelMask
virtual Int_t CoarseProcess(TClonesArray &tracks)
virtual Int_t FineProcess(TClonesArray &tracks)
std::vector< UInt_t > fVTPTriggerType5
std::vector< UInt_t > fVTPTriggerTime
Int_t GetNHits() const
virtual Int_t ReadDatabase(const TDatime &date)
void ClusterNPS_Hits(THcNPSShowerHitSet &HitSet, THcNPSShowerClusterList *ClusterList)
TArc a
void tracks()