ATLAS Offline Software
Loading...
Searching...
No Matches
LArSamples::Interface Class Reference

#include <Interface.h>

Inheritance diagram for LArSamples::Interface:
Collaboration diagram for LArSamples::Interface:

Public Member Functions

 Interface (std::unique_ptr< const Accessor > accessor)
 Constructor.
 Interface (const Interface &)=delete
Interfaceoperator= (const Interface &)=delete
virtual ~Interface ()
virtual unsigned int nEvents () const override
virtual unsigned int nRuns () const override
virtual const EventDataeventData (unsigned int i) const override
virtual const RunDatarunData (unsigned int i) const override
virtual unsigned int historySize (unsigned int i) const override
virtual unsigned int historySizeSC (unsigned int i) const override
HistoryIterator begin (unsigned int pos=0, double eMin=-1, double adcMaxMin=-1) const
unsigned int end () const
unsigned int size () const
unsigned int nFilledChannels () const
void printFilledRanges (unsigned int skip=0) const
bool highEData (double eCut, TArrayI &hashes, TArrayI &indices) const
HistoryIterator findEtaPhi (CaloId calo, short layer, short iEta, short iPhi, short region=0) const
HistoryIterator findFebChannel (CaloId calo, short feb, short channel) const
HistoryIterator findFTSlotChannel (CaloId calo, short ft, short slot, short channel) const
bool neighbors (const CellInfo &cell, double dRCut, std::vector< unsigned int > &hashes) const
bool firstNeighbors (unsigned int hash, std::vector< unsigned int > &hashes, short layer=-2) const
bool data (const std::vector< unsigned int > &hashes, const EventData &event, std::vector< std::unique_ptr< const Data > > &data) const
std::unique_ptr< Interfacemerge (const Interface &other, const TString &fileName) const
std::unique_ptr< Interfacemerge (const Interface &other, const TString &fileName, const TString &LBFile) const
std::unique_ptr< Interfacefilter (const TString &sel, const TString &fileName, const TString &tweaks="") const
std::unique_ptr< Interfacefilter (const FilterParams &filterParams, const DataTweaker &tweaker, const TString &fileName) const
std::unique_ptr< InterfacemakeTemplate (const TString &fileName) const
std::unique_ptr< Interfacerefit (const TString &newFileName, Chi2Params pars=DefaultChi2) const
const Accessoraccessor () const
bool isValid () const
TH1D * Draw (const TString &var, int nBins, double xMin, double xMax, const TString &sel="", const TString &opt="") const
TH2D * Draw (const TString &varList, int nBinsX, double xMin, double xMax, int nBinsY, double yMin, double yMax, const TString &sel="", const TString &opt="") const
TH2D * DrawPartition (PartitionId partition, const TString &var, const TString &sel="", const TString &opt="", CombinationType comb=TotalValue) const
TH2D * DrawEtaPhi (CaloId calo, short layer, const TString &var, const TString &sel="", const TString &opt="", CombinationType comb=TotalValue) const
bool Scan (const TString &vars, const TString &sel="", unsigned int verbosity=1) const
bool Scan (const TString &vars, CombinationType comb, const TString &sel="", const TString &ranges="", unsigned int verbosity=1) const
bool Show (unsigned int hash, unsigned int verbosity=1) const
bool Show (const TString &sel="", unsigned int verbosity=1) const
bool ShowEvents (const TString &sel="", unsigned int verbosity=1) const
bool ShowRuns (unsigned int verbosity=1) const
bool ShowStats (const TString &varList, const TString &sel="", bool withErrors=false) const
OccupancyMonitor occupancyMonitor () const
DigitMonitor digitMonitor () const
FitMonitor fitMonitor () const
bool dumpEventTuple (const TString &variables, const TString &fileName) const
void setShapeErrorGetter (const AbsShapeErrorGetter *err)
void setShapeError (double k)
void setShapeError (const TString &fileName)
const AbsShapeErrorGettershapeErrorGetter () const
virtual bool writeToFile (const TString &fileName) const override
virtual const HistorycellHistory (unsigned int i) const override
virtual std::unique_ptr< const HistorygetCellHistory (unsigned int i) const override
virtual std::unique_ptr< const HistorygetSCHistory (unsigned int i) const override
virtual std::unique_ptr< const CellInfogetCellInfo (unsigned int i) const override
virtual std::unique_ptr< const HistorynewCellHistory (unsigned int i) const
virtual std::unique_ptr< const CellInfocellInfo (unsigned int i) const
virtual unsigned int nChannels () const
virtual unsigned int nChannelsSC () const
virtual void resetCache () const
const CellInfocellInfoCache (unsigned int i) const
const Historypass (unsigned int i, const FilterParams &f) const
const HistorycellCache () const
unsigned int cachePos () const

Static Public Member Functions

static std::unique_ptr< Interfaceopen (const TString &fileName)
static std::unique_ptr< Interfaceopen (const std::vector< TString > &fileNames)
static std::unique_ptr< InterfaceopenList (const TString &fileList)
static std::unique_ptr< InterfaceopenWild (const TString &wcName)
static std::unique_ptr< Interfacemerge (const std::vector< const Interface * > &interfaces, const TString &fileName)
static std::unique_ptr< Interfacemerge (const std::vector< const Interface * > &interfaces, const TString &fileName, const TString &LBFile)
static std::unique_ptr< Interfacemerge (const TString &listFileName, const TString &fileName)
static std::unique_ptr< Interfacemerge (const TString &listFileName, const TString &fileName, const TString &LBFile)
static bool filterAndMerge (const TString &listFileName, const TString &outFile, const TString &filters, const TString &tweaks="")
static TString addSuffix (const TString &fileName, const TString &suffix)

Private Types

using CacheEntry_t = std::pair<bool, std::vector<unsigned int> >

Private Attributes

std::unique_ptr< const Accessorm_accessor
const AbsShapeErrorGetterm_shapeErrorGetter
std::unique_ptr< const AbsShapeErrorGetterm_ownedShapeErrorGetter
std::vector< CacheEntry_tm_neighborCache
std::vector< unsigned int > m_neighborHistoryPos
std::vector< std::unique_ptr< const History > > m_neighborHistories
unsigned int m_pos
std::unique_ptr< const Historym_cellCache
std::vector< std::unique_ptr< CellInfo > > m_cellInfoCache

Detailed Description

Definition at line 37 of file Interface.h.

Member Typedef Documentation

◆ CacheEntry_t

using LArSamples::Interface::CacheEntry_t = std::pair<bool, std::vector<unsigned int> >
private

Definition at line 142 of file Interface.h.

Constructor & Destructor Documentation

◆ Interface() [1/2]

Interface::Interface ( std::unique_ptr< const Accessor > accessor)

Constructor.

Definition at line 74 of file Interface.cxx.

