CMS 3D CMS Logo

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

#include <EcalTrigPrimProducer.h>

Inheritance diagram for EcalTrigPrimProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 EcalTrigPrimProducer (const edm::ParameterSet &conf)
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~EcalTrigPrimProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

unsigned long long getRecords (edm::EventSetup const &setup)
 

Private Attributes

std::unique_ptr
< EcalTrigPrimFunctionalAlgo
algo_
 
bool barrelOnly_
 
int binOfMaximum_
 
unsigned long long cacheID_
 
bool debug_
 
bool famos_
 
bool fillBinOfMaximumFromHistory_
 
std::string instanceNameEB_
 
std::string instanceNameEE_
 
std::string label_
 
bool tcpFormat_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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

EcalTrigPrimProducer produces a EcalTrigPrimDigiCollection The barrel code does a detailed simulation The code for the endcap is simulated in a rough way, due to missing strip geometry

Author
Ursula Berthon, Stephanie Baffioni, LLR Palaiseau
Version
1st Version may 2006
2nd Version jul 2006

EcalTrigPrimProducer produces a EcalTrigPrimDigiCollection Simulation as close as possible to hardware Main algorithm is EcalTrigPrimFunctionalAlgo which is now templated to take EBdataFrames/EEDataFrames as input

Author
Ursula Berthon, Stephanie Baffioni, Pascal Paganini, LLR Palaiseau
Version
1st Version may 2006
2nd Version jul 2006
3rd Version nov 2006
4th Version apr 2007 full endcap

Definition at line 32 of file EcalTrigPrimProducer.h.

Constructor & Destructor Documentation

EcalTrigPrimProducer::EcalTrigPrimProducer ( const edm::ParameterSet conf)
explicit

Definition at line 62 of file EcalTrigPrimProducer.cc.

References tcpFormat_.

62  :
63  barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")),
64  tcpFormat_(iConfig.getParameter<bool>("TcpOutput")),
65  debug_(iConfig.getParameter<bool>("Debug")),
66  famos_(iConfig.getParameter<bool>("Famos")),
67  label_(iConfig.getParameter<std::string>("Label")),
68  instanceNameEB_(iConfig.getParameter<std::string>("InstanceEB")),
69  instanceNameEE_(iConfig.getParameter<std::string>("InstanceEE")),
70  binOfMaximum_(iConfig.getParameter<int>("binOfMaximum")),
72 {
73  //register your products
74  produces <EcalTrigPrimDigiCollection >();
75  if (tcpFormat_) produces <EcalTrigPrimDigiCollection >("formatTCP");
76 }
EcalTrigPrimProducer::~EcalTrigPrimProducer ( )
virtual

Definition at line 199 of file EcalTrigPrimProducer.cc.

200 {}

Member Function Documentation

void EcalTrigPrimProducer::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 114 of file EcalTrigPrimProducer.cc.

References algo_, barrelOnly_, binOfMaximum_, cacheID_, debug_, famos_, fillBinOfMaximumFromHistory_, findBinOfMaximum(), getRecords(), edm::Run::processHistory(), and tcpFormat_.

114  {
115  //ProcessHistory is guaranteed to be constant for an entire Run
117 
119 
120  // get a first version of the records
121  cacheID_=this->getRecords(setup);
122 }
static int findBinOfMaximum(bool iFillFromHistory, int iPSetValue, edm::ProcessHistory const &iHistory)
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
unsigned long long cacheID_
unsigned long long getRecords(edm::EventSetup const &setup)
ProcessHistory const & processHistory() const
Definition: Run.cc:108
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void EcalTrigPrimProducer::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 124 of file EcalTrigPrimProducer.cc.

References algo_.

124  {
125  algo_.reset();
126 }
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
void EcalTrigPrimProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 275 of file EcalTrigPrimProducer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), kComment, and AlCaHLTBitMon_QueryRunRegistry::string.

275  {
276 
278  desc.add<bool>("BarrelOnly",false);
279  desc.add<bool>("TcpOutput",false);
280  desc.add<bool>("Debug",false);
281  desc.add<bool>("Famos",false);
282  desc.add<std::string>("Label","simEcalUnsuppressedDigis");
283  desc.add<std::string>("InstanceEB","");
284  desc.add<std::string>("InstanceEE","");
285  const std::string kComment("A value of -1 will make the module lookup the value of 'binOfMaximum' from the module 'ecalUnsuppressedDigis' from the process history. Allowed values are -1 and from 1-10.");
286  //The code before the existence of fillDescriptions did something special if 'binOfMaximum' was missing. This replicates that behavior.
287  desc.add<int>("binOfMaximum",-1)->setComment(kComment);
288  descriptions.addDefault(desc);
289 }
void addDefault(ParameterSetDescription const &psetDescription)
static const char *const kComment
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned long long EcalTrigPrimProducer::getRecords ( edm::EventSetup const &  setup)
private

