CMS 3D CMS Logo

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

#include <EcalPedHists.h>

Inheritance diagram for EcalPedHists:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalPedHists (const edm::ParameterSet &ps)
 
 ~EcalPedHists () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginRun (edm::Run const &, edm::EventSetup const &c) override
 
void endJob (void) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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<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)
 

Private Member Functions

void initHists (int FED)
 
std::string intToString (int num)
 
void readEBdigis (edm::Handle< EBDigiCollection > digis)
 
void readEEdigis (edm::Handle< EEDigiCollection > digis)
 

Private Attributes

bool allFEDsSelected_
 
edm::InputTag barrelDigiCollection_
 
const EcalElectronicsMappingecalElectronicsMap_
 
edm::InputTag endcapDigiCollection_
 
EcalFedMapfedMap_
 
std::map< int, stringHistMapFEDsAndHistMaps_
 
std::string fileName_
 
edm::InputTag headerProducer_
 
bool histsFilled_
 
bool inputIsOk_
 
std::vector< int > listChannels_
 
std::vector< std::string > listEBs_
 
std::vector< int > listFEDs_
 
std::vector< int > listSamples_
 
TFile * root_file_
 
int runNum_
 
std::set< int > theRealFedSet_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 34 of file EcalPedHists.h.

Constructor & Destructor Documentation

EcalPedHists::EcalPedHists ( const edm::ParameterSet ps)

Module which outputs a root file of ADC counts (all three gains) of user-selected channels (defaults to channel 1) for user-selected samples (defaults to samples 1,2,3) for user-selected supermodules.

Author
S. Cooper

Definition at line 13 of file EcalPedHists.cc.

References allFEDsSelected_, gather_cfg::cout, fedMap_, EcalFedMap::getFedFromSlice(), edm::ParameterSet::getUntrackedParameter(), histsFilled_, mps_fire::i, inputIsOk_, listChannels_, listEBs_, listFEDs_, listSamples_, and theRealFedSet_.

