CMS 3D CMS Logo

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

#include <EcalDigiDisplay.h>

Inheritance diagram for EcalDigiDisplay:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 EcalDigiDisplay (const edm::ParameterSet &ps)
 
 ~EcalDigiDisplay () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void readEBDigis (edm::Handle< EBDigiCollection > digis, int Mode)
 
void readEEDigis (edm::Handle< EEDigiCollection > digis, int Mode)
 
void readPNDigis (edm::Handle< EcalPnDiodeDigiCollection > PNs, int Mode)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Protected Attributes

bool cryDigi
 
const std::string digiProducer_
 
const std::string ebDigiCollection_
 
const edm::EDGetTokenT< EBDigiCollectionebDigiToken_
 
const EcalElectronicsMappingecalElectronicsMap_
 
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdecalMappingToken_
 
const std::string eeDigiCollection_
 
const edm::EDGetTokenT< EEDigiCollectioneeDigiToken_
 
EcalFedMapfedMap
 
bool inputIsOk
 
std::vector< int > listChannels
 
std::vector< int > listPns
 
std::vector< int > listTowers
 
int mode
 
bool pnDigi
 
const edm::EDGetTokenT< EcalPnDiodeDigiCollectionpnDiodeDigiToken_
 
const edm::EDGetTokenT< EcalRawDataCollectionrawDataToken_
 
std::vector< std::string > requestedEbs_
 
std::vector< int > requestedFeds_
 
bool ttDigi
 

Private Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &c) override
 
void beginRun (edm::Run const &, edm::EventSetup const &c) override
 
void endJob () override
 
void endRun (edm::Run const &, edm::EventSetup const &c) override
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 20 of file EcalDigiDisplay.h.

Constructor & Destructor Documentation

◆ EcalDigiDisplay()

EcalDigiDisplay::EcalDigiDisplay ( const edm::ParameterSet ps)

Definition at line 25 of file EcalDigiDisplay.cc.

