CMS 3D CMS Logo

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<>

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
 
 ~EcalTrigPrimProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

std::unique_ptr< EcalTrigPrimFunctionalAlgoalgo_
 
bool barrelOnly_
 
int binOfMaximum_
 
unsigned long long cacheID_
 
bool debug_
 
bool famos_
 
bool fillBinOfMaximumFromHistory_
 
bool tcpFormat_
 
edm::EDGetTokenT< EBDigiCollectiontokenEB_
 
edm::EDGetTokenT< EEDigiCollectiontokenEE_
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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 35 of file EcalTrigPrimProducer.h.

Constructor & Destructor Documentation

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

Definition at line 64 of file EcalTrigPrimProducer.cc.

References tcpFormat_.

65  : barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")),
66  tcpFormat_(iConfig.getParameter<bool>("TcpOutput")),
67  debug_(iConfig.getParameter<bool>("Debug")),
68  famos_(iConfig.getParameter<bool>("Famos")),
69  tokenEB_(consumes<EBDigiCollection>(
70  edm::InputTag(iConfig.getParameter<std::string>("Label"),
71  iConfig.getParameter<std::string>("InstanceEB")))),
72  tokenEE_(consumes<EEDigiCollection>(
73  edm::InputTag(iConfig.getParameter<std::string>("Label"),
74  iConfig.getParameter<std::string>("InstanceEE")))),
75  binOfMaximum_(iConfig.getParameter<int>("binOfMaximum")),
77  // register your products
78  produces<EcalTrigPrimDigiCollection>();
79  if (tcpFormat_)
80  produces<EcalTrigPrimDigiCollection>("formatTCP");
81 }
edm::EDGetTokenT< EBDigiCollection > tokenEB_
edm::EDGetTokenT< EEDigiCollection > tokenEE_
EcalTrigPrimProducer::~EcalTrigPrimProducer ( )
override

Definition at line 241 of file EcalTrigPrimProducer.cc.

241 {}

Member Function Documentation

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

Definition at line 132 of file EcalTrigPrimProducer.cc.

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

133  {
134  // ProcessHistory is guaranteed to be constant for an entire Run
136  run.processHistory());
137 
140 
141  // get a first version of the records
142  cacheID_ = this->getRecords(setup);
143 }
static int findBinOfMaximum(bool iFillFromHistory, int iPSetValue, edm::ProcessHistory const &iHistory)
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
unsigned long long cacheID_
unsigned long long getRecords(edm::EventSetup const &setup)
ProcessHistory const & processHistory() const
Definition: Run.cc:106
void EcalTrigPrimProducer::endRun ( const edm::Run ,
const edm::EventSetup  
)
override

Definition at line 145 of file EcalTrigPrimProducer.cc.

References algo_.

146  {
147  algo_.reset();
148 }
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
void EcalTrigPrimProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 344 of file EcalTrigPrimProducer.cc.

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

345  {
346 
348  desc.add<bool>("BarrelOnly", false);
349  desc.add<bool>("TcpOutput", false);
350  desc.add<bool>("Debug", false);
351  desc.add<bool>("Famos", false);
352  desc.add<std::string>("Label", "simEcalUnsuppressedDigis");
353  desc.add<std::string>("InstanceEB", "");
354  desc.add<std::string>("InstanceEE", "");
355  const std::string kComment(
356  "A value of -1 will make the module lookup the value of 'binOfMaximum' "
357  "from the module 'ecalUnsuppressedDigis' from the process history. "
358  "Allowed values are -1 and from 1-10.");
359  // The code before the existence of fillDescriptions did something special if
360  // 'binOfMaximum' was missing. This replicates that behavior.
361  desc.add<int>("binOfMaximum", -1)->setComment(kComment);
362  descriptions.addDefault(desc);
363 }
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 151 of file EcalTrigPrimProducer.cc.

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

Referenced by beginRun(), and produce().

