CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

L1EmulBias Class Reference

#include <L1EmulBias.h>

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

List of all members.

Public Member Functions

 L1EmulBias (const edm::ParameterSet &)
template<>
void ModifyCollection (std::auto_ptr< L1CSCTrackCollection > &data, const edm::Handle< L1CSCTrackCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< EcalTrigPrimDigiCollection > &data, const edm::Handle< EcalTrigPrimDigiCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuGMTReadoutCollection > &data, const edm::Handle< L1MuGMTReadoutCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuGMTCandCollection > &data, const edm::Handle< L1MuGMTCandCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< LTCDigiCollection > &data, const edm::Handle< LTCDigiCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuDTChambThContainer > &data, const edm::Handle< L1MuDTChambThContainer > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuDTChambPhContainer > &data, const edm::Handle< L1MuDTChambPhContainer > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuDTTrackContainer > &data, const edm::Handle< L1MuDTTrackContainer > emul)
template<>
void ModifyCollection (std::auto_ptr< L1MuRegionalCandCollection > &data, const edm::Handle< L1MuRegionalCandCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1GctJetCandCollection > &data, const edm::Handle< L1GctJetCandCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1GctEmCandCollection > &data, const edm::Handle< L1GctEmCandCollection >emul)
template<>
void ModifyCollection (std::auto_ptr< L1CaloRegionCollection > &data, const edm::Handle< L1CaloRegionCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< L1CaloEmCollection > &data, const edm::Handle< L1CaloEmCollection > emul)
template<>
void ModifyCollection (std::auto_ptr< CSCCorrelatedLCTDigiCollection > &data, const edm::Handle< CSCCorrelatedLCTDigiCollection > emul)
template<class T >
void ModifyCollection (std::auto_ptr< T > &data, const edm::Handle< T > emul)
 ~L1EmulBias ()

Protected Member Functions

virtual void beginJob (void)
virtual void endJob (void)
virtual void produce (edm::Event &, const edm::EventSetup &)

Private Member Functions

int verbose ()

Private Attributes

std::string instName [dedefs::DEnsys][5]
edm::InputTag m_DEsource [dedefs::DEnsys][2]
bool m_doSys [dedefs::DEnsys]
CLHEP::RandFlat * rndFlat_
CLHEP::RandGaussQ * rndGaus_
int verbose_

Detailed Description

Definition at line 38 of file L1EmulBias.h.


Constructor & Destructor Documentation

L1EmulBias::L1EmulBias ( const edm::ParameterSet iConfig) [explicit]

assertion/temporary

List of collections to be produced

Definition at line 5 of file L1EmulBias.cc.

References gather_cfg::cout, dedefs::CTF, dedefs::CTP, dedefs::DEnsys, dedefs::DTF, dedefs::DTP, dedefs::ETP, dedefs::GCT, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), dedefs::GLT, dedefs::GMT, dedefs::HTP, i, j, diffTwoXMLs::label, dedefs::LTC, dedefs::RCT, dedefs::RPC, AlCaHLTBitMon_QueryRunRegistry::string, dedefs::SystLabel, and validate_alignment_devdb10_cfg::verbose.

                                                     {

  verbose_ = iConfig.getUntrackedParameter<int>("VerboseFlag",0);

  for(int sys=0; sys<DEnsys; sys++) {
    std::string label = SystLabel[sys] + "source";
    m_DEsource[sys][0] = iConfig.getParameter<edm::InputTag>(label);
    if(sys==CTF) {
      std::string label = "CTTsource";
      m_DEsource[sys][1] = iConfig.getParameter<edm::InputTag>(label);
    }
  }
  
  std::vector<unsigned int> compColls  
    = iConfig.getUntrackedParameter<std::vector<unsigned int> >("DO_SYSTEM");
  for(int i=0; i<DEnsys; i++)
    m_doSys[i] = compColls[i];

  if(verbose()) {
    std::cout << "[L1EmulBias] do sys? ";
    for(int i=0; i<DEnsys; i++)
      std::cout << m_doSys[i];
    std::cout << "\n\t";  
    for(int i=0; i<DEnsys; i++)
      if(m_doSys[i]) 
        std::cout << SystLabel[i] << " ";
    std::cout << std::endl;  
  }
  
  std::string CollInstName[DEnsys][5];
  for(int i=0; i<DEnsys; i++)
    for(int j=0; j<5; j++)
      CollInstName[i][j]=std::string("");

  CollInstName[GCT][0]+="isoEm"   ;
  CollInstName[GCT][1]+="nonIsoEm";
  CollInstName[GCT][2]+="cenJets" ;
  CollInstName[GCT][3]+="forJets" ;
  CollInstName[GCT][4]+="tauJets" ;
  CollInstName[DTF][0]+="DT"      ;
  CollInstName[DTF][1]+="DTTF"    ;
  CollInstName[CTF][0]+="CSC"     ;
  CollInstName[CTF][1]+=""        ;
  CollInstName[RPC][0]+="RPCb"    ;
  CollInstName[RPC][1]+="RPCf"    ;
  
  for(int i=0; i<DEnsys; i++)
    for(int j=0; j<5; j++)
      instName[i][j] = CollInstName[i][j];
  
  if(verbose())
    for(int i=0; i<DEnsys; i++)
      for(int j=0; j<5; j++)
        if(instName[i][j] != "")
          std::cout << "[emulbias] " << i << " " << SystLabel[i] 
                    << " " << j << " " << instName[i][j] 
                    << std::endl;  
  
  assert(ETP==0); assert(HTP==1); assert(RCT== 2); assert(GCT== 3);
  assert(DTP==4); assert(DTF==5); assert(CTP== 6); assert(CTF== 7);
  assert(RPC==8); assert(LTC==9); assert(GMT==10); assert(GLT==11);

  if(m_doSys[ETP])  produces<EcalTrigPrimDigiCollection>     (instName[ETP][0]);
  if(m_doSys[HTP])  produces<HcalTrigPrimDigiCollection>     (instName[HTP][0]);
  if(m_doSys[RCT])  produces<L1CaloEmCollection>             (instName[RCT][0]);
  if(m_doSys[RCT])  produces<L1CaloRegionCollection>         (instName[RCT][0]);
  if(m_doSys[GCT])  produces<L1GctEmCandCollection>          (instName[GCT][0]);
  if(m_doSys[GCT])  produces<L1GctEmCandCollection>          (instName[GCT][1]);
  if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][2]);
  if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][3]);
  if(m_doSys[GCT])  produces<L1GctJetCandCollection>         (instName[GCT][4]);
  if(m_doSys[DTP])  produces<L1MuDTChambPhContainer>         (instName[DTP][0]);
  if(m_doSys[DTP])  produces<L1MuDTChambThContainer>         (instName[DTP][0]);
  if(m_doSys[DTF])  produces<L1MuRegionalCandCollection>     (instName[DTF][0]);
  if(m_doSys[DTF])  produces<L1MuDTTrackContainer>           (instName[DTF][1]);
  if(m_doSys[CTP])  produces<CSCCorrelatedLCTDigiCollection> (instName[CTP][0]);
  if(m_doSys[CTF])  produces<L1MuRegionalCandCollection>     (instName[CTF][0]);
  if(m_doSys[CTF])  produces<L1CSCTrackCollection>           (instName[CTF][1]);
  if(m_doSys[RPC])  produces<L1MuRegionalCandCollection>     (instName[RPC][0]);
  if(m_doSys[RPC])  produces<L1MuRegionalCandCollection>     (instName[RPC][1]);
  if(m_doSys[LTC])  produces<LTCDigiCollection>              (instName[LTC][0]);
  if(m_doSys[GMT])  produces<L1MuGMTCandCollection>          (instName[GMT][0]);
  if(m_doSys[GMT])  produces<L1MuGMTReadoutCollection>       (instName[GMT][0]);
  if(m_doSys[GLT])  produces<L1GlobalTriggerReadoutRecord>   (instName[GLT][0]);
  if(m_doSys[GLT])  produces<L1GlobalTriggerEvmReadoutRecord>(instName[GLT][0]);
  if(m_doSys[GLT])  produces<L1GlobalTriggerObjectMapRecord> (instName[GLT][0]);

  edm::Service<edm::RandomNumberGenerator> rng;
  CLHEP::HepRandomEngine& engine = rng->getEngine();
  rndFlat_ = new CLHEP::RandFlat  (engine, 0., 1.);
  rndGaus_ = new CLHEP::RandGaussQ(engine, 0., 1.);

  if(verbose())
    std::cout << "L1EmulBias::L1EmulBias()... done." << std::endl; 
}
L1EmulBias::~L1EmulBias ( )

