5 #include <JANA/JApplication.h>
17 #include <TDirectory.h>
92 TDirectory *
mainDir = gDirectory;
93 TDirectory *tpolDir = gDirectory->mkdir(
"TPOL");
96 tpol_num_events =
new TH1I(
"tpol_num_events",
"TPOL number of events",1,0.5,1.5);
99 gDirectory->mkdir(
"Hit")->cd();
102 hHit_Phi =
new TH1F(
"Hit_Phi",
"TPOL azimuthal angle;triplet azimuthal angle [degrees];hits / sector",
Nsectors,0.0,360.0);
103 hHit_Peak =
new TH1I(
"Hit_Peak",
"TPOL fADC pulse peak;pulse peak;hits",410,0.0,4100.0);
105 hHit_Integral =
new TH1I(
"Hit_Integral",
"TPOL fADC pulse integral;pulse integral;hits",1000,0.0,30000.0);
107 hHit_Time =
new TH1I(
"Hit_Time",
"TPOL time;time [ns];hits / 2 ns",400,-400.0,400.0);
109 hHit_TimeVsPhi =
new TH2F(
"Hit_TimeVsPhi",
"TPOL time vs. phi;#phi [degrees];time [ns]",
Nsectors,0.0,360.0,400,-400.0,400.0);
110 hHit_TimeVsIntegral =
new TH2I(
"Hit_TimeVsIntegral",
"TPOL time vs. integral;pulse integral;time [ns]",500,0.0,30000.0,400,-400.0,400.0);
111 hHit_TimeVsPeak =
new TH2I(
"Hit_TimeVsPeak",
"TPOL time vs. peak;pulse peak;time [ns]",410,0.0,4100.0,400,-400.0,400.0);
114 gDirectory->mkdir(
"DigiHit")->cd();
116 hDigiHit_NSamplesPedestal =
new TH1I(
"DigiHit_NSamplesPedestal",
"TPOL fADC pedestal samples;pedestal samples;raw hits",50,-0.5,49.5);
117 hDigiHit_Pedestal =
new TH1I(
"DigiHit_Pedestal",
"TPOL fADC pedestals;pedestal [fADC counts];raw hits",200,0.0,200.0);
119 hDigiHit_QualityFactor =
new TH1I(
"DigiHit_QualityFactor",
"TPOL fADC quality factor;quality factor;raw hits",4,-0.5,3.5);
120 hDigiHit_PulseNumber =
new TH1I(
"DigiHit_PulseNumber",
"TPOL fADC pulse number;pulse number;raw hits",4,-0.5,3.5);
123 hDigiHit_RawPeak =
new TH1I(
"DigiHit_RawPeak",
"TPOL fADC pulse peak (raw);pulse peak (raw);raw hits",410,0.0,4100.0);
125 hDigiHit_RawIntegral =
new TH1I(
"DigiHit_RawIntegral",
"TPOL fADC pulse integral (raw);pulse integral (raw);raw hits",1000,0.0,30000.0);
127 hDigiHit_NSamplesIntegral =
new TH1I(
"DigiHit_NSamplesIntegral",
"TPOL fADC integral samples;integral samples;raw hits",60,-0.5,59.5);
129 hDigiHit_IntegralVsPeak =
new TH2I(
"DigiHit_IntegralVsPeak",
"TPOL fADC pulse integral vs. peak;pulse peak;pulse integral",410,0.0,4100.0,1000,0.0,30000.0);
131 hDigiHit_PulseTime =
new TH1I(
"DigiHit_PulseTime",
"TPOL fADC pulse time;pulse time [62.5 ps];raw hits",1000,0.0,6500.0);
132 hDigiHit_Time =
new TH1I(
"DigiHit_Time",
"TPOL fADC pulse time;pulse time [ns];raw hits / 2 ns",200,0.0,400.0);
134 hDigiHit_TimeVsPeak =
new TH2I(
"DigiHit_TimeVsPeak",
"TPOL time vs. peak;pulse peak;time [ns]",410,0.0,4100.0,200,0.0,400.0);
135 hDigiHit_TimeVsIntegral =
new TH2I(
"DigiHit_fadcTimeVsIntegral",
"TPOL fADC pulse time vs. integral;pulse integral;pulse time [ns]",500,0.0,30000.0,200,0.0,400.0);
161 uint32_t trig_mask, fp_trig_mask;
163 eventLoop->GetSingle(trig_words);
165 if (trig_words !=
nullptr) {
173 int trig_bits = fp_trig_mask > 0 ? 10 + fp_trig_mask:trig_mask;
175 if (trig_bits != 8) {
178 vector<const DTPOLHit*> hits;
179 eventLoop->Get(hits);
180 vector<const DTPOLSectorDigiHit*> sdhits;
181 eventLoop->Get(sdhits);
182 vector<const Df250WindowRawData*> windowrawdata;
183 eventLoop->Get(windowrawdata);
186 map< const DTPOLSectorDigiHit*, const Df250PulseData* > pd_cache;
187 for (
const auto& hit : sdhits) {
195 japp->RootFillLock(
this);
198 for (
const auto& wrd : windowrawdata) {
201 (wrd->slot == 13 || wrd->slot == 14)) {
210 for (
const auto& hit : sdhits) {
211 double ped = (double)hit->pedestal/hit->nsamples_pedestal;
215 if (ped == 0.0 || hit->pulse_peak == 0)
continue;
222 double pI = hit->pulse_integral-hit->nsamples_integral*ped;
227 double t_ns = 0.0625*hit->pulse_time;
240 for (
const auto& hit : hits) {
254 japp->RootFillUnLock(
this);
static TH2F * hHit_TimeVsPhi
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
static TH1I * hDigiHit_NSamplesPedestal
if(locHist_BCALShowerPhiVsZ!=NULL)
static TH2I * hHit_PeakVsSector
static TH2I * hHit_TimeVsIntegral
static TH2I * hDigiHit_PeakVsSector
static TH2I * hDigiHit_RawIntegralVsSector
static TH1I * hDigiHit_RawIntegral
static TH2I * hHit_TimeVsSector
static TH2I * hDigiHit_TimeVsPeak
static TH1I * hDigiHit_NHits
static TH1I * hDigiHit_Occupancy
static TH1I * hHit_Occupancy
static TH2I * hHit_IntegralVsSector
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
static TH1I * hDigiHit_NSamplesIntegral
static TH2I * hDigiHit_RawPeakVsSector
~JEventProcessor_TPOL_online()
static TH2I * hHit_TimeVsPeak
static TH1I * hDigiHit_PulseNumber
static TH1I * hDigiHit_QualityFactor
static TH2I * hDigiHit_PulseNumberVsSector
static TH1I * hHit_Integral
jerror_t init(void)
Called once at program start.
static TH2I * hDigiHit_IntegralVsPeak
static TH2I * hDigiHit_TimeVsIntegral
static TH2I * hDigiHit_TimeVsSector
JEventProcessor_TPOL_online()
static TH2I * hDigiHit_IntegralVsSector
static TH1I * hDigiHit_RawPeak
static TProfile * hDigiHit_PedestalVsSector
static TH1I * hDigiHit_PulseTime
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
static TH1I * hDigiHit_Time
jerror_t fini(void)
Called after last event of last event source has been processed.
uint32_t pulse_number
pulse number for this channel, this event starting from 0
static TH1I * hDigiHit_Pedestal
static const int NSECTORS
static TH1I * tpol_num_events