CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CaloRecHitMixer< T > Class Template Reference

#include <CaloRecHitMixer.h>

Inheritance diagram for CaloRecHitMixer< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  todoListEntryType
 

Public Member Functions

 CaloRecHitMixer (const edm::ParameterSet &)
 
 ~CaloRecHitMixer ()
 
- 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 Types

enum  { kAbsolute }
 
typedef std::map< uint32_t, float > detIdToFloatMap
 
typedef std::map< uint32_t,
CaloRecHitMixer_mixedRecHitInfoType
detIdToMixedRecHitInfoMap
 
typedef edm::SortedCollection< TRecHitCollection
 

Private Member Functions

template<>
EcalRecHit buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &recHitInfo)
 
T buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &)
 
template<>
HBHERecHit buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &recHitInfo)
 
template<>
HORecHit buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &recHitInfo)
 
template<>
HFRecHit buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &recHitInfo)
 
template<>
CastorRecHit buildRecHit (const CaloRecHitMixer_mixedRecHitInfoType &recHitInfo)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
void updateRecHitInfos (const RecHitCollection &, int)
 

Private Attributes

detIdToMixedRecHitInfoMap mixedRecHitInfos_
 
std::string moduleLabel_
 
edm::InputTag srcEnergyDepositMapMuMinus_
 
edm::InputTag srcEnergyDepositMapMuPlus_
 
std::vector< todoListEntryTypetodoList_
 
int typeEnergyDepositMap_
 
int verbosity_
 

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

template<typename T>
class CaloRecHitMixer< T >

Merge collections of calorimeter recHits for original Zmumu event and "embedded" simulated tau decay products (detectors supported at the moment: EB/EE, HB/HE and HO)

Author
Tomasz Maciej Frueboes; Christian Veelken, LLR
Version
Revision:
1.9
Id:
CaloRecHitMixer.h,v 1.9 2013/03/23 09:12:51 veelken Exp

Definition at line 46 of file CaloRecHitMixer.h.

Member Typedef Documentation

template<typename T >
typedef std::map<uint32_t, float> CaloRecHitMixer< T >::detIdToFloatMap
private

Definition at line 82 of file CaloRecHitMixer.h.

template<typename T >
typedef std::map<uint32_t, CaloRecHitMixer_mixedRecHitInfoType> CaloRecHitMixer< T >::detIdToMixedRecHitInfoMap
private

Definition at line 71 of file CaloRecHitMixer.h.

template<typename T >
typedef edm::SortedCollection<T> CaloRecHitMixer< T >::RecHitCollection
private

Definition at line 69 of file CaloRecHitMixer.h.

Member Enumeration Documentation

template<typename T >
anonymous enum
private
Enumerator
kAbsolute 

Definition at line 79 of file CaloRecHitMixer.h.

Constructor & Destructor Documentation

template<typename T >
CaloRecHitMixer< T >::CaloRecHitMixer ( const edm::ParameterSet cfg)
explicit

Definition at line 88 of file CaloRecHitMixer.h.

References edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::InputTag::instance(), CaloRecHitMixer< T >::kAbsolute, CaloRecHitMixer< T >::todoListEntryType::killNegEnergyAfterMixing_, CaloRecHitMixer< T >::todoListEntryType::killNegEnergyBeforeMixing1_, CaloRecHitMixer< T >::todoListEntryType::killNegEnergyBeforeMixing2_, CaloRecHitMixer< T >::todoListEntryType::kSubtractAfterMixing, CaloRecHitMixer< T >::todoListEntryType::kSubtractFromCollection1BeforeMixing, CaloRecHitMixer< T >::todoListEntryType::kSubtractFromCollection2BeforeMixing, CaloRecHitMixer< T >::todoListEntryType::muonEnSutractionMode_, CaloRecHitMixer< T >::todoListEntryType::srcRecHitCollection1_, CaloRecHitMixer< T >::todoListEntryType::srcRecHitCollection2_, AlCaHLTBitMon_QueryRunRegistry::string, CaloRecHitMixer< T >::todoList_, CaloRecHitMixer< T >::typeEnergyDepositMap_, and CaloRecHitMixer< T >::verbosity_.

