12 #include <JANA/JApplication.h>
21 #include <TDirectory.h>
105 TDirectory *
mainDir = gDirectory;
106 TDirectory *psDir = gDirectory->mkdir(
"PS");
110 ps_num_events =
new TH1I(
"ps_num_events",
"PS Number of events",1,0.5,1.5);
112 TDirectory *hitDir = gDirectory->mkdir(
"Hit"); hitDir->cd();
116 TString arm_str[] = {
"Left",
"Right"};
117 for (
int i = 0; i <
Narms; i++) {
118 gDirectory->mkdir(arm_str[i]+
"Arm")->cd();
119 TString strN =
"_" + arm_str[i] +
"Arm";
120 TString strT =
", " + arm_str[i] +
" arm";
121 hHit_Occupancy[i] =
new TH1I(
"Hit_Occupancy"+strN,
"PS occupancy"+strT+
";column (tile);hits / column",
Ncols,0.5,0.5+
Ncols);
122 hHit_Energy[i] =
new TH1I(
"Hit_Energy"+strN,
"PS energy"+strT+
";energy [GeV];hits / column",120,0.5,6.5);
123 hHit_EnergyVsColumn[i] =
new TH2I(
"Hit_EnergyVsColumn"+strN,
"PS energy vs. column"+strT+
";column (tile);energy [GeV]",
Ncols,0.5,0.5+
Ncols,120,0.5,6.5);
124 hHit_Integral[i] =
new TH1I(
"Hit_Integral"+strN,
"PS fADC pulse integral"+strT+
";pulse integral;hits",1000,0.0,30000.0);
125 hHit_IntegralVsColumn[i] =
new TH2I(
"Hit_IntegralVsColumn"+strN,
"PS fADC pulse integral vs. column"+strT+
";column (tile);pulse integral",
Ncols,0.5,0.5+
Ncols,1000,0.0,30000.0);
127 hHit_Time[i] =
new TH1I(
"Hit_Time"+strN,
"PS fADC time"+strT+
";time [ns];hits / 400 ps",1000,-200.0,200.0);
128 hHit_TimeVsColumn[i] =
new TH2I(
"Hit_TimeVsColumn"+strN,
"PS fADC time vs. column"+strT+
";column (tile);time [ns]",
Ncols,0.5,0.5+
Ncols,1000,-200.0,200.0);
133 TDirectory *digihitDir = gDirectory->mkdir(
"DigiHit"); digihitDir->cd();
135 hDigiHit_Arm =
new TH1I(
"DigiHit_Arm",
"PS arm;arm;raw hits",Narms,-0.5,-0.5+Narms);
138 hDigiHit_Arm_cut =
new TH1I(
"DigiHit_Arm_cut",
"PS arm (> 500 ADC integral counts);arm;raw hits",Narms,-0.5,-0.5+Narms);
140 for (
int i = 0; i <
Narms; i++) {
141 gDirectory->mkdir(arm_str[i]+
"Arm")->cd();
142 TString strN =
"_" + arm_str[i] +
"Arm";
143 TString strT =
", " + arm_str[i] +
" arm";
144 hDigiHit_NSamplesPedestal[i] =
new TH1I(
"DigiHit_NSamplesPedestal"+strN,
"PS fADC pedestal samples"+strT+
";pedestal samples;raw hits",50,-0.5,49.5);
145 hDigiHit_Pedestal[i] =
new TH1I(
"DigiHit_Pedestal"+strN,
"PS fADC pedestals"+strT+
";pedestal [fADC counts];raw hits",200,0.0,200.0);
146 hDigiHit_PedestalVsColumn[i] =
new TProfile(
"DigiHit_PedestalVsColumn"+strN,
"PS pedestal vs. column"+strT+
";column (tile);average pedestal [fADC counts]",
Ncols,0.5,0.5+
Ncols,
"s");
147 hDigiHit_QualityFactor[i] =
new TH1I(
"DigiHit_QualityFactor"+strN,
"PS fADC quality factor"+strT+
";quality factor;raw hits",4,-0.5,3.5);
148 hDigiHit_Occupancy[i] =
new TH1I(
"DigiHit_Occupancy"+strN,
"PS fADC hit occupancy"+strT+
";column (tile);raw hits / column",
Ncols,0.5,0.5+
Ncols);
149 hDigiHit_RawPeak[i] =
new TH1I(
"DigiHit_RawPeak"+strN,
"PS fADC pulse peak (raw)"+strT+
";pulse peak (raw);raw hits",410,0.0,4100.0);
150 hDigiHit_RawPeakVsColumn[i] =
new TH2I(
"DigiHit_RawPeakVsColumn"+strN,
"PS fADC pulse peak (raw) vs. column"+strT+
";column (tile);pulse peak (raw)",
Ncols,0.5,0.5+
Ncols,410,0.0,4100.0);
151 hDigiHit_RawIntegral[i] =
new TH1I(
"DigiHit_RawIntegral"+strN,
"PS fADC pulse integral (raw)"+strT+
";pulse integral (raw);raw hits",1000,0.0,30000.0);
152 hDigiHit_RawIntegralVsColumn[i] =
new TH2I(
"DigiHit_RawIntegralVsColumn"+strN,
"PS fADC pulse integral (raw) vs. column"+strT+
";column (tile);pulse integral (raw)",
Ncols,0.5,0.5+
Ncols,1000,0.0,30000.0);
153 hDigiHit_NSamplesIntegral[i] =
new TH1I(
"DigiHit_NSamplesIntegral"+strN,
"PS fADC integral samples"+strT+
";integral samples;raw hits",60,-0.5,59.5);
154 hDigiHit_PeakVsColumn[i] =
new TH2I(
"DigiHit_PeakVsColumn"+strN,
"PS fADC pulse peak vs. column"+strT+
";column (tile);pulse peak",
Ncols,0.5,0.5+
Ncols,410,0.0,4100.0);
155 hDigiHit_IntegralVsPeak[i] =
new TH2I(
"DigiHit_IntegralVsPeak"+strN,
"PS fADC pulse integral vs. peak"+strT+
";pulse peak;pulse integral",410,0.0,4100.0,1000,0.0,30000.0);
156 hDigiHit_IntegralVsColumn[i] =
new TH2I(
"DigiHit_IntegralVsColumn"+strN,
"PS fADC pulse integral vs. column"+strT+
";column (tile);pulse integral",
Ncols,0.5,0.5+
Ncols,1000,0.0,30000.0);
157 hDigiHit_PulseTime[i] =
new TH1I(
"DigiHit_PulseTime"+strN,
"PS fADC pulse time"+strT+
";pulse time [62.5 ps];raw hits",2000,0.0,6500.0);
158 hDigiHit_Time[i] =
new TH1I(
"DigiHit_Time"+strN,
"PS fADC pulse time"+strT+
";pulse time [ns];raw hits / 400 ps",1000,0.0,400.0);
159 hDigiHit_TimeVsColumn[i] =
new TH2I(
"DigiHit_TimeVsColumn"+strN,
"PS fADC pulse time vs. column"+strT+
";column (tile);pulse time [ns]",
Ncols,0.5,0.5+
Ncols,1000,0.0,400.0);
160 hDigiHit_TimeVsIntegral[i] =
new TH2I(
"DigiHit_TimeVsIntegral"+strN,
"PS fADC pulse time vs. integral"+strT+
";pulse integral;pulse time [ns]",1000,0.0,30000.0,1000,0.0,400.0);
162 hDigiHit_Occupancy_cut[i] =
new TH1I(
"DigiHit_Occupancy_cut"+strN,
"PS fADC hit occupancy (> 500 ADC integral counts)"+strT+
";column (tile);raw hits / column",
Ncols,0.5,0.5+
Ncols);
163 hDigiHit_Time_cut[i] =
new TH1I(
"DigiHit_Time_cut"+strN,
"PS fADC pulse time (> 500 ADC integral counts)"+strT+
";pulse time [ns];raw hits / 400 ps",1000,0.0,400.0);
164 hDigiHit_TimeVsColumn_cut[i] =
new TH2I(
"DigiHit_TimeVsColumn_cut"+strN,
"PS fADC pulse time vs. column (> 500 ADC integral counts)"+strT+
";column (tile);pulse time [ns]",
Ncols,0.5,0.5+
Ncols,1000,0.0,400.0);
165 hDigiHit_TimeVsQF_cut[i] =
new TH2I(
"DigiHit_TimeVsQF_cut"+strN,
"PS fADC pulse time vs. quality factor (> 500 ADC integral counts)"+strT+
";fADC quality factor;pulse time [ns]",4,-0.5,3.5,1000,0.0,400.0);
182 vector<const DPSGeometry*> psGeomVect;
183 eventLoop->Get(psGeomVect);
184 if (psGeomVect.size() == 0)
return OBJECT_NOT_AVAILABLE;
189 double cols[
Ncols+1];
190 for (
int i = 0; i <
Ncols; i++) {
191 Elows[0][i] = psGeom.
getElow(0,i+1);
192 Elows[1][i] = psGeom.
getElow(1,i+1);
201 japp->RootFillLock(
this);
204 for (
int i = 0; i <
Narms; i++) {
209 japp->RootFillUnLock(
this);
226 vector<const DPSDigiHit*> digihits;
227 eventLoop->Get(digihits);
228 vector<const DPSHit*> hits;
229 eventLoop->Get(hits);
233 japp->RootFillLock(
this);
238 int NDigiHits[] = {0,0};
239 int NDigiHits_cut[] = {0,0};
241 for (
const auto& hit : digihits) {
243 double ped = (double)hit->pedestal/hit->nsamples_pedestal;
247 if (ped == 0.0 || hit->pulse_peak == 0)
continue;
257 double pI = hit->pulse_integral-hit->nsamples_integral*ped;
261 double t_ns = 0.0625*hit->pulse_time;
267 NDigiHits_cut[arm]++;
282 for (
const auto& hit : hits) {
297 japp->RootFillUnLock(
this);
static TH1I * ps_num_events
static TH1I * hDigiHit_NHits_cut
static TH2I * hDigiHit_RawPeakVsColumn[Narms]
static TH1I * hDigiHit_Arm_cut
static const int NUM_ARMS
static TH1I * hDigiHit_Time[Narms]
static TH1I * hDigiHit_Pedestal[Narms]
static TH2I * hDigiHit_PeakVsColumn[Narms]
static TH1I * hDigiHit_Arm
static TH2I * hDigiHit_IntegralVsColumn[Narms]
double getEhigh(int arm, int column) const
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
static TH2I * hDigiHit_NHitsVsArm
static TH2I * hDigiHit_TimeVsColumn_cut[Narms]
static TH2I * hDigiHit_RawIntegralVsColumn[Narms]
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static TH2I * hDigiHit_TimeVsIntegral[Narms]
static TH1I * hDigiHit_RawIntegral[Narms]
static TH1I * hDigiHit_RawPeak[Narms]
static TH1I * hDigiHit_NSamplesPedestal[Narms]
static TH2I * hDigiHit_TimeVsQF_cut[Narms]
static TH1I * hDigiHit_Time_cut[Narms]
static TH2I * hHit_NHitsVsArm
static TProfile * hDigiHit_PedestalVsColumn[Narms]
static TH2I * hDigiHit_TimeVsColumn[Narms]
static TH2I * hHit_IntegralVsColumn[Narms]
static TH1I * hDigiHit_NSamplesIntegral[Narms]
static TH1I * hHit_Energy[Narms]
static TH1I * hDigiHit_Occupancy_cut[Narms]
static TH1I * hHit_Occupancy[Narms]
static TH1I * hHit_Time[Narms]
static TH1I * hDigiHit_Occupancy[Narms]
static TH2I * hHit_TimeVsColumn[Narms]
static TH1I * hDigiHit_QualityFactor[Narms]
jerror_t init(void)
Called once at program start.
static TH2I * hHit_EnergyVsColumn[Narms]
static TH2I * hDigiHit_IntegralVsPeak[Narms]
JEventProcessor_PS_online()
static TH1I * hDigiHit_PulseTime[Narms]
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
jerror_t fini(void)
Called after last event of last event source has been processed.
~JEventProcessor_PS_online()
static const int NUM_FINE_COLUMNS
static TH1I * hHit_Integral[Narms]
static TH2I * hDigiHit_NHitsVsArm_cut
static TH1I * hDigiHit_NHits
double getElow(int arm, int column) const