CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
GE0TriggerPseudoBuilder Class Reference

#include <GE0TriggerPseudoBuilder.h>

Public Types

enum  trig_me0s { trig_me0s::MAX_ENDCAPS = 2, trig_me0s::MAX_CHAMBERS = 18 }
 

Public Member Functions

void build (const GEMSegmentCollection &me0segments, GE0TriggerDigiCollection &oc_trig)
 
void dumpAllME0Segments (const GEMSegmentCollection &segments) const
 
 GE0TriggerPseudoBuilder (const edm::ParameterSet &)
 
void setME0Geometry (const GEMGeometry *g)
 
 ~GE0TriggerPseudoBuilder ()
 

Private Member Functions

ME0TriggerDigi segmentConversion (const GEMSegment segment)
 

Private Attributes

edm::ParameterSet config_
 
double dphiresolution_
 
int info_
 
const GEMGeometryme0_g
 

Static Private Attributes

static const int max_chamber
 
static const int max_endcap
 
static const unsigned int ME0KeyLayer = 3
 
static const int ME0TriggerCentralBX = 8
 
static const int min_chamber
 
static const int min_endcap
 

Detailed Description

Builds GE0 trigger objects from GE0 segment

Author
Original ME0 code by Tao Huang (TAMU). Converted and updated to GE0 by Ian J. Watson (USeoul)

Definition at line 20 of file GE0TriggerPseudoBuilder.h.

Member Enumeration Documentation

◆ trig_me0s

Max values of trigger labels for all ME0s; used to construct TMB processors.

Enumerator
MAX_ENDCAPS 
MAX_CHAMBERS 

Definition at line 42 of file GE0TriggerPseudoBuilder.h.

42 { MAX_ENDCAPS = 2, MAX_CHAMBERS = 18 };

Constructor & Destructor Documentation

◆ GE0TriggerPseudoBuilder()

GE0TriggerPseudoBuilder::GE0TriggerPseudoBuilder ( const edm::ParameterSet conf)
explicit

Configure the algorithm via constructor. Receives ParameterSet percolated down from EDProducer which owns this Builder.

Definition at line 12 of file GE0TriggerPseudoBuilder.cc.

References config_, dphiresolution_, edm::ParameterSet::getUntrackedParameter(), and info_.

12  {
13  config_ = conf;
14  info_ = config_.getUntrackedParameter<int>("info", 0);
15  dphiresolution_ = config_.getUntrackedParameter<double>("DeltaPhiResolution", 0.25);
16 }
T getUntrackedParameter(std::string const &, T const &) const

◆ ~GE0TriggerPseudoBuilder()

GE0TriggerPseudoBuilder::~GE0TriggerPseudoBuilder ( )

Definition at line 18 of file GE0TriggerPseudoBuilder.cc.

18 {}

Member Function Documentation

◆ build()

void GE0TriggerPseudoBuilder::build ( const GEMSegmentCollection me0segments,
GE0TriggerDigiCollection oc_trig 
)

Build Triggers from ME0 segment in each chamber and fill them into output collections.

Definition at line 20 of file GE0TriggerPseudoBuilder.cc.

References relativeConstraints::cham, ALCARECOPPSCalTrackBasedSel_cff::detid, dumpAllME0Segments(), info_, LogTrace, MAX_CHAMBERS, MAX_ENDCAPS, me0Segments_cfi::me0Segments, MuonDigiCollection< IndexType, DigiType >::put(), nano_mu_digi_cff::region, segmentConversion(), and ClusterTask_cfi::trig.

