-
Notifications
You must be signed in to change notification settings - Fork 6
/
scanRecoTracks.C
31 lines (26 loc) · 1 KB
/
scanRecoTracks.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include "TROOT.h"
#include "TSystem.h"
#include "TChain.h"
#include "TRegexp.h"
void scanRecoTracks(std::string eName, std::string branchReg = "recoTracks_*"){
gSystem->Load("libFWCoreFWLite");
gROOT->ProcessLine("AutoLibraryLoader::enable();");
TChain* e = new TChain("Events");
e->SetScanField(0);
e->Add(eName.c_str());
TRegexp regg(branchReg.c_str(), kTRUE);
TChain* tc = e ;
TObjArray* tl = tc->GetListOfBranches();
Int_t nBr = tl->GetSize();
for (int iB=0;iB<nBr;++iB){
TBranch* br = (TBranch*)(tl->At(iB));
TString ts(br->GetName());
if(ts.Index(regg)>=0){
std::cout<<ts.Data()<<std::endl;
tc->Scan(Form("%s.obj.pt():%s.obj.eta():%s.obj.phi():%s.obj.chi2():%s.obj.ndof():\
%s.obj.hitPattern().numberOfValidHits():%s.obj.hitPattern().numberOfValidTrackerHits():%s.obj.hitPattern().numberOfValidMuonHits()",
ts.Data(), ts.Data(), ts.Data(), ts.Data(),ts.Data(), ts.Data(), ts.Data(),ts.Data()),"", "");
}
} //> e.tecoTracks.recoT0.txt
}