本文整理汇总了C++中TChain::SetCacheLearnEntries方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::SetCacheLearnEntries方法的具体用法?C++ TChain::SetCacheLearnEntries怎么用?C++ TChain::SetCacheLearnEntries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::SetCacheLearnEntries方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makesimpleplot
void makesimpleplot(void)
{
// set_plot_style();
TChain *chain = new TChain("OSTwoLepAna/summaryTree");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_1.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_10.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_11.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_12.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_13.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_14.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_15.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_16.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_17.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_18.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_19.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_2.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_20.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_3.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_4.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_5.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_6.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_7.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_8.root");
chain->Add("root://eoscms.cern.ch//eos/cms/store/user/muell149/ttH-leptons_Skims/acceptance_study_v5/ttHJetToNonbb_M125_13TeV_amcatnloFXFX_madspin_pythia8/crab_ttH125/150916_225227/0000/multilep_michaeltest_deleteme_9.root");
int chainentries = chain->GetEntries();
cout << "tree entries: " << chainentries << endl;
Int_t cachesize = 100000000; //100 MBytes
chain->SetCacheSize(cachesize); //<<<
chain->SetCacheLearnEntries(20);
double mcwgt_intree = -999.;
double wgt_intree = -999.;
int hDecay_intree = -999;
int eventNum_intree = -999;
vector<ttH::GenParticle> *pruned_genParticles_intree = 0;
vector<ttH::Electron> *raw_electrons_intree = 0;
vector<ttH::Electron> *preselected_electrons_intree = 0;
vector<ttH::Electron> *tight_electrons_intree = 0;
vector<ttH::Muon> *raw_muons_intree = 0;
vector<ttH::Muon> *preselected_muons_intree = 0;
vector<ttH::Muon> *tight_muons_intree = 0;
vector<ttH::Lepton> *tight_leptons_intree = 0;
vector<ttH::Lepton> *preselected_leptons_intree = 0;
vector<ttH::Lepton> raw_leptons;
chain->SetBranchAddress("mcwgt", &mcwgt_intree);
chain->SetBranchAddress("wgt", &wgt_intree);
chain->SetBranchAddress("eventnum", &eventNum_intree);
chain->SetBranchAddress("higgs_decay", &hDecay_intree);
chain->SetBranchAddress("pruned_genParticles", &pruned_genParticles_intree);
chain->SetBranchAddress("raw_electrons", &raw_electrons_intree);
chain->SetBranchAddress("preselected_electrons", &preselected_electrons_intree);
chain->SetBranchAddress("tightMvaBased_electrons", &tight_electrons_intree);
chain->SetBranchAddress("raw_muons", &raw_muons_intree);
chain->SetBranchAddress("preselected_muons", &preselected_muons_intree);
chain->SetBranchAddress("tightMvaBased_muons", &tight_muons_intree);
chain->SetBranchAddress("tightMvaBased_leptons", &tight_leptons_intree);
chain->SetBranchAddress("preselected_leptons", &preselected_leptons_intree);
int positiveCharge;
int negativeCharge;
double leadPt;
double trailPt;
int duplicate = 0;
int total_count = 0;
int ss2l_reco_count =0;
int ss2l_reco_agree_count =0;
int ss2l_gen_count =0;
int ss2l_ee_gen_count =0;
int ss2l_mm_gen_count =0;
int ss2l_em_gen_count =0;
int ss2l_me_gen_count =0;
int l3_reco_count =0;
int l3_reco_agree_count =0;
int l3_gen_count =0;
int l4_reco_count =0;
int l4_reco_agree_count =0;
int l4_gen_count =0;
int ss2l_PS_count = 0;
int ss2l_raw_count = 0;
int l3_PS_count = 0;
int l3_raw_count = 0;
int l4_PS_count = 0;
int l4_raw_count = 0;
int wgt;
//pure rate study
vector<int> cut_vec_ele_int (7,0);
vector<int> cut_vec_mu_int (7,0);
int raw_ele_size = 0;
int raw_mu_size = 0;
//2D plot vars
vector<ttH::GenParticle> genMuons;
//.........这里部分代码省略.........
示例2: MuMcPrVKFV2012
//.........这里部分代码省略.........
if (p < 2) hists[h][p] = new TH2D(Name, Title, nMcRecMult, xMult.GetArray(), nMcRecMult, xMult.GetArray());
else if (p == 2) hists[h][p] = new TH1D(Name, Title, nMcRecMult, xMult.GetArray());
}
}
TNtuple *VertexG = new TNtuple("VertexG", "good vertex & global params info", vnames);
TNtuple *VertexB = new TNtuple("VertexB", "bad vertex & global params info", vnames);
// ----------------------------------------------
StMuDstMaker *maker = new StMuDstMaker(0, 0, "", file, "st:MuDst.root", 1e9); // set up maker in read mode
// 0,0 this mean read mode
// dir read all files in this directory
// file bla.lis real all file in this list, if (file!="") dir is ignored
// filter apply filter to filenames, multiple filters are separated by ':'
// 10 maximum number of file to read
maker->SetStatus("*", 0);
std::vector<std::string> activeBranchNames = {
"MuEvent",
"PrimaryVertices",
"StStMuMcVertex",
"StStMuMcTrack"
};
// Set Active braches
for (const auto& branchName : activeBranchNames)
maker->SetStatus(branchName.c_str(), 1);
TChain *tree = maker->chain();
Long64_t nentries = tree->GetEntries();
nevent = TMath::Min(nevent, nentries);
std::cout << nentries << " events in chain " << nevent << " will be read." << std::endl;
tree->SetCacheSize(-1); //by setting the read cache to -1 we set it to the AutoFlush value when writing
tree->SetCacheLearnEntries(1); //one entry is sufficient to learn
tree->SetCacheEntryRange(0, nevent);
for (Long64_t ev = 0; ev < nevent; ev++) {
if (maker->Make()) break;
StMuDst *muDst = maker->muDst(); // get a pointer to the StMuDst class, the class that points to all the data
StMuEvent *muEvent = muDst->event(); // get a pointer to the class holding event-wise information
int referenceMultiplicity = muEvent->refMult(); // get the reference multiplicity
TClonesArray *PrimaryVertices = muDst->primaryVertices();
int nPrimaryVertices = PrimaryVertices->GetEntriesFast();
TClonesArray *MuMcVertices = muDst->mcArray(0);
int nMuMcVertices = MuMcVertices->GetEntriesFast();
TClonesArray *MuMcTracks = muDst->mcArray(1);
int nMuMcTracks = MuMcTracks->GetEntriesFast();
if ( nevent >= 10 && ev % int(nevent*0.1) == 0 )
{
std::cout << "Event #" << ev << "\tRun\t" << muEvent->runId()
<< "\tId: " << muEvent->eventId()
<< " refMult= " << referenceMultiplicity
<< "\tPrimaryVertices " << nPrimaryVertices
<< "\t" << " " << nMuMcVertices
<< "\t" << " " << nMuMcTracks
<< std::endl;
}
// const Double_t field = muEvent->magneticField()*kilogauss;
if (! nMuMcVertices || ! nMuMcTracks || nPrimaryVertices <= 0) {
std::cout << "Ev. " << ev << " has no MC information ==> skip it" << std::endl;
示例3: trainElectronEnergyRegression_ECAL
void trainElectronEnergyRegression_ECAL(char* trainingFile, char* outWeightFile, char* optionChar, int nTrees) {
// Setting up training option
std::string optionStr(optionChar);
// ******** If option is V00, V01, V02, etc. ********* //
if (optionStr == "V00" || optionStr == "V01") {
GBRTrainer *traineb = new GBRTrainer;
GBRTrainer *trainebvar = new GBRTrainer;
GBRTrainer *trainee = new GBRTrainer;
GBRTrainer *traineevar = new GBRTrainer;
TTree *intree = 0;
cout << "Training on file " << trainingFile << " with version " << optionChar << endl;
TChain *chainele = new TChain("eleIDdir/T1");
chainele->Add(trainingFile);
chainele->LoadTree(0);
chainele->SetCacheSize(64*1024*1024);
chainele->SetCacheLearnEntries();
intree = chainele;
traineb->AddTree(chainele);
trainebvar->AddTree(chainele);
trainee->AddTree(chainele);
traineevar->AddTree(chainele);
TCut traincut = "pt>0";////////////////////////////////
TCut evtcut;
TCut evtcutvar;
TCut statusenergycut;
//if you want to train also energy variance
evtcut = "event%2==0 ";
evtcutvar = "event%2==1 ";
statusenergycut="(GeneratedEnergyStatus3-GeneratedEnergyStatus1)/GeneratedEnergyStatus3<0.01 && GeneratedEnergyStatus3>=GeneratedEnergyStatus1";
traineb->SetTrainingCut(std::string(traincut && evtcut && statusenergycut && "abs(eta)<1.479 && mcmatch==1"));
trainee->SetTrainingCut(std::string(traincut && evtcut && statusenergycut && "abs(eta)>1.479 && abs(eta)<2.5 && mcmatch==1"));
//turn this off for now
trainebvar->SetTrainingCut(std::string(traincut && evtcutvar && statusenergycut && "abs(eta)<1.479 && mcmatch==1"));
traineevar->SetTrainingCut(std::string(traincut && evtcutvar && statusenergycut && "abs(eta)>1.479 && abs(eta)<2.5 && mcmatch==1"));
const double maxsig = 3.0;
const double shrinkage = 0.1;
traineb->SetMinEvents(200);
traineb->SetShrinkage(shrinkage);
traineb->SetMinCutSignificance(maxsig);
trainebvar->SetMinEvents(200);
trainebvar->SetShrinkage(shrinkage);
trainebvar->SetMinCutSignificance(maxsig);
trainee->SetMinEvents(200);
trainee->SetShrinkage(shrinkage);
trainee->SetMinCutSignificance(maxsig);
traineevar->SetMinEvents(200);
traineevar->SetShrinkage(shrinkage);
traineevar->SetMinCutSignificance(maxsig);
traineb->SetTargetVar("GeneratedEnergyStatus3/SCRawEnergy");
trainebvar->SetTargetVar("abs( targeteb - GeneratedEnergyStatus3/SCRawEnergy) ");
trainee->SetTargetVar("GeneratedEnergyStatus3/(SCRawEnergy*(1+PreShowerOverRaw))");
traineevar->SetTargetVar("abs( targetee - GeneratedEnergyStatus3/(SCRawEnergy*(1+PreShowerOverRaw))) ");
std::vector<std::string> *varsf = new std::vector<std::string>;
varsf->push_back("SCRawEnergy");
varsf->push_back("scEta");
varsf->push_back("scPhi");
varsf->push_back("R9");
varsf->push_back("E5x5Seed/SCRawEnergy");
varsf->push_back("etawidth");
varsf->push_back("phiwidth");
varsf->push_back("NClusters");
varsf->push_back("HoE");
varsf->push_back("rho");
varsf->push_back("vertices");
varsf->push_back("EtaSeed-scEta");
varsf->push_back("atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi))");
varsf->push_back("ESeed/SCRawEnergy");
varsf->push_back("E3x3Seed/ESeed");
varsf->push_back("E5x5Seed/ESeed");
varsf->push_back("see");
varsf->push_back("spp");
// varsf->push_back("sep");
varsf->push_back("EMaxSeed/ESeed");
varsf->push_back("E2ndSeed/ESeed");
varsf->push_back("ETopSeed/ESeed");
varsf->push_back("EBottomSeed/ESeed");
varsf->push_back("ELeftSeed/ESeed");
//.........这里部分代码省略.........