101 std::cout <<
"getting handle to CRTHits..." << std::endl;
104 art::Handle< std::vector<sbn::crt::CRTHit> > rawHandle;
107 if(!rawHandle.isValid()){
109 <<
", event " <<
evt.
event() <<
" has zero"
110 <<
" CRTHits " <<
" in module " <<
data_label_ << std::endl;
116 std::vector<sbn::crt::CRTHit>
const& CRTHitCollection(*rawHandle);
119 std::unique_ptr<std::vector<sbn::crt::CRTTzero> > CRTTzeroCol(
new std::vector<sbn::crt::CRTTzero>);
125 art::PtrMaker<sbn::crt::CRTHit> hitPtrMaker(
evt, rawHandle.id());
126 art::PtrMaker<sbn::crt::CRTTzero> tzeroPtrMaker(
evt);
128 int N_CRTHits = CRTHitCollection.size();
130 std::vector<int> iflag;
132 std::cout <<
"found " << N_CRTHits <<
" CRTHits" << std::endl;
134 for(
int i = 0; i < N_CRTHits; i++) iflag.push_back(0);
139 for(
int i = 0; i < N_CRTHits; i++) {
142 std::vector<art::Ptr<sbn::crt::CRTHit>> CRTHitCol;
144 art::Ptr<sbn::crt::CRTHit> hptr = hitPtrMaker(i);
145 CRTHitCol.push_back(hptr);
147 double time_ns_A = CRTHiteventA.
ts1_ns;
153 for (
int j=0; j<7 ;++j) {
154 CRTcanTzero.
nhits[j]=0;
155 CRTcanTzero.
pes[j]=0;
160 planeA = CRTHiteventA.
plane;
161 CRTcanTzero.
nhits[planeA]=1;
163 CRTcanTzero.
pes[planeA]=CRTHiteventA.
peshit;
164 for(
int j = i+1; j < N_CRTHits; j++) {
169 double time_ns_B = CRTHiteventB.
ts1_ns;
170 double time_diff = time_ns_B - time_ns_A;
172 art::Ptr<sbn::crt::CRTHit> hptr = hitPtrMaker(j);
173 CRTHitCol.push_back(hptr);
174 planeB = CRTHiteventB.
plane;
175 CRTcanTzero.
nhits[planeB]+=1;
176 CRTcanTzero.
pes[planeB]+=CRTHiteventB.
peshit;
178 CRTcanTzero.
ts1_ns+=(int)(time_diff);
185 CRTcanTzero.
ts1_ns/=icount;
186 CRTcanTzero.
ts1_ns+=(int)time_ns_A;
187 CRTcanTzero.
ts0_ns/=icount;
191 CRTTzeroCol->push_back(CRTcanTzero);
194 art::Ptr<sbn::crt::CRTTzero> aptz = tzeroPtrMaker(CRTTzeroCol->size()-1);
195 std::cout <<
"produced " << CRTTzeroCol->size() <<
" CRTTzero objects" << std::endl;
196 std::cout <<
"pointer to CRTTzero = " << aptz << std::endl;
204 std::cout <<
"about to move CRTTzero and art::Assns to file..." << std::endl;
207 evt.put(std::move(CRTTzeroCol));
double ts1_ns
Timestamp T1 ([signal time w.r.t. Trigger time]), in UTC absolute time scale in nanoseconds from the ...
int plane
Name of the CRT wall (in the form of numbers).
float peshit
Total photo-electron (PE) in a crt hit.
uint64_t ts0_s
Second-only part of timestamp T0.
double ts0_ns
Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch...
BEGIN_PROLOG could also be cout
double max_time_difference_