ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArSamplesMon
src
Splitter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArSamplesMon/Splitter.h
"
6
7
#include "
LArSamplesMon/Interface.h
"
8
#include "
LArSamplesMon/FilterParams.h
"
9
#include "
LArSamplesMon/DataTweaker.h
"
10
11
#include "TString.h"
12
13
#include <map>
14
#include <iostream>
15
using
std::cout;
16
using
std::endl;
17
18
using namespace
LArSamples
;
19
20
21
bool
Splitter::splitEvents
(
const
TString& name,
unsigned
int
max
)
const
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
std::unique_ptr<Interface> 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
}
49
50
return
true
;
51
}
52
DataTweaker.h
FilterParams.h
Interface.h
Splitter.h
max
#define max(a, b)
Definition
cfImp.cxx:41
LArSamples::DataTweaker
Definition
DataTweaker.h:24
LArSamples::Data::event
int event() const
Definition
Data.cxx:28
LArSamples::FilterParams
Definition
FilterParams.h:50
LArSamples::History
Definition
History.h:36
LArSamples::History::data
const Data * data(unsigned int i) const
Definition
History.cxx:88
LArSamples::History::nData
unsigned int nData() const
Definition
History.h:54
LArSamples::Splitter::m_interface
const Interface * m_interface
Definition
Splitter.h:32
LArSamples::Splitter::splitEvents
bool splitEvents(const TString &name, unsigned int max=20) const
Definition
Splitter.cxx:21
LArSamples
Definition
AbsShape.h:24
Generated on
for ATLAS Offline Software by
1.17.0