Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 18 of file TopMuonFWLiteAnalyzer.cc.
References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, AutoLibraryLoader::enable(), relval_parameters_module::energy, eta(), customizeTrackingMonitorSeedNumber::idx, patZpeak::muons, nevt, phi, and setNiceStyle().
23 <<
"Wrong number of arguments! Please specify:" << std::endl
24 <<
" * filepath" << std::endl
25 <<
" * process name" << std::endl;
31 gSystem->Load(
"libFWCoreFWLite" );
38 TH1I* noMuons =
new TH1I(
"noMuons",
"N(Muon)", 10, 0 , 10 );
39 TH1I* noLepts =
new TH1I(
"noLepts",
"N(Lepton)", 10, 0 , 10 );
40 TH1F* ptMuons =
new TH1F(
"ptMuons",
"pt_{Muons}", 100, 0.,300.);
41 TH1F* enMuons =
new TH1F(
"enMuons",
"energy_{Muons}",100, 0.,300.);
42 TH1F* etaMuons =
new TH1F(
"etaMuons",
"eta_{Muons}", 100, -3., 3.);
43 TH1F* phiMuons =
new TH1F(
"phiMuons",
"phi_{Muons}", 100, -5., 5.);
48 TFile* inFile = TFile::Open(
argv[1]);
50 if( inFile ) inFile->GetObject(
"Events", events_);
54 <<
"Unable to retrieve TTree Events!" << std::endl
55 <<
" Eighter wrong file name or the the tree doesn't exists" << std::endl;
62 sprintf(muonName,
"patMuons_selectedPatMuons__%s.obj",
argv[2]);
63 TBranch* muons_ = events_->GetBranch( muonName ); assert( muons_!=0 );
65 sprintf(elecName,
"patElectrons_selectedPatElectrons__%s.obj",
argv[2]);
66 TBranch* elecs_ = events_->GetBranch( elecName ); assert( elecs_!=0 );
69 std::vector<pat::Muon>
muons;
70 std::vector<pat::Electron> elecs;
71 int nevt = events_->GetEntries();
74 std::cout <<
"start looping " << nevt <<
" events..." << std::endl;
76 for(
int evt=0; evt<
nevt; ++evt){
78 muons_->SetAddress( &muons );
79 elecs_->SetAddress( &elecs );
81 muons_ ->GetEntry( evt );
82 elecs_ ->GetEntry( evt );
83 events_->GetEntry( evt, 0 );
86 if(evt>0 && !(evt%10))
std::cout <<
" processing event: " << evt << std::endl;
90 noMuons->Fill(muons.size());
91 noLepts->Fill(muons.size()+elecs.size());
92 for(
unsigned idx=0;
idx<muons.size(); ++
idx){
94 ptMuons ->Fill(muons[
idx].pt() );
96 etaMuons->Fill(muons[
idx].
eta() );
97 phiMuons->Fill(muons[
idx].
phi() );
106 TFile outFile(
"analyzeMuons.root",
"recreate" );
107 outFile.mkdir(
"analyzeMuon");
108 outFile.cd(
"analyzeMuon");
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
static void enable()
enable automatic library loading