Definition at line 103 of file L1EmulBias.cc.

                        {
  delete rndFlat_;
  delete rndGaus_;
}

Member Function Documentation

virtual void L1EmulBias::beginJob ( void  ) [inline, protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 45 of file L1EmulBias.h.

{};
virtual void L1EmulBias::endJob ( void  ) [inline, protected, virtual]

Reimplemented from edm::EDProducer.

Definition at line 48 of file L1EmulBias.h.

{};
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< CSCCorrelatedLCTDigiCollection > &  data,
const edm::Handle< CSCCorrelatedLCTDigiCollection emul 
) [inline]

modify digi

append digi

Definition at line 390 of file L1EmulBias.h.

References CSCCorrelatedLCTDigi::getTrknmb(), and CSCCorrelatedLCTDigi::setTrknmb().

                                                                                 {
  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
  typedef CSCCorrelatedLCTDigiCollection::DigiRangeIterator mapIt;//map iterator
  typedef CSCCorrelatedLCTDigiCollection::const_iterator    vecIt;//vec iterator
  //loop over data (map<idx,vec_digi>)
  for (mapIt mit = emul->begin(); mit != emul->end(); mit++) {
    //get detector index
    CSCDetId did = (*mit).first;
    //get vec_digi range(pair)  corresponding to idx of map
    //CSCCorrelatedLCTDigiCollection::Range ctpRange = emul->get(did)
    //loop over digi vector (ie between begin and end pointers in range)
    //for (vecIt vit = ctpRange.first; vit != ctpRange.second; vit++) {
    for (vecIt vit = emul->get((*mit).first).first; 
         vit != emul->get((*mit).first).second; vit++) {
      CSCCorrelatedLCTDigi dg = *vit; 
      //dg.clear;
      uint16_t tn = dg.getTrknmb();
      if(tn==2) tn--;
      dg.setTrknmb(tn);
      //dg.setTrknmb   (dg.getTrknmb   ());
      //dg.setMPCLink  (dg.getMPCLink  ());
      //dg.setWireGroup(dg.getWireGroup());
      data->insertDigi(did,dg);
    }
  }
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuGMTReadoutCollection > &  data,
const edm::Handle< L1MuGMTReadoutCollection emul 
) [inline]

Definition at line 325 of file L1EmulBias.h.

