CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
RPCTechnicalTrigger Class Reference

#include <L1Trigger/RPCTechnicalTrigger/interface/RPCTechnicalTrigger.cc>

Inheritance diagram for RPCTechnicalTrigger:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  sortByBx
 
class  TTUResults
 

Public Member Functions

 RPCTechnicalTrigger (const edm::ParameterSet &)
 
 ~RPCTechnicalTrigger ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginRun (edm::Run const &, const edm::EventSetup &) overridefinal
 
int convertToMap (const std::vector< TTUResults * > &)
 
virtual void endJob ()
 
void printinfo ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
bool Reset ()
 
bool searchCoincidence (int, int)
 

Private Attributes

int m_boardIndex [3]
 
int m_cand
 
std::string m_configFile
 
std::vector< int >::iterator m_firstSector
 
bool m_hasConfig
 
int m_ievt
 
RPCInputSignalm_input
 
int m_maxBits
 
int m_maxTtuBoards
 
int m_nWheels [3]
 
std::vector< int > m_quadrants
 
const RBCBoardSpecsm_rbcspecs
 
TTUConfiguratorm_readConfig
 
edm::InputTag m_rpcDigiLabel
 
edm::ESHandle< RPCGeometrym_rpcGeometry
 
edm::InputTag m_rpcSimLinkInstance
 
std::vector< TTUResults * > m_serializedInfoLine1
 
std::vector< TTUResults * > m_serializedInfoLine2
 
ProcessInputSignalm_signal
 
std::bitset< 5 > m_triggerbits
 
std::vector< unsigned > m_ttBits
 
std::vector< std::string > m_ttNames
 
TTUEmulatorm_ttu [3]
 
TTUEmulatorm_ttuRbcLine [3]
 
std::map< int, TTUResults * > m_ttuResultsByQuadrant
 
const TTUBoardSpecsm_ttuspecs
 
int m_useEventSetup
 
int m_useRPCSimLink
 
int m_verbosity
 
std::map< int, int > m_WheelTtu
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: Implementation of the RPC Technical Trigger Emulator

Implementation:

Definition at line 68 of file RPCTechnicalTrigger.h.

Constructor & Destructor Documentation

RPCTechnicalTrigger::RPCTechnicalTrigger ( const edm::ParameterSet iConfig)
explicit

Definition at line 28 of file RPCTechnicalTrigger.cc.

References HDQMDatabaseProducer::configFile, validate-o2o-wbm::f1, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HLT_25ns10e33_v2_cff::InputTag, LogTrace, m_boardIndex, m_cand, m_configFile, m_hasConfig, m_ievt, m_maxBits, m_maxTtuBoards, m_nWheels, m_quadrants, m_readConfig, m_rpcDigiLabel, m_rpcSimLinkInstance, m_ttBits, m_ttNames, m_ttu, m_ttuRbcLine, m_useEventSetup, m_useRPCSimLink, m_verbosity, m_WheelTtu, NULL, and AlCaHLTBitMon_QueryRunRegistry::string.

