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::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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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::InputTag tpInputCollection_
 
std::string tpOutputCollection_
 
edm::ESHandle
< EcalTrigTowerConstituentsMap
ttMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

produce a subset of TP information

Id:
EcalTPSkimmer.cc,v 1.1 2010/10/01 16:27:18 ferriff Exp
Date:
2010/10/01 16:27:18
Revision:
1.1
Author
Federico Ferri, CEA/Saclay Irfu/SPP

produce a subset of TP information

Id:
EcalTPSkimmer.cc,v 1.13 2010/09/29 15:31:27 ferriff Exp
Date:
2010/09/29 15:31:27
Revision:
1.13
Author
Federico Ferri, CEA/Saclay Irfu/SPP

Definition at line 25 of file EcalTPSkimmer.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file EcalTPSkimmer.cc.

References chStatusToSelectTP_, doBarrel_, doEndcap_, edm::ParameterSet::getParameter(), skipModule_, tpInputCollection_, and tpOutputCollection_.

28 {
29  skipModule_ = ps.getParameter<bool>("skipModule");
30 
31  doBarrel_ = ps.getParameter<bool>("doBarrel");
32  doEndcap_ = ps.getParameter<bool>("doEndcap");
33 
34  chStatusToSelectTP_ = ps.getParameter<std::vector<uint32_t> >("chStatusToSelectTP");
35 
36  tpOutputCollection_ = ps.getParameter<std::string>("tpOutputCollection");
37  tpInputCollection_ = ps.getParameter<edm::InputTag>("tpInputCollection");
38 
39  produces< EcalTrigPrimDigiCollection >(tpOutputCollection_);
40 }
T getParameter(std::string const &) const
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:43
edm::InputTag tpInputCollection_
Definition: EcalTPSkimmer.h:48
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:50
EcalTPSkimmer::~EcalTPSkimmer ( )

Definition at line 42 of file EcalTPSkimmer.cc.

43 {
44 }

Member Function Documentation

bool EcalTPSkimmer::alreadyInserted ( EcalTrigTowerDetId  ttId)
private

Definition at line 132 of file EcalTPSkimmer.cc.

References insertedTP_.

Referenced by produce().

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

Definition at line 138 of file EcalTPSkimmer.cc.

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

Referenced by produce().

139 {
140  EcalTrigPrimDigiCollection::const_iterator tpIt = tpIn->find( ttId );
141  if ( tpIt != tpIn->end() ) {
142  tpOut.push_back( *tpIt );
143  insertedTP_.insert( ttId );
144  }
145 }
std::vector< T >::const_iterator const_iterator
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:46
void EcalTPSkimmer::produce ( edm::Event evt,
const edm::EventSetup es 
)
virtual

Implements edm::EDProducer.

Definition at line 47 of file EcalTPSkimmer.cc.

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