20  {
21  if (info_ > 2)
23 
24  for (unsigned int endc = 0; endc < static_cast<unsigned int>(trig_me0s::MAX_ENDCAPS); endc++) {
25  for (unsigned int cham = 0; cham < static_cast<unsigned int>(trig_me0s::MAX_CHAMBERS); cham++) {
26  // 0th layer means whole chamber.
27  // chamber counts from 1 to 18 in ME0ID
28  const int region(endc == 0 ? -1 : 1);
29  // constexpr GEMDetId(int region, int ring, int station, int layer, int chamber, int ieta)
30  GEMDetId detid(region, 1, 0, 0, cham + 1, 0);
31 
32  const auto& drange = me0Segments.get(detid);
33  std::vector<ME0TriggerDigi> trigV;
34  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
35  if (info_ > 1)
36  LogTrace("L1ME0Trigger") << "GE0TriggerPseudoBuilder id " << detid << " ME0 segment " << *digiIt
37  << " to be converted into trigger digi\n";
39  if (trig.isValid())
40  trigV.push_back(trig);
41  if (info_ > 1 and trig.isValid())
42  LogTrace("L1ME0Trigger") << " ME0trigger " << trig << "\n";
43  else if (info_ > 1)
44  LogTrace("L1ME0Trigger") << " ME0trigger is not valid. Conversion failed \n";
45  }
46 
47  if (!trigV.empty()) {
48  LogTrace("L1ME0Trigger") << "GE0TriggerPseudoBuilder got results in " << detid << std::endl
49  << "Put " << trigV.size() << " Trigger digi" << ((trigV.size() > 1) ? "s " : " ")
50  << "in collection\n";
51  oc_trig.put(std::make_pair(trigV.begin(), trigV.end()), detid);
52  }
53  }
54  }
55 }
#define LogTrace(id)
ME0TriggerDigi segmentConversion(const GEMSegment segment)
void dumpAllME0Segments(const GEMSegmentCollection &segments) const
void put(Range range, const IndexType &index)
insert a range of digis for a given DetUnit

◆ dumpAllME0Segments()

void GE0TriggerPseudoBuilder::dumpAllME0Segments ( const GEMSegmentCollection segments) const

Definition at line 148 of file GE0TriggerPseudoBuilder.cc.

References GEMRecHit::gemId(), runTauDisplay::gp, GEMGeometry::idToDet(), LogTrace, me0_g, FastTrackerRecHitMaskProducer_cfi::recHits, and GeomDet::toGlobal().

Referenced by build().

148  {
149  LogTrace("L1GE0Trigger") << "dumpt all ME0 Segments" << std::endl;
150  for (auto iC = segments.id_begin(); iC != segments.id_end(); ++iC) {
151  auto ch_segs = segments.get(*iC);
152  for (auto iS = ch_segs.first; iS != ch_segs.second; ++iS) {
153  if (iS->gemDetId().station() != 0) // only dump GE0 segments
154  continue;
155  GlobalPoint gp = me0_g->idToDet(iS->gemDetId())->surface().toGlobal(iS->localPosition());
156  LogTrace("L1ME0Trigger") << "ME0Detid " << iS->gemDetId() << " segment " << *iS << " eta " << gp.eta() << " phi "
157  << gp.phi() << std::endl;
158  auto recHits(iS->recHits());
159  LogTrace("L1GE0Trigger") << "\t has " << recHits.size() << " me0 rechits" << std::endl;
160  for (auto& rh : recHits) {
161  const GEMRecHit* me0rh(dynamic_cast<const GEMRecHit*>(rh));
162  LogTrace("L1GEMTrigger") << "\t detid " << me0rh->gemId() << " rechit " << *me0rh << std::endl;
163  }
164  }
165  }
166 }
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
#define LogTrace(id)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49

◆ segmentConversion()

ME0TriggerDigi GE0TriggerPseudoBuilder::segmentConversion ( const GEMSegment  segment)
private

Definition at line 57 of file GE0TriggerPseudoBuilder.cc.

References L1TStage2uGTEmulatorClient_cff::BX, GEMEtaPartition::centreOfStrip(), relativeConstraints::chamber, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), ALCARECOPPSCalTrackBasedSel_cff::detid, dphiresolution_, PV3DBase< T, PVType, FrameType >::eta(), GEMChamber::etaPartition(), Exception, spr::find(), GEMSegment::gemDetId(), runTauDisplay::gp, GEMGeometry::idToDet(), info_, GEMSegment::localDirection(), GEMEtaPartition::localPitch(), GEMSegment::localPosition(), edm::errors::LogicError, LogTrace, me0_g, ME0KeyLayer, ME0TriggerCentralBX, GEMChamber::nEtaPartitions(), GEMSegment::nRecHits(), GEMEtaPartition::nstrips(), or, l1ctLayer1_patternWriters_cff::partition, PV3DBase< T, PVType, FrameType >::phi(), quality, mps_fire::result, GEMSegment::specificRecHits(), nano_mu_digi_cff::strip, GEMEtaPartition::strip(), GEMGeometry::superChamber(), GeomDet::surface(), GeomDet::toGlobal(), and GloballyPositioned< T >::toLocal().

Referenced by build().