89  : moduleLabel_(cfg.getParameter<std::string>("@module_label")),
90  srcEnergyDepositMapMuPlus_(cfg.getParameter<edm::InputTag>("srcEnergyDepositMapMuPlus")),
91  srcEnergyDepositMapMuMinus_(cfg.getParameter<edm::InputTag>("srcEnergyDepositMapMuMinus"))
92 {
93  edm::VParameterSet todoList = cfg.getParameter<edm::VParameterSet>("todo");
94  if ( todoList.size() == 0 ) {
95  throw cms::Exception("Configuration")
96  << "Empty to-do list !!\n";
97  }
98 
99  std::string typeEnergyDepositMap_string = cfg.getParameter<std::string>("typeEnergyDepositMap");
100  if ( typeEnergyDepositMap_string == "absolute" ) typeEnergyDepositMap_ = kAbsolute;
101  else throw cms::Exception("Configuration")
102  << "Invalid Configuration parameter 'typeEnergyDepositMap' = " << typeEnergyDepositMap_string << " !!\n";
103 
104  for ( edm::VParameterSet::const_iterator todoItem = todoList.begin();
105  todoItem != todoList.end(); ++todoItem ) {
106  todoListEntryType todoListEntry;
107  todoListEntry.srcRecHitCollection1_ = todoItem->getParameter<edm::InputTag>("collection1");
108  todoListEntry.killNegEnergyBeforeMixing1_ = todoItem->getParameter<bool>("killNegEnergyBeforeMixing1");
109  todoListEntry.srcRecHitCollection2_ = todoItem->getParameter<edm::InputTag>("collection2");
110  todoListEntry.killNegEnergyBeforeMixing2_ = todoItem->getParameter<bool>("killNegEnergyBeforeMixing2");
111  std::string muonEnSutractionMode_string = todoItem->getParameter<std::string>("muonEnSutractionMode");
112  if ( muonEnSutractionMode_string == "subtractFromCollection1BeforeMixing" ) todoListEntry.muonEnSutractionMode_ = todoListEntryType::kSubtractFromCollection1BeforeMixing;
113  else if ( muonEnSutractionMode_string == "subtractFromCollection2BeforeMixing" ) todoListEntry.muonEnSutractionMode_ = todoListEntryType::kSubtractFromCollection2BeforeMixing;
114  else if ( muonEnSutractionMode_string == "subtractAfterMixing" ) todoListEntry.muonEnSutractionMode_ = todoListEntryType::kSubtractAfterMixing;
115  else throw cms::Exception("Configuration")
116  << "Invalid Configuration parameter 'muonEnSutractionMode' = " << muonEnSutractionMode_string << " !!\n";
117  todoListEntry.killNegEnergyAfterMixing_ = todoItem->getParameter<bool>("killNegEnergyAfterMixing");
118 
119  std::string instanceLabel1 = todoListEntry.srcRecHitCollection1_.instance();
120  std::string instanceLabel2 = todoListEntry.srcRecHitCollection2_.instance();
121  if ( instanceLabel1 != instanceLabel2 ) {
122  throw cms::Exception("Configuration")
123  << "Mismatch in Instance labels for collection 1 = " << instanceLabel1 << " and 2 = " << instanceLabel2 << " !!\n";
124  }
125 
126  todoList_.push_back(todoListEntry);
127 
128  produces<RecHitCollection>(instanceLabel1);
129  std::string instanceLabel_removedEnergyMuMinus = "removedEnergyMuMinus";
130  if ( instanceLabel1 != "" ) instanceLabel_removedEnergyMuMinus.append("#").append(instanceLabel1);
131  produces<double>(instanceLabel_removedEnergyMuMinus.data());
132  std::string instanceLabel_removedEnergyMuPlus = "removedEnergyMuPlus";
133  if ( instanceLabel1 != "" ) instanceLabel_removedEnergyMuPlus.append("#").append(instanceLabel1);
134  produces<double>(instanceLabel_removedEnergyMuPlus.data());
135  }
136 
137  verbosity_ = ( cfg.exists("verbosity") ) ?
138  cfg.getParameter<int>("verbosity") : 0;
139 }
T getParameter(std::string const &) const
std::vector< ParameterSet > VParameterSet
Definition: ParameterSet.h:33
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::InputTag srcEnergyDepositMapMuPlus_
edm::InputTag srcEnergyDepositMapMuMinus_
std::vector< todoListEntryType > todoList_
std::string moduleLabel_
template<typename T >
CaloRecHitMixer< T >::~CaloRecHitMixer ( )

Definition at line 142 of file CaloRecHitMixer.h.

143 {
144 // nothing to be done yet...
145 }

Member Function Documentation

template<>
EcalRecHit CaloRecHitMixer< EcalRecHit >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 34 of file CaloRecHitMixer.cc.

References CaloRecHit::aux(), EcalRecHit::checkFlag(), CaloRecHit::detid(), CaloRecHitMixer_mixedRecHitInfoType::energySum_, CaloRecHit::flags(), CaloRecHitMixer_mixedRecHitInfoType::isRecHit1_, CaloRecHitMixer_mixedRecHitInfoType::isRecHit2_, CaloRecHitMixer_mixedRecHitInfoType::isRecHitSum_, CaloRecHitMixer_mixedRecHitInfoType::recHit1_, CaloRecHitMixer_mixedRecHitInfoType::recHit2_, CaloRecHit::setAux(), and CaloRecHit::time().

35 {
36  // CV: take status flags and timing information from simulated tau decay products
37  // (suggested by Florian Beaudette)
38  const CaloRecHit* recHit = 0;
39  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
40  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
41  const EcalRecHit* recHit_ecal = static_cast<const EcalRecHit*>(recHit);
42  assert(recHit_ecal);
43  assert(recHitInfo.isRecHitSum_);
44  uint32_t flagBits = 0;
45  for ( int flag = 0; flag < 32; ++flag ) {
46  if ( recHit_ecal->checkFlag(flag) ) flagBits += (0x1 << flag);
47  }
48  EcalRecHit mergedRecHit(recHit_ecal->detid(), recHitInfo.energySum_, recHit_ecal->time(), recHit_ecal->flags(), flagBits);
49  mergedRecHit.setAux(recHit_ecal->aux());
50  return mergedRecHit;
51 }
uint32_t aux() const
Definition: CaloRecHit.h:26
const DetId & detid() const
Definition: CaloRecHit.h:20
float time() const
Definition: CaloRecHit.h:19
bool checkFlag(int flag) const
check if the flag is true
Definition: EcalRecHit.h:106
uint32_t flags() const
Definition: CaloRecHit.h:21
void setAux(uint32_t value)
Definition: CaloRecHit.h:25
template<typename T >
T CaloRecHitMixer< T >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 22 of file CaloRecHitMixer.cc.

23 {
24  assert(0); // CV: make sure general function never gets called;
25  // always use template specializations
26 }
template<>
HBHERecHit CaloRecHitMixer< HBHERecHit >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 79 of file CaloRecHitMixer.cc.

80 {
81  return buildRecHit_HCAL<HBHERecHit>(recHitInfo);
82 }
template<>
HORecHit CaloRecHitMixer< HORecHit >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 85 of file CaloRecHitMixer.cc.

86 {
87  return buildRecHit_HCAL<HORecHit>(recHitInfo);
88 }
template<>
HFRecHit CaloRecHitMixer< HFRecHit >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 91 of file CaloRecHitMixer.cc.

92 {
93  return buildRecHit_HCAL<HFRecHit>(recHitInfo);
94 }
template<>
CastorRecHit CaloRecHitMixer< CastorRecHit >::buildRecHit ( const CaloRecHitMixer_mixedRecHitInfoType recHitInfo)
private

Definition at line 102 of file CaloRecHitMixer.cc.

References CaloRecHit::aux(), CaloRecHit::detid(), CaloRecHitMixer_mixedRecHitInfoType::energySum_, CaloRecHit::flags(), CaloRecHitMixer_mixedRecHitInfoType::isRecHit1_, CaloRecHitMixer_mixedRecHitInfoType::isRecHit2_, CaloRecHitMixer_mixedRecHitInfoType::isRecHitSum_, CaloRecHitMixer_mixedRecHitInfoType::recHit1_, CaloRecHitMixer_mixedRecHitInfoType::recHit2_, CaloRecHit::setFlags(), and CaloRecHit::time().