References i, L1MuGMTReadoutRecord::setBxNr(), L1MuRegionalCand::setPtPacked(), and L1MuRegionalCand::setType().

                                                                           {
  typedef std::vector<L1MuGMTReadoutRecord>::const_iterator col_cit;
  std::vector<L1MuGMTReadoutRecord> col = emul->getRecords();
  for(col_cit it = col.begin(); it!=col.end(); it++) {
    L1MuGMTReadoutRecord rec(it->getBxInEvent());    
    rec.setBxNr (it->getBxNr ());
    rec.setEvNr (it->getEvNr ());
    rec.setBCERR(it->getBCERR());
    
    std::auto_ptr<L1MuRegionalCandCollection> new_dttf(new L1MuRegionalCandCollection);
    std::auto_ptr<L1MuRegionalCandCollection> new_rpcb(new L1MuRegionalCandCollection);
    std::auto_ptr<L1MuRegionalCandCollection> new_csc (new L1MuRegionalCandCollection);
    std::auto_ptr<L1MuRegionalCandCollection> new_rpcf(new L1MuRegionalCandCollection);
  
    L1MuRegionalCandCollection old_dttf = it->getDTBXCands();
    L1MuRegionalCandCollection old_rpcb = it->getBrlRPCCands();
    L1MuRegionalCandCollection old_csc  = it->getCSCCands();
    L1MuRegionalCandCollection old_rpcf = it->getFwdRPCCands();

    typedef L1MuRegionalCandCollection::const_iterator ait;
    for(ait it = old_dttf.begin(); it!=old_dttf.end(); it++) {
      L1MuRegionalCand cand(*it);    
      if(it->quality()<4)
        cand.setPtPacked((it->pt_packed()>>2)&0x1f);
      cand.setType(it->type_idx());
      new_dttf->push_back(cand);
    }
    for(ait it = old_rpcb.begin(); it!=old_rpcb.end(); it++) {
      L1MuRegionalCand cand(*it);    
      if(it->quality()<4)
        cand.setPtPacked((it->pt_packed()>>2)&0x1f);
      cand.setType(it->type_idx());
      new_rpcb->push_back(cand);
    }
    for(ait it = old_csc.begin(); it!=old_csc.end(); it++) {
      L1MuRegionalCand cand(*it);    
      if(it->quality()<4)
        cand.setPtPacked((it->pt_packed()>>2)&0x1f);
      cand.setType(it->type_idx());
      new_csc->push_back(cand);
    }
    for(ait it = old_rpcf.begin(); it!=old_rpcf.end(); it++) {
      L1MuRegionalCand cand(*it);    
      if(it->quality()<4)
        cand.setPtPacked((it->pt_packed()>>2)&0x1f);
      cand.setType(it->type_idx());
      new_rpcf->push_back(cand);
    }
  
    for(unsigned i=0; i<old_dttf.size(); i++)
      rec.setInputCand(i   ,new_dttf->at(i));//dt  : 0..3
    for(unsigned i=0; i<old_rpcb.size(); i++)
      rec.setInputCand(i+ 4,new_rpcb->at(i));//rpcb: 4..7
    for(unsigned i=0; i<old_csc .size(); i++)
      rec.setInputCand(i+ 8,new_csc ->at(i));//csc : 8..11
    for(unsigned i=0; i<old_rpcf.size(); i++)
      rec.setInputCand(i+12,new_rpcf->at(i));//rpcf:12..15

    data->addRecord(rec);
  }
  //void addRecord(L1MuGMTReadoutRecord const& rec) {
}
template<class T >
void L1EmulBias::ModifyCollection ( std::auto_ptr< T > &  data,
const edm::Handle< T emul 
)

Definition at line 73 of file L1EmulBias.h.

References edm::Handle< T >::product().

                                                                               {
  data = (std::auto_ptr<T>)(const_cast<T*>(emul.product()));
} 
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< LTCDigiCollection > &  data,
const edm::Handle< LTCDigiCollection emul 
) [inline]

Definition at line 297 of file L1EmulBias.h.

                                                                    {
  typedef std::vector<LTCDigi>::const_iterator col_cit;
  for(col_cit it=emul->begin(); it!=emul->end(); it++) {
    data->push_back(*it);
    //note: raw data accessor missing in dataformats!
    //data->push_back(LTCDigi(it->data()>>1));
  }
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuDTChambThContainer > &  data,
const edm::Handle< L1MuDTChambThContainer emul 
) [inline]

Definition at line 275 of file L1EmulBias.h.

References j, and testEve_cfg::tracks.

                                                                         {
  typedef std::vector<L1MuDTChambThDigi> Thi_Container;
  typedef Thi_Container::const_iterator  col_cit;
  Thi_Container* tracks_in = emul->getContainer(); 
  Thi_Container tracks(tracks_in->size());
  int uos[7],uqa[7];
  for(col_cit it=tracks_in->begin(); it!=tracks_in->end(); it++) {
    for(int j=0; j<7; j++) {
      uos[j]=(it->position(j)?0:1);
      uqa[j]=(it->quality (j)?0:1);
    }
    int stnum = it->stNum();
    stnum = (stnum>2?stnum-1:stnum);
    L1MuDTChambThDigi 
      cand(it->bxNum(),it->whNum(),it->scNum(),stnum,uos,uqa);
    tracks.push_back(cand);
  }
  data->setContainer(tracks);
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuDTChambPhContainer > &  data,
const edm::Handle< L1MuDTChambPhContainer emul 
) [inline]

Definition at line 256 of file L1EmulBias.h.

References testEve_cfg::tracks.

                                                                         {
  typedef std::vector<L1MuDTChambPhDigi> Phi_Container;
  typedef Phi_Container::const_iterator  col_it;
  Phi_Container* tracks_in = emul->getContainer(); 
  Phi_Container tracks(tracks_in->size());
  int uqua;
  for(col_it it=tracks_in->begin(); it!=tracks_in->end(); it++) {
    uqua = it->code(); // (int)(10*rndFlat_->fire());
    uqua = (uqua<2?uqua+1:uqua);
    L1MuDTChambPhDigi 
      cand(it->bxNum(),it->whNum(),it->scNum(),it->stNum(),
           it->phi(),it->phiB(),uqua,it->Ts2Tag(),it->BxCnt() );
    tracks.push_back(cand);
  }
  data->setContainer(tracks);
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuDTTrackContainer > &  data,
const edm::Handle< L1MuDTTrackContainer emul 
) [inline]

