CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/EventFilter/EcalRawToDigi/plugins/EcalRawToRecHitByproductProducer.cc

Go to the documentation of this file.
00001 #include "EventFilter/EcalRawToDigi/plugins/EcalRawToRecHitByproductProducer.h"
00002 #include "EventFilter/EcalRawToDigi/interface/EcalUnpackerWorkerRecord.h"
00003 #include "EventFilter/EcalRawToDigi/interface/EcalUnpackerWorker.h"
00004 
00005 
00006 EcalRawToRecHitByproductProducer::EcalRawToRecHitByproductProducer(const edm::ParameterSet& iConfig)
00007 {
00008   workerName_ = iConfig.getParameter<std::string>("workerName");
00009 
00010   produces<EBDigiCollection>("ebDigis"); 
00011   produces<EEDigiCollection>("eeDigis");
00012 
00013   produces<EBSrFlagCollection>();
00014   produces<EESrFlagCollection>();
00015   produces<EcalRawDataCollection>();
00016   produces<EcalPnDiodeDigiCollection>();
00017   produces<EcalTrigPrimDigiCollection>("EcalTriggerPrimitives");
00018   produces<EcalPSInputDigiCollection>("EcalPseudoStripInputs");
00019   
00020   // Integrity for xtal data
00021   produces<EBDetIdCollection>("EcalIntegrityGainErrors");
00022   produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");
00023   produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
00024 
00025   // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
00026   produces<EEDetIdCollection>("EcalIntegrityGainErrors");
00027   produces<EEDetIdCollection>("EcalIntegrityGainSwitchErrors");
00028   produces<EEDetIdCollection>("EcalIntegrityChIdErrors");
00029 
00030   // Integrity Errors
00031   produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
00032   produces<EcalElectronicsIdCollection>("EcalIntegrityZSXtalIdErrors");
00033   produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
00034  
00035   // Mem channels' integrity
00036   produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
00037   produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSizeErrors");
00038   produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
00039   produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
00040 }
00041 
00042 
00043 // ------------ method called to produce the data  ------------
00044 void
00045 EcalRawToRecHitByproductProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00046 {
00047   //retrieve the unpacker worker
00048   edm::ESHandle<EcalUnpackerWorkerBase> workerESH;
00049   iSetup.get<EcalUnpackerWorkerRecord>().get(workerName_, workerESH);
00050   const EcalUnpackerWorker * worker =  dynamic_cast<const EcalUnpackerWorker *>(&*workerESH);
00051   if (!worker) 
00052     edm::LogError("IncorrectConfiguration")<<"worker "<< workerName_ <<" could not be cast in EcalUnpackerWorker type."
00053                                                <<" this must be a configuration mistake. Expect a segfault right now.";
00054 
00055   LogDebug("EcalRawToRecHit|Byproducts")<<"worker retrieved.";
00056 
00057   //prepare output collections
00058   std::auto_ptr<EBDigiCollection> productDigisEB(worker->productDigisEB);
00059   
00060   // create the collection of Ecal Digis
00061   std::auto_ptr<EEDigiCollection> productDigisEE(worker->productDigisEE);
00062 
00063   // create the collection for headers
00064   std::auto_ptr<EcalRawDataCollection> productDccHeaders(worker->productDccHeaders);
00065 
00066   // create the collection for invalid gains
00067   std::auto_ptr< EBDetIdCollection> productInvalidGains(worker->productInvalidGains);
00068 
00069   // create the collection for invalid gain Switch
00070   std::auto_ptr< EBDetIdCollection> productInvalidGainsSwitch(worker->productInvalidGainsSwitch);
00071   
00072   // create the collection for invalid chids
00073   std::auto_ptr< EBDetIdCollection> productInvalidChIds(worker->productInvalidChIds);
00074   
00076     
00077   // create the collection for invalid gains
00078   std::auto_ptr<EEDetIdCollection> productInvalidEEGains(worker->productInvalidEEGains);
00079     
00080   // create the collection for invalid gain Switch
00081   std::auto_ptr<EEDetIdCollection> productInvalidEEGainsSwitch(worker->productInvalidEEGainsSwitch);
00082     
00083   // create the collection for invalid chids
00084   std::auto_ptr<EEDetIdCollection> productInvalidEEChIds(worker->productInvalidEEChIds);
00085   
00087     
00088   // create the collection for EB srflags       
00089   std::auto_ptr<EBSrFlagCollection> productEBSrFlags(worker->productEBSrFlags);
00090   
00091   // create the collection for EB srflags       
00092   std::auto_ptr<EESrFlagCollection> productEESrFlags(worker->productEESrFlags);
00093   
00094   // create the collection for ecal trigger primitives
00095   std::auto_ptr<EcalTrigPrimDigiCollection> productEcalTps(worker->productTps);
00096 
00097   // create the collection for ecal trigger primitives
00098   std::auto_ptr<EcalPSInputDigiCollection> productEcalPSs(worker->productPSs);
00099 
00101 
00102   // create the collection for invalid TTIds
00103   std::auto_ptr<EcalElectronicsIdCollection> productInvalidTTIds(worker->productInvalidTTIds);
00104  
00105   // create the collection for invalid XtalIds
00106   std::auto_ptr<EcalElectronicsIdCollection> productInvalidZSXtalIds(worker->productInvalidZSXtalIds);
00107  
00108   // create the collection for invalid BlockLengths
00109   std::auto_ptr<EcalElectronicsIdCollection> productInvalidBlockLengths(worker->productInvalidBlockLengths);
00110   
00111   // MEMs Collections
00112   // create the collection for the Pn Diode Digis
00113   std::auto_ptr<EcalPnDiodeDigiCollection> productPnDiodeDigis(worker->productPnDiodeDigis);
00114   
00115   // create the collection for invalid Mem Tt id 
00116   std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemTtIds(worker->productInvalidMemTtIds);
00117   
00118   // create the collection for invalid Mem Block Size 
00119   std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemBlockSizes(worker->productInvalidMemBlockSizes);
00120   
00121   // create the collection for invalid Mem Block Size 
00122   std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemChIds(worker->productInvalidMemChIds);
00123   
00124   // create the collection for invalid Mem Gain Errors 
00125   std::auto_ptr<EcalElectronicsIdCollection> productInvalidMemGains(worker->productInvalidMemGains);
00126   
00127 
00128   //---------------------------   
00129   //write outputs to the event
00130   //---------------------------   
00131 
00132   iEvent.put(productDigisEB,"ebDigis");
00133   iEvent.put(productDigisEE,"eeDigis");
00134   iEvent.put(productDccHeaders); 
00135   iEvent.put(productInvalidGains,"EcalIntegrityGainErrors");
00136   iEvent.put(productInvalidGainsSwitch, "EcalIntegrityGainSwitchErrors");
00137   iEvent.put(productInvalidChIds, "EcalIntegrityChIdErrors");
00138   // EE (leaving for now the same names as in EB)
00139   iEvent.put(productInvalidEEGains,"EcalIntegrityGainErrors");
00140   iEvent.put(productInvalidEEGainsSwitch, "EcalIntegrityGainSwitchErrors");
00141   iEvent.put(productInvalidEEChIds, "EcalIntegrityChIdErrors");
00142   // EE
00143   iEvent.put(productInvalidTTIds,"EcalIntegrityTTIdErrors");
00144   iEvent.put(productInvalidZSXtalIds,"EcalIntegrityZSXtalIdErrors");
00145   iEvent.put(productInvalidBlockLengths,"EcalIntegrityBlockSizeErrors");
00146   iEvent.put(productPnDiodeDigis);
00147   // errors  
00148   iEvent.put(productInvalidMemTtIds,"EcalIntegrityMemTtIdErrors");
00149   iEvent.put(productInvalidMemBlockSizes,"EcalIntegrityMemBlockSizeErrors");
00150   iEvent.put(productInvalidMemChIds,"EcalIntegrityMemChIdErrors");
00151   iEvent.put(productInvalidMemGains,"EcalIntegrityMemGainErrors");
00152 
00153   // flags
00154   iEvent.put(productEBSrFlags);
00155   iEvent.put(productEESrFlags);
00156 
00157   // trigger primitives 
00158   iEvent.put(productEcalTps,"EcalTriggerPrimitives");
00159   iEvent.put(productEcalPSs,"EcalPseudoStripInputs");
00160 
00161   //make new collections.
00162   worker->update(iEvent);
00163 }