28  {
29 
30  //...........................................................................
31 
32  std::string configFile = iConfig.getParameter<std::string>("ConfigFile");
33  m_verbosity = iConfig.getUntrackedParameter<int>("Verbosity", 0);
34  m_rpcDigiLabel = iConfig.getParameter<edm::InputTag>("RPCDigiLabel");
35  m_ttBits = iConfig.getParameter< std::vector<unsigned> >("BitNumbers");
36  m_ttNames = iConfig.getParameter< std::vector<std::string> >("BitNames");
37  m_useEventSetup = iConfig.getUntrackedParameter<int>("UseEventSetup", 0);
38  m_useRPCSimLink = iConfig.getUntrackedParameter<int>("UseRPCSimLink", 0);
39  m_rpcSimLinkInstance = iConfig.getParameter<edm::InputTag>("RPCSimLinkInstance");
40 
41  edm::FileInPath f1("L1Trigger/RPCTechnicalTrigger/data/" + configFile);
42  m_configFile = f1.fullPath();
43 
44  if ( m_verbosity ) {
45  LogTrace("RPCTechnicalTrigger")
46  << m_rpcDigiLabel << '\n'
47  << std::endl;
48 
49  LogTrace("RPCTechnicalTrigger")
50  << "\nConfiguration file used for UseEventSetup = 0 \n" << m_configFile << '\n'
51  << std::endl;
52  }
53 
54  //...........................................................................
55  //... There are three Technical Trigger Units Boards: 1 can handle 2 Wheels
56  //... n_Wheels sets the number of wheels attached to board with index boardIndex
57 
58  m_boardIndex[0] = 1;
59  m_boardIndex[1] = 2;
60  m_boardIndex[2] = 3;
61 
62  m_nWheels[0] = 2;
63  m_nWheels[1] = 1;
64  m_nWheels[2] = 2;
65 
66  m_ttu[0] = new TTUEmulator( m_boardIndex[0] , m_nWheels[0] );
67  m_ttu[1] = new TTUEmulator( m_boardIndex[1] , m_nWheels[1] );
68  m_ttu[2] = new TTUEmulator( m_boardIndex[2] , m_nWheels[2] );
69 
70  //... This is second line that delivers in parallel a second trigger
71  m_ttuRbcLine[0] = new TTUEmulator( m_boardIndex[0] , m_nWheels[0] );
72  m_ttuRbcLine[1] = new TTUEmulator( m_boardIndex[1] , m_nWheels[1] );
73  m_ttuRbcLine[2] = new TTUEmulator( m_boardIndex[2] , m_nWheels[2] );
74 
75  m_WheelTtu[-2] = 3;
76  m_WheelTtu[-1] = 3;
77  m_WheelTtu[0 ] = 2;
78  m_WheelTtu[1 ] = 1;
79  m_WheelTtu[2 ] = 1;
80 
81  //...........................................................................
82  //For the pointing Logic: declare here the first sector of each quadrant
83  //
84  m_quadrants.push_back(2);
85  m_quadrants.push_back(3);
86  m_quadrants.push_back(4);
87  m_quadrants.push_back(5);
88  m_quadrants.push_back(6);
89  m_quadrants.push_back(7);
90  m_quadrants.push_back(8);
91  m_quadrants.push_back(9);
92  m_quadrants.push_back(10);
93  m_quadrants.push_back(11);
94 
95  //...........................................................................
96 
97  m_ievt = 0;
98  m_cand = 0;
99  m_maxTtuBoards = 3;
100  m_maxBits = 5;
101  m_hasConfig = false;
102  m_readConfig = NULL;
103  produces<L1GtTechnicalTriggerRecord>();
104  consumes<RPCDigiCollection>(m_rpcDigiLabel);
105  consumes<edm::DetSetVector<RPCDigiSimLink> >(edm::InputTag("simMuonRPCDigis", "RPCDigiSimLink",""));
106 }
edm::InputTag m_rpcSimLinkInstance
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, int > m_WheelTtu
#define NULL
Definition: scimark2.h:8
std::vector< int > m_quadrants
TTUEmulator * m_ttu[3]
#define LogTrace(id)
std::vector< unsigned > m_ttBits
TTUConfigurator * m_readConfig
std::vector< std::string > m_ttNames
TTUEmulator * m_ttuRbcLine[3]
edm::InputTag m_rpcDigiLabel
RPCTechnicalTrigger::~RPCTechnicalTrigger ( )

Definition at line 109 of file RPCTechnicalTrigger.cc.

References LogDebug, m_hasConfig, m_readConfig, m_ttu, m_ttuRbcLine, and m_WheelTtu.

110 {
111 
112  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger: object starts deletion" << std::endl;
113 
114  if ( m_hasConfig ) {
115 
116  delete m_ttu[0];
117  delete m_ttu[1];
118  delete m_ttu[2];
119 
120  delete m_ttuRbcLine[0];
121  delete m_ttuRbcLine[1];
122  delete m_ttuRbcLine[2];
123 
124  if ( m_readConfig )
125  delete m_readConfig;
126 
127  }
128 
129  m_WheelTtu.clear();
130 
131  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger: object deleted" << '\n';
132 
133 }
#define LogDebug(id)
std::map< int, int > m_WheelTtu
TTUEmulator * m_ttu[3]
TTUConfigurator * m_readConfig
TTUEmulator * m_ttuRbcLine[3]

Member Function Documentation

void RPCTechnicalTrigger::beginRun ( edm::Run const &  iRun,
const edm::EventSetup evtSetup 
)
finaloverrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 378 of file RPCTechnicalTrigger.cc.

