16 #include <TDirectory.h>
26 #define CORRECTIONS false
71 #include <JANA/JApplication.h>
72 #include <JANA/JFactory.h>
112 TDirectory *
mainDir = gDirectory;
113 TDirectory *tagmDir = gDirectory->mkdir(
"TAGM");
114 TDirectory *taghDir = gDirectory->mkdir(
"TAGH");
120 h_dt =
new TH1F(
"h_dt",
"Time difference PS - TAGM;PS-TAGM (ns)",200,-17,37);
124 Form(
"PS E vs PS left, TAGM col %i;\
125 Energy asymmetry;PS energy (GeV)",col+1),
134 Form(
"PS E vs PS left, TAGH counter %i;\
135 Energy asymmetry;PS energy (GeV)",hodo+1),
156 std::vector< std::map<std::string, double> > table;
157 std::string ccdb_key =
"/PHOTON_BEAM/pair_spectrometer/fine/energy_corrections";
158 if (eventLoop->GetCalib(ccdb_key, table)) {
159 jout <<
"Error loading " << ccdb_key <<
" from ccdb!" << std::endl;
161 for (
unsigned int i=0; i < table.size(); ++i) {
162 p0 = (table[i])[
"constant"];
163 p1 = (table[i])[
"linear"];
164 p2 = (table[i])[
"quadratic"];
189 vector<const DTAGMHit*> tm_hits;
190 vector<const DTAGHHit*> th_hits;
191 vector<const DPSPair*> ps_pairs;
192 vector<const DPSCPair*> psc_pairs;
197 loop->Get(psc_pairs);
201 japp->RootFillLock(
this);
203 if (psc_pairs.size() > 0 ) {
204 for (uint32_t i = 0; i < ps_pairs.size(); ++i) {
206 ps_El = ps_pairs[i]->ee.first->E;
207 ps_tl = ps_pairs[i]->ee.first->t;
209 ps_Er = ps_pairs[i]->ee.second->E;
210 ps_tr = ps_pairs[i]->ee.second->t;
220 for (uint32_t j = 0; j < tm_hits.size(); ++j) {
221 tm_E = tm_hits[j]->E;
222 tm_t = tm_hits[j]->t;
224 column = tm_hits[j]->column;
226 if (!tm_hits[j]->has_fADC || !tm_hits[j]->has_TDC)
continue;
227 if (tm_hits[j]->row != 0)
continue;
231 if (
run == 3180 && tdiff_tm < 26.5 && tdiff_tm >= 22.5) {
234 else if (
run == 3185 && tdiff_tm < 34.5 && tdiff_tm >= 30.5) {
240 for (uint32_t j = 0; j < th_hits.size(); ++j) {
241 th_E = th_hits[j]->E;
242 th_t = th_hits[j]->t;
244 counter = th_hits[j]->counter_id;
246 if (!th_hits[j]->has_fADC || !th_hits[j]->has_TDC)
continue;
248 if (
run == 3180 && tdiff_th < 26.5 && tdiff_th >= 22.5) {
251 else if (
run == 3185 && tdiff_th < 34.5 && tdiff_th >= 30.5) {
258 japp->RootFillUnLock(
this);
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
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.
jerror_t init(void)
Called once at program start.
~JEventProcessor_PS_E_calib()
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
JEventProcessor_PS_E_calib()
static TH2F * h_psE_vs_psEl_th[MAX_COUNTERS]
static TH2F * h_psE_vs_psEl_tm[MAX_COLUMNS]