Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 40 of file ZntupleToTreeConverter.cc.
References fwlite::Event::atEnd(), gather_cfg::cout, AutoLibraryLoader::enable(), ev, cmsRelvalreport::exit, convertXMLtoSQLite_cfg::fileName, fromPtEtaPhiToPxPyPz(), fwlite::Handle< T >::getByLabel(), i, iEvent, fwlite::Handle< T >::isValid(), TFileDirectory::make(), TFileDirectory::mkdir(), AlCaHLTBitMon_QueryRunRegistry::string, TrackerOfflineValidation_Standalone_cff::TFileService, and fwlite::Event::toBegin().
44 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
49 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
62 gSystem->Load(
"libFWCoreFWLite" );
68 TH1F* muonPt_ = theDir.
make<TH1F>(
"muonPt",
"pt", 100, 0.,300.);
69 TH1F* muonEta_ = theDir.
make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
70 TH1F* muonPhi_ = theDir.make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
73 TFile* inFile = TFile::Open(
fileName.c_str());
94 std::vector<MuonPair> pairVector;
102 if(iEvent>0 && iEvent%100==0){
103 std::cout <<
" processing event: " << iEvent << std::endl;
113 muon1pt.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Pt");
114 muon1eta.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Eta");
115 muon1phi.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Phi");
116 muon2pt.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Pt");
117 muon2eta.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Eta");
118 muon2phi.
getByLabel(
ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Phi");
120 if( !muon1pt.
isValid() )
continue;
121 if( !muon1eta.
isValid() )
continue;
122 if( !muon1phi.
isValid() )
continue;
123 if( !muon2pt.
isValid() )
continue;
124 if( !muon2eta.
isValid() )
continue;
125 if( !muon2phi.
isValid() )
continue;
129 if( muon1pt->size() != muon2pt->size() ) {
130 std::cout <<
"Error: size of muon1 and muon2 is different. Skipping event" << std::endl;
133 for(
unsigned i=0;
i<muon1pt->size(); ++
i){
134 muonPt_->Fill( (*muon1pt)[
i] );
135 muonEta_->Fill( (*muon1eta)[i] );
136 muonPhi_->Fill( (*muon1phi)[i] );
137 muonPt_->Fill( (*muon2pt)[i] );
138 muonEta_->Fill( (*muon2eta)[i] );
139 muonPhi_->Fill( (*muon2phi)[i] );
141 double muon1[3] = {(*muon1pt)[
i], (*muon1eta)[
i], (*muon1phi)[
i]};
142 double muon2[3] = {(*muon2pt)[
i], (*muon2eta)[
i], (*muon2phi)[
i]};
148 size_t namePos =
fileName.find_last_of(
"/");
149 treeHandler.writeTree((
"tree_"+
fileName.substr(namePos+1,
fileName.size())).c_str(), &pairVector);
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=0, const char *iProcessLabel=0)
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
static void enable()
enable automatic library loading