CMS 3D CMS Logo

SiStripRawToClustersRoI Class Reference

Author:
M.Wingham
More...

#include <EventFilter/SiStripRawToDigi/plugins/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 beginJob (const edm::EventSetup &)
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
 Defines regions of interest by bjets.
void electrons (const reco::SuperClusterCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
 Defines regions of interest by superclusters.
void muons (const reco::TrackCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
 Defines regions of interest by muons.
bool physicalLayer (SubDet &, uint32_t &) const
 Defines allowed physical layer numbers.
void random (RefGetter &, edm::Handle< LazyGetter > &) const
 Defines regions of interest randomly.
void taujets (const reco::CaloJetCollection &, RefGetter &, edm::Handle< LazyGetter > &) const
 Defines regions of interest by taujets.
void updateCabling (const edm::EventSetup &setup)

Private Attributes

std::vector< uint32_t > allregions_
 Record of all region numbers.
double bjetdeta_
double bjetdphi_
edm::InputTag bjetL2_
bool bjets_
const SiStripRegionCablingcabling_
 Cabling.
uint32_t cacheId_
edm::InputTag electronBarrelL2_
double electrondeta_
 deta/dphi to define regions of interest around physics objects
double electrondphi_
edm::InputTag electronEndcapL2_
bool electrons_
bool global_
 Booleans to define objects of interest.
double muondeta_
double muondphi_
edm::InputTag muonL2_
bool muons_
int nlayers_
 Layers of SST to unpack (from innermost).
bool random_
edm::InputTag siStripLazyGetter_
 reco module labels to define regions of interest
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

typedef edm::LazyGetter<SiStripCluster> SiStripRawToClustersRoI::LazyGetter

Definition at line 34 of file SiStripRawToClustersRoI.h.

typedef SiStripRegionCabling::Position SiStripRawToClustersRoI::Position

Definition at line 36 of file SiStripRawToClustersRoI.h.

typedef edm::RefGetter<SiStripCluster> SiStripRawToClustersRoI::RefGetter

Definition at line 35 of file SiStripRawToClustersRoI.h.

typedef SiStripRegionCabling::SubDet SiStripRawToClustersRoI::SubDet

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.

00008                                                                             :
00009   cabling_(0),
00010   cacheId_(0),
00011   allregions_(),
00012   nlayers_(conf.getUntrackedParameter<int>("Layers",-1)),
00013   global_(conf.getUntrackedParameter<bool>("Global",true)),
00014   random_(conf.getUntrackedParameter<bool>("Random",false)),
00015   electrons_(conf.getUntrackedParameter<bool>("Electrons",false)),
00016   muons_(conf.getUntrackedParameter<bool>("Muons",false)),
00017   taujets_(conf.getUntrackedParameter<bool>("TauJets",false)),
00018   bjets_(conf.getUntrackedParameter<bool>("BJets",false)),
00019   siStripLazyGetter_(conf.getParameter<edm::InputTag>("SiStripLazyGetter")),
00020   electronBarrelL2_(conf.getParameter<edm::InputTag>("ElectronBarrelL2")),
00021   electronEndcapL2_(conf.getParameter<edm::InputTag>("ElectronEndcapL2")),
00022   muonL2_(conf.getParameter<edm::InputTag>("MuonL2")),
00023   taujetL2_(conf.getParameter<edm::InputTag>("TauJetL2")),
00024   bjetL2_(conf.getParameter<edm::InputTag>("BJetL2")),
00025   electrondeta_(conf.getUntrackedParameter<double>("ElectronEtaWindow",0.2)),
00026   electrondphi_(conf.getUntrackedParameter<double>("ElectronPhiWindow",0.2)),
00027   muondeta_(conf.getUntrackedParameter<double>("MuonEtaWindow",0.2)),
00028   muondphi_(conf.getUntrackedParameter<double>("MuonPhiWindow",0.2)),
00029   taujetdeta_(conf.getUntrackedParameter<double>("TauJetEtaWindow",0.2)),
00030   taujetdphi_(conf.getUntrackedParameter<double>("TauJetPhiWindow",0.2)),
00031   bjetdeta_(conf.getUntrackedParameter<double>("BJetEtaWindow",0.2)),
00032   bjetdphi_(conf.getUntrackedParameter<double>("BJetPhiWindow",0.2))
00033 {
00034   produces< RefGetter >();
00035 }

SiStripRawToClustersRoI::~SiStripRawToClustersRoI (  ) 

Definition at line 37 of file SiStripRawToClustersRoI.cc.

00037 {}


Member Function Documentation

void SiStripRawToClustersRoI::beginJob ( const edm::EventSetup setup  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 39 of file SiStripRawToClustersRoI.cc.

00039                                                                  {
00040   //@@ unstable behaviour if uncommented!
00041   //updateCabling( setup );  
00042 }

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

Reimplemented from edm::EDProducer.

Definition at line 44 of file SiStripRawToClustersRoI.cc.

References updateCabling().

00044                                                                            {
00045   updateCabling( setup );  
00046 }

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

Defines regions of interest by bjets.

Definition at line 205 of file SiStripRawToClustersRoI.cc.

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

Referenced by produce().

00205                                                                                                                                           {
00206 
00207   reco::CaloJetCollection::const_iterator icollection = collection.begin();
00208   for (; icollection!=collection.end(); icollection++) {
00209     Position position(icollection->eta(),icollection->phi());
00210     for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
00211       SubDet subdet = static_cast<SubDet>(isubdet);
00212       for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
00213         if (!physicalLayer(subdet,ilayer)) break;
00214         cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,bjetdeta_,bjetdphi_,subdet,ilayer);
00215       }
00216     }    
00217   }
00218 }

void SiStripRawToClustersRoI::electrons ( const reco::SuperClusterCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by superclusters.

Definition at line 160 of file SiStripRawToClustersRoI.cc.

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

Referenced by produce().

00160                                                                                                                                                    {
00161   
00162   reco::SuperClusterCollection::const_iterator icollection = collection.begin();
00163   for (; icollection!=collection.end(); icollection++) {
00164     Position position(icollection->eta(),icollection->phi());
00165     for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
00166       SubDet subdet = static_cast<SubDet>(isubdet);
00167       for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
00168         if (!physicalLayer(subdet,ilayer)) break;
00169         cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,electrondeta_,electrondphi_,subdet,ilayer);
00170       }
00171     }    
00172   }
00173 }

void SiStripRawToClustersRoI::muons ( const reco::TrackCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by muons.

Definition at line 175 of file SiStripRawToClustersRoI.cc.

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

Referenced by produce().

00175                                                                                                                                         {
00176 
00177   reco::TrackCollection::const_iterator icollection = collection.begin();
00178   for (; icollection!=collection.end(); icollection++) {
00179     Position position(icollection->outerPosition().eta(),icollection->outerPosition().phi());
00180     for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
00181       SubDet subdet = static_cast<SubDet>(isubdet);
00182       for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
00183         if (!physicalLayer(subdet,ilayer)) break;
00184         cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,muondeta_,muondphi_,subdet,ilayer);
00185       }
00186     }    
00187   }
00188 }

bool SiStripRawToClustersRoI::physicalLayer ( SubDet subdet,
uint32_t &  layer 
) const [private]

Defines allowed physical layer numbers.

Definition at line 140 of file SiStripRawToClustersRoI.cc.

References nlayers_, and SiStripRegionCabling::physicalLayer().

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

00140                                                                                  {
00141   int signedlayer = static_cast<int>(SiStripRegionCabling::physicalLayer(subdet,layer));
00142   return (nlayers_ == -1 || signedlayer < nlayers_) ? true : false;
00143 }

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 48 of file SiStripRawToClustersRoI.cc.

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

00048                                                                                  {
00049   
00050   updateCabling( setup );  
00051   
00052   edm::Handle< LazyGetter > lazygetter;
00053   event.getByLabel(siStripLazyGetter_,lazygetter);
00054   
00056   
00057   if (global_) {
00058     std::auto_ptr<RefGetter> globalrefgetter(new RefGetter(lazygetter,allregions_));
00059     /*//unpack
00060       for (RefGetter::const_iterator iReg = globalrefgetter->begin(); iReg != globalrefgetter->end(); iReg++) *iReg;*/
00061     event.put(globalrefgetter);
00062     return;
00063   }
00064   
00065   std::auto_ptr<RefGetter> refgetter(new RefGetter(allregions_.size()));
00066   refgetter->reserve(10000);
00067   
00069   
00070   if (random_) {random(*refgetter,lazygetter);}
00071   
00073 
00074   if (electrons_) {
00075       try {
00076         edm::Handle<reco::SuperClusterCollection> barrelcollection;
00077         edm::Handle<reco::SuperClusterCollection> endcapcollection;
00078         event.getByLabel(electronBarrelL2_,barrelcollection);
00079         event.getByLabel(electronEndcapL2_,endcapcollection);
00080         electrons(*barrelcollection,*refgetter,lazygetter);
00081         electrons(*endcapcollection,*refgetter,lazygetter);
00082       } catch(...) {}
00083   }
00084 
00086 
00087   if (muons_) {
00088       try {
00089         edm::Handle<reco::TrackCollection> collection;
00090         event.getByLabel(muonL2_,collection);
00091         muons(*collection,*refgetter,lazygetter);
00092       } catch(...) {}
00093     }
00094   
00096 
00097   if (taujets_) {
00098       try {
00099         edm::Handle<reco::CaloJetCollection> collection;
00100         event.getByLabel(taujetL2_,collection);
00101         taujets(*collection,*refgetter,lazygetter);
00102       } catch(...) {}
00103     }
00104   
00106 
00107   if (bjets_) {
00108       try {
00109         edm::Handle<reco::CaloJetCollection> collection;
00110         event.getByLabel(bjetL2_,collection);
00111         bjets(*collection,*refgetter,lazygetter);
00112       } catch(...) {}
00113     }
00114   
00115   event.put(refgetter);
00116 }

void SiStripRawToClustersRoI::random ( RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest randomly.

Definition at line 145 of file SiStripRawToClustersRoI.cc.

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

Referenced by produce().

00145                                                                                                   {
00146   
00147   uint32_t total = cabling_->getRegionCabling().size();
00148   uint32_t required = static_cast<uint32_t>(RandFlat::shoot()*(total+1));
00149   for (uint32_t iregion = 0; iregion < required; iregion++) {
00150     for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
00151       SubDet subdet = static_cast<SubDet>(isubdet);
00152       for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
00153         if (!physicalLayer(subdet,ilayer)) break;
00154         cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,SiStripRegionCabling::elementIndex(iregion,subdet,ilayer));
00155       }
00156     }
00157   }
00158 }

void SiStripRawToClustersRoI::taujets ( const reco::CaloJetCollection collection,
RefGetter refgetter,
edm::Handle< LazyGetter > &  lazygetter 
) const [private]

Defines regions of interest by taujets.

Definition at line 190 of file SiStripRawToClustersRoI.cc.

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

Referenced by produce().

00190                                                                                                                                             {
00191 
00192   reco::CaloJetCollection::const_iterator icollection = collection.begin();
00193   for (; icollection!=collection.end(); icollection++) {
00194     Position position(icollection->eta(),icollection->phi());
00195     for (uint32_t isubdet = 0; isubdet < SiStripRegionCabling::ALLSUBDETS; isubdet++) {
00196       SubDet subdet = static_cast<SubDet>(isubdet);
00197       for (uint32_t ilayer = 0; ilayer < SiStripRegionCabling::ALLLAYERS; ilayer++) {
00198         if (!physicalLayer(subdet,ilayer)) break;
00199         cabling_->updateSiStripRefGetter<SiStripCluster>(refgetter,lazygetter,position,taujetdeta_,taujetdphi_,subdet,ilayer);
00200       }
00201     }    
00202   }
00203 }

void SiStripRawToClustersRoI::updateCabling ( const edm::EventSetup setup  )  [private]

Definition at line 120 of file SiStripRawToClustersRoI.cc.

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

Referenced by beginRun(), and produce().

00120                                                                         {
00121   uint32_t cache_id = setup.get<SiStripRegionCablingRcd>().cacheIdentifier();
00122   if ( cacheId_ != cache_id ) {
00123     edm::ESHandle<SiStripRegionCabling> c;
00124     setup.get<SiStripRegionCablingRcd>().get( c );
00125     cabling_ = c.product();
00126     cacheId_ = cache_id;
00127     allregions_.clear();
00128     allregions_.reserve( cabling_->getRegionCabling().size() );
00129     for (uint32_t iregion=0;iregion<cabling_->getRegionCabling().size();iregion++) {
00130       for (uint32_t isubdet=0;isubdet<cabling_->getRegionCabling()[iregion].size();isubdet++) {  
00131         for (uint32_t ilayer=0;ilayer<cabling_->getRegionCabling()[iregion][isubdet].size();ilayer++) {
00132           uint32_t index = SiStripRegionCabling::elementIndex(iregion,static_cast<SubDet>(isubdet),ilayer);
00133           allregions_.push_back(index);
00134         }
00135       }
00136     }
00137   }
00138 }


