215 std::cout<<
"============================================"<<std::endl
216 <<
"Run = "<<
event.run()<<
", SubRun = "<<
event.subRun()<<
", Event = "<<
event.id().event()<<std::endl
217 <<
"============================================"<<std::endl;
225 auto particleHandle =
event.getValidHandle<std::vector<simb::MCParticle>>(
fSimModuleLabel);
228 art::Handle< std::vector<sbn::crt::CRTTrack>> crtTrackHandle;
229 std::vector<art::Ptr<sbn::crt::CRTTrack> > crtTrackList;
231 art::fill_ptr_vector(crtTrackList, crtTrackHandle);
234 auto tpcTrackHandle =
event.getValidHandle<std::vector<recob::Track>>(
fTPCTrackLabel);
235 art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event,
fTPCTrackLabel);
243 std::map<int, simb::MCParticle> particles;
245 for (
auto const& particle: (*particleHandle)){
248 int partID = particle.TrackId();
249 particles[partID] = particle;
253 std::vector<sbn::crt::CRTTrack> crtTracks;
254 std::map<int, std::vector<sbn::crt::CRTTrack>> crtTrackMap;
256 double minTrackTime = 99999;
257 double maxTrackTime = -99999;
259 for(
auto const&
track : (*crtTrackHandle)){
260 crtTracks.push_back(
track);
263 if(trueID != -99999) crtTrackMap[trueID].push_back(
track);
265 double trackTime = (double)(
int)
track.ts1_ns * 1
e-3;
266 if(trackTime < minTrackTime) minTrackTime = trackTime;
267 if(trackTime > maxTrackTime) maxTrackTime = trackTime;
274 auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
275 auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clockData);
278 for (
auto const& tpcTrack : (*tpcTrackHandle)){
280 std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
283 if(particles.find(trackTrueID) == particles.end())
continue;
285 if(!(
std::abs(particles[trackTrueID].PdgCode()) == 13 && particles[trackTrueID].Mother() == 0))
continue;
288 double trueTime = particles[trackTrueID].T() * 1
e-3;
289 if(trueTime < minTrackTime || trueTime > maxTrackTime)
continue;
296 if(closestAngle.second != -99999){
297 hAngle->Fill(closestAngle.second);
300 if(closestAngle.second != -99999){
302 if(crtTrueID == trackTrueID && crtTrueID != -99999){
311 for(
int i = 0; i < nbinsAngle; i++){
315 if(crtTrackMap.find(trackTrueID) != crtTrackMap.end()){
319 if(closestAngle.second < angleCut && closestAngle.second != -99999){
325 if(closestAngle.second < angleCut && closestAngle.second != -99999){
329 double trackTime = closestAngle.first.ts1_ns * 1
e-3;
330 if(particles.find(trackTrueID) != particles.end()){
331 if(
std::abs(trackTime - trueTime) < 2.){
343 if(closestDCA.second != -99999){
344 hDCA->Fill(closestDCA.second);
346 if(closestDCA.second != -99999){
348 if(crtTrueID == trackTrueID && crtTrueID != -99999){
357 for(
int i = 0; i < nbinsDCA; i++){
361 if(crtTrackMap.find(trackTrueID) != crtTrackMap.end()){
365 if(closestDCA.second < DCAcut && closestDCA.second != -99999){
371 if(closestDCA.second < DCAcut && closestDCA.second != -99999){
375 double trackTime = closestDCA.first.ts1_ns * 1
e-3;
376 if(particles.find(trackTrueID) != particles.end()){
377 if(
std::abs(trackTime - trueTime) < 2.){
389 for(
auto const& possTrack : possTracks){
393 if(crtTrueID == trackTrueID && crtTrueID != -99999){
int TrueIdFromTrackId(const art::Event &event, int track_i)
art::InputTag fSimModuleLabel
name of detsim producer
process_name use argoneut_mc_hitfinder track
double AngleBetweenTracks(recob::Track tpcTrack, sbn::crt::CRTTrack crtTrack)
double AveDCABetweenTracks(recob::Track tpcTrack, sbn::crt::CRTTrack crtTrack, double shift)
int TrueIdFromTotalEnergy(const art::Event &event, const sbnd::crt::CRTData &data)
void Initialize(const art::Event &event)
std::pair< sbn::crt::CRTTrack, double > ClosestCRTTrackByDCA(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTTrack > crtTracks, const art::Event &event, double minAngle=0.)
CRTTrackMatchAlg trackAlg
art::InputTag fCRTTrackLabel
name of CRT producer
int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
std::vector< sbn::crt::CRTTrack > AllPossibleCRTTracks(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTTrack > crtTracks, const art::Event &event)
bool fVerbose
print information about what's going on
std::pair< sbn::crt::CRTTrack, double > ClosestCRTTrackByAngle(detinfo::DetectorPropertiesData const &detProp, recob::Track tpcTrack, std::vector< sbn::crt::CRTTrack > crtTracks, const art::Event &event, double minDCA=0.)
art::InputTag fTPCTrackLabel
name of CRT producer
finds tracks best matching by angle
CRTBackTracker fCrtBackTrack
BEGIN_PROLOG could also be cout