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);
36 int main(
int argc,
char* argv[])
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 treeHandler.
readTree(-1, fileName, &pairVector, -20, &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 for( ; it != pairVector.end(); ++it, ++genIt ) {
81 outputFile << it->first.pt() <<
" " << it->first.eta() <<
" " << it->first.phi() <<
" "
82 << it->second.pt() <<
" " << it->second.eta() <<
" " << it->second.phi() <<
" ";
84 outputFile << genIt->first.pt() <<
" " << genIt->first.eta() <<
" " << genIt->first.phi() <<
" "
85 << genIt->second.pt() <<
" " << genIt->second.eta() <<
" " << genIt->second.phi() <<
" ";
87 outputFile << std::endl;
Sin< T >::type sin(const T &t)
def main
— Main —############################
Exp< T >::type exp(const T &t)
reco::Particle::LorentzVector lorentzVector
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Cos< T >::type cos(const T &t)
std::vector< std::pair< lorentzVector, lorentzVector > > MuonPairVector
void readTree(const int maxEvents, const TString &fileName, MuonPairVector *savedPair, const int muonType, MuonPairVector *genPair=0)
std::vector< std::vector< double > > tmp
static void enable()
enable automatic library loading