References cryDigi, fedMap, EcalFedMap::getFedFromSlice(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, inputIsOk, listChannels, listPns, listTowers, mode, pnDigi, requestedEbs_, requestedFeds_, and ttDigi.

26  : ebDigiCollection_(ps.getParameter<std::string>("ebDigiCollection")),
27  eeDigiCollection_(ps.getParameter<std::string>("eeDigiCollection")),
28  digiProducer_(ps.getParameter<std::string>("digiProducer")),
29  rawDataToken_(consumes<EcalRawDataCollection>(edm::InputTag(digiProducer_))),
30  ebDigiToken_(consumes<EBDigiCollection>(edm::InputTag(digiProducer_, ebDigiCollection_))),
31  eeDigiToken_(consumes<EEDigiCollection>(edm::InputTag(digiProducer_, eeDigiCollection_))),
32  pnDiodeDigiToken_(consumes<EcalPnDiodeDigiCollection>(edm::InputTag(digiProducer_))),
33  ecalMappingToken_(esConsumes<edm::Transition::BeginRun>()) {
34  //=========================================================================
35  requestedFeds_ = ps.getUntrackedParameter<std::vector<int> >("requestedFeds");
36  requestedEbs_ = ps.getUntrackedParameter<std::vector<std::string> >("requestedEbs");
37 
38  cryDigi = ps.getUntrackedParameter<bool>("cryDigi");
39  ttDigi = ps.getUntrackedParameter<bool>("ttDigi");
40  pnDigi = ps.getUntrackedParameter<bool>("pnDigi");
41 
42  mode = ps.getUntrackedParameter<int>("mode");
43  listChannels = ps.getUntrackedParameter<std::vector<int> >("listChannels");
44  listTowers = ps.getUntrackedParameter<std::vector<int> >("listTowers");
45  listPns = ps.getUntrackedParameter<std::vector<int> >("listPns");
46 
47  std::vector<int> listDefaults;
48  listDefaults.push_back(-1);
49  requestedFeds_ = ps.getUntrackedParameter<std::vector<int> >("requestedFeds", listDefaults);
50  bool fedIsGiven = false;
51 
52  std::vector<std::string> ebDefaults;
53  ebDefaults.push_back("none");
54  requestedEbs_ = ps.getUntrackedParameter<std::vector<std::string> >("requestedEbs", ebDefaults);
55  // FEDs and EBs
56  if (requestedFeds_[0] != -1) {
57  edm::LogInfo("EcalDigiDisplay") << "FED id is given! Goining to beginRun! ";
58  fedIsGiven = true;
59  } else {
60  if (requestedEbs_[0] != "none") {
61  //EB id is given and convert to FED id
62  requestedFeds_.clear();
63  fedMap = new EcalFedMap();
64  for (std::vector<std::string>::const_iterator ebItr = requestedEbs_.begin(); ebItr != requestedEbs_.end();
65  ++ebItr) {
66  requestedFeds_.push_back(fedMap->getFedFromSlice(*ebItr));
67  }
68  delete fedMap;
69  } else {
70  //Select all FEDs in the Event
71  for (int i = 601; i < 655; ++i) {
72  requestedFeds_.push_back(i);
73  }
74  }
75  }
76 
77  //Channel list
78  listChannels = ps.getUntrackedParameter<std::vector<int> >("listChannels", listDefaults);
79  //Tower list
80  listTowers = ps.getUntrackedParameter<std::vector<int> >("listTowers", listDefaults);
81 
82  //Consistancy checks:
83  std::vector<int>::iterator fedIter;
84  std::vector<int>::iterator intIter;
85  inputIsOk = true;
86 
87  if (fedIsGiven) {
88  for (fedIter = requestedFeds_.begin(); fedIter != requestedFeds_.end(); ++fedIter) {
89  if ((*fedIter) < 601 || (*fedIter) > 655) {
90  edm::LogError("EcalDigiDisplay") << " FED value: " << (*fedIter) << " found in requetsedFeds. "
91  << " Valid range is 601-654. Returning.";
92  inputIsOk = false;
93  return;
94  } //Loop over requetsed FEDS
95  }
96  }
97  bool barrelSM = false;
98  //Loop over and Check if Barrel SM is picked up
99  for (fedIter = requestedFeds_.begin(); fedIter != requestedFeds_.end(); ++fedIter) {
100  if ((*fedIter) > 609 && (*fedIter) < 646 && inputIsOk) // if EB SM is being picked up
101  barrelSM = true;
102  }
103 
104  if (barrelSM) {
105  if (cryDigi) {
106  // Check with channels in Barrel
107  for (intIter = listChannels.begin(); intIter != listChannels.end(); intIter++) {
108  if (((*intIter) < 1) || (1700 < (*intIter))) {
109  edm::LogError("EcalDigiDisplay") << " ic value: " << (*intIter) << " found in listChannels. "
110  << " Valid range is 1-1700. Returning.";
111  inputIsOk = false;
112  return;
113  }
114  }
115  }
116  //Check with Towers in Barrel
117  if (ttDigi) {
118  for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) {
119  if (((*intIter) < 1) || (70 < (*intIter))) {
120  edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. "
121  << " Valid range for EB SM is 1-70. Returning.";
122  inputIsOk = false;
123  return;
124  }
125  }
126  }
127  } else //if EE DCC is being picked up
128  if (ttDigi) {
129  //Check with Towers in Endcap
130  for (intIter = listTowers.begin(); intIter != listTowers.end(); intIter++) {
131  if ((*intIter) > 34) {
132  edm::LogError("EcalDigiDisplay") << " TT value: " << (*intIter) << " found in listTowers. "
133  << " Valid range for EE DCC is 1-34. Returning.";
134  inputIsOk = false;
135  return;
136  }
137  }
138  }
139 
140  //PNs
141  listPns = ps.getUntrackedParameter<std::vector<int> >("listPns", listDefaults);
142  /*
143  if ( listPns[0] != -1 ) pnDigi = true;
144  else {
145  listPns.clear();
146  for ( int i=1; i < 11; ++i ) {
147  listPns.push_back(i);
148  }
149  }
150  */
151  if (pnDigi) {
152  for (intIter = listPns.begin(); intIter != listPns.end(); intIter++) {
153  if (((*intIter) < 1) || (10 < (*intIter))) {
154  edm::LogError("EcalDigiDisplay") << " Pn number : " << (*intIter) << " found in listPns. "
155  << " Valid range is 1-10. Returning.";
156  inputIsOk = false;
157  return;
158  }
159  }
160  }
161 }
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
std::vector< int > requestedFeds_
int getFedFromSlice(std::string)
Definition: EcalFedMap.cc:96
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
std::vector< int > listPns
Log< level::Error, false > LogError
EcalFedMap * fedMap
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > listTowers
Log< level::Info, false > LogInfo
const std::string eeDigiCollection_
std::vector< int > listChannels
const std::string digiProducer_
std::vector< std::string > requestedEbs_
const edm::EDGetTokenT< EBDigiCollection > ebDigiToken_
const std::string ebDigiCollection_

