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

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

Enumerator
MAX_ENDCAPS 
MAX_CHAMBERS 

Definition at line 44 of file ME0TriggerPseudoBuilder.h.

44 {MAX_ENDCAPS = 2, MAX_CHAMBERS = 18};

Constructor & Destructor Documentation

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.

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

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

Definition at line 20 of file ME0TriggerPseudoBuilder.cc.

21 {
22 }

Member Function Documentation

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 24 of file ME0TriggerPseudoBuilder.cc.

References relativeConstraints::cham, dumpAllME0Segments(), info_, ME0TriggerDigi::isValid(), LogTrace, MAX_CHAMBERS, MAX_ENDCAPS, and segmentConversion().

26 {
28  for (int endc = 0; endc < static_cast<int>(trig_me0s::MAX_ENDCAPS); endc++)
29  {
30  for (int cham = 0; cham < static_cast<int>(trig_me0s::MAX_CHAMBERS); cham++)
31  {
32  // 0th layer means whole chamber.
33  const int region(endc == 0 ? -1 : 1);
34  ME0DetId detid(region, 0, cham, 0);
35 
36  const auto& drange = me0Segments->get(detid);
37  std::vector<ME0TriggerDigi> trigV;
38  for (auto digiIt = drange.first; digiIt != drange.second; digiIt++) {
39  if (info_ > 1 ) LogTrace("L1ME0Trigger") << "ME0TriggerPseudoBuilder id "<< detid
40  <<" ME0 segment "<< *digiIt <<" to be converted into trigger digi\n";
41  ME0TriggerDigi trig = segmentConversion(*digiIt);
42  if (trig.isValid()) trigV.push_back(trig);
43  if (info_ > 1 and trig.isValid()) LogTrace("L1ME0Trigger") <<" ME0trigger "<< trig <<"\n";
44  else if (info_ > 1) LogTrace("L1ME0Trigger") <<" ME0trigger is not valid. Conversion failed \n";
45  }
46 
47  if (!trigV.empty()) {
48  LogTrace("L1ME0Trigger")
49  << "ME0TriggerPseudoBuilder got results in " <<detid
50  << std::endl
51  << "Put " << trigV.size() << " Trigger digi"
52  << ((trigV.size() > 1) ? "s " : " ") << "in collection\n";
53  oc_trig.put(std::make_pair(trigV.begin(),trigV.end()), detid);
54  }
55  }
56  }
57 }
ME0TriggerDigi segmentConversion(const ME0Segment segment)
void dumpAllME0Segments(const ME0SegmentCollection &segments) const
#define LogTrace(id)
bool isValid() const
is valid?
void ME0TriggerPseudoBuilder::dumpAllME0Segments ( const ME0SegmentCollection segments) const

Definition at line 134 of file ME0TriggerPseudoBuilder.cc.

References PV3DBase< T, PVType, FrameType >::eta(), runTauDisplay::gp, ME0Geometry::idToDet(), LogTrace, me0_g, ME0RecHit::me0Id(), PV3DBase< T, PVType, FrameType >::phi(), and GeomDet::toGlobal().

Referenced by build(), and setME0Geometry().

