AlcapDAQ  1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
SiR2Target Class Reference

#include <SiR2Target.h>

Inheritance diagram for SiR2Target:
FillHistBase

Public Member Functions

 SiR2Target (char *HistogramDirectoryName)
 
 ~SiR2Target ()
 
virtual int ProcessEntry (TGlobalData *gData, TSetupData *gSetup)
 
int ProcessGenericEntry (TGlobalData *gData, TSetupData *gSetup)
 
virtual int BeforeFirstEntry (TGlobalData *gData, TSetupData *setup)
 
virtual int AfterLastEntry (TGlobalData *gData, TSetupData *setup)
 
const char * GetName () const
 

Protected Member Functions

bool Debug () const
 

Protected Attributes

TDirectory * dir
 
TSetupDatafSetup
 

Private Attributes

TH1I * fhSpectrum
 
double ftCoincidence
 

Detailed Description

Definition at line 12 of file SiR2Target.h.

Constructor & Destructor Documentation

SiR2Target::SiR2Target ( char *  HistogramDirectoryName)

Definition at line 17 of file SiR2Target.cpp.

References fhSpectrum, and ftCoincidence.

17  :
18  FillHistBase(HistogramDirectoryName) {
19 
20  ftCoincidence = 2000.;
21  fhSpectrum = new TH1I("hSiR2Spectrum","Spectrum of Silicon Target", 26000, 0., 26000.);
22 
23  gDirectory->cd("/");
24 }
SiR2Target::~SiR2Target ( )

Definition at line 26 of file SiR2Target.cpp.

26  {
27 }

Member Function Documentation

virtual int FillHistBase::AfterLastEntry ( TGlobalData gData,
TSetupData setup 
)
inlinevirtualinherited

Reimplemented in TestModule.

Definition at line 39 of file FillHistBase.h.

39 {return 0;};
virtual int FillHistBase::BeforeFirstEntry ( TGlobalData gData,
TSetupData setup 
)
inlinevirtualinherited

Reimplemented in ExportPulse, MakeAnalysedPulses, MakeDetectorPulses, MakeMuonEvents, and TestModule.

Definition at line 38 of file FillHistBase.h.

38 {return 0;};
bool FillHistBase::Debug ( ) const
inlineprotectedinherited
const char* FillHistBase::GetName ( ) const
inlineinherited

Definition at line 40 of file FillHistBase.h.

References FillHistBase::dir.

Referenced by DeadTimeGe::ProcessEntry(), PlotAmplitude::ProcessEntry(), and PlotTime::ProcessEntry().

40 {return dir->GetName();};
int SiR2Target::ProcessEntry ( TGlobalData gData,
TSetupData gSetup 
)
virtual

Reimplemented from FillHistBase.

Definition at line 29 of file SiR2Target.cpp.

References fhSpectrum, and ftCoincidence.

