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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 23 of file EcalEBTrigPrimProducer.h.

Constructor & Destructor Documentation

◆ EcalEBTrigPrimProducer()

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

Definition at line 62 of file EcalEBTrigPrimProducer.cc.

63  : barrelOnly_(iConfig.getParameter<bool>("BarrelOnly")),
64  tcpFormat_(iConfig.getParameter<bool>("TcpOutput")),
65  debug_(iConfig.getParameter<bool>("Debug")),
66  famos_(iConfig.getParameter<bool>("Famos")),
67  nSamples_(iConfig.getParameter<int>("nOfSamples")),
68  binOfMaximum_(iConfig.getParameter<int>("binOfMaximum")) {
69  tokenEBdigi_ = consumes<EBDigiCollection>(iConfig.getParameter<edm::InputTag>("barrelEcalDigis"));
70  //register your products
71  produces<EcalEBTrigPrimDigiCollection>();
72  if (tcpFormat_)
73  produces<EcalEBTrigPrimDigiCollection>("formatTCP");
74 }

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

◆ ~EcalEBTrigPrimProducer()

EcalEBTrigPrimProducer::~EcalEBTrigPrimProducer ( )
override

Definition at line 146 of file EcalEBTrigPrimProducer.cc.

146 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 76 of file EcalEBTrigPrimProducer.cc.

76  {
77  //ProcessHistory is guaranteed to be constant for an entire Run
78  //binOfMaximum_ = findBinOfMaximum(fillBinOfMaximumFromHistory_,binOfMaximum_,run.processHistory());
79 
81  // get a first version of the records
82  cacheID_ = this->getRecords(setup);
83  nEvent_ = 0;
84 }

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

◆ endRun()

void EcalEBTrigPrimProducer::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Definition at line 144 of file EcalEBTrigPrimProducer.cc.

144 { algo_.reset(); }

References algo_.

◆ getRecords()

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

Definition at line 86 of file EcalEBTrigPrimProducer.cc.

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

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

Referenced by beginRun().

◆ produce()

void EcalEBTrigPrimProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Definition at line 149 of file EcalEBTrigPrimProducer.cc.

149  {
150  nEvent_++;
151 
152  // get input collections
153  edm::Handle<EBDigiCollection> barrelDigiHandle;
154 
155  if (!e.getByToken(tokenEBdigi_, barrelDigiHandle)) {
157  labelsForToken(tokenEBdigi_, labels);
158  edm::LogWarning("EcalTPG") << " Couldnt find Barrel digis " << labels.module << " and label "
159  << labels.productInstance << "!!!";
160  }
161 
162  if (debug_)
163  std::cout << "EcalTPG"
164  << " =================> Treating event " << nEvent_ << ", Number of EB digis "
165  << barrelDigiHandle.product()->size() << std::endl;
166 
167  auto pOut = std::make_unique<EcalEBTrigPrimDigiCollection>();
168  auto pOutTcp = std::make_unique<EcalEBTrigPrimDigiCollection>();
169 
170  // if ( e.id().event() != 648 ) return;
171 
172  //std::cout << " Event number " << e.id().event() << std::endl;
173 
174  // invoke algorithm
175 
176  const EBDigiCollection* ebdigi = nullptr;
177  ebdigi = barrelDigiHandle.product();
178  algo_->run(iSetup, ebdigi, *pOut, *pOutTcp);
179 
180  if (debug_)
181  std::cout << "produce"
182  << " For Barrel " << pOut->size() << " TP Digis were produced" << std::endl;
183 
184  // debug prints if TP >0
185 
186  int nonZeroTP = 0;
187  for (unsigned int i = 0; i < pOut->size(); ++i) {
188  if (debug_) {
189  std::cout << "EcalTPG Printing only non zero TP "
190  << " For tower " << (((*pOut)[i])).id() << ", TP is " << (*pOut)[i];
191  for (int isam = 0; isam < (*pOut)[i].size(); ++isam) {
192  if ((*pOut)[i][isam].encodedEt() > 0) {
193  nonZeroTP++;
194  std::cout << " (*pOut)[i][isam].raw() " << (*pOut)[i][isam].raw() << " (*pOut)[i][isam].encodedEt() "
195  << (*pOut)[i][isam].encodedEt() << std::endl;
196  }
197  }
198  }
199  }
200  if (debug_)
201  std::cout << "EcalTPG"
202  << "\n =================> For Barrel , " << pOut->size()
203  << " TP Digis were produced (including zero ones)"
204  << " Non zero primitives were " << nonZeroTP << std::endl;
205 
206  // put result into the Event
207  e.put(std::move(pOut));
208  if (tcpFormat_)
209  e.put(std::move(pOutTcp), "formatTCP");
210 }

References algo_, gather_cfg::cout, debug_, MillePedeFileConverter_cfg::e, mps_fire::i, SummaryClient_cfi::labels, eostools::move(), nEvent_, edm::Handle< T >::product(), edm::DataFrameContainer::size(), tcpFormat_, and tokenEBdigi_.

