Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sbndcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ add_subdirectory(SBNDCVN)
add_subdirectory(TPCPMTBarycenterMatching)

add_subdirectory(BlipRecoSBND)
add_subdirectory(LightPropagationCorrection)
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ physics.producers.cafmaker.TrackChi2PidLabel: "pandoraPidData"
# Include 3D barycenter flahs matching
physics.producers.cafmaker.TPCPMTBarycenterMatchLabel: "tpcpmtbarycentermatching"

# Include Light Propagation Correction for OpFlash timing
physics.producers.cafmaker.CorrectedOpFlashLabel: "lightpropagationcorrection"

# Blinding not needed for MC
physics.producers.cafmaker.CreateBlindedCAF: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ physics.producers.cafmaker.SBNDCRTTrackMatchLabel: "crttrackmatchingSCE"
physics.producers.cafmaker.OpT0Label: "opt0finderSCE"
physics.producers.cafmaker.TPCPMTBarycenterMatchLabel: "tpcpmtbarycentermatchingSCE"
physics.producers.cafmaker.CVNLabel: "cvnSCE"
physics.producers.cafmaker.CorrectedOpFlashLabel: "lightpropagationcorrectionSCE"

physics.producers.cnnid.ClusterModuleLabel: "pandoraSCE"
physics.producers.cnnid.PFParticleModuleLabel: "pandoraSCE"
Expand All @@ -23,6 +24,10 @@ physics.producers.pandoraTrackRange.TrackLabel: "pandoraSCETrack"
physics.producers.cafmaker.FlashMatchOpDetSuffixes: ["", "op", "ara", "opara"]
physics.producers.cafmaker.FlashMatchSCECryoSuffixes: ["SCE"]





physics.producers.pandoraShowerSelectionVars.PandoraLabel: "pandoraSCE"
physics.producers.pandoraShowerSelectionVars.ShowerLabel: "pandoraSCEShowerSBN"
physics.producers.pandoraShowerCosmicDist.PandoraLabel: "pandoraSCE"
Expand Down
6 changes: 5 additions & 1 deletion sbndcode/JobConfigurations/standard/reco/reco2_data.fcl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "crt_calib_service.fcl"
#include "opt0finder_sbnd_data.fcl"
#include "sbnd_tpcpmt3dbarycentermatching_config.fcl"
#include "sbnd_lightpropagationcorrection_config.fcl"
#include "frameshift_sbnd_data.fcl"
#include "standard_reco2_sbnd.fcl"

Expand All @@ -26,6 +27,8 @@ physics.producers:
opt0finderSCE: @local::sbnd_opt0_finder_data
tpcpmtbarycentermatching: @local::TPCPMTBarycenterMatchProducer
tpcpmtbarycentermatchingSCE: @local::TPCPMTBarycenterMatchProducerSCE
lightpropagationcorrection: @local::LightPropagationCorrection
lightpropagationcorrectionSCE: @local::LightPropagationCorrectionSCE

### shower reco for data
pandoraShower: @local::sbnd_incremental_pandoraModularShowerCreationData
Expand All @@ -41,7 +44,8 @@ physics.reco2: [ pandora, pandoraTrack, pandoraShower, pandoraShowerSBN, pandora
cvn, opt0finder, crtveto, crtspacepointmatching, crttrackmatching, tpcpmtbarycentermatching,
pandoraSCE, pandoraSCETrack, pandoraSCEShower, pandoraSCEShowerSBN, pandoraSCECaloData, pandoraSCEPidData,
cvnSCE, opt0finderSCE, tpcpmtbarycentermatchingSCE, crtspacepointmatchingSCE, crttrackmatchingSCE,
caloskimCalorimetry, blipreco, frameshift]
caloskimCalorimetry, blipreco, lightpropagationcorrectionSCE, frameshift]


physics.analyzers.caloskim.G4producer: ""
physics.analyzers.caloskim.SimChannelproducer: ""
Expand Down
38 changes: 38 additions & 0 deletions sbndcode/LightPropagationCorrection/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