76{
77}
virtual unsigned int nChannels() const
Definition AbsLArCells.h:35
const Accessor & accessor() const
Definition Interface.h:96
const AbsShapeErrorGetter * m_shapeErrorGetter
Definition Interface.h:139
std::vector< CacheEntry_t > m_neighborCache
Definition Interface.h:143
std::unique_ptr< const Accessor > m_accessor
Definition Interface.h:138

◆ Interface() [2/2]

LArSamples::Interface::Interface ( const Interface & )
delete

◆ ~Interface()

Interface::~Interface ( )
virtual

Definition at line 79 of file Interface.cxx.

80{
81}

Member Function Documentation

◆ accessor()

const Accessor & LArSamples::Interface::accessor ( ) const
inline

Definition at line 96 of file Interface.h.

96{ return *m_accessor; }

◆ addSuffix()

TString Interface::addSuffix ( const TString & fileName,
const TString & suffix )
static

Definition at line 374 of file Interface.cxx.

375{
376 TString rootName = fileName;
377 if (fileName(fileName.Length() - 5, 5) == ".root") rootName = fileName(0, fileName.Length() - 5);
378
379 return rootName + "_" + suffix + ".root";
380}

◆ begin()

HistoryIterator Interface::begin ( unsigned int pos = 0,
double eMin = -1,
double adcMaxMin = -1 ) const

Definition at line 191 of file Interface.cxx.

192{
193 return HistoryIterator(*this, pos, eMin, adcMaxMin);
194}

◆ cachePos()

unsigned int LArSamples::AbsLArCells::cachePos ( ) const
inlineinherited

Definition at line 49 of file AbsLArCells.h.

49{ return m_pos; }

◆ cellCache()

const History * LArSamples::AbsLArCells::cellCache ( ) const
inlineinherited

Definition at line 48 of file AbsLArCells.h.

48{ return m_cellCache.get(); }
std::unique_ptr< const History > m_cellCache
Definition AbsLArCells.h:55

◆ cellHistory()

const History * Interface::cellHistory ( unsigned int i) const
overridevirtual

Reimplemented from LArSamples::AbsLArCells.

Definition at line 134 of file Interface.cxx.

135{
136 const History* history = accessor().cellHistory(i);
137 if (history) {
139 history->setInterface(this);
140 }
141 return history;
142}
virtual const History * cellHistory(unsigned int i) const
void setShapeErrorGetter(const AbsShapeErrorGetter *err) const
Definition History.h:93
void setInterface(const Interface *interface) const
Definition History.h:113

◆ cellInfo()

std::unique_ptr< const CellInfo > AbsLArCells::cellInfo ( unsigned int i) const
virtualinherited

Definition at line 66 of file AbsLArCells.cxx.

67{
68 const CellInfo* info = cellInfoCache(i);
69 if (info) {
70 if (info->isValid()) {
71 return std::make_unique<CellInfo> (*info);
72 }
73 return nullptr;
74 }
75 std::unique_ptr<const CellInfo> infop = getCellInfo(i);
76 if (infop) m_cellInfoCache[i] = std::make_unique<CellInfo>(*infop, false);
77 return infop;
78}
virtual std::unique_ptr< const CellInfo > getCellInfo(unsigned int i) const
std::vector< std::unique_ptr< CellInfo > > m_cellInfoCache
Definition AbsLArCells.h:56
const CellInfo * cellInfoCache(unsigned int i) const

◆ cellInfoCache()

const CellInfo * AbsLArCells::cellInfoCache ( unsigned int i) const
inherited

Definition at line 81 of file AbsLArCells.cxx.

82{
83 return m_cellInfoCache[i].get();
84}

◆ data()

bool Interface::data ( const std::vector< unsigned int > & hashes,
const EventData & event,
std::vector< std::unique_ptr< const Data > > & data ) const

Definition at line 757 of file Interface.cxx.

759{
760 if (hashes != m_neighborHistoryPos) {
761 m_neighborHistories.clear();
762 m_neighborHistoryPos.clear();
763 for (std::vector<unsigned int>::const_iterator hash = hashes.begin(); hash != hashes.end(); ++hash) {
764 std::unique_ptr<const History> history = AbsLArCells::newCellHistory(*hash);// bypasses history caching in order not to invalidate cell
765 m_neighborHistories.emplace_back(std::move(history));
766 m_neighborHistoryPos.push_back(*hash);
767 }
768 }
769
770 for (const std::unique_ptr<const History>& history : m_neighborHistories) {
771 if (!history) continue;
772 const Data* dataForEvent = history->data_for_event(event);
773 if (dataForEvent) data.push_back(std::make_unique<Data>(*dataForEvent));
774 }
775 return true;
776}
@ Data
Definition BaseObject.h:11
virtual std::unique_ptr< const History > newCellHistory(unsigned int i) const
bool data(const std::vector< unsigned int > &hashes, const EventData &event, std::vector< std::unique_ptr< const Data > > &data) const
std::vector< unsigned int > m_neighborHistoryPos
Definition Interface.h:144
std::vector< std::unique_ptr< const History > > m_neighborHistories
Definition Interface.h:145

◆ digitMonitor()

DigitMonitor LArSamples::Interface::digitMonitor ( ) const
inline

Definition at line 117 of file Interface.h.

117{ return DigitMonitor(*this); }

◆ Draw() [1/2]

TH1D * Interface::Draw ( const TString & var,
int nBins,
double xMin,
double xMax,
const TString & sel = "",
const TString & opt = "" ) const

Definition at line 455 of file Interface.cxx.

456{
457 MonitorBase m(*this);
458 FilterParams f;
459 if (!f.set(sel)) return nullptr;
460
461 std::vector<TString> vars;
462 std::vector<DataFuncSet> funcs;
463 std::vector<DataFuncArgs> args;
464 if (!MonitorBase::parseVariables(var, vars, funcs, args) || funcs.size() != 1) {
465 cout << "Invalid variable specification " << var << endl;
466 return nullptr;
467 }
468
469 TString title = vars[0];
470 if (TString(sel) != "") title = title + ", " + sel;
471
472 TH1D* h = m.dist(funcs[0], args[0], vars[0], nBins, xMin, xMax,
473 title, vars[0], "digits", f);
474 if (!h) return nullptr;
475 h->Draw(opt);
476 return h;
477}
static bool parseVariables(TString varStr, std::vector< TString > &vars, std::vector< DataFuncSet > &funcs, std::vector< DataFuncArgs > &args)

◆ Draw() [2/2]

TH2D * Interface::Draw ( const TString & varList,
int nBinsX,
double xMin,
double xMax,
int nBinsY,
double yMin,
double yMax,
const TString & sel = "",
const TString & opt = "" ) const

Definition at line 480 of file Interface.cxx.

