25 double px = ptEtaPhiE[0] *
cos(ptEtaPhiE[2]);
26 double py = ptEtaPhiE[0] *
sin(ptEtaPhiE[2]);
27 double tmp = 2 * atan(
exp(-ptEtaPhiE[1]));
28 double pz = ptEtaPhiE[0] *
cos(tmp) /
sin(tmp);
29 double E =
sqrt(px * px + py * py + pz * pz + muMass * muMass);
36 std::cout <<
"Please provide the name of the file and if there is generator information (0 is false)" << std::endl;
44 std::cout <<
"Reading tree dump with genInfo = " << genInfo << std::endl;
47 gSystem->Load(
"libFWCoreFWLite");
51 std::vector<MuonPair> pairVector;
52 std::vector<GenMuonPair> genPairVector;
58 inputFile.open(fileName.c_str());
64 while (!inputFile.eof()) {
65 getline(inputFile, line);
68 std::stringstream
ss(line);
69 for (
int i = 0;
i < 6; ++
i) {
76 for (
int i = 0;
i < 6; ++
i) {
86 if ((pairVector.size() != genPairVector.size()) && genInfo) {
87 std::cout <<
"Error: the size of pairVector and genPairVector is different" << std::endl;
91 treeHandler.
writeTree(
"TreeFromDump.root", &pairVector, 0, &genPairVector);
92 std::cout <<
"Filling tree with genInfo" << std::endl;
94 treeHandler.
writeTree(
"TreeFromDump.root", &pairVector);
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
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=nullptr, const bool saveAll=false)
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Cos< T >::type cos(const T &t)
static void enable()
enable automatic library loading