48 {
49  insertedTP_.clear();
50 
51  using namespace edm;
52 
53  es.get<IdealGeometryRecord>().get(ttMap_);
54 
55  // collection of rechits to put in the event
56  std::auto_ptr< EcalTrigPrimDigiCollection > tpOut( new EcalTrigPrimDigiCollection );
57 
58  if ( skipModule_ ) {
59  evt.put( tpOut, tpOutputCollection_ );
60  return;
61  }
62 
64  es.get<EcalChannelStatusRcd>().get(chStatus);
65 
67  evt.getByLabel(tpInputCollection_, tpIn);
68 
69  if ( ! tpIn.isValid() ) {
70  edm::LogError("EcalTPSkimmer") << "Can't get the product " << tpInputCollection_.instance()
71  << " with label " << tpInputCollection_.label();
72  return;
73  }
74 
75  if ( doBarrel_ ) {
77  uint16_t code = 0;
78  for ( int i = 0; i < EBDetId::kSizeForDenseIndexing; ++i )
79  {
80  if ( ! EBDetId::validDenseIndex( i ) ) continue;
82  chit = chStatus->find( id );
83  // check if the channel status means TP to be kept
84  if ( chit != chStatus->end() ) {
85  code = (*chit).getStatusCode() & 0x001F;
86  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
87  // retrieve the TP DetId
88  EcalTrigTowerDetId ttDetId( ((EBDetId)id).tower() );
89  // insert the TP if not done already
90  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
91  }
92  } else {
93  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
94  << id.rawId()
95  << "! something wrong with EcalChannelStatus in your DB? ";
96  }
97  }
98  }
99 
100  if ( doEndcap_ ) {
102  uint16_t code = 0;
103  for ( int i = 0; i < EEDetId::kSizeForDenseIndexing; ++i )
104  {
105  if ( ! EEDetId::validDenseIndex( i ) ) continue;
107  chit = chStatus->find( id );
108  // check if the channel status means TP to be kept
109  if ( chit != chStatus->end() ) {
110  code = (*chit).getStatusCode() & 0x001F;
111  if ( std::find( chStatusToSelectTP_.begin(), chStatusToSelectTP_.end(), code ) != chStatusToSelectTP_.end() ) {
112  // retrieve the TP DetId
113  EcalTrigTowerDetId ttDetId = ttMap_->towerOf( id );
114  // insert the TP if not done already
115  if ( ! alreadyInserted( ttDetId ) ) insertTP( ttDetId, tpIn, *tpOut );
116  }
117  } else {
118  edm::LogError("EcalDetIdToBeRecoveredProducer") << "No channel status found for xtal "
119  << id.rawId()
120  << "! something wrong with EcalChannelStatus in your DB? ";
121  }
122  }
123  }
124 
125  // put the collection of reconstructed hits in the event
126  LogInfo("EcalTPSkimmer") << "total # of TP inserted: " << tpOut->size();
127 
128  evt.put( tpOut, tpOutputCollection_ );
129 }
static EEDetId detIdFromDenseIndex(uint32_t din)
Definition: EEDetId.h:215
int i
Definition: DBlmapReader.cc:9
std::vector< uint32_t > chStatusToSelectTP_
Definition: EcalTPSkimmer.h:43
edm::InputTag tpInputCollection_
Definition: EcalTPSkimmer.h:48
std::set< EcalTrigTowerDetId > insertedTP_
Definition: EcalTPSkimmer.h:46
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:98
edm::ESHandle< EcalTrigTowerConstituentsMap > ttMap_
Definition: EcalTPSkimmer.h:44
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
std::string tpOutputCollection_
Definition: EcalTPSkimmer.h:50
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
bool alreadyInserted(EcalTrigTowerDetId ttId)
std::string const & label() const
Definition: InputTag.h:25
void insertTP(EcalTrigTowerDetId ttId, edm::Handle< EcalTrigPrimDigiCollection > &in, EcalTrigPrimDigiCollection &out)
static bool validDenseIndex(uint32_t din)
Definition: EEDetId.h:208
std::string const & instance() const
Definition: InputTag.h:26
static bool validDenseIndex(uint32_t din)
Definition: EBDetId.h:96

Member Data Documentation

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

Definition at line 43 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doBarrel_
private

Definition at line 40 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

bool EcalTPSkimmer::doEndcap_
private

Definition at line 41 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 46 of file EcalTPSkimmer.h.

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

bool EcalTPSkimmer::skipModule_
private

Definition at line 39 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpCollection_
private

Definition at line 37 of file EcalTPSkimmer.h.

edm::InputTag EcalTPSkimmer::tpInputCollection_
private

Definition at line 48 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

std::string EcalTPSkimmer::tpOutputCollection_
private

Definition at line 50 of file EcalTPSkimmer.h.

Referenced by EcalTPSkimmer(), and produce().

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

Definition at line 44 of file EcalTPSkimmer.h.

Referenced by produce().