#include <memory>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <cstdlib>
#include <TH1F.h>
#include <TROOT.h>
#include <TFile.h>
#include <TSystem.h>
#include "FWCore/FWLite/interface/FWLiteEnabler.h"
#include "MuonAnalysis/MomentumScaleCalibration/interface/RootTreeHandler.h"
Go to the source code of this file.
Builds a tree from the dump in the TreeDump.txt file produced by the TreeDump macro.
Definition at line 23 of file TreeFromDump.cc.
References funct::cos(), JetChargeProducer_cfi::exp, fastsim::Constants::muMass, funct::sin(), mathSSE::sqrt(), and tmp.
Referenced by main().
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);
Sin< T >::type sin(const T &t)
static double constexpr muMass
Muon mass [GeV].
reco::Particle::LorentzVector lorentzVector
Cos< T >::type cos(const T &t)
std::vector< std::vector< double > > tmp
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 35 of file TreeFromDump.cc.
References gather_cfg::cout, FWLiteEnabler::enable(), cmsRelvalreport::exit, MillePedeFileConverter_cfg::fileName, fromPtEtaPhiToPxPyPz(), mps_fire::i, analyzePatCleaning_cfg::inputFile, geometryCSVtoXML::line, AlCaHLTBitMon_QueryRunRegistry::string, and RootTreeHandler::writeTree().
39 std::cout <<
"Please provide the name of the file and if there is generator information (0 is false)" << std::endl;
47 std::cout <<
"Reading tree dump with genInfo = " << genInfo << std::endl;
50 gSystem->Load(
"libFWCoreFWLite" );
54 std::vector<MuonPair> pairVector;
55 std::vector<GenMuonPair> genPairVector;
67 while( !inputFile.eof() ) {
68 getline(inputFile, line);
71 std::stringstream ss(line);
72 for(
int i=0;
i<6; ++
i ) {
78 for(
int i=0;
i<6; ++
i ) {
88 if( (pairVector.size() != genPairVector.size()) && genInfo ) {
89 std::cout <<
"Error: the size of pairVector and genPairVector is different" << std::endl;
93 treeHandler.
writeTree(
"TreeFromDump.root", &pairVector, 0, &genPairVector);
94 std::cout <<
"Filling tree with genInfo" << std::endl;
97 treeHandler.
writeTree(
"TreeFromDump.root", &pairVector);
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=nullptr, const bool saveAll=false)
static void enable()
enable automatic library loading
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)