CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTTrigProd.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
11 //
12 //--------------------------------------------------
13 
14 // This class's header
16 
17 // Framework related classes
21 
24 
25 // Data Formats classes
32 
33 // Collaborating classes
34 #include <iostream>
35 
36 using namespace edm;
37 using namespace std;
38 
39 // DataFormats interface
40 typedef vector<DTSectCollPhSegm> SectCollPhiColl;
41 typedef SectCollPhiColl::const_iterator SectCollPhiColl_iterator;
42 typedef vector<DTSectCollThSegm> SectCollThetaColl;
43 typedef SectCollThetaColl::const_iterator SectCollThetaColl_iterator;
44 
45 DTTrigProd::DTTrigProd(const ParameterSet& pset) : my_trig(0) {
46 
47  produces<L1MuDTChambPhContainer>();
48  produces<L1MuDTChambThContainer>();
49 
50  my_debug = pset.getUntrackedParameter<bool>("debug");
51  my_DTTFnum = pset.getParameter<bool>("DTTFSectorNumbering");
52  my_params = pset;
53 
54  my_lut_dump_flag = pset.getUntrackedParameter<bool>("lutDumpFlag");
55  my_lut_btic = pset.getUntrackedParameter<int>("lutBtic");
56 
57 }
58 
60 
61  if (my_trig) delete my_trig;
62 
63 }
64 
65 void DTTrigProd::beginRun(edm::Run const& iRun, const edm::EventSetup& iEventSetup) {
66 
67  if(my_debug)
68  cout << "DTTrigProd::beginRun " << iRun.id().run() << endl;
69 
71  iEventSetup.get< DTConfigManagerRcd >().get( dtConfig ) ;
72 
73  my_CCBValid = dtConfig->CCBConfigValidity();
74 
75  if (!my_trig) {
76  my_trig = new DTTrig(my_params);
77  my_trig->createTUs(iEventSetup);
78  if (my_debug)
79  cout << "[DTTrigProd] TU's Created" << endl;
80 
81  if(my_lut_dump_flag) {
82  cout << "Dumping luts...." << endl;
83  my_trig->dumpLuts(my_lut_btic, dtConfig.product());
84  }
85  }
86 
87 
88 
89 }
90 
91 
92 void DTTrigProd::produce(Event & iEvent, const EventSetup& iEventSetup){
93 
94  vector<L1MuDTChambPhDigi> outPhi;
95  vector<L1MuDTChambThDigi> outTheta;
96 
97  // SV check if CCB configuration is valid, otherwise just produce empty collections
98  if(!my_CCBValid) {
99  if (my_debug)
100  cout << "[DTTrigProd] CCB configuration is not valid for this run, empty collection will be produced " << endl;
101  } else {
102  my_trig->triggerReco(iEvent,iEventSetup);
104 
105  if (my_debug)
106  cout << "[DTTrigProd] Trigger algorithm run for " <<iEvent.id() << endl;
107 
108  // Convert Phi Segments
109  SectCollPhiColl myPhiSegments;
110  myPhiSegments = my_trig->SCPhTrigs();
111 
112  SectCollPhiColl_iterator SCPCend = myPhiSegments.end();
113  for (SectCollPhiColl_iterator it=myPhiSegments.begin();it!=SCPCend;++it){
114  int step = (*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
115  int sc_sector = (*it).SCId().sector();
116  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
117  outPhi.push_back(L1MuDTChambPhDigi(step,
118  (*it).ChamberId().wheel(),
119  sc_sector,
120  (*it).ChamberId().station(),
121  (*it).phi(),
122  (*it).phiB(),
123  (*it).code(),
124  !(*it).isFirst(),
125  0
126  ));
127  }
128 
129  // Convert Theta Segments
130  SectCollThetaColl myThetaSegments;
131  myThetaSegments = my_trig->SCThTrigs();
132 
133  SectCollThetaColl_iterator SCTCend = myThetaSegments.end();
134  for (SectCollThetaColl_iterator it=myThetaSegments.begin();it!=SCTCend;++it){
135  int pos[7], qual[7];
136  for (int i=0; i<7; i++){
137  pos[i] =(*it).position(i);
138  qual[i]=(*it).quality(i);
139  }
140  int step =(*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
141  int sc_sector = (*it).SCId().sector();
142  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
143  outTheta.push_back(L1MuDTChambThDigi( step,
144  (*it).ChamberId().wheel(),
145  sc_sector,
146  (*it).ChamberId().station(),
147  pos,
148  qual
149  ));
150  }
151  }
152 
153  // Write everything into the event (CB write empty collection as default actions if emulator does not run)
154  std::auto_ptr<L1MuDTChambPhContainer> resultPhi (new L1MuDTChambPhContainer);
155  resultPhi->setContainer(outPhi);
156  iEvent.put(resultPhi);
157  std::auto_ptr<L1MuDTChambThContainer> resultTheta (new L1MuDTChambThContainer);
158  resultTheta->setContainer(outTheta);
159  iEvent.put(resultTheta);
160 
161 }
162 
T getParameter(std::string const &) const
bool my_CCBValid
Definition: DTTrigProd.h:49
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
int getBXOffset()
Get BX Offset.
Definition: DTTrig.h:182
RunID const & id() const
Definition: RunBase.h:41
DTTrigProd(const edm::ParameterSet &pset)
Constructor.
Definition: DTTrigProd.cc:45
bool my_lut_dump_flag
Definition: DTTrigProd.h:61
RunNumber_t run() const
Definition: RunID.h:43
short int my_lut_btic
Definition: DTTrigProd.h:62
vector< DTSectCollThSegm > SectCollThetaColl
Definition: DTTrigProd.cc:42
std::vector< DTSectCollPhSegm > SCPhTrigs()
Return a copy of all the Sector Collector (Phi) triggers.
Definition: DTTrig.cc:551
void produce(edm::Event &iEvent, const edm::EventSetup &iEventSetup)
Producer: process every event and generates trigger data.
Definition: DTTrigProd.cc:92
int iEvent
Definition: GenABIO.cc:243
SectCollThetaColl::const_iterator SectCollThetaColl_iterator
Definition: DTTrigProd.cc:43
int my_BXoffset
Definition: DTTrigProd.h:55
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void triggerReco(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Run the whole trigger reconstruction chain.
Definition: DTTrig.cc:150
bool my_debug
Definition: DTTrigProd.h:58
~DTTrigProd()
Destructor.
Definition: DTTrigProd.cc:59
edm::ParameterSet my_params
Definition: DTTrigProd.h:65
Definition: DTTrig.h:52
void dumpLuts(short int lut_btic, const DTConfigManager *conf)
Dump the LUT files.
Definition: DTTrig.cc:468
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
DTTrig * my_trig
Definition: DTTrigProd.h:46
SectCollPhiColl::const_iterator SectCollPhiColl_iterator
Definition: DTTrigProd.cc:41
edm::EventID id() const
Definition: EventBase.h:56
bool my_DTTFnum
Definition: DTTrigProd.h:52
tuple cout
Definition: gather_cfg.py:121
vector< DTSectCollPhSegm > SectCollPhiColl
Definition: DTTrigProd.cc:40
void createTUs(const edm::EventSetup &iSetup)
Create the trigger units and store them in the cache.
Definition: DTTrig.cc:76
void beginRun(edm::Run const &iRun, const edm::EventSetup &iEventSetup) override
Create Trigger Units before starting event processing.
Definition: DTTrigProd.cc:65
Definition: Run.h:41
std::vector< DTSectCollThSegm > SCThTrigs()
Return a copy of all the Sector Collector (Theta) triggers.
Definition: DTTrig.cc:580