![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
40 const std::vector<const EventData*>& eventData,
unsigned hash,
42 : m_cellInfo(*container.cellInfo()),
43 m_eventData(eventData),
44 m_hash(
hash), m_shapeErrorGetter(shapeErrorGetter)
46 ClassCounts::incrementInstanceCount(
"History");
54 const std::vector<const EventData*>& eventData,
57 m_shapeErrorGetter(shapeErrorGetter)
79 for (
unsigned int k = 0;
k <
nData();
k++) {
90 if (
i >=
nData())
return nullptr;
97 for (
unsigned int k = 0;
k <
nData();
k++) {
127 if (
nData() == 0)
return false;
132 for (
unsigned int j = 0; j <
nData(); j++) {
133 if (
sum->nPoints() !=
m_data[j]->nSamples())
return false;
134 for (
unsigned int k = 0;
k <
m_data[j]->nSamples();
k++)
137 if (!thisRef) {
delete sum;
return false; }
152 if (
nData() == 0)
return false;
166 if (
m_data[
i]->isDisconnected())
return -1;
170 if (nDof) *nDof = c2c.
nDof();
182 if (oldGetter) combGetter->
add(*oldGetter);
183 combGetter->
add(*uniGetter);
185 double chi2Value =
chi2(
i, lwb, upb, chi2Params);
196 for (
unsigned int i = 0;
i <
nData();
i++) {
197 double chi2Value =
chi2(
i, lwb, upb, chi2Params);
206 if (
k >=
nData())
return nullptr;
215 if (!
result)
return nullptr;
223 if (
k >=
nData())
return false;
234 std::vector<const Data*> datas;
239 for (
unsigned int j = 0; j <
nData(); j++) {
242 for (
unsigned int k = 0;
k < datas.size();
k++)
delete datas[
k];
245 datas.push_back(refitData);
258 std::vector<const Data*> datas;
262 for (
unsigned int j = 0; j <
nData(); j++) {
265 for (
unsigned int k = 0;
k < datas.size();
k++)
delete datas[
k];
268 datas.push_back(newData);
282 if (!
f.set(
cuts))
return nullptr;
284 std::vector<const Data*> datas;
286 for (
unsigned int j = 0; j <
nData(); j++) {
287 if (!
f.pass(
hash(), *
this, j))
continue;
288 datas.push_back(
new Data(*
data(j)));
312 if (!
sed)
return nullptr;
321 if (!
sed)
return nullptr;
328 if (!
sed)
return nullptr;
337 if (!
sed)
return nullptr;
350 if (
k >=
nData() ||
data(
k)->adcMax() <= 0)
return nullptr;
353 if (!
sed)
return nullptr;
365 if (
k >=
nData())
return 0;
367 if (
dv.GetNrows() == 0)
return false;
375 if (
k >=
nData())
return TVectorD();
391 if (!sea)
return false;
402 if (!sea)
return false;
403 if (!sea->
isInRange(sample1) || !sea->
isInRange(sample2)) {
delete sea;
return false; }
415 for (
unsigned int j = 0; j <
nData(); j++) {
416 if (
m_data[j]->isDisconnected())
continue;
417 if (
m_data[j]->adcMax() < 1)
continue;
420 allData->
add(*thisData);
423 else allData = thisData;
426 allRef->
add(*thisRef);
429 else allRef = thisRef;
442 if (!
allShape(allData, allRef))
return -1;
443 double chi2Value = c2c.
chi2(*allData, *allRef);
452 if ((
unsigned int)
k >=
nData())
return false;
456 if (!refShape || !smpShape)
return false;
459 if (atlasTitle !=
"") {
476 if (!
sum(dataShape, refShape))
return false;
479 return drawer.drawAndDelete(
"", dataShape, refShape);
486 cout <<
"No data" << endl;
492 if (!refitted_history)
return false;
494 delete refitted_history;
501 std::vector<const AbsShape*> shapes;
503 for (
unsigned int i = 0;
i <
nData();
i++) {
504 if (
m_data[
i]->adcMax() < 1)
continue;
508 for (
unsigned int k = 0;
k < shape->
nPoints();
k++)
513 shapes.push_back(shape);
517 return drawer.drawAndDelete(Form(
"%s (Normalized Shape, max at 1000)",
cellInfo()->
location(2).
Data()), shapes, refShape, smpShape);
523 std::vector<const AbsShape*> shapes;
524 for (
unsigned int i = 0;
i <
nData();
i++) {
525 if (
m_data[
i]->adcMax() < 1)
continue;
526 if (
k >= 0 &&
k != (
int)
i)
continue;
530 if (!shape)
continue;
536 shapes.push_back(shape);
539 TString
title = (
rescale ?
"Normalized " :
"") + TString(
"residuals for %s");
545 bool samplesOnly)
const
548 if (adcMax < 0) adcMax =
m_data[
k]->adcMax();
557 if (
k >=
nData())
return nullptr;
566 if (
dv.GetNrows() == 0)
return nullptr;
576 for (
unsigned int i = 0;
i <
nData();
i++)
586 for (
unsigned int k = 0;
k <
nData();
k++) {
587 if (
i >= 0 &&
i != (
int)
k)
continue;
605 if (
k >=
nData())
return nullptr;
606 TVectorD del =
deltas(
k, -1, -1, correct);
608 (zeroTime ? 0 :
data(
k)->ofcTime() ));
617 for (
unsigned int k = 0;
k <
nData();
k++) {
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 ["
630 for (
int i =
res->lwb(); i < res->upb();
i++) {
631 if (absResCut > 0 && TMath::Abs(
res->scaledDelta(
i)) > absResCut) {
647 std::vector<unsigned int> upstreamNeighbors;
649 if (upstreamNeighbors.empty())
return -1;
650 std::vector<const Data*> unData;
652 double upstreamE = 0;
663 if (
nData() == 0 || chi2Cut <= 0)
return -1;
665 for (
unsigned int k = 0;
k <
nData();
k++)
if (
chi2(
k) > chi2Cut) nBadChi2++;
666 double effBad = nBadChi2/
nData();
667 double effRef = TMath::Prob(chi2Cut, nDof);
668 double dEff = sqrt(effRef*(1 - effRef))/sqrt(
nData());
669 if (dEff == 0) dEff = 1/sqrt(
nData());
670 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
def time(flags, cells_name, *args, **kw)
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)