CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalTPSkimmer Class Reference

#include <EcalTPSkimmer.h>

Inheritance diagram for EcalTPSkimmer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EcalTPSkimmer (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &evt, const edm::EventSetup &es)
 
 ~EcalTPSkimmer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

bool alreadyInserted (EcalTrigTowerDetId ttId)
 
void insertTP (EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
 

Private Attributes

std::vector< uint32_t > chStatusToSelectTP_
 
bool doBarrel_
 
bool doEndcap_
 
std::set< EcalTrigTowerDetIdinsertedTP_
 
bool skipModule_
 
std::string tpCollection_
 
edm::EDGetTokenT
< EcalTrigPrimDigiCollection
tpInputToken_
 
std::string tpOutputCollection_
 
edm::ESHandle
< EcalTrigTowerConstituentsMap
ttMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

produce a subset of TP information

Author
Federico Ferri, CEA/Saclay Irfu/SPP

Definition at line 22 of file EcalTPSkimmer.h.

Constructor & Destructor Documentation

EcalTPSkimmer::EcalTPSkimmer ( const edm::ParameterSet ps)
explicit

Definition at line 24 of file EcalTPSkimmer.cc.

References chStatusToSelectTP_, doBarrel_, doEndcap_, edm::ParameterSet::getParameter(), skipModule_, AlCaHLTBitMon_QueryRunRegistry::string, tpInputToken_, and tpOutputCollection_.

25 {
26  skipModule_ = ps.getParameter<bool>("skipModule");
27 
28  doBarrel_ = ps.getParameter<bool>("doBarrel");
29  doEndcap_ = ps.getParameter<bool>("doEndcap");
30 
31  chStatusToSelectTP_ = ps.getParameter<std::vector<uint32_t> >("chStatusToSelectTP");
32 
33  tpOutputCollection_ = ps.getParameter<std::string>("tpOutputCollection");
34  tpInputToken_ = consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("tpInputCollection"));
35 
36  produces< EcalTrigPrimDigiCollection >(tpOutputCollection_);
37 }
T getParameter(std::string const &) const
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:40
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:47
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:45
EcalTPSkimmer::~EcalTPSkimmer ( )

Definition at line 39 of file EcalTPSkimmer.cc.

40 {
41 }

Member Function Documentation

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 124 of file EcalTPSkimmer.cc.

References insertedTP_.

Referenced by produce().

125 {
126  return ( insertedTP_.find( ttId ) != insertedTP_.end() );
127 }
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void EcalTPSkimmer::insertTP ( EcalTrigTowerDetId  ttId,
edm::Handle< EcalTrigPrimDigiCollection > &  in,
EcalTrigPrimDigiCollection out 
)
private

Definition at line 130 of file EcalTPSkimmer.cc.

References insertedTP_, and edm::SortedCollection< T, SORT >::push_back().

Referenced by produce().

131 {
132  EcalTrigPrimDigiCollection::const_iterator tpIt = tpIn->find( ttId );
133  if ( tpIt != tpIn->end() ) {
134  tpOut.push_back( *tpIt );
135  insertedTP_.insert( ttId );
136  }
137 }
std::vector< EcalTriggerPrimitiveDigi >::const_iterator const_iterator
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void EcalTPSkimmer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 44 of file EcalTPSkimmer.cc.

References alreadyInserted(), chStatusToSelectTP_, EBDetId::detIdFromDenseIndex(), EEDetId::detIdFromDenseIndex(), doBarrel_, doEndcap_, spr::find(), edm::EventSetup::get(), edm::Event::getByToken(), i, insertedTP_, insertTP(), EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, edm::Event::put(), skipModule_, tpInputToken_, tpOutputCollection_, ttMap_, EBDetId::validDenseIndex(), and EEDetId::validDenseIndex().

45 {
46  insertedTP_.clear();
47 
48  using namespace edm;
49 
50  es.get<IdealGeometryRecord>().get(ttMap_);
51 
52  // collection of rechits to put in the event
53  std::auto_ptr< EcalTrigPrimDigiCollection > tpOut( new EcalTrigPrimDigiCollection );
54 
55  if ( skipModule_ ) {
56  evt.put( tpOut, tpOutputCollection_ );
57  return;
58  }
59 
61  es.get<EcalChannelStatusRcd>().get(chStatus);
62 
64  evt.getByToken(tpInputToken_, tpIn);
65 
66 
67  if ( doBarrel_ ) {
69  uint16_t code = 0;
70  for ( int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i )
71  {
72  if ( ! EBDetId::validDenseIndex( i ) ) continue;
74  chit = chStatus->find( id );
75  // check if the channel status means TP to be kept
76  if ( chit != chStatus->end() ) {
77  code = (*chit).getStatusCode() & 0x001F;
78  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
79  // retrieve the TP DetId
80  EcalTrigTowerDetId ttDetId( ((EBDetId)id).tower() );
81  // insert the TP if not done already
82  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
83  }
84  } else {
85  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
86  << id.rawId()
87  << "! something wrong with EcalChannelStatus in your DB? ";
88  }
89  }
90  }
91 
92  if ( doEndcap_ ) {
94  uint16_t code = 0;
95  for ( int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i )
96  {
97  if ( ! EEDetId::validDenseIndex( i ) ) continue;
99  chit = chStatus->find( id );
100  // check if the channel status means TP to be kept
101  if ( chit != chStatus->end() ) {
102  code = (*chit).getStatusCode() & 0x001F;
103  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
104  // retrieve the TP DetId
105  EcalTrigTowerDetId ttDetId = ttMap_->towerOf( id );
106  // insert the TP if not done already
107  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
108  }
109  } else {
110  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
111  << id.rawId()
112  << "! something wrong with EcalChannelStatus in your DB? ";
113  }
114  }
115  }
116 
117  // put the collection of reconstructed hits in the event
118  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
119 
120  evt.put( tpOut, tpOutputCollection_ );
121 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:220
int i
Definition: DBlmapReader.cc:9
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:40
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:43
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static EBDetId detIdFromDenseIndex(uint32_t di)
Definition: EBDetId.h:111
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:41
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:47
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
bool alreadyInserted(EcalTrigTowerDetId ttId)
void insertTP(EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:213
edm::EDGetTokenT< EcalTrigPrimDigiCollection > tpInputToken_
Definition: EcalTPSkimmer.h:45
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:109

Member Data Documentation

std::vector<uint32_t> EcalTPSkimmer::chStatusToSelectTP_
private

Definition at line 40 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doBarrel_
private

Definition at line 37 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doEndcap_
private

Definition at line 38 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::set<EcalTrigTowerDetId> EcalTPSkimmer::insertedTP_
private

Definition at line 43 of file EcalTPSkimmer.h.

Referenced by alreadyInserted(), insertTP(), and produce().

bool EcalTPSkimmer::skipModule_
private

Definition at line 36 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 34 of file EcalTPSkimmer.h.

edm::EDGetTokenT<EcalTrigPrimDigiCollection> EcalTPSkimmer::tpInputToken_
private

Definition at line 45 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 47 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

edm::ESHandle<EcalTrigTowerConstituentsMap> EcalTPSkimmer::ttMap_
private

Definition at line 41 of file EcalTPSkimmer.h.

Referenced by produce().