CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalEBTrigPrimProducer Class Reference

#include <EcalEBTrigPrimProducer.h>

Inheritance diagram for EcalEBTrigPrimProducer:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 EcalEBTrigPrimProducer (const edm::ParameterSet &conf)
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~EcalEBTrigPrimProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

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

Private Attributes

std::unique_ptr< EcalEBTrigPrimTestAlgoalgo_
 
bool barrelOnly_
 
int binOfMaximum_
 
unsigned long long cacheID_
 
bool debug_
 
bool famos_
 
bool fillBinOfMaximumFromHistory_
 
int nEvent_
 
int nSamples_
 
bool tcpFormat_
 
edm::EDGetTokenT< EBDigiCollectiontokenEBdigi_
 

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

For Phase II EcalEBTrigPrimProducer produces a EcalEBTrigPrimDigiCollection out of PhaseI Digis. This is a simple starting point to fill in the chain for Phase II

For Phase II

Definition at line 25 of file EcalEBTrigPrimProducer.h.

Constructor & Destructor Documentation

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

Definition at line 63 of file EcalEBTrigPrimProducer.cc.

References edm::ParameterSet::getParameter(), tcpFormat_, and tokenEBdigi_.

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  nSamples_(iConfig.getParameter<int>("nOfSamples")),
69  binOfMaximum_(iConfig.getParameter<int>("binOfMaximum"))
70 {
71  tokenEBdigi_=consumes<EBDigiCollection>(iConfig.getParameter<edm::InputTag>("barrelEcalDigis"));
72  //register your products
73  produces <EcalEBTrigPrimDigiCollection >();
74  if (tcpFormat_) produces <EcalEBTrigPrimDigiCollection >("formatTCP");
75 }
edm::EDGetTokenT< EBDigiCollection > tokenEBdigi_
EcalEBTrigPrimProducer::~EcalEBTrigPrimProducer ( )
override

Definition at line 152 of file EcalEBTrigPrimProducer.cc.

153 {}

Member Function Documentation

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

Definition at line 79 of file EcalEBTrigPrimProducer.cc.

References algo_, barrelOnly_, binOfMaximum_, cacheID_, debug_, famos_, getRecords(), nEvent_, nSamples_, and tcpFormat_.

79  {
80  //ProcessHistory is guaranteed to be constant for an entire Run
81  //binOfMaximum_ = findBinOfMaximum(fillBinOfMaximumFromHistory_,binOfMaximum_,run.processHistory());
82 
84  // get a first version of the records
85  cacheID_=this->getRecords(setup);
86  nEvent_=0;
87 }
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
unsigned long long getRecords(edm::EventSetup const &setup)
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
void EcalEBTrigPrimProducer::endRun ( const edm::Run ,
const edm::EventSetup  
)
override

Definition at line 147 of file EcalEBTrigPrimProducer.cc.

References algo_.

147  {
148  algo_.reset();
149 }
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
unsigned long long EcalEBTrigPrimProducer::getRecords ( edm::EventSetup const &  setup)
private

Definition at line 89 of file EcalEBTrigPrimProducer.cc.

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

Referenced by beginRun().

89  {
90 
91  // get parameter records for xtals
92  edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
93  setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
94  const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product();
95  //
96  edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
97  setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
98  const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product();
99  //
100  edm::ESHandle<EcalTPGCrystalStatus> theEcalTPGCrystalStatus_handle;
101  setup.get<EcalTPGCrystalStatusRcd>().get(theEcalTPGCrystalStatus_handle);
102  const EcalTPGCrystalStatus * ecaltpgBadX = theEcalTPGCrystalStatus_handle.product();
103  //
104  //for strips
105  //
106  edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
107  setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
108  const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product();
109  //
110  edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
111  setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
112  const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product();
113  //
114  edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
115  setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
116  const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product();
117  // TCP
118  edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
119  setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
120  const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
121  //
122  edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
123  setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
124  const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product();
125  //
126  edm::ESHandle<EcalTPGTowerStatus> theEcalTPGTowerStatus_handle;
127  setup.get<EcalTPGTowerStatusRcd>().get(theEcalTPGTowerStatus_handle);
128  const EcalTPGTowerStatus * ecaltpgBadTT = theEcalTPGTowerStatus_handle.product();
129  //
130  edm::ESHandle<EcalTPGSpike> theEcalTPGSpike_handle;
131  setup.get<EcalTPGSpikeRcd>().get(theEcalTPGSpike_handle);
132  const EcalTPGSpike * ecaltpgSpike = theEcalTPGSpike_handle.product();
133 
134 
135 
137  algo_->setPointers(ecaltpLin,ecaltpPed,ecaltpgBadX,ecaltpgWeightMap,ecaltpgWeightGroup,ecaltpgSlidW,ecaltpgLutGroup,ecaltpgLut,ecaltpgBadTT, ecaltpgSpike);
138  return setup.get<EcalTPGLinearizationConstRcd>().cacheIdentifier();
139 
140 
141 
142 
143 }
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:2
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
T const * product() const
Definition: ESHandle.h:86
void EcalEBTrigPrimProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 158 of file EcalEBTrigPrimProducer.cc.

References algo_, gather_cfg::cout, debug_, edm::Event::getByToken(), mps_fire::i, tablePrinter::labels, edm::ProductLabels::module, eostools::move(), nEvent_, edm::Handle< T >::product(), edm::ProductLabels::productInstance, edm::Event::put(), edm::DataFrameContainer::size(), tcpFormat_, and tokenEBdigi_.

159 {
160 
161  nEvent_++;
162 
163  // get input collections
164  edm::Handle<EBDigiCollection> barrelDigiHandle;
165 
166 
167  if (! e.getByToken(tokenEBdigi_,barrelDigiHandle)) {
169  labelsForToken(tokenEBdigi_, labels);
170  edm::LogWarning("EcalTPG") <<" Couldnt find Barrel digis "<<labels.module<<" and label "<<labels.productInstance<<"!!!";
171  }
172 
173 
174 
175 
176 
177  if (debug_) std::cout << "EcalTPG" <<" =================> Treating event "<< nEvent_<<", Number of EB digis "<<barrelDigiHandle.product()->size() << std::endl;
178 
179 
180  auto pOut = std::make_unique<EcalEBTrigPrimDigiCollection>();
181  auto pOutTcp = std::make_unique<EcalEBTrigPrimDigiCollection>();
182 
183  // if ( e.id().event() != 648 ) return;
184 
185  //std::cout << " Event number " << e.id().event() << std::endl;
186 
187  // invoke algorithm
188 
189 
190  const EBDigiCollection *ebdigi=nullptr;
191  ebdigi=barrelDigiHandle.product();
192  algo_->run(iSetup,ebdigi,*pOut,*pOutTcp);
193 
194 
195  if (debug_ ) std::cout << "produce" << " For Barrel "<<pOut->size()<<" TP Digis were produced" << std::endl;
196 
197  // debug prints if TP >0
198 
199  int nonZeroTP=0;
200  for (unsigned int i=0;i<pOut->size();++i) {
201 
202  if (debug_ ) {
203  std::cout << "EcalTPG Printing only non zero TP " <<" For tower "<<(((*pOut)[i])).id()<<", TP is "<<(*pOut)[i];
204  for (int isam=0;isam<(*pOut)[i].size();++isam) {
205 
206  if ( (*pOut)[i][isam].encodedEt() > 0) {
207  nonZeroTP++;
208  std::cout << " (*pOut)[i][isam].raw() " << (*pOut)[i][isam].raw() << " (*pOut)[i][isam].encodedEt() " << (*pOut)[i][isam].encodedEt() << std::endl;
209  }
210  }
211  }
212  }
213  if (debug_ ) std::cout << "EcalTPG" <<"\n =================> For Barrel , "<<pOut->size()<<" TP Digis were produced (including zero ones)" << " Non zero primitives were " << nonZeroTP << std::endl;
214 
215 
216 
217  // put result into the Event
218  e.put(std::move(pOut));
219  if (tcpFormat_) e.put(std::move(pOutTcp),"formatTCP");
220 }
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
edm::EDGetTokenT< EBDigiCollection > tokenEBdigi_
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
char const * module
Definition: ProductLabels.h:5
T const * product() const
Definition: Handle.h:74
char const * productInstance
Definition: ProductLabels.h:6
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

std::unique_ptr<EcalEBTrigPrimTestAlgo> EcalEBTrigPrimProducer::algo_
private

Definition at line 39 of file EcalEBTrigPrimProducer.h.

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

bool EcalEBTrigPrimProducer::barrelOnly_
private

Definition at line 40 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

int EcalEBTrigPrimProducer::binOfMaximum_
private

Definition at line 49 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

unsigned long long EcalEBTrigPrimProducer::cacheID_
private

Definition at line 53 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

bool EcalEBTrigPrimProducer::debug_
private

Definition at line 42 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun(), and produce().

bool EcalEBTrigPrimProducer::famos_
private

Definition at line 43 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

bool EcalEBTrigPrimProducer::fillBinOfMaximumFromHistory_
private

Definition at line 50 of file EcalEBTrigPrimProducer.h.

int EcalEBTrigPrimProducer::nEvent_
private

Definition at line 45 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun(), and produce().

int EcalEBTrigPrimProducer::nSamples_
private

Definition at line 44 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

bool EcalEBTrigPrimProducer::tcpFormat_
private

Definition at line 41 of file EcalEBTrigPrimProducer.h.

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

edm::EDGetTokenT<EBDigiCollection> EcalEBTrigPrimProducer::tokenEBdigi_
private

Definition at line 47 of file EcalEBTrigPrimProducer.h.

Referenced by EcalEBTrigPrimProducer(), and produce().