103 {
104  // CV: take status flags and timing information from simulated tau decay products
105  // (suggested by Florian Beaudette)
106  const CaloRecHit* recHit = 0;
107  if ( recHitInfo.isRecHit1_ ) recHit = recHitInfo.recHit1_;
108  else if ( recHitInfo.isRecHit2_ ) recHit = recHitInfo.recHit2_;
109  const CastorRecHit* recHit_castor = static_cast<const CastorRecHit*>(recHit);
110  assert(recHit_castor);
111  assert(recHitInfo.isRecHitSum_);
112  CastorRecHit mergedRecHit(recHit_castor->detid(), recHitInfo.energySum_, recHit_castor->time());
113  mergedRecHit.setFlags(recHit_castor->flags());
114  mergedRecHit.setAux(recHit_castor->aux());
115  return mergedRecHit;
116 }
uint32_t aux() const
Definition: CaloRecHit.h:26
const DetId & detid() const
Definition: CaloRecHit.h:20
float time() const
Definition: CaloRecHit.h:19
uint32_t flags() const
Definition: CaloRecHit.h:21
void setFlags(uint32_t flags)
Definition: CaloRecHit.h:22
template<typename T >
void CaloRecHitMixer< T >::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 161 of file CaloRecHitMixer.h.

References edm::HandleBase::clear(), gather_cfg::cout, alignCSCRings::e, edm::Event::getByLabel(), moduleLabel_(), edm::Event::put(), and AlCaHLTBitMon_QueryRunRegistry::string.