References edm::EventSetup::get(), TTUConfigurator::getRbcSpecs(), TTUConfigurator::getTtuSpecs(), TTUEmulator::initialise(), edm::ESHandleBase::isValid(), relval_2017::k, LogDebug, m_configFile, TTUConfigurator::m_hasConfig, m_hasConfig, m_maxTtuBoards, m_rbcspecs, m_readConfig, m_rpcGeometry, m_ttu, m_ttuRbcLine, m_ttuspecs, m_useEventSetup, TTUConfigurator::process(), edm::ESHandle< class >::product(), TTUEmulator::SetLineId(), and TTUEmulator::setSpecifications().

379 {
380  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger::beginRun> starts" << std::endl;
381 
382  //. Set up RPC geometry
383 
384  evtSetup.get<MuonGeometryRecord>().get( m_rpcGeometry );
385 
386  //.. Get Board Specifications (hardware configuration)
387 
388  if ( m_useEventSetup >= 1 ) {
389 
391  evtSetup.get<RBCBoardSpecsRcd>().get(pRBCSpecs);
392 
394  evtSetup.get<TTUBoardSpecsRcd>().get(pTTUSpecs);
395 
396  if ( !pRBCSpecs.isValid() || !pTTUSpecs.isValid() ) {
397  edm::LogError("RPCTechnicalTrigger") << "can't find RBC/TTU BoardSpecsRcd" << '\n';
398  m_hasConfig = false;
399  }
400  else {
401  m_rbcspecs = pRBCSpecs.product();
402  m_ttuspecs = pTTUSpecs.product();
403  m_hasConfig = true;
404  }
405 
406  } else {
407 
408  // read hardware configuration from file
410 
411  if ( m_readConfig->m_hasConfig ) {
415  m_hasConfig = true;
416  }
417 
418  else m_hasConfig = false;
419 
420  }
421 
422  if ( m_hasConfig ) {
423 
424  //... Initialize all
425 
426  for (int k=0; k < m_maxTtuBoards; ++k ) {
427 
428  m_ttu[k]->SetLineId ( 1 );
429  m_ttuRbcLine[k]->SetLineId( 2 );
430 
433 
434  m_ttu[k]->initialise();
436  }
437 
438  }
439 
440 }
#define LogDebug(id)
edm::ESHandle< RPCGeometry > m_rpcGeometry
TTUBoardSpecs * getTtuSpecs()
RBCBoardSpecs * getRbcSpecs()
TTUEmulator * m_ttu[3]
bool initialise()
Definition: TTUEmulator.cc:133
void SetLineId(int)
Definition: TTUEmulator.cc:149
TTUConfigurator * m_readConfig
const TTUBoardSpecs * m_ttuspecs
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
TTUEmulator * m_ttuRbcLine[3]
const RBCBoardSpecs * m_rbcspecs
bool isValid() const
Definition: ESHandle.h:47
void setSpecifications(const TTUBoardSpecs *, const RBCBoardSpecs *)
Definition: TTUEmulator.cc:118
int RPCTechnicalTrigger::convertToMap ( const std::vector< TTUResults * > &  ttuResults)
private

Definition at line 443 of file RPCTechnicalTrigger.cc.

References relval_steps::key, and m_ttuResultsByQuadrant.

Referenced by produce().

444 {
445 
446  std::vector<TTUResults*>::const_iterator itr = ttuResults.begin();
447 
448  while ( itr != ttuResults.end() ) {
449 
450  if ( (*itr)->m_bx != 0 ) {
451  ++itr;
452  continue;
453  }
454 
455  int key(0);
456  key = 1000 * ( (*itr)->m_ttuidx + 1 ) + 1*(*itr)->m_wedge;
457  m_ttuResultsByQuadrant[ key ] = (*itr);
458  ++itr;
459 
460  }
461 
462  return m_ttuResultsByQuadrant.size();
463 
464 }
std::map< int, TTUResults * > m_ttuResultsByQuadrant
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
void RPCTechnicalTrigger::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 550 of file RPCTechnicalTrigger.cc.

References LogDebug.

551 {
552 
553  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger::endJob>" << std::endl;
554 
555 }
#define LogDebug(id)
void RPCTechnicalTrigger::printinfo ( )
private

Definition at line 557 of file RPCTechnicalTrigger.cc.

References relval_2017::k, LogDebug, m_maxTtuBoards, m_ttu, m_ttuRbcLine, and TTUEmulator::printinfo().