set (
MODULE_LIBRARIES
art::Framework_Principal
art::Framework_Services_Registry
art_root_io::tfile_support
art_root_io::TFileService_service
art::Persistency_Common
art::Persistency_Provenance
art::Utilities

ROOT::Tree
ROOT::Core

larsim::Utils
lardata::DetectorInfoServices_DetectorClocksServiceStandard_service
larcore::Geometry_Geometry_service
larcorealg::Geometry
lardataobj::RecoBase
lardataobj::MCBase
lardataobj::Simulation


sbndcode_OpDetReco_OpFlash_FlashFinder

sbnobj::Common_Reco
sbnobj::SBND_Timing
sbndcode_OpDetSim
)

cet_build_plugin(LightPropagationCorrection art::module SOURCE LightPropagationCorrection_module.cc LIBRARIES ${MODULE_LIBRARIES})
cet_build_plugin(LightPropagationCorrectionAna art::module SOURCE LightPropagationCorrectionAna_module.cc LIBRARIES ${MODULE_LIBRARIES})

install_fhicl()
install_source()
install_headers()
add_subdirectory(job)

Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
////////////////////////////////////////////////////////////////////////
// Class: SBNDOpT0FinderAna
// Plugin Type: analyzer (art v3_05_01)
// File: SBNDOpT0FinderAna_module.cc
//
// Generated at Mon Oct 12 13:52:37 2020 by Marco Del Tutto using cetskelgen
// from cetlib version v3_10_00.
////////////////////////////////////////////////////////////////////////

#include "art/Framework/Core/EDAnalyzer.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Principal/Run.h"
#include "art/Framework/Principal/SubRun.h"
#include "canvas/Utilities/InputTag.h"
#include "canvas/Persistency/Common/FindManyP.h"
#include "fhiclcpp/ParameterSet.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

#include "lardataobj/RecoBase/Slice.h"
#include "lardataobj/RecoBase/OpFlash.h"
#include "sbnobj/Common/Reco/CorrectedOpFlashTiming.h"

#include "art_root_io/TFileService.h"

#include "TTree.h"

#include <numeric>

class LightPropagationCorrectionAna;


class LightPropagationCorrectionAna : public art::EDAnalyzer {
public:
explicit LightPropagationCorrectionAna(fhicl::ParameterSet const& p);
// The compiler-generated destructor is fine for non-base
// classes without bare pointers or other resource use.

// Plugins should not be copied or assigned.
LightPropagationCorrectionAna(LightPropagationCorrectionAna const&) = delete;
LightPropagationCorrectionAna(LightPropagationCorrectionAna&&) = delete;
LightPropagationCorrectionAna& operator=(LightPropagationCorrectionAna const&) = delete;
LightPropagationCorrectionAna& operator=(LightPropagationCorrectionAna&&) = delete;

// Required functions.
void analyze(art::Event const& e) override;
void beginJob() override;
private:

std::string fLightPropCorrectionLabel; ///< The light propagation correction label producer

TTree* fTree; ///< The TTree for storing event information

double fOpFlashT0;
double fUpstreamTime_lightonly;
double fUpstreamTime_tpczcorr;
double fUpstreamTime_propcorr_tpczcorr;

unsigned int _eventID;
unsigned int _runID;
unsigned int _subrunID;

};


LightPropagationCorrectionAna::LightPropagationCorrectionAna(fhicl::ParameterSet const& p)
: EDAnalyzer{p}
{
fLightPropCorrectionLabel = p.get<std::string>("LightPropCorrectionLabel");
}

