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");
200 cout <<
"[DTTrigTest] TU's Created" << endl;
206 const float ptcut = 1.0;
207 const float etacut = 2.4;
210 cout <<
"[DTTrigTest] Trigger algorithm executed for run " <<
iEvent.id().run() <<
" event " <<
iEvent.id().event()
221 iEvent.getByLabel(
"g4SimHits", MyTracks);
222 iEvent.getByLabel(
"g4SimHits", MyVertexes);
223 vector<SimTrack>::const_iterator itrack;
226 cout <<
"[DTTrigTest] Tracks found in the detector (not only muons) " << MyTracks->size() << endl;
228 for (itrack = MyTracks->begin(); itrack != MyTracks->end(); itrack++) {
229 if (
abs(itrack->type()) == 13) {
231 float pt = momentum.Pt();
232 float eta = momentum.eta();
234 float phi = momentum.phi();
235 int charge = static_cast<int>(-itrack->type() / 13);
238 int vtxindex = itrack->vertIndex();
239 float gvx = 0, gvy = 0, gvz = 0;
241 gvx = MyVertexes->at(vtxindex).position().x();
242 gvy = MyVertexes->at(vtxindex).position().y();
243 gvz = MyVertexes->at(vtxindex).position().z();
265 vector<DTBtiTrigData>::const_iterator pbti;
268 cout <<
"[DTTrigTest] " << btitrigs.size() <<
" BTI triggers found" << endl;
270 for (pbti = btitrigs.begin(); pbti != btitrigs.end(); pbti++) {
272 bwh[ibti] = pbti->wheel();
273 bstat[ibti] = pbti->station();
274 bsect[ibti] = pbti->sector();
275 bsl[ibti] = pbti->btiSL();
276 bnum[ibti] = pbti->btiNumber();
277 bbx[ibti] = pbti->step();
278 bcod[ibti] = pbti->code();
279 bk[ibti] = pbti->K();
280 bx[ibti] = pbti->X();
296 vector<DTTracoTrigData>::const_iterator ptc;
299 cout <<
"[DTTrigTest] " << tracotrigs.size() <<
" TRACO triggers found" << endl;
301 for (ptc = tracotrigs.begin(); ptc != tracotrigs.end(); ptc++) {
303 twh[itraco] = ptc->wheel();
304 tstat[itraco] = ptc->station();
305 tsect[itraco] = ptc->sector();
306 tnum[itraco] = ptc->tracoNumber();
307 tbx[itraco] = ptc->step();
308 tcod[itraco] = ptc->code();
309 tk[itraco] = ptc->K();
310 tx[itraco] = ptc->X();
326 vector<DTChambPhSegm>::const_iterator ptsph;
329 cout <<
"[DTTrigTest] " << tsphtrigs.size() <<
" TSPhi triggers found" << endl;
331 for (ptsph = tsphtrigs.begin(); ptsph != tsphtrigs.end(); ptsph++) {
333 swh[itsphi] = ptsph->wheel();
334 sstat[itsphi] = ptsph->station();
335 ssect[itsphi] = ptsph->sector();
336 sbx[itsphi] = ptsph->step();
337 scod[itsphi] = ptsph->oldCode();
338 sphi[itsphi] = ptsph->phi();
339 sphib[itsphi] = ptsph->phiB();
355 vector<DTChambThSegm>::const_iterator ptsth;
358 cout <<
"[DTTrigTest] " << tsthtrigs.size() <<
" TSTheta triggers found" << endl;
360 for (ptsth = tsthtrigs.begin(); ptsth != tsthtrigs.end(); ptsth++) {
362 thwh[itstheta] = ptsth->ChamberId().wheel();
363 thstat[itstheta] = ptsth->ChamberId().station();
364 thsect[itstheta] = ptsth->ChamberId().sector();
365 thbx[itstheta] = ptsth->step();
366 for (
int i = 0;
i < 7;
i++) {
367 thcode[itstheta][
i] = ptsth->code(
i);
368 thpos[itstheta][
i] = ptsth->position(
i);
369 thqual[itstheta][
i] = ptsth->quality(
i);
378 vector<DTSectCollPhSegm>::const_iterator pscph;
381 cout <<
"[DTTrigTest] " << scphtrigs.size() <<
" SectCollPhi triggers found" << endl;
383 for (pscph = scphtrigs.begin(); pscph != scphtrigs.end(); pscph++) {
386 scphwh[iscphi] = pscph->wheel();
387 scphstat[iscphi] = pscph->station();
389 scphbx[iscphi] = pscph->step();
390 scphcod[iscphi] = pscph->oldCode();
391 scphphi[iscphi] = pscph->phi();
408 vector<DTSectCollThSegm>::const_iterator pscth;
411 cout <<
"[DTTrigTest] " << scthtrigs.size() <<
" SectCollTheta triggers found" << endl;
413 for (pscth = scthtrigs.begin(); pscth != scthtrigs.end(); pscth++) {
415 scthwh[isctheta] = pscth->ChamberId().wheel();
416 scthstat[isctheta] = pscth->ChamberId().station();
417 scthsect[isctheta] = pscth->ChamberId().sector();
418 scthbx[isctheta] = pscth->step();
419 for (
int i = 0;
i < 7;
i++) {
421 scthpos[isctheta][
i] = pscth->position(
i);