#include #include "TROOT.h" #include "TTree.h" #include "TFile.h" #include "TH1.h" #include "JetBlockProcessor.hpp" #include "EFlowBlockProcessor.hpp" #include "Histogrammer.hpp" #include "Analyzer.hpp" #include "PhysicsObjectHistoFuncs.hpp" #include "MCBlockProcessor.hpp" int main(int argc, char **argv) { TROOT simple("simple","Example test program"); // open source file TFile * infile = new TFile("RecoAnalyze.root", "READ"); std::cout << "Getting the tree " << std::endl; TTree * myTree = (TTree *)(infile->Get("Global")); if(myTree == 0) { std::cout << "Couldn't find the tree1" << std::endl; return 1; } int n = myTree->GetEntries(); std::cout << " Tree has " << n << " entries" <SetBlockID("JCCA"); jbp->SetPrefix("JCCA"); // make an eflow block processor and set it to process block EFLW EFlowBlockProcessor *eflow = new EFlowBlockProcessor("EFLOWBLOCK1"); eflow->SetBlockID("EFLW"); eflow->SetPrefix("EFLW"); MCBlockProcessor *mcblock = new MCBlockProcessor("MCBLOCK1"); mcblock->SetBlockID("MCA_IPRT"); mcblock->SetPrefix(""); // make a histogrammer to fill the histograms Histogrammer * myHisto1 = new Histogrammer("Histo1"); Histogrammer * myHisto2 = new Histogrammer("Histo2"); Histogrammer * myHisto3 = new Histogrammer("Histo3"); // add object sources for the histogrammers myHisto1->AddObjectSource(jbp); myHisto2->AddObjectSource(eflow); myHisto3->AddObjectSource(mcblock); // now get the function pointers PhysicsObjectHistoFuncs funcPtrClass; AnaFuncPtr1D_t etaFunc = funcPtrClass.getEtaPtr(); AnaFuncPtr1D_t phiFunc = funcPtrClass.getPhiPtr(); // now add some histograms and the functions to the histogrammer myHisto1->AddHistogram("ETA1", etahisto1, etaFunc); myHisto1->AddHistogram("PHI1", phihisto1, phiFunc); myHisto2->AddHistogram("ETA2", etahisto2, etaFunc); myHisto2->AddHistogram("PHI2", phihisto2, phiFunc); myHisto3->AddHistogram("ETA3", etahisto3, etaFunc); myHisto3->AddHistogram("PHI3", phihisto3, phiFunc); // print out the histograms stored myHisto1->PrintHistogramList(); myHisto2->PrintHistogramList(); // make the top level analyzer and add the histogrammer Analyzer * ana = new Analyzer(); ana->AddProcessor(myHisto1); ana->AddProcessor(myHisto2); ana->AddProcessor(myHisto3); // initialise ana->SetAllDebug(0); ana->Init(myTree); ana->Print(); ana->RunOnEvents(); outfile->Write(); return 0; }