558 {
559 
560  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger::Printing TTU emulators info>" << std::endl;
561 
562  for (int k=0; k < m_maxTtuBoards; ++k ) {
563  m_ttu[k]->printinfo();
565  }
566 
567 
568 }
#define LogDebug(id)
TTUEmulator * m_ttu[3]
void printinfo()
Definition: TTUEmulator.cc:336
TTUEmulator * m_ttuRbcLine[3]
void RPCTechnicalTrigger::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 136 of file RPCTechnicalTrigger.cc.

References funct::abs(), TTUEmulator::clearTriggerResponse(), convertToMap(), gather_cfg::cout, edm::Event::getByLabel(), edm::HandleBase::isValid(), relval_2017::k, LogDebug, m_firstSector, m_hasConfig, m_ievt, m_input, m_maxTtuBoards, m_quadrants, m_rpcDigiLabel, m_rpcGeometry, m_serializedInfoLine1, m_serializedInfoLine2, m_signal, m_triggerbits, TTUEmulator::m_triggerBxVec, m_ttBits, m_ttNames, m_ttu, m_ttuRbcLine, m_useRPCSimLink, m_verbosity, ProcessInputSignal::next(), convertSQLitetoXML_cfg::output, TTUEmulator::processTtu(), edm::Event::put(), Reset(), mps_fire::result, ProcessInputSignal::retrievedata(), searchCoincidence(), and mps_update::status.

