ATLAS Offline Software
Loading...
Searching...
No Matches
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.
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) { }
const Interface * m_interface
Definition Splitter.h:32

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;
44 FilterParams f;
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}
#define max(a, b)
Definition cfImp.cxx:41
int event() const
Definition Data.cxx:28
const Data * data(unsigned int i) const
Definition History.cxx:91
unsigned int nData() const
Definition History.h:51

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: