|
ATLAS Offline Software
|
Go to the documentation of this file.
43 const std::vector<const EventData*>& eventData,
unsigned hash,
45 : m_cellInfo(*container.cellInfo()),
46 m_eventData(eventData),
47 m_hash(
hash), m_shapeErrorGetter(shapeErrorGetter)
49 ClassCounts::incrementInstanceCount(
"History");
57 const std::vector<const EventData*>& eventData,
60 m_shapeErrorGetter(shapeErrorGetter)
82 for (
unsigned int k = 0;
k <
nData();
k++) {
93 if (
i >=
nData())
return nullptr;
100 for (
unsigned int k = 0;
k <
nData();
k++) {
130 if (
nData() == 0)
return false;
135 for (
unsigned int j = 0; j <
nData(); j++) {
136 if (
sum->nPoints() !=
m_data[j]->nSamples())
return false;
137 for (
unsigned int k = 0;
k <
m_data[j]->nSamples();
k++)
140 if (!thisRef) {
delete sum;
return false; }
155 if (
nData() == 0)
return false;
169 if (
m_data[
i]->isDisconnected())
return -1;
173 if (nDof) *nDof = c2c.
nDof();
185 if (oldGetter) combGetter->
add(*oldGetter);
186 combGetter->
add(*uniGetter);
188 double chi2Value =
chi2(
i, lwb, upb, chi2Params);
199 for (
unsigned int i = 0;
i <
nData();
i++) {
200 double chi2Value =
chi2(
i, lwb, upb, chi2Params);
209 if (
k >=
nData())
return nullptr;
218 if (!
result)
return nullptr;
226 if (
k >=
nData())
return false;
237 std::vector<const Data*> datas;
242 for (
unsigned int j = 0; j <
nData(); j++) {
245 for (
unsigned int k = 0;
k < datas.size();
k++)
delete datas[
k];
248 datas.push_back(refitData);
261 std::vector<const Data*> datas;
265 for (
unsigned int j = 0; j <
nData(); j++) {
268 for (
unsigned int k = 0;
k < datas.size();
k++)
delete datas[
k];
271 datas.push_back(newData);
285 if (!
f.set(
cuts))
return nullptr;
287 std::vector<const Data*> datas;
289 for (
unsigned int j = 0; j <
nData(); j++) {
290 if (!
f.pass(
hash(), *
this, j))
continue;
291 datas.push_back(
new Data(*
data(j)));
315 if (!
sed)
return nullptr;
324 if (!
sed)
return nullptr;
331 if (!
sed)
return nullptr;
340 if (!
sed)
return nullptr;
353 if (
k >=
nData() ||
data(
k)->adcMax() <= 0)
return nullptr;
356 if (!
sed)
return nullptr;
368 if (
k >=
nData())
return 0;
370 if (
dv.GetNrows() == 0)
return false;
378 if (
k >=
nData())
return TVectorD();
394 if (!sea)
return false;
405 if (!sea)
return false;
406 if (!sea->
isInRange(sample1) || !sea->
isInRange(sample2)) {
delete sea;
return false; }
418 for (
unsigned int j = 0; j <
nData(); j++) {
419 if (
m_data[j]->isDisconnected())
continue;
420 if (
m_data[j]->adcMax() < 1)
continue;
423 allData->
add(*thisData);
426 else allData = thisData;
429 allRef->
add(*thisRef);
432 else allRef = thisRef;
445 if (!
allShape(allData, allRef))
return -1;
446 double chi2Value = c2c.
chi2(*allData, *allRef);
455 if ((
unsigned int)
k >=
nData())
return false;
459 if (!refShape || !smpShape)
return false;
462 if (atlasTitle !=
"") {
477 if (!
sum(dataShape, refShape))
return false;
480 return drawer.drawAndDelete(
"", dataShape, refShape);
487 cout <<
"No data" << endl;
493 if (!refitted_history)
return false;
495 delete refitted_history;
502 std::vector<const AbsShape*> shapes;
504 for (
unsigned int i = 0;
i <
nData();
i++) {
505 if (
m_data[
i]->adcMax() < 1)
continue;
509 for (
unsigned int k = 0;
k < shape->
nPoints();
k++)
514 shapes.push_back(shape);
518 return drawer.drawAndDelete(Form(
"%s (Normalized Shape, max at 1000)",
cellInfo()->location(2).
Data()), shapes, refShape, smpShape);
524 std::vector<const AbsShape*> shapes;
525 for (
unsigned int i = 0;
i <
nData();
i++) {
526 if (
m_data[
i]->adcMax() < 1)
continue;
527 if (
k >= 0 &&
k != (
int)
i)
continue;
531 if (!shape)
continue;
537 shapes.push_back(shape);
540 TString
title = (
rescale ?
"Normalized " :
"") + TString(
"residuals for %s");
546 bool samplesOnly)
const
549 if (adcMax < 0) adcMax =
m_data[
k]->adcMax();
558 if (
k >=
nData())
return nullptr;
567 if (
dv.GetNrows() == 0)
return nullptr;
577 for (
unsigned int i = 0;
i <
nData();
i++)
587 for (
unsigned int k = 0;
k <
nData();
k++) {
588 if (
i >= 0 &&
i != (
int)
k)
continue;
606 if (
k >=
nData())
return nullptr;
607 TVectorD del =
deltas(
k, -1, -1, correct);
609 (zeroTime ? 0 :
data(
k)->ofcTime() ));
617 auto residuals = std::make_unique<Residuals>();
618 for (
unsigned int k = 0;
k <
nData();
k++) {
620 auto res = std::unique_ptr<Residual>(
residual(
k, correct, zeroTime));
621 if (!
res) { cout <<
"Error calculating residual for hash = " <<
m_hash <<
", index = " <<
k << endl;
return nullptr; }
623 cout <<
"Warning for hash = " <<
m_hash <<
", index = " <<
k <<
" : index interval changed from ["
628 for (
int i =
res->lwb(); i < res->upb();
i++) {
629 if (absResCut > 0 && TMath::Abs(
res->scaledDelta(
i)) > absResCut) {
644 std::vector<unsigned int> upstreamNeighbors;
646 if (upstreamNeighbors.empty())
return -1;
647 std::vector<const Data*> unData;
649 double upstreamE = 0;
660 if (
nData() == 0 || chi2Cut <= 0)
return -1;
662 for (
unsigned int k = 0;
k <
nData();
k++)
if (
chi2(
k) > chi2Cut) nBadChi2++;
663 double effBad = nBadChi2/
nData();
664 double effRef = TMath::Prob(chi2Cut, nDof);
665 double dEff = sqrt(effRef*(1 - effRef))/sqrt(
nData());
666 if (dEff == 0) dEff = 1/sqrt(
nData());
667 return (effBad - effRef)/dEff;
TString description(unsigned int verbosity=1) const
char data[hepevt_bytes_allocation_ATLAS]
const Data * data_for_event(int event, int run=-1) const
std::vector< const EventData * > m_eventData
TVectorD deltas(const AbsShape &data, const AbsShape &reference, CovMatrix &errors, const ScaledErrorData *shapeError=0, int lwb=-1, int upb=-1, bool noDataError=false)
unsigned int hash() const
void setRefit(bool refit=true)
const ScaledErrorData * scaledErrorData(unsigned int i, double adcMax=-1, double time=Definitions::none, ShapeErrorType shapeErrorType=BestShapeError) const
double chi2Anomaly(double chi2Cut, unsigned int nDof=3) const
const CellInfo * cellInfo() const
TMatrixTSym< double > CovMatrix
SimpleShape * referenceShape(unsigned int k, double adcMax=-1, double time=Definitions::none, bool samplesOnly=false) const
void setAdjust(bool adjust=true)
void setCallBacks(const History *history, unsigned int index) const
std::vector< const Data * > m_data
const DataContainer * dataContainer(unsigned int i) const
bool hasSameRange(int lw, int up) const
int run(int argc, char *argv[])
virtual ShapeErrorData * shapeErrorData(unsigned int hash, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
Residuals * residuals(CaloGain::CaloGain gain=CaloGain::LARNGAIN, double absResTrunc=-1, bool correct=true, bool zeroTime=false) const
const Interface * m_interface
unsigned int nPoints() const
bool residualError(unsigned int i, short sample1, short sample2, double &offset, double adcMax=-1, double time=Definitions::none) const
storage of the time histories of all the cells
History * filter(const TString &cuts) const
double allChi2(Chi2Params pars) const
OFC * ofc(unsigned int i, int lwb=-1, int upb=-1, double time=Definitions::none, bool useCorrs=true) const
void add(const AbsShapeErrorGetter &getter)
bool add(const AbsShape &other)
SimpleShape * deltaShape(unsigned int k, int lwb=-1, int upb=-1) const
double maxChi2(int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
bool add(unsigned int k, double value, double error)
const Data * data(unsigned int i) const
void set(unsigned int i, double value, double error=-1)
double value(unsigned int i) const
bool firstNeighbors(unsigned int hash, std::vector< unsigned int > &hashes, short layer=-2) const
bool isInRange(int i) const
Residual * residual(unsigned int k, bool correct=true, bool zeroTime=false) const
History * refit(Chi2Params pars=DefaultChi2) const
POOL::TEvent event(POOL::TEvent::kClassAccess)
bool allShape(GraphShape *&allData, SimpleShape *&allRef) const
bool refVal(unsigned int i, unsigned int sample, double &val, double &err) const
void decrementInstanceCount() const
void setShapeErrorGetter(const AbsShapeErrorGetter *err) const
std::pair< std::vector< unsigned int >, bool > res
bool drawSumWithReference() const
TString location(int verbose=1) const
double chi2_k(int i, double k, int lwb=-1, int upb=-1, int chi2Params=DefaultChi2) const
HistoryContainer * dissolve()
InDet::SiSpacePointsSeedMakerEventData EventData
bool sum(SimpleShape *&sum, SimpleShape *&reference) const
unsigned int nData() const
double chi2(int i, int lwb=-1, int upb=-1, int chi2Params=DefaultChi2, ShapeErrorType shapeErrorType=BestShapeError, unsigned int *nDof=0) const
storage of a pulse shape residual set
bool drawResiduals(int k=-1, bool errors=true, bool rescale=true) const
History(const HistoryContainer &container, const std::vector< const EventData * > &eventData, unsigned int hash, const AbsShapeErrorGetter *shapeErrorGetter=0)
Constructor
void setFitParams(Chi2Params params)
unsigned int nPoints() const
bool delta(unsigned int i, unsigned int sample, double &del) const
Data * tweak(const Data &data, int evtIndex=-1) const
void incrementInstanceCount() const
const DataContainer * dissolve()
Averager * calculatePedestal(int i) const
CaloGain::CaloGain gain() const
void setShapeErrorType(ShapeErrorType type)
const AbsShapeErrorGetter * shapeErrorGetter() const
bool drawAllWithReference(bool refit=false) const
const ShapeErrorData * shapeErrorData(CaloGain::CaloGain gain, ShapeErrorType shapeErrorType=BestShapeError, const Residual *res=0) const
unsigned int size() const
bool add(const Residual &residual)
double upstreamEnergy(unsigned int k) const
void add(const DataContainer *data)
append data (takes ownership)
void setError(unsigned int i, double error)
TVectorD deltas(unsigned int i, int lwb=-1, int upb=-1, bool correct=true) const
static bool isNone(double x)
bool drawWithReference(int i, const TString &atlasTitle="") const
bool data(const std::vector< unsigned int > &hashes, const EventData &event, std::vector< const Data * > &data) const
bool residualOffset(unsigned int i, short sample, double &offset, double adcMax=-1, double time=Definitions::none) const
TString description(unsigned int verbosity=1) const
const std::vector< const EventData * > & eventData() const
const ScaledErrorData * sed
static const unsigned int samplingInterval
unsigned int nDof() const
const CovMatrix errors(int first=-1, int last=-1) const
double value(unsigned int i) const
virtual ShapeErrorData * phiSymShapeErrorData(short ring, CaloGain::CaloGain gain, const Residual *toExclude=0) const =0
const TVectorD offsets(int first=-1, int last=-1) const
slightly more convenient legend class
unsigned int nDataContainers() const
double chi2(const AbsShape &data, const AbsShape &reference, const ScaledErrorData *shapeError=0, int lwb=-1, int upb=-1)