Definition at line 226 of file L1EmulBias.h.

References L1MuRegionalCand::setPtPacked(), L1MuRegionalCand::setQualityPacked(), L1MuRegionalCand::setType(), and testEve_cfg::tracks.

                                                                       {
  typedef std::vector<L1MuDTTrackCand>  TrackContainer;
  typedef TrackContainer::const_iterator col_cit;
  TrackContainer* tracks_in = emul->getContainer();
  TrackContainer tracks;
  for(col_cit it = tracks_in->begin(); it!=tracks_in->end(); it++) {
    L1MuDTTrackCand cand(*it);    
    cand.setType(it->type_idx());
    unsigned pt = it->pt_packed(); //0..31
    unsigned qua = it->quality(); //0..7
    if(qua<4) {
      cand.setPtPacked((pt>>2)&0x1f);
      cand.setQualityPacked((qua<<1)&0x07);
    }
    tracks.push_back(cand);
  }
  data->setContainer(tracks);
  /*   few alternatives...
  unsigned phip = it->phi_packed();
  unsigned raw = it->getDataWord();
  uint16_t rdata = raw;
  if(2.5<fabs(it->phiValue())<3.0)
    rdata = raw>>1;
  L1MuRegionalCand cand(rdata,it->bx());    
  double rnd    = rndFlat_->fire();
  */
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuRegionalCandCollection > &  data,
const edm::Handle< L1MuRegionalCandCollection emul 
) [inline]

Definition at line 189 of file L1EmulBias.h.

References phi, and L1MuRegionalCand::setPtPacked().

                                                                               {
  typedef L1MuRegionalCandCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    L1MuRegionalCand cand(*it);    
    //unsigned raw = it->getDataWord();
    unsigned phi = it->phi_packed();
    if(phi>90 && phi<110)
      cand.setPtPacked( (it->pt_packed())>>1 );
      //raw = (raw>>2);
      //L1MuRegionalCand cand(raw); 
      //cand.setType(it->type_idx());
    data->push_back(cand);
  }
  /* few alternatives...
  unsigned pt= it->pt_packed(); //0..31
  unsigned int qua = it->quality(); //0..7
  if(qua<4){cand.setPtPacked((pt>>2)&0x1f);cand.setQualityPacked((qua<<1)&0x07);}
  double rnd = rndGaus_->fire();
  if(rnd>0.7) {
    raw_=(raw>>1);
    cand.setDataWord(raw_);
  } else if (rnd>0.3) {
    pt_ *= (int)(1+0.3*rndFlat_->fire());
    cand.setPtPacked(pt_);
  } else 
    cand.reset();
  unsigned raw = it->getDataWord();
  if(2.5<fabs(it->phiValue())<3.0)
    rdata = raw>>1;
  L1MuRegionalCand cand(rdata,it->bx());    
  */
  //L1MuRegionalCand(unsigned dataword = 0, int bx = 0); 
  //L1MuRegionalCand(unsigned type_idx, unsigned phi, unsigned eta, unsigned pt, unsigned charge, unsigned ch_valid, unsigned finehalo, unsigned quality, int bx);
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1CaloRegionCollection > &  data,
const edm::Handle< L1CaloRegionCollection emul 
) [inline]

Definition at line 141 of file L1EmulBias.h.

                                                                         {
  typedef L1CaloRegionCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    unsigned crate = it->rctCrate();
    unsigned raw = it->et();
    uint16_t rdata = raw;
    if(crate<4*rndFlat_->fire())
      rdata = raw>>1;
    L1CaloRegion cand(rdata,it->gctEta(),it->gctPhi(),it->bx());    
    data->push_back(cand);
  }  
  //L1CaloRegion(uint16_t data, unsigned ieta, unsigned iphi, int16_t bx);
  //Note: raw data accessor missing in dataformats!
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1MuGMTCandCollection > &  data,
const edm::Handle< L1MuGMTCandCollection emul 
) [inline]

Definition at line 308 of file L1EmulBias.h.

                                                                        {
  //typedef std::vector<L1MuGMTCand>          L1MuGMTCandCollection;
  typedef std::vector<L1MuGMTCand>::const_iterator col_cit;
  for(col_cit it=emul->begin(); it!=emul->end(); it++) {
    float phiv = it->phiValue();
    unsigned dword = it->getDataWord();
    if(phiv>2. && phiv<4.) 
      dword = dword>>2;
    L1MuGMTCand cand(dword,it->bx());
    data->push_back(cand);
    //cand.setPtPacked(cand.ptIndex()>>1);
    //data->push_back(L1MuGMTCand((it->getDataWord()>>1),it->bx()));
  }
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1GctEmCandCollection > &  data,
const edm::Handle< L1GctEmCandCollection emul 
) [inline]

Definition at line 158 of file L1EmulBias.h.

References rndFlat_.

                                                                       {
  typedef L1GctEmCandCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    unsigned raw = it->raw();
    uint16_t rdata = raw;
    if(it->phiIndex()<4*rndFlat_->fire()) //0-17
      rdata = raw>>1;
    L1GctEmCand cand(rdata,it->isolated());
    data->push_back(cand);
  }  
  //etaIndex(), etaSign() : -6 to -0, +0 to +6
  //L1GctEmCand(uint16_t data, bool iso);
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1CaloEmCollection > &  data,
const edm::Handle< L1CaloEmCollection emul 
) [inline]

