Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
CALO JETS
PF JETS
Definition at line 17 of file TopElecFWLiteAnalyzer.cc.
References MessageLogger_cfi::cerr, gather_cfg::cout, PatTopSelectionAnalyzer_cfi::elecs, FWLiteEnabler::enable(), PVValHelper::eta, training_settings::idx, nevt, GetRecoTauVFromDQM_MC_cff::outFile, PVValHelper::phi, EnergyCorrector::pt, and setNiceStyle().
22 <<
"Wrong number of arguments! Please specify:" << std::endl
23 <<
" * filepath" << std::endl
24 <<
" * process name" << std::endl;
30 gSystem->Load(
"libFWCoreFWLite" );
37 TH1I* noElecs =
new TH1I(
"noElecs",
"N_{Elecs}", 10, 0 , 10 );
38 TH1F* ptElecs =
new TH1F(
"ptElecs",
"pt_{Elecs}", 100, 0.,300.);
39 TH1F* enElecs =
new TH1F(
"enElecs",
"energy_{Elecs}",100, 0.,300.);
40 TH1F* etaElecs =
new TH1F(
"etaElecs",
"eta_{Elecs}", 100, -3., 3.);
41 TH1F* phiElecs =
new TH1F(
"phiElecs",
"phi_{Elecs}", 100, -5., 5.);
46 TFile* inFile = TFile::Open(
argv[1]);
47 TTree* events_=
nullptr;
48 if( inFile ) inFile->GetObject(
"Events", events_);
49 if( events_==
nullptr ){
52 <<
"Unable to retrieve TTree Events!" << std::endl
53 <<
" Eighter wrong file name or the the tree doesn't exists" << std::endl;
60 sprintf(elecName,
"patElectrons_selectedPatElectrons__%s.obj",
argv[2]);
61 TBranch* elecs_ = events_->GetBranch( elecName ); assert( elecs_!=
nullptr );
64 std::vector<pat::Electron>
elecs;
65 int nevt = events_->GetEntries();
68 std::cout <<
"start looping " << nevt <<
" events..." << std::endl;
70 for(
int evt=0; evt<
nevt; ++evt){
72 elecs_->SetAddress( &elecs );
74 elecs_ ->GetEntry( evt );
75 events_->GetEntry( evt, 0 );
78 if(evt>0 && !(evt%10))
std::cout <<
" processing event: " << evt << std::endl;
82 noElecs->Fill(elecs.size());
83 for(
unsigned idx=0;
idx<elecs.size(); ++
idx){
85 ptElecs ->Fill(elecs[
idx].
pt() );
86 enElecs ->Fill(elecs[
idx].energy());
87 etaElecs->Fill(elecs[
idx].
eta() );
88 phiElecs->Fill(elecs[
idx].
phi() );
97 TFile
outFile(
"analyzeElecs.root",
"recreate" );
static void enable()
enable automatic library loading