CMS 3D CMS Logo

EcalTrigPrimProducer Class Reference

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

#include <SimCalorimetry/EcalTrigPrimProducers/plugins/EcalTrigPrimProducer.h>

Inheritance diagram for EcalTrigPrimProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginJob (edm::EventSetup const &setup)
void beginRun (const edm::Run &run, const edm::EventSetup &es)
 EcalTrigPrimProducer (const edm::ParameterSet &conf)
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

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


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.

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, LLR Palaiseau
Version:
1st Version may 2006

2nd Version jul 2006

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


Constructor & Destructor Documentation

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

Definition at line 56 of file EcalTrigPrimProducer.cc.

References algo_, edm::ParameterSet::getParameter(), instanceNameEB_, instanceNameEE_, label_, NULL, and tcpFormat_.

00056                                                                          :
00057   barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")),
00058   tcpFormat_(iConfig.getParameter<bool>("TcpOutput")),
00059   debug_(iConfig.getParameter<bool>("Debug")),ps_(iConfig)
00060 {
00061   //register your products
00062   produces <EcalTrigPrimDigiCollection >();
00063   if (tcpFormat_) produces <EcalTrigPrimDigiCollection >("formatTCP");
00064 
00065   label_= iConfig.getParameter<std::string>("Label");
00066   instanceNameEB_ = iConfig.getParameter<std::string>("InstanceEB");;
00067   instanceNameEE_ = iConfig.getParameter<std::string>("InstanceEE");;
00068   algo_=NULL;
00069 }
void EcalTrigPrimProducer::beginRun(const edm::Run & run,edm::EventSetup const& setup) {

EcalTrigPrimProducer::~EcalTrigPrimProducer (  )  [virtual]

Definition at line 176 of file EcalTrigPrimProducer.cc.

References algo_.

00177 {
00178 
00179   // do anything here that needs to be done at desctruction time
00180   // (e.g. close files, deallocate resources etc.)
00181   delete algo_;
00182 
00183 }


Member Function Documentation

void EcalTrigPrimProducer::beginJob ( edm::EventSetup const &  setup  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 73 of file EcalTrigPrimProducer.cc.

References algo_, barrelOnly_, binOfMaximum_, cacheID_, debug_, find(), edm::BranchDescription::friendlyClassName(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::getParameterSet(), getRecords(), it, edm::BranchDescription::moduleLabel(), names, ps_, edm::BranchDescription::psetID(), HLT_VtxMuL3::result, and tcpFormat_.

00073                                                               {
00074 
00075   bool famos = ps_.getParameter<bool>("Famos");
00076 
00077   //  get  binOfMax
00078   //  try first in cfg, then in ProductRegistry
00079   //  =6 is default (1-10 possible values)
00080   binOfMaximum_=0;  //starts at 1!
00081   bool found=false;
00082   std::vector<std::string> names = ps_.getParameterNames();
00083   if (find(names.begin(), names.end(), std::string("binOfMaximum"))
00084       != names.end()) {
00085     binOfMaximum_=ps_.getParameter<int>("binOfMaximum");
00086     edm::LogInfo("EcalTPG") <<"EcalTrigPrimProducer is using binOfMaximum found in cfg file :  "<<binOfMaximum_;
00087     found = true;
00088   }
00089   
00090   edm::Service<edm::ConstProductRegistry> reg;
00091   // Loop over provenance of products in registry.
00092   for (edm::ProductRegistry::ProductList::const_iterator it =  reg->productList().begin();
00093        it != reg->productList().end(); ++it) {
00094     edm::BranchDescription desc = it->second;
00095     if (desc.friendlyClassName().find("EBDigiCollection")==0  &&
00096         desc.moduleLabel()=="ecalUnsuppressedDigis") {
00097       edm::ParameterSet result = getParameterSet(desc.psetID());
00098       if (found ) {
00099         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")<<")!!!";
00100       }else {
00101         binOfMaximum_=result.getParameter<int>("binOfMaximum");
00102         edm::LogInfo("EcalTPG") <<"EcalTrigPrimProducer is using binOfMaximum found in ProductRegistry :  "<<binOfMaximum_;
00103         break;
00104       }
00105     }
00106   }
00107 
00108 
00109   if (binOfMaximum_==0) {
00110     binOfMaximum_=6;
00111     edm::LogWarning("EcalTPG")<<"Could not find product registry of EBDigiCollection (label ecalUnsuppressedDigis), had to set the following parameters by Hand:  binOfMaximum="<<binOfMaximum_;
00112   }
00113 
00114   algo_ = new EcalTrigPrimFunctionalAlgo(setup,binOfMaximum_,tcpFormat_,barrelOnly_,debug_,famos);
00115 
00116   // get a first version of the records
00117   cacheID_=this->getRecords(setup);
00118 }

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

Definition at line 70 of file EcalTrigPrimProducer.cc.

00070                                                                                  {
00071 }

unsigned long long EcalTrigPrimProducer::getRecords ( edm::EventSetup const &  setup  )  [private]

Definition at line 120 of file EcalTrigPrimProducer.cc.

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

Referenced by beginJob().

00120                                                                                {
00121   // get Eventsetup records
00122 
00123   // for EcalFenixStrip...
00124   // get parameter records for xtals
00125   edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
00126   setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
00127   const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product();
00128   edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
00129   setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
00130   const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product();
00131 
00132   //for strips
00133   edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
00134   setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
00135   const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product();
00136   edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
00137   setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
00138   const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product();
00139   edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
00140   setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
00141   const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product();
00142   edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle;
00143   setup.get<EcalTPGFineGrainStripEERcd>().get(theEcalTPGFineGrainStripEE_handle);
00144   const EcalTPGFineGrainStripEE * ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product();     
00145 
00146   algo_->setPointers(ecaltpLin,ecaltpPed,ecaltpgSlidW,ecaltpgWeightMap,ecaltpgWeightGroup,ecaltpgFgStripEE);
00147 
00148   // .. and for EcalFenixTcp
00149   // get parameter records for towers
00150   edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle;
00151   setup.get<EcalTPGFineGrainEBGroupRcd>().get(theEcalTPGFineGrainEBGroup_handle);
00152   const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product();
00153 
00154   edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
00155   setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
00156   const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
00157 
00158   edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
00159   setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
00160   const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product();
00161 
00162   edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle;
00163   setup.get<EcalTPGFineGrainEBIdMapRcd>().get(theEcalTPGFineGrainEBIdMap_handle);
00164   const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product();
00165 
00166     edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle;
00167     setup.get<EcalTPGFineGrainTowerEERcd>().get(theEcalTPGFineGrainTowerEE_handle);
00168     const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product();
00169 
00170   algo_->setPointers2(ecaltpgFgEBGroup,ecaltpgLutGroup,ecaltpgLut, ecaltpgFineGrainEB,ecaltpgFineGrainTowerEE);
00171 
00172   // we will suppose that everything is to be updated if the EcalTPGLinearizationConstRcd has changed
00173   return setup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
00174 }

void EcalTrigPrimProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 188 of file EcalTrigPrimProducer.cc.

References algo_, GeomDetEnumerators::barrel, barrelOnly_, cacheID_, GeomDetEnumerators::endcap, Exception, edm::EventSetup::get(), edm::Event::getByLabel(), i, edm::Event::id(), instanceNameEB_, instanceNameEE_, label_, LogDebug, NULL, print(), edm::Handle< T >::product(), edm::Event::put(), EcalTrigPrimFunctionalAlgo::run(), and tcpFormat_.

00189 {
00190 
00191   // update constants if necessary
00192   if (iSetup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier()!=cacheID_) cacheID_=this->getRecords(iSetup);
00193 
00194 
00195   // get input collections
00196 
00197   edm::Handle<EBDigiCollection> ebDigis;
00198   edm::Handle<EEDigiCollection> eeDigis;
00199   bool barrel=true;
00200   bool endcap=true;
00201   if (barrelOnly_) endcap=false;
00202 
00203   if (!e.getByLabel(label_,instanceNameEB_,ebDigis)) {
00204     barrel=false;
00205     edm::LogWarning("EcalTPG") <<" Couldnt find Barrel dataframes with producer "<<label_<<" and label "<<instanceNameEB_<<"!!!";
00206   }
00207   if (!barrelOnly_) {
00208     if (!e.getByLabel(label_,instanceNameEE_,eeDigis)) {
00209       endcap=false;
00210       edm::LogWarning("EcalTPG") <<" Couldnt find Endcap dataframes with producer "<<label_<<" and label "<<instanceNameEE_<<"!!!";
00211     }
00212   }
00213   if (!barrel && !endcap) {
00214     throw cms::Exception(" ProductNotFound") <<"No EBDataFrames(EEDataFrames) with producer "<<label_<<" and label "<<instanceNameEB_<<" found in input!!\n";
00215   }
00216 
00217   if (!barrelOnly_)   LogDebug("EcalTPG") <<" =================> Treating event  "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size()<<", Number of EEDataFrames "<<eeDigis.product()->size() ;
00218   else  LogDebug("EcalTPG") <<" =================> Treating event  "<<e.id()<<", Number of EBDataFrames "<<ebDigis.product()->size();
00219 
00220   std::auto_ptr<EcalTrigPrimDigiCollection> pOut(new  EcalTrigPrimDigiCollection);
00221   std::auto_ptr<EcalTrigPrimDigiCollection> pOutTcp(new  EcalTrigPrimDigiCollection);
00222  
00223 
00224   // invoke algorithm 
00225 
00226   const EBDigiCollection *ebdc=NULL;
00227   const EEDigiCollection *eedc=NULL;
00228   if (barrel) {
00229     ebdc=ebDigis.product();
00230     algo_->run(iSetup,ebdc,*pOut,*pOutTcp);
00231   }
00232 
00233   if (endcap) {
00234     eedc=eeDigis.product();
00235     algo_->run(iSetup,eedc,*pOut,*pOutTcp);
00236   }
00237 
00238   edm::LogInfo("produce") <<"For Barrel + Endcap, "<<pOut->size()<<" TP  Digis were produced";
00239 
00240   //  debug prints if TP >0
00241 
00242   for (unsigned int i=0;i<pOut->size();++i) {
00243     bool print=false;
00244     for (int isam=0;isam<(*pOut)[i].size();++isam) {
00245       if ((*pOut)[i][isam].raw()) print=true;
00246     }
00247     if (print) LogDebug("EcalTPG") <<" For tower  "<<(((*pOut)[i])).id()<<", TP is "<<(*pOut)[i];
00248   }
00249   if (barrelOnly_)  LogDebug("EcalTPG") <<"\n =================> For Barrel , "<<pOut->size()<<" TP  Digis were produced (including zero ones)";
00250   else      LogDebug("EcalTPG") <<"\n =================> For Barrel + Endcap, "<<pOut->size()<<" TP  Digis were produced (including zero ones)";
00251 
00252   // put result into the Event
00253 
00254   e.put(pOut);
00255   if (tcpFormat_) e.put(pOutTcp,"formatTCP");
00256 }


Member Data Documentation

EcalTrigPrimFunctionalAlgo* EcalTrigPrimProducer::algo_ [private]

Definition at line 47 of file EcalTrigPrimProducer.h.

Referenced by beginJob(), EcalTrigPrimProducer(), getRecords(), produce(), and ~EcalTrigPrimProducer().

bool EcalTrigPrimProducer::barrelOnly_ [private]

Definition at line 49 of file EcalTrigPrimProducer.h.

Referenced by beginJob(), and produce().

int EcalTrigPrimProducer::binOfMaximum_ [private]

Definition at line 56 of file EcalTrigPrimProducer.h.

Referenced by beginJob().

unsigned long long EcalTrigPrimProducer::cacheID_ [private]

Definition at line 62 of file EcalTrigPrimProducer.h.

Referenced by beginJob(), and produce().

bool EcalTrigPrimProducer::debug_ [private]

Definition at line 51 of file EcalTrigPrimProducer.h.

Referenced by beginJob().

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().

bool EcalTrigPrimProducer::tcpFormat_ [private]

Definition at line 50 of file EcalTrigPrimProducer.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:01 2009 for CMSSW by  doxygen 1.5.4