CMS 3D CMS Logo

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

◆ fromPtEtaPhiToPxPyPz()

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.

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 }

References funct::cos(), JetChargeProducer_cfi::exp, fastsim::Constants::muMass, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, funct::sin(), mathSSE::sqrt(), and createJobs::tmp.

Referenced by main().

◆ main()

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:

Definition at line 34 of file TreeFromDump.cc.

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(
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 }

References dir2webdir::argc, cmsBatch::argv, gather_cfg::cout, FWLiteEnabler::enable(), beamvalidation::exit(), MillePedeFileConverter_cfg::fileName, fromPtEtaPhiToPxPyPz(), mps_fire::i, dtResolutionTest_cfi::inputFile, mps_splice::line, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, and RootTreeHandler::writeTree().

cmsBatch.argv
argv
Definition: cmsBatch.py:279
mps_fire.i
i
Definition: mps_fire.py:428
RootTreeHandler
Definition: RootTreeHandler.h:24
dir2webdir.argc
argc
Definition: dir2webdir.py:39
GenMuonPair
Definition: GenMuonPair.h:19
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
gather_cfg.cout
cout
Definition: gather_cfg.py:144
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
MuonPair
Definition: MuonPair.h:13
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
RootTreeHandler::writeTree
void writeTree(const TString &fileName, const std::vector< MuonPair > *savedPair, const int muonType=0, const std::vector< GenMuonPair > *genPair=nullptr, const bool saveAll=false)
Definition: RootTreeHandler.h:28
FWLiteEnabler::enable
static void enable()
enable automatic library loading
Definition: FWLiteEnabler.cc:46
lorentzVector
reco::Particle::LorentzVector lorentzVector
Definition: GenMuonPair.h:9
dtResolutionTest_cfi.inputFile
inputFile
Definition: dtResolutionTest_cfi.py:14
value
Definition: value.py:1
fastsim::Constants::muMass
static constexpr double muMass
Muon mass [GeV].
Definition: Constants.h:14
fromPtEtaPhiToPxPyPz
lorentzVector fromPtEtaPhiToPxPyPz(const double *ptEtaPhiE)
Definition: TreeFromDump.cc:23
MuScleFitEvent
Definition: Event.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:52
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
mps_splice.line
line
Definition: mps_splice.py:76