36 static constexpr
float REcal = 129.;
37 static constexpr
float ZEcal = 315.4;
53 float CorrectedEta(
float eta,
float zv)
const;
86 label_(iConfig.getParameter<std::
string>(
"label")),
87 etMin_((float)iConfig.getParameter<double>(
"ETmin")),
88 zMax_((float)iConfig.getParameter<double>(
"ZMAX")),
89 chi2Max_((float)iConfig.getParameter<double>(
"CHI2MAX")),
90 pTMinTra_((float)iConfig.getParameter<double>(
"PTMINTRA")),
91 dR2Min_((float)iConfig.getParameter<double>(
"DRmin") * (float)iConfig.getParameter<double>(
"DRmin")),
92 dR2Max_((float)iConfig.getParameter<double>(
"DRmax") * (float)iConfig.getParameter<double>(
"DRmax")),
93 primaryVtxConstrain_(iConfig.getParameter<bool>(
"PrimaryVtxConstrain")),
94 deltaZMax_((float)iConfig.getParameter<double>(
"DeltaZMax")),
95 isoCut_((float)iConfig.getParameter<double>(
"IsoCut")),
96 relativeIsolation_(iConfig.getParameter<bool>(
"RelativeIsolation")) {
97 produces<TkEmCollection>(
label_);
106 auto result = std::make_unique<TkEmCollection>();
111 if (!L1TTTrackHandle.isValid()) {
112 LogError(
"L1TkEmParticleProducer") <<
"\nWarning: L1TTTrackCollectionType not found in the event. Exit."
118 float zvtxL1tk = -999;
122 if (!L1VertexHandle.isValid()) {
124 <<
"Warning: TkPrimaryVertexCollection not found in the event. Won't use any PrimaryVertex constraint."
126 primaryVtxConstrain =
false;
128 std::vector<TkPrimaryVertex>::const_iterator vtxIter = L1VertexHandle->begin();
131 zvtxL1tk = vtxIter->zvertex();
138 if (!eGammaHandle.isValid()) {
139 LogError(
"L1TkEmParticleProducer") <<
"\nWarning: L1EmCollection not found in the event. Exit." << std::endl;
146 for (egIter = eGammaCollection.begin(0); egIter != eGammaCollection.end(0); ++egIter)
151 float et = egIter->et();
155 float eta = egIter->eta();
161 float phi = egIter->phi();
169 for (
const auto&
track : *L1TTTrackHandle) {
170 float Pt =
track.momentum().perp();
171 float Eta =
track.momentum().eta();
173 float z =
track.POCA().z();
183 if (dr2 < dR2Max_ && dr2 >=
dR2Min_) {
191 if (dr2 < dR2Max_ && dr2 >=
dR2Min_) {
196 float trkisol = -999;
197 float trkisolPV = -999;
200 trkisol = sumPt / et;
201 trkisolPV = sumPtPV / et;
208 float isolation = primaryVtxConstrain ? trkisolPV : trkisol;
211 TkEm trkEm(P4, EGammaRef, trkisol, trkisolPV);
238 float thetaprime = atan(-
REcal / zv);
240 thetaprime = thetaprime +
M_PI;
241 float etaprime = -
log(
tan(0.5 * thetaprime));
247 float tanhalftheta =
exp(-eta);
248 float tantheta = 2. * tanhalftheta / (1. - tanhalftheta * tanhalftheta);
252 delta =
REcal / tantheta;
260 float tanthetaprime = delta * tantheta / (delta -
zv);
261 float thetaprime = atan(tanthetaprime);
263 thetaprime = thetaprime +
M_PI;
264 etaprime = -
log(
tan(0.5 * thetaprime));
275 desc.
add<
string>(
"label",
"EG");
279 desc.
add<
double>(
"ETmin", -1.);
280 desc.
add<
bool>(
"RelativeIsolation",
true);
281 desc.
add<
double>(
"IsoCut", 0.23);
282 desc.
add<
double>(
"ZMAX", 25.);
283 desc.
add<
double>(
"CHI2MAX", 100.);
284 desc.
add<
double>(
"PTMINTRA", 2.);
285 desc.
add<
double>(
"DRmin", 0.07);
286 desc.
add<
double>(
"DRmax", 0.30);
287 desc.
add<
bool>(
"PrimaryVtxConstrain",
false);
288 desc.
add<
double>(
"DeltaZMax", 0.6);
289 descriptions.
add(
"l1TkEmParticleProducer", desc);
static constexpr float EtaECal
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static std::vector< std::string > checklist log
edm::Ref< EGammaBxCollection > EGammaRef
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
~L1TkEmParticleProducer() override
const edm::EDGetTokenT< EGammaBxCollection > egToken_
Exp< T >::type exp(const T &t)
Log< level::Error, false > LogError
const bool primaryVtxConstrain_
static constexpr float REcal
const edm::EDGetTokenT< TkPrimaryVertexCollection > vertexToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const edm::EDGetTokenT< L1TTTrackCollectionType > trackToken_
std::vector< T >::const_iterator const_iterator
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
const bool relativeIsolation_
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
L1TkEmParticleProducer(const edm::ParameterSet &)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Class to store the L1 Track Trigger tracks.
std::vector< TkPrimaryVertex > TkPrimaryVertexCollection
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static constexpr float ZEcal
std::vector< L1TTTrackType > L1TTTrackCollectionType
float CorrectedEta(float eta, float zv) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Log< level::Warning, false > LogWarning