483{
484 MonitorBase m(*this);
485 FilterParams f;
486 if (!f.set(sel)) return nullptr;
487
488 std::vector<TString> vars;
489 std::vector<DataFuncSet> funcs;
490 std::vector<DataFuncArgs> args;
491 if (!MonitorBase::parseVariables(varList, vars, funcs, args) || funcs.size() != 2) {
492 cout << "Invalid variable specification " << varList << endl;
493 return nullptr;
494 }
495
496 TString title = vars[1] + " vs. " + vars[0];
497
498 if (TString(sel) != "") title = title + ", " + sel;
499 TH2D* h = m.dist(funcs[0], args[0], funcs[1], args[1], vars[0] + "_" + vars[1],
500 nBinsX, xMin, xMax, nBinsY, yMin, yMax,
501 title, vars[0], vars[1], f);
502 if (!h) return nullptr;
503 h->Draw(opt);
504 return h;
505}

◆ DrawEtaPhi()

TH2D * Interface::DrawEtaPhi ( CaloId calo,
short layer,
const TString & var,
const TString & sel = "",
const TString & opt = "",
CombinationType comb = TotalValue ) const

Definition at line 535 of file Interface.cxx.

538{
539 MonitorBase m(*this);
540 FilterParams f;
541 if (!f.set(sel)) return nullptr;
542
543 std::vector<TString> vars;
544 std::vector<DataFuncSet> funcs;
545 std::vector<DataFuncArgs> args;
546 if (!MonitorBase::parseVariables(var, vars, funcs, args) || funcs.size() != 1) {
547 cout << "Invalid variable specification " << var << endl;
548 return nullptr;
549 }
550 TString title = var;
551 title += Form(", %s, layer %d", Id::str(calo).Data(), layer);
552 if (TString(sel) != "") title = title + ", " + sel;
553
554 TH2D* h = m.etaPhiMap(funcs[0], args[0], var, calo, layer, title, comb, f);
555 if (!h) return nullptr;
556 h->Draw(opt);
557 return h;
558}
static TString str(CaloId id)
Definition CaloId.cxx:15

◆ DrawPartition()

TH2D * Interface::DrawPartition ( PartitionId partition,
const TString & var,
const TString & sel = "",
const TString & opt = "",
CombinationType comb = TotalValue ) const

Definition at line 508 of file Interface.cxx.

511{
512 MonitorBase m(*this);
513 FilterParams f;
514 if (!f.set(sel)) return nullptr;
515
516 std::vector<TString> vars;
517 std::vector<DataFuncSet> funcs;
518 std::vector<DataFuncArgs> args;
519 if (!MonitorBase::parseVariables(var, vars, funcs, args) || funcs.size() != 1) {
520 cout << "Invalid variable specification " << var << endl;
521 return nullptr;
522 }
523
524 TString title = var;
525 title = title + ", " + Id::str(partition);
526 if (TString(sel) != "") title = title + ", " + sel;
527
528 TH2D* h = m.partitionMap(funcs[0], args[0], var, partition, title, comb, f);
529 if (!h) return nullptr;
530 h->Draw(opt);
531 return h;
532}

◆ dumpEventTuple()

bool Interface::dumpEventTuple ( const TString & variables,
const TString & fileName ) const

Definition at line 779 of file Interface.cxx.

780{
781 std::vector<float> floatVars;
782 std::vector<int> intVars;
783 std::vector<std::vector<float> > floatVects;
784 std::vector<std::vector<int> > intVects;
785 std::map<TString, unsigned int> varIndex;
786
787 std::vector<TString> vars;
788 std::vector<DataFuncSet> funcs;
789 std::vector<DataFuncArgs> args;
790 if (!MonitorBase::parseVariables(variables, vars, funcs, args)) return false;
791
792 cout << "Making trees..." << endl;
793
794 std::unique_ptr<TFile> flatFile (TFile::Open(fileName + "_tmpFlatFile.root", "RECREATE"));
795 TTree flatTree = TTree("flatTree", "Flat tree");
796
797 std::unique_ptr<TFile> eventFile (TFile::Open(fileName, "RECREATE"));
798 TTree eventTree ("eventTree", "Event tree");
799
800 // Ensure that the contents of the vectors won't move.
801 intVars.reserve (vars.size());
802 intVects.reserve (vars.size());
803 floatVars.reserve (vars.size());
804 floatVects.reserve (vars.size());
805
806 for (unsigned int j = 0; j < vars.size(); j++) {
807 unsigned int index = 0;
808 if (funcs[j].isNull()) return false;
809 if (funcs[j].isInt()) {
810 index = intVars.size();
811 intVars.push_back(0);
812 intVects.push_back (std::vector<int>());
813 flatTree.Branch(vars[j], &intVars.back());
814 eventTree.Branch(vars[j], &intVects.back());
815 }
816 else {
817 index = floatVars.size();
818 floatVars.push_back(0);
819 floatVects.push_back(std::vector<float>());
820 flatTree.Branch(vars[j], &floatVars.back());
821 eventTree.Branch(vars[j], &floatVects.back());
822 }
823 varIndex[vars[j]] = index;
824 cout << vars[j] << " -> " << index << endl;
825 }
826 std::map< unsigned int, std::map< unsigned int, std::vector<long long> > > runEventIndices;
827 cout << "Making flat ntuple" << endl;
828 unsigned int count = 0;
829 for (HistoryIterator iter = begin(); iter.isValid(); iter.next()) {
830 const History* hist = iter.history();
831 count++;
832 if (count % 100 == 0) cout << "Processing entry " << count << " (hash = " << iter.pos() << "), size = " << hist->nData() << endl;
833 for (unsigned int k = 0; k < hist->nData(); k++) {
834 for (unsigned int j = 0; j < vars.size(); j++) {
835 if (funcs[j].isInt())
836 intVars[varIndex[vars[j]]] = int(funcs[j].intVal(*hist->data(k), args[j]));
837 else
838 floatVars[varIndex[vars[j]]] = funcs[j].doubleVal(*hist->data(k), args[j]);
839 }
840 runEventIndices[hist->data(k)->run()][hist->data(k)->event()].push_back(flatTree.GetEntries());
841 flatTree.Fill();
842 }
843 }
844
845 cout << "Making event tuple" << endl;
846 unsigned int runCount = 0;
847 for (const auto& run : runEventIndices) {
848 runCount++;
849 cout << "Processing run " << run.first << " (" << runCount << " of " << runEventIndices.size() << ")" << endl;
850 unsigned int eventCount = 0;
851 for (const auto& event : run.second) {
852 eventCount++;
853 if (eventCount % 1000 == 0)
854 cout << " processing event " << event.first << " (" << eventCount << " of " << run.second.size() << "), size = " << event.second.size() << endl;
855 for (std::vector<int>& v : intVects) v.clear();
856 for (std::vector<float>& v : floatVects) v.clear();
857 for (long long index : event.second) {
858 flatTree.GetEntry(index);
859 for (unsigned int j = 0; j < vars.size(); j++) {
860 size_t vi = varIndex[vars[j]];
861 if (funcs[j].isInt())
862 intVects[vi].push_back(intVars[vi]);
863 else
864 floatVects[vi].push_back(floatVars[vi]);
865 }
866 }
867 eventTree.Fill();
868 }
869 }
870
871 cout << "Writing data..." << endl;
872 flatFile->cd();
873 flatTree.Write();
874 eventFile->cd();
875 eventTree.Write();
876
877 cout << "Done!" << endl;
878 return true;
879}
HistoryIterator begin(unsigned int pos=0, double eMin=-1, double adcMaxMin=-1) const
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
str index
Definition DeMoScan.py:362
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
int run(int argc, char *argv[])

