39 #include <CLHEP/Vector/LorentzVector.h>
56 cout <<
"[DTTrigTest] Creating rootfile " << outputfile <<endl;
57 my_rootfile =
new TFile(outputfile.c_str(),
"RECREATE");
58 my_tree =
new TTree(
"h1",
"GMT",0);
60 if (
my_debug)
cout <<
"[DTTrigTest] Constructor executed!!!" << endl;
70 cout <<
"[DTTrigTest] Destructor executed!!!" << endl;
77 cout <<
"[DTTrigTest] Writing Tree and Closing File" << endl;
207 cout <<
"[DTTrigTest] TU's Created" << endl;
217 const float ptcut = 1.0;
218 const float etacut = 2.4;
221 cout <<
"[DTTrigTest] Trigger algorithm executed for run " << iEvent.
id().
run()
222 <<
" event " << iEvent.
id().
event() << endl;
234 vector<SimTrack>::const_iterator itrack;
237 cout <<
"[DTTrigTest] Tracks found in the detector (not only muons) " << MyTracks->size() <<endl;
239 for (itrack=MyTracks->begin(); itrack!=MyTracks->end(); itrack++){
240 if (
abs(itrack->type())==13){
242 float pt = momentum.Pt();
243 float eta = momentum.eta();
244 if ( pt>ptcut && fabs(eta)<etacut ){
245 float phi = momentum.phi();
246 int charge =
static_cast<int> (-itrack->type()/13);
247 if ( phi<0 ) phi = 2*
M_PI +
phi;
248 int vtxindex = itrack->vertIndex();
249 float gvx=0,gvy=0,gvz=0;
251 gvx=MyVertexes->at(vtxindex).position().x();
252 gvy=MyVertexes->at(vtxindex).position().y();
253 gvz=MyVertexes->at(vtxindex).position().z();
255 if (
ngen < MAXGEN ) {
275 vector<DTBtiTrigData>::const_iterator pbti;
278 cout <<
"[DTTrigTest] " << btitrigs.size() <<
" BTI triggers found" << endl;
280 for ( pbti = btitrigs.begin(); pbti != btitrigs.end(); pbti++ ) {
282 bwh[ibti]=pbti->wheel();
283 bstat[ibti]=pbti->station();
284 bsect[ibti]=pbti->sector();
285 bsl[ibti]=pbti->btiSL();
286 bnum[ibti]=pbti->btiNumber();
287 bbx[ibti]=pbti->step();
288 bcod[ibti]=pbti->code();
306 vector<DTTracoTrigData>::const_iterator ptc;
309 cout <<
"[DTTrigTest] " << tracotrigs.size() <<
" TRACO triggers found" << endl;
311 for (ptc=tracotrigs.begin(); ptc!=tracotrigs.end(); ptc++) {
313 twh[itraco]=ptc->wheel();
314 tstat[itraco]=ptc->station();
315 tsect[itraco]=ptc->sector();
316 tnum[itraco]=ptc->tracoNumber();
317 tbx[itraco]=ptc->step();
318 tcod[itraco]=ptc->code();
336 vector<DTChambPhSegm>::const_iterator ptsph;
339 cout <<
"[DTTrigTest] " << tsphtrigs.size() <<
" TSPhi triggers found" << endl;
341 for (ptsph=tsphtrigs.begin(); ptsph!=tsphtrigs.end(); ptsph++) {
343 swh[itsphi] = ptsph->wheel();
344 sstat[itsphi] = ptsph->station();
345 ssect[itsphi] = ptsph->sector();
346 sbx[itsphi] = ptsph->step();
347 scod[itsphi] = ptsph->oldCode();
348 sphi[itsphi] = ptsph->phi();
349 sphib[itsphi] = ptsph->phiB();
365 vector<DTChambThSegm>::const_iterator ptsth;
368 cout <<
"[DTTrigTest] " << tsthtrigs.size() <<
" TSTheta triggers found" << endl;
370 for (ptsth=tsthtrigs.begin(); ptsth!=tsthtrigs.end(); ptsth++) {
372 thwh[itstheta] = ptsth->ChamberId().wheel();
373 thstat[itstheta] = ptsth->ChamberId().station();
374 thsect[itstheta] = ptsth->ChamberId().sector();
375 thbx[itstheta] = ptsth->step();
376 for(
int i=0;
i<7;
i++) {
377 thcode[itstheta][
i] = ptsth->code(
i);
378 thpos[itstheta][
i] = ptsth->position(
i);
379 thqual[itstheta][
i] = ptsth->quality(
i);
388 vector<DTSectCollPhSegm>::const_iterator pscph;
391 cout <<
"[DTTrigTest] " << scphtrigs.size() <<
" SectCollPhi triggers found" << endl;
393 for (pscph=scphtrigs.begin(); pscph!=scphtrigs.end(); pscph++) {
396 scphwh[iscphi] = pscph->wheel();
397 scphstat[iscphi] = pscph->station();
399 scphbx[iscphi] = pscph->step();
400 scphcod[iscphi] = pscph->oldCode();
401 scphphi[iscphi] = pscph->phi();
418 vector<DTSectCollThSegm>::const_iterator pscth;
421 cout <<
"[DTTrigTest] " << scthtrigs.size() <<
" SectCollTheta triggers found" << endl;
423 for (pscth=scthtrigs.begin(); pscth!=scthtrigs.end(); pscth++) {
425 scthwh[isctheta] = pscth->ChamberId().wheel();
426 scthstat[isctheta] = pscth->ChamberId().station();
427 scthsect[isctheta] = pscth->ChamberId().sector();
428 scthbx[isctheta] = pscth->step();
429 for(
int i=0;
i<7;
i++) {
431 scthpos[isctheta][
i] = pscth->position(
i);
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet my_params
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
void analyze(const edm::Event &iEvent, const edm::EventSetup &iEventSetup)
Analyze function executed on all the events.
std::vector< DTSectCollPhSegm > SCPhTrigs()
Return a copy of all the Sector Collector (Phi) triggers.
Abs< T >::type abs(const T &t)
static const double my_TtoTDC
void beginRun(const edm::Run &iRun, const edm::EventSetup &iEventSetup)
Create DTTrig instance and TUs.
void triggerReco(const edm::Event &iEvent, const edm::EventSetup &iSetup)
Run the whole trigger reconstruction chain.
GlobalPoint CMSPosition(const DTTrigData *trig) const
Coordinate of a trigger-data object in CMS frame.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
GlobalVector CMSDirection(const DTTrigData *trig) const
Direction of a trigger-data object in CMS frame.
std::vector< DTChambThSegm > TSThTrigs()
Return a copy of all the Trigger Server (Theta) triggers.
std::vector< DTTracoTrigData > TracoTrigs()
Return a copy of all the TRACO triggers.
DTTrigTest(const edm::ParameterSet &pset)
Constructor.
void beginJob()
Create tree and Branches.
void createTUs(const edm::EventSetup &iSetup)
Create the trigger units and store them in the cache.
void endJob()
Close Tree and write File.
std::vector< DTBtiTrigData > BtiTrigs()
Return a copy of all the BTI triggers.
std::vector< DTSectCollThSegm > SCThTrigs()
Return a copy of all the Sector Collector (Theta) triggers.
std::vector< DTChambPhSegm > TSPhTrigs()
Return a copy of all the Trigger Server (Phi) triggers.