22 #include <Event/Event.h>
23 #include <Event/EventTypes.h>
24 #include <Event/packet.h>
35 , _filename(
"./outputfile.root")
37 std::cout <<
"tpc_hits::tpc_hits(const std::string &name)" << std::endl;
41 M.
setMapNames(
"AutoPad-R1-RevA.sch.ChannelMapping.csv",
"AutoPad-R2-RevA-Pads.sch.ChannelMapping.csv",
"AutoPad-R3-RevA.sch.ChannelMapping.csv");
48 std::cout <<
"tpc_hits::~tpc_hits() Calling dtor" << std::endl;
54 std::cout <<
"tpc_hits::Init(PHCompositeNode *topNode) Initializing" << std::endl;
57 _h_hit_XY =
new TH2F(
"_h_hit_XY" ,
"_h_hit_XY;X, [m];Y, [m]", 400, -800, 800, 400, -800, 800);
73 std::cout <<
"tpc_hits::InitRun - DST Node missing, doing nothing." << std::endl;
78 auto hitsetcontainer = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
81 std::cout <<
"tpc_hits::InitRun - creating TRKR_HITSET." << std::endl;
89 dstNode->addNode(trkrnode);
95 trkrnode->addNode(newNode);
115 auto trkrhitsetcontainer = findNode::getClass<TrkrHitSetContainer>(topNode,
"TRKR_HITSET");
116 assert(trkrhitsetcontainer);
118 Event *_event = findNode::getClass<Event>(topNode,
"PRDF");
121 if (_event ==
nullptr)
123 std::cout <<
"tpc_hits::Process_Event - Event not found" << std::endl;
132 for(
int ep=0;ep<2;ep++){
133 for (
int sector = 0; sector<=23; sector++)
135 const int packet = 4000 + sector*10 + ep;
142 if(sector>11) side=1;
146 std::cout <<
"tpc_hits:: Event getPacket: "<< packet <<
"| Sector"<< sector <<
"| EndPoint "<< ep << std::endl;
151 int nr_of_waveforms = p->
iValue(0,
"NR_WF");
158 for (wf = 0; wf < nr_of_waveforms; wf++)
174 int sampa_nr = p->
iValue(wf,
"SAMPAADDRESS");
177 int fee = p->
iValue(wf,
"FEE");
178 int samples = p->
iValue( wf,
"SAMPLES" );
181 int FEE_R[26]={2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 1, 2, 2, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3};
183 int FEE_map[26]={3, 2, 5, 3, 4, 0, 2, 1, 3, 4, 5, 7, 6, 2, 0, 1, 0, 1, 4, 5, 11, 9, 10, 8, 6, 7};
184 int pads_per_sector[3] = {96, 128, 192};
187 int feeM = FEE_map[fee]-1;
188 if(FEE_R[fee]==2) feeM += 6;
189 if(FEE_R[fee]==3) feeM += 14;
192 double R =
M.
getR(feeM, channel);
193 double phi =
M.
getPhi(feeM, channel) + sector * M_PI / 6 ;
200 int sampaAddress = p->
iValue(wf,
"SAMPAADDRESS");
201 int sampaChannel = p->
iValue(wf,
"SAMPACHANNEL");
202 int checksum = p->
iValue(wf,
"CHECKSUM");
203 int checksumError = p->
iValue(wf,
"CHECKSUMERROR");
204 std::cout <<
"tpc_hits::Process_Event Samples "<< samples
206 <<
" layer: " << layer
207 <<
" sampa: "<< sampa_nr
209 <<
" Mapped fee: "<< feeM
210 <<
" sampaAddress: "<< sampaAddress
211 <<
" sampaChannel: "<< sampaChannel
212 <<
" checksum: "<< checksum
213 <<
" checksumError: "<< checksumError
214 <<
" hitsetkey "<< tpcHitSetKey
219 for (
int s = 0;
s < samples;
s++)
221 int pad =
M.
getPad(feeM, channel);
227 auto hit = hitsetit->second->getHit(hitkey);
235 hitsetit->second->addHitSpecificKey(hitkey, hit);
242 _h_hit_XY->Fill(R*cos(phi),R*sin(phi),adc);
275 std::cout <<
"tpc_hits::End(PHCompositeNode *topNode) This is the End..." << std::endl;