◆ end()

unsigned int LArSamples::Interface::end ( ) const
inline

Definition at line 63 of file Interface.h.

63{ return nChannels(); }

◆ eventData()

virtual const EventData * LArSamples::Interface::eventData ( unsigned int i) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 56 of file Interface.h.

56{ return accessor().eventData(i); }
virtual const EventData * eventData(unsigned int i) const =0

◆ filter() [1/2]

std::unique_ptr< Interface > Interface::filter ( const FilterParams & filterParams,
const DataTweaker & tweaker,
const TString & fileName ) const

Definition at line 383 of file Interface.cxx.

384{
385 std::unique_ptr<TreeAccessor> newAcc = TreeAccessor::filter(accessor(), filterParams, fileName, tweaker);
386 return std::make_unique<Interface>(std::move(newAcc));
387}
static std::unique_ptr< TreeAccessor > filter(const Accessor &accessor, const FilterParams &filterParams, const TString &fileName, const DataTweaker &tweaker)

◆ filter() [2/2]

std::unique_ptr< Interface > Interface::filter ( const TString & sel,
const TString & fileName,
const TString & tweaks = "" ) const

Definition at line 355 of file Interface.cxx.

356{
357 FilterParams f;
358 if (!f.set(sel)) return nullptr;
359
360 DataTweaker tweak;
361 if (!tweak.set(tweaks)) return nullptr;
362
363 TString thisFN = fileName;
364 if (thisFN.Index(".root") < 0 && dynamic_cast<const TreeAccessor*>(&accessor())) {
365 auto pAccess = dynamic_cast<const TreeAccessor*>(&accessor());
366 if (not pAccess) return nullptr;
367 TString newFN = addSuffix(pAccess->fileName(), fileName);
368 if (newFN != "") thisFN = std::move(newFN);
369 }
370 return filter(f, tweak, thisFN);
371}
bool set(const TString &tweaks)
std::unique_ptr< Interface > filter(const TString &sel, const TString &fileName, const TString &tweaks="") const
static TString addSuffix(const TString &fileName, const TString &suffix)

◆ filterAndMerge()

bool Interface::filterAndMerge ( const TString & listFileName,
const TString & outFile,
const TString & filters,
const TString & tweaks = "" )
static

Definition at line 296 of file Interface.cxx.

297{
298 FilterList filterList;
299
300 std::unique_ptr<TObjArray> list (filters.Tokenize(",;"));
301 if (list->GetEntries() == 0) {
302 cout << "No filtering specified, exiting.";
303 return 0;
304 }
305
306 for (int k = 0; k < list->GetEntries(); k++) {
307 TObjString* tobs = (TObjString*)(list->At(k));
308 std::unique_ptr<TObjArray> items (tobs->String().Tokenize(":"));
309 if (items->GetEntries() != 2) {
310 cout << "Invalid filter entry " << tobs->String() << ", exiting." << endl;
311 return 0;
312 }
313 TString params = ((TObjString*)(items->At(0)))->String();
314 TString suffix = ((TObjString*)(items->At(1)))->String();
315 FilterParams f;
316 if (!f.set(params)) return 0;
317 cout << "---" << endl;
318 filterList.add(f, addSuffix(outFile, suffix));
319 }
320
321
322 DataTweaker tweak;
323 if (!tweak.set(tweaks)) return 0;
324
325 std::unique_ptr<const Interface> multi = openList(listFileName);
326 if (!multi) return 0;
327 const MultiTreeAccessor* mt = dynamic_cast<const MultiTreeAccessor*>(&multi->accessor());
328 if (!mt){
329 return 0;
330 }
331 std::vector<std::unique_ptr<MultiTreeAccessor> > filtered_mts = mt->filterComponents(filterList, tweak);
332 if (filtered_mts.size() != filterList.size()){
333 return 0;
334 }
335 cout << "Component filtering done!" << endl;
336 // The following line should work, but doesn't... so the block of code below replaces it.
337 //Interface* filtered_multi = new Interface(*filtered_mt);
338 //
339 for (unsigned int f = 0; f < filtered_mts.size(); f++) {
340 std::vector<TString> files;
341 for (unsigned int i = 0; i < filtered_mts[f]->nAccessors(); i++) {
342 files.push_back(((const TreeAccessor*)&filtered_mts[f]->accessor(i))->fileName());
343 cout << "Added " << files.back() << endl;
344 }
345 std::unique_ptr<const Interface> filtered_multi = open(files);
346 //
347 std::vector<const Interface*> justOne { filtered_multi.get() };
348 std::unique_ptr<Interface> interface = merge(justOne, filterList.fileName(f));
349 }
350
351 return true;
352}
void add(const FilterParams &params, const TString &fileName)
Definition FilterList.h:27
unsigned int size() const
Definition FilterList.h:29
static std::unique_ptr< Interface > open(const TString &fileName)
Definition Interface.cxx:35
std::unique_ptr< Interface > merge(const Interface &other, const TString &fileName) const
static std::unique_ptr< Interface > openList(const TString &fileList)
Definition Interface.cxx:54
std::vector< std::unique_ptr< MultiTreeAccessor > > filterComponents(const FilterList &filterList, const DataTweaker &tweaker) const
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:50
list(name, path='/')
Definition histSizes.py:38

◆ findEtaPhi()

HistoryIterator Interface::findEtaPhi ( CaloId calo,
short layer,
short iEta,
short iPhi,
short region = 0 ) const

Definition at line 407 of file Interface.cxx.

408{
409 for (unsigned int i = 0; i < nChannels(); i++) {
410 std::unique_ptr<const CellInfo> info = cellInfo(i);
411 if (!info) continue;
412 if (!Id::matchCalo(info->calo(), calo)) continue;
413 if (info->layer() != layer) continue;
414 if (info->iEta() != iEta) continue;
415 if (info->iPhi() != iPhi) continue;
416 if (info->region() != region) continue;
417 return HistoryIterator(*this, i);
418 }
419
420 return HistoryIterator(*this, end());
421}
virtual std::unique_ptr< const CellInfo > cellInfo(unsigned int i) const
static bool matchCalo(CaloId id, CaloId idSpec)
Definition CaloId.cxx:188
unsigned int end() const
Definition Interface.h:63

◆ findFebChannel()

HistoryIterator Interface::findFebChannel ( CaloId calo,
short feb,
short channel ) const

Definition at line 424 of file Interface.cxx.

425{
426 for (unsigned int i = 0; i < nChannels(); i++) {
427 std::unique_ptr<const CellInfo> info = cellInfo(i);
428 if (!info) continue;
429 if (!Id::matchCalo(info->calo(), calo)) continue;
430 if (info->feb() != feb) continue;
431 if (info->channel() != channel) continue;
432 return HistoryIterator(*this, i);
433 }
434
435 return HistoryIterator(*this, end());
436}

◆ findFTSlotChannel()

HistoryIterator Interface::findFTSlotChannel ( CaloId calo,
short ft,
short slot,
short channel ) const

Definition at line 439 of file Interface.cxx.

440{
441 for (unsigned int i = 0; i < nChannels(); i++) {
442 std::unique_ptr<const CellInfo> info = cellInfo(i);
443 if (!info) continue;
444 if (!Id::matchCalo(info->calo(), calo)) continue;
445 if (ft >= 0 && info->feedThrough() != ft) continue;
446 if (slot >= 0 && info->slot() != slot) continue;
447 if (channel >= 0 && info->channel() != channel) continue;
448 return HistoryIterator(*this, i);
449 }
450
451 return HistoryIterator(*this, end());
452}

◆ firstNeighbors()

bool Interface::firstNeighbors ( unsigned int hash,
std::vector< unsigned int > & hashes,
short layer = -2 ) const

Definition at line 736 of file Interface.cxx.

737{
738 std::unique_ptr<const CellInfo> cell = cellInfo(hash);
739 if (!cell) return true;
740 if (!Id::matchCalo(cell->calo(), HEC)) return false; // for now!
741 if (layer < 0) return true;
742 std::vector<unsigned int> allHashes;
744 if (!cache.first) {
745 if (!neighbors(*cell, 0.15, cache.second)) return false;
746 cache.first = true;
747 }
748 for (unsigned int h : cache.second) {
749 std::unique_ptr<const CellInfo> info = cellInfo(h);
750 if (!info) continue;
751 if (info->layer() == layer) hashes.push_back(h);
752 }
753 return true;
754}
std::pair< bool, std::vector< unsigned int > > CacheEntry_t
Definition Interface.h:142
bool neighbors(const CellInfo &cell, double dRCut, std::vector< unsigned int > &hashes) const

◆ fitMonitor()

FitMonitor LArSamples::Interface::fitMonitor ( ) const
inline

Definition at line 118 of file Interface.h.

118{ return FitMonitor(*this); }

◆ getCellHistory()

std::unique_ptr< const History > Interface::getCellHistory ( unsigned int i) const
overridevirtual

Implements LArSamples::AbsLArCells.

Definition at line 114 of file Interface.cxx.

115{
116 std::unique_ptr<const History> history = accessor().getCellHistory(i);
117 if (history) {
118 history->setShapeErrorGetter(m_shapeErrorGetter);
119 history->setInterface(this);
120 }
121 return history;
122}
virtual std::unique_ptr< const History > getCellHistory(unsigned int i) const =0

◆ getCellInfo()

std::unique_ptr< const CellInfo > Interface::getCellInfo ( unsigned int i) const
overridevirtual

Reimplemented from LArSamples::AbsLArCells.

Definition at line 145 of file Interface.cxx.

146{
147 return accessor().getCellInfo(i);
148}

◆ getSCHistory()

std::unique_ptr< const History > Interface::getSCHistory ( unsigned int i) const
overridevirtual

Implements LArSamples::AbsLArCells.

Definition at line 124 of file Interface.cxx.

125{
126 std::unique_ptr<const History> history = accessor().getSCHistory(i);
127 if (history) {
128 history->setInterface(this);
129 }
130 return history;
131}
virtual std::unique_ptr< const History > getSCHistory(unsigned int i) const =0

◆ highEData()

bool Interface::highEData ( double eCut,
TArrayI & hashes,
TArrayI & indices ) const

Definition at line 197 of file Interface.cxx.

198{
199 std::vector<unsigned int> hashV, indexV;
200 unsigned int nTot = 0;
201
202 for (unsigned int i = 0; i < nChannels(); i++) {
203 const History* history = cellHistory(i);
204 if (!history) continue;
205 for (unsigned int j = 0; j < history->nData(); j++) {
206 const Data& data = *history->data(j);
207 nTot++;
208 if (data.isDisconnected()) continue;
209 if (nTot % 10000 == 0) cout << nTot << endl;
210 if (data.energy() > eCut) {
211 cout << "E = " << data.energy() << " " << i << " " << j << endl;
212 hashV.push_back(i);
213 indexV.push_back(j);
214 }
215 }
216 }
217
218 hashes.Set(hashV.size());
219 indices.Set(indexV.size());
220
221 for (unsigned int i = 0; i < hashV.size(); i++) {
222 hashes[i] = hashV[i];
223 indices[i] = indexV[i];
224 }
225
226 cout << hashV.size() << "/" << nTot << endl;
227 return true;
228}
const Data * data(unsigned int i) const
Definition History.cxx:88
unsigned int nData() const
Definition History.h:54
virtual const History * cellHistory(unsigned int i) const override
std::pair< long int, long int > indices

◆ historySize()

virtual unsigned int LArSamples::Interface::historySize ( unsigned int i) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 59 of file Interface.h.

59{ return accessor().historySize(i); }
virtual unsigned int historySize(unsigned int i) const =0

◆ historySizeSC()

virtual unsigned int LArSamples::Interface::historySizeSC ( unsigned int i) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 60 of file Interface.h.

60{ return accessor().historySizeSC(i); }
virtual unsigned int historySizeSC(unsigned int i) const =0

◆ isValid()

bool Interface::isValid ( ) const

Definition at line 231 of file Interface.cxx.

232{
233 for (unsigned int i = 0; i < nChannels(); i++) {
234 const History* history = cellHistory(i);
235 if (!history) continue;
236 if (!history->isValid()) {
237 cout << "Invalid LArSamplesHistory at hash = " << i << endl;
238 return false;
239 }
240 }
241
242 return true;
243}
bool isValid() const
Definition History.cxx:149

◆ makeTemplate()

std::unique_ptr< Interface > Interface::makeTemplate ( const TString & fileName) const

Definition at line 390 of file Interface.cxx.

391{
392 std::unique_ptr<TreeAccessor> newAcc = TreeAccessor::makeTemplate(accessor(), fileName);
393 return std::make_unique<Interface>(std::move(newAcc));
394}
static std::unique_ptr< TreeAccessor > makeTemplate(const Accessor &accessor, const TString &fileName)

◆ merge() [1/6]

std::unique_ptr< Interface > Interface::merge ( const Interface & other,
const TString & fileName ) const

Definition at line 246 of file Interface.cxx.

247{
248 std::vector<const Interface*> interfaces { this, &other };
249 return merge(interfaces, fileName);
250}

◆ merge() [2/6]

std::unique_ptr< Interface > Interface::merge ( const Interface & other,
const TString & fileName,
const TString & LBFile ) const

Definition at line 262 of file Interface.cxx.

263{
264 std::vector<const Interface*> interfaces { this, &other };
265 return merge(interfaces, fileName, LBFile);
266}

◆ merge() [3/6]

