CMS 3D CMS Logo

Public Member Functions | Private Attributes

DTTrigProd Class Reference

#include <DTTrigProd.h>

Inheritance diagram for DTTrigProd:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginRun (edm::Run &iRun, const edm::EventSetup &iEventSetup)
 Create Trigger Units before starting event processing.
 DTTrigProd (const edm::ParameterSet &pset)
 Constructor.
void produce (edm::Event &iEvent, const edm::EventSetup &iEventSetup)
 Producer: process every event and generates trigger data.
 ~DTTrigProd ()
 Destructor.

Private Attributes

int my_BXoffset
bool my_CCBValid
bool my_debug
bool my_DTTFnum
short int my_lut_btic
bool my_lut_dump_flag
edm::ParameterSet my_params
DTTrigmy_trig

Detailed Description

Main EDProducer for the DTTPG

Date:
2011/03/28 13:47:50
Revision:
1.8
Author:
C. Battilana

Main EDProducer for the DTTPG

Date:
2011/05/16 16:23:03
Revision:
1.19
Author:
C. Battilana

Definition at line 29 of file DTTrigProd.h.


Constructor & Destructor Documentation

DTTrigProd::DTTrigProd ( const edm::ParameterSet pset)

Constructor.

Definition at line 47 of file DTTrigProd.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), my_debug, my_DTTFnum, my_lut_btic, my_lut_dump_flag, and my_params.

                                               : my_trig(0) {
  
  produces<L1MuDTChambPhContainer>();
  produces<L1MuDTChambThContainer>();

  my_debug = pset.getUntrackedParameter<bool>("debug");
  my_DTTFnum = pset.getParameter<bool>("DTTFSectorNumbering");
  my_params = pset;

  my_lut_dump_flag = pset.getUntrackedParameter<bool>("lutDumpFlag");
  my_lut_btic = pset.getUntrackedParameter<int>("lutBtic");

}
DTTrigProd::~DTTrigProd ( )

Destructor.

Definition at line 61 of file DTTrigProd.cc.

References my_trig.

                       {

  if (my_trig) delete my_trig;

}

Member Function Documentation

void DTTrigProd::beginRun ( edm::Run iRun,
const edm::EventSetup iEventSetup 
) [virtual]

Create Trigger Units before starting event processing.

Reimplemented from edm::EDProducer.

Definition at line 67 of file DTTrigProd.cc.

References gather_cfg::cout, DTTrig::createTUs(), DTTrig::dumpLuts(), edm::EventSetup::get(), edm::RunBase::id(), my_CCBValid, my_debug, my_lut_btic, my_lut_dump_flag, my_params, my_trig, edm::ESHandle< T >::product(), and edm::RunID::run().

                                                                        {

  if(my_debug)
    cout << "DTTrigProd::beginRun  " << iRun.id().run() << endl;
  
  ESHandle< DTConfigManager > dtConfig ;
  iEventSetup.get< DTConfigManagerRcd >().get( dtConfig ) ;

  my_CCBValid = dtConfig->CCBConfigValidity();

  if (!my_trig) {
    my_trig = new DTTrig(my_params);
    my_trig->createTUs(iEventSetup);
    if (my_debug)
      cout << "[DTTrigProd] TU's Created" << endl;
    
    if(my_lut_dump_flag) {
      cout << "Dumping luts...." << endl;
      my_trig->dumpLuts(my_lut_btic, dtConfig.product());
    }   
  }


  
}
void DTTrigProd::produce ( edm::Event iEvent,
const edm::EventSetup iEventSetup 
) [virtual]

Producer: process every event and generates trigger data.

Implements edm::EDProducer.

Definition at line 94 of file DTTrigProd.cc.

