13 #include <JANA/JApplication.h>
14 #include <JANA/JFactory.h>
18 #include <TDirectory.h>
72 TDirectory *
mainDir = gDirectory;
73 TDirectory *taghDir = gDirectory->mkdir(
"TAGH_doubles");
75 gDirectory->mkdir(
"BeforeMergingDoubles")->cd();
76 hBM_tdiffVsIDdiff =
new TH2I(
"BM_tdiffVsIDdiff",
"TAGH 2-hit time difference vs. counter ID difference;counter ID difference;time difference [ns]",15,0.5,15.5,200,-5.0,5.0);
78 hBM1_Occupancy =
new TH1F(
"BM1_Occupancy",
"TAGH occ.: All hits, before merging doubles;counter (slot) ID;hits / counter",
Nslots,0.5,0.5+
Nslots);
79 hBM2_Occupancy =
new TH1F(
"BM2_Occupancy",
"TAGH occ.: Doubles only, before merging doubles;counter (slot) ID;hits / counter",
Nslots,0.5,0.5+
Nslots);
80 hBM1_Energy =
new TH1F(
"BM1_Energy",
"TAGH energy: All hits, before merging doubles;photon energy [GeV];hits / counter",180,3.0,12.0);
81 hBM2_Energy =
new TH1F(
"BM2_Energy",
"TAGH energy: Doubles only, before merging doubles;photon energy [GeV];hits / counter",180,3.0,12.0);
82 hBM1_PulseHeightVsID =
new TH2I(
"BM1_PulseHeightVsID",
"TAGH ADC pulse height vs. ID: All hits;counter (slot) ID;pulse height",
Nslots,0.5,0.5+
Nslots,410,0.0,4100.0);
83 hBM2_PulseHeightVsID =
new TH2I(
"BM2_PulseHeightVsID",
"TAGH ADC pulse height vs. ID: Doubles only;counter (slot) ID;pulse height",
Nslots,0.5,0.5+
Nslots,410,0.0,4100.0);
85 gDirectory->mkdir(
"AfterMergingDoubles")->cd();
86 hAM_tdiffVsIDdiff =
new TH2I(
"AM_tdiffVsIDdiff",
"TAGH 2-hit time difference vs. counter ID difference;counter ID difference;time difference [ns]",15,0.5,15.5,200,-5.0,5.0);
88 hAM1_Occupancy =
new TH1F(
"AM1_Occupancy",
"TAGH occ.: All hits, after merging doubles;counter (slot) ID;hits / counter",
Nslots,0.5,0.5+
Nslots);
89 hAM2_Occupancy =
new TH1F(
"AM2_Occupancy",
"TAGH occ.: Doubles only, after merging doubles;counter (slot) ID;hits / counter",
Nslots,0.5,0.5+
Nslots);
90 hAM3_Occupancy =
new TH1F(
"AM3_Occupancy",
"TAGH occ.: Doubles only w/ overlaps, after merging doubles;counter (slot) ID;hits / counter",
Nslots,0.5,0.5+
Nslots);
91 hAM1_Energy =
new TH1F(
"AM1_Energy",
"TAGH energy: All hits, after merging doubles;photon energy [GeV];hits / counter",180,3.0,12.0);
92 hAM2_Energy =
new TH1F(
"AM2_Energy",
"TAGH energy: Doubles only, after merging doubles;photon energy [GeV];hits / counter",180,3.0,12.0);
93 hAM3_Energy =
new TH1F(
"AM3_Energy",
"TAGH energy: Doubles only w/ overlaps, after merging doubles;photon energy [GeV];hits / counter",180,3.0,12.0);
121 vector<const DTAGHHit*> hits_c;
122 loop->Get(hits_c,
"Calib");
124 vector<const DTAGHHit*> hits;
128 vector<const DTAGHGeometry*> taghGeomVect;
129 loop->Get(taghGeomVect);
130 if (taghGeomVect.size() < 1)
131 return OBJECT_NOT_AVAILABLE;
134 japp->RootFillLock(
this);
137 for (
const auto& hit : hits_c) {
138 if (!hit->has_TDC||!hit->has_fADC)
continue;
148 for (
size_t i = 0; i < hits_c.size(); i++) {
151 for (
size_t j = i+1; j < hits_c.size(); j++) {
159 for (
const auto& hit : hits) {
160 if (!hit->has_TDC||!hit->has_fADC)
continue;
162 bool has_overlap =
false;
163 if (hit->counter_id < 274) {
164 double El = taghGeom.
getElow(hit->counter_id);
double Eh1 = taghGeom.
getEhigh(hit->counter_id+1);
165 has_overlap = (Eh1 > El);
171 if (hit->is_double && has_overlap)
hAM3_Occupancy->Fill(hit->counter_id);
172 if (hit->is_double && has_overlap)
hAM3_Energy->Fill(hit->E);
175 for (
size_t i = 0; i < hits.size(); i++) {
178 for (
size_t j = i+1; j < hits.size(); j++) {
184 japp->RootFillUnLock(
this);
static TH1F * hAM2_Occupancy
static TH1F * hAM3_Occupancy
static TH1F * hBM2_Energy
double getElow(unsigned int counter) const
static TH2I * hBM_tdiffVsIDdiff
JEventProcessor_TAGH_doubles()
static TH1F * hAM1_Energy
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static TH1F * hAM1_Occupancy
static TH2I * hBM1_PulseHeightVsID
static TH2I * hAM_tdiffVsIDdiff
static TH2I * hBM2_PulseHeightVsID
static TH1F * hBM2_Occupancy
~JEventProcessor_TAGH_doubles()
static TH1F * hBM1_Energy
static TH1F * hBM1_Occupancy
jerror_t init(void)
Called once at program start.
jerror_t fini(void)
Called after last event of last event source has been processed.
double getEhigh(unsigned int counter) const
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
static TH1F * hAM3_Energy
static const unsigned int kCounterCount
static TH1F * hAM2_Energy
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.