29  {
30 
31  std::vector<TAnalysedPulse*>* pulses_musc = NULL;
32  std::vector<TAnalysedPulse*>* pulses_targ = NULL;
33  std::vector<TAnalysedPulse*>* pulses_thick = NULL;
34  std::vector<TAnalysedPulse*>* pulses_thin1 = NULL;
35  std::vector<TAnalysedPulse*>* pulses_thin2 = NULL;
36  std::vector<TAnalysedPulse*>* pulses_thin3 = NULL;
37  std::vector<TAnalysedPulse*>* pulses_thin4 = NULL;
38 
39  // Find the pulses if they exist
40  if (gAnalysedPulseMap.count("muSc") == 0) {
41  std::cout << "INFO: No beam counter hits" << std::endl;
42  return 0;
43  } else if (gAnalysedPulseMap.count("SiR2-S") == 0) {
44  std::cout << "INFO: No target hits" << std::endl;
45  return 0;
46  } else if (gAnalysedPulseMap.count("SiL2-S") == 0) {
47  std::cout << "INFO: No thick external hits" << std::endl;
48  return 0;
49  }
50  pulses_musc = &gAnalysedPulseMap.at("muSc");
51  pulses_targ = &gAnalysedPulseMap.at("SiR2-S");
52  pulses_thick = &gAnalysedPulseMap.at("SiL2-S");
53 
54  if (gAnalysedPulseMap.count("SiL1-1-S"))
55  pulses_thin1 = &gAnalysedPulseMap.at("SiL1-1-S");
56  if (gAnalysedPulseMap.count("SiL1-2-S"))
57  pulses_thin2 = &gAnalysedPulseMap.at("SiL1-2-S");
58  if (gAnalysedPulseMap.count("SiL1-3-S"))
59  pulses_thin3 = &gAnalysedPulseMap.at("SiL1-3-S");
60  if (gAnalysedPulseMap.count("SiL1-4-S"))
61  pulses_thin4 = &gAnalysedPulseMap.at("SiL1-4-S");
62  if(!(pulses_thin1 || pulses_thin2 || pulses_thin3 || pulses_thin4)) {
63  std::cout << "INFO: No thin external hits" << std::endl;
64  return 0;
65  }
66 
67  std::vector<TAnalysedPulse*>::iterator iMusc;
68  std::vector<TAnalysedPulse*>::iterator iTarg;
69  std::vector<TAnalysedPulse*>::iterator iThick;
70  std::vector<TAnalysedPulse*>::iterator iThin1;
71  std::vector<TAnalysedPulse*>::iterator iThin2;
72  std::vector<TAnalysedPulse*>::iterator iThin3;
73  std::vector<TAnalysedPulse*>::iterator iThin4;
74 
75  iMusc = pulses_musc->begin();
76  iTarg = pulses_targ->begin();
77  iThick = pulses_thick->begin();
78  if (pulses_thin1)
79  iThin1 = pulses_thin1->begin();
80  if (pulses_thin2)
81  iThin2 = pulses_thin2->begin();
82  if (pulses_thin3)
83  iThin3 = pulses_thin3->begin();
84  if (pulses_thin4)
85  iThin4 = pulses_thin4->begin();
86 
87  double e, t;
88  for (; iMusc != pulses_musc->end(); ++iMusc) {
89  e = 0.;
90  t = (*iMusc)->GetTime();
91  // Advance target and external detectors to time window, and
92  // then check that we haven't run out of pulses.
93  for (; iTarg != pulses_targ->end(); ++iTarg)
94  if ((*iTarg)->GetTime() - t >= -ftCoincidence)
95  break;
96  for (; iThick != pulses_thick->end(); ++iThick)
97  if ((*iThick)->GetTime() - t >= -ftCoincidence)
98  break;
99  if (pulses_thin1)
100  for (; iThin1 != pulses_thin1->end(); ++iThin1)
101  if ((*iThin1)->GetTime() - t >= -ftCoincidence)
102  break;
103  if (pulses_thin2)
104  for (; iThin2 != pulses_thin2->end(); ++iThin2)
105  if ((*iThin2)->GetTime() - t >= -ftCoincidence)
106  break;
107  if (pulses_thin3)
108  for (; iThin3 != pulses_thin3->end(); ++iThin3)
109  if ((*iThin3)->GetTime() - t >= -ftCoincidence)
110  break;
111  if (pulses_thin4)
112  for (; iThin4 != pulses_thin4->end(); ++iThin4)
113  if ((*iThin4)->GetTime() - t >= -ftCoincidence)
114  break;
115  // Check we didn't run out of pulses
116  if (iTarg == pulses_targ->end()) {
117  break;
118  } else if ((*iTarg)->GetTime() - t < ftCoincidence) {
119  e = (*iTarg)->GetEnergy();
120  ++iTarg;
121  } else {
122  continue;
123  }
124  if (iThick == pulses_thick->end()) {
125  break;
126  } else if ((*iThick)->GetTime() - t < ftCoincidence) {
127  e += (*iThick)->GetEnergy();
128  ++iThick;
129  } else {
130  continue;
131  }
132  bool pulse_found = false;
133  bool out_of_pulses = true;
134  if (pulses_thin1) {
135  if (iThin1 != pulses_thin1->end()) {
136  out_of_pulses = false;
137  if ((*iThin1)->GetTime() - t < ftCoincidence) {
138  e += (*iThin1)->GetEnergy();
139  ++iThin1;
140  pulse_found = true;
141  }
142  }
143  }
144  if (pulses_thin2) {
145  if (iThin2 != pulses_thin2->end()) {
146  out_of_pulses = false;
147  if ((*iThin2)->GetTime() - t < ftCoincidence) {
148  e += (*iThin2)->GetEnergy();
149  ++iThin2;
150  pulse_found = true;
151  }
152  }
153  }
154  if (pulses_thin3) {
155  if (iThin3 != pulses_thin3->end()) {
156  out_of_pulses = false;
157  if ((*iThin3)->GetTime() - t < ftCoincidence) {
158  e += (*iThin3)->GetEnergy();
159  ++iThin3;
160  pulse_found = true;
161  }
162  }
163  }
164  if (pulses_thin4) {
165  if (iThin4 != pulses_thin4->end()) {
166  out_of_pulses = false;
167  if ((*iThin4)->GetTime() - t < ftCoincidence) {
168  e += (*iThin4)->GetEnergy();
169  ++iThin4;
170  pulse_found = true;
171  }
172  }
173  }
174  if (out_of_pulses)
175  break;
176  else if (!pulse_found)
177  continue;
178  // Fill the energy
179  fhSpectrum->Fill(e);
180  }
181  return 0;
182 }
int FillHistBase::ProcessGenericEntry ( TGlobalData gData,
TSetupData gSetup 
)
inherited

Definition at line 24 of file FillHistBase.cpp.

References FillHistBase::dir, and FillHistBase::ProcessEntry().

24  {
25  // This is called by our main routine and would allow later to split into different
26  // process routines if we have more than one Tree and hence different tpyes of data input.
27 
28  if(dir) dir->cd();
29  int ret = ProcessEntry(gData, gSetup);
30  gDirectory->cd("/");
31 
32  return ret;
33 }

Field Documentation

TDirectory* FillHistBase::dir
protectedinherited
TH1I* SiR2Target::fhSpectrum
private

Definition at line 18 of file SiR2Target.h.

Referenced by ProcessEntry(), and SiR2Target().

TSetupData* FillHistBase::fSetup
protectedinherited

Definition at line 44 of file FillHistBase.h.

double SiR2Target::ftCoincidence
private

Definition at line 19 of file SiR2Target.h.

Referenced by ProcessEntry(), and SiR2Target().


The documentation for this class was generated from the following files: