eic-smear
1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
|
Go to the documentation of this file.
17 #include <TRefArray.h>
35 , mInputName(
"default.txt")
36 , mOutputName(
"default.root")
37 , mTreeName(
"EICTree")
38 , mBranchName(
"event")
86 std::cout <<
"Processing event "<< std::setw(width) << i;
90 std::cout << std::endl;
114 catch(std::exception& e) {
115 std::cerr <<
"Caught exception in Forester::Plant(): "
116 << e.what() << std::endl;
117 std::cerr <<
"Event will be skipped..." << std::endl;
123 catch(std::exception& e) {
124 std::cerr <<
"Caught exception in Forester::Plant(): "
125 << e.what() << std::endl;
139 std::string message(
"Unable to open file ");
147 " is not from a supported generator");
153 catch(std::exception&) {
163 std::string message(
"Unable to open file ");
169 std::string message(
"Error allocating TTree ");
170 throw std::runtime_error(message.append(
GetTreeName()));
178 mTree->SetAutoSave(500LL * 1024LL * 1024LL);
186 catch(std::exception&) {
223 catch(std::exception&) {
242 os <<
"Input file: " <<
mInputName << std::endl;
244 os <<
"Output tree: " <<
mTreeName << std::endl;
245 os <<
"Output branch: " <<
mBranchName << std::endl;
246 os <<
"Maximum number of events: " <<
mMaxNEvents << std::endl;
248 os <<
"Event type: " <<
mEvent->ClassName() << std::endl;
271 os <<
"Began on " << std::ctime(&mStartTime);
272 os <<
"Ended on " << std::ctime(&mEndTime);
273 os <<
"Processed " << mNEvents <<
" events containing "
274 << mNParticles <<
" particles in "
275 << mTimer.RealTime() <<
" seconds "
276 <<
'(' << mTimer.RealTime()/mNEvents <<
" sec/event)" << std::endl;
281 std::time(&mStartTime);
286 std::time(&mEndTime);
295 mNParticles += count;
const erhic::FileType * mFile
< Stores event branch address
Forester()
Default constructor.
void Finish()
Writes output and takes end-of-file actions.
bool BeVerbose() const
Returns the verbosity i.e.
const FileType * GetFile(const std::string &generatorName) const
Returns a FileType object for the named generator.
VirtualEvent * mEvent
< Output TTree, owned by mRootFile
Long64_t mMaxNEvents
< Pointer to output ROOT file
virtual void StartTimer()
virtual void ModifyParticleCount(Long64_t count)
std::string GetInputFileName() const
Returns the name of the input text file containing Monte Carlo data.
bool MustQuit() const
Prints the quit flag status.
std::ifstream * mTextFile
std::string GetOutputFileName() const
Returns the name of the ROOT tree file to create.
bool FindFirstEvent()
Aligns the input text file on the first line of the first event.
Status mStatus
Forester status information.
std::string mBranchName
Name of the event TBranch.
virtual VirtualEventFactory * CreateEventFactory(std::istream &) const =0
Returns a new event object for the generator making this type of file.
void SetMustQuit(bool quit)
Set the quit flag.
const Status & GetGetStatus() const
Prints a summary of the last call to Plant() to the requested output stream.
void Print(std::ostream &stream) const
Prints the current configuration to the requested output stream.
virtual UInt_t GetNTracks() const =0
Returns the number of tracks in the event.
bool SetupOutput()
Opens the output ROOT file and creates the TTree ready for filling.
virtual std::ostream & Print(std::ostream &os=std::cout) const
bool AllocateEvent()
Allocate an event buffer for the TTree based on the generator type.
Long64_t GetMaxNEvents() const
Returns the maximum number of events to process.
std::string mTreeName
Name of the output TTree.
std::string GetBranchName() const
Returns the name of the TBranch containing event objects.
std::string mOutputName
Name of the output ROOT file.
virtual VirtualEvent * Create()=0
Returns a new event instance.
virtual EventBase * AllocateEvent() const =0
Returns a new event object for the generator making this type of file.
Long64_t Plant()
Processes a text file into a ROOT file.
VirtualEventFactory * mFactory
Long64_t mInterval
Event interval between printing status messages.
virtual ~Forester()
Destructor.
static FileFactory & GetInstance()
Returns the single instance of FileFactory.
bool OpenInput()
Opens the input file and checks that it was produced by a supported Monte Carlo generator.
TFile * mRootFile
< File type information
std::string GetTreeName() const
Returns the name of the TTree to write to the file named by SetOutputFileName().
std::string mInputName
< Input text file
std::string mLine
Stores the latest text line read from the input file.
virtual void ModifyEventCount(Long64_t count)