57  {
58  auto detid = segment.gemDetId();
60  const GEMChamber* keylayer = chamber->chamber(GE0TriggerPseudoBuilder::ME0KeyLayer);
61  int chamberid = detid.superChamberId() % 2;
62  int totRolls = keylayer->nEtaPartitions();
63  float dphi = chamber->computeDeltaPhi(segment.localPosition(), segment.localDirection());
64 
65  int nrechits = segment.nRecHits();
66  std::vector<int> rolls;
67  for (const auto& rechit : segment.specificRecHits()) {
68  if (std::find(rolls.begin(), rolls.end(), rechit.gemId().roll()) == rolls.end())
69  rolls.push_back(rechit.gemId().roll());
70  }
71  if (rolls.size() > 2 or rolls.empty())
72  LogTrace("L1ME0Trigger") << " ME0 segment is crossing " << rolls.size() << " roll !!! \n";
73  //assert(rolls.size() <= 2); // we did found very few ME0 segments crossing 3 rolls!!! this cut is applied offline
74  if (rolls.empty())
75  return ME0TriggerDigi();
76  if (rolls[0] < 1) {
77  LogTrace("L1ME0Trigger") << " ME0 segment has wrong roll number " << rolls[0] << " which should be >= 1 \n !!!";
78  throw edm::Exception(edm::errors::LogicError, "ME0 should have at least one roll");
79  }
80  int partition = (rolls[0] - 1) << 1; //roll from detid counts from 1
81  if (rolls.size() == 2 and rolls[0] > rolls[1])
82  partition = partition - 1;
83  else if (rolls.size() == 2 and rolls[0] < rolls[1])
84  partition = partition + 1;
85 
86  if (partition < 0 or partition >= 2 * totRolls) {
87  LogTrace("L1ME0Trigger") << " ME0 segment rolls size of all hits " << rolls.size() << " rolls[0] " << rolls[0]
88  << " rolls.back() " << rolls.back() << " and ME0 trigger roll is " << partition
89  << " max expected " << 2 * totRolls - 1 << "\n";
90  return ME0TriggerDigi();
91  }
92 
93  //globalpoint from ME0 segment
94  GlobalPoint gp = me0_g->idToDet(segment.gemDetId())->surface().toGlobal(segment.localPosition());
95  const GEMEtaPartition* etapart = keylayer->etaPartition(rolls[0]);
96  LocalPoint segment_lp = etapart->surface().toLocal(gp); // convert segment gp into lp in etapartition coordinate
97  float strippitch = etapart->localPitch(segment_lp);
98  float strip = etapart->strip(segment_lp);
99  int totstrip = etapart->nstrips();
100  int istrip = static_cast<int>(strip);
101  int phiposition = istrip;
102  if (phiposition > totstrip)
103  LogTrace("L1ME0Trigger") << " ME0 segment strip number is " << phiposition << " larger than nstrip " << totstrip
104  << " !!! \n";
105  constexpr float phi_resolution = 0.5; //halfstrip
106  int phiposition2 = (static_cast<int>((strip - phiposition) / phi_resolution) & 1); // half-strip resolution
107  phiposition = (phiposition << 1) | phiposition2;
108 
109  //gloablpoint from ME0 trigger digi
110  float centreOfStrip = istrip + 0.25 + phiposition2 * 0.5;
111  GlobalPoint gp_digi = etapart->toGlobal(etapart->centreOfStrip(centreOfStrip));
112 
113  float strippitch_rad = strippitch / gp.perp(); //unit in rad
114 
115  int idphi = static_cast<int>(fabs(dphi) / (strippitch_rad * dphiresolution_));
116  const int max_idphi = 512;
117  if (idphi >= max_idphi) {
118  LogTrace("L1ME0Trigger") << " ME0 segment dphi " << dphi << " and int type: " << idphi
119  << " larger than max allowed: " << max_idphi << " !!! \n";
120  idphi = max_idphi - 1;
121  }
122  int quality = nrechits; // attention: not the same as discussed in meeting
123  // !!!!TODO!!!! int BX = (static_cast<int>(fabs(time) / 25.0)) * sign_time + GE0TriggerPseudoBuilder::ME0TriggerCentralBX;
125  int bend = (dphi > 0.0) ? 0 : 1;
126  if (info_ > 2)
127  LogTrace("L1ME0Trigger") << " ME0trigger in conversion function:\n"
128  << "\t chamber(1-18) " << detid.chamber() << " chamber id " << chamberid << " \n"
129  << "\t rolls size of all hits " << rolls.size() << " rolls[0] " << rolls[0]
130  << " rolls.back() " << rolls.back() << " roll " << partition << " \n"
131  << "\t nRechits " << nrechits << " quality " << quality << " \n"
132  << "\t strip(float) " << strip << " (int) " << istrip << " phiposition " << phiposition
133  << " resolution (in term of strip) " << phi_resolution << " \n"
134  << "\t deltaphi(float) " << dphi << " (int) " << idphi << " resolution "
135  << strippitch_rad * dphiresolution_ << " bend " << bend << " \n"
136  << "\t global point eta " << gp.eta() << " phi " << gp.phi() << " trigger digi eta "
137  << gp_digi.eta() << " phi " << gp_digi.phi() << " \n"
138  // << "\t time (ns, float) " << time << " BX " << BX << " \n"
139  ;
140 
141  ME0TriggerDigi result = ME0TriggerDigi(chamberid, quality, phiposition, partition, idphi, bend, BX);
142  result.setStrip(istrip);
143  return result;
144 
145  return ME0TriggerDigi();
146 }
LocalPoint localPosition() const override
Definition: GEMSegment.h:52
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return the eta partition corresponding to the given id.
Definition: GEMChamber.cc:33
LocalVector localDirection() const override
Local direction.
Definition: GEMSegment.h:55
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
const GeomDet * idToDet(DetId) const override
Definition: GEMGeometry.cc:25
T eta() const
Definition: PV3DBase.h:73
float strip(const LocalPoint &lp) const
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: GEMChamber.cc:31
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
LocalPoint toLocal(const GlobalPoint &gp) const
static const int ME0TriggerCentralBX
#define LogTrace(id)
string quality
int nRecHits() const
Definition: GEMSegment.h:81
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const std::vector< GEMRecHit > & specificRecHits() const
Definition: GEMSegment.h:79
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
GEMDetId gemDetId() const
Definition: GEMSegment.h:83
float localPitch(const LocalPoint &lp) const
int nstrips() const
number of readout strips in partition
static const unsigned int ME0KeyLayer
LocalPoint centreOfStrip(int strip) const
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69

◆ setME0Geometry()

void GE0TriggerPseudoBuilder::setME0Geometry ( const GEMGeometry g)
inline

set geometry for the matching needs

Definition at line 34 of file GE0TriggerPseudoBuilder.h.

References g, and me0_g.

34 { me0_g = g; }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4

Member Data Documentation

◆ config_

edm::ParameterSet GE0TriggerPseudoBuilder::config_
private

Definition at line 60 of file GE0TriggerPseudoBuilder.h.

Referenced by GE0TriggerPseudoBuilder().

◆ dphiresolution_

double GE0TriggerPseudoBuilder::dphiresolution_
private

Definition at line 56 of file GE0TriggerPseudoBuilder.h.

Referenced by GE0TriggerPseudoBuilder(), and segmentConversion().

◆ info_

int GE0TriggerPseudoBuilder::info_
private

Definition at line 54 of file GE0TriggerPseudoBuilder.h.

Referenced by build(), GE0TriggerPseudoBuilder(), and segmentConversion().

◆ max_chamber

const int GE0TriggerPseudoBuilder::max_chamber
staticprivate

Definition at line 48 of file GE0TriggerPseudoBuilder.h.

◆ max_endcap

const int GE0TriggerPseudoBuilder::max_endcap
staticprivate

Definition at line 46 of file GE0TriggerPseudoBuilder.h.

◆ me0_g

const GEMGeometry* GE0TriggerPseudoBuilder::me0_g
private

Definition at line 52 of file GE0TriggerPseudoBuilder.h.

Referenced by dumpAllME0Segments(), segmentConversion(), and setME0Geometry().

◆ ME0KeyLayer

const unsigned int GE0TriggerPseudoBuilder::ME0KeyLayer = 3
staticprivate

Definition at line 49 of file GE0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

◆ ME0TriggerCentralBX

const int GE0TriggerPseudoBuilder::ME0TriggerCentralBX = 8
staticprivate

Definition at line 50 of file GE0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

◆ min_chamber

const int GE0TriggerPseudoBuilder::min_chamber
staticprivate

Definition at line 47 of file GE0TriggerPseudoBuilder.h.

◆ min_endcap

const int GE0TriggerPseudoBuilder::min_endcap
staticprivate

Definition at line 45 of file GE0TriggerPseudoBuilder.h.