Member Data Documentation

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

Record of all region numbers.

Definition at line 74 of file SiStripRawToClustersRoI.h.

Referenced by produce(), and updateCabling().

double SiStripRawToClustersRoI::bjetdeta_ [private]

Definition at line 102 of file SiStripRawToClustersRoI.h.

Referenced by bjets().

double SiStripRawToClustersRoI::bjetdphi_ [private]

Definition at line 103 of file SiStripRawToClustersRoI.h.

Referenced by bjets().

edm::InputTag SiStripRawToClustersRoI::bjetL2_ [private]

Definition at line 93 of file SiStripRawToClustersRoI.h.

Referenced by produce().

bool SiStripRawToClustersRoI::bjets_ [private]

Definition at line 85 of file SiStripRawToClustersRoI.h.

Referenced by produce().

const SiStripRegionCabling* SiStripRawToClustersRoI::cabling_ [private]

Cabling.

Definition at line 69 of file SiStripRawToClustersRoI.h.

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

uint32_t SiStripRawToClustersRoI::cacheId_ [private]

Definition at line 71 of file SiStripRawToClustersRoI.h.

Referenced by updateCabling().

edm::InputTag SiStripRawToClustersRoI::electronBarrelL2_ [private]

Definition at line 89 of file SiStripRawToClustersRoI.h.

Referenced by produce().

double SiStripRawToClustersRoI::electrondeta_ [private]

deta/dphi to define regions of interest around physics objects

Definition at line 96 of file SiStripRawToClustersRoI.h.

Referenced by electrons().

double SiStripRawToClustersRoI::electrondphi_ [private]

Definition at line 97 of file SiStripRawToClustersRoI.h.

Referenced by electrons().

edm::InputTag SiStripRawToClustersRoI::electronEndcapL2_ [private]

Definition at line 90 of file SiStripRawToClustersRoI.h.

Referenced by produce().

bool SiStripRawToClustersRoI::electrons_ [private]

Definition at line 82 of file SiStripRawToClustersRoI.h.

Referenced by produce().

bool SiStripRawToClustersRoI::global_ [private]

Booleans to define objects of interest.

Definition at line 80 of file SiStripRawToClustersRoI.h.

Referenced by produce().

double SiStripRawToClustersRoI::muondeta_ [private]

Definition at line 98 of file SiStripRawToClustersRoI.h.

Referenced by muons().

double SiStripRawToClustersRoI::muondphi_ [private]

Definition at line 99 of file SiStripRawToClustersRoI.h.

Referenced by muons().

edm::InputTag SiStripRawToClustersRoI::muonL2_ [private]

Definition at line 91 of file SiStripRawToClustersRoI.h.

Referenced by produce().

bool SiStripRawToClustersRoI::muons_ [private]

Definition at line 83 of file SiStripRawToClustersRoI.h.

Referenced by produce().

int SiStripRawToClustersRoI::nlayers_ [private]

Layers of SST to unpack (from innermost).

Definition at line 77 of file SiStripRawToClustersRoI.h.

Referenced by physicalLayer().

bool SiStripRawToClustersRoI::random_ [private]

Definition at line 81 of file SiStripRawToClustersRoI.h.

Referenced by produce().

edm::InputTag SiStripRawToClustersRoI::siStripLazyGetter_ [private]

reco module labels to define regions of interest

Definition at line 88 of file SiStripRawToClustersRoI.h.

Referenced by produce().

double SiStripRawToClustersRoI::taujetdeta_ [private]

Definition at line 100 of file SiStripRawToClustersRoI.h.

Referenced by taujets().

double SiStripRawToClustersRoI::taujetdphi_ [private]

Definition at line 101 of file SiStripRawToClustersRoI.h.

Referenced by taujets().

edm::InputTag SiStripRawToClustersRoI::taujetL2_ [private]

Definition at line 92 of file SiStripRawToClustersRoI.h.

Referenced by produce().

bool SiStripRawToClustersRoI::taujets_ [private]

Definition at line 84 of file SiStripRawToClustersRoI.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:32 2009 for CMSSW by  doxygen 1.5.4