void LightPropagationCorrectionAna::analyze(art::Event const& e)
{
fOpFlashT0=-99999.;
fUpstreamTime_lightonly=-99999.;
fUpstreamTime_tpczcorr=-99999.;
fUpstreamTime_propcorr_tpczcorr=-99999.;

_eventID = -1;
_runID = -1;
_subrunID = -1;

std::cout << "Run: " << e.id().run() << " Sub: " << e.id().subRun() << " Evt: " << e.id().event() << std::endl;

_eventID = e.id().event();
_runID = e.id().run();
_subrunID = e.id().subRun();

// Get all the T0 objects
::art::Handle<std::vector<sbn::CorrectedOpFlashTiming>> correctedopflash_h;
e.getByLabel(fLightPropCorrectionLabel, correctedopflash_h);
if(!correctedopflash_h.isValid() || correctedopflash_h->empty()) {
mf::LogWarning("fLightPropCorrectionLabel") << "No LightPropCorrectionLabel objects with label " << fLightPropCorrectionLabel << std::endl;
return;
}


std::vector<art::Ptr<sbn::CorrectedOpFlashTiming>> correctedopflash_v;
art::fill_ptr_vector(correctedopflash_v, correctedopflash_h);

// Get the T0->Slice association
art::FindManyP<recob::Slice> correctedflash_to_slices(correctedopflash_h, e, fLightPropCorrectionLabel);
art::FindManyP<recob::OpFlash> correctedflash_to_flashes(correctedopflash_h, e, fLightPropCorrectionLabel);

for (size_t i = 0; i < correctedopflash_v.size(); i++) {

// The T0 object
auto const correctedopflash = correctedopflash_v[i];

// The associations from T0 to both slices and flashes
std::vector<art::Ptr<recob::Slice>> slice_v = correctedflash_to_slices.at(correctedopflash.key());
std::vector<art::Ptr<recob::OpFlash>> flash_v = correctedflash_to_flashes.at(correctedopflash.key());

// One T0 object is always associated to one and only one Slice and Flash
assert(slice_v.size() == 1);
assert(flash_v.size() == 1);

std::cout << " Corrected flash time is " << correctedopflash->OpFlashT0 << std::endl;
std::cout << " Associated with slice id " << slice_v[0]->ID() << std::endl;
std::cout << "Corrected flash time light only " << correctedopflash->UpstreamTime_lightonly << std::endl;
std::cout << "Corrected flash time tpc z corr " << correctedopflash->UpstreamTime_tpczcorr << std::endl;
std::cout << "Corrected flash time prop corr tpc z corr " << correctedopflash->UpstreamTime_propcorr_tpczcorr << std::endl;

fOpFlashT0 = correctedopflash->OpFlashT0;
fUpstreamTime_lightonly = correctedopflash->UpstreamTime_lightonly;
fUpstreamTime_tpczcorr = correctedopflash->UpstreamTime_tpczcorr;
fUpstreamTime_propcorr_tpczcorr = correctedopflash->UpstreamTime_propcorr_tpczcorr;
fTree->Fill();
}
}

void LightPropagationCorrectionAna::beginJob()
{
// Implementation of optional member function here.
art::ServiceHandle<art::TFileService> tfs;
fTree = tfs->make<TTree>("LightPropagationCorrection", "Light Propagation Correction Tree");

fTree->Branch("eventID", &_eventID, "eventID/i");
fTree->Branch("runID", &_runID, "runID/i");
fTree->Branch("subrunID", &_subrunID, "subrunID/i");

fTree->Branch("fOpFlashT0", &fOpFlashT0, "OpFlashT0/d");
fTree->Branch("fUpstreamTime_lightonly", &fUpstreamTime_lightonly, "UpstreamTime_lightonly/d");
fTree->Branch("fUpstreamTime_tpczcorr", &fUpstreamTime_tpczcorr, "UpstreamTime_tpczcorr/d");
fTree->Branch("fUpstreamTime_propcorr_tpczcorr", &fUpstreamTime_propcorr_tpczcorr, "UpstreamTime_propcorr_tpczcorr/d");

}

DEFINE_ART_MODULE(LightPropagationCorrectionAna)
Loading