CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

DTTrig Class Reference

#include <DTTrig.h>

List of all members.

Public Types

typedef std::map< DTChamberId,
DTDigiCollection, std::less
< DTChamberId > > 
DTDigiMap
typedef DTDigiMap::const_iterator DTDigiMap_const_iterator
typedef DTDigiMap::iterator DTDigiMap_iterator
typedef std::pair< TU_iterator,
TU_iterator
Range
typedef SCcontainer::const_iterator SC_const_iterator
typedef SCcontainer::iterator SC_iterator
typedef std::map< DTSectCollId,
DTSectColl *, std::less
< DTSectCollId > > 
SCcontainer
typedef std::pair< SC_iterator,
SC_iterator
SCRange
typedef TUcontainer::const_iterator TU_const_iterator
typedef TUcontainer::iterator TU_iterator
typedef std::map< DTChamberId,
DTSCTrigUnit *, std::less
< DTChamberId > > 
TUcontainer

Public Member Functions

TU_iterator begin ()
 Begin of the trigger units store.
SC_iterator begin1 ()
 Begin of the sector collector store.
std::vector< DTBtiTrigDataBtiTrigs ()
 Return a copy of all the BTI triggers.
Range cache ()
 Begin of the trigger units store.
SCRange cache1 ()
 Range of the sector collector store.
DTChambPhSegmchPhiSegm1 (DTChamberId sid, int step)
 Return the first phi track segment in req. chamber/step.
DTChambPhSegmchPhiSegm1 (DTSCTrigUnit *unit, int step)
 Return the first phi track segment in req. chamber/step.
DTChambPhSegmchPhiSegm1 (int wheel, int stat, int sect, int step)
 Return the first phi track segment in req. chamber/step, MTTF numbering.
DTChambPhSegmchPhiSegm2 (DTChamberId sid, int step)
 Return the second phi track segment in req. chamber/step.
DTChambPhSegmchPhiSegm2 (DTSCTrigUnit *unit, int step)
 Return the second phi track segment in req. chamber/step.
DTChambPhSegmchPhiSegm2 (int wheel, int stat, int sect, int step)
 Return the second phi track segment in req. chamber/step, MTTF numbering.
DTSectCollPhSegmchSectCollPhSegm1 (DTSectColl *unit, int step)
 Return the first phi track segment in req. chamber/step [SC step].
DTSectCollPhSegmchSectCollPhSegm1 (int wheel, int sect, int step)
 Return the first phi track segment in req. chamber/step, [MTTF numbering & SC step].
DTSectCollPhSegmchSectCollPhSegm2 (DTSectColl *unit, int step)
 Return the second phi track segment in req. chamber/step [SC step].
DTSectCollPhSegmchSectCollPhSegm2 (int wheel, int sect, int step)
 Return the second phi track segment in req. chamber/step, [MTTF numbering & SC step].
DTSectCollThSegmchSectCollThSegm (DTSectColl *unit, int step)
 Return the theta track segment in req. chamber/step [SC step].
DTSectCollThSegmchSectCollThSegm (int wheel, int sect, int step)
 Return the theta track segment in req. chamber/step, [MTTF numbering & SC step].
DTChambThSegmchThetaSegm (DTChamberId sid, int step)
 Return the theta candidates in req. chamber/step.
DTChambThSegmchThetaSegm (DTSCTrigUnit *unit, int step)
 Return the theta candidates in req. chamber/step.
DTChambThSegmchThetaSegm (int wheel, int stat, int sect, int step)
 Return the theta candidates in req. chamber/step, MTTF numbering.
void clear ()
 Clear the trigger units cache.
GlobalVector CMSDirection (const DTTrigData *trig) const
 Direction of a trigger-data object in CMS frame.
GlobalPoint CMSPosition (const DTTrigData *trig) const
 Coordinate of a trigger-data object in CMS frame.
void createTUs (const edm::EventSetup &iSetup)
 Create the trigger units and store them in the cache.
 DTTrig (const edm::ParameterSet &params)
 Constructors.
void dumpGeom ()
 Dump the geometry.
void dumpLuts (short int lut_btic, const DTConfigManager *conf)
 Dump the LUT files.
TU_iterator end ()
 End of the trigger units store.
SC_iterator end1 ()
 End of the sectoor collector store.
TU_iterator find (DTChamberId id)
 Find a trigger unit in the map.
SC_iterator find1 (DTSectCollId id)
 Find a Sector Collector in the map.
int getBXOffset ()
 Get BX Offset.
LocalVector localDirection (const DTTrigData *trig) const
 Direction of a trigger-data object in chamber frame.
LocalPoint localPosition (const DTTrigData *trig) const
 Coordinate of a trigger-data object in chamber frame.
void print (DTTrigData *trig) const
 Print a trigger-data object.
std::vector< DTSectCollPhSegmSCPhTrigs ()
 Return a copy of all the Sector Collector (Phi) triggers.
std::vector< DTSectCollThSegmSCThTrigs ()
 Return a copy of all the Sector Collector (Theta) triggers.
int size ()
 Size of the trigger units store.
int size1 ()
 Size of the sector collector store.
std::vector< DTTracoTrigDataTracoTrigs ()
 Return a copy of all the TRACO triggers.
