CMS 3D CMS Logo

RecoProducerFP420.cc
Go to the documentation of this file.
3 
7 
8 #include "CLHEP/Vector/LorentzVector.h"
9 
10 #include <cmath>
11 
12 //#include <iostream>
13 
15  // Create LHC beam line
16  // double length = param.getParameter<double>("BeamLineLength");
17  // std::cout << " BeamLineLength = " << length << std::endl;
18 
19  length = conf_.getParameter<double>("BeamLineLength"); //m
20  verbosity = conf_.getUntrackedParameter<int>("VerbosityLevel");
23 
24  edm::LogInfo("RecoProducerFP420") << "RecoProducerFP420 parameters: \n"
25  << " Verbosity: " << verbosity << "\n"
26  << " length: " << length << "\n";
27  if (verbosity > 1) {
28  std::cout << " RecoProducerFP420: constructor " << std::endl;
29  std::cout << " BeamLineLength: " << length << std::endl;
30  }
31 
32  // edm::FileInPath b1("SimTransport/HectorData/twiss_ip5_b1_v6.5.txt");
33  // edm::FileInPath b2("SimTransport/HectorData/twiss_ip5_b2_v6.5.txt");
34 
37 
38  m_beamline1 = new H_BeamLine(1, length + 0.1); // (direction, length)
39  m_beamline2 = new H_BeamLine(-1, length + 0.1); //
40 
41  try {
42  m_beamline1->fill(b1.fullPath(), 1, "IP5");
43  m_beamline2->fill(b2.fullPath(), -1, "IP5");
44  } catch (const edm::Exception& e) {
45  std::string msg = e.what();
46  msg += " caught in RecoProducerFP420... \nERROR: Could not locate SimTransport/HectorData data files.";
47  edm::LogError("DataNotFound") << msg;
48  }
49 
50  m_beamline1->offsetElements(120, -0.097);
51  m_beamline2->offsetElements(120, +0.097);
52 
53  m_beamline1->calcMatrix();
54  m_beamline2->calcMatrix();
55 
56  edm::LogInfo("RecoProducerFP420") << "==============================\n";
57 }
58 
60 
61 std::vector<RecoFP420> RecoProducerFP420::reconstruct(
62  int direction, double x1_420, double y1_420, double x2_420, double y2_420, double z1_420, double z2_420) {
63  // ==================================================================================
64  // ==================================================================================
65  std::vector<RecoFP420> rhits;
66  int restracks = 10; // max # tracks
67  rhits.reserve(restracks);
68  rhits.clear();
69  // ==================================================================================
70  // trivial (TM), angle compensation (AM) and position compensation (PM) methods
71  // #define TM 1 #define AM 2 #define PM 3
72  m_tx0 = -100., m_ty0 = -100., m_x0 = -100., m_y0 = -100.;
73  if (direction == 1) {
74  m_rp420_f = new H_RecRPObject(z1_420 * 0.001, z2_420 * 0.001, *m_beamline1); // m
75  if (m_rp420_f) {
76  if (verbosity > 1) {
77  std::cout << " RecoProducerFP420: input coord. in um " << std::endl;
78  std::cout << " x1_420: " << x1_420 << " y1_420: " << y1_420 << std::endl;
79  std::cout << " x2_420: " << x2_420 << " y2_420: " << y2_420 << std::endl;
80  }
81  m_rp420_f->setPositions(x1_420, y1_420, x2_420, y2_420); //input coord. in um
82  m_e = m_rp420_f->getE(AM); // GeV
83  // std::cout << " m_e1: " << m_rp420_f->getE( TM ) << std::endl;
84  // std::cout << " m_e2: " << m_rp420_f->getE( AM ) << std::endl;
85  m_tx0 = m_rp420_f->getTXIP(); // urad
86  m_ty0 = m_rp420_f->getTYIP(); // urad
87  m_x0 = m_rp420_f->getX0(); // um
88  m_y0 = m_rp420_f->getY0(); // um
89  m_q2 = m_rp420_f->getQ2(); // GeV^2
90  } // if ( m_rp420_f
91  } // if ( dire
92  else if (direction == 2) {
93  m_rp420_b = new H_RecRPObject(z1_420 * 0.001, z2_420 * 0.001, *m_beamline2); // m
94  if (m_rp420_b) {
95  m_rp420_b->setPositions(x1_420, y1_420, x2_420, y2_420); // input coord. in um
96  m_e = m_rp420_b->getE(AM); // GeV
97  m_tx0 = m_rp420_b->getTXIP(); // urad
98  m_ty0 = m_rp420_b->getTYIP(); // urad
99  m_x0 = m_rp420_b->getX0(); // um
100  m_y0 = m_rp420_b->getY0(); // um
101  m_q2 = m_rp420_b->getQ2(); // GeV^2
102  } // if ( m_rp420_b
103  } else {
104  return rhits;
105  }
106 
107  // ==============================
108  if (verbosity > 1) {
109  std::cout << " RecoProducerFP420: rhits.push_back " << std::endl;
110  std::cout << " m_e: " << m_e << std::endl;
111  std::cout << " m_x0: " << m_x0 << std::endl;
112  std::cout << " m_y0: " << m_y0 << std::endl;
113  std::cout << " m_tx0: " << m_tx0 << std::endl;
114  std::cout << " m_ty0: " << m_ty0 << std::endl;
115  std::cout << " m_q2: " << m_q2 << std::endl;
116  std::cout << " direction: " << direction << std::endl;
117  }
118  rhits.push_back(RecoFP420(m_e, m_x0, m_y0, m_tx0, m_ty0, m_q2, direction));
119  // ==============================
121  return rhits;
122  //============
123 }
RecoProducerFP420::verbosity
int verbosity
Definition: RecoProducerFP420.h:26
MessageLogger.h
RecoProducerFP420::m_e
double m_e
Definition: RecoProducerFP420.h:29
gather_cfg.cout
cout
Definition: gather_cfg.py:144
mps_check.msg
tuple msg
Definition: mps_check.py:285
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
RecoProducerFP420::beam1filename
std::string beam1filename
Definition: RecoProducerFP420.h:38
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
RecoProducerFP420::m_beamline2
H_BeamLine * m_beamline2
Definition: RecoProducerFP420.h:33
b2
static constexpr float b2
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
RecoProducerFP420::m_tx0
double m_tx0
Definition: RecoProducerFP420.h:30
FileInPath.h
RecoProducerFP420::conf_
edm::ParameterSet conf_
Definition: RecoProducerFP420.h:23
RecoProducerFP420::m_x0
double m_x0
Definition: RecoProducerFP420.h:29
edm::Exception
Definition: EDMException.h:77
RecoProducerFP420::m_q2
double m_q2
Definition: RecoProducerFP420.h:29
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
edm::FileInPath
Definition: FileInPath.h:64
RecoFP420.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RecoProducerFP420::m_ty0
double m_ty0
Definition: RecoProducerFP420.h:30
RecoProducerFP420::length
double length
Definition: RecoProducerFP420.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
RecoProducerFP420::reconstruct
std::vector< RecoFP420 > reconstruct(int, double, double, double, double, double, double)
Definition: RecoProducerFP420.cc:61
RecoProducerFP420::RecoProducerFP420
RecoProducerFP420(const edm::ParameterSet &conf)
Definition: RecoProducerFP420.cc:14
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
RecoFP420
Definition: RecoFP420.h:6
RecoProducerFP420::~RecoProducerFP420
virtual ~RecoProducerFP420()
Definition: RecoProducerFP420.cc:59
RecoProducerFP420::m_rp420_f
H_RecRPObject * m_rp420_f
Definition: RecoProducerFP420.h:35
RecoProducerFP420.h
RecoProducerFP420::m_rp420_b
H_RecRPObject * m_rp420_b
Definition: RecoProducerFP420.h:36
RecoProducerFP420::beam2filename
std::string beam2filename
Definition: RecoProducerFP420.h:39
RecoProducerFP420::m_beamline1
H_BeamLine * m_beamline1
Definition: RecoProducerFP420.h:32
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RecoCollectionFP420.h
RecoProducerFP420::rhits
std::vector< RecoFP420 > rhits
Definition: RecoProducerFP420.h:24
RecoProducerFP420::m_y0
double m_y0
Definition: RecoProducerFP420.h:29
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37