39 #include <CLHEP/Vector/LorentzVector.h> 53 string outputfile =
pset.getUntrackedParameter<
string>(
"outputFileName");
57 my_tree =
new TTree(
"h1",
"GMT", 0);
60 cout <<
"[DTTrigTest] Constructor executed!!!" << endl;
69 cout <<
"[DTTrigTest] Destructor executed!!!" << endl;
74 cout <<
"[DTTrigTest] Writing Tree and Closing File" << endl;
138 my_tree->Branch(
"tk",
tk,
"tk[Ntraco]/I");
139 my_tree->Branch(
"tx",
tx,
"tx[Ntraco]/I");
168 my_tree->Branch(
"thpos",
thpos,
"thpos[Ntstheta][7]/I");
199 cout <<
"[DTTrigTest] TU's Created" << endl;
203 const int MAXGEN = 10;
204 const float ptcut = 1.0;
205 const float etacut = 2.4;
208 cout <<
"[DTTrigTest] Trigger algorithm executed for run " <<
iEvent.id().run() <<
" event " <<
iEvent.id().event()
219 iEvent.getByLabel(
"g4SimHits", MyTracks);
220 iEvent.getByLabel(
"g4SimHits", MyVertexes);
221 vector<SimTrack>::const_iterator itrack;
224 cout <<
"[DTTrigTest] Tracks found in the detector (not only muons) " << MyTracks->size() << endl;
226 for (itrack = MyTracks->begin(); itrack != MyTracks->end(); itrack++) {
227 if (
abs(itrack->type()) == 13) {
229 float pt = momentum.Pt();
230 float eta = momentum.eta();
232 float phi = momentum.phi();
233 int charge =
static_cast<int>(-itrack->type() / 13);
236 int vtxindex = itrack->vertIndex();
237 float gvx = 0, gvy = 0, gvz = 0;
239 gvx = MyVertexes->at(vtxindex).position().x();
240 gvy = MyVertexes->at(vtxindex).position().y();
241 gvz = MyVertexes->at(vtxindex).position().z();
263 vector<DTBtiTrigData>::const_iterator pbti;
266 cout <<
"[DTTrigTest] " << btitrigs.size() <<
" BTI triggers found" << endl;
268 for (pbti = btitrigs.begin(); pbti != btitrigs.end(); pbti++) {
270 bwh[ibti] = pbti->wheel();
271 bstat[ibti] = pbti->station();
272 bsect[ibti] = pbti->sector();
273 bsl[ibti] = pbti->btiSL();
274 bnum[ibti] = pbti->btiNumber();
275 bbx[ibti] = pbti->step();
276 bcod[ibti] = pbti->code();
277 bk[ibti] = pbti->K();
278 bx[ibti] = pbti->X();
294 vector<DTTracoTrigData>::const_iterator ptc;
297 cout <<
"[DTTrigTest] " << tracotrigs.size() <<
" TRACO triggers found" << endl;
299 for (ptc = tracotrigs.begin(); ptc != tracotrigs.end(); ptc++) {
301 twh[itraco] = ptc->wheel();
302 tstat[itraco] = ptc->station();
303 tsect[itraco] = ptc->sector();
304 tnum[itraco] = ptc->tracoNumber();
305 tbx[itraco] = ptc->step();
306 tcod[itraco] = ptc->code();
307 tk[itraco] = ptc->K();
308 tx[itraco] = ptc->X();
324 vector<DTChambPhSegm>::const_iterator ptsph;
327 cout <<
"[DTTrigTest] " << tsphtrigs.size() <<
" TSPhi triggers found" << endl;
329 for (ptsph = tsphtrigs.begin(); ptsph != tsphtrigs.end(); ptsph++) {
331 swh[itsphi] = ptsph->wheel();
332 sstat[itsphi] = ptsph->station();
333 ssect[itsphi] = ptsph->sector();
334 sbx[itsphi] = ptsph->step();
335 scod[itsphi] = ptsph->oldCode();
336 sphi[itsphi] = ptsph->phi();
337 sphib[itsphi] = ptsph->phiB();
353 vector<DTChambThSegm>::const_iterator ptsth;
356 cout <<
"[DTTrigTest] " << tsthtrigs.size() <<
" TSTheta triggers found" << endl;
358 for (ptsth = tsthtrigs.begin(); ptsth != tsthtrigs.end(); ptsth++) {
360 thwh[itstheta] = ptsth->ChamberId().wheel();
361 thstat[itstheta] = ptsth->ChamberId().station();
362 thsect[itstheta] = ptsth->ChamberId().sector();
363 thbx[itstheta] = ptsth->step();
364 for (
int i = 0;
i < 7;
i++) {
365 thcode[itstheta][
i] = ptsth->code(
i);
366 thpos[itstheta][
i] = ptsth->position(
i);
367 thqual[itstheta][
i] = ptsth->quality(
i);
376 vector<DTSectCollPhSegm>::const_iterator pscph;
379 cout <<
"[DTTrigTest] " << scphtrigs.size() <<
" SectCollPhi triggers found" << endl;
381 for (pscph = scphtrigs.begin(); pscph != scphtrigs.end(); pscph++) {
384 scphwh[iscphi] = pscph->wheel();
385 scphstat[iscphi] = pscph->station();
387 scphbx[iscphi] = pscph->step();
388 scphcod[iscphi] = pscph->oldCode();
389 scphphi[iscphi] = pscph->phi();
406 vector<DTSectCollThSegm>::const_iterator pscth;
409 cout <<
"[DTTrigTest] " << scthtrigs.size() <<
" SectCollTheta triggers found" << endl;
411 for (pscth = scthtrigs.begin(); pscth != scthtrigs.end(); pscth++) {
413 scthwh[isctheta] = pscth->ChamberId().wheel();
414 scthstat[isctheta] = pscth->ChamberId().station();
415 scthsect[isctheta] = pscth->ChamberId().sector();
416 scthbx[isctheta] = pscth->step();
417 for (
int i = 0;
i < 7;
i++) {
419 scthpos[isctheta][
i] = pscth->position(
i);
std::vector< DTBtiTrigData > BtiTrigs() const
Return a copy of all the BTI triggers.
edm::ParameterSet my_params
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup) override
Create DTTrig instance and TUs.
std::vector< DTChambThSegm > TSThTrigs() const
Return a copy of all the Trigger Server (Theta) triggers.
GlobalPoint CMSPosition(const DTTrigData *trig) const
Coordinate of a trigger-data object in CMS frame.
void endJob() override
Close Tree and write File.
std::vector< DTSectCollPhSegm > SCPhTrigs() const
Return a copy of all the Sector Collector (Phi) triggers.
std::vector< DTTracoTrigData > TracoTrigs() const
Return a copy of all the TRACO triggers.
void beginJob() override
Create tree and Branches.
std::vector< DTSectCollThSegm > SCThTrigs() const
Return a copy of all the Sector Collector (Theta) triggers.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Abs< T >::type abs(const T &t)
static const double my_TtoTDC
void triggerReco(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Run the whole trigger reconstruction chain.
std::vector< DTChambPhSegm > TSPhTrigs() const
Return a copy of all the Trigger Server (Phi) triggers.
~DTTrigTest() override
Destructor.
GlobalVector CMSDirection(const DTTrigData *trig) const
Direction of a trigger-data object in CMS frame.
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup) override
Analyze function executed on all the events.
DTTrigTest(const edm::ParameterSet &pset)
Constructor.
void createTUs(const edm::EventSetup &iSetup)
Create the trigger units and store them in the cache.