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