14  : runNum_(-1),
15  fileName_(ps.getUntrackedParameter<std::string>("fileName", std::string("ecalPedDigiDump"))),
16  barrelDigiCollection_(ps.getParameter<edm::InputTag>("EBdigiCollection")),
17  endcapDigiCollection_(ps.getParameter<edm::InputTag>("EEdigiCollection")),
18  headerProducer_(ps.getParameter<edm::InputTag>("headerProducer")) {
19  using namespace std;
20 
21  fedMap_ = new EcalFedMap();
22  histsFilled_ = false;
23  //for(int i=601; i<655; ++i)
24  //{
25  // listDefaults.push_back(i);
26  //}
27  listFEDs_ = ps.getUntrackedParameter<vector<int> >("listFEDs");
28  listEBs_ = ps.getUntrackedParameter<vector<string> >("listEBs");
29 
30  if (listFEDs_.empty()) {
31  allFEDsSelected_ = false;
32  //if "actual" EB id given, then convert to FEDid and put in listFEDs_
33  if (!listEBs_.empty()) {
34  listFEDs_.clear();
35  for (vector<string>::const_iterator itr = listEBs_.begin(); itr != listEBs_.end(); ++itr) {
36  listFEDs_.push_back(fedMap_->getFedFromSlice(*itr));
37  }
38  }
39  } else if (listFEDs_[0] == -1) {
40  // Apply no selection if -1 is passed in FED list
41  allFEDsSelected_ = true;
42  //debug
43  //cout << "no selection on FEDs!" << endl;
44  //inputIsOk_=false;
45  //return;
46  //listFEDs_ = listDefaults;
47  } else {
48  //in this case, listFEDs should be populated
49  allFEDsSelected_ = false;
50  }
51 
52  if (!allFEDsSelected_) {
53  // Verify FED numbers are valid
54  for (vector<int>::const_iterator intIter = listFEDs_.begin(); intIter != listFEDs_.end(); intIter++) {
55  if (((*intIter) < 601) || (654 < (*intIter))) {
56  cout << "[EcalPedHists] FED value: " << (*intIter) << " found in listFEDs. "
57  << " Valid range is 601-654. Returning." << endl;
58  inputIsOk_ = false;
59  return;
60  } else
61  theRealFedSet_.insert(*intIter);
62  }
63  }
64 
65  vector<int> listDefaults = vector<int>();
66  listDefaults.clear();
67  for (int i = 1; i < 1701; ++i) {
68  listDefaults.push_back(i);
69  }
70  listChannels_ = ps.getUntrackedParameter<vector<int> >("listChannels", listDefaults);
71  listDefaults.clear();
72  // Get samples to plot (default to 1,2,3)
73  listDefaults.push_back(0);
74  listDefaults.push_back(1);
75  listDefaults.push_back(2);
76  listSamples_ = ps.getUntrackedParameter<vector<int> >("listSamples", listDefaults);
77 
78  inputIsOk_ = true;
79  vector<int>::iterator intIter;
80 
81  // Verify crystal numbers are valid
82  for (intIter = listChannels_.begin(); intIter != listChannels_.end(); ++intIter) {
83  //TODO: Fix crystal index checking?
84  //if ( ((*intIter) < 1)||(1700 < (*intIter)) )
85  //{
86  // cout << "[EcalPedHists] ic value: " << (*intIter) << " found in listChannels. "
87  // << " Valid range is 1-1700. Returning." << endl;
88  // inputIsOk_ = false;
89  // return;
90  //}
91  }
92  // Verify sample numbers are valid
93  for (intIter = listSamples_.begin(); intIter != listSamples_.end(); intIter++) {
94  if (((*intIter) < 1) || (10 < (*intIter))) {
95  cout << "[EcalPedHists] sample number: " << (*intIter) << " found in listSamples. "
96  << " Valid range is 1-10. Returning." << endl;
97  inputIsOk_ = false;
98  return;
99  }
100  }
101 }
T getParameter(std::string const &) const
std::vector< int > listFEDs_
Definition: EcalPedHists.h:60
T getUntrackedParameter(std::string const &, T const &) const
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:63
int getFedFromSlice(std::string)
Definition: EcalFedMap.cc:96
std::vector< std::string > listEBs_
Definition: EcalPedHists.h:61
edm::InputTag endcapDigiCollection_
Definition: EcalPedHists.h:56
edm::InputTag headerProducer_
Definition: EcalPedHists.h:57
bool histsFilled_
Definition: EcalPedHists.h:53
EcalFedMap * fedMap_
Definition: EcalPedHists.h:64
std::vector< int > listChannels_
Definition: EcalPedHists.h:58
bool allFEDsSelected_
Definition: EcalPedHists.h:52
std::string fileName_
Definition: EcalPedHists.h:54
edm::InputTag barrelDigiCollection_
Definition: EcalPedHists.h:55
std::vector< int > listSamples_
Definition: EcalPedHists.h:59
EcalPedHists::~EcalPedHists ( )
override

Definition at line 103 of file EcalPedHists.cc.

103 {}

Member Function Documentation

void EcalPedHists::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 170 of file EcalPedHists.cc.

References allFEDsSelected_, barrelDigiCollection_, ftlUncalibratedRecHits_cfi::barrelDigis, edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), endcapDigiCollection_, ftlUncalibratedRecHits_cfi::endcapDigis, cppFunctionSkipper::exception, FEDsAndHistMaps_, edm::Event::getByLabel(), headerProducer_, edm::EventBase::id(), initHists(), inputIsOk_, readEBdigis(), readEEdigis(), edm::EventID::run(), runNum_, and theRealFedSet_.

