111 art::Handle< std::vector<sbn::crt::CRTHit> > rawHandle;
114 if(!rawHandle.isValid()){
116 <<
", event " <<
evt.
event() <<
" has zero"
117 <<
" CRTHits " <<
" in module " <<
data_label_ << std::endl;
123 std::vector<sbn::crt::CRTHit>
const& CRTHitCollection(*rawHandle);
126 std::unique_ptr<std::vector<sbn::crt::CRTTzero> > CRTTzeroCol(
new std::vector<sbn::crt::CRTTzero>);
129 std::unique_ptr<art::Assns<sbn::crt::CRTTzero, sbn::crt::CRTHit>> outputHits(
new art::Assns<sbn::crt::CRTTzero, sbn::crt::CRTHit>);
131 art::PtrMaker<sbn::crt::CRTHit> hitPtrMaker(
evt, rawHandle.id());
132 art::PtrMaker<sbn::crt::CRTTzero> tzeroPtrMaker(
evt);
134 int N_CRTHits = CRTHitCollection.size();
137 std::vector<int> iflag;
138 for(
int i = 0; i < N_CRTHits; i++) iflag.push_back(0);
141 for(
int i = 0; i < N_CRTHits; i++) {
144 std::vector<art::Ptr<sbn::crt::CRTHit>> CRTHitCol;
146 art::Ptr<sbn::crt::CRTHit> hptr = hitPtrMaker(i);
147 CRTHitCol.push_back(hptr);
150 double time_ns_A = CRTHiteventA.
ts1_ns;
158 for (
int j=0; j<7 ;++j) {
159 CRTcanTzero.
nhits[j]=0;
160 CRTcanTzero.
pes[j]=0;
166 planeA = CRTHiteventA.
plane;
167 CRTcanTzero.
nhits[planeA]=1;
171 CRTcanTzero.
pes[planeA]=CRTHiteventA.
peshit;
172 for(
int j = i+1; j < N_CRTHits; j++) {
177 double time_ns_B = CRTHiteventB.
ts1_ns;
178 double time_diff = time_ns_B - time_ns_A;
181 art::Ptr<sbn::crt::CRTHit> hptr = hitPtrMaker(j);
182 CRTHitCol.push_back(hptr);
183 planeB = CRTHiteventB.
plane;
184 CRTcanTzero.
nhits[planeB]+=1;
185 CRTcanTzero.
pes[planeB]+=CRTHiteventB.
peshit;
187 CRTcanTzero.
ts1_ns+=(int)(time_diff);
195 CRTcanTzero.
ts1_ns/=icount;
196 CRTcanTzero.
ts1_ns+=(int)time_ns_A;
197 CRTcanTzero.
ts0_ns/=icount;
201 CRTTzeroCol->push_back(CRTcanTzero);
205 art::Ptr<sbn::crt::CRTTzero> aptz = tzeroPtrMaker(CRTTzeroCol->size()-1);
214 evt.put(std::move(CRTTzeroCol));
215 evt.put(std::move(outputHits));
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 max_time_difference_
double ts0_ns
Timestamp T0 (from White Rabbit), in UTC absolute time scale in nanoseconds from the Epoch...
bool CreateAssn(art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t index=UINT_MAX)
Creates a single one-to-one association.
BEGIN_PROLOG could also be cout