CMS 3D CMS Logo

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

SiStripRawToClustersRoI Class Reference

#include <SiStripRawToClustersRoI.h>

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

List of all members.

Public Types

typedef edm::LazyGetter
< SiStripCluster
LazyGetter
typedef
SiStripRegionCabling::Position 
Position
typedef edm::RefGetter
< SiStripCluster
RefGetter
typedef
SiStripRegionCabling::SubDet 
SubDet

Public Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 SiStripRawToClustersRoI (const edm::ParameterSet &)
 ~SiStripRawToClustersRoI ()

Private Member Functions

void bjets (const reco::CaloJetCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
void electrons (const reco::SuperClusterCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
void muons (const reco::TrackCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
bool physicalLayer (SubDet &, uint32_t &) const
void random (RefGetter &, edm::Handle< LazyGetter > &) const
void taujets (const reco::CaloJetCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
void updateCabling (const edm::EventSetup &setup)

Private Attributes

std::vector< uint32_t > allregions_
double bjetdeta_
double bjetdphi_
edm::InputTag bjetL2_
bool bjets_
const SiStripRegionCablingcabling_
uint32_t cacheId_
edm::InputTag electronBarrelL2_
double electrondeta_
double electrondphi_
edm::InputTag electronEndcapL2_
bool electrons_
bool global_
double muondeta_
double muondphi_
edm::InputTag muonL2_
bool muons_
int nlayers_
bool random_
edm::InputTag siStripLazyGetter_
double taujetdeta_
double taujetdphi_
edm::InputTag taujetL2_
bool taujets_

Detailed Description

Author:
M.Wingham

Definition at line 30 of file SiStripRawToClustersRoI.h.


Member Typedef Documentation

Definition at line 34 of file SiStripRawToClustersRoI.h.

Definition at line 36 of file SiStripRawToClustersRoI.h.

Definition at line 35 of file SiStripRawToClustersRoI.h.

Definition at line 37 of file SiStripRawToClustersRoI.h.


Constructor & Destructor Documentation

SiStripRawToClustersRoI::SiStripRawToClustersRoI ( const edm::ParameterSet conf)

Definition at line 8 of file SiStripRawToClustersRoI.cc.

                                                                            :
  cabling_(0),
  cacheId_(0),
  allregions_(),
  nlayers_(conf.getUntrackedParameter<int>("Layers",-1)),
  global_(conf.getUntrackedParameter<bool>("Global",true)),
  random_(conf.getUntrackedParameter<bool>("Random",false)),
  electrons_(conf.getUntrackedParameter<bool>("Electrons",false)),
  muons_(conf.getUntrackedParameter<bool>("Muons",false)),
  taujets_(conf.getUntrackedParameter<bool>("TauJets",false)),
  bjets_(conf.getUntrackedParameter<bool>("BJets",false)),
  siStripLazyGetter_(conf.getParameter<edm::InputTag>("SiStripLazyGetter")),
  electronBarrelL2_(conf.getParameter<edm::InputTag>("ElectronBarrelL2")),
  electronEndcapL2_(conf.getParameter<edm::InputTag>("ElectronEndcapL2")),
  muonL2_(conf.getParameter<edm::InputTag>("MuonL2")),
  taujetL2_(conf.getParameter<edm::InputTag>("TauJetL2")),
  bjetL2_(conf.getParameter<edm::InputTag>("BJetL2")),
  electrondeta_(conf.getUntrackedParameter<double>("ElectronEtaWindow",0.2)),
  electrondphi_(conf.getUntrackedParameter<double>("ElectronPhiWindow",0.2)),
  muondeta_(conf.getUntrackedParameter<double>("MuonEtaWindow",0.2)),
  muondphi_(conf.getUntrackedParameter<double>("MuonPhiWindow",0.2)),
  taujetdeta_(conf.getUntrackedParameter<double>("TauJetEtaWindow",0.2)),
  taujetdphi_(conf.getUntrackedParameter<double>("TauJetPhiWindow",0.2)),
  bjetdeta_(conf.getUntrackedParameter<double>("BJetEtaWindow",0.2)),
  bjetdphi_(conf.getUntrackedParameter<double>("BJetPhiWindow",0.2))
{
  produces< RefGetter >();
}
SiStripRawToClustersRoI::~SiStripRawToClustersRoI ( )

Definition at line 37 of file SiStripRawToClustersRoI.cc.

{}

Member Function Documentation

void SiStripRawToClustersRoI::beginRun ( edm::Run ,
const edm::EventSetup setup 
) [virtual]

Reimplemented from edm::EDProducer.

Definition at line 39 of file SiStripRawToClustersRoI.cc.

References updateCabling().

                                                                           {
  updateCabling( setup );  
}
void SiStripRawToClustersRoI::bjets ( const reco::CaloJetCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by bjets

Definition at line 202 of file SiStripRawToClustersRoI.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, bjetdeta_, bjetdphi_, cabling_, physicalLayer(), position, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by produce().

                                                                                                                                          {

  reco::CaloJetCollection::const_iterator icollection = collection.begin();
  for (; icollection!=collection.end(); icollection++) {
    Position position(icollection->eta(),icollection->phi());
    for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
      SubDet subdet = static_cast<SubDet>(isubdet);
      for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
        if (!physicalLayer(subdet,ilayer)) break;
        cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,bjetdeta_,bjetdphi_,subdet,ilayer);
      }
    }    
  }
}
void SiStripRawToClustersRoI::electrons ( const reco::SuperClusterCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by superclusters

Definition at line 157 of file SiStripRawToClustersRoI.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, cabling_, electrondeta_, electrondphi_, physicalLayer(), position, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by produce().

                                                                                                                                                   {
  
  reco::SuperClusterCollection::const_iterator icollection = collection.begin();
  for (; icollection!=collection.end(); icollection++) {
    Position position(icollection->eta(),icollection->phi());
    for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
      SubDet subdet = static_cast<SubDet>(isubdet);
      for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
        if (!physicalLayer(subdet,ilayer)) break;
        cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,electrondeta_,electrondphi_,subdet,ilayer);
      }
    }    
  }
}
void SiStripRawToClustersRoI::muons ( const reco::TrackCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by muons

Definition at line 172 of file SiStripRawToClustersRoI.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, cabling_, muondeta_, muondphi_, physicalLayer(), position, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by produce().

                                                                                                                                        {

  reco::TrackCollection::const_iterator icollection = collection.begin();
  for (; icollection!=collection.end(); icollection++) {
    Position position(icollection->outerPosition().eta(),icollection->outerPosition().phi());
    for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
      SubDet subdet = static_cast<SubDet>(isubdet);
      for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
        if (!physicalLayer(subdet,ilayer)) break;
        cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,muondeta_,muondphi_,subdet,ilayer);
      }
    }    
  }
}
bool SiStripRawToClustersRoI::physicalLayer ( SubDet subdet,
uint32_t &  layer 
) const [private]

