CMS 3D CMS Logo

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 
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  if(!(my_trig)) my_trig = new DTTrig(my_params,consumesCollector());
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  my_trig->createTUs(iEventSetup);
76  if (my_debug)
77  cout << "[DTTrigProd] TU's Created" << endl;
78 
79  if(my_lut_dump_flag) {
80  cout << "Dumping luts...." << endl;
81  my_trig->dumpLuts(my_lut_btic, dtConfig.product());
82  }
83 
84 }
85 
86 
87 void DTTrigProd::produce(Event & iEvent, const EventSetup& iEventSetup){
88 
89  vector<L1MuDTChambPhDigi> outPhi;
90  vector<L1MuDTChambThDigi> outTheta;
91 
92  // SV check if CCB configuration is valid, otherwise just produce empty collections
93  if(!my_CCBValid) {
94  if (my_debug)
95  cout << "[DTTrigProd] CCB configuration is not valid for this run, empty collection will be produced " << endl;
96  } else {
97  my_trig->triggerReco(iEvent,iEventSetup);
99 
100  if (my_debug)
101  cout << "[DTTrigProd] Trigger algorithm run for " <<iEvent.id() << endl;
102 
103  // Convert Phi Segments
104  SectCollPhiColl myPhiSegments;
105  myPhiSegments = my_trig->SCPhTrigs();
106 
107  SectCollPhiColl_iterator SCPCend = myPhiSegments.end();
108  for (SectCollPhiColl_iterator it=myPhiSegments.begin();it!=SCPCend;++it){
109  int step = (*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
110  int sc_sector = (*it).SCId().sector();
111  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
112  outPhi.push_back(L1MuDTChambPhDigi(step,
113  (*it).ChamberId().wheel(),
114  sc_sector,
115  (*it).ChamberId().station(),
116  (*it).phi(),
117  (*it).phiB(),
118  (*it).code(),
119  !(*it).isFirst(),
120  0
121  ));
122  }
123 
124  // Convert Theta Segments
125  SectCollThetaColl myThetaSegments;
126  myThetaSegments = my_trig->SCThTrigs();
127 
128  SectCollThetaColl_iterator SCTCend = myThetaSegments.end();
129  for (SectCollThetaColl_iterator it=myThetaSegments.begin();it!=SCTCend;++it){
130  int pos[7], qual[7];
131  for (int i=0; i<7; i++){
132  pos[i] =(*it).position(i);
133  qual[i]=(*it).quality(i);
134  }
135  int step =(*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
136  int sc_sector = (*it).SCId().sector();
137  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
138  outTheta.push_back(L1MuDTChambThDigi( step,
139  (*it).ChamberId().wheel(),
140  sc_sector,
141  (*it).ChamberId().station(),
142  pos,
143  qual
144  ));
145  }
146  }
147 
148  // Write everything into the event (CB write empty collection as default actions if emulator does not run)
149  std::unique_ptr<L1MuDTChambPhContainer> resultPhi (new L1MuDTChambPhContainer);
150  resultPhi->setContainer(outPhi);
151  iEvent.put(std::move(resultPhi));
152  std::unique_ptr<L1MuDTChambThContainer> resultTheta (new L1MuDTChambThContainer);
153  resultTheta->setContainer(outTheta);
154  iEvent.put(std::move(resultTheta));
155 
156 }
157 
T getParameter(std::string const &) const
bool my_CCBValid
Definition: DTTrigProd.h:49
T getUntrackedParameter(std::string const &, T const &) const
int getBXOffset()
Get BX Offset.
Definition: DTTrig.h:183
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
RunID const & id() const
Definition: RunBase.h:39
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:39
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
int iEvent
Definition: GenABIO.cc:230
SectCollThetaColl::const_iterator SectCollThetaColl_iterator
Definition: DTTrigProd.cc:43
int my_BXoffset
Definition: DTTrigProd.h:55
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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
bool CCBConfigValidity() const
flag for CCB configuration validity
Definition: DTTrig.h:53
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
DTTrig * my_trig
Definition: DTTrigProd.h:46
SectCollPhiColl::const_iterator SectCollPhiColl_iterator
Definition: DTTrigProd.cc:41
edm::EventID id() const
Definition: EventBase.h:60
HLT enums.
bool my_DTTFnum
Definition: DTTrigProd.h:52
step
vector< DTSectCollPhSegm > SectCollPhiColl
Definition: DTTrigProd.cc:40
void produce(edm::Event &iEvent, const edm::EventSetup &iEventSetup) override
Producer: process every event and generates trigger data.
Definition: DTTrigProd.cc:87
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
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:42
std::vector< DTSectCollThSegm > SCThTrigs()
Return a copy of all the Sector Collector (Theta) triggers.
Definition: DTTrig.cc:580