170  {
171  using namespace std;
172  using namespace edm;
173 
174  if (!inputIsOk_)
175  return;
176 
177  // loop over the headers, this is to detect missing FEDs if all are selected
178  if (allFEDsSelected_) {
180  try {
181  e.getByLabel(headerProducer_, DCCHeaders);
182  } catch (std::exception& ex) {
183  edm::LogError("EcalPedHists") << "Error! can't get the product " << headerProducer_;
184  return;
185  }
186 
187  for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
188  ++headerItr) {
189  int FEDid = 600 + headerItr->id();
190  theRealFedSet_.insert(FEDid);
191  }
192  }
193 
194  // loop over fed list and make sure that there are histo maps
195  for (set<int>::const_iterator fedItr = theRealFedSet_.begin(); fedItr != theRealFedSet_.end(); ++fedItr) {
196  if (FEDsAndHistMaps_.find(*fedItr) == FEDsAndHistMaps_.end())
197  initHists(*fedItr);
198  }
199 
200  //debug
201  //cout << "analyze...input is ok? " << inputIsOk_ << endl;
202 
203  bool barrelDigisFound = true;
204  bool endcapDigisFound = true;
205  // get the barrel digis
206  // (one digi for each crystal)
207  // TODO; SIC: fix this behavior
209  try {
210  e.getByLabel(barrelDigiCollection_, barrelDigis);
211  } catch (std::exception& ex) {
212  edm::LogError("EcalPedOffset") << "Error! can't get the product " << barrelDigiCollection_;
213  barrelDigisFound = false;
214  }
215  // get the endcap digis
216  // (one digi for each crystal)
217  // TODO; SIC: fix this behavior
219  try {
220  e.getByLabel(endcapDigiCollection_, endcapDigis);
221  } catch (std::exception& ex) {
222  edm::LogError("EcalPedOffset") << "Error! can't get the product " << endcapDigiCollection_;
223  endcapDigisFound = false;
224  }
225 
226  if (barrelDigisFound)
227  readEBdigis(barrelDigis);
228  if (endcapDigisFound)
229  readEEdigis(endcapDigis);
230  if (!barrelDigisFound && !endcapDigisFound)
231  edm::LogError("EcalPedOffset") << "No digis found in the event!";
232 
233  if (runNum_ == -1)
234  runNum_ = e.id().run();
235 }
RunNumber_t run() const
Definition: EventID.h:39
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:63
void initHists(int FED)
std::vector< T >::const_iterator const_iterator
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:62
edm::InputTag endcapDigiCollection_
Definition: EcalPedHists.h:56
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:480
edm::InputTag headerProducer_
Definition: EcalPedHists.h:57
void readEBdigis(edm::Handle< EBDigiCollection > digis)
const_iterator end() const
bool allFEDsSelected_
Definition: EcalPedHists.h:52
edm::EventID id() const
Definition: EventBase.h:59
HLT enums.
void readEEdigis(edm::Handle< EEDigiCollection > digis)
edm::InputTag barrelDigiCollection_
Definition: EcalPedHists.h:55
const_iterator begin() const
void EcalPedHists::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file EcalPedHists.cc.

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

105  {
107  c.get<EcalMappingRcd>().get(elecHandle);
108  ecalElectronicsMap_ = elecHandle.product();
109 }
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:66
T const * product() const
Definition: ESHandle.h:86
void EcalPedHists::endJob ( void  )
overrideprotectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file EcalPedHists.cc.

References MessageLogger_cfi::cerr, dir, fedMap_, FEDsAndHistMaps_, fileName_, EcalFedMap::getSliceFromFed(), create_public_lumi_plots::hist, histsFilled_, inputIsOk_, intToString(), listChannels_, root_file_, runNum_, and theRealFedSet_.

Referenced by o2olib.O2ORunMgr::executeJob().

111  {
112  using namespace std;
113  if (inputIsOk_) {
114  //debug
115  //cout << "endJob:creating root file!" << endl;
116 
117  fileName_ += "-" + intToString(runNum_) + ".graph.root";
118 
119  TFile root_file_(fileName_.c_str(), "RECREATE");
120  //Loop over FEDs first
121  for (set<int>::const_iterator FEDitr = theRealFedSet_.begin(); FEDitr != theRealFedSet_.end(); ++FEDitr) {
122  if (!histsFilled_)
123  break;
124  string dir = fedMap_->getSliceFromFed(*FEDitr);
125  TDirectory* FEDdir = gDirectory->mkdir(dir.c_str());
126  FEDdir->cd();
127  //root_file_.mkdir(dir.c_str());
128  //root_file_.cd(dir.c_str());
129  map<string, TH1F*> mapHistos = FEDsAndHistMaps_[*FEDitr];
130 
131  //Loop over channels; write histos and directory structure
132  for (vector<int>::const_iterator itr = listChannels_.begin(); itr != listChannels_.end(); itr++) {
133  //debug
134  //cout << "loop over channels" << endl;
135 
136  TH1F* hist = nullptr;
137  string chnl = intToString(*itr);
138  string name1 = "Cry";
139  name1.append(chnl + "Gain1");
140  string name2 = "Cry";
141  name2.append(chnl + "Gain6");
142  string name3 = "Cry";
143  name3.append(chnl + "Gain12");
144  hist = mapHistos[name1];
145  // This is a sanity check only
146  if (hist != nullptr) {
147  string cryDirName = "Cry_" + chnl;
148  TDirectory* cryDir = FEDdir->mkdir(cryDirName.c_str());
149  cryDir->cd();
150  hist->SetDirectory(cryDir);
151  hist->Write();
152  hist = mapHistos[name2];
153  hist->SetDirectory(cryDir);
154  hist->Write();
155  hist = mapHistos[name3];
156  hist->SetDirectory(cryDir);
157  hist->Write();
158  //root_file_.cd(dir.c_str());
159  root_file_.cd();
160  } else {
161  cerr << "EcalPedHists: Error: This shouldn't happen!" << endl;
162  }
163  }
164  root_file_.cd();
165  }
166  root_file_.Close();
167  }
168 }
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:63
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:62
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:86
bool histsFilled_
Definition: EcalPedHists.h:53
EcalFedMap * fedMap_
Definition: EcalPedHists.h:64
std::vector< int > listChannels_
Definition: EcalPedHists.h:58
std::string fileName_
Definition: EcalPedHists.h:54
dbl *** dir
Definition: mlp_gen.cc:35
TFile * root_file_
Definition: EcalPedHists.h:65
void EcalPedHists::initHists ( int  FED)
private

Definition at line 238 of file EcalPedHists.cc.

References FEDsAndHistMaps_, intToString(), and listChannels_.

Referenced by analyze().

238  {
239  using namespace std;
240  //using namespace edm;
241 
242  std::map<string, TH1F*> histMap;
243  //debug
244  //cout << "Initializing map for FED:" << *FEDitr << endl;
245  for (vector<int>::const_iterator intIter = listChannels_.begin(); intIter != listChannels_.end(); ++intIter) {
246  //Put 3 histos (1 per gain) for the channel into the map
247  string FEDid = intToString(FED);
248  string chnl = intToString(*intIter);
249  string title1 = "Gain1 ADC Counts for channel ";
250  title1.append(chnl);
251  string name1 = "Cry";
252  name1.append(chnl + "Gain1");
253  string title2 = "Gain6 ADC Counts for channel ";
254  title2.append(chnl);
255  string name2 = "Cry";
256  name2.append(chnl + "Gain6");
257  string title3 = "Gain12 ADC Counts for channel ";
258  title3.append(chnl);
259  string name3 = "Cry";
260  name3.append(chnl + "Gain12");
261  histMap.insert(make_pair(name1, new TH1F(name1.c_str(), title1.c_str(), 75, 175.0, 250.0)));
262  histMap[name1]->SetDirectory(nullptr);
263  histMap.insert(make_pair(name2, new TH1F(name2.c_str(), title2.c_str(), 75, 175.0, 250.0)));
264  histMap[name2]->SetDirectory(nullptr);
265  histMap.insert(make_pair(name3, new TH1F(name3.c_str(), title3.c_str(), 75, 175.0, 250.0)));
266  histMap[name3]->SetDirectory(nullptr);
267  }
268  FEDsAndHistMaps_.insert(make_pair(FED, histMap));
269 }
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:62
std::vector< int > listChannels_
Definition: EcalPedHists.h:58
std::string EcalPedHists::intToString ( int  num)
private

Definition at line 376 of file EcalPedHists.cc.

Referenced by endJob(), initHists(), readEBdigis(), and readEEdigis().

376  {
377  using namespace std;
378  //
379  // outputs the number into the string stream and then flushes
380  // the buffer (makes sure the output is put into the stream)
381  //
382  ostringstream myStream; //creates an ostringstream object
383  myStream << num << flush;
384  return (myStream.str()); //returns the string form of the stringstream object
385 }
void EcalPedHists::readEBdigis ( edm::Handle< EBDigiCollection digis)
private

Definition at line 271 of file EcalPedHists.cc.

References ecalMGPA::adc(), edm::DataFrameContainer::begin(), MessageLogger_cfi::cerr, EcalElectronicsId::dccId(), ecalElectronicsMap_, edm::DataFrameContainer::end(), FEDsAndHistMaps_, spr::find(), ecalMGPA::gainId(), EcalElectronicsMapping::getElectronicsId(), create_public_lumi_plots::hist, histsFilled_, EBDetId::ic(), intToString(), listChannels_, listSamples_, simplePhotonAnalyzer_cfi::sample, and theRealFedSet_.

Referenced by analyze().

271  {
272  using namespace std;
273  using namespace edm;
274  //debug
275  //cout << "readEBdigis" << endl;
276 
277  // Loop over digis
278  for (EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
279  EBDetId detId = EBDetId(digiItr->id());
281  int FEDid = 600 + elecId.dccId();
282  int crystalId = detId.ic();
283 
284  //debug
285  //cout << "FEDid:" << FEDid << " cryId:" << crystalId << endl;
286  //cout << "FEDid:" << FEDid << endl;
287  //Select desired supermodules only
288  set<int>::const_iterator fedIter = find(theRealFedSet_.begin(), theRealFedSet_.end(), FEDid);
289  if (fedIter == theRealFedSet_.end())
290  continue;
291 
292  // Select desired channels only
293  vector<int>::iterator icIter;
294  icIter = find(listChannels_.begin(), listChannels_.end(), crystalId);
295  if (icIter == listChannels_.end())
296  continue;
297 
298  // Get the adc counts from the selected samples and fill the corresponding histogram
299  // Must subtract 1 from user-given sample list (e.g., user's sample 1 -> sample 0)
300  for (vector<int>::iterator itr = listSamples_.begin(); itr != listSamples_.end(); itr++) {
301  histsFilled_ = true;
302  map<string, TH1F*> mapHistos = FEDsAndHistMaps_[FEDid];
303  string chnl = intToString(crystalId);
304  string name1 = "Cry";
305  name1.append(chnl + "Gain1");
306  string name2 = "Cry";
307  name2.append(chnl + "Gain6");
308  string name3 = "Cry";
309  name3.append(chnl + "Gain12");
310  TH1F* hist = nullptr;
311  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 3)
312  hist = mapHistos[name1];
313  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 2)
314  hist = mapHistos[name2];
315  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 1)
316  hist = mapHistos[name3];
317  if (hist != nullptr)
318  hist->Fill(((EBDataFrame)(*digiItr)).sample(*itr - 1).adc());
319  else
320  cerr << "EcalPedHistDumper: Error: This shouldn't happen!" << endl;
321  }
322  }
323 }
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:63
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:62
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
int ic() const
get ECAL/crystal number inside SM
Definition: EBDetId.cc:41
bool histsFilled_
Definition: EcalPedHists.h:53
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:66
std::vector< int > listChannels_
Definition: EcalPedHists.h:58
const_iterator end() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
HLT enums.
std::vector< int > listSamples_
Definition: EcalPedHists.h:59
void EcalPedHists::readEEdigis ( edm::Handle< EEDigiCollection digis)
private

Definition at line 325 of file EcalPedHists.cc.

References ecalMGPA::adc(), edm::DataFrameContainer::begin(), MessageLogger_cfi::cerr, EcalElectronicsId::dccId(), ecalElectronicsMap_, edm::DataFrameContainer::end(), FEDsAndHistMaps_, spr::find(), ecalMGPA::gainId(), EcalElectronicsMapping::getElectronicsId(), create_public_lumi_plots::hist, histsFilled_, intToString(), listChannels_, listSamples_, simplePhotonAnalyzer_cfi::sample, and theRealFedSet_.

Referenced by analyze().

