本文整理汇总了C++中Analysis::SetUseCacher方法的典型用法代码示例。如果您正苦于以下问题:C++ Analysis::SetUseCacher方法的具体用法?C++ Analysis::SetUseCacher怎么用?C++ Analysis::SetUseCacher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Analysis
的用法示例。
在下文中一共展示了Analysis::SetUseCacher方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runBavanti
//--------------------------------------------------------------------------------------------------
void runBavanti(const char *fileset = "0000",
const char *skim = "noskim",
const char *dataset = "r12b-smu-j22-v1",
const char *book = "t2mit/filefi/032",
const char *catalogDir = "/home/cmsprod/catalog",
const char *outputName = "boostedv",
int nEvents = 1000)
{
//------------------------------------------------------------------------------------------------
// some parameters get passed through the environment
//------------------------------------------------------------------------------------------------
TString cataDir = Utils::GetCatalogDir(catalogDir);
TString mitData = Utils::GetEnv("MIT_DATA");
TString json = Utils::GetEnv("MIT_PROD_JSON");
TString jsonFile = Utils::GetJsonFile("/home/cmsprod/cms/json");
Bool_t isData = (json.CompareTo("~") != 0);
printf("\n Initialization worked. Data?: %d\n\n",isData);
//------------------------------------------------------------------------------------------------
// some global setups
//------------------------------------------------------------------------------------------------
// debugging config
using namespace mithep;
gDebugMask = (Debug::EDebugMask) (Debug::kGeneral | Debug::kTreeIO);
gDebugLevel = 3;
// Caching and how
Int_t local = 1, cacher = 1;
// local = 0 - as is,
// 1 - /mt/hadoop (MIT:SmartCache - preload one-by-one)
// 2 - /mnt/hadoop (MIT:SmartCache - preload complete fileset)
// 3 - ./ (xrdcp - preload one-by-one)
// cacher = 0 - no file by file caching
// 1 - file by file caching on
//------------------------------------------------------------------------------------------------
// set up information for master module
//------------------------------------------------------------------------------------------------
RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod;
runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted
// only select on run- and lumisection numbers when valid json file present
if (json.CompareTo("~") != 0 && json.CompareTo("-") != 0) {
printf(" runBoostedV() - adding jsonFile: %s\n",jsonFile.Data());
runLumiSel->AddJSONFile(jsonFile.Data());
}
if (json.CompareTo("-") == 0) {
printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n");
runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file
}
printf("\n Run lumi worked. \n\n");
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(cacher);
ana->SetUseHLT(kTRUE);
ana->SetKeepHierarchy(kTRUE);
ana->SetSuperModule(runLumiSel);
ana->SetPrintScale(100);
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
Catalog *c = new Catalog(cataDir.Data());
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
Dataset *d = NULL;
TString bookstr = book;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(bookstr,dataset,fileset,local);
else
d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local);
ana->AddDataset(d);
//------------------------------------------------------------------------------------------------
// organize output
//------------------------------------------------------------------------------------------------
TString rootFile = TString(outputName);
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
if (TString(fileset) != TString(""))
rootFile += TString("_") + TString(fileset);
ana->SetOutputName(rootFile + TString(".root"));
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// select events with a good primary vertex
//------------------------------------------------------------------------------------------------
GoodPVFilterMod *goodPvFilterMod = new GoodPVFilterMod;
goodPvFilterMod->SetMinVertexNTracks(0);
goodPvFilterMod->SetMinNDof(4.0);
goodPvFilterMod->SetMaxAbsZ(24.0);
goodPvFilterMod->SetMaxRho(2.0);
goodPvFilterMod->SetIsMC(!isData);
goodPvFilterMod->SetVertexesName("PrimaryVertexes");
//.........这里部分代码省略.........
示例2: runMonoJetSkim
//.........这里部分代码省略.........
monojetSel->SetMaxNeutralEmFrac(iCat, 0.7);
}
//------------------------------------------------------------------------------------------------
// making the analysis chain
//------------------------------------------------------------------------------------------------
// this is how it always starts
runLumiSel ->Add(generatorMod);
generatorMod ->Add(goodPvMod);
goodPvMod ->Add(hltModP);
// photon regression
hltModP ->Add(photonReg);
// simple object id modules
photonReg ->Add(SepPUMod);
SepPUMod ->Add(muonId);
muonId ->Add(eleIdMod);
eleIdMod ->Add(electronCleaning);
electronCleaning ->Add(merger);
merger ->Add(photonIDMod);
photonIDMod ->Add(photonCleaningMod);
photonCleaningMod->Add(pfTauIDMod);
pfTauIDMod ->Add(pfTauCleaningMod);
pfTauCleaningMod ->Add(pubJet);
pubJet ->Add(jetCorr);
jetCorr ->Add(metCorrT0T1Shift);
metCorrT0T1Shift ->Add(jetID);
jetID ->Add(jetCleaning);
jetCleaning ->Add(monojetSel);
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(1);
ana->SetUseHLT(kTRUE);
ana->SetKeepHierarchy(kTRUE);
ana->SetSuperModule(runLumiSel);
ana->SetPrintScale(100);
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
Catalog *c = new Catalog(catalogDir);
TString skimDataset = TString(dataset)+TString("/") +TString(skim);
Dataset *d = NULL;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(book,dataset,fileset, 1); // 1 to use smartcache
else
d = c->FindDataset(book,skimDataset.Data(),fileset, 1);
ana->AddDataset(d);
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// skim output
//------------------------------------------------------------------------------------------------
TString outputName = TString(outputLabel);
outputName += TString("_") + TString(dataset) + TString("_") + TString(skim);
if (TString(fileset) != TString(""))
outputName += TString("_") + TString(fileset);
OutputMod *skimOutput = new OutputMod;
skimOutput->Drop("*");
skimOutput->Keep("HLT*");
skimOutput->Keep("MC*");
示例3: getCatalogDir
//--------------------------------------------------------------------------------------------------
void runBavantiBoostedV_Synch
(const char *fileset = "0000",
const char *skim = "noskim",
//const char *dataset = "s12-ttj-sl-v1-v7c",
const char *dataset = "GJets_HT-400ToInf_8TeV-madgraph+Summer12_DR53X-PU_S10_START53_V7A-v1+AODSIM",
const char *book = "t2mit/filefi/032",
const char *catalogDir = "/home/cmsprod/catalog",
const char *outputName = "boostedv",
int nEvents = 10)
{
//------------------------------------------------------------------------------------------------
// some parameters get passed through the environment
//------------------------------------------------------------------------------------------------
TString cataDir = getCatalogDir(catalogDir);
TString mitData = Utils::GetEnv("MIT_DATA");
TString json = Utils::GetEnv("MIT_PROD_JSON");
TString jsonFile = getJsonFile("/home/cmsprod/cms/json");
Bool_t isData = (json.CompareTo("~") != 0);
// only for synchrionization purposes
isData = kFALSE;
printf("\n Initialization worked. Data?: %d\n\n",isData);
//------------------------------------------------------------------------------------------------
// some global setups
//------------------------------------------------------------------------------------------------
// debugging config
using namespace mithep;
gDebugMask = (Debug::EDebugMask) (Debug::kGeneral | Debug::kTreeIO);
gDebugLevel = 3;
// Caching and how
Int_t local = 1, cacher = 1;
// local = 0 - as is,
// 1 - /mt/hadoop (MIT:SmartCache - preload one-by-one)
// 2 - /mnt/hadoop (MIT:SmartCache - preload complete fileset)
// 3 - ./ (xrdcp - preload one-by-one)
// cacher = 0 - no file by file caching
// 1 - file by file caching on
//------------------------------------------------------------------------------------------------
// set up information for master module
//------------------------------------------------------------------------------------------------
RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod;
runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted
// only select on run- and lumisection numbers when valid json file present
if (json.CompareTo("~") != 0 && json.CompareTo("-") != 0) {
printf(" runBoostedV() - adding jsonFile: %s\n",jsonFile.Data());
runLumiSel->AddJSONFile(jsonFile.Data());
}
if (json.CompareTo("-") == 0) {
printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n");
runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file
}
printf("\n Run lumi worked. \n\n");
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(cacher);
ana->SetUseHLT(kTRUE);
ana->SetKeepHierarchy(kTRUE);
ana->SetSuperModule(runLumiSel);
ana->SetPrintScale(100);
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
Catalog *c = new Catalog(cataDir.Data());
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
Dataset *d = NULL;
TString bookstr = book;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(bookstr,dataset,fileset,local);
else
d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local);
ana->AddDataset(d);
//------------------------------------------------------------------------------------------------
// organize output
//------------------------------------------------------------------------------------------------
TString rootFile = TString(outputName);
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
if (TString(fileset) != TString(""))
rootFile += TString("_") + TString(fileset);
TString ntupleFile = rootFile + TString("_ntuple");
rootFile += TString(".root");
ana->SetOutputName(rootFile.Data());
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// HLT information
//------------------------------------------------------------------------------------------------
HLTMod *hltModP = new HLTMod("HLTModP");
//.........这里部分代码省略.........
示例4: runIoTest
//--------------------------------------------------------------------------------------------------
void runIoTest(const char *fileset = "0000",
const char *skim = "noskim",
const char *dataset = "r12b-dmu-j22-v1",
const char *book = "t2mit/filefi/032",
const char *catalogDir = "/home/cmsprod/catalog",
const char *outputName = "iotest",
int nEvents = 200000)
{
//------------------------------------------------------------------------------------------------
// some parameters get passed through the environment
//------------------------------------------------------------------------------------------------
TString cataDir = getCatalogDir(catalogDir);
TString mitData = Utils::GetEnv("MIT_DATA");
TString json = Utils::GetEnv("MIT_PROD_JSON");
TString jsonFile = getJsonFile("/home/cmsprod/cms/json");
Bool_t isData = (json.CompareTo("~") != 0);
printf("\n Initialization worked. Data?: %d\n\n",isData);
//------------------------------------------------------------------------------------------------
// some global setups
//------------------------------------------------------------------------------------------------
using namespace mithep;
gDebugMask = ( Debug::kAnalysis && Debug::kTreeIO );
gDebugLevel = 1;
//------------------------------------------------------------------------------------------------
// set up information for master module
//------------------------------------------------------------------------------------------------
RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod;
runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted
// only select on run- and lumisection numbers when valid json file present
if (json.CompareTo("~") != 0 && json.CompareTo("-") != 0) {
runLumiSel->AddJSONFile(jsonFile.Data());
}
if (json.CompareTo("-") == 0) {
printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n");
runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file
}
printf("\n Run lumi worked. \n\n");
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(1);
ana->SetUseHLT(kTRUE);
ana->SetKeepHierarchy(kTRUE);
ana->SetSuperModule(runLumiSel);
ana->SetPrintScale(100);
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
Catalog *c = new Catalog(cataDir.Data());
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
Dataset *d = NULL;
TString bookstr = book;
Int_t local = 3;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(bookstr,dataset,fileset,local);
else
d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local);
ana->AddDataset(d);
//------------------------------------------------------------------------------------------------
// organize output
//------------------------------------------------------------------------------------------------
TString rootFile = TString(outputName);
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
if (TString(fileset) != TString(""))
rootFile += TString("_") + TString(fileset);
TString ntupleFile = rootFile + TString("_ntuple.root");
rootFile += TString(".root");
ana->SetOutputName(rootFile.Data());
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// HLT information
//------------------------------------------------------------------------------------------------
HLTMod *hltModP = new HLTMod("HLTModP");
hltModP->SetBitsName("HLTBits");
hltModP->SetTrigObjsName("HltObjsMonoJet");
hltModP->SetAbortIfNotAccepted(isData);
hltModP->SetPrintTable(kFALSE);
// monojet triggers
const int nMjtTrigs = 1;
TString monoJetTriggers[nMjtTrigs] = { "HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v4" };
for (int i=0; i<nMjtTrigs; i++)
hltModP->AddTrigger(TString("!+"+monoJetTriggers[i]),0,999999);
//------------------------------------------------------------------------------------------------
// making analysis chain
//------------------------------------------------------------------------------------------------
runLumiSel ->Add(hltModP);
//.........这里部分代码省略.........
示例5: runMonoJetSkim
//.........这里部分代码省略.........
if (TString(fileset) != TString(""))
outputName += TString("_") + TString(fileset);
OutputMod *skimOutput = new OutputMod;
skimOutput->Keep("*");
skimOutput->Drop("L1TechBits*");
skimOutput->Drop("L1AlgoBits*");
skimOutput->Drop("MCVertexes");
skimOutput->Drop("PFEcal*SuperClusters");
skimOutput->Drop("*Tracks");
skimOutput->Drop("StandaloneMuonTracksWVtxConstraint");
skimOutput->Drop("PrimaryVertexesBeamSpot");
skimOutput->Drop("InclusiveSecondaryVertexes");
skimOutput->Drop("CosmicMuons");
skimOutput->Drop("MergedElectronsStable");
skimOutput->Drop("MergedConversions*");
skimOutput->Drop("AKT8GenJets");
skimOutput->Drop("AKt4PFJets");
skimOutput->Drop("DCASig");
skimOutput->AddNewBranch(type1MetCorr->GetOutputName());
skimOutput->AddNewBranch(monojetSel->GetCategoryFlagsName());
skimOutput->SetMaxFileSize(10 * 1024); // 10 GB - should never exceed
skimOutput->SetFileName(outputName);
skimOutput->SetPathName(".");
skimOutput->SetCheckTamBr(false);
skimOutput->SetKeepTamBr(false);
skimOutput->SetCheckBrDep(true);
skimOutput->SetUseBrDep(true);
skimOutput->AddCondition(monojetSel);
//------------------------------------------------------------------------------------------------
// making the analysis chain
//------------------------------------------------------------------------------------------------
auto mItr(modules.begin());
while (true) {
auto* mod = *(mItr++);
if (mItr == modules.end())
break;
mod->Add(*mItr);
}
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(1);
ana->SetUseHLT(kTRUE);
ana->SetAllowNoHLTTree(kTRUE); // for private MC with no HLT info
ana->SetKeepHierarchy(kFALSE);
ana->SetPrintScale(100);
ana->SetOutputName(outputName + "_hist.root");
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
ana->AddSuperModule(modules.front());
ana->AddOutputMod(skimOutput);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
Catalog *c = new Catalog(catalogDir);
TString skimDataset = TString(dataset)+TString("/") +TString(skim);
Dataset *d = NULL;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(book,dataset,fileset, 1); // 1 to use smartcache
else
d = c->FindDataset(book,skimDataset.Data(),fileset, 1);
ana->AddDataset(d);
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// Say what we are doing
//------------------------------------------------------------------------------------------------
printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n");
printf("\n JSON file: %s\n", json.Data());
printf("\n Rely on Catalog: %s\n",catalogDir);
printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset);
printf("\n========================================\n");
std::cout << std::endl;
std::cout << "+++++ ANALYSIS FLOW +++++" << std::endl;
ana->PrintModuleTree();
std::cout << std::endl;
std::cout << "+++++++++++++++++++++++++" << std::endl;
//------------------------------------------------------------------------------------------------
// run the analysis after successful initialisation
//------------------------------------------------------------------------------------------------
ana->Run(false);
delete ana; // all modules deleted recursively
// rename the output file so that condor can see it
gSystem->Rename("./" + outputName + "_000.root", "./" + outputName + ".root");
return;
}
示例6: runFlatMonoJet
//.........这里部分代码省略.........
jetplusmettree->SetMetFromBranch(kFALSE);
jetplusmettree->SetPhotonsFromBranch(kFALSE);
jetplusmettree->SetPhotonsName(photonCleaningMod->GetOutputName());
jetplusmettree->SetElectronsFromBranch(kFALSE);
jetplusmettree->SetElectronsName(electronCleaning->GetOutputName());
jetplusmettree->SetMuonsFromBranch(kFALSE);
jetplusmettree->SetMuonsName(muonId->GetOutputName());
jetplusmettree->SetTausFromBranch(kFALSE);
jetplusmettree->SetTausName(pftauCleaningMod->GetOutputName());
jetplusmettree->SetJetsFromBranch(kFALSE);
jetplusmettree->SetJetsName(jetCleaning->GetOutputName());
jetplusmettree->SetRawJetsName(pubJet->GetOutputName());
jetplusmettree->SetPVFromBranch(kFALSE);
jetplusmettree->SetPVName(goodPVFilterMod->GetOutputName());
jetplusmettree->SetLeptonsName(merger->GetOutputName());
jetplusmettree->SetIsData(isData);
jetplusmettree->SetProcessID(0);
jetplusmettree->SetFillNtupleType(0);
//------------------------------------------------------------------------------------------------
// making analysis chain
//------------------------------------------------------------------------------------------------
// this is how it always starts
runLumiSel->Add(generatorMod);
generatorMod->Add(goodPVFilterMod);
goodPVFilterMod->Add(hltModP);
// photon regression
hltModP->Add(photreg);
// simple object id modules
photreg ->Add(SepPUMod);
SepPUMod ->Add(muonId);
muonId ->Add(eleIdMod);
eleIdMod ->Add(electronCleaning);
electronCleaning ->Add(merger);
merger ->Add(photonIDMod);
photonIDMod ->Add(photonCleaningMod);
photonCleaningMod->Add(pftauIDMod);
pftauIDMod ->Add(pftauCleaningMod);
pftauCleaningMod ->Add(pubJet);
pubJet ->Add(jetCorr);
jetCorr ->Add(metCorrT0T1Shift);
metCorrT0T1Shift ->Add(jetID);
jetID ->Add(muonIdIso);
muonIdIso ->Add(jetCleaning);
jetCleaning ->Add(jetplusmettree);
//------------------------------------------------------------------------------------------------
// setup analysis
//------------------------------------------------------------------------------------------------
Analysis *ana = new Analysis;
ana->SetUseCacher(cacher);
ana->SetUseHLT(kTRUE);
ana->SetKeepHierarchy(kTRUE);
ana->SetSuperModule(runLumiSel);
ana->SetPrintScale(100);
if (nEvents >= 0)
ana->SetProcessNEvents(nEvents);
//------------------------------------------------------------------------------------------------
// organize input
//------------------------------------------------------------------------------------------------
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
TString bookstr = book;
Catalog *c = new Catalog(cataDir.Data());
Dataset *d = NULL;
if (TString(skim).CompareTo("noskim") == 0)
d = c->FindDataset(bookstr,dataset,fileset,local);
else
d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local);
ana->AddDataset(d);
//ana->AddFile("/mnt/hadoop/cms/store/user/paus/filefi/032/r12a-met-j22-v1/C4AC0AB8-BA82-E211-B238-003048678FF4.root");
//------------------------------------------------------------------------------------------------
// organize output
//------------------------------------------------------------------------------------------------
TString rootFile = TString(outputName);
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
if (TString(fileset) != TString(""))
rootFile += TString("_") + TString(fileset);
rootFile += TString(".root");
ana->SetOutputName(rootFile.Data());
ana->SetCacheSize(0);
//------------------------------------------------------------------------------------------------
// Say what we are doing
//------------------------------------------------------------------------------------------------
printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n");
printf("\n JSON file: %s\n",jsonFile.Data());
printf("\n Rely on Catalog: %s\n",cataDir.Data());
printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset);
printf("\n Root output: %s\n\n",rootFile.Data());
printf("\n========================================\n");
//------------------------------------------------------------------------------------------------
// run the analysis after successful initialisation
//------------------------------------------------------------------------------------------------
ana->Run(kFALSE);
return;
}