Defines allowed physical layer numbers

Definition at line 137 of file SiStripRawToClustersRoI.cc.

References nlayers_.

Referenced by bjets(), electrons(), muons(), random(), and taujets().

                                                                                 {
  int signedlayer = static_cast<int>(SiStripRegionCabling::physicalLayer(subdet,layer));
  return (nlayers_ == -1 || signedlayer < nlayers_) ? true : false;
}
void SiStripRawToClustersRoI::produce ( edm::Event event,
const edm::EventSetup setup 
) [virtual]

All regions

Random region number. Starts from 0.

Seeded by L2 electrons.

Seeded by L2 muons.

Seeded by L2 taujets.

Seeded by L2 bjets.

Implements edm::EDProducer.

Definition at line 43 of file SiStripRawToClustersRoI.cc.

References allregions_, bjetL2_, bjets(), bjets_, runEdmFileComparison::collection, electronBarrelL2_, electronEndcapL2_, electrons(), electrons_, global_, edm::HandleBase::isValid(), muonL2_, muons(), muons_, random(), random_, siStripLazyGetter_, taujetL2_, taujets(), taujets_, and updateCabling().

                                                                                 {
  
  updateCabling( setup );  
  
  edm::Handle< LazyGetter > lazygetter;
  event.getByLabel(siStripLazyGetter_,lazygetter);
  
  
  if (global_) {
    std::auto_ptr<RefGetter> globalrefgetter(new RefGetter(lazygetter,allregions_));
    /*//unpack
      for (RefGetter::const_iterator iReg = globalrefgetter->begin(); iReg != globalrefgetter->end(); iReg++) *iReg;*/
    event.put(globalrefgetter);
    return;
  }
  
  std::auto_ptr<RefGetter> refgetter(new RefGetter(allregions_.size()));
  refgetter->reserve(10000);
  
  
  if (random_) {random(*refgetter,lazygetter);}
  

  if (electrons_) {
        edm::Handle<reco::SuperClusterCollection> barrelcollection;
        edm::Handle<reco::SuperClusterCollection> endcapcollection;
        event.getByLabel(electronBarrelL2_,barrelcollection);
        event.getByLabel(electronEndcapL2_,endcapcollection);
        if (barrelcollection.isValid()) {
          electrons(*barrelcollection,*refgetter,lazygetter);
        }
        if (endcapcollection.isValid()) {
          electrons(*endcapcollection,*refgetter,lazygetter);
        }
  }


  if (muons_) {
        edm::Handle<reco::TrackCollection> collection;
        event.getByLabel(muonL2_,collection);
        if (collection.isValid()) {
          muons(*collection,*refgetter,lazygetter);
        }
    }
  

  if (taujets_) {
        edm::Handle<reco::CaloJetCollection> collection;
        event.getByLabel(taujetL2_,collection);
        if (collection.isValid()) {
          taujets(*collection,*refgetter,lazygetter);
        }
    }
  

  if (bjets_) {
        edm::Handle<reco::CaloJetCollection> collection;
        event.getByLabel(bjetL2_,collection);
        if (collection.isValid()) {
          bjets(*collection,*refgetter,lazygetter);
        }
    }
  
  event.put(refgetter);
}
void SiStripRawToClustersRoI::random ( RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest randomly

Definition at line 142 of file SiStripRawToClustersRoI.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, cabling_, SiStripRegionCabling::elementIndex(), SiStripRegionCabling::getRegionCabling(), physicalLayer(), pileupDistInMC::total, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by produce().

                                                                                                  {
  
  uint32_t total = cabling_->getRegionCabling().size();
  uint32_t required = static_cast<uint32_t>(CLHEP::RandFlat::shoot()*(total+1));
  for (uint32_t iregion = 0; iregion < required; iregion++) {
    for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
      SubDet subdet = static_cast<SubDet>(isubdet);
      for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
        if (!physicalLayer(subdet,ilayer)) break;
        cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,SiStripRegionCabling::elementIndex(iregion,subdet,ilayer));
      }
    }
  }
}
void SiStripRawToClustersRoI::taujets ( const reco::CaloJetCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by taujets

Definition at line 187 of file SiStripRawToClustersRoI.cc.

References SiStripRegionCabling::ALLLAYERS, SiStripRegionCabling::ALLSUBDETS, cabling_, physicalLayer(), position, taujetdeta_, taujetdphi_, and SiStripRegionCabling::updateSiStripRefGetter().

Referenced by produce().

                                                                                                                                            {

  reco::CaloJetCollection::const_iterator icollection = collection.begin();
  for (; icollection!=collection.end(); icollection++) {
    Position position(icollection->eta(),icollection->phi());
    for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
      SubDet subdet = static_cast<SubDet>(isubdet);
      for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
        if (!physicalLayer(subdet,ilayer)) break;
        cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,taujetdeta_,taujetdphi_,subdet,ilayer);
      }
    }    
  }
}
void SiStripRawToClustersRoI::updateCabling ( const edm::EventSetup setup) [private]