◆ ~EcalDigiDisplay()

EcalDigiDisplay::~EcalDigiDisplay ( )
override

Definition at line 163 of file EcalDigiDisplay.cc.

163  {
164  //=========================================================================
165  //delete *;
166 }

Member Function Documentation

◆ analyze()

void EcalDigiDisplay::analyze ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overrideprivatevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 181 of file EcalDigiDisplay.cc.

References cryDigi, MillePedeFileConverter_cfg::e, ebDigiToken_, eeDigiToken_, edm::SortedCollection< T, SORT >::empty(), edm::DataFrameContainer::empty(), inputIsOk, edm::HandleBase::isValid(), mode, pnDigi, pnDiodeDigiToken_, rawDataToken_, readEBDigis(), readEEDigis(), readPNDigis(), and ttDigi.

181  {
182  //========================================================================
183 
184  if (!inputIsOk)
185  return;
186 
187  //Get DCC headers
189  e.getByToken(rawDataToken_, dccHeader);
190  if (!dccHeader.isValid()) {
191  edm::LogError("EcalDigiUnpackerModule") << "Can't get DCC Headers!";
192  }
193 
194  //
195  bool ebDigisFound = false;
196  bool eeDigisFound = false;
197  bool pnDigisFound = false;
198  // retrieving crystal data from Event
200  e.getByToken(ebDigiToken_, eb_digis);
201  if (!eb_digis.isValid()) {
202  edm::LogError("EcalDigiUnpackerModule") << "EB Digis were not found!";
203  }
204  if (!eb_digis->empty())
205  ebDigisFound = true;
206 
207  //
209  e.getByToken(eeDigiToken_, ee_digis);
210  if (!ee_digis.isValid()) {
211  edm::LogError("EcalDigiUnpackerModule") << "EE Digis were not found!";
212  }
213  if (!ee_digis->empty())
214  eeDigisFound = true;
215 
216  // retrieving crystal PN diodes from Event
218  e.getByToken(pnDiodeDigiToken_, pn_digis);
219  if (!pn_digis.isValid()) {
220  edm::LogError("EcalDigiUnpackerModule") << "PNs were not found!";
221  }
222  if (!pn_digis->empty())
223  pnDigisFound = true;
224 
225  //=============================
226  //Call for funcitons
227  //=============================
228  if (cryDigi || ttDigi) {
229  if (ebDigisFound)
230  readEBDigis(eb_digis, mode);
231  if (eeDigisFound)
232  readEEDigis(ee_digis, mode);
233  if (!(ebDigisFound || eeDigisFound)) {
234  edm::LogWarning("EcalDigiUnpackerModule") << "No Digis were found! Returning..";
235  return;
236  }
237  }
238  if (pnDigi) {
239  if (pnDigisFound)
240  readPNDigis(pn_digis, mode);
241  }
242 }
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EEDigiCollection > eeDigiToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDiodeDigiToken_
void readEBDigis(edm::Handle< EBDigiCollection > digis, int Mode)
Log< level::Error, false > LogError
void readEEDigis(edm::Handle< EEDigiCollection > digis, int Mode)
void readPNDigis(edm::Handle< EcalPnDiodeDigiCollection > PNs, int Mode)
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< EBDigiCollection > ebDigiToken_

◆ beginRun()

void EcalDigiDisplay::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprivate

Definition at line 169 of file EcalDigiDisplay.cc.

References DummyCfis::c, ecalElectronicsMap_, and ecalMappingToken_.

169  {
170  //========================================================================
171  edm::LogInfo("EcalDigiDisplay") << "entering beginRun! ";
172 
174 }
const edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
const EcalElectronicsMapping * ecalElectronicsMap_
Log< level::Info, false > LogInfo

◆ endJob()

void EcalDigiDisplay::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 394 of file EcalDigiDisplay.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

394  {
395  //==================================================
396  edm::LogInfo("EcalDigiDisplay") << "DONE!.... ";
397 }
Log< level::Info, false > LogInfo

◆ endRun()

void EcalDigiDisplay::endRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprivate

Definition at line 177 of file EcalDigiDisplay.cc.

