本文整理汇总了C++中TChain::GetNtrees方法的典型用法代码示例。如果您正苦于以下问题:C++ TChain::GetNtrees方法的具体用法?C++ TChain::GetNtrees怎么用?C++ TChain::GetNtrees使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TChain
的用法示例。
在下文中一共展示了TChain::GetNtrees方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateChain
//________________________________________________________________________________
TChain* CreateChain(const char *xmlfile, const char *type)
{
// Create a chain using url's from xml file
TString treename = type;
treename.ToLower();
treename += "Tree";
printf("***************************************\n");
printf(" Getting chain of trees %s\n", treename.Data());
printf("***************************************\n");
TGridCollection *coll = gGrid->OpenCollection(xmlfile);
if (!coll) {
::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
return NULL;
}
TChain *chain = new TChain(treename);
coll->Reset();
while (coll->Next()) {
chain->Add(coll->GetTURL(""));
}
if (!chain->GetNtrees()) {
::Error("CreateChain", "No tree found from collection %s", xmlfile);
return NULL;
}
return chain;
}
示例2: CreateChainFromCollection
//______________________________________________________________________________
TChain* CreateChainFromCollection(const char *xmlfile)
{
// Create a chain from the collection of tags.
TAlienCollection* coll = TAlienCollection::Open(xmlfile);
if (!coll) {
::Error("CreateChainFromTags", "Cannot create an AliEn collection from %s", xmlfile);
return NULL;
}
TGridResult* tagResult = coll->GetGridResult("",kFALSE,kFALSE);
AliTagAnalysis *tagAna = new AliTagAnalysis("ESD");
tagAna->ChainGridTags(tagResult);
AliRunTagCuts *runCuts = new AliRunTagCuts();
AliLHCTagCuts *lhcCuts = new AliLHCTagCuts();
AliDetectorTagCuts *detCuts = new AliDetectorTagCuts();
AliEventTagCuts *evCuts = new AliEventTagCuts();
// Check if the cuts configuration file was provided
if (!gSystem->AccessPathName("ConfigureCuts.C")) {
gROOT->LoadMacro("ConfigureCuts.C");
ConfigureCuts(runCuts, lhcCuts, detCuts, evCuts);
}
TChain *chain = tagAna->QueryTags(runCuts, lhcCuts, detCuts, evCuts);
if (!chain || !chain->GetNtrees()) return NULL;
chain->ls();
return chain;
}
示例3: CreateChainFromAODFile
//______________________________________________________________________________
TChain* CreateChainFromAODFile(const char *rootfile, Bool_t isESD)
{
// Create a chain using the root file.
TChain* chain = 0;
if ( !isESD) chain = new TChain("aodTree");
else chain = new TChain("esdTree");
chain->Add(rootfile);
if (!chain->GetNtrees()) return NULL;
chain->ls();
return chain;
}
示例4: CreateChainXML
//________________________________________________________________________________
TChain* CreateChainXML(const char *xmlfile)
{
// Create a chain using url's from xml file
TString filename;
Int_t run = 0;
TString treename = "esdTree";
printf("***************************************\n");
printf(" Getting chain of trees %s\n", treename.Data());
printf("***************************************\n");
TAlienCollection *coll = TAlienCollection::Open(xmlfile);
if (!coll) {
::Error("CreateChain", "Cannot create an AliEn collection from %s", xmlfile);
return NULL;
}
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
TChain *chain = new TChain(treename);
coll->Reset();
while (coll->Next()) {
filename = coll->GetTURL();
if (filename.EndsWith("Barrel.root")) barrelFlag = kTRUE;
if (mgr) {
Int_t nrun = AliAnalysisManager::GetRunFromAlienPath(filename);
if (nrun && nrun != run) {
printf("### Run number detected from chain: %d\n", nrun);
mgr->SetRunFromPath(nrun);
run = nrun;
}
}
chain->Add(filename);
}
if (!chain->GetNtrees()) {
::Error("CreateChain", "No tree found from collection %s", xmlfile);
return NULL;
}
printf("Created chain with %d entries in %d trees from %s\n",chain->GetEntries(),chain->GetNtrees(),xmlfile);
return chain;
}
示例5: CreateChainFromESDList
//______________________________________________________________________________
TChain* CreateChainFromESDList(const char *esdList)
{
// Create a chain using tags from the run list.
TChain* chain = new TChain("esdTree");
ifstream inFile(esdList);
TString inFileName;
if (inFile.is_open()) {
while (! inFile.eof() ) {
inFileName.ReadLine(inFile,kFALSE);
if(!inFileName.EndsWith(".root")) continue;
chain->Add(inFileName.Data());
}
}
inFile.close();
if (!chain->GetNtrees()) return NULL;
chain->ls();
return chain;
}
示例6: CreateChainTXT
//________________________________________________________________________________
TChain* CreateChainTXT(const char* inpData)
{
const char* chName="esdTree";
TChain* chain = new TChain(chName);
//
TString inpDtStr = inpData;
if (inpDtStr.EndsWith(".root")) {
chain->AddFile(inpData);
}
else {
//
ifstream inpf(inpData);
if (!inpf.good()) {
printf("Failed on input filename %s\n",inpData);
return kFALSE;
}
//
TString flName;
flName.ReadLine(inpf);
while ( !flName.IsNull() ) {
flName = flName.Strip(TString::kBoth,' ');
if (flName.BeginsWith("//") || flName.BeginsWith("#")) {flName.ReadLine(inpf); continue;}
flName = flName.Strip(TString::kBoth,',');
flName = flName.Strip(TString::kBoth,'"');
if (flName.EndsWith("Barrel.root")) barrelFlag = kTRUE;
printf("Adding %s\n",flName.Data());
chain->AddFile(flName.Data());
flName.ReadLine(inpf);
}
}
//
int n = chain->GetEntries();
if (n<1) {
printf("Obtained chain is empty\n");
return kFALSE;
}
printf("Created chain with %d entries in %d trees from %s\n",chain->GetEntries(),chain->GetNtrees(),inpData);
return chain;
}
示例7: GetNfiles
void GetNfiles() { fChain->GetNtrees(); }
示例8: HCALCheckRun
//
// Main analyzer
//
void HCALCheckRun(TString rootfile, TString outfile, int maxevents=-1, int option=2)
{
cout << "[Hcal analyzer] Running option " << option << " for " << endl;
// fit pannel display option
gStyle->SetOptFit(1011);
//
// Get the tree from the PFG ntuple
//
TChain *ch = new TChain("hcalTupleTree/tree");
std::string filename(rootfile);
std::string::size_type idx;
idx = filename.rfind('.');
std::string extension = filename.substr(idx+1);
std::string line;
if(idx != std::string::npos && extension=="txt")
{
std::cout << rootfile << " " << extension << std::endl;
std::ifstream in(rootfile);
while (std::getline(in, line)) { // Process line
if (line.size()>0) ch->Add(line.c_str());
}
}
else
{
// No extension found
ch->Add(rootfile);
}
printf("%d;\n",ch->GetNtrees());
printf("%lld;\n",ch->GetEntries());
TTreeReader fReader(ch); //!the tree reader
//
// Set up TTreeReader's
// -- use MakeSelector of root
//
// Readers to access the data (delete the ones you do not need).
// if (isMC){
// TTreeReaderArray<double> GenParEta = {fReader, "GenParEta"};
// TTreeReaderArray<double> GenParM = {fReader, "GenParM"};
// TTreeReaderArray<double> GenParPhi = {fReader, "GenParPhi"};
// TTreeReaderArray<double> GenParPt = {fReader, "GenParPt"};
// }
TTreeReaderArray<vector<double>> QIE11DigiFC = {fReader, "QIE11DigiFC"};
TTreeReaderArray<float> HBHEDigiEta = {fReader, "HBHEDigiEta"};
TTreeReaderArray<float> HBHEDigiPhi = {fReader, "HBHEDigiPhi"};
TTreeReaderArray<float> HBHEDigiRecEnergy = {fReader, "HBHEDigiRecEnergy"};
TTreeReaderArray<float> HBHEDigiRecTime = {fReader, "HBHEDigiRecTime"};
TTreeReaderArray<float> HBHERecHitEnergy = {fReader, "HBHERecHitEnergy"};
TTreeReaderArray<float> HBHERecHitEta = {fReader, "HBHERecHitEta"};
TTreeReaderArray<float> HBHERecHitPhi = {fReader, "HBHERecHitPhi"};
TTreeReaderArray<float> HBHERecHitTime = {fReader, "HBHERecHitTime"};
TTreeReaderArray<float> HFDigiEta = {fReader, "HFDigiEta"};
TTreeReaderArray<float> HFDigiPhi = {fReader, "HFDigiPhi"};
TTreeReaderArray<float> HFDigiRecEnergy = {fReader, "HFDigiRecEnergy"};
TTreeReaderArray<float> HFDigiRecTime = {fReader, "HFDigiRecTime"};
TTreeReaderArray<float> HODigiEta = {fReader, "HODigiEta"};
TTreeReaderArray<float> HODigiPhi = {fReader, "HODigiPhi"};
TTreeReaderArray<float> HODigiRecEnergy = {fReader, "HODigiRecEnergy"};
TTreeReaderArray<float> HODigiRecTime = {fReader, "HODigiRecTime"};
// TTreeReaderArray<float> HcalSimHitsEnergy = {fReader, "HcalSimHitsEnergy"};
// TTreeReaderArray<float> HcalSimHitsEta = {fReader, "HcalSimHitsEta"};
// TTreeReaderArray<float> HcalSimHitsPhi = {fReader, "HcalSimHitsPhi"};
// TTreeReaderArray<float> HcalSimHitsPosx = {fReader, "HcalSimHitsPosx"};
// TTreeReaderArray<float> HcalSimHitsPosy = {fReader, "HcalSimHitsPosy"};
// TTreeReaderArray<float> HcalSimHitsPosz = {fReader, "HcalSimHitsPosz"};
// TTreeReaderArray<float> HcalSimHitsTime = {fReader, "HcalSimHitsTime"};
// TTreeReaderArray<float> HcalSimHitsTimeTOF = {fReader, "HcalSimHitsTimeTOF"};
// if (isMC){
// TTreeReaderArray<float> HcalSimHitsEnergy = {fReader, "HcalSimHitsEnergy"};
// TTreeReaderArray<float> HcalSimHitsEta = {fReader, "HcalSimHitsEta"};
// TTreeReaderArray<float> HcalSimHitsPhi = {fReader, "HcalSimHitsPhi"};
// TTreeReaderArray<float> HcalSimHitsPosx = {fReader, "HcalSimHitsPosx"};
// TTreeReaderArray<float> HcalSimHitsPosy = {fReader, "HcalSimHitsPosy"};
// TTreeReaderArray<float> HcalSimHitsPosz = {fReader, "HcalSimHitsPosz"};
// TTreeReaderArray<float> HcalSimHitsTime = {fReader, "HcalSimHitsTime"};
// TTreeReaderArray<float> HcalSimHitsTimeTOF = {fReader, "HcalSimHitsTimeTOF"};
// }
TTreeReaderArray<vector<float>> HBHEDigiAllFC = {fReader, "HBHEDigiAllFC"};
TTreeReaderArray<vector<float>> HBHEDigiEnergy = {fReader, "HBHEDigiEnergy"};
TTreeReaderArray<vector<float>> HBHEDigiFC = {fReader, "HBHEDigiFC"};
TTreeReaderArray<vector<float>> HBHEDigiGain = {fReader, "HBHEDigiGain"};
TTreeReaderArray<vector<float>> HBHEDigiNomFC = {fReader, "HBHEDigiNomFC"};
TTreeReaderArray<vector<float>> HBHEDigiPedFC = {fReader, "HBHEDigiPedFC"};
TTreeReaderArray<vector<float>> HBHEDigiRCGain = {fReader, "HBHEDigiRCGain"};
TTreeReaderArray<vector<float>> HFDigiAllFC = {fReader, "HFDigiAllFC"};
TTreeReaderArray<vector<float>> HFDigiEnergy = {fReader, "HFDigiEnergy"};
TTreeReaderArray<vector<float>> HFDigiFC = {fReader, "HFDigiFC"};
TTreeReaderArray<vector<float>> HFDigiGain = {fReader, "HFDigiGain"};
//.........这里部分代码省略.........