151  {
152  // get Eventsetup records
153 
154  // for EcalFenixStrip...
155  // get parameter records for xtals
156  edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
157  setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
158  const EcalTPGLinearizationConst *ecaltpLin =
159  theEcalTPGLinearization_handle.product();
160  edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
161  setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
162  const EcalTPGPedestals *ecaltpPed = theEcalTPGPedestals_handle.product();
163  edm::ESHandle<EcalTPGCrystalStatus> theEcalTPGCrystalStatus_handle;
164  setup.get<EcalTPGCrystalStatusRcd>().get(theEcalTPGCrystalStatus_handle);
165  const EcalTPGCrystalStatus *ecaltpgBadX =
166  theEcalTPGCrystalStatus_handle.product();
167 
168  // for strips
169  edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
170  setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
171  const EcalTPGSlidingWindow *ecaltpgSlidW =
172  theEcalTPGSlidingWindow_handle.product();
173  edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
174  setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
175  const EcalTPGWeightIdMap *ecaltpgWeightMap =
176  theEcalTPGWEightIdMap_handle.product();
177  edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
178  setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
179  const EcalTPGWeightGroup *ecaltpgWeightGroup =
180  theEcalTPGWEightGroup_handle.product();
181  edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle;
183  theEcalTPGFineGrainStripEE_handle);
184  const EcalTPGFineGrainStripEE *ecaltpgFgStripEE =
185  theEcalTPGFineGrainStripEE_handle.product();
186  edm::ESHandle<EcalTPGStripStatus> theEcalTPGStripStatus_handle;
187  setup.get<EcalTPGStripStatusRcd>().get(theEcalTPGStripStatus_handle);
188  const EcalTPGStripStatus *ecaltpgStripStatus =
189  theEcalTPGStripStatus_handle.product();
190 
191  algo_->setPointers(ecaltpLin, ecaltpPed, ecaltpgSlidW, ecaltpgWeightMap,
192  ecaltpgWeightGroup, ecaltpgFgStripEE, ecaltpgBadX,
193  ecaltpgStripStatus);
194 
195  // .. and for EcalFenixTcp
196  // get parameter records for towers
197  edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle;
199  theEcalTPGFineGrainEBGroup_handle);
200  const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup =
201  theEcalTPGFineGrainEBGroup_handle.product();
202 
203  edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
204  setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
205  const EcalTPGLutGroup *ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
206 
207  edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
208  setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
209  const EcalTPGLutIdMap *ecaltpgLut = theEcalTPGLutIdMap_handle.product();
210 
211  edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle;
213  theEcalTPGFineGrainEBIdMap_handle);
214  const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB =
215  theEcalTPGFineGrainEBIdMap_handle.product();
216 
217  edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle;
219  theEcalTPGFineGrainTowerEE_handle);
220  const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE =
221  theEcalTPGFineGrainTowerEE_handle.product();
222 
223  edm::ESHandle<EcalTPGTowerStatus> theEcalTPGTowerStatus_handle;
224  setup.get<EcalTPGTowerStatusRcd>().get(theEcalTPGTowerStatus_handle);
225  const EcalTPGTowerStatus *ecaltpgBadTT =
226  theEcalTPGTowerStatus_handle.product();
227 
228  edm::ESHandle<EcalTPGSpike> theEcalTPGSpike_handle;
229  setup.get<EcalTPGSpikeRcd>().get(theEcalTPGSpike_handle);
230  const EcalTPGSpike *ecaltpgSpike = theEcalTPGSpike_handle.product();
231 
232  algo_->setPointers2(ecaltpgFgEBGroup, ecaltpgLutGroup, ecaltpgLut,
233  ecaltpgFineGrainEB, ecaltpgFineGrainTowerEE, ecaltpgBadTT,
234  ecaltpgSpike);
235 
236  // we will suppose that everything is to be updated if the
237  // EcalTPGLinearizationConstRcd has changed
238  return setup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
239 }
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
T const * product() const
Definition: ESHandle.h:86
void EcalTrigPrimProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 244 of file EcalTrigPrimProducer.cc.

References algo_, Reference_intrackfit_cff::barrel, barrelOnly_, cacheID_, edm::eventsetup::EventSetupRecord::cacheIdentifier(), makeMuonMisalignmentScenario::endcap, Exception, edm::EventSetup::get(), edm::Event::getByToken(), getRecords(), mps_fire::i, edm::EventBase::id(), tablePrinter::labels, LogDebug, edm::ProductLabels::module, eostools::move(), edm::print(), edm::Handle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), edm::DataFrameContainer::size(), tcpFormat_, tokenEB_, and tokenEE_.