136  {
137 
138 
139  bool status(false);
140 
142 
144 
145  std::auto_ptr<L1GtTechnicalTriggerRecord> output(new L1GtTechnicalTriggerRecord());
146 
147  if ( m_useRPCSimLink == 0 ) {
148  iEvent.getByLabel(m_rpcDigiLabel, pIn);
149  if ( ! pIn.isValid() ) {
150  edm::LogError("RPCTechnicalTrigger") << "can't find RPCDigiCollection with label: "
151  << m_rpcDigiLabel << '\n';
152  iEvent.put(output);
153  return;
154  }
155  m_signal = dynamic_cast<ProcessInputSignal*>(new RBCProcessRPCDigis( m_rpcGeometry, pIn ));
156 
157  } else {
158 
159  iEvent.getByLabel("simMuonRPCDigis", "RPCDigiSimLink", simIn);
160 
161  if ( ! simIn.isValid() ) {
162  edm::LogError("RPCTechnicalTrigger") << "can't find RPCDigiCollection with label: "
163  << m_rpcDigiLabel << '\n';
164  iEvent.put(output);
165  return;
166  }
167  m_signal = dynamic_cast<ProcessInputSignal*>(new RBCProcessRPCSimDigis( m_rpcGeometry, simIn ));
168  }
169 
170  LogDebug("RPCTechnicalTrigger") << "signal object created" << '\n';
171 
172  if ( ! m_hasConfig ) {
173  edm::LogError("RPCTechnicalTrigger") << "cannot read hardware configuration \n";
174  iEvent.put(output);
175  return;
176  }
177 
178  status = m_signal->next();
179 
180  if ( !status) {
181  delete m_signal;
182  iEvent.put(output);
183  return;
184  }
185 
187 
188  std::vector<L1GtTechnicalTrigger> ttVec( m_ttBits.size() );
189 
190  //. distribute data to different TTU emulator instances and process it
191 
192  m_triggerbits.reset();
193 
194  std::vector<TTUEmulator::TriggerResponse*>::const_iterator outItr;
195 
196  for(int k=0; k < m_maxTtuBoards; ++k) {
197 
198  m_ttu[k]->processTtu( m_input );
199 
200  //work out Pointing Logic to Tracker
202  m_ttuRbcLine[k]->processTtu( m_input , (*m_firstSector) );
203 
204  //...for trigger 1
205  for( outItr = m_ttu[k]->m_triggerBxVec.begin(); outItr != m_ttu[k]->m_triggerBxVec.end(); ++outItr )
206  m_serializedInfoLine1.push_back( new TTUResults( k, (*outItr)->m_bx, (*outItr)->m_trigger[0], (*outItr)->m_trigger[1] ) );
208 
209  //...for trigger 2
210  for( outItr = m_ttuRbcLine[k]->m_triggerBxVec.begin(); outItr != m_ttuRbcLine[k]->m_triggerBxVec.end(); ++outItr )
211  m_serializedInfoLine2.push_back( new TTUResults( k,
212  (*outItr)->m_bx,
213  (*outItr)->m_trigger[0],
214  (*outItr)->m_trigger[1],
215  (*outItr)->m_wedge ) );
216 
218 
219  }
220 
221  //.. write results to technical trigger bits
222  int bx(0);
223  int infoSize(0);
224 
225  infoSize = m_serializedInfoLine1.size();
226 
227  std::vector<RPCTechnicalTrigger::TTUResults*>::const_iterator ttuItr;
228 
229  std::sort( m_serializedInfoLine1.begin(), m_serializedInfoLine1.end(), sortByBx() );
230 
231  for( ttuItr = m_serializedInfoLine1.begin(); ttuItr != m_serializedInfoLine1.end(); ++ttuItr ) {
232  if ( m_verbosity && abs( (*ttuItr)->m_bx ) <= 1 )
233  std::cout << "RPCTechnicalTrigger> "
234  << (*ttuItr)->m_ttuidx << '\t'
235  << (*ttuItr)->m_bx << '\t'
236  << (*ttuItr)->m_trigWheel1 << '\t'
237  << (*ttuItr)->m_trigWheel2 << '\n';
238  }
239 
240  bool has_bx0 = false;
241 
242  for(int k = 0; k < infoSize; k+=m_maxTtuBoards) {
243 
244  bx = m_serializedInfoLine1[k]->m_bx;
245 
246  if ( bx == 0 ) {
247 
248  m_triggerbits.set(0, m_serializedInfoLine1[k]->m_trigWheel2);
249  m_triggerbits.set(1, m_serializedInfoLine1[k]->m_trigWheel1);
250  m_triggerbits.set(2, m_serializedInfoLine1[k+1]->m_trigWheel1);
251  m_triggerbits.set(3, m_serializedInfoLine1[k+2]->m_trigWheel1);
252  m_triggerbits.set(4, m_serializedInfoLine1[k+2]->m_trigWheel2);
253 
254  bool five_wheels_OR = m_triggerbits.any();
255 
256  ttVec.at(0)=L1GtTechnicalTrigger(m_ttNames.at(0), m_ttBits.at(0), bx, five_wheels_OR ) ; // bit 24 = Or 5 wheels in TTU mode
257  ttVec.at(2)=L1GtTechnicalTrigger(m_ttNames.at(2), m_ttBits.at(2), bx, m_triggerbits[0] ) ; // bit 26
258  ttVec.at(3)=L1GtTechnicalTrigger(m_ttNames.at(3), m_ttBits.at(3), bx, m_triggerbits[1] ) ; // bit 27
259  ttVec.at(4)=L1GtTechnicalTrigger(m_ttNames.at(4), m_ttBits.at(4), bx, m_triggerbits[2] ) ; // bit 28
260  ttVec.at(5)=L1GtTechnicalTrigger(m_ttNames.at(5), m_ttBits.at(5), bx, m_triggerbits[3] ) ; // bit 29
261  ttVec.at(6)=L1GtTechnicalTrigger(m_ttNames.at(6), m_ttBits.at(6), bx, m_triggerbits[4] ) ; // bit 30
262 
263  m_triggerbits.reset();
264 
265  has_bx0 = true;
266 
267  break;
268 
269  } else continue;
270 
271  }
272 
273  infoSize = m_serializedInfoLine2.size();
274 
275  std::sort( m_serializedInfoLine2.begin(), m_serializedInfoLine2.end(), sortByBx() );
276 
277  for( ttuItr = m_serializedInfoLine2.begin(); ttuItr != m_serializedInfoLine2.end(); ++ttuItr ) {
278  if ( m_verbosity && abs ( (*ttuItr)->m_bx ) <= 1 )
279  std::cout << "RPCTechnicalTrigger> "
280  << (*ttuItr)->m_ttuidx << '\t'
281  << (*ttuItr)->m_bx << '\t'
282  << (*ttuItr)->m_trigWheel1 << '\t'
283  << (*ttuItr)->m_trigWheel2 << '\t'
284  << (*ttuItr)->m_wedge << '\n';
285  }
286 
287  infoSize = convertToMap( m_serializedInfoLine2 );
288 
289  std::bitset<8> triggerCoincidence;
290  triggerCoincidence.reset();
291 
292  // searchCoincidence( W-2 , W0 )
293  bool result = searchCoincidence( -2, 0 );
294  triggerCoincidence.set(0, result );
295 
296  // searchCoincidence( W-2 , W+1 )
297  result = searchCoincidence( -2, 1 );
298  triggerCoincidence.set(1, result );
299 
300  // searchCoincidence( W-1 , W0 )
301  result = searchCoincidence( -1, 0 );
302  triggerCoincidence.set(2, result );
303 
304  // searchCoincidence( W-1 , W+1 )
305  result = searchCoincidence( -1, 1 );
306  triggerCoincidence.set(3, result );
307 
308  // searchCoincidence( W-1 , W+2 )
309  result = searchCoincidence( -1, 2 );
310  triggerCoincidence.set(4, result );
311 
312  // searchCoincidence( W0 , W0 )
313  result = searchCoincidence( 0 , 0 );
314  triggerCoincidence.set(5, result );
315 
316  // searchCoincidence( W+1 , W0 )
317  result = searchCoincidence( 1, 0 );
318  triggerCoincidence.set(6, result );
319 
320  // searchCoincidence( W+2 , W0 )
321  result = searchCoincidence( 2, 0 );
322  triggerCoincidence.set(7, result );
323 
324  bool five_wheels_OR = triggerCoincidence.any();
325 
326  if ( m_verbosity ) std::cout << "RPCTechnicalTrigger> pointing trigger: " << five_wheels_OR << '\n';
327 
328  ttVec.at(1)=L1GtTechnicalTrigger(m_ttNames.at(1), m_ttBits.at(1), bx, five_wheels_OR ) ; // bit 25 = Or 5 wheels in RBC mode
329 
330  triggerCoincidence.reset();
331 
332  //...check that data appeared at bx=0
333 
334  if ( ! has_bx0 ) {
335  iEvent.put(output);
336  status = Reset();
337  ++m_ievt;
338  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger> end of event loop" << std::endl;
339  return;
340 
341  }
342 
343  output->setGtTechnicalTrigger(ttVec);
344  iEvent.put(output);
345 
346  //.... all done
347 
348  status = Reset();
349  ++m_ievt;
350  LogDebug("RPCTechnicalTrigger") << "RPCTechnicalTrigger> end of event loop" << std::endl;
351 
352 }
#define LogDebug(id)
virtual RPCInputSignal * retrievedata()=0
std::vector< TTUResults * > m_serializedInfoLine1
edm::ESHandle< RPCGeometry > m_rpcGeometry
std::vector< int > m_quadrants
std::bitset< 5 > m_triggerbits
tuple result
Definition: mps_fire.py:84
std::vector< TriggerResponse * > m_triggerBxVec
Definition: TTUEmulator.h:112
ProcessInputSignal * m_signal
void clearTriggerResponse()
Definition: TTUEmulator.cc:324
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
TTUEmulator * m_ttu[3]
std::vector< TTUResults * > m_serializedInfoLine2
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
std::vector< unsigned > m_ttBits
void processTtu(RPCInputSignal *)
Definition: TTUEmulator.cc:162
virtual int next()=0
std::vector< std::string > m_ttNames
std::vector< int >::iterator m_firstSector
TTUEmulator * m_ttuRbcLine[3]
edm::InputTag m_rpcDigiLabel
tuple cout
Definition: gather_cfg.py:145
RPCInputSignal * m_input
int convertToMap(const std::vector< TTUResults * > &)
bool searchCoincidence(int, int)
tuple status
Definition: mps_update.py:57
bool RPCTechnicalTrigger::Reset ( void  )
private

