#include <EcalTrigPrimProducer.h>
Public Member Functions | |
void | beginJob () |
void | beginRun (edm::Run &run, const edm::EventSetup &es) |
EcalTrigPrimProducer (const edm::ParameterSet &conf) | |
void | endRun (edm::Run &, const edm::EventSetup &) |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
virtual | ~EcalTrigPrimProducer () |
Private Member Functions | |
unsigned long long | getRecords (edm::EventSetup const &setup) |
Private Attributes | |
EcalTrigPrimFunctionalAlgo * | algo_ |
bool | barrelOnly_ |
int | binOfMaximum_ |
unsigned long long | cacheID_ |
bool | debug_ |
TFile * | histfile_ |
std::string | instanceNameEB_ |
std::string | instanceNameEE_ |
std::string | label_ |
const edm::ParameterSet | ps_ |
bool | tcpFormat_ |
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
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
Definition at line 33 of file EcalTrigPrimProducer.h.
EcalTrigPrimProducer::EcalTrigPrimProducer | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 65 of file EcalTrigPrimProducer.cc.
References algo_, edm::ParameterSet::getParameter(), instanceNameEB_, instanceNameEE_, label_, NULL, and tcpFormat_.
: barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")), tcpFormat_(iConfig.getParameter<bool>("TcpOutput")), debug_(iConfig.getParameter<bool>("Debug")),ps_(iConfig) { //register your products produces <EcalTrigPrimDigiCollection >(); if (tcpFormat_) produces <EcalTrigPrimDigiCollection >("formatTCP"); label_= iConfig.getParameter<std::string>("Label"); instanceNameEB_ = iConfig.getParameter<std::string>("InstanceEB");; instanceNameEE_ = iConfig.getParameter<std::string>("InstanceEE");; algo_=NULL; }
EcalTrigPrimProducer::~EcalTrigPrimProducer | ( | ) | [virtual] |
Definition at line 204 of file EcalTrigPrimProducer.cc.
{}
void EcalTrigPrimProducer::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 93 of file EcalTrigPrimProducer.cc.
References binOfMaximum_, spr::find(), newFWLiteAna::found, edm::BranchDescription::friendlyClassName(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::getParameterSet(), edm::BranchDescription::moduleLabel(), h::names, ps_, edm::BranchDescription::psetID(), and query::result.
{ // get binOfMax // try first in cfg, then in ProductRegistry // =6 is default (1-10 possible values) binOfMaximum_=0; //starts at 1! bool found=false; std::vector<std::string> names = ps_.getParameterNames(); if (find(names.begin(), names.end(), std::string("binOfMaximum")) != names.end()) { binOfMaximum_=ps_.getParameter<int>("binOfMaximum"); edm::LogInfo("EcalTPG") <<"EcalTrigPrimProducer is using binOfMaximum found in cfg file : "<<binOfMaximum_; found = true; } edm::Service<edm::ConstProductRegistry> reg; // Loop over provenance of products in registry. for (edm::ProductRegistry::ProductList::const_iterator it = reg->productList().begin(); it != reg->productList().end(); ++it) { edm::BranchDescription desc = it->second; if (desc.friendlyClassName().find("EBDigiCollection")==0 && desc.moduleLabel()=="ecalUnsuppressedDigis") { edm::ParameterSet result = getParameterSet(desc.psetID()); if (found ) { if ( result.getParameter<int>("binOfMaximum")!=binOfMaximum_)edm:: LogWarning("EcalTPG")<< "binofMaximum given in configuration (="<<binOfMaximum_<<") is different from the one found in ProductRegistration(="<<result.getParameter<int>("binOfMaximum")<<")!!!"; }else { binOfMaximum_=result.getParameter<int>("binOfMaximum"); edm::LogInfo("EcalTPG") <<"EcalTrigPrimProducer is using binOfMaximum found in ProductRegistry : "<<binOfMaximum_; break; } } } if (binOfMaximum_==0) { binOfMaximum_=6; edm::LogWarning("EcalTPG")<<"Could not find product registry of EBDigiCollection (label ecalUnsuppressedDigis), had to set the following parameters by Hand: binOfMaximum="<<binOfMaximum_; } }
void EcalTrigPrimProducer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | es | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 80 of file EcalTrigPrimProducer.cc.
References algo_, barrelOnly_, binOfMaximum_, cacheID_, debug_, edm::ParameterSet::getParameter(), getRecords(), ps_, and tcpFormat_.
{ bool famos = ps_.getParameter<bool>("Famos"); algo_ = new EcalTrigPrimFunctionalAlgo(setup,binOfMaximum_,tcpFormat_,barrelOnly_,debug_,famos); // get a first version of the records cacheID_=this->getRecords(setup); }
void EcalTrigPrimProducer::endRun | ( | edm::Run & | run, |
const edm::EventSetup & | setup | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 89 of file EcalTrigPrimProducer.cc.
References algo_.
{ delete algo_; }
unsigned long long EcalTrigPrimProducer::getRecords | ( | edm::EventSetup const & | setup | ) | [private] |
Definition at line 133 of file EcalTrigPrimProducer.cc.
References algo_, edm::EventSetup::get(), edm::ESHandle< T >::product(), EcalTrigPrimFunctionalAlgo::setPointers(), and EcalTrigPrimFunctionalAlgo::setPointers2().
Referenced by beginRun(), and produce().
{ // get Eventsetup records // for EcalFenixStrip... // get parameter records for xtals edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle; setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle); const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product(); edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle; setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle); const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product(); edm::ESHandle<EcalTPGCrystalStatus> theEcalTPGCrystalStatus_handle; setup.get<EcalTPGCrystalStatusRcd>().get(theEcalTPGCrystalStatus_handle); const EcalTPGCrystalStatus * ecaltpgBadX = theEcalTPGCrystalStatus_handle.product(); //for strips edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle; setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle); const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product(); edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle; setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle); const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product(); edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle; setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle); const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product(); edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle; setup.get<EcalTPGFineGrainStripEERcd>().get(theEcalTPGFineGrainStripEE_handle); const EcalTPGFineGrainStripEE * ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product(); edm::ESHandle<EcalTPGStripStatus> theEcalTPGStripStatus_handle; setup.get<EcalTPGStripStatusRcd>().get(theEcalTPGStripStatus_handle); const EcalTPGStripStatus * ecaltpgStripStatus = theEcalTPGStripStatus_handle.product(); algo_->setPointers(ecaltpLin,ecaltpPed,ecaltpgSlidW,ecaltpgWeightMap,ecaltpgWeightGroup,ecaltpgFgStripEE,ecaltpgBadX,ecaltpgStripStatus); // .. and for EcalFenixTcp // get parameter records for towers edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle; setup.get<EcalTPGFineGrainEBGroupRcd>().get(theEcalTPGFineGrainEBGroup_handle); const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product(); edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle; setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle); const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product(); edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle; setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle); const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product(); edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle; setup.get<EcalTPGFineGrainEBIdMapRcd>().get(theEcalTPGFineGrainEBIdMap_handle); const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product(); edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle; setup.get<EcalTPGFineGrainTowerEERcd>().get(theEcalTPGFineGrainTowerEE_handle); const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product(); edm::ESHandle<EcalTPGTowerStatus> theEcalTPGTowerStatus_handle; setup.get<EcalTPGTowerStatusRcd>().get(theEcalTPGTowerStatus_handle); const EcalTPGTowerStatus * ecaltpgBadTT = theEcalTPGTowerStatus_handle.product(); edm::ESHandle<EcalTPGSpike> theEcalTPGSpike_handle; setup.get<EcalTPGSpikeRcd>().get(theEcalTPGSpike_handle); const EcalTPGSpike * ecaltpgSpike = theEcalTPGSpike_handle.product(); algo_->setPointers2(ecaltpgFgEBGroup,ecaltpgLutGroup,ecaltpgLut,ecaltpgFineGrainEB,ecaltpgFineGrainTowerEE,ecaltpgBadTT,ecaltpgSpike); // we will suppose that everything is to be updated if the EcalTPGLinearizationConstRcd has changed return setup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier(); }
void EcalTrigPrimProducer::produce | ( | edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 210 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::getByLabel(), getRecords(), i, edm::EventBase::id(), instanceNameEB_, instanceNameEE_, label_, LogDebug, NULL, reco::print(), edm::Handle< T >::product(), edm::Event::put(), EcalTrigPrimFunctionalAlgo::run(), and tcpFormat_.
{ // update constants if necessary if (iSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier()!=cacheID_) cacheID_=this->getRecords(iSetup); // get input collections edm::Handle<EBDigiCollection> ebDigis; edm::Handle<EEDigiCollection> eeDigis; bool barrel=true; bool endcap=true; if (barrelOnly_) endcap=false; if (!e.getByLabel(label_,instanceNameEB_,ebDigis)) { barrel=false; edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with producer "<<label_<<" and label "<<instanceNameEB_<<"!!!"; } if (!barrelOnly_) { if (!e.getByLabel(label_,instanceNameEE_,eeDigis)) { endcap=false; edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with producer "<<label_<<" and label "<<instanceNameEE_<<"!!!"; } } if (!barrel && !endcap) { throw cms::Exception(" ProductNotFound") <<"No EBDataFrames(EEDataFrames) with producer "<<label_<<" and label "<<instanceNameEB_<<" found in input!!\n"; } if (!barrelOnly_) LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size()<<", Number of EEDataFrames "<<eeDigis.product()->size() ; else LogDebug("EcalTPG") <<" =================> Treating event "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size(); std::auto_ptr<EcalTrigPrimDigiCollection> pOut(new EcalTrigPrimDigiCollection); std::auto_ptr<EcalTrigPrimDigiCollection> pOutTcp(new EcalTrigPrimDigiCollection); // invoke algorithm const EBDigiCollection *ebdc=NULL; const EEDigiCollection *eedc=NULL; if (barrel) { ebdc=ebDigis.product(); algo_->run(iSetup,ebdc,*pOut,*pOutTcp); } if (endcap) { eedc=eeDigis.product(); algo_->run(iSetup,eedc,*pOut,*pOutTcp); } edm::LogInfo("produce") <<"For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced"; // debug prints if TP >0 for (unsigned int i=0;i<pOut->size();++i) { bool print=false; for (int isam=0;isam<(*pOut)[i].size();++isam) { if ((*pOut)[i][isam].raw()) print=true; } if (print) LogDebug("EcalTPG") <<" For tower "<<(((*pOut)[i])).id()<<", TP is "<<(*pOut)[i]; } if (barrelOnly_) LogDebug("EcalTPG") <<"\n =================> For Barrel , "<<pOut->size()<<" TP Digis were produced (including zero ones)"; else LogDebug("EcalTPG") <<"\n =================> For Barrel + Endcap, "<<pOut->size()<<" TP Digis were produced (including zero ones)"; // put result into the Event e.put(pOut); if (tcpFormat_) e.put(pOutTcp,"formatTCP"); }
Definition at line 47 of file EcalTrigPrimProducer.h.
Referenced by beginRun(), EcalTrigPrimProducer(), 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 beginJob(), and beginRun().
unsigned long long EcalTrigPrimProducer::cacheID_ [private] |
Definition at line 62 of file EcalTrigPrimProducer.h.
Referenced by beginRun(), and produce().
bool EcalTrigPrimProducer::debug_ [private] |
Definition at line 51 of file EcalTrigPrimProducer.h.
Referenced by beginRun().
TFile* EcalTrigPrimProducer::histfile_ [private] |
Definition at line 48 of file EcalTrigPrimProducer.h.
std::string EcalTrigPrimProducer::instanceNameEB_ [private] |
Definition at line 53 of file EcalTrigPrimProducer.h.
Referenced by EcalTrigPrimProducer(), and produce().
std::string EcalTrigPrimProducer::instanceNameEE_ [private] |
Definition at line 54 of file EcalTrigPrimProducer.h.
Referenced by EcalTrigPrimProducer(), and produce().
std::string EcalTrigPrimProducer::label_ [private] |
Definition at line 52 of file EcalTrigPrimProducer.h.
Referenced by EcalTrigPrimProducer(), and produce().
const edm::ParameterSet EcalTrigPrimProducer::ps_ [private] |
Definition at line 58 of file EcalTrigPrimProducer.h.
Referenced by beginJob(), and beginRun().
bool EcalTrigPrimProducer::tcpFormat_ [private] |
Definition at line 50 of file EcalTrigPrimProducer.h.
Referenced by beginRun(), EcalTrigPrimProducer(), and produce().