177 {}

◆ readEBDigis()

void EcalDigiDisplay::readEBDigis ( edm::Handle< EBDigiCollection digis,
int  Mode 
)
protected

Definition at line 248 of file EcalDigiDisplay.cc.

References edm::DataFrameContainer::begin(), gather_cfg::cout, EcalElectronicsId::dccId(), hcalRecHitTable_cff::detId, das-up-to-nevents::df, ecalElectronicsMap_, edm::DataFrameContainer::end(), spr::find(), EcalElectronicsMapping::getElectronicsId(), mps_fire::i, hcalRecHitTable_cff::ieta, inputIsOk, hcalRecHitTable_cff::iphi, listChannels, listTowers, requestedFeds_, edm::DataFrameContainer::size(), l1tHGCalTowerProducer_cfi::tower, and groupFilesInBlocks::tt.

Referenced by analyze().

248  {
249  for (EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
250  EBDetId detId = EBDetId((*digiItr).id());
252 
253  int FEDid = elecId.dccId() + 600;
254  std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid);
255  if (fedIter == requestedFeds_.end())
256  continue;
257 
258  int ic = EBDetId((*digiItr).id()).ic();
259  int tt = EBDetId((*digiItr).id()).tower().iTT();
260 
261  //Check if Mode is set 1 or 2
262  if (Mode == 1) {
263  edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size "
264  << digis->size();
265  edm::LogInfo("EcalDigiDisplay") << " [EcalDigiDisplay] dumping first " << listChannels[0]
266  << " crystals\n";
267  //It will break if all required digis are dumpped
268  if (ic > listChannels[0])
269  continue;
270  } else if (Mode == 2) {
271  std::vector<int>::iterator icIterCh;
272  std::vector<int>::iterator icIterTt;
273  icIterCh = find(listChannels.begin(), listChannels.end(), ic);
274  icIterTt = find(listTowers.begin(), listTowers.end(), tt);
275  if (icIterCh == listChannels.end() && icIterTt == listTowers.end())
276  continue;
277  edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size "
278  << digis->size();
279  } else {
280  edm::LogInfo("EcalDigiDisplay") << "[EcalDigiDisplay] parameter mode set to: " << Mode
281  << ". Only mode 1 and 2 are allowed. Returning...";
282  inputIsOk = false;
283  return;
284  }
285  std::cout << "FEDID: " << FEDid << std::endl;
286  std::cout << "Tower: " << EBDetId((*digiItr).id()).tower().iTT() << " ic-cry: " << EBDetId((*digiItr).id()).ic()
287  << " i-phi: " << EBDetId((*digiItr).id()).iphi() << " j-eta: " << EBDetId((*digiItr).id()).ieta()
288  << std::endl;
289  //Get Samples
290  for (unsigned int i = 0; i < (*digiItr).size(); ++i) {
291  EBDataFrame df(*digiItr);
292  if (!(i % 3))
293  std::cout << "\n\t";
294  std::cout << "sId: " << (i + 1) << " " << df.sample(i) << "\t";
295  }
296  std::cout << " " << std::endl;
297  }
298 }
std::vector< int > requestedFeds_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
Definition: TTTypes.h:54
const_iterator end() const
std::vector< int > listTowers
const EcalElectronicsMapping * ecalElectronicsMap_
Log< level::Info, false > LogInfo
std::vector< int > listChannels
const_iterator begin() const
The iterator returned can not safely be used across threads.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.

◆ readEEDigis()

void EcalDigiDisplay::readEEDigis ( edm::Handle< EEDigiCollection digis,
int  Mode 
)
protected

Definition at line 301 of file EcalDigiDisplay.cc.

References edm::DataFrameContainer::begin(), gather_cfg::cout, EcalElectronicsId::dccId(), hcalRecHitTable_cff::detId, das-up-to-nevents::df, ecalElectronicsMap_, edm::DataFrameContainer::end(), spr::find(), EcalElectronicsMapping::getElectronicsId(), mps_fire::i, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::ix(), ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::endcap::iy(), listChannels, listTowers, requestedFeds_, and edm::DataFrameContainer::size().

Referenced by analyze().