Definition at line 122 of file L1EmulBias.h.

                                                                     {
  typedef L1CaloEmCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    unsigned crate = it->rctCrate();
    unsigned raw   = it->raw();
    bool     iso   = it->isolated();  
    unsigned rdata = raw;
    if(crate<4*rndFlat_->fire())
      rdata = raw>>1;
    L1CaloEmCand cand(rdata,crate,iso,it->index(),it->bx(),false);    
    data->push_back(cand);
  }  
  //L1CaloEmCand(uint16_t data, unsigned crate, bool iso);
  //L1CaloEmCand(uint16_t data, unsigned crate, bool iso, uint16_t index, int16_t bx, bool dummy);
}
void L1EmulBias::ModifyCollection ( std::auto_ptr< EcalTrigPrimDigiCollection > &  data,
const edm::Handle< EcalTrigPrimDigiCollection emul 
) [inline]

Definition at line 78 of file L1EmulBias.h.

References gather_cfg::cout, createXMLFile::iphi, EcalTriggerPrimitiveSample::raw(), reset(), alignCSCRings::s, compare_using_db::sample, EcalTriggerPrimitiveDigi::sample(), EcalTriggerPrimitiveDigi::setSampleValue(), tmp, and verbose().

                                                                             {
  typedef EcalTrigPrimDigiCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    EcalTriggerPrimitiveDigi col(*it);    
    int iphi = it->id().iphi();
    bool reset = (iphi>18 && iphi<39);//remove few supermodules
    for(int s=0; s<5; s++) {
      uint16_t sample = it->sample(s).raw(); 
      if(sample==0) continue;
      uint16_t tmp = reset?0:sample; 
      if(reset)
        tmp = sample>>1; 
      col.setSampleValue(s,tmp);
      if(verbose() && sample!=0)
        std::cout << "[emulbias] etp " << *it << "\t sample: " << s << "  "
                  << std::hex << sample << " -> " << col.sample(s).raw()
                  << std::dec << std::endl;
    }
    data->push_back(col);
  }  
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1GctJetCandCollection > &  data,
const edm::Handle< L1GctJetCandCollection emul 
) [inline]

Definition at line 174 of file L1EmulBias.h.

References rndFlat_.

                                                                         {
  typedef L1GctJetCandCollection::const_iterator col_cit;
  for(col_cit it = emul->begin(); it!=emul->end(); it++) {
    unsigned raw = it->raw();
    uint16_t rdata = raw;
    if(it->phiIndex()<4*rndFlat_->fire()) //0-17
      rdata = raw>>1;
    L1GctJetCand cand(rdata,it->isTau(),it->isForward());
    data->push_back(cand);
  }
  //L1GctJetCand(uint16_t data, bool isTau, bool isFor);
}
template<>
void L1EmulBias::ModifyCollection ( std::auto_ptr< L1CSCTrackCollection > &  data,
const edm::Handle< L1CSCTrackCollection emul 
) [inline]

Definition at line 420 of file L1EmulBias.h.

References CSCCorrelatedLCTDigi::getTrknmb(), L1MuRegionalCand::pt_packed(), L1MuRegionalCand::quality(), L1MuRegionalCand::setPtPacked(), CSCCorrelatedLCTDigi::setTrknmb(), L1MuRegionalCand::setType(), and L1MuRegionalCand::type_idx().

                                                                                               {
  typedef L1CSCTrackCollection::const_iterator col_cit;
  //typedef std::vector<L1CSCTrack> L1CSCTrackCollection;
  //typedef std::pair<csc::L1Track,CSCCorrelatedLCTDigiCollection> L1CSCTrack;
  //typedef MuonDigiCollection<CSCDetId,CSCCorrelatedLCTDigi> CSCCorrelatedLCTDigiCollection;
  typedef CSCCorrelatedLCTDigiCollection::DigiRangeIterator mapIt;//map iterator
  typedef CSCCorrelatedLCTDigiCollection::const_iterator    vecIt;//vec iterator
  CSCCorrelatedLCTDigiCollection_ ctf_trk_data_v, ctf_trk_emul_v; //vector
  //loop over csc-tracks (ie pairs<l1track,digi_vec>)
  for(col_cit tcit=emul->begin(); tcit!=emul->end(); tcit++) {
    csc::L1Track l1trk = tcit->first;
    if(l1trk.quality()<4)
      l1trk.setPtPacked((l1trk.pt_packed()>>2)&0x1f);
    l1trk.setType(l1trk.type_idx());
    //L1MuRegionalCand reg(tcit->first.getDataWord(), tcit->first.bx());
    std::auto_ptr<CSCCorrelatedLCTDigiCollection> dgcoll(new CSCCorrelatedLCTDigiCollection);
    CSCCorrelatedLCTDigiCollection ldc = tcit->second; //muondigicollection=map
    //get the lct-digi-collection (ie muon-digi-collection)
    //loop over data (map<idx,vec_digi>)
    for (mapIt mit = ldc.begin(); mit != ldc.end(); mit++) {
      //get vec_digi range(pair)  corresponding to idx of map
      //loop over digi vector (ie between begin and end pointers in range)
      //CSCCorrelatedLCTDigiCollection::Range ctpRange = ctp_lct_data_->get((*mit).first)
      CSCDetId did = (*mit).first;
      //for (vecIt vit = ctpRange.first; vit != ctpRange.second; vit++) {
      for (vecIt vit = ldc.get((*mit).first).first; 
           vit != ldc.get((*mit).first).second; vit++) {
        CSCCorrelatedLCTDigi dg = *vit; 
        uint16_t tn = dg.getTrknmb();
        if(tn==2) tn--;
        dg.setTrknmb(tn);
        dgcoll->insertDigi(did,dg);
      }
    }
    L1CSCTrack l1csctrk = std::make_pair(l1trk,*dgcoll);
    data->push_back(l1csctrk);
  }
}
void L1EmulBias::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [protected, virtual]

