test
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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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_
 
bool tcpFormat_
 
edm::EDGetTokenT
< EBDigiCollection
tokenEB_
 
edm::EDGetTokenT
< EEDigiCollection
tokenEE_
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 35 of file EcalTrigPrimProducer.h.

Constructor & Destructor Documentation

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

Definition at line 63 of file EcalTrigPrimProducer.cc.

References tcpFormat_.

63  :
64  barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")),
65  tcpFormat_(iConfig.getParameter<bool>("TcpOutput")),
66  debug_(iConfig.getParameter<bool>("Debug")),
67  famos_(iConfig.getParameter<bool>("Famos")),
68  tokenEB_(consumes <EBDigiCollection>(edm::InputTag(iConfig.getParameter<std::string>("Label"), iConfig.getParameter<std::string>("InstanceEB")))),
69  tokenEE_(consumes <EEDigiCollection>(edm::InputTag(iConfig.getParameter<std::string>("Label"), 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 }
edm::EDGetTokenT< EBDigiCollection > tokenEB_
edm::EDGetTokenT< EEDigiCollection > tokenEE_
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:99
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 281 of file EcalTrigPrimProducer.cc.

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

281  {
282 
284  desc.add<bool>("BarrelOnly",false);
285  desc.add<bool>("TcpOutput",false);
286  desc.add<bool>("Debug",false);
287  desc.add<bool>("Famos",false);
288  desc.add<std::string>("Label","simEcalUnsuppressedDigis");
289  desc.add<std::string>("InstanceEB","");
290  desc.add<std::string>("InstanceEE","");
291  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.");
292  //The code before the existence of fillDescriptions did something special if 'binOfMaximum' was missing. This replicates that behavior.
293  desc.add<int>("binOfMaximum",-1)->setComment(kComment);
294  descriptions.addDefault(desc);
295 }
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:86
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, Exception, edm::EventSetup::get(), edm::Event::getByToken(), getRecords(), i, edm::EventBase::id(), HLT_25ns10e33_v2_cff::labels, edm::EDConsumerBase::labelsForToken(), LogDebug, edm::ProductLabels::module, NULL, reco::print(), edm::Handle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), tcpFormat_, tokenEB_, and tokenEE_.

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.getByToken(tokenEB_,ebDigis)) {
220  barrel=false;
222  labelsForToken(tokenEB_, labels);
223  edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with producer "<<labels.module<<" and label "<<labels.productInstance<<"!!!";
224  }
225  if (!barrelOnly_) {
226  if (!e.getByToken(tokenEE_,eeDigis)) {
227  endcap=false;
229  labelsForToken(tokenEE_, labels);
230  edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with producer "<<labels.module<<" and label "<<labels.productInstance<<"!!!";
231  }
232  }
233  if (!barrel && !endcap) {
235  labelsForToken(tokenEB_, labels);
236  throw cms::Exception(" ProductNotFound") <<"No EBDataFrames(EEDataFrames) with producer "<<labels.module<<" and label "<<labels.productInstance<<" found in input!!\n";
237  }
238 
239  if (!barrelOnly_) LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size()<<", Number of EEDataFrames "<<eeDigis.product()->size() ;
240  else LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size();
241 
242  std::auto_ptr<EcalTrigPrimDigiCollection> pOut(new EcalTrigPrimDigiCollection);
243  std::auto_ptr<EcalTrigPrimDigiCollection> pOutTcp(new EcalTrigPrimDigiCollection);
244 
245 
246  // invoke algorithm
247 
248  const EBDigiCollection *ebdc=NULL;
249  const EEDigiCollection *eedc=NULL;
250  if (barrel) {
251  ebdc=ebDigis.product();
252  algo_->run(iSetup,ebdc,*pOut,*pOutTcp);
253  }
254 
255  if (endcap) {
256  eedc=eeDigis.product();
257  algo_->run(iSetup,eedc,*pOut,*pOutTcp);
258  }
259 
260  edm::LogInfo("produce") <<"For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced";
261 
262  // debug prints if TP >0
263 
264  for (unsigned int i=0;i<pOut->size();++i) {
265  bool print=false;
266  for (int isam=0;isam<(*pOut)[i].size();++isam) {
267  if ((*pOut)[i][isam].raw()) print=true;
268  }
269  if (print) LogDebug("EcalTPG") <<" For tower "<<(((*pOut)[i])).id()<<", TP is "<<(*pOut)[i];
270  }
271  if (barrelOnly_) LogDebug("EcalTPG") <<"\n =================> For Barrel , "<<pOut->size()<<" TP Digis were produced (including zero ones)";
272  else LogDebug("EcalTPG") <<"\n =================> For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced (including zero ones)";
273 
274  // put result into the Event
275 
276  e.put(pOut);
277  if (tcpFormat_) e.put(pOutTcp,"formatTCP");
278 }
#define LogDebug(id)
unsigned long long cacheIdentifier() const
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition: print.cc:10
#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:121
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:81
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
edm::EventID id() const
Definition: EventBase.h:59
char const * productInstance
Definition: ProductLabels.h:6
edm::EDGetTokenT< EEDigiCollection > tokenEE_

Member Data Documentation

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

Definition at line 50 of file EcalTrigPrimProducer.h.

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

bool EcalTrigPrimProducer::barrelOnly_
private

Definition at line 51 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), and produce().

int EcalTrigPrimProducer::binOfMaximum_
private

Definition at line 58 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

unsigned long long EcalTrigPrimProducer::cacheID_
private

Definition at line 63 of file EcalTrigPrimProducer.h.

Referenced by beginRun(), and produce().

bool EcalTrigPrimProducer::debug_
private

Definition at line 53 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::famos_
private

Definition at line 54 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::fillBinOfMaximumFromHistory_
private

Definition at line 59 of file EcalTrigPrimProducer.h.

Referenced by beginRun().

bool EcalTrigPrimProducer::tcpFormat_
private

Definition at line 52 of file EcalTrigPrimProducer.h.

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

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

Definition at line 55 of file EcalTrigPrimProducer.h.

Referenced by produce().

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

Definition at line 56 of file EcalTrigPrimProducer.h.

Referenced by produce().