std::unique_ptr< Interface > Interface::merge ( const std::vector< const Interface * > & interfaces,
const TString & fileName )
static

Definition at line 253 of file Interface.cxx.

254{
255 std::vector<const Accessor*> accessors;
256 for (unsigned int i = 0; i < interfaces.size(); i++)
257 accessors.push_back(&interfaces[i]->accessor());
258 std::unique_ptr<TreeAccessor> newAccessor = TreeAccessor::merge(accessors, fileName);
259 return std::make_unique<Interface>(std::move(newAccessor));
260}
static std::unique_ptr< TreeAccessor > merge(const std::vector< const Accessor * > &accessors, const TString &fileName="")

◆ merge() [4/6]

std::unique_ptr< Interface > Interface::merge ( const std::vector< const Interface * > & interfaces,
const TString & fileName,
const TString & LBFile )
static

Definition at line 269 of file Interface.cxx.

270{
271 std::vector<const Accessor*> accessors;
272 for (unsigned int i = 0; i < interfaces.size(); i++)
273 accessors.push_back(&interfaces[i]->accessor());
274 std::unique_ptr<TreeAccessor> newAccessor = TreeAccessor::merge(accessors, fileName, LBFile);
275 return std::make_unique<Interface>(std::move(newAccessor));
276}

◆ merge() [5/6]

std::unique_ptr< Interface > Interface::merge ( const TString & listFileName,
const TString & fileName )
static

Definition at line 279 of file Interface.cxx.

280{
281 std::unique_ptr<const Interface> multi = openList(listFileName);
282 if (!multi) return nullptr;
283 std::vector<const Interface*> justOne { multi.get() };
284 return merge(justOne, fileName);
285}

◆ merge() [6/6]

std::unique_ptr< Interface > Interface::merge ( const TString & listFileName,
const TString & fileName,
const TString & LBFile )
static

Definition at line 287 of file Interface.cxx.

288{
289 std::unique_ptr<const Interface> multi = openList(listFileName);
290 if (!multi) return nullptr;
291 std::vector<const Interface*> justOne { multi.get() };
292 return merge(justOne, fileName, LBFile);
293}

◆ nChannels()

virtual unsigned int LArSamples::AbsLArCells::nChannels ( ) const
inlinevirtualinherited

Reimplemented in LArSamples::MonitorBase.

Definition at line 35 of file AbsLArCells.h.

◆ nChannelsSC()

virtual unsigned int LArSamples::AbsLArCells::nChannelsSC ( ) const
inlinevirtualinherited

Definition at line 36 of file AbsLArCells.h.

◆ neighbors()

bool Interface::neighbors ( const CellInfo & cell,
double dRCut,
std::vector< unsigned int > & hashes ) const

Definition at line 723 of file Interface.cxx.

724{
725 for (unsigned int i = 0; i < nChannels(); i++) {
726 std::unique_ptr<const CellInfo> otherCell = cellInfo(i);
727 if (!otherCell) continue;
728 if (cell.position().DeltaR(otherCell->position()) > dRCut) continue;
729 //cout << "Adding hash = " << i << " " << otherCell->location(3) << endl;
730 hashes.push_back(i);
731 }
732 return true;
733}

◆ nEvents()

virtual unsigned int LArSamples::Interface::nEvents ( ) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 53 of file Interface.h.

53{ return accessor().nEvents(); }
virtual unsigned int nEvents() const =0

◆ newCellHistory()

std::unique_ptr< const History > AbsLArCells::newCellHistory ( unsigned int i) const
virtualinherited

Definition at line 39 of file AbsLArCells.cxx.

40{
41 std::unique_ptr<const History> history = getCellHistory(i);
42 if (!history) return nullptr;
43 if (!m_cellInfoCache[i]) {
44 const CellInfo* ci=history->cellInfo();
45 if (ci) {
46 m_cellInfoCache[i]=std::make_unique<CellInfo>(*ci,false);
47 }
48 }
49 // m_cellInfoCache[i] = (history->cellInfo() ? new CellInfo(*history->cellInfo(), false) : new CellInfo());
50 return history;
51}

◆ nFilledChannels()

unsigned int Interface::nFilledChannels ( ) const

Definition at line 151 of file Interface.cxx.

152{
153 unsigned int n = 0;
154 for (unsigned int i = 0; i < nChannels(); i++)
155 n += (accessor().historySize(i) ? 1 : 0);
156 return n;
157}
virtual unsigned int historySize(unsigned int i) const override
Definition Interface.h:59

◆ nRuns()

virtual unsigned int LArSamples::Interface::nRuns ( ) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 54 of file Interface.h.

54{ return accessor().nRuns(); }
virtual unsigned int nRuns() const =0

◆ occupancyMonitor()

OccupancyMonitor LArSamples::Interface::occupancyMonitor ( ) const
inline

Definition at line 116 of file Interface.h.

116{ return OccupancyMonitor(*this); }

◆ open() [1/2]

std::unique_ptr< Interface > Interface::open ( const std::vector< TString > & fileNames)
static

Definition at line 44 of file Interface.cxx.

45{
46 std::unique_ptr<MultiTreeAccessor> accessor = MultiTreeAccessor::open(fileNames);
47 if (accessor) {
48 return std::make_unique<Interface> (std::move(accessor));
49 }
50 return nullptr;
51}
static std::unique_ptr< MultiTreeAccessor > open(const std::vector< TString > &files)

◆ open() [2/2]

std::unique_ptr< Interface > Interface::open ( const TString & fileName)
static

Definition at line 35 of file Interface.cxx.

36{
37 std::unique_ptr<TreeAccessor> accessor = TreeAccessor::open(fileName);
38 if (accessor) {
39 return std::make_unique<Interface> (std::move(accessor));
40 }
41 return nullptr;
42}
static std::unique_ptr< TreeAccessor > open(const TString &fileName)

◆ openList()

std::unique_ptr< Interface > Interface::openList ( const TString & fileList)
static

Definition at line 54 of file Interface.cxx.

55{
56 std::unique_ptr<MultiTreeAccessor> accessor = MultiTreeAccessor::openList(fileList);
57 if (accessor) {
58 return std::make_unique<Interface> (std::move(accessor));
59 }
60 return nullptr;
61}
static std::unique_ptr< MultiTreeAccessor > openList(const TString &fileList)

◆ openWild()

std::unique_ptr< Interface > Interface::openWild ( const TString & wcName)
static

Definition at line 64 of file Interface.cxx.

65{
66 std::unique_ptr<MultiTreeAccessor> accessor = MultiTreeAccessor::openWild(wcName);
67 if (accessor) {
68 return std::make_unique<Interface> (std::move(accessor));
69 }
70 return nullptr;
71}
static std::unique_ptr< MultiTreeAccessor > openWild(const TString &wcName)

◆ operator=()

Interface & LArSamples::Interface::operator= ( const Interface & )
delete

◆ pass()

const History * AbsLArCells::pass ( unsigned int i,
const FilterParams & f ) const
inherited