325  {
326  using namespace std;
327  using namespace edm;
328  //debug
329  //cout << "readEEdigis" << endl;
330 
331  // Loop over digis
332  for (EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr) {
333  EEDetId detId = EEDetId(digiItr->id());
335  int FEDid = 600 + elecId.dccId();
336  int crystalId = 10000 * FEDid + 100 * elecId.towerId() + 5 * (elecId.stripId() - 1) + elecId.xtalId();
337 
338  //Select desired FEDs only
339  set<int>::const_iterator fedIter = find(theRealFedSet_.begin(), theRealFedSet_.end(), FEDid);
340  if (fedIter == theRealFedSet_.end())
341  continue;
342 
343  // Select desired channels only
344  vector<int>::iterator icIter;
345  icIter = find(listChannels_.begin(), listChannels_.end(), crystalId);
346  if (icIter == listChannels_.end())
347  continue;
348 
349  // Get the adc counts from the selected samples and fill the corresponding histogram
350  // Must subtract 1 from user-given sample list (e.g., user's sample 1 -> sample 0)
351  for (vector<int>::iterator itr = listSamples_.begin(); itr != listSamples_.end(); itr++) {
352  histsFilled_ = true;
353  map<string, TH1F*> mapHistos = FEDsAndHistMaps_[FEDid];
354  string chnl = intToString(crystalId);
355  string name1 = "Cry";
356  name1.append(chnl + "Gain1");
357  string name2 = "Cry";
358  name2.append(chnl + "Gain6");
359  string name3 = "Cry";
360  name3.append(chnl + "Gain12");
361  TH1F* hist = nullptr;
362  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 3)
363  hist = mapHistos[name1];
364  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 2)
365  hist = mapHistos[name2];
366  if (((EBDataFrame)(*digiItr)).sample(*itr - 1).gainId() == 1)
367  hist = mapHistos[name3];
368  if (hist != nullptr)
369  hist->Fill(((EBDataFrame)(*digiItr)).sample(*itr - 1).adc());
370  else
371  cerr << "EcalPedHistDumper: Error: This shouldn't happen!" << endl;
372  }
373  }
374 }
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:63
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:62
const_iterator begin() const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
bool histsFilled_
Definition: EcalPedHists.h:53
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:66
std::vector< int > listChannels_
Definition: EcalPedHists.h:58
const_iterator end() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
HLT enums.
std::vector< int > listSamples_
Definition: EcalPedHists.h:59

Member Data Documentation

bool EcalPedHists::allFEDsSelected_
private

Definition at line 52 of file EcalPedHists.h.

Referenced by analyze(), and EcalPedHists().

edm::InputTag EcalPedHists::barrelDigiCollection_
private

Definition at line 55 of file EcalPedHists.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalPedHists::ecalElectronicsMap_
private

Definition at line 66 of file EcalPedHists.h.

Referenced by beginRun(), readEBdigis(), and readEEdigis().

edm::InputTag EcalPedHists::endcapDigiCollection_
private

Definition at line 56 of file EcalPedHists.h.

Referenced by analyze().

EcalFedMap* EcalPedHists::fedMap_
private

Definition at line 64 of file EcalPedHists.h.

Referenced by EcalPedHists(), and endJob().

std::map<int, stringHistMap> EcalPedHists::FEDsAndHistMaps_
private

Definition at line 62 of file EcalPedHists.h.

Referenced by analyze(), endJob(), initHists(), readEBdigis(), and readEEdigis().

std::string EcalPedHists::fileName_
private

Definition at line 54 of file EcalPedHists.h.

Referenced by endJob().

edm::InputTag EcalPedHists::headerProducer_
private

Definition at line 57 of file EcalPedHists.h.

Referenced by analyze().

bool EcalPedHists::histsFilled_
private

Definition at line 53 of file EcalPedHists.h.

Referenced by EcalPedHists(), endJob(), readEBdigis(), and readEEdigis().

bool EcalPedHists::inputIsOk_
private

Definition at line 51 of file EcalPedHists.h.

Referenced by analyze(), EcalPedHists(), and endJob().

std::vector<int> EcalPedHists::listChannels_
private

Definition at line 58 of file EcalPedHists.h.

Referenced by EcalPedHists(), endJob(), initHists(), readEBdigis(), and readEEdigis().

std::vector<std::string> EcalPedHists::listEBs_
private

Definition at line 61 of file EcalPedHists.h.

Referenced by EcalPedHists().

std::vector<int> EcalPedHists::listFEDs_
private

Definition at line 60 of file EcalPedHists.h.

Referenced by EcalPedHists().

std::vector<int> EcalPedHists::listSamples_
private

Definition at line 59 of file EcalPedHists.h.

Referenced by EcalPedHists(), readEBdigis(), and readEEdigis().

TFile* EcalPedHists::root_file_
private

Definition at line 65 of file EcalPedHists.h.

Referenced by endJob().

int EcalPedHists::runNum_
private

Definition at line 50 of file EcalPedHists.h.

Referenced by analyze(), and endJob().

std::set<int> EcalPedHists::theRealFedSet_
private

Definition at line 63 of file EcalPedHists.h.

Referenced by analyze(), EcalPedHists(), endJob(), readEBdigis(), and readEEdigis().