301  {
302  //For Endcap so far works only Mode 2
303  if (Mode != 2) {
304  std::cout << "For Endcap mode needs to be set to 2" << std::endl;
305  return;
306  }
307 
308  for (EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
309  //Make sure that digis are form requested place
310  EEDetId detId = EEDetId((*digiItr).id());
312 
313  int FEDid = elecId.dccId() + 600;
314  std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid);
315  if (fedIter == requestedFeds_.end())
316  continue;
317 
318  edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ [EcalDigiDisplay] digi cry collection size "
319  << digis->size();
320 
321  int crystalId = 10000 * FEDid + 100 * elecId.towerId() + 5 * (elecId.stripId() - 1) + elecId.xtalId();
322  int chId = elecId.towerId(); // this is a channel in Endcap DCC, sometimes also called as Super Crystal
323 
324  std::vector<int>::iterator icIterCh;
325  std::vector<int>::iterator icIterTt;
326  icIterCh = find(listChannels.begin(), listChannels.end(), crystalId);
327  icIterTt = find(listTowers.begin(), listTowers.end(), chId);
328  if (icIterCh == listChannels.end() && icIterTt == listTowers.end())
329  continue;
330 
331  std::cout << "FEDID: " << FEDid << std::endl;
332  std::cout << "Tower: " << elecId.towerId() << "crystalId: " << crystalId
333  << " i-x: " << EEDetId((*digiItr).id()).ix() << " j-y: " << EEDetId((*digiItr).id()).iy() << std::endl;
334 
335  //Get samples
336  for (unsigned int i = 0; i < (*digiItr).size(); ++i) {
337  EEDataFrame df(*digiItr);
338  if (!(i % 3))
339  std::cout << "\n\t";
340  std::cout << "sId: " << (i + 1) << " " << df.sample(i) << "\t";
341  }
342  std::cout << " " << std::endl;
343  }
344 }
std::vector< int > requestedFeds_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const_iterator end() const
std::vector< int > listTowers
const EcalElectronicsMapping * ecalElectronicsMap_
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
std::vector< int > listChannels
const_iterator begin() const
The iterator returned can not safely be used across threads.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)

◆ readPNDigis()

void EcalDigiDisplay::readPNDigis ( edm::Handle< EcalPnDiodeDigiCollection PNs,
int  Mode 
)
protected

Definition at line 346 of file EcalDigiDisplay.cc.

References edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, edm::SortedCollection< T, SORT >::end(), spr::find(), EcalPnDiodeDetId::iDCCId(), inputIsOk, listPns, requestedFeds_, and edm::SortedCollection< T, SORT >::size().

Referenced by analyze().

346  {
347  int pnDigiCounter = 0;
348 
349  //Loop over PN digis
350  for (EcalPnDiodeDigiCollection::const_iterator pnItr = PNs->begin(); pnItr != PNs->end(); ++pnItr) {
351  EcalPnDiodeDetId pnDetId = EcalPnDiodeDetId((*pnItr).id());
352  //Make sure that we look at the requested place
353  int FEDid = pnDetId.iDCCId() + 600;
354  std::vector<int>::iterator fedIter = find(requestedFeds_.begin(), requestedFeds_.end(), FEDid);
355  if (fedIter == requestedFeds_.end())
356  continue;
357  int pnNum = (*pnItr).id().iPnId();
358 
359  if (Mode == 1) {
360  edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ EcalDigiDisplay digi PN collection. Size: "
361  << PNs->size();
362  edm::LogInfo("EcalDigiDisplay") << " [EcalDigiDisplay] dumping first " << listPns[0]
363  << " PNs ";
364 
365  if ((pnDigiCounter++) >= listPns[0])
366  break;
367  } else if (Mode == 2) {
368  edm::LogInfo("EcalDigiDisplay") << "\n\n^^^^^^^^^^^^^^^^^^ EcalDigiDisplay digi PN collection. Size: "
369  << PNs->size();
370 
371  // Check that we look at PN from the given list
372  std::vector<int>::iterator pnIter;
373  pnIter = find(listPns.begin(), listPns.end(), pnNum);
374  if (pnIter == listPns.end())
375  continue;
376  } else {
377  edm::LogError("EcalDigiDisplay") << "[EcalDigiDisplay] parameter mode set to: " << Mode
378  << ". Only mode 1 and 2 are allowed. Returning...";
379  inputIsOk = false;
380  return;
381  }
382 
383  std::cout << "DCCID: " << pnDetId.iDCCId() << std::endl;
384  std::cout << "\nPN num: " << (*pnItr).id().iPnId();
385  for (int samId = 0; samId < (*pnItr).size(); samId++) {
386  if (!(samId % 3))
387  std::cout << "\n\t";
388  std::cout << "sId: " << (samId + 1) << " " << (*pnItr).sample(samId) << "\t";
389  }
390  }
391 }
std::vector< int > requestedFeds_
size_type size() const
std::vector< T >::const_iterator const_iterator
std::vector< int > listPns
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const_iterator begin() const
const_iterator end() const
Log< level::Info, false > LogInfo
int iDCCId() const
get the DCCId

