#include <memory>
#include <string>
#include <vector>
#include <sstream>
#include <fstream>
#include <iostream>
#include <stdlib.h>
#include <TH1F.h>
#include <TROOT.h>
#include <TFile.h>
#include <TSystem.h>
#include "FWCore/FWLite/interface/AutoLibraryLoader.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(), create_public_lumi_plots::exp, funct::sin(), mathSSE::sqrt(), and tmp.
25 double muMass = 0.105658;
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)
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, AutoLibraryLoader::enable(), cmsRelvalreport::exit, convertXMLtoSQLite_cfg::fileName, fromPtEtaPhiToPxPyPz(), i, analyzePatCleaning_cfg::inputFile, geometryCSVtoXML::line, AlCaHLTBitMon_QueryRunRegistry::string, relativeConstraints::value, 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);
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=0, const bool saveAll=false)
static void enable()
enable automatic library loading