list the emulated collections

get the emulated collections

assert collection validity

declare the data collections

fill data as modified emul collections

append data into event

Implements edm::EDProducer.

Definition at line 110 of file L1EmulBias.cc.

References gather_cfg::cout, dedefs::CTF, dedefs::CTP, dedefs::DTF, dedefs::DTP, dedefs::ETP, dedefs::GCT, edm::Event::getByLabel(), dedefs::GLT, dedefs::GMT, dedefs::HTP, edm::HandleBase::isValid(), diffTwoXMLs::label, dedefs::LTC, edm::Event::put(), dedefs::RCT, dedefs::RPC, and validate_alignment_devdb10_cfg::verbose.

                                                                 {
  
  if(verbose())
    std::cout << "L1EmulBias::produce...\n" << std::flush; 

  edm::Handle<EcalTrigPrimDigiCollection>       ecal_tp_emul;
  edm::Handle<HcalTrigPrimDigiCollection>       hcal_tp_emul;
  edm::Handle<L1CaloEmCollection>               rct_em_emul;
  edm::Handle<L1CaloRegionCollection>           rct_rgn_emul;
  edm::Handle<L1GctEmCandCollection>            gct_isolaem_emul;
  edm::Handle<L1GctEmCandCollection>            gct_noisoem_emul;
  edm::Handle<L1GctJetCandCollection>           gct_cenjets_emul;
  edm::Handle<L1GctJetCandCollection>           gct_forjets_emul;
  edm::Handle<L1GctJetCandCollection>           gct_taujets_emul;
  edm::Handle<L1MuDTChambPhContainer>           dtp_ph_emul;
  edm::Handle<L1MuDTChambThContainer>           dtp_th_emul;
  edm::Handle<L1MuRegionalCandCollection>       dtf_emul;
  edm::Handle<L1MuDTTrackContainer>             dtf_trk_emul;
  edm::Handle<CSCCorrelatedLCTDigiCollection>   ctp_emul;
  edm::Handle<L1MuRegionalCandCollection>       ctf_emul;
  edm::Handle<L1CSCTrackCollection>             ctf_trk_emul;
  edm::Handle<L1MuRegionalCandCollection>       rpc_cen_emul;
  edm::Handle<L1MuRegionalCandCollection>       rpc_for_emul;
  edm::Handle<LTCDigiCollection>                ltc_emul;
  edm::Handle<L1MuGMTCandCollection>            gmt_emul;
  edm::Handle<L1MuGMTReadoutCollection>         gmt_rdt_emul;    
  edm::Handle<L1GlobalTriggerReadoutRecord>     gt_em_emul;
  edm::Handle<L1GlobalTriggerReadoutRecord>     glt_rdt_emul;
  edm::Handle<L1GlobalTriggerEvmReadoutRecord>  glt_evm_emul;
  edm::Handle<L1GlobalTriggerObjectMapRecord>   glt_obj_emul;

  if(m_doSys[ETP]) iEvent.getByLabel(m_DEsource[ETP][0].label(),instName[ETP][0],    ecal_tp_emul);
  if(m_doSys[HTP]) iEvent.getByLabel(m_DEsource[HTP][0].label(),instName[HTP][0],    hcal_tp_emul);
  if(m_doSys[RCT]) iEvent.getByLabel(m_DEsource[RCT][0].label(),instName[RCT][0],     rct_em_emul);
  if(m_doSys[RCT]) iEvent.getByLabel(m_DEsource[RCT][0].label(),instName[RCT][0],    rct_rgn_emul);
  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][0],gct_isolaem_emul);
  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][1],gct_noisoem_emul);
  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][2],gct_cenjets_emul);
  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][3],gct_forjets_emul);
  if(m_doSys[GCT]) iEvent.getByLabel(m_DEsource[GCT][0].label(),instName[GCT][4],gct_taujets_emul);
  if(m_doSys[DTP]) iEvent.getByLabel(m_DEsource[DTP][0].label(),instName[DTP][0],     dtp_ph_emul);
  if(m_doSys[DTP]) iEvent.getByLabel(m_DEsource[DTP][0].label(),instName[DTP][0],     dtp_th_emul);
  if(m_doSys[DTF]) iEvent.getByLabel(m_DEsource[DTF][0].label(),instName[DTF][0],        dtf_emul);
  if(m_doSys[DTF]) iEvent.getByLabel(m_DEsource[DTF][0].label(),instName[DTF][1],    dtf_trk_emul);
  if(m_doSys[CTP]) iEvent.getByLabel(m_DEsource[CTP][0].label(),instName[CTP][0],        ctp_emul);
  if(m_doSys[CTF]) iEvent.getByLabel(m_DEsource[CTF][0].label(),instName[CTF][0],        ctf_emul);
  if(m_doSys[CTF]) iEvent.getByLabel(m_DEsource[CTF][1].label(),instName[CTF][1],    ctf_trk_emul);
  if(m_doSys[RPC]) iEvent.getByLabel(m_DEsource[RPC][0].label(),instName[RPC][0],    rpc_cen_emul);
  if(m_doSys[RPC]) iEvent.getByLabel(m_DEsource[RPC][0].label(),instName[RPC][1],    rpc_for_emul);
  if(m_doSys[LTC]) iEvent.getByLabel(m_DEsource[LTC][0].label(),instName[LTC][0],        ltc_emul);
  if(m_doSys[GMT]) iEvent.getByLabel(m_DEsource[GMT][0].label(),instName[GMT][0],        gmt_emul);
  if(m_doSys[GMT]) iEvent.getByLabel(m_DEsource[GMT][0].label(),instName[GMT][0],    gmt_rdt_emul);
  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0],    glt_rdt_emul);
  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0],    glt_evm_emul);
  if(m_doSys[GLT]) iEvent.getByLabel(m_DEsource[GLT][0].label(),instName[GLT][0],    glt_obj_emul);

  if(m_doSys[ETP]) assert(    ecal_tp_emul.isValid());
  if(m_doSys[HTP]) assert(    hcal_tp_emul.isValid());
  if(m_doSys[RCT]) assert(     rct_em_emul.isValid());
  if(m_doSys[RCT]) assert(    rct_rgn_emul.isValid());
  if(m_doSys[GCT]) assert(gct_isolaem_emul.isValid());
  if(m_doSys[GCT]) assert(gct_noisoem_emul.isValid());
  if(m_doSys[GCT]) assert(gct_cenjets_emul.isValid());
  if(m_doSys[GCT]) assert(gct_forjets_emul.isValid());
  if(m_doSys[GCT]) assert(gct_taujets_emul.isValid());
  if(m_doSys[DTP]) assert(     dtp_ph_emul.isValid());
  if(m_doSys[DTP]) assert(     dtp_th_emul.isValid());
  if(m_doSys[DTF]) assert(        dtf_emul.isValid());
  if(m_doSys[DTF]) assert(    dtf_trk_emul.isValid());
  if(m_doSys[CTP]) assert(        ctp_emul.isValid());
  if(m_doSys[CTF]) assert(        ctf_emul.isValid());
  if(m_doSys[CTF]) assert(    ctf_trk_emul.isValid());
  if(m_doSys[RPC]) assert(    rpc_cen_emul.isValid());
  if(m_doSys[RPC]) assert(    rpc_for_emul.isValid());
  if(m_doSys[LTC]) assert(        ltc_emul.isValid());
  if(m_doSys[GMT]) assert(        gmt_emul.isValid());
  if(m_doSys[GMT]) assert(    gmt_rdt_emul.isValid());
  if(m_doSys[GLT]) assert(    glt_rdt_emul.isValid());
  if(m_doSys[GLT]) assert(    glt_evm_emul.isValid());
  if(m_doSys[GLT]) assert(    glt_obj_emul.isValid());

  std::auto_ptr<EcalTrigPrimDigiCollection>         ecal_tp_data(new EcalTrigPrimDigiCollection     );
  std::auto_ptr<HcalTrigPrimDigiCollection>         hcal_tp_data(new HcalTrigPrimDigiCollection     );
  std::auto_ptr<L1CaloEmCollection>                  rct_em_data(new L1CaloEmCollection             );
  std::auto_ptr<L1CaloRegionCollection>             rct_rgn_data(new L1CaloRegionCollection         );
  std::auto_ptr<L1GctEmCandCollection>          gct_isolaem_data(new L1GctEmCandCollection          ); 
  std::auto_ptr<L1GctEmCandCollection>          gct_noisoem_data(new L1GctEmCandCollection          ); 
  std::auto_ptr<L1GctJetCandCollection>         gct_cenjets_data(new L1GctJetCandCollection         ); 
  std::auto_ptr<L1GctJetCandCollection>         gct_forjets_data(new L1GctJetCandCollection         ); 
  std::auto_ptr<L1GctJetCandCollection>         gct_taujets_data(new L1GctJetCandCollection         ); 
  std::auto_ptr<L1MuDTChambPhContainer>              dtp_ph_data(new L1MuDTChambPhContainer         );
  std::auto_ptr<L1MuDTChambThContainer>              dtp_th_data(new L1MuDTChambThContainer         );
  std::auto_ptr<L1MuRegionalCandCollection>             dtf_data(new L1MuRegionalCandCollection     );
  std::auto_ptr<L1MuDTTrackContainer>               dtf_trk_data(new L1MuDTTrackContainer           );
  std::auto_ptr<CSCCorrelatedLCTDigiCollection>         ctp_data(new CSCCorrelatedLCTDigiCollection );
  std::auto_ptr<L1MuRegionalCandCollection>             ctf_data(new L1MuRegionalCandCollection     );
  std::auto_ptr<L1CSCTrackCollection>               ctf_trk_data(new L1CSCTrackCollection           );
  std::auto_ptr<L1MuRegionalCandCollection>         rpc_cen_data(new L1MuRegionalCandCollection     );
  std::auto_ptr<L1MuRegionalCandCollection>         rpc_for_data(new L1MuRegionalCandCollection     );
  std::auto_ptr<LTCDigiCollection>                      ltc_data(new LTCDigiCollection              );
  std::auto_ptr<L1MuGMTCandCollection>                  gmt_data(new L1MuGMTCandCollection          );
  std::auto_ptr<L1MuGMTReadoutCollection>           gmt_rdt_data(new L1MuGMTReadoutCollection       ); 
  std::auto_ptr<L1GlobalTriggerReadoutRecord>       glt_rdt_data(new L1GlobalTriggerReadoutRecord   );
  std::auto_ptr<L1GlobalTriggerEvmReadoutRecord>    glt_evm_data(new L1GlobalTriggerEvmReadoutRecord);
  std::auto_ptr<L1GlobalTriggerObjectMapRecord>     glt_obj_data(new L1GlobalTriggerObjectMapRecord );

  if(verbose())
    std::cout << "L1EmulBias::produce - modify...\n" << std::flush; 

  if(m_doSys[ETP]) ModifyCollection(    ecal_tp_data,    ecal_tp_emul);
  if(m_doSys[HTP]) ModifyCollection(    hcal_tp_data,    hcal_tp_emul);
  if(m_doSys[RCT]) ModifyCollection(     rct_em_data,     rct_em_emul);
  if(m_doSys[RCT]) ModifyCollection(    rct_rgn_data,    rct_rgn_emul);
  if(m_doSys[GCT]) ModifyCollection(gct_isolaem_data,gct_isolaem_emul);
  if(m_doSys[GCT]) ModifyCollection(gct_noisoem_data,gct_noisoem_emul);
  if(m_doSys[GCT]) ModifyCollection(gct_cenjets_data,gct_cenjets_emul);
  if(m_doSys[GCT]) ModifyCollection(gct_forjets_data,gct_forjets_emul);
  if(m_doSys[GCT]) ModifyCollection(gct_taujets_data,gct_taujets_emul);
  if(m_doSys[DTP]) ModifyCollection(     dtp_ph_data,     dtp_ph_emul);
  if(m_doSys[DTP]) ModifyCollection(     dtp_th_data,     dtp_th_emul);
  if(m_doSys[DTF]) ModifyCollection(        dtf_data,        dtf_emul);
  if(m_doSys[DTF]) ModifyCollection(    dtf_trk_data,    dtf_trk_emul);
  if(m_doSys[CTP]) ModifyCollection(        ctp_data,        ctp_emul);
  if(m_doSys[CTF]) ModifyCollection(        ctf_data,        ctf_emul);
  if(m_doSys[CTF]) ModifyCollection(    ctf_trk_data,    ctf_trk_emul);
  if(m_doSys[RPC]) ModifyCollection(    rpc_cen_data,    rpc_cen_emul);
  if(m_doSys[RPC]) ModifyCollection(    rpc_for_data,    rpc_for_emul);
  if(m_doSys[LTC]) ModifyCollection(        ltc_data,        ltc_emul);
  if(m_doSys[GMT]) ModifyCollection(        gmt_data,        gmt_emul);
  if(m_doSys[GMT]) ModifyCollection(    gmt_rdt_data,    gmt_rdt_emul);
  if(m_doSys[GLT]) ModifyCollection(    glt_rdt_data,    glt_rdt_emul);
  if(m_doSys[GLT]) ModifyCollection(    glt_evm_data,    glt_evm_emul);
  if(m_doSys[GLT]) ModifyCollection(    glt_obj_data,    glt_obj_emul);

  if(verbose())
    std::cout << "L1EmulBias::produce - put...\n" << std::flush; 

  if(m_doSys[ETP]) iEvent.put(    ecal_tp_data, instName[ETP][0]);
  if(m_doSys[HTP]) iEvent.put(    hcal_tp_data, instName[HTP][0]);
  if(m_doSys[RCT]) iEvent.put(     rct_em_data, instName[RCT][0]);
  if(m_doSys[RCT]) iEvent.put(    rct_rgn_data, instName[RCT][0]);
  if(m_doSys[GCT]) iEvent.put(gct_isolaem_data, instName[GCT][0]);
  if(m_doSys[GCT]) iEvent.put(gct_noisoem_data, instName[GCT][1]);
  if(m_doSys[GCT]) iEvent.put(gct_cenjets_data, instName[GCT][2]);
  if(m_doSys[GCT]) iEvent.put(gct_forjets_data, instName[GCT][3]);
  if(m_doSys[GCT]) iEvent.put(gct_taujets_data, instName[GCT][4]);
  if(m_doSys[DTP]) iEvent.put(     dtp_ph_data, instName[DTP][0]);
  if(m_doSys[DTP]) iEvent.put(     dtp_th_data, instName[DTP][0]);
  if(m_doSys[DTF]) iEvent.put(        dtf_data, instName[DTF][0]);
  if(m_doSys[DTF]) iEvent.put(    dtf_trk_data, instName[DTF][1]);
  if(m_doSys[CTP]) iEvent.put(        ctp_data, instName[CTP][0]);
  if(m_doSys[CTF]) iEvent.put(        ctf_data, instName[CTF][0]);
  if(m_doSys[CTF]) iEvent.put(    ctf_trk_data, instName[CTF][1]);
  if(m_doSys[RPC]) iEvent.put(    rpc_cen_data, instName[RPC][0]);
  if(m_doSys[RPC]) iEvent.put(    rpc_for_data, instName[RPC][1]);
  if(m_doSys[LTC]) iEvent.put(        ltc_data, instName[LTC][0]);
  if(m_doSys[GMT]) iEvent.put(        gmt_data, instName[GMT][0]);
  if(m_doSys[GMT]) iEvent.put(    gmt_rdt_data, instName[GMT][0]);
  if(m_doSys[GLT]) iEvent.put(    glt_rdt_data, instName[GLT][0]);
  if(m_doSys[GLT]) iEvent.put(    glt_evm_data, instName[GLT][0]);
  if(m_doSys[GLT]) iEvent.put(    glt_obj_data, instName[GLT][0]);

  if(verbose())
    std::cout << "L1EmulBias::produce...done.\n" << std::flush; 

}
int L1EmulBias::verbose ( ) [inline, private]

Definition at line 56 of file L1EmulBias.h.

References verbose_.

Referenced by ModifyCollection().

{return verbose_;}

Member Data Documentation

std::string L1EmulBias::instName[dedefs::DEnsys][5] [private]

Definition at line 59 of file L1EmulBias.h.

Definition at line 57 of file L1EmulBias.h.

Definition at line 58 of file L1EmulBias.h.

CLHEP::RandFlat* L1EmulBias::rndFlat_ [private]

Definition at line 60 of file L1EmulBias.h.

Referenced by ModifyCollection().

CLHEP::RandGaussQ* L1EmulBias::rndGaus_ [private]

Definition at line 61 of file L1EmulBias.h.

int L1EmulBias::verbose_ [private]

Definition at line 55 of file L1EmulBias.h.

Referenced by verbose().