Definition at line 354 of file RPCTechnicalTrigger.cc.

References RPCInputSignal::clear(), m_input, m_serializedInfoLine1, m_serializedInfoLine2, m_signal, m_triggerbits, and m_ttuResultsByQuadrant.

Referenced by produce().

355 {
356 
357  m_input->clear();
358  m_triggerbits.reset();
359  std::vector<TTUResults*>::iterator itrRes;
360 
361  for( itrRes=m_serializedInfoLine1.begin(); itrRes!=m_serializedInfoLine1.end(); ++itrRes)
362  delete (*itrRes);
363 
364  for( itrRes=m_serializedInfoLine2.begin(); itrRes!=m_serializedInfoLine2.end(); ++itrRes)
365  delete (*itrRes);
366 
367  m_serializedInfoLine1.clear();
368  m_serializedInfoLine2.clear();
369  m_ttuResultsByQuadrant.clear();
370 
371  delete m_signal;
372 
373  return true;
374 
375 }
std::vector< TTUResults * > m_serializedInfoLine1
virtual void clear()=0
Destructor.
std::bitset< 5 > m_triggerbits
ProcessInputSignal * m_signal
std::map< int, TTUResults * > m_ttuResultsByQuadrant
std::vector< TTUResults * > m_serializedInfoLine2
RPCInputSignal * m_input
bool RPCTechnicalTrigger::searchCoincidence ( int  wheel1,
int  wheel2 
)
private

