CMS 3D CMS Logo

EcalEBTrigPrimProducer.cc
Go to the documentation of this file.
1 
11 
17 
22 //
26 
41 
42 /*
43 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBGroupRcd.h"
44 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainEBIdMapRcd.h"
45 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainTowerEERcd.h"
46 
47 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBGroup.h"
48 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainEBIdMap.h"
49 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainTowerEE.h"
50 #include "CondFormats/DataRecord/interface/EcalTPGFineGrainStripEERcd.h"
51 #include "CondFormats/EcalObjects/interface/EcalTPGWeightIdMap.h"
52 #include "CondFormats/EcalObjects/interface/EcalTPGWeightGroup.h"
53 #include "CondFormats/EcalObjects/interface/EcalTPGFineGrainStripEE.h"
54 #include "CondFormats/EcalObjects/interface/EcalTPGTowerStatus.h"
55 #include "CondFormats/DataRecord/interface/EcalTPGStripStatusRcd.h"
56 #include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h"
57 */
58 
59 #include "EcalEBTrigPrimProducer.h"
61 
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 }
75 
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 }
85 
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 }
143 
145 
147 
148 // ------------ method called to produce the data ------------
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 }
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalTPGLutGroupRcd.h
EcalEBTrigPrimProducer::algo_
std::unique_ptr< EcalEBTrigPrimTestAlgo > algo_
Definition: EcalEBTrigPrimProducer.h:34
EcalTPGWeightIdMap
Definition: EcalTPGWeightIdMap.h:10
electrons_cff.bool
bool
Definition: electrons_cff.py:372
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
EcalEBTrigPrimProducer::~EcalEBTrigPrimProducer
~EcalEBTrigPrimProducer() override
Definition: EcalEBTrigPrimProducer.cc:146
edm::Handle::product
T const * product() const
Definition: Handle.h:70
EcalEBTrigPrimProducer::cacheID_
unsigned long long cacheID_
Definition: EcalEBTrigPrimProducer.h:48
EcalEBTrigPrimProducer::endRun
void endRun(const edm::Run &, const edm::EventSetup &) override
Definition: EcalEBTrigPrimProducer.cc:144
EcalTPGLinearizationConstRcd.h
edm::Run
Definition: Run.h:45
EcalTPGSpikeRcd.h
EcalTPGSpike
Definition: EcalTPGSpike.h:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EcalTPGCrystalStatusRcd
Definition: EcalTPGCrystalStatusRcd.h:5
EcalEBTrigPrimTestAlgo.h
EcalTPGPedestalsRcd
Definition: EcalTPGPedestalsRcd.h:5
EcalTPGCrystalStatusRcd.h
EcalEBTrigPrimProducer::famos_
bool famos_
Definition: EcalEBTrigPrimProducer.h:38
EcalTPGWeightGroup
Definition: EcalTPGWeightGroup.h:13
EcalCondObjectContainer< EcalTPGLinearizationConstant >
edm::Handle< EBDigiCollection >
EcalEBTrigPrimProducer::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition: EcalEBTrigPrimProducer.cc:149
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
MakerMacros.h
EcalTPGSlidingWindow
Definition: EcalTPGSlidingWindow.h:9
EcalTPGSpike.h
EcalTPGLutIdMap.h
Provenance.h
EcalDigiCollections.h
ProductID.h
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
EcalEBTrigPrimProducer::beginRun
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
Definition: EcalEBTrigPrimProducer.cc:76
EcalTPGWeightIdMapRcd.h
EcalTPGSlidingWindowRcd.h
EcalTPGLutIdMap
Definition: EcalTPGLutIdMap.h:10
edm::LogWarning
Definition: MessageLogger.h:141
EcalTPGLutGroup.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
EcalTPGLinearizationConst.h
EBDigiCollection
Definition: EcalDigiCollections.h:32
createfilelist.int
int
Definition: createfilelist.py:10
EcalTPGPedestals.h
EcalEBTrigPrimProducer::debug_
bool debug_
Definition: EcalEBTrigPrimProducer.h:37
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
InputTag.h
EcalTPGWeightGroupRcd
Definition: EcalTPGWeightGroupRcd.h:5
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EcalTPGLutIdMapRcd
Definition: EcalTPGLutIdMapRcd.h:5
EcalTPGTowerStatus
Definition: EcalTPGTowerStatus.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
writedatasetfile.run
run
Definition: writedatasetfile.py:27
EcalTPGSlidingWindow.h
EcalTPGWeightIdMapRcd
Definition: EcalTPGWeightIdMapRcd.h:5
Frameworkfwd.h
EcalTPGSlidingWindowRcd
Definition: EcalTPGSlidingWindowRcd.h:5
EcalEBTrigPrimProducer::nSamples_
int nSamples_
Definition: EcalEBTrigPrimProducer.h:39
EcalTPGLutIdMapRcd.h
EcalTPGCrystalStatus.h
EcalTPGTowerStatusRcd.h
EcalTPGWeightGroupRcd.h
ParameterSetID.h
EcalTPGPedestalsRcd.h
ParameterSet.h
EcalEBTrigPrimProducer.h
EcalTPGLutGroupRcd
Definition: EcalTPGLutGroupRcd.h:5
EcalEBTrigPrimProducer::EcalEBTrigPrimProducer
EcalEBTrigPrimProducer(const edm::ParameterSet &conf)
Definition: EcalEBTrigPrimProducer.cc:62
edm::Event
Definition: Event.h:73
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