Member Data Documentation

◆ cryDigi

bool EcalDigiDisplay::cryDigi
protected

Definition at line 54 of file EcalDigiDisplay.h.

Referenced by analyze(), and EcalDigiDisplay().

◆ digiProducer_

const std::string EcalDigiDisplay::digiProducer_
protected

Definition at line 42 of file EcalDigiDisplay.h.

◆ ebDigiCollection_

const std::string EcalDigiDisplay::ebDigiCollection_
protected

Definition at line 40 of file EcalDigiDisplay.h.

◆ ebDigiToken_

const edm::EDGetTokenT<EBDigiCollection> EcalDigiDisplay::ebDigiToken_
protected

Definition at line 45 of file EcalDigiDisplay.h.

Referenced by analyze().

◆ ecalElectronicsMap_

const EcalElectronicsMapping* EcalDigiDisplay::ecalElectronicsMap_
protected

Definition at line 64 of file EcalDigiDisplay.h.

Referenced by beginRun(), readEBDigis(), and readEEDigis().

◆ ecalMappingToken_

const edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> EcalDigiDisplay::ecalMappingToken_
protected

Definition at line 48 of file EcalDigiDisplay.h.

Referenced by beginRun().

◆ eeDigiCollection_

const std::string EcalDigiDisplay::eeDigiCollection_
protected

Definition at line 41 of file EcalDigiDisplay.h.

◆ eeDigiToken_

const edm::EDGetTokenT<EEDigiCollection> EcalDigiDisplay::eeDigiToken_
protected

Definition at line 46 of file EcalDigiDisplay.h.

Referenced by analyze().

◆ fedMap

EcalFedMap* EcalDigiDisplay::fedMap
protected

Definition at line 38 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay().

◆ inputIsOk

bool EcalDigiDisplay::inputIsOk
protected

Definition at line 53 of file EcalDigiDisplay.h.

Referenced by analyze(), EcalDigiDisplay(), readEBDigis(), and readPNDigis().

◆ listChannels

std::vector<int> EcalDigiDisplay::listChannels
protected

Definition at line 60 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay(), readEBDigis(), and readEEDigis().

◆ listPns

std::vector<int> EcalDigiDisplay::listPns
protected

Definition at line 62 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay(), and readPNDigis().

◆ listTowers

std::vector<int> EcalDigiDisplay::listTowers
protected

Definition at line 61 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay(), readEBDigis(), and readEEDigis().

◆ mode

int EcalDigiDisplay::mode
protected

Definition at line 58 of file EcalDigiDisplay.h.

Referenced by analyze(), and EcalDigiDisplay().

◆ pnDigi

bool EcalDigiDisplay::pnDigi
protected

Definition at line 56 of file EcalDigiDisplay.h.

Referenced by analyze(), and EcalDigiDisplay().

◆ pnDiodeDigiToken_

const edm::EDGetTokenT<EcalPnDiodeDigiCollection> EcalDigiDisplay::pnDiodeDigiToken_
protected

Definition at line 47 of file EcalDigiDisplay.h.

Referenced by analyze().

◆ rawDataToken_

const edm::EDGetTokenT<EcalRawDataCollection> EcalDigiDisplay::rawDataToken_
protected

Definition at line 44 of file EcalDigiDisplay.h.

Referenced by analyze().

◆ requestedEbs_

std::vector<std::string> EcalDigiDisplay::requestedEbs_
protected

Definition at line 51 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay().

◆ requestedFeds_

std::vector<int> EcalDigiDisplay::requestedFeds_
protected

Definition at line 50 of file EcalDigiDisplay.h.

Referenced by EcalDigiDisplay(), readEBDigis(), readEEDigis(), and readPNDigis().

◆ ttDigi

bool EcalDigiDisplay::ttDigi
protected

Definition at line 55 of file EcalDigiDisplay.h.

Referenced by analyze(), and EcalDigiDisplay().