Definition at line 467 of file RPCTechnicalTrigger.cc.

References relval_2017::k, relval_steps::key, m_firstSector, m_quadrants, m_ttuResultsByQuadrant, and m_WheelTtu.

Referenced by produce().

468 {
469 
470  std::map<int, TTUResults*>::iterator itr;
471  bool topRight(false);
472  bool botLeft(false);
473 
474  int indxW1 = m_WheelTtu[wheel1];
475  int indxW2 = m_WheelTtu[wheel2];
476 
477  int k(0);
478  int key(0);
479  bool finalTrigger(false);
480  int maxTopQuadrants = 4;
481 
482  //work out Pointing Logic to Tracker
483 
484  for( m_firstSector = m_quadrants.begin(); m_firstSector != m_quadrants.end(); ++m_firstSector) {
485 
486  key = 1000 * ( indxW1 ) + (*m_firstSector);
487 
488  itr = m_ttuResultsByQuadrant.find( key );
489  if ( itr != m_ttuResultsByQuadrant.end() )
490  topRight = (*itr).second->getTriggerForWheel(wheel1);
491 
492  //std::cout << "W1: " << wheel1 << " " << "sec: " << (*m_firstSector) << " dec: " << topRight << '\n';
493 
494  key = 1000 * ( indxW2 ) + (*m_firstSector) + 5;
495 
496  itr = m_ttuResultsByQuadrant.find( key );
497 
498  if ( itr != m_ttuResultsByQuadrant.end() )
499  botLeft = (*itr).second->getTriggerForWheel(wheel2);
500 
501  //std::cout << "W2: " << wheel2 << " " << "sec: " << (*m_firstSector) + 5 << " dec: " << botLeft << '\n';
502 
503  finalTrigger |= ( topRight && botLeft );
504 
505  ++k;
506 
507  if ( k > maxTopQuadrants)
508  break;
509 
510  }
511 
512  //Try the opposite now
513 
514  k=0;
515 
516  for( m_firstSector = m_quadrants.begin(); m_firstSector != m_quadrants.end(); ++m_firstSector) {
517 
518  key = 1000 * ( indxW2 ) + (*m_firstSector);
519 
520  itr = m_ttuResultsByQuadrant.find( key );
521  if ( itr != m_ttuResultsByQuadrant.end() )
522  topRight = (*itr).second->getTriggerForWheel(wheel1);
523 
524  //std::cout << "W1: " << wheel1 << " " << "sec: " << (*m_firstSector) << " dec: " << topRight << '\n';
525 
526  key = 1000 * ( indxW1 ) + (*m_firstSector) + 5;
527 
528  itr = m_ttuResultsByQuadrant.find( key );
529 
530  if ( itr != m_ttuResultsByQuadrant.end() )
531  botLeft = (*itr).second->getTriggerForWheel(wheel2);
532 
533  //std::cout << "W2: " << wheel2 << " " << "sec: " << (*m_firstSector) + 5 << " dec: " << botLeft << '\n';
534 
535  finalTrigger |= ( topRight && botLeft );
536 
537  ++k;
538 
539  if ( k > maxTopQuadrants)
540  break;
541 
542  }
543 
544  return finalTrigger;
545 
546 }
std::map< int, int > m_WheelTtu
std::vector< int > m_quadrants
std::map< int, TTUResults * > m_ttuResultsByQuadrant
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::vector< int >::iterator m_firstSector

Member Data Documentation

int RPCTechnicalTrigger::m_boardIndex[3]
private

Definition at line 115 of file RPCTechnicalTrigger.h.

Referenced by RPCTechnicalTrigger().

int RPCTechnicalTrigger::m_cand
private

Definition at line 114 of file RPCTechnicalTrigger.h.

Referenced by RPCTechnicalTrigger().

std::string RPCTechnicalTrigger::m_configFile
private

Definition at line 101 of file RPCTechnicalTrigger.h.

Referenced by beginRun(), and RPCTechnicalTrigger().