void triggerReco (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 Run the whole trigger reconstruction chain.
DTSCTrigUnittrigUnit (DTChamberId sid)
 Return a trigger unit - Muon numbering.
DTSCTrigUnittrigUnit (int wheel, int stat, int sect)
 Return a trigger unit - Muon numbering, MTTF numbering.
std::vector< DTChambPhSegmTSPhTrigs ()
 Return a copy of all the Trigger Server (Phi) triggers.
std::vector< DTChambThSegmTSThTrigs ()
 Return a copy of all the Trigger Server (Theta) triggers.
void updateES (const edm::EventSetup &iSetup)
 update the eventsetup info
 ~DTTrig ()
 Destructor.

Private Member Functions

DTSCTrigUnitconstTrigUnit (DTChamberId sid) const
 Return a trigger unit - Muon numbering - const version.
DTSCTrigUnitconstTrigUnit (int wheel, int stat, int sect) const
 Return a trigger unit - Muon numbering, MTTF numbering - const version.
DTSectCollSCUnit (DTSectCollId scid) const
 Return a SC unit - Muon numbering - const version.
DTSectCollSCUnit (int wheel, int sect) const
 Return a SC Unit Muon Numbering, MTTF numbering - const version.

Private Attributes

TUcontainer _cache
SCcontainer _cache1
const DTConfigManager_conf_manager
unsigned long long _configid
bool _debug
DTTTrigBaseSync_digi_sync
edm::InputTag _digitag
unsigned long long _geomid
bool _inputexist
unsigned long long _t0id
unsigned long long _ttrigid
bool _usesyncdb

Detailed Description

Steering routine for L1 trigger simulation in a muon barrel station

Date:
2009/11/12 14:33:26
Revision:
1.13
Author:
C.Grandi

Definition at line 54 of file DTTrig.h.


Member Typedef Documentation

Definition at line 66 of file DTTrig.h.

typedef DTDigiMap::const_iterator DTTrig::DTDigiMap_const_iterator

Definition at line 68 of file DTTrig.h.

typedef DTDigiMap::iterator DTTrig::DTDigiMap_iterator

Definition at line 67 of file DTTrig.h.

Definition at line 64 of file DTTrig.h.

typedef SCcontainer::const_iterator DTTrig::SC_const_iterator

Definition at line 63 of file DTTrig.h.

typedef SCcontainer::iterator DTTrig::SC_iterator

Definition at line 62 of file DTTrig.h.

typedef std::map< DTSectCollId,DTSectColl*,std::less<DTSectCollId> > DTTrig::SCcontainer

Definition at line 61 of file DTTrig.h.

Definition at line 65 of file DTTrig.h.

typedef TUcontainer::const_iterator DTTrig::TU_const_iterator

Definition at line 60 of file DTTrig.h.

typedef TUcontainer::iterator DTTrig::TU_iterator

Definition at line 59 of file DTTrig.h.

typedef std::map< DTChamberId,DTSCTrigUnit*,std::less<DTChamberId> > DTTrig::TUcontainer

Definition at line 58 of file DTTrig.h.


Constructor & Destructor Documentation

DTTrig::DTTrig ( const edm::ParameterSet params)

Constructors.

Definition at line 56 of file DTTrig.cc.

References _debug, _digi_sync, _digitag, _usesyncdb, gather_cfg::cout, reco::get(), edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

                                             :
 _inputexist(1) ,  _configid(0) , _geomid(0) , _t0id(0) , _ttrigid(0) {

  // Set configuration parameters
  // _debug = _conf_manager->getDTTPGDebug();
  _debug = params.getUntrackedParameter<bool>("debug"); // CB FIXME: update when debug will be fully configured from parameter set

  if(_debug){
    std::cout << std::endl;
    std::cout << "**** Initialization of DTTrigger ****" << std::endl;
    std::cout << std::endl;
    std::cout << "DTTrig::DTTrig creating synchronizer" << std::endl;
  }

  _digitag   = params.getParameter<edm::InputTag>("digiTag");
  _digi_sync = DTTTrigSyncFactory::get()->create(params.getParameter<std::string>("tTrigMode"),
                                              params.getParameter<edm::ParameterSet>("tTrigModeConfig"));
  _usesyncdb = params.getParameter<std::string>("tTrigMode")!="DTTTrigSyncTOFCorr";
}
DTTrig::~DTTrig ( )

Destructor.

Definition at line 80 of file DTTrig.cc.

References _digi_sync, and clear().

               {

  clear();
  delete _digi_sync; //CB check if it is really needed

}

Member Function Documentation

TU_iterator DTTrig::begin ( void  ) [inline]

Begin of the trigger units store.

Definition at line 94 of file DTTrig.h.

References _cache.

{ /*check();*/ return _cache.begin(); }
SC_iterator DTTrig::begin1 ( ) [inline]

Begin of the sector collector store.

Definition at line 111 of file DTTrig.h.

References _cache1.

{ /*check();*/ return _cache1.begin(); }
std::vector< DTBtiTrigData > DTTrig::BtiTrigs ( )

Return a copy of all the BTI triggers.

Definition at line 570 of file DTTrig.cc.

References _cache, DTCache< T, Coll >::begin(), DTSCTrigUnit::BtiTrigs(), DTCache< T, Coll >::end(), and L1TEmulatorMonitor_cff::p.

Referenced by DTTrigTest::analyze().

                 {
  /*check();*/
  std::vector<DTBtiTrigData> trigs;
  TU_iterator ptu;
  for(ptu=_cache.begin();ptu!=_cache.end();ptu++) {
    DTSCTrigUnit* tu = (*ptu).second;
    std::vector<DTBtiTrigData>::const_iterator p; //p=0;
    std::vector<DTBtiTrigData>::const_iterator peb=tu->BtiTrigs()->end();
    for(p=tu->BtiTrigs()->begin();p!=peb;p++){
      trigs.push_back(*p);
    }
  }
  return trigs;
}
Range DTTrig::cache ( ) [inline]

Begin of the trigger units store.

Definition at line 103 of file DTTrig.h.

References _cache.

{ /*check();*/ return Range(_cache.begin(), _cache.end()); }
SCRange DTTrig::cache1 ( ) [inline]

Range of the sector collector store.

Definition at line 120 of file DTTrig.h.

References _cache1.

{ /*check();*/ return SCRange(_cache1.begin(), _cache1.end()); }
DTChambPhSegm * DTTrig::chPhiSegm1 ( DTChamberId  sid,
int  step 
)

Return the first phi track segment in req. chamber/step.

Definition at line 451 of file DTTrig.cc.

References trigUnit().

Referenced by chPhiSegm1().

                                            {
  return chPhiSegm1(trigUnit(sid),step);
}
DTChambPhSegm * DTTrig::chPhiSegm1 ( DTSCTrigUnit unit,
int  step 
)

Return the first phi track segment in req. chamber/step.

Definition at line 430 of file DTTrig.cc.

References DTSCTrigUnit::nPhiSegm(), and DTSCTrigUnit::phiSegment().

                                               {
  if(unit==0)return 0;
  if(unit->nPhiSegm(step)<1)return 0;
  return const_cast<DTChambPhSegm*>(unit->phiSegment(step,1));
}
DTChambPhSegm * DTTrig::chPhiSegm1 ( int  wheel,
int  stat,
int  sect,
int  step 
)

Return the first phi track segment in req. chamber/step, MTTF numbering.

Definition at line 467 of file DTTrig.cc.

References chPhiSegm1(), and trigUnit().

                                                          {
   return chPhiSegm1(trigUnit(wheel,stat,sect),step);
  // to make it transparent to the outside world
  //  return chSectCollSegm1(wheel,stat,sect,step);

}
DTChambPhSegm * DTTrig::chPhiSegm2 ( DTChamberId  sid,
int  step 
)

Return the second phi track segment in req. chamber/step.

Definition at line 456 of file DTTrig.cc.

References trigUnit().

Referenced by chPhiSegm2().

                                            {
  return chPhiSegm2(trigUnit(sid),step);
}
DTChambPhSegm * DTTrig::chPhiSegm2 ( DTSCTrigUnit unit,
int  step 
)

Return the second phi track segment in req. chamber/step.

Definition at line 437 of file DTTrig.cc.

References DTSCTrigUnit::nPhiSegm(), and DTSCTrigUnit::phiSegment().

                                               {
  if(unit==0)return 0;
  if(unit->nPhiSegm(step)<2)return 0;
  return const_cast<DTChambPhSegm*>(unit->phiSegment(step,2));
}
DTChambPhSegm * DTTrig::chPhiSegm2 ( int  wheel,
int  stat,
int  sect,
int  step 
)

Return the second phi track segment in req. chamber/step, MTTF numbering.

Definition at line 475 of file DTTrig.cc.

References chPhiSegm2(), and trigUnit().

                                                          {
  //  if(stat==4&&(sect==3||sect==9)) {
  // if hrizontal chambers of MB4 get first track of twin chamber (flag=1)
  //   return chPhiSegm1(trigUnit(wheel,stat,sect,1),step);
  //  } else {
    return chPhiSegm2(trigUnit(wheel,stat,sect),step);
  // to make it transparent to the outside world
  // return chSectCollSegm2(wheel,stat,sect,step);
  //}
}
DTSectCollPhSegm * DTTrig::chSectCollPhSegm1 ( DTSectColl unit,
int  step 
)

Return the first phi track segment in req. chamber/step [SC step].

Definition at line 494 of file DTTrig.cc.

References DTSectColl::nSegmPh(), and DTSectColl::SectCollPhSegment().

Referenced by chSectCollPhSegm1().

                                                    {

  if(unit==0)return 0;
   if(unit->nSegmPh(step)<1)return 0;
   return const_cast<DTSectCollPhSegm*>(unit->SectCollPhSegment(step,1));
}
DTSectCollPhSegm * DTTrig::chSectCollPhSegm1 ( int  wheel,
int  sect,
int  step 
)

Return the first phi track segment in req. chamber/step, [MTTF numbering & SC step].

Definition at line 510 of file DTTrig.cc.

References chSectCollPhSegm1(), and SCUnit().

                                                       {

  return chSectCollPhSegm1(SCUnit(wheel,sect),step);
}
DTSectCollPhSegm * DTTrig::chSectCollPhSegm2 ( DTSectColl unit,
int  step 
)

Return the second phi track segment in req. chamber/step [SC step].

Definition at line 502 of file DTTrig.cc.

References DTSectColl::nSegmPh(), and DTSectColl::SectCollPhSegment().

Referenced by chSectCollPhSegm2().

                                                    {
  if(unit==0)return 0;
    if(unit->nSegmPh(step)<2)return 0;
  return const_cast<DTSectCollPhSegm*>(unit->SectCollPhSegment(step,2));
}
DTSectCollPhSegm * DTTrig::chSectCollPhSegm2 ( int  wheel,
int  sect,
int  step 
)

Return the second phi track segment in req. chamber/step, [MTTF numbering & SC step].

Definition at line 516 of file DTTrig.cc.

References chSectCollPhSegm2(), and SCUnit().

                                                       {
  //  if(stat==4&&(sect==3||sect==9)) {
    // if hrizontal chambers of MB4 get first track of twin chamber (flag=1)
  //return chSectCollSegm1(trigUnit(wheel,stat,sect,1),step);
  //} else {
    return chSectCollPhSegm2(SCUnit(wheel,sect),step);
    //}
}
DTSectCollThSegm * DTTrig::chSectCollThSegm ( DTSectColl unit,
int  step 
)

Return the theta track segment in req. chamber/step [SC step].

Definition at line 526 of file DTTrig.cc.

References DTSectColl::nSegmTh(), and DTSectColl::SectCollThSegment().

Referenced by chSectCollThSegm().

                                                   {

  if(unit==0)return 0;
   if(unit->nSegmTh(step)<1)return 0;
  return const_cast<DTSectCollThSegm*>(unit->SectCollThSegment(step));
}
DTSectCollThSegm * DTTrig::chSectCollThSegm ( int  wheel,
int  sect,
int  step 
)

Return the theta track segment in req. chamber/step, [MTTF numbering & SC step].

Definition at line 534 of file DTTrig.cc.

References chSectCollThSegm(), and SCUnit().

                                                      {

  return chSectCollThSegm(SCUnit(wheel,sect),step);
}
DTChambThSegm * DTTrig::chThetaSegm ( DTChamberId  sid,
int  step 
)

Return the theta candidates in req. chamber/step.

Definition at line 461 of file DTTrig.cc.

References DTChamberId::station(), and trigUnit().

Referenced by chThetaSegm().

                                             {
  if(sid.station()==4)return 0;
  return chThetaSegm(trigUnit(sid),step);
}
DTChambThSegm * DTTrig::chThetaSegm ( int  wheel,
int  stat,
int  sect,
int  step 
)

Return the theta candidates in req. chamber/step, MTTF numbering.

Definition at line 487 of file DTTrig.cc.

References chThetaSegm(), and trigUnit().

                                                           {
  if(stat==4)return 0;
  return chThetaSegm(trigUnit(wheel,stat,sect),step);
}
DTChambThSegm * DTTrig::chThetaSegm ( DTSCTrigUnit unit,
int  step 
)

Return the theta candidates in req. chamber/step.

Definition at line 444 of file DTTrig.cc.

References DTSCTrigUnit::nThetaSegm(), and DTSCTrigUnit::thetaSegment().

                                                {
  if(unit==0)return 0;
  if(unit->nThetaSegm(step)<1)return 0;
  return const_cast<DTChambThSegm*>(unit->thetaSegment(step,1));
}
void DTTrig::clear ( void  )

Clear the trigger units cache.

Definition at line 355 of file DTTrig.cc.

References _cache, and _cache1.

Referenced by ~DTTrig().

              {
  // Delete the map
  for (TU_iterator it=_cache.begin();it!=_cache.end();it++){
    // Delete all the trigger units 
    delete (*it).second;
  }
  _cache.clear(); 

  for (SC_iterator it=_cache1.begin();it!=_cache1.end();it++){
    // Delete all the Sector Collectors
    delete (*it).second;
  }
  _cache1.clear();

}
GlobalVector DTTrig::CMSDirection ( const DTTrigData trig) const [inline]

Direction of a trigger-data object in CMS frame.

Definition at line 222 of file DTTrig.h.

References DTTrigData::ChamberId(), and constTrigUnit().

Referenced by DTTrigTest::analyze().

                                                            {
      return constTrigUnit(trig->ChamberId())->CMSDirection(trig);
    }
GlobalPoint DTTrig::CMSPosition ( const DTTrigData trig) const [inline]

Coordinate of a trigger-data object in CMS frame.

Definition at line 212 of file DTTrig.h.

References DTTrigData::ChamberId(), and constTrigUnit().

Referenced by DTTrigTest::analyze().

                                                          {
      return constTrigUnit(trig->ChamberId())->CMSPosition(trig);
    }
DTSCTrigUnit * DTTrig::constTrigUnit ( int  wheel,
int  stat,
int  sect 
) const [private]

Return a trigger unit - Muon numbering, MTTF numbering - const version.

Definition at line 422 of file DTTrig.cc.

References constTrigUnit(), and DTChamberId.

                                                         {
  sect++;   // offset 1 for sector number ([0,11] --> [1,12])
  return constTrigUnit(DTChamberId(wheel,stat,sect));

}
DTSCTrigUnit * DTTrig::constTrigUnit ( DTChamberId  sid) const [private]

Return a trigger unit - Muon numbering - const version.

Definition at line 380 of file DTTrig.cc.

References _cache, gather_cfg::cout, DTChamberId::sector(), DTChamberId::station(), and DTChamberId::wheel().

Referenced by CMSDirection(), CMSPosition(), constTrigUnit(), localDirection(), localPosition(), print(), and trigUnit().

                                            {
//    std::cout << " SC: running DTTrig::constTrigUnit(DTChamberId chid)" << std::endl;
  TU_const_iterator it = _cache.find(chid);
  if ( it == _cache.end()) {
    std::cout << "DTTrig::trigUnit: Trigger Unit not in the map: ";
    std::cout << " wheel=" << chid.wheel() ;
    std::cout << ", station=" << chid.station();
    std::cout << ", sector=" << chid.sector();
    std::cout << std::endl;
    return 0;
  }

  return (*it).second;
}
void DTTrig::createTUs ( const edm::EventSetup iSetup)

Create the trigger units and store them in the cache.

Definition at line 88 of file DTTrig.cc.

References _cache, _cache1, _debug, _digi_sync, DTSectColl::addTU(), gather_cfg::cout, edm::EventSetup::get(), DTChamber::id(), DTChamberId::sector(), DTSectCollId::sector(), DTSectCollId::wheel(), and DTChamberId::wheel().

Referenced by DTTrigProd::beginRun(), and DTTrigTest::beginRun().

                                             {
  
  // build up Sector Collectors and then
  // build the trrigger units (one for each chamber)
  for(int iwh=-2;iwh<=2;iwh++){ 
    for(int ise=1;ise<=12;ise++){ 
      if(_debug){
        std::cout << "calling sectcollid wh sc " << iwh <<  " " << ise << std::endl;}
      DTSectCollId scid(iwh,ise);
      SC_iterator it =  _cache1.find(scid);
      if ( it != _cache1.end()) {
        std::cout << "DTTrig::createTUs: Sector Collector unit already exists"<<std::endl;
        continue;
      }    
      // add a sector collector to the map
      // SCConf_iterator scit = _scconf.find(scid);
      //edm::ParameterSet sc_pset = _conf_pset.getParameter<edm::ParameterSet>("SectCollParameters");
      DTSectColl* sc;
      //sc = new DTSectColl(sc_pset);
      sc = new DTSectColl(scid);

      //  if ( scit != _scconf.end()){
      //        sc = new DTSectColl( (*scit).second);
      //       }
      //       else {
      //        std::cout << "DTTrig::createTUs: SC config file does not exist. Using default one";
      //        sc = new DTSectColl(config());
      //       }
      if(_debug){
        std::cout << " DTTrig::createTUs new SC sc = " << sc  
                  << " at scid.sector() " << scid.sector() 
                  << " at scid.wheel() " << scid.wheel()   
                  << std::endl;
      }
      _cache1[scid] = sc;  
    }
  }
  
  edm::ESHandle<DTGeometry>pDD;
  iSetup.get<MuonGeometryRecord>().get(pDD);
  for (std::vector<DTChamber*>::const_iterator ich=pDD->chambers().begin(); ich!=pDD->chambers().end();ich++){
       
    DTChamber* chamb = (*ich);
    DTChamberId chid = chamb->id();
    TU_iterator it = _cache.find(chid);
    if ( it != _cache.end()) {
      std::cout << "DTTrig::init: Trigger unit already exists" << std::endl;
      continue;
    }    
    //    Conf_iterator cit = _truconf.find(chid);
    //       if ( cit == _truconf.end()) {
    //  std::cout << "DTTrig::init: Local Config File not found using default config" << std::endl;
    //  DTSCTrigUnit* tru = new DTSCTrigUnit(chamb,config());
    //  _cache[chid] = tru;
    //  continue;
    //       }

    // add a trigger unit to the map with a link to the station
    //edm::ParameterSet tu_pset = _conf_pset.getParameter<edm::ParameterSet>("TUParameters");
    //DTSCTrigUnit* tru = new DTSCTrigUnit(chamb,tu_pset);
    DTSCTrigUnit* tru = new DTSCTrigUnit(chamb,_digi_sync);
    _cache[chid] = tru;
    
    //----------- add TU to corresponding SC
    // returning correspondent SC id
    DTSectCollId scid;
    if(chid.sector()==13) { 
      scid = DTSectCollId(chid.wheel(), 4);}
    else if(chid.sector()==14)  {
      scid = DTSectCollId(chid.wheel(), 10);}
    else  { 
      scid = DTSectCollId(chid.wheel(), chid.sector() );}
    
    SC_iterator it1 =  _cache1.find(scid);
    
    if ( it1 != _cache1.end()) {
      
      DTSectColl* sc = (*it1).second;
      if(_debug) {
        std::cout << "DTTrig::init:  adding TU in SC << " 
                  << " sector = " << scid.sector() 
                  << " wheel = " << scid.wheel() 
                  << std::endl;}
      sc->addTU(tru);    
    }
    else {
      std::cout << "DTTrig::createTUs: Trigger Unit not in the map: ";
    }
    
  }

}
void DTTrig::dumpGeom ( )

Dump the geometry.

Definition at line 543 of file DTTrig.cc.

References _cache.

                 {
  /*check();*/
  for (TU_const_iterator it=_cache.begin();it!=_cache.end();it++){
    ((*it).second)->dumpGeom();
  }
}
void DTTrig::dumpLuts ( short int  lut_btic,
const DTConfigManager conf 
)

Dump the LUT files.

Definition at line 551 of file DTTrig.cc.

References _cache, DTSCTrigUnit::dumpLUT(), DTConfigManager::dumpLUTParam(), and DTSCTrigUnit::statId().

Referenced by DTTrigProd::beginRun().

                                                                {
  for (TU_const_iterator it=_cache.begin();it!=_cache.end();it++){

    DTSCTrigUnit* thisTU = (*it).second;

    // dump lut command file from geometry
    thisTU->dumpLUT(lut_btic);

    // dump lut command file from parameters (DB or CMSSW)
    DTChamberId chid = thisTU->statId();
    conf->dumpLUTParam(chid);

  }
 
  return;

}
TU_iterator DTTrig::end ( void  ) [inline]

End of the trigger units store.

Definition at line 97 of file DTTrig.h.

References _cache.

{ /*check();*/ return _cache.end(); }
SC_iterator DTTrig::end1 ( ) [inline]

End of the sectoor collector store.

Definition at line 114 of file DTTrig.h.

References _cache1.

{ /*check();*/ return _cache1.end(); }
TU_iterator DTTrig::find ( DTChamberId  id) [inline]

Find a trigger unit in the map.

Definition at line 100 of file DTTrig.h.

References _cache.

{ /*check();*/ return _cache.find(id); }
SC_iterator DTTrig::find1 ( DTSectCollId  id) [inline]

Find a Sector Collector in the map.

Definition at line 117 of file DTTrig.h.

References _cache1.

{ /*check();*/ return _cache1.find(id); }
int DTTrig::getBXOffset ( ) [inline]

Get BX Offset.

Definition at line 184 of file DTTrig.h.

References _conf_manager, and DTConfigManager::getBXOffset().

Referenced by DTTrigProd::produce().

{ return _conf_manager->getBXOffset(); }
LocalVector DTTrig::localDirection ( const DTTrigData trig) const [inline]

Direction of a trigger-data object in chamber frame.

Definition at line 217 of file DTTrig.h.

References DTTrigData::ChamberId(), and constTrigUnit().

                                                             {
      return constTrigUnit(trig->ChamberId())->localDirection(trig);
    }
LocalPoint DTTrig::localPosition ( const DTTrigData trig) const [inline]

Coordinate of a trigger-data object in chamber frame.

Definition at line 207 of file DTTrig.h.

References DTTrigData::ChamberId(), and constTrigUnit().

                                                           {
      return constTrigUnit(trig->ChamberId())->localPosition(trig);
    }
void DTTrig::print ( DTTrigData trig) const [inline]

Print a trigger-data object.

Definition at line 227 of file DTTrig.h.

References DTTrigData::ChamberId(), and constTrigUnit().

                                       {
      constTrigUnit(trig->ChamberId())->print(trig);
    }
std::vector< DTSectCollPhSegm > DTTrig::SCPhTrigs ( )

Return a copy of all the Sector Collector (Phi) triggers.

Definition at line 634 of file DTTrig.cc.

References _cache1, DTSectColl::beginPh(), DTSectColl::endPh(), and L1TEmulatorMonitor_cff::p.

Referenced by DTTrigTest::analyze(), and DTTrigProd::produce().

                   {
  /*check();*/
  std::vector<DTSectCollPhSegm> trigs;
  //  SC_iterator ptu;
  SC_iterator psc;
  for(psc=_cache1.begin();psc!=_cache1.end();psc++) {
    //    DTSCTrigUnit* tu = (*ptu).second;
    //
    // old SMDB:    
    //      DTSectColl* tu = (*ptu).second;
    //      std::vector<DTChambPhSegm>::const_iterator p=0;
    //      std::vector<DTChambPhSegm>::const_iterator peb=tu->SCTrigs()->end();
    //      for(p=tu->SCTrigs()->begin();p!=peb;p++){
    //        trigs.push_back(*p);
    //      } 

    DTSectColl* sc = (*psc).second;
    std::vector<DTSectCollPhSegm>::const_iterator p;
    std::vector<DTSectCollPhSegm>::const_iterator peb=sc->endPh();
    for(p=sc->beginPh();p!=peb;p++){
      trigs.push_back(*p);
    }

  }
  return trigs;
}
std::vector< DTSectCollThSegm > DTTrig::SCThTrigs ( )

Return a copy of all the Sector Collector (Theta) triggers.

Definition at line 663 of file DTTrig.cc.

References _cache1, DTSectColl::beginTh(), DTSectColl::endTh(), and L1TEmulatorMonitor_cff::p.

Referenced by DTTrigTest::analyze(), and DTTrigProd::produce().

                   {
  /*check();*/
  std::vector<DTSectCollThSegm> trigs;
  SC_iterator psc;
  for(psc=_cache1.begin();psc!=_cache1.end();psc++) {
    DTSectColl* sc = (*psc).second;
    std::vector<DTSectCollThSegm>::const_iterator p; //p=0;
    std::vector<DTSectCollThSegm>::const_iterator peb=sc->endTh();
    for(p=sc->beginTh();p!=peb;p++){
      trigs.push_back(*p);
    }

  }
  return trigs;
}
DTSectColl * DTTrig::SCUnit ( DTSectCollId  scid) const [private]

Return a SC unit - Muon numbering - const version.

Definition at line 396 of file DTTrig.cc.

References _cache1, gather_cfg::cout, DTSectCollId::sector(), and DTSectCollId::wheel().

Referenced by chSectCollPhSegm1(), chSectCollPhSegm2(), chSectCollThSegm(), and SCUnit().

                                      {
SC_const_iterator it = _cache1.find(scid);
  if ( it == _cache1.end()) {
    std::cout << "DTTrig::SCUnit: Trigger Unit not in the map: ";
    std::cout << " wheel=" << scid.wheel() ;
    std::cout << ", sector=" << scid.sector();
    std::cout << std::endl;
    return 0;
  }

  return (*it).second;
}
DTSectColl * DTTrig::SCUnit ( int  wheel,
int  sect 
) const [private]

Return a SC Unit Muon Numbering, MTTF numbering - const version.

Definition at line 415 of file DTTrig.cc.

References SCUnit().

                                        {
  sect++;
  return SCUnit(DTSectCollId(wheel,sect));
}
int DTTrig::size ( void  ) [inline]

Size of the trigger units store.

Definition at line 91 of file DTTrig.h.

References _cache.

{ return _cache.size(); }
int DTTrig::size1 ( ) [inline]

Size of the sector collector store.

Definition at line 108 of file DTTrig.h.

References _cache1.

{ /*check();*/ return _cache1.size(); }
std::vector< DTTracoTrigData > DTTrig::TracoTrigs ( )

Return a copy of all the TRACO triggers.

Definition at line 586 of file DTTrig.cc.

References _cache, DTCache< T, Coll >::begin(), DTCache< T, Coll >::end(), L1TEmulatorMonitor_cff::p, and DTSCTrigUnit::TracoTrigs().

Referenced by DTTrigTest::analyze().

                    {
  std::vector<DTTracoTrigData> trigs;
  TU_iterator ptu;
  /*check();*/
  for(ptu=_cache.begin();ptu!=_cache.end();ptu++) {
    DTSCTrigUnit* tu = (*ptu).second;
    std::vector<DTTracoTrigData>::const_iterator p; //p=0;
    std::vector<DTTracoTrigData>::const_iterator peb=tu->TracoTrigs()->end();
    for(p=tu->TracoTrigs()->begin();p!=peb;p++){
      trigs.push_back(*p);
    }
  }
  return trigs;
}
void DTTrig::triggerReco ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Run the whole trigger reconstruction chain.

Definition at line 183 of file DTTrig.cc.

References _cache, _cache1, _digitag, _inputexist, DTSCTrigUnit::BtiTrigs(), DTSuperLayerId::chamberId(), DTCache< T, Coll >::clearCache(), DTBtiCard::clearCache(), DTTracoCard::clearCache(), DTSectColl::clearCache(), edm::Event::getByLabel(), DTSectColl::getTSPhi(), DTSectColl::getTSTheta(), i, edm::HandleBase::isValid(), LogDebug, DTSectColl::reconstruct(), DTTSPhi::reconstruct(), DTTracoCard::reconstruct(), DTTSTheta::reconstruct(), DTBtiCard::reconstruct(), DTSectCollId::sector(), DTCache< T, Coll >::size(), DTSectColl::sizePh(), DTSectColl::sizeTh(), DTSCTrigUnit::statId(), DTLayerId::superlayerId(), DTSCTrigUnit::TracoTrigs(), DTSCTrigUnit::TSPhTrigs(), DTSCTrigUnit::TSThTrigs(), and updateES().

Referenced by DTTrigTest::analyze(), and DTTrigProd::produce().

                                                                       {
  
  updateES(iSetup);
  if (!_inputexist) return;

  DTDigiMap digiMap;
  //Sort digis by chamber so they can be used by BTIs
  edm::Handle<DTDigiCollection> dtDigis;
  iEvent.getByLabel(_digitag, dtDigis);

  if (!dtDigis.isValid()) {
    LogDebug("DTTrig")
      << "DTTrig::triggerReco DTDigiCollection  with input tag " << _digitag
      << "requested in configuration, but not found in the event." << std::endl;
   
    _inputexist = false;
    return;
  }
   
  DTDigiCollection::DigiRangeIterator detUnitIt;
  
  for (detUnitIt=dtDigis->begin();
       detUnitIt!=dtDigis->end();
       ++detUnitIt){
    const DTLayerId& layId = (*detUnitIt).first;
    const DTChamberId chambId=layId.superlayerId().chamberId();
    const DTDigiCollection::Range& range = (*detUnitIt).second;
    //    DTDigiCollection tmpDTDigiColl;
    //tmpDTDigiColl.put(range,layId); 
    digiMap[chambId].put(range,layId); 
//     const DTDigiCollection::Range& range = (*detUnitIt).second;
//     for (DTDigiCollection::const_iterator digiIt = range.first;
//       digiIt!=range.second;
//       ++digiIt){
//       DTDigiCollection tmp;
      
//       digiMap[chambId].push_back((*digiIt));
//     }
  }

  // CB the commented because we don't use config()->debug() anymore in future will probably be possible to avoid the digis sorting  
//   if(config()->debug()>2){
//     std::cout << "----------DTDigis ordered by chamber:" << std::endl;
//     for (DTDigiMap_const_iterator digiMapIt=digiMap.begin();
//       digiMapIt!=digiMap.end();
//       digiMapIt++){
//       DTChamberId chambId = (*digiMapIt).first;
//       DTDigiCollection digis = (*digiMapIt).second;
//       std::cout << "Chamber id   " << chambId << std::endl;
//       DTDigiCollection::DigiRangeIterator RangeIt;
//       for (RangeIt=digis.begin();
//         RangeIt!=digis.end();
//         RangeIt++){
//      std::cout << "Digi's layer   " << (*RangeIt).first << std::endl;
//      const DTDigiCollection::Range& range = (*RangeIt).second;
//      for (DTDigiCollection::const_iterator digiIt = range.first;
//           digiIt!=range.second;
//           ++digiIt){
//        std::cout << "Digi's data   " << (*digiIt) << std::endl; 
//      }
        
        
//       }
//     }
//   }
  
  //Run reconstruct for single trigger subsystem (Bti, Traco TS)
  for (TU_iterator it=_cache.begin();it!=_cache.end();it++){
    DTSCTrigUnit* thisTU=(*it).second;
    if (thisTU->BtiTrigs()->size()>0){
      thisTU->BtiTrigs()->clearCache();
      thisTU->TSThTrigs()->clearCache();
      thisTU->TracoTrigs()->clearCache();
      thisTU->TSPhTrigs()->clearCache();
    }
    DTChamberId chid=thisTU->statId();
    DTDigiMap_iterator dmit = digiMap.find(chid);
    if (dmit !=digiMap.end()){
      thisTU->BtiTrigs()->reconstruct((*dmit).second); 
      if(thisTU->BtiTrigs()->size()>0){
        thisTU->TSThTrigs()->reconstruct();
        thisTU->TracoTrigs()->reconstruct();
        if(thisTU->TracoTrigs()->size()>0)
          thisTU->TSPhTrigs()->reconstruct();
      }
    }
  }
  //Run reconstruct for Sector Collector
  for (SC_iterator it=_cache1.begin();it!=_cache1.end();it++){
    DTSectColl* sectcoll = (*it).second;
    DTSectCollId scid = (*it).first;
    if (sectcoll->sizePh()>0 || sectcoll->sizeTh()>0)
      sectcoll->clearCache();
    bool mustreco = false;
    for (int i=1;i<5;i++) {
      if (sectcoll->getTSPhi(i)->size()>0) {
        mustreco = true;
        break;
      }
    }
    for (int i=1;i<4;i++) {
      if (sectcoll->getTSTheta(i)->size()>0) {
        mustreco = true;
        break;
      }
    }
    if (scid.sector()==4 || scid.sector()==10){
      if (sectcoll->getTSPhi(5)->size()>0)
        mustreco = true;
    }
    if (mustreco)
      sectcoll->reconstruct();
  }

}
DTSCTrigUnit * DTTrig::trigUnit ( DTChamberId  sid)

Return a trigger unit - Muon numbering.

Definition at line 372 of file DTTrig.cc.

References constTrigUnit().

Referenced by chPhiSegm1(), chPhiSegm2(), and chThetaSegm().

                                 {
  /*check();*/  return constTrigUnit(chid);

}
DTSCTrigUnit * DTTrig::trigUnit ( int  wheel,
int  stat,
int  sect 
)

Return a trigger unit - Muon numbering, MTTF numbering.

Definition at line 410 of file DTTrig.cc.

References constTrigUnit().

                                              {
  return constTrigUnit(wheel, stat, sect);
}
std::vector< DTChambPhSegm > DTTrig::TSPhTrigs ( )

Return a copy of all the Trigger Server (Phi) triggers.

Definition at line 602 of file DTTrig.cc.

References _cache, DTCache< T, Coll >::begin(), DTCache< T, Coll >::end(), L1TEmulatorMonitor_cff::p, and DTSCTrigUnit::TSPhTrigs().

Referenced by DTTrigTest::analyze().

                   {
  /*check();*/
  std::vector<DTChambPhSegm> trigs;
  TU_iterator ptu;
  for(ptu=_cache.begin();ptu!=_cache.end();ptu++) {
    DTSCTrigUnit* tu = (*ptu).second;
    std::vector<DTChambPhSegm>::const_iterator p; //p=0;
    std::vector<DTChambPhSegm>::const_iterator peb=tu->TSPhTrigs()->end();
    for(p=tu->TSPhTrigs()->begin();p!=peb;p++){
      trigs.push_back(*p);
    }
  }
  return trigs;
}
std::vector< DTChambThSegm > DTTrig::TSThTrigs ( )

Return a copy of all the Trigger Server (Theta) triggers.

Definition at line 618 of file DTTrig.cc.

References _cache, DTCache< T, Coll >::begin(), DTCache< T, Coll >::end(), L1TEmulatorMonitor_cff::p, and DTSCTrigUnit::TSThTrigs().

Referenced by DTTrigTest::analyze().

                   {
  /*check();*/
  std::vector<DTChambThSegm> trigs;
  TU_iterator ptu;
  for(ptu=_cache.begin();ptu!=_cache.end();ptu++) {
    DTSCTrigUnit* tu = (*ptu).second;
    std::vector<DTChambThSegm>::const_iterator p; //p=0;
    std::vector<DTChambThSegm>::const_iterator peb=tu->TSThTrigs()->end();
    for(p=tu->TSThTrigs()->begin();p!=peb;p++){
      trigs.push_back(*p);
    }
  }
  return trigs;
}
void DTTrig::updateES ( const edm::EventSetup iSetup)

update the eventsetup info

Definition at line 300 of file DTTrig.cc.

References _cache, _cache1, _conf_manager, _configid, _debug, _digi_sync, _geomid, _t0id, _ttrigid, _usesyncdb, edm::eventsetup::EventSetupRecord::cacheIdentifier(), gather_cfg::cout, edm::EventSetup::get(), edm::ESHandle< T >::product(), and DTTTrigBaseSync::setES().

Referenced by triggerReco().

                                           {

  // Check for updatets in config
  edm::ESHandle<DTConfigManager> confHandle;
  edm::ESHandle<DTGeometry> geomHandle;
  edm::ESHandle<DTT0> t0Handle;
  edm::ESHandle<DTTtrig> ttrigHandle;

  if (iSetup.get<DTConfigManagerRcd>().cacheIdentifier()!=_configid) {
    
    if (_debug)
    std::cout << "DTTrig::updateES updating DTTPG configuration" << std::endl;
    
    _configid = iSetup.get<DTConfigManagerRcd>().cacheIdentifier();
    iSetup.get<DTConfigManagerRcd>().get(confHandle);
    _conf_manager = confHandle.product();
    for (TU_iterator it=_cache.begin();it!=_cache.end();it++){
      (*it).second->setConfig(_conf_manager);
    }
    for (SC_iterator it=_cache1.begin();it!=_cache1.end();it++){
    (*it).second->setConfig(_conf_manager);
    }

  }

  if (iSetup.get<MuonGeometryRecord>().cacheIdentifier()!=_configid) {

    if (_debug)
    std::cout << "DTTrig::updateES updating muon geometry" << std::endl;

    _geomid = iSetup.get<MuonGeometryRecord>().cacheIdentifier();
    iSetup.get<MuonGeometryRecord>().get(geomHandle);
    for (TU_iterator it=_cache.begin();it!=_cache.end();it++){
      (*it).second->setGeom(geomHandle->chamber((*it).second->statId()));
    }

  }

  if (_usesyncdb &&
      (iSetup.get<DTT0Rcd>().cacheIdentifier()!=_t0id || 
      iSetup.get<DTTtrigRcd>().cacheIdentifier()!=_ttrigid)) {

    if (_debug)
    std::cout << "DTTrig::updateES updating synchronizer" << std::endl;

    _t0id    = iSetup.get<DTT0Rcd>().cacheIdentifier();
    _ttrigid = iSetup.get<DTTtrigRcd>().cacheIdentifier();
    _digi_sync->setES(iSetup);

  }

} 

Member Data Documentation

Definition at line 250 of file DTTrig.h.

Referenced by getBXOffset(), and updateES().

unsigned long long DTTrig::_configid [private]

Definition at line 257 of file DTTrig.h.

Referenced by updateES().

bool DTTrig::_debug [private]

Definition at line 253 of file DTTrig.h.

Referenced by createTUs(), DTTrig(), and updateES().

Definition at line 251 of file DTTrig.h.

Referenced by createTUs(), DTTrig(), updateES(), and ~DTTrig().

Definition at line 252 of file DTTrig.h.

Referenced by DTTrig(), and triggerReco().

unsigned long long DTTrig::_geomid [private]

Definition at line 258 of file DTTrig.h.

Referenced by updateES().

bool DTTrig::_inputexist [private]

Definition at line 255 of file DTTrig.h.

Referenced by triggerReco().

unsigned long long DTTrig::_t0id [private]

Definition at line 259 of file DTTrig.h.

Referenced by updateES().

unsigned long long DTTrig::_ttrigid [private]

Definition at line 260 of file DTTrig.h.

Referenced by updateES().

bool DTTrig::_usesyncdb [private]

Definition at line 254 of file DTTrig.h.

Referenced by DTTrig(), and updateES().