Definition at line 96 of file AbsLArCells.cxx.

97{
98 //std::cout << "Called AbsLArCells with hash " << i << std::endl;
99 if (!f.passHash(i)) return nullptr;
100 std::unique_ptr<const CellInfo> info = cellInfo(i);
101 if (!info) {
102 return nullptr;
103 }
104 //std::cout << "Called AbsLArCells::pass on a cell belonging to " << Id::str(info->calo()) << std::endl;
105 bool result = f.passCell(*info);
106 return result ? cellHistory(i) : nullptr;
107}

◆ printFilledRanges()

void Interface::printFilledRanges ( unsigned int skip = 0) const

Definition at line 160 of file Interface.cxx.

161{
162 int i1 = 0, i2 = 0;
163 unsigned int nNull = 0;
164 unsigned int size = accessor().historySize(0);
165 bool ok = (size > 0);
166 bool inInterval = ok;
167
168 for (unsigned int i = 0; i < nChannels(); i++) {
170 if (inInterval && nNull == 0) i2 = i;
171 bool ok = (size > 0);
172 if (!ok && inInterval) {
173 nNull++;
174 if (nNull > skip) {
175 nNull = 0;
176 inInterval = false;
177 cout << i1 << "-" << i2 << endl;
178 }
179 }
180 if (ok) nNull = 0;
181 if (ok && !inInterval) {
182 inInterval = true;
183 i1 = i;
184 }
185 }
186
187 if (inInterval) cout << i1 << "-" << nChannels() << endl;
188}
unsigned int size() const
bool inInterval(const cool::ValidityKey n, const cool::ValidityKey from, const cool::ValidityKey to)

◆ refit()

std::unique_ptr< Interface > Interface::refit ( const TString & newFileName,
Chi2Params pars = DefaultChi2 ) const

Definition at line 397 of file Interface.cxx.

398{
399 FilterParams f;
400 DataTweaker tw;
401 tw.setRefit(true);
402 tw.setFitParams(pars);
403 return filter(f, tw, newFileName);
404}
void setRefit(bool refit=true)
Definition DataTweaker.h:39
void setFitParams(Chi2Params params)
Definition DataTweaker.h:40

◆ resetCache()

void AbsLArCells::resetCache ( ) const
virtualinherited

Definition at line 32 of file AbsLArCells.cxx.

33{
34 m_cellCache.reset();
35 m_pos = nChannels() + 1;
36}

◆ runData()

virtual const RunData * LArSamples::Interface::runData ( unsigned int i) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 57 of file Interface.h.

57{ return accessor().runData(i); }
virtual const RunData * runData(unsigned int i) const =0

◆ Scan() [1/2]

bool Interface::Scan ( const TString & vars,
CombinationType comb,
const TString & sel = "",
const TString & ranges = "",
unsigned int verbosity = 1 ) const

Definition at line 570 of file Interface.cxx.

571{
572 MonitorBase m(*this);
573 FilterParams f;
574 if (!f.set(sel)) return 0;
575 return m.dump(vars, comb, f, ranges, verbosity);
576}

◆ Scan() [2/2]

bool Interface::Scan ( const TString & vars,
const TString & sel = "",
unsigned int verbosity = 1 ) const

Definition at line 561 of file Interface.cxx.

562{
563 MonitorBase m(*this);
564 FilterParams f;
565 if (!f.set(sel)) return 0;
566 return m.dump(vars, f, verbosity);
567}

◆ setShapeError() [1/2]

void Interface::setShapeError ( const TString & fileName)

Definition at line 99 of file Interface.cxx.

100{
101 setShapeErrorGetter(new TreeShapeErrorGetter(fileName));
102}
void setShapeErrorGetter(const AbsShapeErrorGetter *err)
Definition Interface.cxx:84

◆ setShapeError() [2/2]

void Interface::setShapeError ( double k)

Definition at line 91 of file Interface.cxx.

92{
93 if (k == 0) { m_shapeErrorGetter = nullptr; m_ownedShapeErrorGetter.reset(); return; }
94 m_ownedShapeErrorGetter = std::make_unique<UniformShapeErrorGetter>(k);
96}
std::unique_ptr< const AbsShapeErrorGetter > m_ownedShapeErrorGetter
Definition Interface.h:140

◆ setShapeErrorGetter()

void Interface::setShapeErrorGetter ( const AbsShapeErrorGetter * err)

Definition at line 84 of file Interface.cxx.

◆ shapeErrorGetter()

const AbsShapeErrorGetter * LArSamples::Interface::shapeErrorGetter ( ) const
inline

Definition at line 125 of file Interface.h.

125{ return m_shapeErrorGetter; }

◆ Show() [1/2]

bool Interface::Show ( const TString & sel = "",
unsigned int verbosity = 1 ) const

Definition at line 587 of file Interface.cxx.

588{
589 FilterParams f;
590 if (!f.set(sel)) return false;
591 for (unsigned int i = 0; i < nChannels(); i++) {
592 const History* history = pass(i, f);
593 if (!history) continue;
594 std::unique_ptr<History> filtered = history->filter(sel);
595 TString hDesc = filtered->description(verbosity);
596 if (hDesc == "") continue;
597 cout << Form("Hash = %-5d : ", i) << hDesc
598 << "-----------------------------------------------------------------------------"
599 << endl;
600 }
601 return true;
602}
const History * pass(unsigned int i, const FilterParams &f) const
std::unique_ptr< History > filter(const TString &cuts) const
Definition History.cxx:272

◆ Show() [2/2]

bool Interface::Show ( unsigned int hash,
unsigned int verbosity = 1 ) const

Definition at line 579 of file Interface.cxx.

580{
581 const History* history = cellHistory(hash);
582 if (!history) return false;
583 cout << history->description(verbosity) << endl;
584 return true;
585}
TString description(unsigned int verbosity=1) const
Definition History.cxx:553

◆ ShowEvents()

bool Interface::ShowEvents ( const TString & sel = "",
unsigned int verbosity = 1 ) const

Definition at line 605 of file Interface.cxx.

606{
607 FilterParams f;
608 if (!f.set(sel)) return false;
609 std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventCells;
610 std::map< std::pair<unsigned int, unsigned int>, double > eventEnergy;
611
612 if (verbosity & 8) {
613 for (unsigned int i = 0; i < nChannels(); i++) {
614 if ((i+1) % 50000 == 0) cout << "Cell # " << i+1 << "/" << nChannels() << endl;
615 const History* history = pass(i, f);
616 if (!history) continue;
617 for (unsigned int j = 0; j < history->nData(); j++) {
618 std::pair<unsigned int, unsigned int> ev = std::make_pair(history->data(j)->run(), history->data(j)->event());
619 eventCells[ev]++;
620 eventEnergy[ev] += history->data(j)->energy();
621 }
622 }
623 }
624 for (unsigned int i = 0; i < nEvents(); i++) {
625 const EventData* evtData = eventData(i);
626 std::pair<unsigned int, unsigned int> id(evtData->run(), evtData->event());
627 TString printout = Form("%d : ", i) + evtData->description(verbosity);
628 if (verbosity & 8)
629 printout += Form(" : %6d LAr hits, %7.1f MeV", eventCells[id], eventEnergy[id]);
630 cout << printout << endl;
631 }
632
633 return true;
634}
double energy() const
Definition Data.h:110
int event() const
Definition Data.cxx:28
int run() const
Definition Data.cxx:27
TString description(unsigned int verbosity) const
virtual const EventData * eventData(unsigned int i) const override
Definition Interface.h:56
virtual unsigned int nEvents() const override
Definition Interface.h:53
int ev
Definition globals.cxx:25