std::vector<int>::iterator RPCTechnicalTrigger::m_firstSector
private

Definition at line 182 of file RPCTechnicalTrigger.h.

Referenced by produce(), and searchCoincidence().

bool RPCTechnicalTrigger::m_hasConfig
private
int RPCTechnicalTrigger::m_ievt
private

Definition at line 113 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

RPCInputSignal* RPCTechnicalTrigger::m_input
private

Definition at line 91 of file RPCTechnicalTrigger.h.

Referenced by produce(), and Reset().

int RPCTechnicalTrigger::m_maxBits
private

Definition at line 118 of file RPCTechnicalTrigger.h.

Referenced by RPCTechnicalTrigger().

int RPCTechnicalTrigger::m_maxTtuBoards
private

Definition at line 117 of file RPCTechnicalTrigger.h.

Referenced by beginRun(), printinfo(), produce(), and RPCTechnicalTrigger().

int RPCTechnicalTrigger::m_nWheels[3]
private

Definition at line 116 of file RPCTechnicalTrigger.h.

Referenced by RPCTechnicalTrigger().

std::vector<int> RPCTechnicalTrigger::m_quadrants
private

Definition at line 180 of file RPCTechnicalTrigger.h.

Referenced by produce(), RPCTechnicalTrigger(), and searchCoincidence().

const RBCBoardSpecs* RPCTechnicalTrigger::m_rbcspecs
private

Definition at line 111 of file RPCTechnicalTrigger.h.

Referenced by beginRun().

TTUConfigurator* RPCTechnicalTrigger::m_readConfig
private

Definition at line 109 of file RPCTechnicalTrigger.h.

Referenced by beginRun(), RPCTechnicalTrigger(), and ~RPCTechnicalTrigger().

edm::InputTag RPCTechnicalTrigger::m_rpcDigiLabel
private

Definition at line 104 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

edm::ESHandle<RPCGeometry> RPCTechnicalTrigger::m_rpcGeometry
private

Definition at line 97 of file RPCTechnicalTrigger.h.

Referenced by beginRun(), and produce().

edm::InputTag RPCTechnicalTrigger::m_rpcSimLinkInstance
private

Definition at line 105 of file RPCTechnicalTrigger.h.

Referenced by RPCTechnicalTrigger().

std::vector<TTUResults*> RPCTechnicalTrigger::m_serializedInfoLine1
private

Definition at line 169 of file RPCTechnicalTrigger.h.

Referenced by produce(), and Reset().

std::vector<TTUResults*> RPCTechnicalTrigger::m_serializedInfoLine2
private

Definition at line 170 of file RPCTechnicalTrigger.h.

Referenced by produce(), and Reset().

ProcessInputSignal* RPCTechnicalTrigger::m_signal
private

Definition at line 93 of file RPCTechnicalTrigger.h.

Referenced by produce(), and Reset().

std::bitset<5> RPCTechnicalTrigger::m_triggerbits
private

Definition at line 95 of file RPCTechnicalTrigger.h.

Referenced by produce(), and Reset().

std::vector<unsigned> RPCTechnicalTrigger::m_ttBits
private

Definition at line 102 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

std::vector<std::string> RPCTechnicalTrigger::m_ttNames
private

Definition at line 103 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

TTUEmulator* RPCTechnicalTrigger::m_ttu[3]
private
TTUEmulator* RPCTechnicalTrigger::m_ttuRbcLine[3]
private
std::map<int,TTUResults*> RPCTechnicalTrigger::m_ttuResultsByQuadrant
private

Definition at line 178 of file RPCTechnicalTrigger.h.

Referenced by convertToMap(), Reset(), and searchCoincidence().

const TTUBoardSpecs* RPCTechnicalTrigger::m_ttuspecs
private

Definition at line 110 of file RPCTechnicalTrigger.h.

Referenced by beginRun().

int RPCTechnicalTrigger::m_useEventSetup
private

Definition at line 100 of file RPCTechnicalTrigger.h.

Referenced by beginRun(), and RPCTechnicalTrigger().

int RPCTechnicalTrigger::m_useRPCSimLink
private

Definition at line 107 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

int RPCTechnicalTrigger::m_verbosity
private

Definition at line 99 of file RPCTechnicalTrigger.h.

Referenced by produce(), and RPCTechnicalTrigger().

std::map<int,int> RPCTechnicalTrigger::m_WheelTtu
private