22 <<
"Wrong number of arguments! Please specify:" << std::endl
23 <<
" * filepath" << std::endl
24 <<
" * process name" << std::endl;
30 gSystem->Load(
"libFWCoreFWLite" );
37 TH1I* noJets =
new TH1I(
"noJets",
"N_{Jets}", 10, 0 , 10 );
38 TH1F* ptJets =
new TH1F(
"ptJets",
"pt_{Jets}", 100, 0.,300.);
39 TH1F* enJets =
new TH1F(
"enJets",
"energy_{Jets}",100, 0.,300.);
40 TH1F* etaJets =
new TH1F(
"etaJets",
"eta_{Jets}", 100, -3., 3.);
41 TH1F* phiJets =
new TH1F(
"phiJets",
"phi_{Jets}", 100, -5., 5.);
44 std::cout <<
"open file: " << argv[1] << std::endl;
46 TFile* inFile = TFile::Open(argv[1]);
48 if( inFile ) inFile->GetObject(
"Events", events_);
52 <<
"Unable to retrieve TTree Events!" << std::endl
53 <<
" Eighter wrong file name or the the tree doesn't exists" << std::endl;
60 sprintf(jetsName,
"patJets_selectedPatJets__%s.obj", argv[2]);
61 TBranch* jets_ = events_->GetBranch( jetsName ); assert( jets_!=0 );
64 std::vector<pat::Jet>
jets;
65 int nevt = events_->GetEntries();
68 std::cout <<
"start looping " << nevt <<
" events..." << std::endl;
70 for(
int evt=0; evt<
nevt; ++evt){
72 jets_->SetAddress( &jets );
74 jets_ ->GetEntry( evt );
75 events_->GetEntry( evt, 0 );
78 if(evt>0 && !(evt%10))
std::cout <<
" processing event: " << evt << std::endl;
82 noJets->Fill(jets.size());
83 for(
unsigned idx=0;
idx<jets.size(); ++
idx){
85 ptJets ->Fill(jets[
idx].pt() );
87 etaJets->Fill(jets[
idx].
eta() );
88 phiJets->Fill(jets[
idx].
phi() );
97 TFile outFile(
"analyzeJets.root",
"recreate" );
98 outFile.mkdir(
"analyzeJet");
99 outFile.cd(
"analyzeJet");
int main(int argc, char **argv)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
static void enable()
enable automatic library loading