ATLAS Offline Software
LArCalorimeter
LArSamplesMon
src
Splitter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 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
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
}
53
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
LArSamples
Definition:
AbsShape.h:24
FilterParams.h
python.DataFormatRates.events
events
Definition:
DataFormatRates.py:105
LArSamples::Data::event
int event() const
Definition:
Data.cxx:28
DataTweaker.h
LArSamples::History::data
const Data * data(unsigned int i) const
Definition:
History.cxx:91
Splitter.h
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::Splitter::splitEvents
bool splitEvents(const TString &name, unsigned int max=20) const
Definition:
Splitter.cxx:21
LArSamples::Interface::filter
Interface * filter(const TString &sel, const TString &fileName, const TString &tweaks="") const
Definition:
Interface.cxx:354
Interface.h
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition:
AbsLArCells.h:34
fitman.k
k
Definition:
fitman.py:528
Generated on Fri Jan 10 2025 21:17:58 for ATLAS Offline Software by
1.8.18