EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicEnergyMonitor.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicEnergyMonitor.h
1 //
2 // AYK (ayk@bnl.gov), 2015/08/06
3 //
4 // Energy monitor class;
5 //
6 
7 #include <set>
8 
9 #include <TObject.h>
10 #include <TString.h>
11 #include <TH1D.h>
12 
13 #ifndef _EIC_ENERGY_MONITOR_
14 #define _EIC_ENERGY_MONITOR_
15 
16 class EicEnergyMonitor: public TObject {
17  friend class EicDetector;
18 
19  public:
20  // FIXME: any initialization?;
22  // FIXME: parameter check?;
23  EicEnergyMonitor(const char *volumeName, Int_t PDG,
24  char *histogramName, double histogramMin,
25  double histogramMax, unsigned histogramBinNum):
26  mName(volumeName), mPDG(PDG),
28  mHistogramMin(histogramMin), mHistogramMax(histogramMax),
29  mHistogramBinNum(histogramBinNum) {
30  mHistogram = new TH1D(histogramName, histogramName, histogramBinNum, histogramMin, histogramMax);
31  };
33 
34  void PrimaryOnly() { mPrimaryOnly = true; };
35  void AtVolumeExit() { mAtEntrance = false; };
36 
37  private:
38  // Well, do not want to create a name pattern hub since in this case will have to handle
39  // double counting of the same particle in potentially different volumes; keep things easy;
40  TString mName;
41 
42  // Deal with specific particle type only; FIXME: make any type possible?;
43  Int_t mPDG;
44  // Record particle energy upon either entrance or exit;
47 
48  // Histogram parameters;
49  TString mHistogramName;
50  double mHistogramMin;
51  double mHistogramMax;
52  unsigned mHistogramBinNum;
53 
54  TH1D *mHistogram;
55 
56  // Protection against double entries on the same track; say primary particle exits
57  // TPC gas volume, hits outer field cage loosing most of its energy, starts curling
58  // in magnetic field and pretends to be registered in the histogram several times;
59  // prohibit this: register only once per ID;
60  std::set<unsigned> mRegisteredTracks;
61 
62  ClassDef(EicEnergyMonitor,3)
63 };
64 
65 #endif