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);
37 std::cout <<
"Please provide the name of the file (with file: or rfio: as needed) and if there is generator "
38 "information (0 is false)"
43 if (fileName.find(
"file:") != 0 && fileName.find(
"rfio:") != 0) {
44 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
51 std::cout <<
"Dumping tree with genInfo = " << genInfo << std::endl;
54 gSystem->Load(
"libFWCoreFWLite");
58 TFile* inFile = TFile::Open(fileName.c_str());
67 std::vector<std::pair<unsigned int, unsigned long long> > evtRun;
68 treeHandler.
readTree(-1, fileName, &pairVector, -20, &evtRun, &genPairVector);
70 if ((pairVector.size() != genPairVector.size()) && genInfo) {
71 std::cout <<
"Error: the size of pairVector and genPairVector is different" << std::endl;
75 outputFile.open(
"TreeDump.txt");
77 MuonPairVector::const_iterator it = pairVector.begin();
78 MuonPairVector::const_iterator genIt = genPairVector.begin();
79 std::vector<std::pair<unsigned int, unsigned long long> >::iterator evtRunIt = evtRun.begin();
80 for (; it != pairVector.end(); ++it, ++genIt, ++evtRunIt) {
82 outputFile << it->first.pt() <<
" " << it->first.eta() <<
" " << it->first.phi() <<
" " << it->second.pt() <<
" "
83 << it->second.eta() <<
" " << it->second.phi() <<
" ";
85 outputFile << genIt->first.pt() <<
" " << genIt->first.eta() <<
" " << genIt->first.phi() <<
" "
86 << genIt->second.pt() <<
" " << genIt->second.eta() <<
" " << genIt->second.phi() <<
" ";
88 outputFile <<
" " << evtRunIt->first <<
" " << evtRunIt->second;
89 outputFile << std::endl;
Sin< T >::type sin(const T &t)
void readTree(const int maxEvents, const TString &fileName, MuonPairVector *savedPair, const int muonType, std::vector< std::pair< unsigned int, unsigned long long > > *evtRun, MuonPairVector *genPair=nullptr)
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
std::vector< std::pair< lorentzVector, lorentzVector > > MuonPairVector