Definition at line 128 of file EcalTrigPrimProducer.cc.

References algo_, edm::EventSetup::get(), and edm::ESHandle< class >::product().

Referenced by beginRun(), and produce().

128  {
129  // get Eventsetup records
130 
131  // for EcalFenixStrip...
132  // get parameter records for xtals
133  edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
134  setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
135  const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product();
136  edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
137  setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
138  const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product();
139  edm::ESHandle<EcalTPGCrystalStatus> theEcalTPGCrystalStatus_handle;
140  setup.get<EcalTPGCrystalStatusRcd>().get(theEcalTPGCrystalStatus_handle);
141  const EcalTPGCrystalStatus * ecaltpgBadX = theEcalTPGCrystalStatus_handle.product();
142 
143 
144  //for strips
145  edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
146  setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
147  const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product();
148  edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
149  setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
150  const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product();
151  edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
152  setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
153  const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product();
154  edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle;
155  setup.get<EcalTPGFineGrainStripEERcd>().get(theEcalTPGFineGrainStripEE_handle);
156  const EcalTPGFineGrainStripEE * ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product();
157  edm::ESHandle<EcalTPGStripStatus> theEcalTPGStripStatus_handle;
158  setup.get<EcalTPGStripStatusRcd>().get(theEcalTPGStripStatus_handle);
159  const EcalTPGStripStatus * ecaltpgStripStatus = theEcalTPGStripStatus_handle.product();
160 
161  algo_->setPointers(ecaltpLin,ecaltpPed,ecaltpgSlidW,ecaltpgWeightMap,ecaltpgWeightGroup,ecaltpgFgStripEE,ecaltpgBadX,ecaltpgStripStatus);
162 
163  // .. and for EcalFenixTcp
164  // get parameter records for towers
165  edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle;
166  setup.get<EcalTPGFineGrainEBGroupRcd>().get(theEcalTPGFineGrainEBGroup_handle);
167  const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product();
168 
169  edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
170  setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
171  const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
172 
173  edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
174  setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
175  const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product();
176 
177  edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle;
178  setup.get<EcalTPGFineGrainEBIdMapRcd>().get(theEcalTPGFineGrainEBIdMap_handle);
179  const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product();
180 
181  edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle;
182  setup.get<EcalTPGFineGrainTowerEERcd>().get(theEcalTPGFineGrainTowerEE_handle);
183  const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product();
184 
185  edm::ESHandle<EcalTPGTowerStatus> theEcalTPGTowerStatus_handle;
186  setup.get<EcalTPGTowerStatusRcd>().get(theEcalTPGTowerStatus_handle);
187  const EcalTPGTowerStatus * ecaltpgBadTT = theEcalTPGTowerStatus_handle.product();
188 
189  edm::ESHandle<EcalTPGSpike> theEcalTPGSpike_handle;
190  setup.get<EcalTPGSpikeRcd>().get(theEcalTPGSpike_handle);
191  const EcalTPGSpike * ecaltpgSpike = theEcalTPGSpike_handle.product();
192 
193  algo_->setPointers2(ecaltpgFgEBGroup,ecaltpgLutGroup,ecaltpgLut,ecaltpgFineGrainEB,ecaltpgFineGrainTowerEE,ecaltpgBadTT,ecaltpgSpike);
194 
195  // we will suppose that everything is to be updated if the EcalTPGLinearizationConstRcd has changed
196  return setup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
197 }
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
T const * product() const
Definition: ESHandle.h:62
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void EcalTrigPrimProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 205 of file EcalTrigPrimProducer.cc.

References algo_, Reference_intrackfit_cff::barrel, barrelOnly_, cacheID_, edm::eventsetup::EventSetupRecord::cacheIdentifier(), Reference_intrackfit_cff::endcap, edm::hlt::Exception, edm::EventSetup::get(), edm::Event::getByLabel(), getRecords(), i, edm::EventBase::id(), instanceNameEB_, instanceNameEE_, label_, LogDebug, NULL, reco::print(), edm::Handle< T >::product(), edm::Event::put(), and tcpFormat_.

