26 double muMass = 0.105658;
27 double px = ptEtaPhiE[0]*
cos(ptEtaPhiE[2]);
28 double py = ptEtaPhiE[0]*
sin(ptEtaPhiE[2]);
29 double tmp = 2*atan(
exp(-ptEtaPhiE[1]));
30 double pz = ptEtaPhiE[0]*
cos(tmp)/
sin(tmp);
31 double E =
sqrt(px*px+py*py+pz*pz+muMass*muMass);
40 std::cout <<
"Please provide the name of the file (with file: or rfio: as needed) and if there is generator information (0 is false)" << std::endl;
44 if( fileName.find(
"file:") != 0 && fileName.find(
"rfio:") != 0 ) {
45 std::cout <<
"Please provide the name of the file with file: or rfio: as needed" << std::endl;
52 std::cout <<
"Dumping tree with genInfo = " << genInfo << std::endl;
55 gSystem->Load(
"libFWCoreFWLite" );
59 TFile* inFile = TFile::Open(fileName.c_str());
68 std::vector<std::pair<unsigned int, unsigned long long> > evtRun;
69 treeHandler.
readTree(-1, fileName, &pairVector, -20, &evtRun, &genPairVector);
71 if( (pairVector.size() != genPairVector.size()) && genInfo ) {
72 std::cout <<
"Error: the size of pairVector and genPairVector is different" << std::endl;
76 outputFile.open(
"TreeDump.txt");
78 MuonPairVector::const_iterator it = pairVector.begin();
79 MuonPairVector::const_iterator genIt = genPairVector.begin();
80 std::vector<std::pair<unsigned int, unsigned long long> >::iterator evtRunIt = evtRun.begin();
81 for( ; it != pairVector.end(); ++it, ++genIt, ++evtRunIt ) {
83 outputFile << it->first.pt() <<
" " << it->first.eta() <<
" " << it->first.phi() <<
" "
84 << it->second.pt() <<
" " << it->second.eta() <<
" " << it->second.phi() <<
" ";
86 outputFile << genIt->first.pt() <<
" " << genIt->first.eta() <<
" " << genIt->first.phi() <<
" "
87 << genIt->second.pt() <<
" " << genIt->second.eta() <<
" " << genIt->second.phi() <<
" ";
89 outputFile <<
" " << evtRunIt->first <<
" " << evtRunIt->second;
90 outputFile << std::endl;
Sin< T >::type sin(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
std::vector< std::vector< double > > tmp
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=0)