ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArSamples::Splitter Class Reference

Tools so split an ntuple into smaller bits. More...

#include <Splitter.h>

Collaboration diagram for LArSamples::Splitter:

Public Member Functions

 Splitter (const Interface &interface)
 Constructor
More...
 
bool splitEvents (const TString &name, unsigned int max=20) const
 

Private Attributes

const Interfacem_interface
 

Detailed Description

Tools so split an ntuple into smaller bits.

Definition at line 21 of file Splitter.h.

Constructor & Destructor Documentation

◆ Splitter()

LArSamples::Splitter::Splitter ( const Interface interface)
inline

Constructor

Definition at line 26 of file Splitter.h.

26 : m_interface(&interface) { }

Member Function Documentation

◆ splitEvents()

bool Splitter::splitEvents ( const TString &  name,
unsigned int  max = 20 
) const

Definition at line 21 of file Splitter.cxx.

22 {
23  std::map<unsigned int, bool> events;
24 
25  cout << "Scanning ntuple..." << endl;
26  for (unsigned int i = 0; i < m_interface->nChannels(); i++) {
27  const History* history = m_interface->cellHistory(i);
28  if (!history) continue;
29  for (unsigned int k = 0; k < history->nData(); k++)
30  events[history->data(k)->event()] = true;
31  }
32 
33  cout << "Found " << events.size() << " events";
34  if (events.size() > max) {
35  cout << ", greater than specified maximum (" << max << "), aborting..." << endl;
36  return false;
37  }
38  cout << ", will now split the ntuple" << endl;
39 
40  unsigned int i = 1;
41  for (std::map<unsigned int, bool>::const_iterator event = events.begin();
42  event != events.end(); ++event, ++i) {
43  cout << "Processing event " << event->first << " (" << i << " of " << events.size() << ")" << endl;
45  f.addEvent(event->first);
46  auto pInterface = m_interface->filter(f, DataTweaker(), Form("%s_%d.root", name.Data(), event->first));
47  //nothing is ever done with this (unfinished code?), so simply delete it.
48  delete (pInterface);
49  }
50 
51  return true;
52 }

Member Data Documentation

◆ m_interface

const Interface* LArSamples::Splitter::m_interface
private

Definition at line 32 of file Splitter.h.


The documentation for this class was generated from the following files:
LArSamples::FilterParams
Definition: FilterParams.h:50
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
LArSamples::History
Definition: History.h:35
LArSamples::Interface::cellHistory
const History * cellHistory(unsigned int i) const
Definition: Interface.cxx:116
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
LArSamples::Data::event
int event() const
Definition: Data.cxx:28
LArSamples::History::data
const Data * data(unsigned int i) const
Definition: History.cxx:91
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
hist_file_dump.f
f
Definition: hist_file_dump.py:135
LArSamples::Splitter::m_interface
const Interface * m_interface
Definition: Splitter.h:32
LArSamples::DataTweaker
Definition: DataTweaker.h:24
LArSamples::History::nData
unsigned int nData() const
Definition: History.h:51
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LArSamples::Interface::filter
Interface * filter(const TString &sel, const TString &fileName, const TString &tweaks="") const
Definition: Interface.cxx:354
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition: AbsLArCells.h:34
fitman.k
k
Definition: fitman.py:528