22 #include <Event/Event.h>
23 #include <Event/EventTypes.h>
24 #include <Event/packet.h>
56 std::cout <<
"TpcRawDataDecoder::Init(PHCompositeNode *topNode) Initializing" << std::endl;
61 if (calibdir[0] ==
'/')
69 std::cout <<
"TpcRawDataDecoder::::InitRun No calibration file found" << std::endl;
80 std::cout <<
"TpcCombinedRawDataUnpacker::InitRun(PHCompositeNode* topNode)" << std::endl;
81 std::cout <<
"\tCould not retrieve topNode; doing nothing" << std::endl;
94 std::cout <<
"TpcCombinedRawDataUnpacker::InitRun(PHCompositeNode* topNode)" << std::endl;
98 std::cout <<
"\tCould not retrieve dst_node; doing nothing" << std::endl;
114 TrkrHitSetContainer* trkr_hit_set_container = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
115 if (!trkr_hit_set_container)
119 std::cout <<
"TpcCombinedRawDataUnpacker::InitRun(PHCompositeNode* topNode)" << std::endl;
123 std::cout <<
"\tMaking TrkrHitSetContainer" << std::endl;
133 m_ntup =
new TNtuple(
"NT",
"NT",
"event:gtmbco:packid:ep:sector:side:fee:chan:sampadd:sampch:nsamples");
141 TH1F pedhist(
"pedhist",
"pedhist", 251, -0.5, 1000.5);
143 TrkrHitSetContainer* trkr_hit_set_container = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
144 if (!trkr_hit_set_container)
146 std::cout <<
PHWHERE << std::endl;
147 std::cout <<
"TpcCombinedRawDataUnpacker::process_event(PHCompositeNode* topNode)" << std::endl;
148 std::cout <<
"Could not get \"TRKR_HITSET\" from Node Tree" << std::endl;
149 std::cout <<
"Exiting" << std::endl;
159 std::cout <<
PHWHERE << std::endl;
160 std::cout <<
"TpcCombinedRawDataUnpacker::process_event(PHCompositeNode* topNode)" << std::endl;
161 std::cout <<
"Could not get \"" <<
m_TpcRawNodeName <<
"\" from Node Tree" << std::endl;
162 std::cout <<
"Exiting" << std::endl;
169 findNode::getClass<PHG4TpcCylinderGeomContainer>(topNode,
"CYLINDERCELLGEOM_SVTX");
172 std::cout <<
PHWHERE <<
"ERROR: Can't find node CYLINDERCELLGEOM_SVTX" << std::endl;
181 uint64_t bco_min = UINT64_MAX;
182 uint64_t bco_max = 0;
186 for (
unsigned int i = 0;
i < nhits;
i++)
191 if (gtm_bco < bco_min)
195 if (gtm_bco > bco_max)
203 if (
FEE_R[fee] == 2) feeM += 6;
204 if (
FEE_R[fee] == 3) feeM += 14;
208 int ep = (packet_id - 4000) % 10;
209 int sector = (packet_id - 4000 - ep) / 10;
210 if (sector > 11) side = 0;
212 unsigned int key = 256 * (feeM) + channel;
216 if (layer == 0)
continue;
245 hit_set_container_itr = trkr_hit_set_container->
findOrAddHitSet(hit_set_key);
251 for (uint16_t sampleNum = 0; sampleNum < sam; sampleNum++)
253 uint16_t adc = tpchit->
get_adc(sampleNum);
260 float val = pedhist.GetBinContent(
nbin);
269 double adc_sum = 0.0;
270 double ibin_sum = 0.0;
271 double ibin2_sum = 0.0;
273 for (
int isum = -3; isum <= 3; isum++)
275 float val = pedhist.GetBinContent(hmaxbin + isum);
276 float center = pedhist.GetBinCenter(hmaxbin + isum);
277 ibin_sum += center * val;
278 ibin2_sum += center * center * val;
282 hpedestal = ibin_sum / adc_sum;
283 hpedwidth = sqrt(ibin2_sum / adc_sum - (hpedestal * hpedestal));
285 for (uint16_t
s = 0;
s < sam;
s++)
290 if ((
float(adc) - hpedestal) > (hpedwidth * 4))
294 hit = hit_set_container_itr->second->getHit(hit_key);
298 hit->
setAdc(
float(adc) - hpedestal);
300 hit_set_container_itr->second->addHitSpecificKey(hit_key, hit);
308 std::cout <<
" event BCO: " << bco_min <<
" - " << bco_max << std::endl;
309 std::cout <<
"TpcCombinedRawDataUnpacker:: done" << std::endl;
323 if (
Verbosity()) std::cout <<
"TpcCombinedRawDataUnpacker::End(PHCompositeNode *topNode) This is the End..." << std::endl;