Member Data Documentation

◆ algo_

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

Definition at line 34 of file EcalEBTrigPrimProducer.h.

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

◆ barrelOnly_

bool EcalEBTrigPrimProducer::barrelOnly_
private

Definition at line 35 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

◆ binOfMaximum_

int EcalEBTrigPrimProducer::binOfMaximum_
private

Definition at line 44 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

◆ cacheID_

unsigned long long EcalEBTrigPrimProducer::cacheID_
private

Definition at line 48 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

◆ debug_

bool EcalEBTrigPrimProducer::debug_
private

Definition at line 37 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun(), and produce().

◆ famos_

bool EcalEBTrigPrimProducer::famos_
private

Definition at line 38 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

◆ fillBinOfMaximumFromHistory_

bool EcalEBTrigPrimProducer::fillBinOfMaximumFromHistory_
private

Definition at line 45 of file EcalEBTrigPrimProducer.h.

◆ nEvent_

int EcalEBTrigPrimProducer::nEvent_
private

Definition at line 40 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun(), and produce().

◆ nSamples_

int EcalEBTrigPrimProducer::nSamples_
private

Definition at line 39 of file EcalEBTrigPrimProducer.h.

Referenced by beginRun().

◆ tcpFormat_

bool EcalEBTrigPrimProducer::tcpFormat_
private

Definition at line 36 of file EcalEBTrigPrimProducer.h.

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

◆ tokenEBdigi_

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

Definition at line 42 of file EcalEBTrigPrimProducer.h.

Referenced by EcalEBTrigPrimProducer(), and produce().

SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalEBTrigPrimProducer::algo_
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
Definition: EcalEBTrigPrimProducer.h:34
EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
mps_fire.i
i
Definition: mps_fire.py:355
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EcalEBTrigPrimProducer::cacheID_
unsigned long long cacheID_
Definition: EcalEBTrigPrimProducer.h:48
EcalTPGSpike
Definition: EcalTPGSpike.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGCrystalStatusRcd
Definition: EcalTPGCrystalStatusRcd.h:5
EcalTPGPedestalsRcd
Definition: EcalTPGPedestalsRcd.h:5
EcalEBTrigPrimProducer::famos_
bool famos_
Definition: EcalEBTrigPrimProducer.h:38
EcalTPGWeightGroup
Definition: EcalTPGWeightGroup.h:13
EcalCondObjectContainer< EcalTPGLinearizationConstant >
edm::Handle< EBDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
EcalTPGLutGroup
Definition: EcalTPGLutGroup.h:13
EcalEBTrigPrimProducer::tcpFormat_
bool tcpFormat_
Definition: EcalEBTrigPrimProducer.h:36
EcalEBTrigPrimTestAlgo
Definition: EcalEBTrigPrimTestAlgo.h:43
EcalTPGSlidingWindow
Definition: EcalTPGSlidingWindow.h:9
edm::ESHandle
Definition: DTSurvey.h:22
EcalTPGSpikeRcd
Definition: EcalTPGSpikeRcd.h:5
EcalEBTrigPrimProducer::binOfMaximum_
int binOfMaximum_
Definition: EcalEBTrigPrimProducer.h:44
EcalEBTrigPrimProducer::barrelOnly_
bool barrelOnly_
Definition: EcalEBTrigPrimProducer.h:35
EcalTPGLutIdMap
Definition: EcalTPGLutIdMap.h:10
edm::LogWarning
Definition: MessageLogger.h:141
EBDigiCollection
Definition: EcalDigiCollections.h:32
EcalEBTrigPrimProducer::debug_
bool debug_
Definition: EcalEBTrigPrimProducer.h:37
get
#define get
EcalTPGWeightGroupRcd
Definition: EcalTPGWeightGroupRcd.h:5
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
EcalTPGTowerStatus
Definition: EcalTPGTowerStatus.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
EcalTPGWeightIdMapRcd
Definition: EcalTPGWeightIdMapRcd.h:5
EcalTPGSlidingWindowRcd
Definition: EcalTPGSlidingWindowRcd.h:5
EcalEBTrigPrimProducer::nSamples_
int nSamples_
Definition: EcalEBTrigPrimProducer.h:39
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
EcalTPGTowerStatusRcd
Definition: EcalTPGTowerStatusRcd.h:5
EcalEBTrigPrimProducer::getRecords
unsigned long long getRecords(edm::EventSetup const &setup)
Definition: EcalEBTrigPrimProducer.cc:86
EcalTPGLinearizationConstRcd
Definition: EcalTPGLinearizationConstRcd.h:5
EcalEBTrigPrimProducer::nEvent_
int nEvent_
Definition: EcalEBTrigPrimProducer.h:40
edm::InputTag
Definition: InputTag.h:15
edm::ProductLabels
Definition: ProductLabels.h:4
EcalEBTrigPrimProducer::tokenEBdigi_
edm::EDGetTokenT< EBDigiCollection > tokenEBdigi_
Definition: EcalEBTrigPrimProducer.h:42
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37