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 
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>("lut_dump_flag");
57  my_lut_btic = pset.getUntrackedParameter<int>("lut_btic");
58 }
59 
61 
62  if (my_trig) delete my_trig;
63 
64 }
65 
66 // void DTTrigProd::beginJob(const EventSetup & iEventSetup){
67 
68 
69 // // get DTConfigManager
70 // // ESHandle< DTConfigManager > confManager ;
71 // // iEventSetup.get< DTConfigManagerRcd >().get( confManager ) ;
72 // // my_BXoffset = confManager->getBXOffset();
73 
74 // if (my_debug)
75 // cout << "[DTTrigProd] DTTrig istance Created" << endl;
76 
77 // }
78 
79 void DTTrigProd::beginRun(edm::Run& iRun, const edm::EventSetup& iEventSetup) {
80 
81  if(my_debug)
82  cout << "DTTrigProd::beginRun " << iRun.id().run() << endl;
83 
84  using namespace edm;
85 
87  iEventSetup.get< DTConfigManagerRcd >().get( dtConfig ) ;
88 
89  if(my_debug)
90  {
91  cout << "DTConfigManagerRcd : Print some Config stuff" << endl;
92  DTBtiId btiid(1,1,1,1,1);
93  DTTracoId tracoid(1,1,1,1);
94  DTChamberId chid(1,1,1);
95  DTSectCollId scid(1,1);
96  cout << "BtiMap & TracoMap Size for chamber (1,1,1):" << dtConfig->getDTConfigBtiMap(chid).size()
97  << " " << dtConfig->getDTConfigTracoMap(chid).size() << endl;
98 
99  dtConfig->getDTConfigBti(btiid)->print();
100  dtConfig->getDTConfigTraco(tracoid)->print();
101  dtConfig->getDTConfigTSTheta(chid)->print();
102  dtConfig->getDTConfigTSPhi(chid)->print();
103  // 100511 SV LUTs will NOT be configurated from cfg if not found in DB
104  //dtConfig->getDTConfigLUTs(chid)->print();
105  }
106 
107 
108  if (!my_trig) {
109  my_trig = new DTTrig(my_params);
110  my_trig->createTUs(iEventSetup);
111  if (my_debug)
112  cout << "[DTTrigProd] TU's Created" << endl;
113 
114  //SV 090903 check luts
115  if(my_lut_dump_flag) {
116  cout << "Dumping luts...." << endl;
117  my_trig->dumpLuts(my_lut_btic, dtConfig.product());
118  }
119  }
120 
121 }
122 
123 
124 void DTTrigProd::produce(Event & iEvent, const EventSetup& iEventSetup){
125 
126  my_trig->triggerReco(iEvent,iEventSetup);
128 
129  if (my_debug)
130  cout << "[DTTrigProd] Trigger algorithm run for " <<iEvent.id() << endl;
131 
132  // Convert Phi Segments
133  SectCollPhiColl myPhiSegments;
134  myPhiSegments = my_trig->SCPhTrigs();
135  vector<L1MuDTChambPhDigi> outPhi;
136 
137  SectCollPhiColl_iterator SCPCend = myPhiSegments.end();
138  for (SectCollPhiColl_iterator it=myPhiSegments.begin();it!=SCPCend;++it){
139  int step = (*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
140  int sc_sector = (*it).SCId().sector();
141  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
142  outPhi.push_back(L1MuDTChambPhDigi(step,
143  (*it).ChamberId().wheel(),
144  sc_sector,
145  (*it).ChamberId().station(),
146  (*it).phi(),
147  (*it).phiB(),
148  (*it).code(),
149  !(*it).isFirst(),
150  0
151  ));
152  }
153 
154  // Convert Theta Segments
155  SectCollThetaColl myThetaSegments;
156  myThetaSegments = my_trig->SCThTrigs();
157  vector<L1MuDTChambThDigi> outTheta;
158 
159  SectCollThetaColl_iterator SCTCend = myThetaSegments.end();
160  for (SectCollThetaColl_iterator it=myThetaSegments.begin();it!=SCTCend;++it){
161  int pos[7], qual[7];
162  for (int i=0; i<7; i++){
163  pos[i] =(*it).position(i);
164  qual[i]=(*it).quality(i);
165  }
166  int step =(*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
167  int sc_sector = (*it).SCId().sector();
168  if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
169  outTheta.push_back(L1MuDTChambThDigi( step,
170  (*it).ChamberId().wheel(),
171  sc_sector,
172  (*it).ChamberId().station(),
173  pos,
174  qual
175  ));
176  }
177 
178  // Write everything into the event
179  std::auto_ptr<L1MuDTChambPhContainer> resultPhi (new L1MuDTChambPhContainer);
180  resultPhi->setContainer(outPhi);
181  iEvent.put(resultPhi);
182  std::auto_ptr<L1MuDTChambThContainer> resultTheta (new L1MuDTChambThContainer);
183  resultTheta->setContainer(outTheta);
184  iEvent.put(resultTheta);
185 
186 }
187 
T getParameter(std::string const &) const
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:43
void beginRun(edm::Run &iRun, const edm::EventSetup &iEventSetup)
Create Trigger Units before starting event processing.
Definition: DTTrigProd.cc:79
DTTrigProd(const edm::ParameterSet &pset)
Constructor.
Definition: DTTrigProd.cc:47
bool my_lut_dump_flag
Definition: DTTrigProd.h:60
RunNumber_t run() const
Definition: RunID.h:44
short int my_lut_btic
Definition: DTTrigProd.h:61
vector< DTSectCollThSegm > SectCollThetaColl
Definition: DTTrigProd.cc:44
std::vector< DTSectCollPhSegm > SCPhTrigs()
Return a copy of all the Sector Collector (Phi) triggers.
Definition: DTTrig.cc:634
void produce(edm::Event &iEvent, const edm::EventSetup &iEventSetup)
Producer: process every event and generates trigger data.
Definition: DTTrigProd.cc:124
int iEvent
Definition: GenABIO.cc:243
SectCollThetaColl::const_iterator SectCollThetaColl_iterator
Definition: DTTrigProd.cc:45
int my_BXoffset
Definition: DTTrigProd.h:54
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
tuple pset
Definition: CrabTask.py:85
void triggerReco(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Run the whole trigger reconstruction chain.
Definition: DTTrig.cc:183
bool my_debug
Definition: DTTrigProd.h:57
~DTTrigProd()
Destructor.
Definition: DTTrigProd.cc:60
edm::ParameterSet my_params
Definition: DTTrigProd.h:64
Definition: DTTrig.h:54
void dumpLuts(short int lut_btic, const DTConfigManager *conf)
Dump the LUT files.
Definition: DTTrig.cc:551
const T & get() const
Definition: EventSetup.h:55
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:51
tuple cout
Definition: gather_cfg.py:41
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:88
Definition: Run.h:31
std::vector< DTSectCollThSegm > SCThTrigs()
Return a copy of all the Sector Collector (Theta) triggers.
Definition: DTTrig.cc:663