28namespace globaltracking
33 ic.
options().
get<std::string>(
"cosmics-infile"));
34 connectTree(mFileName);
39 auto ent = mTree->GetReadEntry() + 1;
40 assert(ent < mTree->GetEntries());
42 LOG(info) <<
"Pushing " << mTracks.size() <<
" Cosmic Tracks at entry " << ent;
49 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
55void TrackCosmicsReader::connectTree(
const std::string&
filename)
58 mFile.reset(TFile::Open(
filename.c_str()));
59 assert(mFile && !mFile->IsZombie());
60 mTree.reset((TTree*)mFile->Get(
"cosmics"));
62 mTree->SetBranchAddress(
"tracks", &mTracksPtr);
64 mTree->SetBranchAddress(
"MCTruth", &mLabelsPtr);
66 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
71 std::vector<OutputSpec> outputs;
72 outputs.emplace_back(
"GLO",
"COSMICTRC", 0, Lifetime::Timeframe);
74 outputs.emplace_back(
"GLO",
"COSMICTRC_MC", 0, Lifetime::Timeframe);
78 "cosmic-track-reader",
83 {
"cosmics-infile", VariantType::String,
"cosmics.root", {
"Name of the input file"}},
84 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
Header of the General Run Parameters object.
Definition of the Names Generator class.
Type wrappers for enfording a specific serialization method.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
void run(ProcessingContext &pc) final
void init(InitContext &ic) final
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getTrackCosmicsReaderSpec(bool useMC)
create a processor spec to read cosmic tracks from a root file
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"