CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
TreeFromDump.cc File Reference
#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.

Functions

lorentzVector fromPtEtaPhiToPxPyPz (const double *ptEtaPhiE)
 
int main (int argc, char *argv[])
 

Function Documentation

lorentzVector fromPtEtaPhiToPxPyPz ( const double *  ptEtaPhiE)

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(), funct::exp(), fastsim::Constants::muMass, funct::sin(), mathSSE::sqrt(), and createJobs::tmp.

23  {
24  double muMass = 0.105658;
25  double px = ptEtaPhiE[0] * cos(ptEtaPhiE[2]);
26  double py = ptEtaPhiE[0] * sin(ptEtaPhiE[2]);
27  double tmp = 2 * atan(exp(-ptEtaPhiE[1]));
28  double pz = ptEtaPhiE[0] * cos(tmp) / sin(tmp);
29  double E = sqrt(px * px + py * py + pz * pz + muMass * muMass);
30 
31  return lorentzVector(px, py, pz, E);
32 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static double constexpr muMass
Muon mass [GeV].
Definition: Constants.h:14
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
tmp
align.sh
Definition: createJobs.py:716
int main ( int  argc,
char *  argv[] 
)

===============================================================================================================================================================================================


variant2: for each run define phi-averaged A for normalization channel (Dref,16) and then, divide Rijk on it, i.e. get RRijk

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=29 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=19

eta=17

eta=25

eta=23

eta=22

eta=21

eta=26

eta=24

eta=20

eta=19

eta=18

eta=27 L1=1

eta=25 L1=1

eta=23 L1=1

eta=22 L1=1

eta=21 L1=1

eta=26 L1=1

eta=24 L1=1

eta=20 L1=1

eta=19 L1=1

eta=18 L1=1

eta=17 L1=1

eta=28 L7=1

eta=27 L7=1

eta=25 L7=1

eta=23 L7=1

eta=22 L7=1

eta=21 L7=1

eta=26 L7=1

eta=24 L7=1

eta=20 L7=1

eta=19 L7=1

eta=18 L7=1

eta=17 L7=1

eta=27

eta=28

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

errA with average Amplitudes

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

Summed Amplitude Plots:

RBX:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Prepare maps of good/bad channels:

Definition at line 34 of file TreeFromDump.cc.

References gather_cfg::cout, FWLiteEnabler::enable(), beamvalidation::exit(), MillePedeFileConverter_cfg::fileName, fromPtEtaPhiToPxPyPz(), mps_fire::i, writeEcalDQMStatus::inputFile, geometryCSVtoXML::line, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, relativeConstraints::value, and RootTreeHandler::writeTree().

34  {
35  if (argc != 3) {
36  std::cout << "Please provide the name of the file and if there is generator information (0 is false)" << std::endl;
37  exit(1);
38  }
40  std::stringstream ss;
41  ss << argv[2];
42  bool genInfo = false;
43  ss >> genInfo;
44  std::cout << "Reading tree dump with genInfo = " << genInfo << std::endl;
45 
46  // load framework libraries
47  gSystem->Load("libFWCoreFWLite");
49 
50  // MuonPairVector pairVector;
51  std::vector<MuonPair> pairVector;
52  std::vector<GenMuonPair> genPairVector;
53 
54  // Create the RootTreeHandler to save the events in the root tree
55  RootTreeHandler treeHandler;
56 
57  std::ifstream inputFile;
58  inputFile.open(fileName.c_str());
59 
61  double value[6];
62  double genValue[6];
63  // Read the information from a txt file
64  while (!inputFile.eof()) {
65  getline(inputFile, line);
66  if (!line.empty()) {
67  // std::cout << "line = " << line << std::endl;
68  std::stringstream ss(line);
69  for (int i = 0; i < 6; ++i) {
70  ss >> value[i];
71  // std::cout << "value["<<i<<"] = " << value[i] << std::endl;
72  }
73  pairVector.push_back(
74  MuonPair(fromPtEtaPhiToPxPyPz(value), fromPtEtaPhiToPxPyPz(&(value[3])), MuScleFitEvent(0, 0, 0, 0, 0, 0)));
75  if (genInfo) {
76  for (int i = 0; i < 6; ++i) {
77  ss >> genValue[i];
78  // std::cout << "genValue["<<i<<"] = " << genValue[i] << std::endl;
79  }
80  genPairVector.push_back(GenMuonPair(fromPtEtaPhiToPxPyPz(genValue), fromPtEtaPhiToPxPyPz(&(genValue[3])), 0));
81  }
82  }
83  }
84  inputFile.close();
85 
86  if ((pairVector.size() != genPairVector.size()) && genInfo) {
87  std::cout << "Error: the size of pairVector and genPairVector is different" << std::endl;
88  }
89 
90  if (genInfo) {
91  treeHandler.writeTree("TreeFromDump.root", &pairVector, 0, &genPairVector);
92  std::cout << "Filling tree with genInfo" << std::endl;
93  } else {
94  treeHandler.writeTree("TreeFromDump.root", &pairVector);
95  std::cout << "Filling tree" << std::endl;
96  }
97  // close input file
98  inputFile.close();
99 
100  return 0;
101 }
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=nullptr, const bool saveAll=false)
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Definition: TreeDump.cc:24
static void enable()
enable automatic library loading
tuple argc
Definition: dir2webdir.py:39
tuple cout
Definition: gather_cfg.py:144