References gather_cfg::cout, DTTrig::getBXOffset(), i, edm::EventBase::id(), my_BXoffset, my_CCBValid, my_debug, my_DTTFnum, my_trig, pos, edm::Event::put(), DTTrig::SCPhTrigs(), DTTrig::SCThTrigs(), launcher::step, and DTTrig::triggerReco().

                                                                     {

  vector<L1MuDTChambPhDigi> outPhi;
  vector<L1MuDTChambThDigi> outTheta;

  // SV check if CCB configuration is valid, otherwise just produce empty collections
  if(!my_CCBValid)  {
    if (my_debug)
      cout << "[DTTrigProd] CCB configuration is not valid for this run, empty collection will be produced " << endl;
  }  else  {
    my_trig->triggerReco(iEvent,iEventSetup);
    my_BXoffset = my_trig->getBXOffset();
  
    if (my_debug)
      cout << "[DTTrigProd] Trigger algorithm run for " <<iEvent.id() << endl;
  
    // Convert Phi Segments
    SectCollPhiColl myPhiSegments;
    myPhiSegments = my_trig->SCPhTrigs();

    SectCollPhiColl_iterator SCPCend = myPhiSegments.end();
    for (SectCollPhiColl_iterator it=myPhiSegments.begin();it!=SCPCend;++it){
      int step = (*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
      int sc_sector = (*it).SCId().sector();
      if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
        outPhi.push_back(L1MuDTChambPhDigi(step,
                                       (*it).ChamberId().wheel(),
                                       sc_sector,
                                       (*it).ChamberId().station(),
                                       (*it).phi(),
                                       (*it).phiB(),
                                       (*it).code(),
                                       !(*it).isFirst(),
                                       0
                                       ));
    }

    // Convert Theta Segments
    SectCollThetaColl myThetaSegments;
    myThetaSegments = my_trig->SCThTrigs();
  
    SectCollThetaColl_iterator SCTCend = myThetaSegments.end();
    for (SectCollThetaColl_iterator it=myThetaSegments.begin();it!=SCTCend;++it){
      int pos[7], qual[7];
      for (int i=0; i<7; i++){
        pos[i] =(*it).position(i);
        qual[i]=(*it).quality(i);
      }
      int step =(*it).step() - my_BXoffset; // Shift correct BX to 0 (needed for DTTF data processing)
      int sc_sector =  (*it).SCId().sector();
      if (my_DTTFnum == true) sc_sector--; // Modified for DTTF numbering [0-11]
      outTheta.push_back(L1MuDTChambThDigi( step,
                                         (*it).ChamberId().wheel(),
                                         sc_sector,
                                         (*it).ChamberId().station(),
                                         pos,
                                         qual
                                         ));
    }
  }

  // Write everything into the event (CB write empty collection as default actions if emulator does not run)
  std::auto_ptr<L1MuDTChambPhContainer> resultPhi (new L1MuDTChambPhContainer);
  resultPhi->setContainer(outPhi);
  iEvent.put(resultPhi);
  std::auto_ptr<L1MuDTChambThContainer> resultTheta (new L1MuDTChambThContainer);
  resultTheta->setContainer(outTheta);
  iEvent.put(resultTheta);

}

Member Data Documentation

int DTTrigProd::my_BXoffset [private]

Definition at line 57 of file DTTrigProd.h.

Referenced by produce().

bool DTTrigProd::my_CCBValid [private]

Definition at line 51 of file DTTrigProd.h.

Referenced by beginRun(), and produce().

bool DTTrigProd::my_debug [private]

Definition at line 60 of file DTTrigProd.h.

Referenced by beginRun(), DTTrigProd(), and produce().

bool DTTrigProd::my_DTTFnum [private]

Definition at line 54 of file DTTrigProd.h.

Referenced by DTTrigProd(), and produce().

short int DTTrigProd::my_lut_btic [private]

Definition at line 64 of file DTTrigProd.h.

Referenced by beginRun(), and DTTrigProd().

Definition at line 63 of file DTTrigProd.h.

Referenced by beginRun(), and DTTrigProd().

Definition at line 67 of file DTTrigProd.h.

Referenced by beginRun(), and DTTrigProd().

Definition at line 48 of file DTTrigProd.h.

Referenced by beginRun(), produce(), and ~DTTrigProd().