Definition at line 117 of file SiStripRawToClustersRoI.cc.

References allregions_, trackerHits::c, cabling_, cacheId_, SiStripRegionCabling::elementIndex(), edm::EventSetup::get(), SiStripRegionCabling::getRegionCabling(), getHLTprescales::index, and edm::ESHandle< T >::product().

Referenced by beginRun(), and produce().

                                                                        {
  uint32_t cache_id = setup.get<SiStripRegionCablingRcd>().cacheIdentifier();
  if ( cacheId_ != cache_id ) {
    edm::ESHandle<SiStripRegionCabling> c;
    setup.get<SiStripRegionCablingRcd>().get( c );
    cabling_ = c.product();
    cacheId_ = cache_id;
    allregions_.clear();
    allregions_.reserve( cabling_->getRegionCabling().size() );
    for (uint32_t iregion=0;iregion<cabling_->getRegionCabling().size();iregion++) {
      for (uint32_t isubdet=0;isubdet<cabling_->getRegionCabling()[iregion].size();isubdet++) {  
        for (uint32_t ilayer=0;ilayer<cabling_->getRegionCabling()[iregion][isubdet].size();ilayer++) {
          uint32_t index = SiStripRegionCabling::elementIndex(iregion,static_cast<SubDet>(isubdet),ilayer);
          allregions_.push_back(index);
        }
      }
    }
  }
}

Member Data Documentation

std::vector<uint32_t> SiStripRawToClustersRoI::allregions_ [private]

Record of all region numbers

Definition at line 73 of file SiStripRawToClustersRoI.h.

Referenced by produce(), and updateCabling().

Definition at line 101 of file SiStripRawToClustersRoI.h.

Referenced by bjets().

Definition at line 102 of file SiStripRawToClustersRoI.h.

Referenced by bjets().

Definition at line 92 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 84 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Cabling

Definition at line 68 of file SiStripRawToClustersRoI.h.

Referenced by bjets(), electrons(), muons(), random(), taujets(), and updateCabling().

Definition at line 70 of file SiStripRawToClustersRoI.h.

Referenced by updateCabling().

Definition at line 88 of file SiStripRawToClustersRoI.h.

Referenced by produce().

deta/dphi to define regions of interest around physics objects

Definition at line 95 of file SiStripRawToClustersRoI.h.

Referenced by electrons().

Definition at line 96 of file SiStripRawToClustersRoI.h.

Referenced by electrons().

Definition at line 89 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 81 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Booleans to define objects of interest

Definition at line 79 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 97 of file SiStripRawToClustersRoI.h.

Referenced by muons().

Definition at line 98 of file SiStripRawToClustersRoI.h.

Referenced by muons().

Definition at line 90 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 82 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Layers of SST to unpack (from innermost)

Definition at line 76 of file SiStripRawToClustersRoI.h.

Referenced by physicalLayer().

Definition at line 80 of file SiStripRawToClustersRoI.h.

Referenced by produce().

reco module labels to define regions of interest

Definition at line 87 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 99 of file SiStripRawToClustersRoI.h.

Referenced by taujets().

Definition at line 100 of file SiStripRawToClustersRoI.h.

Referenced by taujets().

Definition at line 91 of file SiStripRawToClustersRoI.h.

Referenced by produce().

Definition at line 83 of file SiStripRawToClustersRoI.h.

Referenced by produce().