123 return (
b.x() >
a.x());
126 return (
b.y() >
a.y());
128 return (
a.z() >
b.z());
204 readMoreMcTruth_(iConfig.getParameter<
bool>(
"readMoreMcTruth")),
221 produces<std::vector<TTTrack<Ref_Phase2TrackerDigi_>>>(
"Level1TTTracks").setBranchAlias(
"Level1TTTracks");
239 esGetToken_ = esConsumes<trackerDTC::Setup, trackerDTC::SetupRcd, edm::Transition::BeginRun>();
323 auto L1TkTracksForOutput = std::make_unique<std::vector<TTTrack<Ref_Phase2TrackerDigi_>>>();
336 ev.setIP(bsPosition.x(), bsPosition.y());
353 map<edm::Ptr<TrackingParticle>,
int> translateTP;
366 for (
const auto& iterTP : *TrackingParticleHandle) {
371 if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty())
374 if (iterTP.g4Tracks().empty()) {
378 int sim_eventid = iterTP.g4Tracks().at(0).eventId().event();
379 int sim_type = iterTP.pdgId();
380 float sim_pt = iterTP.pt();
381 float sim_eta = iterTP.eta();
382 float sim_phi = iterTP.phi();
384 float vx = iterTP.vertex().x();
385 float vy = iterTP.vertex().y();
386 float vz = iterTP.vertex().z();
388 if (sim_pt < 1.0 ||
std::abs(vz) > 100.0 || hypot(vx, vy) > 50.0)
391 ev.addL1SimTrack(sim_eventid, ntps, sim_type, sim_pt, sim_eta, sim_phi, vx, vy, vz);
393 translateTP[tp_ptr] = ntps;
406 for (
const int& channel : handleDTC->
tfpChannels()) {
409 static string dtcbasenames[12] = {
410 "PS10G_1",
"PS10G_2",
"PS10G_3",
"PS10G_4",
"PS_1",
"PS_2",
"2S_1",
"2S_2",
"2S_3",
"2S_4",
"2S_5",
"2S_6"};
412 string dtcname = dtcbasenames[channel % 12];
414 if (channel % 24 >= 12)
415 dtcname =
"neg" + dtcname;
417 dtcname += (channel < 24) ?
"_A" :
"_B";
423 for (
size_t stubIndex = 0; stubIndex < streamFromDTC.size(); ++stubIndex) {
426 if (stub.first.isNull()) {
433 string layerword = stub.second.to_string().substr(61, 2);
434 unsigned int layercode = 2 * (layerword[0] -
'0') + layerword[1] -
'0';
439 static int layerdisktab[12][4] = {{0, 6, 8, 10},
452 int layerdisk = layerdisktab[channel % 12][layercode];
456 constexpr
int DTCLinkWordSize = 64;
457 constexpr
int StubWordSize = 36;
458 constexpr
int LayerandStatusCodeSize = 3;
460 stub.second.to_string().substr(DTCLinkWordSize - StubWordSize - LayerandStatusCodeSize, StubWordSize);
461 string stubwordhex =
"";
464 for (
unsigned int i = 0;
i < 9;
i++) {
465 bitset<4> bits(stubword.substr(
i * 4, 4));
466 ulong
val = bits.to_ulong();
467 stubwordhex += ((
val < 10) ? (
'0' +
val) : (
'A' +
val - 10));
472 innerCluster = stub.first->clusterRef(0);
474 outerCluster = stub.first->clusterRef(1);
480 const DetId innerDetId = innerCluster->getDetId();
482 const auto* theGeomDet_inner =
dynamic_cast<const PixelGeomDetUnit*
>(det_inner);
485 MeasurementPoint coords_inner = innerCluster->findAverageLocalCoordinatesCentered();
487 GlobalPoint posStub_inner = theGeomDet_inner->surface().toGlobal(clustlp_inner);
489 const DetId outerDetId = outerCluster->getDetId();
491 const auto* theGeomDet_outer =
dynamic_cast<const PixelGeomDetUnit*
>(det_outer);
494 MeasurementPoint coords_outer = outerCluster->findAverageLocalCoordinatesCentered();
496 GlobalPoint posStub_outer = theGeomDet_outer->surface().toGlobal(clustlp_outer);
498 bool isFlipped = (posStub_outer.
mag() < posStub_inner.
mag());
500 vector<int> assocTPs;
502 for (
unsigned int iClus = 0; iClus <= 1; iClus++) {
504 const TTClusterRef& ttClusterRef = stub.first->clusterRef(iClus);
507 vector<edm::Ptr<TrackingParticle>> vecTpPtr = MCTruthTTClusterHandle->findTrackingParticlePtrs(ttClusterRef);
510 if (translateTP.find(tpPtr) != translateTP.end()) {
512 assocTPs.push_back(translateTP.at(tpPtr));
514 assocTPs.push_back(-translateTP.at(tpPtr));
518 assocTPs.push_back(0);
523 double stubbend = stub.first->bendFE();
524 if (ttPos.
z() < -120) {
525 stubbend = -stubbend;
538 stub.first->innerClusterPosition(),
542 stubMap[lastStub] = stub.first;
562 if (
track.duplicate())
573 double tmp_chi2rphi =
track.chisqrphi();
574 double tmp_chi2rz =
track.chisqrz();
575 unsigned int tmp_hit =
track.hitpattern();
591 unsigned int trksector =
track.sector();
592 unsigned int trkseed = (
unsigned int)
abs(
track.seed());
594 aTrack.setPhiSector(trksector);
595 aTrack.setTrackSeedType(trkseed);
597 const vector<trklet::L1TStub>& stubptrs =
track.stubs();
598 vector<trklet::L1TStub> stubs;
600 stubs.reserve(stubptrs.size());
601 for (
const auto& stubptr : stubptrs) {
602 stubs.push_back(stubptr);
605 stubMapType::const_iterator it;
606 for (
const auto& itstubs : stubs) {
607 it = stubMap.find(itstubs);
608 if (it != stubMap.end()) {
609 aTrack.addStubRef(it->second);
616 aTrack.setStubPtConsistency(
620 aTrack.setTrackWordBits();
629 L1TkTracksForOutput->push_back(aTrack);
Log< level::Info, true > LogVerbatim
int dtcId(int tklId) const
void setMemoryModulesFile(std::string memoryModulesFileName)
T getParameter(std::string const &) const
edm::InputTag MCTruthStubInputTag
edm::FileInPath tableTREFile
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
string asciiEventOutName_
const Point & position() const
position
std::string fullPath() const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken_
void setFitPatternFile(std::string fitPatternFileName)
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
#define DEFINE_FWK_MODULE(type)
Global3DPoint GlobalPoint
edm::InputTag MCTruthClusterInputTag
trklet::TrackletEventProcessor eventProcessor
void event(SLHCEvent &ev)
std::vector< Frame > Stream
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
const std::vector< int > & tfpChannels() const
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::FileInPath tableTEDFile
void init(Settings const &theSettings)
const Stream & stream(int tfpRegion, int tfpChannel) const
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
std::ofstream asciiEventOut_
bool psModule(int dtcId) const
edm::EDGetTokenT< TTDTC > tokenDTC_
edm::FileInPath processingModulesFile
Abs< T >::type abs(const T &t)
const std::vector< int > & tfpRegions() const
bool getData(T &iHolder) const
edm::EDGetTokenT< TTClusterAssociationMap< Ref_Phase2TrackerDigi_ > > ttClusterMCTruthToken_
trklet::Settings settings
Class to process and provide run-time constants used by Track Trigger emulators.
Class to store the L1 Track Trigger stubs.
edm::EDGetTokenT< std::vector< TrackingParticle > > TrackingParticleToken_
const std::vector< Track > & tracks() const
bool operator()(const trklet::L1TStub &a, const trklet::L1TStub &b) const
edm::FileInPath wiresFile
edm::InputTag TrackingParticleInputTag
bool debugTracklet() const
void endRun(edm::Run const &, edm::EventSetup const &) override
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
std::pair< TTStubRef, BV > Frame
auto const & tracks
cannot be loose
~L1FPGATrackProducer() override
NOTE: this is needed even if it seems not.
XYZPointD XYZPoint
point in space with cartesian internal representation
Class to store the L1 Track Trigger tracks.
void setProcessingModulesFile(std::string processingModulesFileName)
unsigned int nHelixPar() const
TTClusterRefT< Ref_Phase2TrackerDigi_ > TTClusterRef
L1FPGATrackProducer(const edm::ParameterSet &iConfig)
Constructor/destructor.
Class to store hardware like structured TTStub Collection used by Track Trigger emulators.
edm::FileInPath memoryModulesFile
edm::ESGetToken< trackerDTC::Setup, trackerDTC::SetupRcd > esGetToken_
std::map< string, vector< int > > dtclayerdisk
std::unique_ptr< L1TrackQuality > trackQualityModel_
edm::FileInPath fitPatternFile
File path for configuration files.
void setNbitstrackletindex(unsigned int nbitstrackletindex)
void setNHelixPar(unsigned int nHelixPar)
void setWiresFile(std::string wiresFileName)
void setBfield(double bfield)
void setTableTREFile(std::string tableTREFileName)
edm::ParameterSet config
Containers of parameters passed by python configuration file.
void setTableTEDFile(std::string tableTEDFileName)
GlobalPoint stubPos(bool hybrid, const TTDTC::Frame &frame, int tfpRegion, int tfpChannel) const
void setExtended(bool extended)
float getConsistency(TTTrack< Ref_Phase2TrackerDigi_ > aTrack, const TrackerGeometry *theTrackerGeom, const TrackerTopology *tTopo, double mMagneticFieldStrength, int nPar)