162 {
163  if ( verbosity_ ) std::cout << "<CaloRecHitMixer::produce (" << moduleLabel_ << ")>:" << std::endl;
164 
165  edm::Handle<detIdToFloatMap> energyDepositMapMuPlus;
166  evt.getByLabel(srcEnergyDepositMapMuPlus_, energyDepositMapMuPlus);
167  edm::Handle<detIdToFloatMap> energyDepositMapMuMinus;
168  evt.getByLabel(srcEnergyDepositMapMuMinus_, energyDepositMapMuMinus);
169 
170  for ( typename std::vector<todoListEntryType>::const_iterator todoItem = todoList_.begin();
171  todoItem != todoList_.end(); ++todoItem ) {
172  edm::Handle<RecHitCollection> recHitCollection1;
173  evt.getByLabel(todoItem->srcRecHitCollection1_, recHitCollection1);
174  edm::Handle<RecHitCollection> recHitCollection2;
175  evt.getByLabel(todoItem->srcRecHitCollection2_, recHitCollection2);
176  if ( verbosity_ ) {
177  std::cout << "recHitCollection(input1 = " << todoItem->srcRecHitCollection1_.label() << ":" << todoItem->srcRecHitCollection1_.instance() << ":" << todoItem->srcRecHitCollection1_.process() << "):"
178  << " #entries = " << recHitCollection1->size() << std::endl;
179  std::cout << "recHitCollection(input2 = " << todoItem->srcRecHitCollection2_.label() << ":" << todoItem->srcRecHitCollection2_.instance() << ":" << todoItem->srcRecHitCollection2_.process() << "):"
180  << " #entries = " << recHitCollection2->size() << std::endl;
181  }
182 
183  mixedRecHitInfos_.clear();
184  updateRecHitInfos(*recHitCollection1, 0);
185  updateRecHitInfos(*recHitCollection2, 1);
186 
187  std::auto_ptr<RecHitCollection> recHitCollection_output(new RecHitCollection());
188  std::auto_ptr<double> removedEnergyMuPlus(new double(0.));
189  std::auto_ptr<double> removedEnergyMuMinus(new double(0.));
190 
191  double muPlusEnergySum = 0.;
192  double muMinusEnergySum = 0.;
193 
194  for ( typename detIdToMixedRecHitInfoMap::iterator mixedRecHitInfo = mixedRecHitInfos_.begin();
195  mixedRecHitInfo != mixedRecHitInfos_.end(); ++mixedRecHitInfo ) {
196  uint32_t rawDetId = mixedRecHitInfo->second.rawDetId_;
197 
198  double muPlusEnergyDeposit = getCorrection(rawDetId, *energyDepositMapMuPlus);
199  double muMinusEnergyDeposit = getCorrection(rawDetId, *energyDepositMapMuMinus);
200  double muonEnergyDeposit = muPlusEnergyDeposit + muMinusEnergyDeposit;
201 
202  muPlusEnergySum += muPlusEnergyDeposit;
203  muMinusEnergySum += muMinusEnergyDeposit;
204 
205  if ( muonEnergyDeposit > 0. ) {
206  if ( verbosity_ ) std::cout << "removing muon energy: detId = " << rawDetId << ", subtracted = " << muonEnergyDeposit << std::endl;
207  if ( mixedRecHitInfo->second.isRecHit1_ && todoItem->muonEnSutractionMode_ == todoListEntryType::kSubtractFromCollection1BeforeMixing ) {
208  if ( todoItem->killNegEnergyBeforeMixing1_ && mixedRecHitInfo->second.energy1_ < muonEnergyDeposit ) {
209  if ( verbosity_ ) std::cout << "--> killing recHit1: detId = " << rawDetId << ", energy = " << (mixedRecHitInfo->second.energy1_ - muonEnergyDeposit) << std::endl;
210  (*removedEnergyMuPlus) += ((mixedRecHitInfo->second.energy1_/muonEnergyDeposit)*muPlusEnergyDeposit);
211  (*removedEnergyMuMinus) += ((mixedRecHitInfo->second.energy1_/muonEnergyDeposit)*muMinusEnergyDeposit);
212  mixedRecHitInfo->second.energy1_ = 0.;
213  mixedRecHitInfo->second.isRecHit1_ = false;
214  } else {
215  (*removedEnergyMuPlus) += muPlusEnergyDeposit;
216  (*removedEnergyMuMinus) += muMinusEnergyDeposit;
217  mixedRecHitInfo->second.energy1_ -= muonEnergyDeposit;
218  }
219  }
220  if ( mixedRecHitInfo->second.isRecHit2_ && todoItem->muonEnSutractionMode_ == todoListEntryType::kSubtractFromCollection2BeforeMixing ) {
221  if ( todoItem->killNegEnergyBeforeMixing2_ && mixedRecHitInfo->second.energy2_ < muonEnergyDeposit ) {
222  if ( verbosity_ ) std::cout << "--> killing recHit2: detId = " << rawDetId << ", energy = " << (mixedRecHitInfo->second.energy2_ - muonEnergyDeposit) << std::endl;
223  (*removedEnergyMuPlus) += ((mixedRecHitInfo->second.energy2_/muonEnergyDeposit)*muPlusEnergyDeposit);
224  (*removedEnergyMuMinus) += ((mixedRecHitInfo->second.energy2_/muonEnergyDeposit)*muMinusEnergyDeposit);
225  mixedRecHitInfo->second.energy2_ = 0.;
226  mixedRecHitInfo->second.isRecHit2_ = false;
227  } else {
228  (*removedEnergyMuPlus) += muPlusEnergyDeposit;
229  (*removedEnergyMuMinus) += muMinusEnergyDeposit;
230  mixedRecHitInfo->second.energy2_ -= muonEnergyDeposit;
231  }
232  }
233  }
234 
235  mixedRecHitInfo->second.energySum_ = 0.;
236  mixedRecHitInfo->second.isRecHitSum_ = false;
237  if ( mixedRecHitInfo->second.isRecHit1_ ) {
238  mixedRecHitInfo->second.energySum_ += mixedRecHitInfo->second.energy1_;
239  mixedRecHitInfo->second.isRecHitSum_ = true;
240  }
241  if ( mixedRecHitInfo->second.isRecHit2_ ) {
242  mixedRecHitInfo->second.energySum_ += mixedRecHitInfo->second.energy2_;
243  mixedRecHitInfo->second.isRecHitSum_ = true;
244  }
245  if ( muonEnergyDeposit > 0. ) {
246  if ( mixedRecHitInfo->second.isRecHitSum_ && todoItem->muonEnSutractionMode_ == todoListEntryType::kSubtractAfterMixing ) {
247  if ( todoItem->killNegEnergyAfterMixing_ && mixedRecHitInfo->second.energySum_ < muonEnergyDeposit ) {
248  if ( verbosity_ ) std::cout << "--> killing recHitSum: detId = " << rawDetId << ", energy = " << (mixedRecHitInfo->second.energySum_ - muonEnergyDeposit) << std::endl;
249  (*removedEnergyMuPlus) += ((mixedRecHitInfo->second.energySum_/muonEnergyDeposit)*muPlusEnergyDeposit);
250  (*removedEnergyMuMinus) += ((mixedRecHitInfo->second.energySum_/muonEnergyDeposit)*muMinusEnergyDeposit);
251  mixedRecHitInfo->second.energySum_ = 0.;
252  mixedRecHitInfo->second.isRecHitSum_ = false;
253  } else {
254  (*removedEnergyMuPlus) += muPlusEnergyDeposit;
255  (*removedEnergyMuMinus) += muMinusEnergyDeposit;
256  mixedRecHitInfo->second.energySum_ -= muonEnergyDeposit;
257  }
258  }
259  }
260 
261  if ( mixedRecHitInfo->second.isRecHitSum_ ) {
262  if ( verbosity_ ) {
263  if ( muonEnergyDeposit > 1.e-3 ) std::cout << "--> adding recHitSum (cleaned): detId = " << rawDetId << ", energy = " << mixedRecHitInfo->second.energySum_ << std::endl;
264  else std::cout << "--> adding recHitSum (uncleaned): detId = " << rawDetId << ", energy = " << mixedRecHitInfo->second.energySum_ << std::endl;
265  }
266  recHitCollection_output->push_back(buildRecHit(mixedRecHitInfo->second));
267  }
268  }
269 
270  if ( verbosity_ ) {
271  std::cout << " mu+: sum(EnergyDeposits) = " << muPlusEnergySum << " (removed = " << (*removedEnergyMuPlus) << ")" << std::endl;
272  std::cout << " mu-: sum(EnergyDeposits) = " << muMinusEnergySum << " (removed = " << (*removedEnergyMuMinus) << ")" << std::endl;
273  std::cout << "recHitCollection(output = " << moduleLabel_ << ":" << todoItem->srcRecHitCollection1_.instance() << "): #entries = " << recHitCollection_output->size() << std::endl;
274  }
275 
276  std::string instanceLabel = todoItem->srcRecHitCollection1_.instance();
277  evt.put(recHitCollection_output, instanceLabel);
278  std::string instanceLabel_removedEnergyMuMinus = "removedEnergyMuMinus";
279  if ( instanceLabel != "" ) instanceLabel_removedEnergyMuMinus.append("#").append(instanceLabel);
280  evt.put(removedEnergyMuMinus, instanceLabel_removedEnergyMuMinus.data());
281  std::string instanceLabel_removedEnergyMuPlus = "removedEnergyMuPlus";
282  if ( instanceLabel != "" ) instanceLabel_removedEnergyMuPlus.append("#").append(instanceLabel);
283  evt.put(removedEnergyMuPlus, instanceLabel_removedEnergyMuPlus.data());
284  }
285 }
detIdToMixedRecHitInfoMap mixedRecHitInfos_
edm::InputTag srcEnergyDepositMapMuPlus_
edm::InputTag srcEnergyDepositMapMuMinus_
void updateRecHitInfos(const RecHitCollection &, int)
std::vector< todoListEntryType > todoList_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::SortedCollection< T > RecHitCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
std::string moduleLabel_
tuple cout
Definition: gather_cfg.py:121
T buildRecHit(const CaloRecHitMixer_mixedRecHitInfoType &)
template<typename T >
void CaloRecHitMixer< T >::updateRecHitInfos ( const RecHitCollection recHitCollection,
int  idx 
)
private