206 {
207 
208  // update constants if necessary
209  if (iSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier()!=cacheID_) cacheID_=this->getRecords(iSetup);
210 
211  // get input collections
212 
215  bool barrel=true;
216  bool endcap=true;
217  if (barrelOnly_) endcap=false;
218 
219  if (!e.getByLabel(label_,instanceNameEB_,ebDigis)) {
220  barrel=false;
221  edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with producer "<<label_<<" and label "<<instanceNameEB_<<"!!!";
222  }
223  if (!barrelOnly_) {
224  if (!e.getByLabel(label_,instanceNameEE_,eeDigis)) {
225  endcap=false;
226  edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with producer "<<label_<<" and label "<<instanceNameEE_<<"!!!";
227  }
228  }
229  if (!barrel && !endcap) {
230  throw cms::Exception(" ProductNotFound") <<"No EBDataFrames(EEDataFrames) with producer "<<label_<<" and label "<<instanceNameEB_<<" found in input!!\n";
231  }
232 
233  if (!barrelOnly_) LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size()<<", Number of EEDataFrames "<<eeDigis.product()->size() ;
234  else LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size();
235 
236  std::auto_ptr<EcalTrigPrimDigiCollection> pOut(new EcalTrigPrimDigiCollection);
237  std::auto_ptr<EcalTrigPrimDigiCollection> pOutTcp(new EcalTrigPrimDigiCollection);
238 
239 
240  // invoke algorithm
241 
242  const EBDigiCollection *ebdc=NULL;
243  const EEDigiCollection *eedc=NULL;
244  if (barrel) {
245  ebdc=ebDigis.product();
246  algo_->run(iSetup,ebdc,*pOut,*pOutTcp);
247  }
248 
249  if (endcap) {
250  eedc=eeDigis.product();
251  algo_->run(iSetup,eedc,*pOut,*pOutTcp);
252  }
253 
254  edm::LogInfo("produce") <<"For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced";
255 
256  // debug prints if TP >0
257 
258  for (unsigned int i=0;i<pOut->size();++i) {
259  bool print=false;
260  for (int isam=0;isam<(*pOut)[i].size();++isam) {
261  if ((*pOut)[i][isam].raw()) print=true;
262  }
263  if (print) LogDebug("EcalTPG") <<" For tower "<<(((*pOut)[i])).id()<<", TP is "<<(*pOut)[i];
264  }
265  if (barrelOnly_) LogDebug("EcalTPG") <<"\n =================> For Barrel , "<<pOut->size()<<" TP Digis were produced (including zero ones)";
266  else LogDebug("EcalTPG") <<"\n =================> For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced (including zero ones)";
267 
268  // put result into the Event
269 
270  e.put(pOut);
271  if (tcpFormat_) e.put(pOutTcp,"formatTCP");
272 }
#define LogDebug(id)
unsigned long long cacheIdentifier() const
int i
Definition: DBlmapReader.cc:9
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:8
#define NULL
Definition: scimark2.h:8
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
unsigned long long cacheID_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
unsigned long long getRecords(edm::EventSetup const &setup)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
T const * product() const
Definition: Handle.h:81
edm::EventID id() const
Definition: EventBase.h:56

Member Data Documentation

std::unique_ptr<EcalTrigPrimFunctionalAlgo> EcalTrigPrimProducer::algo_
private

Definition at line 47 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), endRun(), getRecords(), and produce().

bool EcalTrigPrimProducer::barrelOnly_
private

Definition at line 48 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), and produce().

int EcalTrigPrimProducer::binOfMaximum_
private

Definition at line 56 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

unsigned long long EcalTrigPrimProducer::cacheID_
private

Definition at line 61 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), and produce().

bool EcalTrigPrimProducer::debug_
private

Definition at line 50 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::famos_
private

Definition at line 51 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::fillBinOfMaximumFromHistory_
private

Definition at line 57 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

std::string EcalTrigPrimProducer::instanceNameEB_
private

Definition at line 53 of file EcalTrigPrimProducer.h.

Referenced by produce().

std::string EcalTrigPrimProducer::instanceNameEE_
private

Definition at line 54 of file EcalTrigPrimProducer.h.

Referenced by produce().

std::string EcalTrigPrimProducer::label_
private
bool EcalTrigPrimProducer::tcpFormat_
private

Definition at line 49 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), EcalTrigPrimProducer(), and produce().