245  {
246 
247  // update constants if necessary
249  cacheID_ = this->getRecords(iSetup);
250 
251  // get input collections
252 
255  bool barrel = true;
256  bool endcap = true;
257  if (barrelOnly_)
258  endcap = false;
259 
260  if (!e.getByToken(tokenEB_, ebDigis)) {
261  barrel = false;
263  labelsForToken(tokenEB_, labels);
264  edm::LogWarning("EcalTPG")
265  << " Couldnt find Barrel dataframes with producer " << labels.module
266  << " and label " << labels.productInstance << "!!!";
267  }
268  if (!barrelOnly_) {
269  if (!e.getByToken(tokenEE_, eeDigis)) {
270  endcap = false;
272  labelsForToken(tokenEE_, labels);
273  edm::LogWarning("EcalTPG")
274  << " Couldnt find Endcap dataframes with producer " << labels.module
275  << " and label " << labels.productInstance << "!!!";
276  }
277  }
278  if (!barrel && !endcap) {
280  labelsForToken(tokenEB_, labels);
281  throw cms::Exception(" ProductNotFound")
282  << "No EBDataFrames(EEDataFrames) with producer " << labels.module
283  << " and label " << labels.productInstance << " found in input!!\n";
284  }
285 
286  if (!barrelOnly_)
287  LogDebug("EcalTPG") << " =================> Treating event " << e.id()
288  << ", Number of EBDataFrames "
289  << ebDigis.product()->size()
290  << ", Number of EEDataFrames "
291  << eeDigis.product()->size();
292  else
293  LogDebug("EcalTPG") << " =================> Treating event " << e.id()
294  << ", Number of EBDataFrames "
295  << ebDigis.product()->size();
296 
297  auto pOut = std::make_unique<EcalTrigPrimDigiCollection>();
298  auto pOutTcp = std::make_unique<EcalTrigPrimDigiCollection>();
299 
300  // invoke algorithm
301 
302  const EBDigiCollection *ebdc = nullptr;
303  const EEDigiCollection *eedc = nullptr;
304  if (barrel) {
305  ebdc = ebDigis.product();
306  algo_->run(iSetup, ebdc, *pOut, *pOutTcp);
307  }
308 
309  if (endcap) {
310  eedc = eeDigis.product();
311  algo_->run(iSetup, eedc, *pOut, *pOutTcp);
312  }
313 
314  edm::LogInfo("produce") << "For Barrel + Endcap, " << pOut->size()
315  << " TP Digis were produced";
316 
317  // debug prints if TP >0
318 
319  for (unsigned int i = 0; i < pOut->size(); ++i) {
320  bool print = false;
321  for (int isam = 0; isam < (*pOut)[i].size(); ++isam) {
322  if ((*pOut)[i][isam].raw())
323  print = true;
324  }
325  if (print)
326  LogDebug("EcalTPG") << " For tower " << (((*pOut)[i])).id() << ", TP is "
327  << (*pOut)[i];
328  }
329  if (barrelOnly_)
330  LogDebug("EcalTPG") << "\n =================> For Barrel , " << pOut->size()
331  << " TP Digis were produced (including zero ones)";
332  else
333  LogDebug("EcalTPG") << "\n =================> For Barrel + Endcap, "
334  << pOut->size()
335  << " TP Digis were produced (including zero ones)";
336 
337  // put result into the Event
338 
339  e.put(std::move(pOut));
340  if (tcpFormat_)
341  e.put(std::move(pOutTcp), "formatTCP");
342 }
#define LogDebug(id)
unsigned long long cacheIdentifier() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
std::unique_ptr< EcalTrigPrimFunctionalAlgo > algo_
unsigned long long cacheID_
unsigned long long getRecords(edm::EventSetup const &setup)
char const * module
Definition: ProductLabels.h:5
edm::EDGetTokenT< EBDigiCollection > tokenEB_
T const * product() const
Definition: Handle.h:74
edm::EventID id() const
Definition: EventBase.h:59
char const * productInstance
Definition: ProductLabels.h:6
edm::EDGetTokenT< EEDigiCollection > tokenEE_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 48 of file EcalTrigPrimProducer.h.

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

bool EcalTrigPrimProducer::barrelOnly_
private

Definition at line 49 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 51 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::famos_
private

Definition at line 52 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::fillBinOfMaximumFromHistory_
private

Definition at line 57 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::tcpFormat_
private

Definition at line 50 of file EcalTrigPrimProducer.h.

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

edm::EDGetTokenT<EBDigiCollection> EcalTrigPrimProducer::tokenEB_
private

Definition at line 53 of file EcalTrigPrimProducer.h.

Referenced by produce().

edm::EDGetTokenT<EEDigiCollection> EcalTrigPrimProducer::tokenEE_
private

Definition at line 54 of file EcalTrigPrimProducer.h.

Referenced by produce().