ATLAS Offline Software
LArCalorimeter
LArSamplesMon
src
Splitter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 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 <vector>
12
#include <map>
13
#include <iostream>
14
using
std::cout;
15
using
std::endl;
16
17
using namespace
LArSamples
;
18
19
20
bool
Splitter::splitEvents
(
const
TString&
name
,
unsigned
int
max
)
const
21
{
22
std::map<unsigned int, bool>
events
;
23
24
cout <<
"Scanning ntuple..."
<< endl;
25
for
(
unsigned
int
i
= 0;
i
<
m_interface
->
nChannels
();
i
++) {
26
const
History
* history =
m_interface
->
cellHistory
(
i
);
27
if
(!history)
continue
;
28
for
(
unsigned
int
k
= 0;
k
< history->
nData
();
k
++)
29
events
[history->
data
(
k
)->
event
()] =
true
;
30
}
31
32
cout <<
"Found "
<<
events
.size() <<
" events"
;
33
if
(
events
.size() >
max
) {
34
cout <<
", greater than specified maximum ("
<<
max
<<
"), aborting..."
<< endl;
35
return
false
;
36
}
37
cout <<
", will now split the ntuple"
<< endl;
38
39
unsigned
int
i
= 1;
40
for
(std::map<unsigned int, bool>::const_iterator
event
=
events
.begin();
41
event
!=
events
.end(); ++
event
, ++
i
) {
42
cout <<
"Processing event "
<<
event
->first <<
" ("
<<
i
<<
" of "
<<
events
.size() <<
")"
<< endl;
43
FilterParams
f
;
44
f
.addEvent(
event
->first);
45
m_interface
->
filter
(
f
,
DataTweaker
(), Form(
"%s_%d.root"
,
name
.Data(),
event
->first));
46
}
47
48
return
true
;
49
}
50
python.CaloRecoConfig.f
f
Definition:
CaloRecoConfig.py:127
max
#define max(a, b)
Definition:
cfImp.cxx:41
LArSamples::FilterParams
Definition:
FilterParams.h:50
LArSamples::History
Definition:
History.h:40
LArSamples::Interface::cellHistory
const History * cellHistory(unsigned int i) const
Definition:
Interface.cxx:114
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:88
Splitter.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition:
lumiFormat.py:92
LArSamples::Splitter::m_interface
const Interface * m_interface
Definition:
Splitter.h:33
LArSamples::DataTweaker
Definition:
DataTweaker.h:23
LArSamples::History::nData
unsigned int nData() const
Definition:
History.h:56
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:195
LArSamples::Splitter::splitEvents
bool splitEvents(const TString &name, unsigned int max=20) const
Definition:
Splitter.cxx:20
LArSamples::Interface::filter
Interface * filter(const TString &sel, const TString &fileName, const TString &tweaks="") const
Definition:
Interface.cxx:346
Interface.h
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition:
AbsLArCells.h:34
fitman.k
k
Definition:
fitman.py:528
Generated on Tue Jul 2 2024 21:27:11 for ATLAS Offline Software by
1.8.18