26 double px = ptEtaPhiE[0] *
cos(ptEtaPhiE[2]);
27 double py = ptEtaPhiE[0] *
sin(ptEtaPhiE[2]);
28 double tmp = 2 * atan(
exp(-ptEtaPhiE[1]));
29 double pz = ptEtaPhiE[0] *
cos(tmp) /
sin(tmp);
30 double E =
sqrt(px * px + py * py + pz * pz + muMass * muMass);
41 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
45 if (fileName.find(
"file:") != 0 && fileName.find(
"rfio:") != 0) {
46 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
59 gSystem->Load(
"libFWCoreFWLite");
65 TH1F* muonPt_ = theDir.
make<TH1F>(
"muonPt",
"pt", 100, 0., 300.);
66 TH1F* muonEta_ = theDir.
make<TH1F>(
"muonEta",
"eta", 100, -3., 3.);
67 TH1F* muonPhi_ = theDir.
make<TH1F>(
"muonPhi",
"phi", 100, -5., 5.);
70 TFile* inFile = TFile::Open(fileName.c_str());
90 std::vector<MuonPair> pairVector;
97 if (iEvent > 0 && iEvent % 100 == 0) {
98 std::cout <<
" processing event: " << iEvent << std::endl;
108 muon1pt.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Pt");
109 muon1eta.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Eta");
110 muon1phi.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau1Phi");
111 muon2pt.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Pt");
112 muon2eta.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Eta");
113 muon2phi.
getByLabel(ev,
"goodZToMuMuEdmNtupleLoose",
"zGoldenDau2Phi");
130 if (muon1pt->size() != muon2pt->size()) {
131 std::cout <<
"Error: size of muon1 and muon2 is different. Skipping event" << std::endl;
134 for (
unsigned i = 0;
i < muon1pt->size(); ++
i) {
135 muonPt_->Fill((*muon1pt)[
i]);
136 muonEta_->Fill((*muon1eta)[i]);
137 muonPhi_->Fill((*muon1phi)[i]);
138 muonPt_->Fill((*muon2pt)[i]);
139 muonEta_->Fill((*muon2eta)[i]);
140 muonPhi_->Fill((*muon2phi)[i]);
142 double muon1[3] = {(*muon1pt)[
i], (*muon1eta)[
i], (*muon1phi)[
i]};
143 double muon2[3] = {(*muon2pt)[
i], (*muon2eta)[
i], (*muon2phi)[
i]};
146 pairVector.push_back(
150 size_t namePos = fileName.find_last_of(
'/');
151 treeHandler.writeTree((
"tree_" + fileName.substr(namePos + 1, fileName.size())).c_str(), &pairVector);
Event const & toBegin() override
Go to the very first Event.
Sin< T >::type sin(const T &t)
static double constexpr muMass
Muon mass [GeV].
Exp< T >::type exp(const T &t)
reco::Particle::LorentzVector lorentzVector
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Cos< T >::type cos(const T &t)
static void enable()
enable automatic library loading
T * make(const Args &...args) const
make new ROOT object
bool atEnd() const override
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
void getByLabel(const P &iP, const char *iModuleLabel, const char *iProductInstanceLabel=nullptr, const char *iProcessLabel=nullptr)