◆ ShowRuns()

bool Interface::ShowRuns ( unsigned int verbosity = 1) const

Definition at line 637 of file Interface.cxx.

638{
639 std::map<unsigned int, unsigned int> events;
640
641 if (verbosity & 8) {
642 for (unsigned int i = 0; i < nEvents(); i++)
643 events[eventData(i)->run()]++;
644 }
645
646 for (unsigned int i = 0; i < nRuns(); i++) {
647 const RunData* rData = runData(i);
648 TString printout = rData->description(verbosity);
649 if (verbosity & 8)
650 printout += Form(" : %6d events", events[rData->run()]);
651 cout << printout << endl;
652 }
653
654 return true;
655}
virtual const RunData * runData(unsigned int i) const override
Definition Interface.h:57
virtual unsigned int nRuns() const override
Definition Interface.h:54
int run() const
Definition RunData.h:36
TString description(unsigned int verbosity) const
Definition RunData.cxx:56

◆ ShowStats()

bool Interface::ShowStats ( const TString & varList,
const TString & sel = "",
bool withErrors = false ) const

Definition at line 658 of file Interface.cxx.

659{
660 MonitorBase m(*this);
661 FilterParams f;
662 if (!f.set(sel)) return 0;
663
664 std::vector<TString> vars;
665 std::vector<DataFuncSet> funcs;
666 std::vector<DataFuncArgs> args;
667 if (!MonitorBase::parseVariables(varList, vars, funcs, args)) {
668 cout << "Invalid variable specification " << varList << endl;
669 return 0;
670 }
671
672 TVectorD mean(vars.size()), meanErr(vars.size());
673 TMatrixD covMatrix(vars.size(), vars.size()), covMatrixErr(vars.size(), vars.size());
674 if (!m.statParams(funcs, args, mean, meanErr, covMatrix, covMatrixErr, f)) return false;
675
676 if (!withErrors) {
677 cout << "---------------------------" << endl;
678 for (unsigned int i = 0; i < vars.size(); i++)
679 cout << Form("| %10s | %-9.4g |", vars[i].Data(), mean(i)) << endl;
680 cout << "---------------------------" << endl << endl;
681
682 cout << "| |";
683 for (unsigned int i = 0; i < vars.size(); i++) cout << " |";
684 cout << endl << "--------------";
685 for (unsigned int i = 0; i < vars.size(); i++) cout << "-------------";
686 cout << endl;
687 for (unsigned int i1 = 0; i1 < vars.size(); i1++) {
688 cout << Form("| %10s |", vars[i1].Data());
689 for (unsigned int i2 = 0; i2 < vars.size(); i2++)
690 cout << Form(" %-9.4g |", covMatrix(i1, i2));
691 cout << endl;
692 }
693 cout << "--------------";
694 for (unsigned int i = 0; i < vars.size(); i++) cout << "-------------";
695 cout << endl;
696 }
697 else {
698 cout << "---------------------------" << endl;
699 for (unsigned int i = 0; i < vars.size(); i++)
700 cout << Form("| %10s | %-9.4g +/- %-9.4g |", vars[i].Data(), mean(i), meanErr(i)) << endl;
701 cout << "---------------------------" << endl << endl;
702
703 cout << "| |";
704 for (unsigned int i = 0; i < vars.size(); i++) cout << " |";
705 cout << endl << "--------------";
706 for (unsigned int i = 0; i < vars.size(); i++) cout << "---------------------------";
707 cout << endl;
708 for (unsigned int i1 = 0; i1 < vars.size(); i1++) {
709 cout << Form("| %10s |", vars[i1].Data());
710 for (unsigned int i2 = 0; i2 < vars.size(); i2++)
711 cout << Form(" %-9.4g +/- %-9.4g |", covMatrix(i1, i2), covMatrixErr(i1, i2));
712 cout << endl;
713 }
714 cout << "--------------";
715 for (unsigned int i = 0; i < vars.size(); i++) cout << "---------------------------";
716 cout << endl;
717 }
718
719 return true;
720}
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")

◆ size()

unsigned int Interface::size ( ) const

Definition at line 105 of file Interface.cxx.

106{
107 unsigned int n = 0;
108 for (unsigned int i = 0; i < nChannels(); i++)
109 n += accessor().historySize(i);
110 return n;
111}

◆ writeToFile()

virtual bool LArSamples::Interface::writeToFile ( const TString & fileName) const
inlineoverridevirtual

Implements LArSamples::Accessor.

Definition at line 127 of file Interface.h.

127{ return accessor().writeToFile(fileName); }
virtual bool writeToFile(const TString &fileName) const =0

Member Data Documentation

◆ m_accessor

std::unique_ptr<const Accessor> LArSamples::Interface::m_accessor
private

Definition at line 138 of file Interface.h.

◆ m_cellCache

std::unique_ptr<const History> LArSamples::AbsLArCells::m_cellCache
mutableprivateinherited

Definition at line 55 of file AbsLArCells.h.

◆ m_cellInfoCache

std::vector<std::unique_ptr<CellInfo> > LArSamples::AbsLArCells::m_cellInfoCache
mutableprivateinherited

Definition at line 56 of file AbsLArCells.h.

◆ m_neighborCache

std::vector<CacheEntry_t> LArSamples::Interface::m_neighborCache
mutableprivate

Definition at line 143 of file Interface.h.

◆ m_neighborHistories

std::vector<std::unique_ptr<const History> > LArSamples::Interface::m_neighborHistories
mutableprivate

Definition at line 145 of file Interface.h.

◆ m_neighborHistoryPos

std::vector<unsigned int> LArSamples::Interface::m_neighborHistoryPos
mutableprivate

Definition at line 144 of file Interface.h.

◆ m_ownedShapeErrorGetter

std::unique_ptr<const AbsShapeErrorGetter> LArSamples::Interface::m_ownedShapeErrorGetter
private

Definition at line 140 of file Interface.h.

◆ m_pos

unsigned int LArSamples::AbsLArCells::m_pos
mutableprivateinherited

Definition at line 54 of file AbsLArCells.h.

◆ m_shapeErrorGetter

const AbsShapeErrorGetter* LArSamples::Interface::m_shapeErrorGetter
private

Definition at line 139 of file Interface.h.


The documentation for this class was generated from the following files: