CMS 3D CMS Logo

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

#include <ME0TriggerPseudoBuilder.h>

Public Types

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

Public Member Functions

void build (const ME0SegmentCollection *me0segments, ME0TriggerDigiCollection &oc_trig)
 
void dumpAllME0Segments (const ME0SegmentCollection &segments) const
 
 ME0TriggerPseudoBuilder (const edm::ParameterSet &)
 
void setME0Geometry (const ME0Geometry *g)
 
 ~ME0TriggerPseudoBuilder ()
 

Private Member Functions

ME0TriggerDigi segmentConversion (const ME0Segment segment)
 

Private Attributes

edm::ParameterSet config_
 
double dphiresolution_
 
int info_
 
const ME0Geometryme0_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 ME0 trigger objects from ME0 segment

Author
Tao Huang (TAMU)

Definition at line 20 of file ME0TriggerPseudoBuilder.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 ME0TriggerPseudoBuilder.h.

42 { MAX_ENDCAPS = 2, MAX_CHAMBERS = 18 };

Constructor & Destructor Documentation

◆ ME0TriggerPseudoBuilder()

ME0TriggerPseudoBuilder::ME0TriggerPseudoBuilder ( 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 ME0TriggerPseudoBuilder.cc.

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

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

◆ ~ME0TriggerPseudoBuilder()

ME0TriggerPseudoBuilder::~ME0TriggerPseudoBuilder ( )

Definition at line 18 of file ME0TriggerPseudoBuilder.cc.

18 {}

Member Function Documentation

◆ build()

void ME0TriggerPseudoBuilder::build ( const ME0SegmentCollection me0segments,
ME0TriggerDigiCollection oc_trig 
)

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

Definition at line 20 of file ME0TriggerPseudoBuilder.cc.

20  {
21  if (info_ > 2)
23 
24  for (int endc = 0; endc < static_cast<int>(trig_me0s::MAX_ENDCAPS); endc++) {
25  for (int cham = 0; cham < static_cast<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  ME0DetId detid(region, 0, cham + 1, 0);
30 
31  const auto& drange = me0Segments->get(detid);
32  std::vector<ME0TriggerDigi> trigV;
33  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
34  if (info_ > 1)
35  LogTrace("L1ME0Trigger") << "ME0TriggerPseudoBuilder id " << detid << " ME0 segment " << *digiIt
36  << " to be converted into trigger digi\n";
38  if (trig.isValid())
39  trigV.push_back(trig);
40  if (info_ > 1 and trig.isValid())
41  LogTrace("L1ME0Trigger") << " ME0trigger " << trig << "\n";
42  else if (info_ > 1)
43  LogTrace("L1ME0Trigger") << " ME0trigger is not valid. Conversion failed \n";
44  }
45 
46  if (!trigV.empty()) {
47  LogTrace("L1ME0Trigger") << "ME0TriggerPseudoBuilder got results in " << detid << std::endl
48  << "Put " << trigV.size() << " Trigger digi" << ((trigV.size() > 1) ? "s " : " ")
49  << "in collection\n";
50  oc_trig.put(std::make_pair(trigV.begin(), trigV.end()), detid);
51  }
52  }
53  }
54 }

References relativeConstraints::cham, dumpAllME0Segments(), info_, LogTrace, MAX_CHAMBERS, MAX_ENDCAPS, me0Segments_cfi::me0Segments, HLT_2018_cff::region, segmentConversion(), and ClusterTask_cfi::trig.

◆ dumpAllME0Segments()

void ME0TriggerPseudoBuilder::dumpAllME0Segments ( const ME0SegmentCollection segments) const

Definition at line 143 of file ME0TriggerPseudoBuilder.cc.

143  {
144  LogTrace("L1ME0Trigger") << "dumpt all ME0 Segments" << std::endl;
145  for (auto iC = segments.id_begin(); iC != segments.id_end(); ++iC) {
146  auto ch_segs = segments.get(*iC);
147  for (auto iS = ch_segs.first; iS != ch_segs.second; ++iS) {
148  GlobalPoint gp = me0_g->idToDet(iS->me0DetId())->surface().toGlobal(iS->localPosition());
149  LogTrace("L1ME0Trigger") << "ME0Detid " << iS->me0DetId() << " segment " << *iS << " eta " << gp.eta() << " phi "
150  << gp.phi() << std::endl;
151  auto recHits(iS->recHits());
152  LogTrace("L1ME0Trigger") << "\t has " << recHits.size() << " me0 rechits" << std::endl;
153  for (auto& rh : recHits) {
154  const ME0RecHit* me0rh(dynamic_cast<const ME0RecHit*>(rh));
155  LogTrace("L1ME0Trigger") << "\t detid " << me0rh->me0Id() << " rechit " << *me0rh << std::endl;
156  }
157  }
158  }
159 }

References runTauDisplay::gp, ME0Geometry::idToDet(), LogTrace, me0_g, ME0RecHit::me0Id(), FastTrackerRecHitMaskProducer_cfi::recHits, and GeomDet::toGlobal().

Referenced by build().

◆ segmentConversion()

ME0TriggerDigi ME0TriggerPseudoBuilder::segmentConversion ( const ME0Segment  segment)
private

Definition at line 56 of file ME0TriggerPseudoBuilder.cc.

56  {
57  auto detid = segment.me0DetId();
58  const ME0Chamber* chamber = me0_g->chamber(detid);
60  int chamberid = detid.chamber() % 2;
61  int totRolls = keylayer->nEtaPartitions();
62  float dphi = chamber->computeDeltaPhi(segment.localPosition(), segment.localDirection());
63  float time = segment.time();
64  int sign_time = (time > 0) ? 1 : -1;
65  int nrechits = segment.nRecHits();
66  std::vector<int> rolls;
67  for (auto rechit : segment.specificRecHits()) {
68  if (std::find(rolls.begin(), rolls.end(), rechit.me0Id().roll()) == rolls.end())
69  rolls.push_back(rechit.me0Id().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  assert(rolls[0] >= 1);
79  int partition = (rolls[0] - 1) << 1; //roll from detid counts from 1
80  if (rolls.size() == 2 and rolls[0] > rolls[1])
81  partition = partition - 1;
82  else if (rolls.size() == 2 and rolls[0] < rolls[1])
83  partition = partition + 1;
84 
85  if (partition < 0 or partition >= 2 * totRolls) {
86  LogTrace("L1ME0Trigger") << " ME0 segment rolls size of all hits " << rolls.size() << " rolls[0] " << rolls[0]
87  << " rolls.back() " << rolls.back() << " and ME0 trigger roll is " << partition
88  << " max expected " << 2 * totRolls - 1 << "\n";
89  return ME0TriggerDigi();
90  }
91 
92  //globalpoint from ME0 segment
93  GlobalPoint gp = me0_g->idToDet(segment.me0DetId())->surface().toGlobal(segment.localPosition());
94  const ME0EtaPartition* etapart = keylayer->etaPartition(rolls[0]);
95  LocalPoint segment_lp = etapart->surface().toLocal(gp); // convert segment gp into lp in etapartition coordinate
96  float strippitch = etapart->localPitch(segment_lp);
97  float strip = etapart->strip(segment_lp);
98  int totstrip = etapart->nstrips();
99  int istrip = static_cast<int>(strip);
100  int phiposition = istrip;
101  if (phiposition > totstrip)
102  LogTrace("L1ME0Trigger") << " ME0 segment strip number is " << phiposition << " larger than nstrip " << totstrip
103  << " !!! \n";
104  float phi_resolution = 0.5; //halfstrip
105  int phiposition2 = (static_cast<int>((strip - phiposition) / phi_resolution) & 1); // half-strip resolution
106  phiposition = (phiposition << 1) | phiposition2;
107 
108  //gloablpoint from ME0 trigger digi
109  float centreOfStrip = istrip + 0.25 + phiposition2 * 0.5;
110  GlobalPoint gp_digi = etapart->toGlobal(etapart->centreOfStrip(centreOfStrip));
111 
112  float strippitch_rad = strippitch / gp.perp(); //unit in rad
113 
114  int idphi = static_cast<int>(fabs(dphi) / (strippitch_rad * dphiresolution_));
115  const int max_idphi = 512;
116  if (idphi >= max_idphi) {
117  LogTrace("L1ME0Trigger") << " ME0 segment dphi " << dphi << " and int type: " << idphi
118  << " larger than max allowed: " << max_idphi << " !!! \n";
119  idphi = max_idphi - 1;
120  }
121  int quality = nrechits; // attention: not the same as discussed in meeting
122  int BX = (static_cast<int>(fabs(time) / 25.0)) * sign_time + ME0TriggerPseudoBuilder::ME0TriggerCentralBX;
123  int bend = (dphi > 0.0) ? 0 : 1;
124  if (info_ > 2)
125  LogTrace("L1ME0Trigger") << " ME0trigger in conversion function:\n"
126  << "\t chamber(1-18) " << detid.chamber() << " chamber id " << chamberid << " \n"
127  << "\t rolls size of all hits " << rolls.size() << " rolls[0] " << rolls[0]
128  << " rolls.back() " << rolls.back() << " roll " << partition << " \n"
129  << "\t nRechits " << nrechits << " quality " << quality << " \n"
130  << "\t strip(float) " << strip << " (int) " << istrip << " phiposition " << phiposition
131  << " resolution (in term of strip) " << phi_resolution << " \n"
132  << "\t deltaphi(float) " << dphi << " (int) " << idphi << " resolution "
133  << strippitch_rad * dphiresolution_ << " bend " << bend << " \n"
134  << "\t global point eta " << gp.eta() << " phi " << gp.phi() << " trigger digi eta "
135  << gp_digi.eta() << " phi " << gp_digi.phi() << " \n"
136  << "\t time (ns, float) " << time << " BX " << BX << " \n";
137 
138  ME0TriggerDigi result = ME0TriggerDigi(chamberid, quality, phiposition, partition, idphi, bend, BX);
139  result.setStrip(istrip);
140  return result;
141 }

References cms::cuda::assert(), trklet::bend(), L1TStage2uGTEmulatorClient_cff::BX, ME0EtaPartition::centreOfStrip(), ME0Geometry::chamber(), relativeConstraints::chamber, dphiresolution_, PV3DBase< T, PVType, FrameType >::eta(), ME0Layer::etaPartition(), spr::find(), runTauDisplay::gp, ME0Geometry::idToDet(), info_, ME0Chamber::layer(), ME0Segment::localDirection(), ME0EtaPartition::localPitch(), ME0Segment::localPosition(), LogTrace, me0_g, ME0Segment::me0DetId(), ME0KeyLayer, ME0TriggerCentralBX, ME0Layer::nEtaPartitions(), ME0Segment::nRecHits(), ME0EtaPartition::nstrips(), or, PV3DBase< T, PVType, FrameType >::phi(), qcdUeDQM_cfi::quality, mps_fire::result, ME0Segment::specificRecHits(), digitizers_cfi::strip, ME0EtaPartition::strip(), GeomDet::surface(), ME0Segment::time(), ntuplemaker::time, GeomDet::toGlobal(), and GloballyPositioned< T >::toLocal().

Referenced by build().

◆ setME0Geometry()

void ME0TriggerPseudoBuilder::setME0Geometry ( const ME0Geometry g)
inline

set geometry for the matching needs

Definition at line 34 of file ME0TriggerPseudoBuilder.h.

34 { me0_g = g; }

References g, and me0_g.

Member Data Documentation

◆ config_

edm::ParameterSet ME0TriggerPseudoBuilder::config_
private

Definition at line 60 of file ME0TriggerPseudoBuilder.h.

Referenced by ME0TriggerPseudoBuilder().

◆ dphiresolution_

double ME0TriggerPseudoBuilder::dphiresolution_
private

Definition at line 56 of file ME0TriggerPseudoBuilder.h.

Referenced by ME0TriggerPseudoBuilder(), and segmentConversion().

◆ info_

int ME0TriggerPseudoBuilder::info_
private

Definition at line 54 of file ME0TriggerPseudoBuilder.h.

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

◆ max_chamber

const int ME0TriggerPseudoBuilder::max_chamber
staticprivate

Definition at line 48 of file ME0TriggerPseudoBuilder.h.

◆ max_endcap

const int ME0TriggerPseudoBuilder::max_endcap
staticprivate

Definition at line 46 of file ME0TriggerPseudoBuilder.h.

◆ me0_g

const ME0Geometry* ME0TriggerPseudoBuilder::me0_g
private

Definition at line 52 of file ME0TriggerPseudoBuilder.h.

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

◆ ME0KeyLayer

const unsigned int ME0TriggerPseudoBuilder::ME0KeyLayer = 3
staticprivate

Definition at line 49 of file ME0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

◆ ME0TriggerCentralBX

const int ME0TriggerPseudoBuilder::ME0TriggerCentralBX = 8
staticprivate

Definition at line 50 of file ME0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

◆ min_chamber

const int ME0TriggerPseudoBuilder::min_chamber
staticprivate

Definition at line 47 of file ME0TriggerPseudoBuilder.h.

◆ min_endcap

const int ME0TriggerPseudoBuilder::min_endcap
staticprivate

Definition at line 45 of file ME0TriggerPseudoBuilder.h.

ME0TriggerPseudoBuilder::dphiresolution_
double dphiresolution_
Definition: ME0TriggerPseudoBuilder.h:56
ME0TriggerPseudoBuilder::ME0TriggerCentralBX
static const int ME0TriggerCentralBX
Definition: ME0TriggerPseudoBuilder.h:50
ME0TriggerPseudoBuilder::trig_me0s::MAX_ENDCAPS
ME0TriggerPseudoBuilder::segmentConversion
ME0TriggerDigi segmentConversion(const ME0Segment segment)
Definition: ME0TriggerPseudoBuilder.cc:56
relativeConstraints.cham
cham
Definition: relativeConstraints.py:69
ME0Segment::specificRecHits
const std::vector< ME0RecHit > & specificRecHits() const
Definition: ME0Segment.h:74
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
ME0TriggerPseudoBuilder::ME0KeyLayer
static const unsigned int ME0KeyLayer
Definition: ME0TriggerPseudoBuilder.h:49
ME0Geometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:24
ME0TriggerPseudoBuilder::config_
edm::ParameterSet config_
Definition: ME0TriggerPseudoBuilder.h:60
cms::cuda::assert
assert(be >=bs)
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ME0Segment::nRecHits
int nRecHits() const
Definition: ME0Segment.h:76
ME0TriggerPseudoBuilder::info_
int info_
Definition: ME0TriggerPseudoBuilder.h:54
ME0Layer::etaPartition
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return the eta partition corresponding to the given id.
Definition: ME0Layer.cc:27
ME0Geometry::chamber
const ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Definition: ME0Geometry.cc:43
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
ME0EtaPartition::centreOfStrip
LocalPoint centreOfStrip(int strip) const
Definition: ME0EtaPartition.cc:26
Point3DBase< float, GlobalTag >
ME0Segment::localDirection
LocalVector localDirection() const override
Local direction.
Definition: ME0Segment.h:50
ME0Chamber::layer
const ME0Layer * layer(ME0DetId id) const
Return the layer corresponding to the given id.
Definition: ME0Chamber.cc:28
ME0TriggerPseudoBuilder::dumpAllME0Segments
void dumpAllME0Segments(const ME0SegmentCollection &segments) const
Definition: ME0TriggerPseudoBuilder.cc:143
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
ME0EtaPartition::nstrips
int nstrips() const
Return the chamber this roll belongs to.
Definition: ME0EtaPartition.cc:24
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
ME0TriggerPseudoBuilder::me0_g
const ME0Geometry * me0_g
Definition: ME0TriggerPseudoBuilder.h:52
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
ME0Layer
Definition: ME0Layer.h:9
ME0EtaPartition::localPitch
float localPitch(const LocalPoint &lp) const
Definition: ME0EtaPartition.cc:39
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
ME0Segment::me0DetId
ME0DetId me0DetId() const
Definition: ME0Segment.h:78
ME0Chamber
Definition: ME0Chamber.h:10
ME0Segment::localPosition
LocalPoint localPosition() const override
Definition: ME0Segment.h:47
ME0DetId
Definition: ME0DetId.h:16
ClusterTask_cfi.trig
trig
Definition: ClusterTask_cfi.py:336
ME0Layer::nEtaPartitions
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: ME0Layer.cc:25
ME0TriggerDigi
Definition: ME0TriggerDigi.h:28
ME0RecHit
Definition: ME0RecHit.h:16
ME0Segment::time
float time() const
Definition: ME0Segment.h:80
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:160
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
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
L1TStage2uGTEmulatorClient_cff.BX
BX
Definition: L1TStage2uGTEmulatorClient_cff.py:9
ME0TriggerPseudoBuilder::trig_me0s::MAX_CHAMBERS
ME0EtaPartition::strip
float strip(const LocalPoint &lp) const
Definition: ME0EtaPartition.cc:37
mps_fire.result
result
Definition: mps_fire.py:303
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
me0Segments_cfi.me0Segments
me0Segments
Definition: me0Segments_cfi.py:3
ntuplemaker.time
time
Definition: ntuplemaker.py:310
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
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
ME0EtaPartition
Definition: ME0EtaPartition.h:12