Definition at line 288 of file CaloRecHitMixer.h.

References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, edm::SortedCollection< T, SORT >::end(), CaloRecHitMixer_mixedRecHitInfoType::energy1_, CaloRecHitMixer_mixedRecHitInfoType::energy2_, CaloRecHitMixer_mixedRecHitInfoType::energySum_, CaloRecHitMixer_mixedRecHitInfoType::isRecHit1_, CaloRecHitMixer_mixedRecHitInfoType::isRecHit2_, CaloRecHitMixer_mixedRecHitInfoType::isRecHitSum_, CaloRecHitMixer_mixedRecHitInfoType::rawDetId_, CaloRecHitMixer_mixedRecHitInfoType::recHit1_, and CaloRecHitMixer_mixedRecHitInfoType::recHit2_.

289 {
290  for ( typename RecHitCollection::const_iterator recHit = recHitCollection.begin();
291  recHit != recHitCollection.end(); ++recHit ) {
292  uint32_t rawDetId = recHit->detid().rawId();
293 
294  bool isNewRecHit = (mixedRecHitInfos_.find(rawDetId) == mixedRecHitInfos_.end());
295  if ( isNewRecHit ) {
296  CaloRecHitMixer_mixedRecHitInfoType mixedRecHitInfo;
297  mixedRecHitInfo.rawDetId_ = rawDetId;
298  mixedRecHitInfo.energy1_ = 0.;
299  mixedRecHitInfo.isRecHit1_ = false;
300  mixedRecHitInfo.recHit1_ = 0;
301  mixedRecHitInfo.energy2_ = 0.;
302  mixedRecHitInfo.isRecHit2_ = false;
303  mixedRecHitInfo.recHit2_ = 0;
304  mixedRecHitInfo.energySum_ = 0.;
305  mixedRecHitInfo.isRecHitSum_ = false;
306  mixedRecHitInfos_.insert(std::pair<uint32_t, CaloRecHitMixer_mixedRecHitInfoType>(rawDetId, mixedRecHitInfo));
307  }
308 
309  typename detIdToMixedRecHitInfoMap::iterator mixedRecHitInfo = mixedRecHitInfos_.find(rawDetId);
310  assert(mixedRecHitInfo != mixedRecHitInfos_.end());
311 
312  if ( verbosity_ ) {
313  if ( isNewRecHit ) std::cout << "creating new recHit: detId = " << rawDetId << ", energy = " << recHit->energy() << std::endl;
314  else std::cout << "merging recHits: detId = " << rawDetId << ", total energy = " << (mixedRecHitInfo->second.energy1_ + mixedRecHitInfo->second.energy2_)
315  << " (added = " << recHit->energy() << ")" << std::endl;
316  }
317 
318  if ( idx == 0 ) {
319  mixedRecHitInfo->second.energy1_ = recHit->energy();
320  mixedRecHitInfo->second.isRecHit1_ = true;
321  mixedRecHitInfo->second.recHit1_ = &(*recHit);
322  } else if ( idx == 1 ) {
323  mixedRecHitInfo->second.energy2_ = recHit->energy();
324  mixedRecHitInfo->second.isRecHit2_ = true;
325  mixedRecHitInfo->second.recHit2_ = &(*recHit);
326  } else assert(0);
327  }
328 }
detIdToMixedRecHitInfoMap mixedRecHitInfos_
std::vector< T >::const_iterator const_iterator
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

