CMS 3D CMS Logo

DTTrigProd.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
11 //
12 //--------------------------------------------------
13 
14 // Framework related classes
24 
28 
29 // Data Formats classes
36 
37 // Collaborating classes
38 #include <iostream>
39 
40 using namespace edm;
41 using namespace std;
42 
43 // DataFormats interface
44 typedef vector<DTSectCollPhSegm> SectCollPhiColl;
45 typedef SectCollPhiColl::const_iterator SectCollPhiColl_iterator;
46 typedef vector<DTSectCollThSegm> SectCollThetaColl;
47 typedef SectCollThetaColl::const_iterator SectCollThetaColl_iterator;
48 
50 public:
53 
55  void beginRun(edm::Run const& iRun, const edm::EventSetup& iEventSetup) override;
56 
58  void produce(edm::Event& iEvent, const edm::EventSetup& iEventSetup) override;
59 
60 private:
61  // Trigger istance
63 
66 
67  // Trigger Configuration Manager CCB validity flag
68  bool my_CCBValid = false;
69 
70  // Sector Format Flag true=[0-11] false=[1-12]
71  const bool my_DTTFnum;
72 
73  // Debug Flag
74  const bool my_debug;
75 
76  // Lut dump file parameters
77  const bool my_lut_dump_flag;
78  const short int my_lut_btic;
79 };
80 
82  : my_trig(pset, consumesCollector()),
83  phToken_{produces<L1MuDTChambPhContainer>()},
84  thToken_{produces<L1MuDTChambThContainer>()},
85  my_DTTFnum{pset.getParameter<bool>("DTTFSectorNumbering")},
86  my_debug{pset.getUntrackedParameter<bool>("debug")},
87  my_lut_dump_flag{pset.getUntrackedParameter<bool>("lutDumpFlag")},
88  my_lut_btic{static_cast<short int>(pset.getUntrackedParameter<int>("lutBtic"))} {}
89 
90 void DTTrigProd::beginRun(edm::Run const& iRun, const edm::EventSetup& iEventSetup) {
91  if (my_debug)
92  cout << "DTTrigProd::beginRun " << iRun.id().run() << endl;
93 
95  iEventSetup.get<DTConfigManagerRcd>().get(dtConfig);
96 
97  my_CCBValid = dtConfig->CCBConfigValidity();
98 
99  my_trig.createTUs(iEventSetup);
100  if (my_debug)
101  cout << "[DTTrigProd] TU's Created" << endl;
102 
103  if (my_lut_dump_flag) {
104  cout << "Dumping luts...." << endl;
105  my_trig.dumpLuts(my_lut_btic, dtConfig.product());
106  }
107 }
108 
109 void DTTrigProd::produce(Event& iEvent, const EventSetup& iEventSetup) {
110  vector<L1MuDTChambPhDigi> outPhi;
111  vector<L1MuDTChambThDigi> outTheta;
112 
113  // SV check if CCB configuration is valid, otherwise just produce empty collections
114  if (!my_CCBValid) {
115  if (my_debug)
116  cout << "[DTTrigProd] CCB configuration is not valid for this run, empty collection will be produced " << endl;
117  } else {
118  my_trig.triggerReco(iEvent, iEventSetup);
119  // BX offset used to correct DTTPG output
120  int bx_offset = my_trig.getBXOffset();
121 
122  if (my_debug)
123  cout << "[DTTrigProd] Trigger algorithm run for " << iEvent.id() << endl;
124 
125  // Convert Phi Segments
126  SectCollPhiColl myPhiSegments;
127  myPhiSegments = my_trig.SCPhTrigs();
128 
129  SectCollPhiColl_iterator SCPCend = myPhiSegments.end();
130  for (SectCollPhiColl_iterator it = myPhiSegments.begin(); it != SCPCend; ++it) {
131  int step = (*it).step() - bx_offset; // Shift correct BX to 0 (needed for DTTF data processing)
132  int sc_sector = (*it).SCId().sector();
133  if (my_DTTFnum == true)
134  sc_sector--; // Modified for DTTF numbering [0-11]
135  outPhi.push_back(L1MuDTChambPhDigi(step,
136  (*it).ChamberId().wheel(),
137  sc_sector,
138  (*it).ChamberId().station(),
139  (*it).phi(),
140  (*it).phiB(),
141  (*it).code(),
142  !(*it).isFirst(),
143  0));
144  }
145 
146  // Convert Theta Segments
147  SectCollThetaColl myThetaSegments;
148  myThetaSegments = my_trig.SCThTrigs();
149 
150  SectCollThetaColl_iterator SCTCend = myThetaSegments.end();
151  for (SectCollThetaColl_iterator it = myThetaSegments.begin(); it != SCTCend; ++it) {
152  int pos[7], qual[7];
153  for (int i = 0; i < 7; i++) {
154  pos[i] = (*it).position(i);
155  qual[i] = (*it).quality(i);
156  }
157  int step = (*it).step() - bx_offset; // Shift correct BX to 0 (needed for DTTF data processing)
158  int sc_sector = (*it).SCId().sector();
159  if (my_DTTFnum == true)
160  sc_sector--; // Modified for DTTF numbering [0-11]
161  outTheta.push_back(
162  L1MuDTChambThDigi(step, (*it).ChamberId().wheel(), sc_sector, (*it).ChamberId().station(), pos, qual));
163  }
164  }
165 
166  // Write everything into the event (CB write empty collection as default actions if emulator does not run)
167  iEvent.emplace(phToken_, std::move(outPhi));
168  iEvent.emplace(thToken_, std::move(outTheta));
169 }
170 
SectCollThetaColl
vector< DTSectCollThSegm > SectCollThetaColl
Definition: DTTrigProd.cc:46
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
DTConfigManager::CCBConfigValidity
bool CCBConfigValidity() const
flag for CCB configuration validity
Definition: DTConfigManager.h:111
mps_fire.i
i
Definition: mps_fire.py:355
L1MuDTChambThDigi.h
L1MuDTChambPhDigi.h
DTTrig::getBXOffset
int getBXOffset() const
Get BX Offset.
Definition: DTTrig.h:196
ESHandle.h
step
step
Definition: StallMonitor.cc:94
edm::RunID::run
RunNumber_t run() const
Definition: RunID.h:36
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::EDPutTokenT< L1MuDTChambPhContainer >
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos
Definition: PixelAliasList.h:18
SectCollPhiColl
vector< DTSectCollPhSegm > SectCollPhiColl
Definition: DTTrigProd.cc:44
DTTrigProd::my_lut_btic
const short int my_lut_btic
Definition: DTTrigProd.cc:78
EDProducer.h
DTTrig::SCPhTrigs
std::vector< DTSectCollPhSegm > SCPhTrigs() const
Return a copy of all the Sector Collector (Phi) triggers.
Definition: DTTrig.cc:468
DTConfigManager.h
L1MuDTChambThContainer.h
MakerMacros.h
DTTrig::triggerReco
void triggerReco(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Run the whole trigger reconstruction chain.
Definition: DTTrig.cc:134
DTTrigProd::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iEventSetup) override
Producer: process every event and generates trigger data.
Definition: DTTrigProd.cc:109
DTTrigProd::my_DTTFnum
const bool my_DTTFnum
Definition: DTTrigProd.cc:71
DTTrigProd
Definition: DTTrigProd.cc:49
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
DTTrigProd::beginRun
void beginRun(edm::Run const &iRun, const edm::EventSetup &iEventSetup) override
Create Trigger Units before starting event processing.
Definition: DTTrigProd.cc:90
Run.h
edm::ESHandle
Definition: DTSurvey.h:22
DTSectCollThSegm.h
SectCollPhiColl_iterator
SectCollPhiColl::const_iterator SectCollPhiColl_iterator
Definition: DTTrigProd.cc:45
DTSectCollPhSegm.h
DTConfigManagerRcd
Definition: DTConfigManagerRcd.h:31
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
DTTrigProd::DTTrigProd
DTTrigProd(const edm::ParameterSet &pset)
Constructor.
Definition: DTTrigProd.cc:81
EDPutToken.h
DTTrigProd::my_CCBValid
bool my_CCBValid
Definition: DTTrigProd.cc:68
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
DTTrig::SCThTrigs
std::vector< DTSectCollThSegm > SCThTrigs() const
Return a copy of all the Sector Collector (Theta) triggers.
Definition: DTTrig.cc:491
edm::EventSetup
Definition: EventSetup.h:57
L1MuDTChambPhContainer.h
get
#define get
DTTrig::dumpLuts
void dumpLuts(short int lut_btic, const DTConfigManager *conf) const
Dump the LUT files.
Definition: DTTrig.cc:401
DTTrigProd::my_debug
const bool my_debug
Definition: DTTrigProd.cc:74
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DTConfigManagerRcd.h
DTTrig::createTUs
void createTUs(const edm::EventSetup &iSetup)
Create the trigger units and store them in the cache.
Definition: DTTrig.cc:64
L1MuDTChambThDigi
Definition: L1MuDTChambThDigi.h:33
DTTrig
Definition: DTTrig.h:54
Frameworkfwd.h
DTTrigProd::phToken_
edm::EDPutTokenT< L1MuDTChambPhContainer > phToken_
Definition: DTTrigProd.cc:64
EventSetup.h
DTTrigProd::my_trig
DTTrig my_trig
Definition: DTTrigProd.cc:62
DTTrigProd::my_lut_dump_flag
const bool my_lut_dump_flag
Definition: DTTrigProd.cc:77
ParameterSet.h
edm::Event
Definition: Event.h:73
SectCollThetaColl_iterator
SectCollThetaColl::const_iterator SectCollThetaColl_iterator
Definition: DTTrigProd.cc:47
edm::RunBase::id
RunID const & id() const
Definition: RunBase.h:39
DTTrigProd::thToken_
edm::EDPutTokenT< L1MuDTChambThContainer > thToken_
Definition: DTTrigProd.cc:65
DTTrig.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31