|
ATLAS Offline Software
|
Go to the documentation of this file.
26 :
m_file(nullptr), m_cellTrees(3), m_ringTrees(3), m_cellCalc(nullptr), m_ringCalc(nullptr)
30 cout <<
"File " <<
fileName <<
" is not accessible" << endl;
40 for (
unsigned int i = 0;
i < 3;
i++ ) {
50 cout <<
"Trees with cell shape error data not found in " <<
fileName << endl;
57 cout <<
"Trees with phi symmetric shape error data not found in " <<
fileName << endl;
60 for (
unsigned int i = 0;
i < 3;
i++ ) {
70 if (
m_file->GetOption() == TString(
"CREATE")) {
72 for (
unsigned int g = 0;
g < 3;
g++ ) {
74 cout <<
"Missing trees, error writing data to TreeShapeErrorGetter" << endl;
157 cout <<
"-> " <<
i << endl;
165 unsigned int nBins,
double xMin,
double xMax)
const
167 TH2D*
h =
new TH2D(Form(
"%s_%d", xip ?
"xip" :
"xi",
sample),
"",
nBins, xMin, xMax,
nBins, xMin, xMax);
170 if (!
data1)
continue;
174 unsigned int sample1 =
sample +
data1->xip().GetLwb();
175 unsigned int sample2 =
sample +
data2->xip().GetLwb();
176 if (
data1->isInRange(sample1) &&
data2->isInRange(sample2))
177 h->Fill(xip ?
data1->xip()(sample1) :
data1->xi()(sample1),
178 xip ?
data2->xip()(sample2) :
data2->xi()(sample2));
188 std::ifstream
f(listFile);
190 cout <<
"file " << listFile <<
" not accessible" << endl;
196 std::vector<const TreeShapeErrorGetter*> getters;
202 cout <<
"Skipping invalid file " <<
fileName << endl;
205 cout << std::setw(2) << ++
i <<
" - " <<
fileName << endl;
206 getters.push_back(getter);
221 for (
unsigned int g = 0;
g < 3;
g++) {
222 bool gotResult =
false;
226 cout <<
"TreeShapeErrorGetter::merge : input getters have non-zero overlap for cell " <<
i <<
" -- not supported, exiting." << endl;
230 cout <<
"Adding " <<
i <<
" " <<
g <<
" " << getter->cellCalc()->size() << endl;
239 for (
unsigned int g = 0;
g < 3;
g++) {
240 bool gotResult =
false;
244 cout <<
"TreeShapeErrorGetter::merge : input getters have non-zero overlap for ring " <<
i <<
" -- not supported, exiting." << endl;
248 cout <<
"Adding ring " <<
i <<
" " <<
g << endl;
261 std::unique_ptr<TFile>
f(TFile::Open(
fileName,
"RECREATE"));
262 auto tree = std::make_unique<TTree>(
"tree",
"");
265 double xi1[99], xi2[99], xip1[99], xip2[99];
273 tree->Branch(
"calo", &calo);
276 tree->Branch(
"slot", &slot);
278 tree->Branch(
"eta", &eta);
279 tree->Branch(
"phi", &phi);
282 tree->Branch(
"lwb1", &lwb1);
283 tree->Branch(
"lwb2", &lwb2);
285 tree->Branch(
"xi1", xi1,
"xi1[nSamples]/D");
286 tree->Branch(
"xi2", xi2,
"xi2[nSamples]/D");
287 tree->Branch(
"xip1", xip1,
"xip1[nSamples]/D");
288 tree->Branch(
"xip2", xip2,
"xip2[nSamples]/D");
291 if (
k % 10000 == 0) cout <<
"Processing entry " <<
k << endl;
295 calo = (cellInfo ? cellInfo->
calo() : -999 );
296 layer = (cellInfo ? cellInfo->
layer() : -999 );
298 slot = (cellInfo ? cellInfo->
slot() : -999 );
300 eta = (cellInfo ? cellInfo->
eta() : -999 );
301 phi = (cellInfo ? cellInfo->
phi() : -999 );
303 for (
unsigned int g = 0;
g < 3;
g++) {
311 int lwb = (lwb1 >= 0 ? lwb1 : lwb2);
312 if (lwb<0)
throw std::runtime_error(
"TreeShapeErrorGetter::compare() attempt to access arrays with negative index");
313 for (
int j = lwb; j < lwb +
nSamples; j++) {
std::vector< TTree * > m_ringTrees
TreeShapeErrorGetter(const TString &fileName, bool recreate=false)
ShapeErrorData * phiSymShapeErrorData(short ring, CaloGain::CaloGain gain, const Residual *toExclude=0) const
int addCell(const ResidualCalculator &calc, CaloGain::CaloGain gain)
short feedThrough() const
ResidualCalculator * m_cellCalc
virtual const CellInfo * cellInfo(unsigned int i) const
TGraphErrors * GetEntries(TH2F *histo)
bool remove(const Residual &residual)
unsigned int size() const
TH2D * correlate(const TreeShapeErrorGetter &other, CaloGain::CaloGain gain, unsigned short sample, bool xip, unsigned int nBins, double xMin, double xMax) const
ShapeErrorData * shapeErrorData(unsigned int hash, CaloGain::CaloGain gain, const Residual *toExclude=0) const
int addRing(const ResidualCalculator &calc, CaloGain::CaloGain gain)
TTree * ringTree(CaloGain::CaloGain gain) const
std::unique_ptr< TFile > m_file
description: this is a custom writer for the old-school drivers that don't use an actual writer
const TVectorD & xip() const
bool compare(const TreeShapeErrorGetter &other, const TString &fileName, const Interface *tmpl=0) const
static const unsigned int nChannels
static bool merge(const TString &listFile, const TString &outputFile)
ResidualCalculator * m_ringCalc
virtual ~TreeShapeErrorGetter()
TTree * cellTree(CaloGain::CaloGain gain) const
void dump(CaloGain::CaloGain gain) const
ShapeErrorData * shapeErrorData() const
storage of a pulse shape residual set
std::vector< TTree * > m_cellTrees
const TVectorD & xi() const
const ScaledErrorData * sed