template<typename T >
detIdToMixedRecHitInfoMap CaloRecHitMixer< T >::mixedRecHitInfos_
private

Definition at line 72 of file CaloRecHitMixer.h.

template<typename T >
std::string CaloRecHitMixer< T >::moduleLabel_
private
template<typename T >
edm::InputTag CaloRecHitMixer< T >::srcEnergyDepositMapMuMinus_
private

Definition at line 78 of file CaloRecHitMixer.h.

template<typename T >
edm::InputTag CaloRecHitMixer< T >::srcEnergyDepositMapMuPlus_
private

Definition at line 77 of file CaloRecHitMixer.h.

template<typename T >
std::vector<todoListEntryType> CaloRecHitMixer< T >::todoList_
private

Definition at line 67 of file CaloRecHitMixer.h.

Referenced by CaloRecHitMixer< T >::CaloRecHitMixer().

template<typename T >
int CaloRecHitMixer< T >::typeEnergyDepositMap_
private

Definition at line 80 of file CaloRecHitMixer.h.

Referenced by CaloRecHitMixer< T >::CaloRecHitMixer().

template<typename T >
int CaloRecHitMixer< T >::verbosity_
private

Definition at line 84 of file CaloRecHitMixer.h.

Referenced by CaloRecHitMixer< T >::CaloRecHitMixer().