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 ()
unsigned int nEvents () const
unsigned int nRuns () const
const EventDataeventData (unsigned int i) const
const RunDatarunData (unsigned int i) const
unsigned int historySize (unsigned int i) const
unsigned int historySizeSC (unsigned int i) const
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< 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
bool writeToFile (const TString &fileName) const
const HistorycellHistory (unsigned int i) const
const HistorygetCellHistory (unsigned int i) const
const HistorygetSCHistory (unsigned int i) const
const CellInfogetCellInfo (unsigned int i) const
virtual const HistorynewCellHistory (unsigned int i) const
virtual 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
void resetCellInfoCache ()

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
const Historym_cellCache
std::vector< 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:34
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 375 of file Interface.cxx.

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

◆ 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 48 of file AbsLArCells.h.

48{ return m_pos; }

◆ cellCache()

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

Definition at line 47 of file AbsLArCells.h.

47{ return m_cellCache; }
const History * m_cellCache
Definition AbsLArCells.h:55

◆ cellHistory()

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

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:88
void setInterface(const Interface *interface) const
Definition History.h:108

◆ cellInfo()

const CellInfo * AbsLArCells::cellInfo ( unsigned int i) const
virtualinherited

Definition at line 71 of file AbsLArCells.cxx.

72{
73 const CellInfo* info = cellInfoCache(i);
74 if (info) return (info->isValid() ? new CellInfo(*info) : nullptr);
75 info = getCellInfo(i);
76 if (info) m_cellInfoCache[i] = new CellInfo(*info, false);
77 //m_cellInfoCache[i] = (info ? new CellInfo(*info, false) : new CellInfo());
78 return info;
79}
std::vector< CellInfo * > m_cellInfoCache
Definition AbsLArCells.h:56
virtual const CellInfo * getCellInfo(unsigned int i) const
const CellInfo * cellInfoCache(unsigned int i) const

◆ cellInfoCache()

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

Definition at line 82 of file AbsLArCells.cxx.

83{
84 return m_cellInfoCache[i];
85}

◆ data()

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

Definition at line 760 of file Interface.cxx.

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

◆ 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 456 of file Interface.cxx.

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

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

◆ DrawEtaPhi()

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

Definition at line 536 of file Interface.cxx.

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

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

◆ dumpEventTuple()

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

Definition at line 781 of file Interface.cxx.

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

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

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 384 of file Interface.cxx.

385{
386 std::unique_ptr<TreeAccessor> newAcc (TreeAccessor::filter(accessor(), filterParams, fileName, tweaker));
387 return std::make_unique<Interface>(std::move(newAcc));
388}
static 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 356 of file Interface.cxx.

357{
358 FilterParams f;
359 if (!f.set(sel)) return nullptr;
360
361 DataTweaker tweak;
362 if (!tweak.set(tweaks)) return nullptr;
363
364 TString thisFN = fileName;
365 if (thisFN.Index(".root") < 0 && dynamic_cast<const TreeAccessor*>(&accessor())) {
366 auto pAccess = dynamic_cast<const TreeAccessor*>(&accessor());
367 if (not pAccess) return nullptr;
368 TString newFN = addSuffix(pAccess->fileName(), fileName);
369 if (newFN != "") thisFN = std::move(newFN);
370 }
371 return filter(f, tweak, thisFN);
372}
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<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 delete filtered_mts[f];
346 std::unique_ptr<const Interface> filtered_multi = open(files);
347 //
348 std::vector<const Interface*> justOne { filtered_multi.get() };
349 std::unique_ptr<Interface> interface = merge(justOne, filterList.fileName(f));
350 }
351
352 return true;
353}
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< 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 408 of file Interface.cxx.

409{
410 for (unsigned int i = 0; i < nChannels(); i++) {
411 const CellInfo* info = cellInfo(i);
412 if (!info) continue;
413 if (!Id::matchCalo(info->calo(), calo)) continue;
414 if (info->layer() != layer) continue;
415 if (info->iEta() != iEta) continue;
416 if (info->iPhi() != iPhi) continue;
417 if (info->region() != region) continue;
418 return HistoryIterator(*this, i);
419 }
420
421 return HistoryIterator(*this, end());
422}
virtual 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 425 of file Interface.cxx.

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

◆ findFTSlotChannel()

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

Definition at line 440 of file Interface.cxx.

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

◆ firstNeighbors()

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

Definition at line 738 of file Interface.cxx.

739{
740 const CellInfo* cell = cellInfo(hash);
741 if (!cell) return true;
742 if (!Id::matchCalo(cell->calo(), HEC)) return false; // for now!
743 if (layer < 0) return true;
744 std::vector<unsigned int> allHashes;
746 if (!cache.first) {
747 if (!neighbors(*cell, 0.15, cache.second)) return false;
748 cache.first = true;
749 }
750 for (unsigned int h : cache.second) {
751 const CellInfo* info = cellInfo(h);
752 if (!info) continue;
753 if (info->layer() == layer) hashes.push_back(h);
754 delete info;
755 }
756 return true;
757}
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()

const History * Interface::getCellHistory ( unsigned int i) const
virtual

Implements LArSamples::AbsLArCells.

Definition at line 114 of file Interface.cxx.

115{
116 const History* history = accessor().getCellHistory(i);
117 if (history) {
119 history->setInterface(this);
120 }
121 return history;
122}
virtual const History * getCellHistory(unsigned int i) const =0

◆ getCellInfo()

const CellInfo * Interface::getCellInfo ( unsigned int i) const
virtual

Reimplemented from LArSamples::AbsLArCells.

Definition at line 145 of file Interface.cxx.

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

◆ getSCHistory()

const History * Interface::getSCHistory ( unsigned int i) const
virtual

Implements LArSamples::AbsLArCells.

Definition at line 124 of file Interface.cxx.

125{
126 const History* history = accessor().getSCHistory(i);
127 if (history) {
128 history->setInterface(this);
129 }
130 return history;
131}
virtual 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:91
unsigned int nData() const
Definition History.h:52
const History * cellHistory(unsigned int i) const
std::pair< long int, long int > indices

◆ historySize()

unsigned int LArSamples::Interface::historySize ( unsigned int i) const
inlinevirtual

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()

unsigned int LArSamples::Interface::historySizeSC ( unsigned int i) const
inlinevirtual

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:152

◆ makeTemplate()

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

Definition at line 391 of file Interface.cxx.

392{
393 std::unique_ptr<TreeAccessor> newAcc (TreeAccessor::makeTemplate(accessor(), fileName));
394 return std::make_unique<Interface>(std::move(newAcc));
395}
static 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 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 34 of file AbsLArCells.h.

◆ nChannelsSC()

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

Definition at line 35 of file AbsLArCells.h.

◆ neighbors()

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

Definition at line 724 of file Interface.cxx.

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

◆ nEvents()

unsigned int LArSamples::Interface::nEvents ( ) const
inlinevirtual

Implements LArSamples::Accessor.

Definition at line 53 of file Interface.h.

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

◆ newCellHistory()

const History * AbsLArCells::newCellHistory ( unsigned int i) const
virtualinherited

Definition at line 44 of file AbsLArCells.cxx.

45{
46 const History* history = getCellHistory(i);
47 if (!history) return nullptr;
48 if (!m_cellInfoCache[i]) {
49 const CellInfo* ci=history->cellInfo();
50 if (ci) {
51 m_cellInfoCache[i]=new CellInfo(*ci,false);
52 }
53 }
54 // m_cellInfoCache[i] = (history->cellInfo() ? new CellInfo(*history->cellInfo(), false) : new CellInfo());
55 return history;
56}
const CellInfo * cellInfo() const
Definition History.h:57

◆ 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}
unsigned int historySize(unsigned int i) const
Definition Interface.h:59

◆ nRuns()

unsigned int LArSamples::Interface::nRuns ( ) const
inlinevirtual

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 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 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 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 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 99 of file AbsLArCells.cxx.

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

◆ 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 398 of file Interface.cxx.

399{
400 FilterParams f;
401 DataTweaker tw;
402 tw.setRefit(true);
403 tw.setFitParams(pars);
404 return filter(f, tw, newFileName);
405}
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 34 of file AbsLArCells.cxx.

35{
36 if (m_cellCache) {
37 delete m_cellCache;
38 m_cellCache = nullptr;
39 }
40 m_pos = nChannels() + 1;
41}

◆ resetCellInfoCache()

void AbsLArCells::resetCellInfoCache ( )
inherited

Definition at line 114 of file AbsLArCells.cxx.

115{
116 for (std::vector<CellInfo*>::iterator cellInfo = m_cellInfoCache.begin();
118 if (*cellInfo) {
119 delete *cellInfo;
120 *cellInfo = 0;
121 }
122}

◆ runData()

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

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 571 of file Interface.cxx.

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

◆ Scan() [2/2]

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

Definition at line 562 of file Interface.cxx.

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

◆ 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 588 of file Interface.cxx.

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

◆ Show() [2/2]

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

Definition at line 580 of file Interface.cxx.

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

◆ ShowEvents()

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

Definition at line 606 of file Interface.cxx.

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

◆ ShowRuns()

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

Definition at line 638 of file Interface.cxx.

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

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

bool LArSamples::Interface::writeToFile ( const TString & fileName) const
inlinevirtual

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

const History* LArSamples::AbsLArCells::m_cellCache
mutableprivateinherited

Definition at line 55 of file AbsLArCells.h.

◆ m_cellInfoCache

std::vector<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: