本文整理汇总了C++中TList::Print方法的典型用法代码示例。如果您正苦于以下问题:C++ TList::Print方法的具体用法?C++ TList::Print怎么用?C++ TList::Print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TList
的用法示例。
在下文中一共展示了TList::Print方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test5
void test5()
{
TFile file("test.root");
TTree* tree = (TTree *)file.Get("tree;1");
TList* list = tree->GetUserInfo() ;
list->Print();
TObjString* objstr = (TObjString*)list->At(0);
objstr->Print();
TString xmlstring = objstr->GetString();
cout << xmlstring << endl;
}
示例2: analyzePFvsCaloJetsppData
void analyzePFvsCaloJetsppData(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1) {
// std::vector<std::string> urls = CollectFiles(list);
// Printf("anaFile: %d",anaFile);
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = (size_t)lastF;
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *hltTree = new TChain("hltanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) hltTree->Add(urls[i].c_str());
chain->AddFriend(hltTree);
Printf("hltTree done");
TChain *skimTree = new TChain("skimanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) skimTree->Add(urls[i].c_str());
chain->AddFriend(skimTree);
Printf("skimTree done");
//TChain *pileupTree = new TChain("pileup/tree");
// for(size_t i=firstFile; i<lastFile; i++) pileupTree->Add(urls[i].c_str());
//chain->AddFriend(pileupTree);
TChain *pfTree = new TChain("pfcandAnalyzer/pfTree");
for(size_t i=firstFile; i<lastFile; i++) pfTree->Add(urls[i].c_str());
chain->AddFriend(pfTree);
Printf("pfTree done");
// TChain *muTree = new TChain("hltMuTree/HLTMuTree");
// for(size_t i=firstFile; i<lastFile; i++) muTree->Add(urls[i].c_str());
// chain->AddFriend(muTree);
// Printf("muTree done");
TChain *pfJetTree = new TChain("ak4PFJetAnalyzer/t");
for(size_t i=firstFile; i<lastFile; i++) pfJetTree->Add(urls[i].c_str());
chain->AddFriend(pfJetTree);
Printf("pfJetTree done");
TChain *caloJetTree = new TChain("ak4CaloJetAnalyzer/t");
for(size_t i=firstFile; i<lastFile; i++) caloJetTree->Add(urls[i].c_str());
//chain->AddFriend(caloJetTree);
Printf("caloJetTree done");
// TChain *genTree = new TChain("HiGenParticleAna/hi");
// for(size_t i=firstFile; i<lastFile; i++) genTree->Add(urls[i].c_str());
// chain->AddFriend(genTree);
// Printf("genTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
pfParticleProducer *p_pf = new pfParticleProducer("pfPartProd");
p_pf->SetInput(chain);
p_pf->SetpfParticlesName("pfParticles");
p_pf->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_pfJet = new lwJetFromForestProducer("lwJetForestProd");
p_pfJet->SetInput(pfJetTree);//chain);
p_pfJet->SetJetContName("akt4PF");
p_pfJet->SetGenJetContName("");//akt4Gen");
p_pfJet->SetEventObjects(fEventObjects);
p_pfJet->SetRadius(0.4);
lwJetFromForestProducer *p_caloJet = new lwJetFromForestProducer("lwJetForestProd");
p_caloJet->SetInput(caloJetTree);
p_caloJet->SetJetContName("akt4Calo");
p_caloJet->SetGenJetContName("");
p_caloJet->SetEventObjects(fEventObjects);
p_caloJet->SetRadius(0.4);
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
//.........这里部分代码省略.........
示例3: analyzeGenChJetMass
void analyzeGenChJetMass(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0) {
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = std::min((size_t)lastF,lastFile);
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
std::cout << "firstEvent: " << firstEvent << std::endl;
//add files to chain
TChain *chain = NULL;
//chain = new TChain("hiEvtAnalyzer/HiTree");
//for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
//Printf("hiTree done");
TChain *genTree = new TChain("HiGenParticleAna/hi");
for(size_t i=firstFile; i<lastFile; i++) genTree->Add(urls[i].c_str());
chain = genTree;
//chain->AddFriend(genTree);
Printf("genTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
genParticleProducer *p_gen = new genParticleProducer("genParticleProd");
p_gen->SetInput(chain);
p_gen->SetGenParticlesName("genParticles");
p_gen->SetEventObjects(fEventObjects);
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
//anti-kt jet finder on gen particles charged
LWJetProducer *lwjaktGen = new LWJetProducer("LWGenJetProducerAKTR030Ch","LWGenJetProducerAKTR030Ch");
//lwjaktGen->SetInput(chain);
lwjaktGen->ConnectEventObject(fEventObjects);
lwjaktGen->SetJetType(LWJetProducer::kAKT);
lwjaktGen->SetRadius(0.4);
lwjaktGen->SetGhostArea(0.005);
lwjaktGen->SetPtMinConst(0.);
lwjaktGen->SetChargedOnly(true);
lwjaktGen->SetParticlesName("genParticles");
lwjaktGen->SetJetContName("GenJetsAKTR040");
lwjaktGen->SetDoConstituentSubtraction(kFALSE);
handler->Add(lwjaktGen);
anaJetMass *anaJetMassCh = new anaJetMass("anaJetMassChR040","anaJetMassChR040");
anaJetMassCh->ConnectEventObject(fEventObjects);
anaJetMassCh->SetHiEvtName("");//hiEventContainer");
anaJetMassCh->SetJetsName("GenJetsAKTR040");
handler->Add(anaJetMassCh);
//anti-kt jet finder on gen particles all -> FULL jets
LWJetProducer *lwjaktGenFull = new LWJetProducer("LWGenJetProducerAKTR030Full","LWGenJetProducerAKTR030Full");
//lwjaktGen->SetInput(chain);
lwjaktGenFull->ConnectEventObject(fEventObjects);
lwjaktGenFull->SetJetType(LWJetProducer::kAKT);
lwjaktGenFull->SetRadius(0.4);
lwjaktGenFull->SetGhostArea(0.005);
lwjaktGenFull->SetPtMinConst(0.);
lwjaktGenFull->SetChargedOnly(false);
lwjaktGenFull->SetParticlesName("genParticles");
lwjaktGenFull->SetJetContName("GenJetsAKTR040Full");
lwjaktGenFull->SetDoConstituentSubtraction(kFALSE);
handler->Add(lwjaktGenFull);
anaJetMass *anaJetMassFull = new anaJetMass("anaJetMassFullR040","anaJetMassFullR040");
anaJetMassFull->ConnectEventObject(fEventObjects);
anaJetMassFull->SetHiEvtName("");//hiEventContainer");
anaJetMassFull->SetJetsName("GenJetsAKTR040Full");
handler->Add(anaJetMassFull);
//---------------------------------------------------------------
//Event loop
//.........这里部分代码省略.........
示例4: analyzeJES
void analyzeJES(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0) {
/*
ptminType: minimum raw pt for particles used by puppi
0 : 0 GeV
1 : 1 GeV
2 : 2 GeV
jetSignalType: jets used to select jetty region in events
0 : detector-level jets (akPu4PF)
1 : particle-level jets (gen jets)
*/
TString jetName = "aktPuppiR040";
TString jetTreeName = "akPuppi4PFJetAnalyzer";
jetName = "aktCsR040";
jetTreeName = "akCs4PFJetAnalyzer";
//jetName = "aktVsR040";
//jetTreeName = "akVs4PFJetAnalyzer";
std::cout << "analyzing JES for: " << jetName << " tree: " << jetTreeName << std::endl;
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = std::min((size_t)lastF,lastFile);
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
std::cout << "firstEvent: " << firstEvent << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *jetTree = new TChain(Form("%s/t",jetTreeName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
chain->AddFriend(jetTree);
Printf("jetTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_PUJet = new lwJetFromForestProducer("lwJetForestProd");
p_PUJet->SetInput(chain);
p_PUJet->SetJetContName(jetName);
p_PUJet->SetGenJetContName("akt4Gen");
p_PUJet->SetEventObjects(fEventObjects);
p_PUJet->SetRadius(0.4);
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
anaJetEnergyScale *anajesForest = new anaJetEnergyScale("anaJESForest","anaJESForest");
anajesForest->ConnectEventObject(fEventObjects);
anajesForest->SetHiEvtName("hiEventContainer");
anajesForest->SetGenJetsName("akt4Gen");
anajesForest->SetRecJetsName(jetName);
anajesForest->SetNCentBins(4);
anajesForest->SetUseForestMatching(true);
//anajesForest->SetMaxDistance(0.2);
handler->Add(anajesForest);
anaJetEnergyScale *anajesForestQuarks = new anaJetEnergyScale("anaJESForestQuarks","anaJESForestQuarks");
anajesForestQuarks->ConnectEventObject(fEventObjects);
anajesForestQuarks->SetHiEvtName("hiEventContainer");
anajesForestQuarks->SetGenJetsName("akt4Gen");
anajesForestQuarks->SetRecJetsName(jetName);
anajesForestQuarks->SetNCentBins(4);
anajesForestQuarks->SetUseForestMatching(true);
//anajesForestQuarks->SetMaxDistance(0.2);
anajesForestQuarks->SetRefPartonFlavor(0,2);
handler->Add(anajesForestQuarks);
anaJetEnergyScale *anajesForestGluons = new anaJetEnergyScale("anaJESForestGluons","anaJESForestGluons");
anajesForestGluons->ConnectEventObject(fEventObjects);
//.........这里部分代码省略.........
示例5: analyzePuppi
void analyzePuppi(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1) {
// std::vector<std::string> urls = CollectFiles(list);
// Printf("anaFile: %d",anaFile);
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = (size_t)lastF;
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *pfTree = new TChain("pfcandAnalyzer/pfTree");
for(size_t i=firstFile; i<lastFile; i++) pfTree->Add(urls[i].c_str());
chain->AddFriend(pfTree);
Printf("pfTree done");
// TChain *muTree = new TChain("hltMuTree/HLTMuTree");
// for(size_t i=firstFile; i<lastFile; i++) muTree->Add(urls[i].c_str());
// chain->AddFriend(muTree);
// Printf("muTree done");
//TChain *jetTree = new TChain("akPu3PFJetAnalyzer/t");
TChain *jetTree = new TChain("akPu2PFJetAnalyzer10/t");
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
chain->AddFriend(jetTree);
Printf("jetTree done");
TChain *genTree = new TChain("HiGenParticleAna/hi");
for(size_t i=firstFile; i<lastFile; i++) genTree->Add(urls[i].c_str());
chain->AddFriend(genTree);
Printf("genTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
pfParticleProducer *p_pf = new pfParticleProducer("pfPartProd");
p_pf->SetInput(chain);
p_pf->SetpfParticlesName("pfParticles");
p_pf->SetEventObjects(fEventObjects);
genParticleProducer *p_gen = new genParticleProducer("genParticleProd");
p_gen->SetInput(chain);
p_gen->SetGenParticlesName("genParticles");
p_gen->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_PUJet = new lwJetFromForestProducer("lwJetForestProd");
p_PUJet->SetInput(chain);
p_PUJet->SetJetContName("aktPUR030");
p_PUJet->SetEventObjects(fEventObjects);
p_PUJet->SetRadius(0.3);
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
//analysis modules which also produce
anaPuppiProducer *pupProd = new anaPuppiProducer("pupProd","pupProd");
pupProd->ConnectEventObject(fEventObjects);
pupProd->SetHiEvtName("hiEventContainer");
pupProd->SetPFPartName("pfParticles");
pupProd->SetPuppiPartName("puppiParticles");
pupProd->SetJetsName("aktPUR030");
pupProd->SetAddMetricType(anaPuppiProducer::kMass);
if(doPuppi) handler->Add(pupProd);
//anti-kt jet finder on reconstructed PUPPI particles ptmin=0
LWJetProducer *lwjakt = new LWJetProducer("LWJetProducerAKTR030Puppi","LWJetProducerAKTR030Puppi");
lwjakt->ConnectEventObject(fEventObjects);
lwjakt->SetJetType(LWJetProducer::kAKT);
lwjakt->SetRadius(0.3);
lwjakt->SetGhostArea(0.005);
lwjakt->SetPtMinConst(0.);
lwjakt->SetParticlesName("puppiParticles");
lwjakt->SetJetContName("JetsAKTR030Puppi");
if(doPuppi) handler->Add(lwjakt);
//.........这里部分代码省略.........
示例6: qaitsAddMetadata
//.........这里部分代码省略.........
regCategory[2]=TPRegexp("pt[0-9]+"); // pt bin
for (Int_t ibr=0; ibr<branches->GetEntriesFast(); ibr++){
TBranch * branch = (TBranch*)branches->At(ibr);
TString matchClass=""; // class match
TString brClass="";
TString brAxisTitle="";
TString brTitle="";
TString brLegend="";
//
TString brNameCase(branches->At(ibr)->GetName());
brNameCase.ToLower();
//
// define met
brClass="ITS";
brAxisTitle="";
// stat
for (Int_t ivar=0; ivar<11; ivar++) if (brNameCase.Contains( regStat[ivar])) {
brClass+=" "+statClass[ivar];
brTitle+=statTitle[ivar];
}
// kine variables
for (Int_t ivar=0; ivar<7; ivar++) if (brNameCase.Contains( regKineVariables[ivar])) {
brClass+=" "+kineVariableClass[ivar];
brAxisTitle+=" "+kineVariableAxisTitle[ivar];
brTitle+=" "+kineVariableTitle[ivar];
brLegend+=" "+kineVariableLegend[ivar];
}
// QA variables
for (Int_t ivar=0; ivar<5; ivar++) if (brNameCase.Contains( regQAVariable[ivar])) {
if ( qaVariableClass[ivar].Contains("$")==kFALSE){
brClass+=" "+ qaVariableClass[ivar];
brLegend+=" "+ qaVariableLegend[ivar];
brTitle+=" "+ qaVariableTitle[ivar];
}else{
TObjArray *amatch=regQAVariable[ivar].MatchS(brNameCase);
if (amatch){
TString match=amatch->At(0)->GetName();
brClass+=" "+match;
brLegend+=" "+match;
brTitle+=" "+match;
}
}
}
// category
for (Int_t ivar=0; ivar<3; ivar++) if (brNameCase.Contains(regCategory[ivar])) {
if (categoryClass[ivar].Contains("$")==kFALSE){
brClass+=" "+categoryClass[ivar];
brLegend+=" "+categoryLegend[ivar];
brTitle+=" "+categoryTitle[ivar];
}else{
TObjArray *amatch=regCategory[ivar].MatchS(brNameCase);
if (amatch){
TString match=amatch->At(0)->GetName();
brClass+=" "+match;
brLegend+=" "+match;
brTitle+=" "+match;
}
}
}
if (branch!=NULL && branch->GetClassName()!=NULL && strlen(branch->GetClassName())>0){
brClass+=" Class:";
brClass+=branch->GetClassName();
}
//
TStatToolkit::AddMetadata(tree,TString::Format("%s.Description",branches->At(ibr)->GetName()).Data(),
TString::Format("ITS standard QA variables. Class %s", brClass.Data()).Data());
TStatToolkit::AddMetadata(tree,TString::Format("%s.class",branches->At(ibr)->GetName()).Data(),brClass.Data());
TStatToolkit::AddMetadata(tree,TString::Format("%s.AxisTitle",branches->At(ibr)->GetName()).Data(),brAxisTitle.Data());
TStatToolkit::AddMetadata(tree,TString::Format("%s.Title",branches->At(ibr)->GetName()).Data(),brTitle.Data());
TStatToolkit::AddMetadata(tree,TString::Format("%s.Legend",branches->At(ibr)->GetName()).Data(),brLegend.Data());
if (verbose&4) printf("Class %s: \t%s\n", branches->At(ibr)->GetName(),brClass.Data());
if (verbose&8) printf("Axis title %s: \t%s\n", branches->At(ibr)->GetName(),brAxisTitle.Data());
if (verbose&16) printf("Title %s: \t%s\n", branches->At(ibr)->GetName(),brTitle.Data());
if (verbose&32) printf("Legend %s: \t%s\n", branches->At(ibr)->GetName(),brLegend.Data());
}
// Fill Based and custom metadata
//
// Index
TStatToolkit::AddMetadata(tree,"run.class","Base Index");
TStatToolkit::AddMetadata(tree,"run.Title","run");
TStatToolkit::AddMetadata(tree,"run.AxisTitle","run");
//
TList * mlist = (TList*)(tree->GetUserInfo()->FindObject("metaTable"));
mlist->Sort();
if ((verbose&1)>0){
mlist->Print();
}
if ((verbose&2)>0){
AliTreePlayer::selectMetadata(tree, "[class==\"\"]",0)->Print();
}
::Info("qaitsAddMetadata","End");
}
示例7: analyzeZgHistos
void analyzeZgHistos(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0, int activateJetShift = 0) {
/*
ptminType: minimum raw pt for particles used by puppi
0 : 0 GeV
1 : 1 GeV
2 : 2 GeV
jetSignalType: jets used to select jetty region in events
0 : detector-level jets (akPu4PF)
1 : particle-level jets (gen jets)
*/
TString jetSDName = "aktCs4PFSoftDrop";
TString jetTreeSDName = "akCsSoftDrop4PFJetAnalyzer";//"akCs4PFSoftDropJetAnalyzer";//
TString jetName = "aktPu4Calo";
TString jetTreeName = "akPu4CaloJetAnalyzer";
bool doDRVar = false;
bool doJetShift = false;
if(activateJetShift>0) doJetShift = true;
float jetShift = 0.04;
if(activateJetShift==1) jetShift = 0.04;
if(activateJetShift==2) jetShift = -0.04;
double minptjet = 30.;
//bool doDijet = false;
//if(!doDijet) minptjet = 80.;
std::cout << "analyzing subjets for: " << jetName << " tree: " << jetTreeName << std::endl;
std::cout << "analyzing subjets for: " << jetSDName << " tree: " << jetTreeSDName << std::endl;
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = std::min((size_t)lastF,lastFile);
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
std::cout << "firstEvent: " << firstEvent << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *skimTree = new TChain("skimanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) skimTree->Add(urls[i].c_str());
chain->AddFriend(skimTree);
Printf("skimTree done");
TChain *hltTree = new TChain("hltanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) hltTree->Add(urls[i].c_str());
chain->AddFriend(hltTree);
Printf("hltTree done");
TChain *jetTreeSD = new TChain(Form("%s/t",jetTreeSDName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTreeSD->Add(urls[i].c_str());
chain->AddFriend(jetTreeSD);
Printf("jetTreeSD done");
TChain *jetTree = new TChain(Form("%s/t",jetTreeName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
Printf("jetTree done");
TChain *rhoTree = new TChain("hiFJRhoAnalyzer/t");
for(size_t i=firstFile; i<lastFile; i++) rhoTree->Add(urls[i].c_str());
chain->AddFriend(rhoTree);
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
triggerProducer *p_trg = new triggerProducer("trigProd");
p_trg->SetInput(chain);
p_trg->SetTriggerMapName("triggerMap");
p_trg->AddTrigger("HLT_HIPuAK4CaloJet100_Eta5p1_v1");
p_trg->AddTrigger("HLT_HIPuAK4CaloJet100_Eta5p1_Cent30_100_v1");
p_trg->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_SDJet = new lwJetFromForestProducer("lwJetForestProdSD");
p_SDJet->SetInput(chain);
//.........这里部分代码省略.........
示例8: analyzeSubJets
void analyzeSubJets(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0) {
/*
ptminType: minimum raw pt for particles used by puppi
0 : 0 GeV
1 : 1 GeV
2 : 2 GeV
jetSignalType: jets used to select jetty region in events
0 : detector-level jets (akPu4PF)
1 : particle-level jets (gen jets)
*/
TString jetSDName = "akt4PFSD";
TString jetTreeSDName = "akSoftDrop4PFJetAnalyzer";
TString jetSDChName = "akt4PFSDCh";
TString jetTreeSDChName = "akSoftDropCh4PFJetAnalyzer";
TString jetSD000Name = "akt4PFSDZCut000";
TString jetTreeSD000Name = "akSoftDropZCut0004PFJetAnalyzer";
TString jetName = "akt4PF";
TString jetTreeName = "ak4PFJetAnalyzer";
//jetName = "akCs4PFFilter";
//jetTreeName = "akCs4PFFilterJetAnalyzer";
double minptjet = 30.;
bool doDijet = false;
if(!doDijet) minptjet = 40.;
std::cout << "analyzing subjets for: " << jetName << " tree: " << jetTreeName << std::endl;
std::cout << "analyzing subjets for: " << jetSDName << " tree: " << jetTreeSDName << std::endl;
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = std::min((size_t)lastF,lastFile);
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
std::cout << "firstEvent: " << firstEvent << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *jetTreeSD = new TChain(Form("%s/t",jetTreeSDName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTreeSD->Add(urls[i].c_str());
chain->AddFriend(jetTreeSD);
Printf("jetTreeSD done");
TChain *jetTreeSD000 = new TChain(Form("%s/t",jetTreeSD000Name.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTreeSD000->Add(urls[i].c_str());
Printf("jetTreeSD000 done");
// TChain *jetTreeSDCh = new TChain(Form("%s/t",jetTreeSDChName.Data()));
// for(size_t i=firstFile; i<lastFile; i++) jetTreeSDCh->Add(urls[i].c_str());
// Printf("jetTreeSDCh done");
TChain *jetTree = new TChain(Form("%s/t",jetTreeName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
Printf("jetTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_SDJet = new lwJetFromForestProducer("lwJetForestProdSD");
p_SDJet->SetInput(chain);
p_SDJet->SetJetContName(jetSDName);
p_SDJet->SetGenJetContName("akt4Gen");
p_SDJet->SetEventObjects(fEventObjects);
p_SDJet->SetMinJetPt(minptjet);
p_SDJet->SetRadius(0.4);
lwJetFromForestProducer *p_SD000Jet = new lwJetFromForestProducer("lwJetForestProdSD000");
p_SD000Jet->SetInput(jetTreeSD000);
p_SD000Jet->SetJetContName(jetSD000Name);
p_SD000Jet->SetGenJetContName("akt4Gen000");
p_SD000Jet->SetEventObjects(fEventObjects);
p_SD000Jet->SetMinJetPt(minptjet);
p_SD000Jet->SetRadius(0.4);
//.........这里部分代码省略.........
示例9: analyzeDijetAj
void analyzeDijetAj(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0) {
/*
ptminType: minimum raw pt for particles used by puppi
0 : 0 GeV
1 : 1 GeV
2 : 2 GeV
jetSignalType: jets used to select jetty region in events
0 : detector-level jets (akPu4PF)
1 : particle-level jets (gen jets)
*/
double ptminjet = 30.;
TString jetName = "aktCs4PF";
TString jetTreeName = "akCs4PFJetAnalyzer";
//jetName = "akCs4PFFilter";
//jetTreeName = "akCs4PFFilterJetAnalyzer";
std::cout << "analyzing subjets for: " << jetName << " tree: " << jetTreeName << std::endl;
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = std::min((size_t)lastF,lastFile);
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
std::cout << "firstEvent: " << firstEvent << std::endl;
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
TChain *skimTree = new TChain("skimanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) skimTree->Add(urls[i].c_str());
chain->AddFriend(skimTree);
Printf("skimTree done");
TChain *hltTree = new TChain("hltanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) hltTree->Add(urls[i].c_str());
chain->AddFriend(hltTree);
Printf("hltTree done");
TChain *jetTree = new TChain(Form("%s/t",jetTreeName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
chain->AddFriend(jetTree);
Printf("jetTree done");
// TChain *csJetTree = new TChain(Form("%s/t","akCs4PFJetAnalyzer"));
// for(size_t i=firstFile; i<lastFile; i++) csJetTree->Add(urls[i].c_str());
// chain->AddFriend(csJetTree);
// Printf("csJetTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
triggerProducer *p_trg = new triggerProducer("trigProd");
p_trg->SetInput(chain);//hltTree);
p_trg->SetTriggerMapName("triggerMap");
p_trg->AddTrigger("HLT_HIPuAK4CaloJet100_Eta5p1_v1");
p_trg->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_PUJet = new lwJetFromForestProducer("lwJetForestProd");
p_PUJet->SetInput(chain);
p_PUJet->SetJetContName(jetName);
p_PUJet->SetGenJetContName("");
p_PUJet->SetEventObjects(fEventObjects);
p_PUJet->SetRadius(0.4);
p_PUJet->SetMinJetPt(ptminjet);
// lwJetFromForestProducer *p_CSJet = new lwJetFromForestProducer("lwJetForestProd");
// p_CSJet->SetInput(csJetTree);
// p_CSJet->SetJetContName("aktCs4PF");
// p_CSJet->SetGenJetContName("");
// p_CSJet->SetEventObjects(fEventObjects);
// p_CSJet->SetRadius(0.4);
//---------------------------------------------------------------
//analysis modules
//
//.........这里部分代码省略.........
示例10: analyzePFCandidates
void analyzePFCandidates(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1) {
// std::vector<std::string> urls = CollectFiles(list);
// Printf("anaFile: %d",anaFile);
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = (size_t)lastF;
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
//add files to chain
TChain *chain = NULL;
// chain = new TChain("hiEvtAnalyzer/HiTree");
//for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
//Printf("hiTree done");
//TChain *pfTree = new TChain("pfcandAnalyzer/pfTree");
chain = new TChain("pfcandAnalyzer/pfTree");
//for(size_t i=firstFile; i<lastFile; i++) pfTree->Add(urls[i].c_str());
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
//chain->AddFriend(pfTree);
Printf("pfTree done");
// TChain *muTree = new TChain("hltMuTree/HLTMuTree");
// for(size_t i=firstFile; i<lastFile; i++) muTree->Add(urls[i].c_str());
// chain->AddFriend(muTree);
// Printf("muTree done");
TChain *jetTree = new TChain("ak4PFJetAnalyzer/t");//akPu4CaloJetAnalyzer/t");
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
chain->AddFriend(jetTree);
Printf("jetTree done");
TChain *hltTree = new TChain("hltanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) hltTree->Add(urls[i].c_str());
chain->AddFriend(hltTree);
Printf("hltTree done");
TChain *skimTree = new TChain("skimanalysis/HltTree");
for(size_t i=firstFile; i<lastFile; i++) skimTree->Add(urls[i].c_str());
chain->AddFriend(skimTree);
Printf("skimTree done");
if(doTracks) {
// TChain *trackTree = new TChain("anaTrack/trackTree");
TChain *trackTree = new TChain("ppTrack/trackTree");
for(size_t i=firstFile; i<lastFile; i++) trackTree->Add(urls[i].c_str());
chain->AddFriend(trackTree);
Printf("trackTree done");
}
// TChain *genTree = new TChain("HiGenParticleAna/hi");
// for(size_t i=firstFile; i<lastFile; i++) genTree->Add(urls[i].c_str());
// chain->AddFriend(genTree);
// Printf("genTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
pfParticleProducer *p_pf = new pfParticleProducer("pfPartProd");
p_pf->SetInput(chain);
p_pf->SetpfParticlesName("pfParticles");
p_pf->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_PUJet = new lwJetFromForestProducer("lwJetForestProd");
p_PUJet->SetInput(chain);
p_PUJet->SetJetContName("akt4PF");
p_PUJet->SetGenJetContName("akt4Gen");
p_PUJet->SetEventObjects(fEventObjects);
p_PUJet->SetRadius(0.4);
trackProducer *p_trk = new trackProducer("trackProd");
if(doTracks) {
p_trk->SetInput(chain);
p_trk->SetTracksName("tracks");
p_trk->SetEventObjects(fEventObjects);
}
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
//.........这里部分代码省略.........
示例11: analyzeZJetMCResponse
void analyzeZJetMCResponse(std::vector<std::string> urls, const char *outname = "eventObjects.root", Long64_t nentries = 20, Int_t firstF = -1, Int_t lastF = -1, Int_t firstEvent = 0) {
TString jetName = "aktPuppiR040";
TString jetTreeName = "akPuppi4PFJetAnalyzer";
jetName = "aktPuR030"; //"aktCsR040";
jetTreeName = "akPu3PFJetAnalyzer"; //"akCs4PFJetAnalyzer"; //akCs4PFJetAnalyzer
std::cout << "analyzing Z-jet response for: " << jetName << " tree: " << jetTreeName << std::endl;
std::cout << "nfiles: " << urls.size() << std::endl;
for (auto i = urls.begin(); i != urls.end(); ++i)
std::cout << *i << std::endl;
size_t firstFile = 0;
size_t lastFile = urls.size();
if(firstF>-1) {
firstFile = (size_t)firstF;
lastFile = (size_t)lastF;
}
std::cout << "firstFile: " << firstFile << " lastFile: " << lastFile << std::endl;
Int_t lastEvent = nentries;
if(firstEvent>0) {
lastEvent = firstEvent + nentries;
}
//add files to chain
TChain *chain = NULL;
chain = new TChain("hiEvtAnalyzer/HiTree");
for(size_t i=firstFile; i<lastFile; i++) chain->Add(urls[i].c_str());
Printf("hiTree done");
// TChain *hltTree = new TChain("hltanalysis/HltTree");
// for(size_t i=firstFile; i<lastFile; i++) hltTree->Add(urls[i].c_str());
// chain->AddFriend(hltTree);
// Printf("hltTree done");
// TChain *skimTree = new TChain("skimanalysis/HltTree");
// for(size_t i=firstFile; i<lastFile; i++) skimTree->Add(urls[i].c_str());
// chain->AddFriend(skimTree);
// Printf("skimTree done");
// TChain *muTree = new TChain("ggHiNtuplizer/EventTree");
// for(size_t i=firstFile; i<lastFile; i++) muTree->Add(urls[i].c_str());
// chain->AddFriend(muTree);
// Printf("muTree done");
TChain *genTree = new TChain("HiGenParticleAna/hi");
for(size_t i=firstFile; i<lastFile; i++) genTree->Add(urls[i].c_str());
//chain->AddFriend(genTree);
Printf("genTree done: %d",(int)genTree->GetEntries());
TChain *jetTree = new TChain(Form("%s/t",jetTreeName.Data()));
for(size_t i=firstFile; i<lastFile; i++) jetTree->Add(urls[i].c_str());
chain->AddFriend(jetTree);
Printf("jetTree done");
TList *fEventObjects = new TList();
//---------------------------------------------------------------
// producers
//
hiEventProducer *p_evt = new hiEventProducer("hiEvtProd");
p_evt->SetInput(chain);
p_evt->SetHIEventContName("hiEventContainer");
p_evt->SetEventObjects(fEventObjects);
lwMuonProducer *p_mu = new lwMuonProducer("lwMuonProd");
p_mu->SetInput(chain);
p_mu->SetlwMuonsRecoName("lwMuonsReco");
p_mu->SetlwMuonsGeneName("");
p_mu->SetEventObjects(fEventObjects);
genParticleProducer *p_gen = new genParticleProducer("genParticleProd");
p_gen->SetInput(genTree);
p_gen->SetGenParticlesName("genParticles");
p_gen->SetEventObjects(fEventObjects);
lwJetFromForestProducer *p_PUJet = new lwJetFromForestProducer("lwJetForestProd");
p_PUJet->SetInput(chain);
p_PUJet->SetJetContName(jetName);
p_PUJet->SetGenJetContName("");//akt4Gen");
p_PUJet->SetEventObjects(fEventObjects);
p_PUJet->SetRadius(0.4);
//---------------------------------------------------------------
//analysis modules
//
//handler to which all modules will be added
anaBaseTask *handler = new anaBaseTask("handler","handler");
//Z to mumu
anaZToMuMu *ZToMuMu = new anaZToMuMu("ZToMuMu","ZToMuMu");
ZToMuMu->ConnectEventObject(fEventObjects);
ZToMuMu->SetHiEvtName("hiEventContainer");
ZToMuMu->SetMuonsName("genParticles");
ZToMuMu->SetCheckPid(true);
ZToMuMu->SetZsName("zMuMuBosons");
//.........这里部分代码省略.........
示例12: get_mass
//____________________________________________________________________________
void get_mass(Double_t length_unit, Double_t density_unit)
{
//tables of Z and A
const Int_t lcin_Z = 150;
const Int_t lcin_A = 300;
// calc unit conversion factors
Double_t density_unit_to_SI = density_unit / units::kg_m3;
Double_t length_unit_to_SI = length_unit / units::m;
Double_t volume_unit_to_SI = TMath::Power(length_unit_to_SI, 3.);
#ifdef _debug_
cout << "Input density unit --> kg/m^3 : x" << density_unit_to_SI << endl;
cout << "Input length unit --> m : x" << length_unit_to_SI << endl;
#endif
// get materials in geometry
TList *matlist = gGeoManager->GetListOfMaterials();
if (!matlist ) {
cout << "Null list of materials!" << endl;
return;
} else {
#ifdef _debug_
matlist->Print();
#endif
}
int max_idx = 0; // number of mixtures in geometry
Int_t nmat = matlist->GetEntries();
for( Int_t imat = 0; imat < nmat; imat++ )
{
Int_t idx = gGeoManager->GetMaterial(imat)->GetIndex();
max_idx = TMath::Max(max_idx, idx);
}
//check if material index is unique
Int_t * checkindex = new Int_t[max_idx+1];
for( Int_t i = 0; i<max_idx+1; i++ ) checkindex[i] = 0;
for( Int_t imat = 0; imat < nmat; imat++ )
{
if( !checkindex[imat] ) checkindex[imat] = 1;
else
{
cout << "material index is not unique" << endl;
return;
}
}
#ifdef _debug_
cout << "max_idx = " << max_idx << endl;
cout << "nmat = " << nmat << endl;
#endif
TGeoVolume * topvol = gGeoManager->GetTopVolume(); //get top volume
if (!topvol) {
cout << "volume does not exist" << endl;
return;
}
TGeoIterator NodeIter(topvol);
TGeoNode *node;
NodeIter.SetType(0); // include all daughters
Double_t * volume = new Double_t[max_idx+1];
Double_t * mass = new Double_t[max_idx+1];
for( Int_t i = 0; i<max_idx+1; i++ ){ volume[i]=0.; mass[i]=0.; } // IMPORTANT! force empty arrays, allows repated calls without ending ROOT session
volume[ topvol->GetMaterial()->GetIndex() ] = topvol->Capacity() * volume_unit_to_SI; //iterator does not include topvolume
while ( (node=NodeIter()) )
{
Int_t momidx = node->GetMotherVolume()->GetMaterial()->GetIndex() ;
Int_t idx = node->GetVolume() ->GetMaterial()->GetIndex() ;
Double_t node_vol = node->GetVolume()->Capacity() * volume_unit_to_SI;
volume[ momidx ] -= node_vol; //substract subvolume from mother
volume[ idx ] += node_vol;
}
Double_t larr_MassIsotopes[lcin_Z][lcin_A] = {0.}; //[Z][A], no map in pure ROOT
Double_t larr_VolumeIsotopes[lcin_Z][lcin_A] = {0.}; //[Z][A], no map in pure ROOT
for( Int_t i=0; i<gGeoManager->GetListOfMaterials()->GetEntries(); i++ )
{
TGeoMaterial *lgeo_Mat = gGeoManager->GetMaterial(i);
Int_t idx = gGeoManager->GetMaterial(i)->GetIndex();
if( lgeo_Mat->IsMixture() )
{
TGeoMixture * lgeo_Mix = dynamic_cast <TGeoMixture*> ( lgeo_Mat );
Int_t lint_Nelements = lgeo_Mix->GetNelements();
for ( Int_t j=0; j<lint_Nelements; j++)
{
Int_t lint_Z = TMath::Nint( (Double_t) lgeo_Mix->GetZmixt()[j] );
Int_t lint_A = TMath::Nint( (Double_t) lgeo_Mix->GetAmixt()[j] );
Double_t ldou_Fraction = lgeo_Mix->GetWmixt()[j];
//.........这里部分代码省略.........