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;
69 cout <<
"[DTTrigTest] Destructor executed!!!" << endl;
76 cout <<
"[DTTrigTest] Writing Tree and Closing File" << endl;
206 cout <<
"[DTTrigTest] TU's Created" << endl;
216 const float ptcut = 1.0;
217 const float etacut = 2.4;
220 cout <<
"[DTTrigTest] Trigger algorithm executed for run " << iEvent.
id().
run()
221 <<
" event " << iEvent.
id().
event() << endl;
233 vector<SimTrack>::const_iterator itrack;
236 cout <<
"[DTTrigTest] Tracks found in the detector (not only muons) " << MyTracks->size() <<endl;
238 for (itrack=MyTracks->begin(); itrack!=MyTracks->end(); itrack++){
239 if (
abs(itrack->type())==13){
241 float pt = momentum.Pt();
242 float eta = momentum.eta();
243 if ( pt>ptcut && fabs(eta)<etacut ){
244 float phi = momentum.phi();
245 int charge =
static_cast<int> (-itrack->type()/13);
246 if ( phi<0 ) phi = 2*
M_PI +
phi;
247 int vtxindex = itrack->vertIndex();
248 float gvx=0,gvy=0,gvz=0;
250 gvx=MyVertexes->at(vtxindex).position().x();
251 gvy=MyVertexes->at(vtxindex).position().y();
252 gvz=MyVertexes->at(vtxindex).position().z();
254 if (
ngen < MAXGEN ) {
274 vector<DTBtiTrigData>::const_iterator pbti;
277 cout <<
"[DTTrigTest] " << btitrigs.size() <<
" BTI triggers found" << endl;
279 for ( pbti = btitrigs.begin(); pbti != btitrigs.end(); pbti++ ) {
281 bwh[ibti]=pbti->wheel();
282 bstat[ibti]=pbti->station();
283 bsect[ibti]=pbti->sector();
284 bsl[ibti]=pbti->btiSL();
285 bnum[ibti]=pbti->btiNumber();
286 bbx[ibti]=pbti->step();
287 bcod[ibti]=pbti->code();
305 vector<DTTracoTrigData>::const_iterator ptc;
308 cout <<
"[DTTrigTest] " << tracotrigs.size() <<
" TRACO triggers found" << endl;
310 for (ptc=tracotrigs.begin(); ptc!=tracotrigs.end(); ptc++) {
312 twh[itraco]=ptc->wheel();
313 tstat[itraco]=ptc->station();
314 tsect[itraco]=ptc->sector();
315 tnum[itraco]=ptc->tracoNumber();
316 tbx[itraco]=ptc->step();
317 tcod[itraco]=ptc->code();
335 vector<DTChambPhSegm>::const_iterator ptsph;
338 cout <<
"[DTTrigTest] " << tsphtrigs.size() <<
" TSPhi triggers found" << endl;
340 for (ptsph=tsphtrigs.begin(); ptsph!=tsphtrigs.end(); ptsph++) {
342 swh[itsphi] = ptsph->wheel();
343 sstat[itsphi] = ptsph->station();
344 ssect[itsphi] = ptsph->sector();
345 sbx[itsphi] = ptsph->step();
346 scod[itsphi] = ptsph->oldCode();
347 sphi[itsphi] = ptsph->phi();
348 sphib[itsphi] = ptsph->phiB();
364 vector<DTChambThSegm>::const_iterator ptsth;
367 cout <<
"[DTTrigTest] " << tsthtrigs.size() <<
" TSTheta triggers found" << endl;
369 for (ptsth=tsthtrigs.begin(); ptsth!=tsthtrigs.end(); ptsth++) {
371 thwh[itstheta] = ptsth->ChamberId().wheel();
372 thstat[itstheta] = ptsth->ChamberId().station();
373 thsect[itstheta] = ptsth->ChamberId().sector();
374 thbx[itstheta] = ptsth->step();
375 for(
int i=0;
i<7;
i++) {
376 thcode[itstheta][
i] = ptsth->code(
i);
377 thpos[itstheta][
i] = ptsth->position(
i);
378 thqual[itstheta][
i] = ptsth->quality(
i);
387 vector<DTSectCollPhSegm>::const_iterator pscph;
390 cout <<
"[DTTrigTest] " << scphtrigs.size() <<
" SectCollPhi triggers found" << endl;
392 for (pscph=scphtrigs.begin(); pscph!=scphtrigs.end(); pscph++) {
395 scphwh[iscphi] = pscph->wheel();
396 scphstat[iscphi] = pscph->station();
398 scphbx[iscphi] = pscph->step();
399 scphcod[iscphi] = pscph->oldCode();
400 scphphi[iscphi] = pscph->phi();
417 vector<DTSectCollThSegm>::const_iterator pscth;
420 cout <<
"[DTTrigTest] " << scthtrigs.size() <<
" SectCollTheta triggers found" << endl;
422 for (pscth=scthtrigs.begin(); pscth!=scthtrigs.end(); pscth++) {
424 scthwh[isctheta] = pscth->ChamberId().wheel();
425 scthstat[isctheta] = pscth->ChamberId().station();
426 scthsect[isctheta] = pscth->ChamberId().sector();
427 scthbx[isctheta] = pscth->step();
428 for(
int i=0;
i<7;
i++) {
430 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.
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 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.