135 {
136  LogTrace("L1ME0Trigger")<<"dumpt all ME0 Segments" << std::endl;
137  for(auto iC = segments.id_begin(); iC != segments.id_end(); ++iC){
138  auto ch_segs = segments.get(*iC);
139  for(auto iS = ch_segs.first; iS != ch_segs.second; ++iS){
140  GlobalPoint gp = me0_g->idToDet(iS->me0DetId())->surface().toGlobal(iS->localPosition());
141  LogTrace("L1ME0Trigger") <<"ME0Detid "<< iS->me0DetId()<<" segment "<< *iS <<" eta "<< gp.eta() <<" phi "<< gp.phi()<< std::endl;
142  auto recHits(iS->recHits());
143  LogTrace("L1ME0Trigger") << "\t has " << recHits.size() << " me0 rechits"<< std::endl;
144  for (auto& rh: recHits) {
145  const ME0RecHit* me0rh(dynamic_cast<const ME0RecHit*>(rh));
146  LogTrace("L1ME0Trigger") <<"\t detid "<< me0rh->me0Id()<<" rechit "<< *me0rh << std::endl;
147  }
148  }
149  }
150 
151 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
#define LogTrace(id)
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:42
T eta() const
Definition: PV3DBase.h:76
ME0TriggerDigi ME0TriggerPseudoBuilder::segmentConversion ( const ME0Segment  segment)
private

Definition at line 60 of file ME0TriggerPseudoBuilder.cc.

References rpcdqm::BX, ME0EtaPartition::centreOfStrip(), ME0Geometry::chamber(), relativeConstraints::chamber, ME0Chamber::computeDeltaPhi(), 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(), jets_cff::quality, mps_fire::result, ME0TriggerDigi::setStrip(), ME0Segment::specificRecHits(), digitizers_cfi::strip, ME0EtaPartition::strip(), protons_cff::time, ME0Segment::time(), and GeomDet::toGlobal().

Referenced by build().

60  {
61  auto detid = segment.me0DetId();
62  const ME0Chamber* chamber = me0_g->chamber(detid);
64  int chamberid = detid.chamber()%2;
65  int totRolls = keylayer->nEtaPartitions();
66  float dphi = chamber->computeDeltaPhi(segment.localPosition(), segment.localDirection());
67  float time = segment.time();
68  int sign_time = (time > 0) ? 1 : -1;
69  int nrechits = segment.nRecHits();
70  std::vector<int> rolls;
71  for (auto rechit : segment.specificRecHits()){
72  if (std::find(rolls.begin(), rolls.end(), rechit.me0Id().roll()) == rolls.end())
73  rolls.push_back(rechit.me0Id().roll());
74  }
75  if (rolls.size() > 2 or rolls.empty()) LogTrace("L1ME0Trigger") << " ME0 segment is crossing "<< rolls.size() <<" roll !!! \n";
76  assert( rolls.size() <=2 );
77  if (rolls.empty()) return ME0TriggerDigi();
78  if (rolls[0] < 1) LogTrace("L1ME0Trigger") << " ME0 segment has wrong roll number "<< rolls[0] <<" which should be >= 1 \n !!!";
79  assert(rolls[0] >= 1);
80  int partition = (rolls[0] -1 )<< 1;//roll from detid counts from 1
81  if (rolls.size() == 2 and rolls[0] > rolls[1]) partition = partition-1;
82  else if (rolls.size() == 2 and rolls[0] < rolls[1]) partition = partition+1;
83 
84  if (partition < 0 or partition >= 2*totRolls){
85  LogTrace("L1ME0Trigger") << " ME0 segment rolls size of all hits "<< rolls.size() <<" rolls[0] "<< rolls[0] <<" rolls.back() "<< rolls.back()
86  <<" and ME0 trigger roll is "<< partition <<" max expected "<< 2*totRolls-1 <<"\n";
87  return ME0TriggerDigi();
88  }
89 
90  const ME0EtaPartition* etapart = keylayer->etaPartition(rolls[0]);
91  float strippitch = etapart->localPitch(segment.localPosition());
92  float strip = etapart->strip(segment.localPosition());
93  int totstrip = etapart->nstrips();
94  int istrip = static_cast<int>(strip);
95  int phiposition = istrip;
96  if (phiposition > totstrip) LogTrace("L1ME0Trigger")<<" ME0 segment strip number is "<< phiposition <<" larger than nstrip "<< totstrip <<" !!! \n";
97  float phi_resolution = 0.5;//halfstrip
98  int phiposition2 = (static_cast<int>((strip - phiposition)/phi_resolution) & 1);// half-strip resolution
99  phiposition = (phiposition << 1) | phiposition2;
100 
101  //globalpoint from ME0 segment
102  GlobalPoint gp = me0_g->idToDet(segment.me0DetId())->surface().toGlobal(segment.localPosition());
103  //gloablpoint from ME0 trigger digi
104  float centreOfStrip = istrip + 0.25 +phiposition2*0.5;
105  GlobalPoint gp_digi = etapart->toGlobal(etapart->centreOfStrip(centreOfStrip));
106 
107 
108  int idphi = static_cast<int>(fabs(dphi)/(strippitch*dphiresolution_));
109  const int max_idphi = 512;
110  if (idphi >= max_idphi){
111  LogTrace("L1ME0Trigger")<<" ME0 segment dphi "<< dphi <<" and int type: "<< idphi <<" larger than max allowed: "<< max_idphi <<" !!! \n";
112  idphi = max_idphi -1;
113  }
114  int quality = nrechits;// attention: not the same as discussed in meeting
115  int BX = (static_cast<int>(fabs(time)/25.0))*sign_time + ME0TriggerPseudoBuilder::ME0TriggerCentralBX;
116  int bend = (dphi > 0.0) ? 0 : 1;
117  if (info_ > 2) LogTrace("L1ME0Trigger") <<" ME0trigger in conversion function:\n"
118  <<"\t chamber(1-18) "<< detid.chamber() <<" chamber id "<< chamberid <<" \n"
119  <<"\t rolls size of all hits "<< rolls.size() <<" rolls[0] "<< rolls[0] <<" rolls.back() "<< rolls.back() <<" roll "<< partition <<" \n"
120  <<"\t nRechits "<< nrechits <<" quality "<< quality <<" \n"
121  <<"\t strip(float) "<< strip <<" (int) "<< istrip<<" phiposition "<< phiposition <<" resolution (in term of strip) "<< phi_resolution <<" \n"
122  <<"\t deltaphi(float) "<< dphi <<" (int) "<< idphi <<" resolution "<< strippitch*dphiresolution_ <<" bend "<< bend <<" \n"
123  <<"\t global point eta "<< gp.eta() <<" phi "<< gp.phi() <<" trigger digi eta "<< gp_digi.eta() <<" phi "<< gp_digi.phi() <<" \n"
124  <<"\t time (ns, float) "<< time <<" BX "<< BX <<" \n";
125 
126  ME0TriggerDigi result = ME0TriggerDigi(chamberid, quality, phiposition, partition, idphi, bend, BX);
127  result.setStrip(istrip);
128  return result;
129 }
float localPitch(const LocalPoint &lp) const
const std::vector< ME0RecHit > & specificRecHits() const
Definition: ME0Segment.h:67
const ME0Layer * layer(ME0DetId id) const
Return the layer corresponding to the given id.
Definition: ME0Chamber.cc:42
ME0DetId me0DetId() const
Definition: ME0Segment.h:71
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
LocalPoint centreOfStrip(int strip) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
float strip(const LocalPoint &lp) const
static const int ME0TriggerCentralBX
float computeDeltaPhi(const LocalPoint &position, const LocalVector &direction) const
Definition: ME0Chamber.cc:82
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 ME0Chamber * chamber(ME0DetId id) const
Return a chamber given its id.
Definition: ME0Geometry.cc:73
LocalVector localDirection() const override
Local direction.
Definition: ME0Segment.h:43
int nstrips() const
Return the chamber this roll belongs to.
#define LogTrace(id)
void setStrip(unsigned int s)
set strip
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return the eta partition corresponding to the given id.
Definition: ME0Layer.cc:41
LocalPoint localPosition() const override
Definition: ME0Segment.h:40
int nEtaPartitions() const
Retunr numbers of eta partitions.
Definition: ME0Layer.cc:37
const GeomDet * idToDet(DetId) const override
Definition: ME0Geometry.cc:42
int nRecHits() const
Definition: ME0Segment.h:69
T eta() const
Definition: PV3DBase.h:76
static const unsigned int ME0KeyLayer
float time() const
Definition: ME0Segment.h:73
void ME0TriggerPseudoBuilder::setME0Geometry ( const ME0Geometry g)
inline

set geometry for the matching needs

Definition at line 36 of file ME0TriggerPseudoBuilder.h.

References dumpAllME0Segments(), g, and me0_g.

36 { 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

edm::ParameterSet ME0TriggerPseudoBuilder::config_
private

Definition at line 63 of file ME0TriggerPseudoBuilder.h.

Referenced by ME0TriggerPseudoBuilder().

double ME0TriggerPseudoBuilder::dphiresolution_
private

Definition at line 59 of file ME0TriggerPseudoBuilder.h.

Referenced by ME0TriggerPseudoBuilder(), and segmentConversion().

int ME0TriggerPseudoBuilder::info_
private

Definition at line 57 of file ME0TriggerPseudoBuilder.h.

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

const int ME0TriggerPseudoBuilder::max_chamber
staticprivate

Definition at line 51 of file ME0TriggerPseudoBuilder.h.

const int ME0TriggerPseudoBuilder::max_endcap
staticprivate

Definition at line 49 of file ME0TriggerPseudoBuilder.h.

const ME0Geometry* ME0TriggerPseudoBuilder::me0_g
private

Definition at line 55 of file ME0TriggerPseudoBuilder.h.

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

const unsigned int ME0TriggerPseudoBuilder::ME0KeyLayer = 3
staticprivate

Definition at line 52 of file ME0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

const int ME0TriggerPseudoBuilder::ME0TriggerCentralBX = 8
staticprivate

Definition at line 53 of file ME0TriggerPseudoBuilder.h.

Referenced by segmentConversion().

const int ME0TriggerPseudoBuilder::min_chamber
staticprivate

Definition at line 50 of file ME0TriggerPseudoBuilder.h.

const int ME0TriggerPseudoBuilder::min_endcap
staticprivate

Definition at line 48 of file ME0TriggerPseudoBuilder.h.