CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginRun (edm::Run const &, edm::EventSetup const &c)
 
void endJob (void)
 
- 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 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 &)
 

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_, i, inputIsOk_, listChannels_, listEBs_, listFEDs_, listSamples_, and theRealFedSet_.

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

Definition at line 120 of file EcalPedHists.cc.

121 {
122 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 197 of file EcalPedHists.cc.

References allFEDsSelected_, barrelDigiCollection_, endcapDigiCollection_, cppFunctionSkipper::exception, FEDsAndHistMaps_, edm::Event::getByLabel(), headerProducer_, edm::EventBase::id(), initHists(), inputIsOk_, readEBdigis(), readEEdigis(), edm::EventID::run(), runNum_, and theRealFedSet_.

198 {
199  using namespace std;
200  using namespace edm;
201 
202  if (!inputIsOk_)
203  return;
204 
205  // loop over the headers, this is to detect missing FEDs if all are selected
206  if(allFEDsSelected_)
207  {
209  try {
210  e.getByLabel (headerProducer_, DCCHeaders);
211  } catch ( std::exception& ex ) {
212  edm::LogError ("EcalPedHists") << "Error! can't get the product "
213  << headerProducer_;
214  return;
215  }
216 
217  for (EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin();
218  headerItr != DCCHeaders->end ();
219  ++headerItr)
220  {
221  int FEDid = 600+headerItr->id();
222  theRealFedSet_.insert(FEDid);
223  }
224  }
225 
226  // loop over fed list and make sure that there are histo maps
227  for(set<int>::const_iterator fedItr = theRealFedSet_.begin(); fedItr != theRealFedSet_.end(); ++fedItr)
228  {
229  if(FEDsAndHistMaps_.find(*fedItr)==FEDsAndHistMaps_.end())
230  initHists(*fedItr);
231  }
232 
233  //debug
234  //cout << "analyze...input is ok? " << inputIsOk_ << endl;
235 
236  bool barrelDigisFound = true;
237  bool endcapDigisFound = true;
238  // get the barrel digis
239  // (one digi for each crystal)
240  // TODO; SIC: fix this behavior
241  Handle<EBDigiCollection> barrelDigis;
242  try {
243  e.getByLabel (barrelDigiCollection_, barrelDigis);
244  } catch ( std::exception& ex )
245  {
246  edm::LogError ("EcalPedOffset") << "Error! can't get the product "
248  barrelDigisFound = false;
249  }
250  // get the endcap digis
251  // (one digi for each crystal)
252  // TODO; SIC: fix this behavior
253  Handle<EEDigiCollection> endcapDigis;
254  try {
255  e.getByLabel (endcapDigiCollection_, endcapDigis);
256  } catch ( std::exception& ex )
257  {
258  edm::LogError ("EcalPedOffset") << "Error! can't get the product "
260  endcapDigisFound = false;
261  }
262 
263  if(barrelDigisFound)
264  readEBdigis(barrelDigis);
265  if(endcapDigisFound)
266  readEEdigis(endcapDigis);
267  if(!barrelDigisFound && !endcapDigisFound)
268  edm::LogError ("EcalPedOffset") << "No digis found in the event!";
269 
270  if(runNum_==-1)
271  runNum_ = e.id().run();
272 }
RunNumber_t run() const
Definition: EventID.h:39
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:64
void initHists(int FED)
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:63
edm::InputTag endcapDigiCollection_
Definition: EcalPedHists.h:57
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
edm::InputTag headerProducer_
Definition: EcalPedHists.h:58
void readEBdigis(edm::Handle< EBDigiCollection > digis)
bool allFEDsSelected_
Definition: EcalPedHists.h:53
edm::EventID id() const
Definition: EventBase.h:59
void readEEdigis(edm::Handle< EEDigiCollection > digis)
edm::InputTag barrelDigiCollection_
Definition: EcalPedHists.h:56
void EcalPedHists::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file EcalPedHists.cc.

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

125 {
127  c.get<EcalMappingRcd>().get(elecHandle);
128  ecalElectronicsMap_ = elecHandle.product();
129 }
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:67
T const * product() const
Definition: ESHandle.h:86
void EcalPedHists::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file EcalPedHists.cc.

References ecal_dqm_sourceclient-live_cfg::cerr, dir, fedMap_, FEDsAndHistMaps_, fileName_, EcalFedMap::getSliceFromFed(), estimatePileup::hist, histsFilled_, inputIsOk_, intToString(), listChannels_, root_file_, runNum_, and theRealFedSet_.

Referenced by o2o.O2ORunMgr::executeJob().

132 {
133  using namespace std;
134  if(inputIsOk_)
135  {
136  //debug
137  //cout << "endJob:creating root file!" << endl;
138 
139  fileName_ += "-"+intToString(runNum_)+".graph.root";
140 
141  TFile root_file_(fileName_.c_str() , "RECREATE");
142  //Loop over FEDs first
143  for(set<int>::const_iterator FEDitr = theRealFedSet_.begin(); FEDitr != theRealFedSet_.end(); ++FEDitr)
144  {
145  if(!histsFilled_)
146  break;
147  string dir = fedMap_->getSliceFromFed(*FEDitr);
148  TDirectory* FEDdir = gDirectory->mkdir(dir.c_str());
149  FEDdir->cd();
150  //root_file_.mkdir(dir.c_str());
151  //root_file_.cd(dir.c_str());
152  map<string,TH1F*> mapHistos = FEDsAndHistMaps_[*FEDitr];
153 
154  //Loop over channels; write histos and directory structure
155  for (vector<int>::const_iterator itr = listChannels_.begin(); itr!=listChannels_.end(); itr++)
156  {
157  //debug
158  //cout << "loop over channels" << endl;
159 
160  TH1F* hist = 0;
161  string chnl = intToString(*itr);
162  string name1 = "Cry";
163  name1.append(chnl+"Gain1");
164  string name2 = "Cry";
165  name2.append(chnl+"Gain6");
166  string name3 = "Cry";
167  name3.append(chnl+"Gain12");
168  hist = mapHistos[name1];
169  // This is a sanity check only
170  if(hist!=0)
171  {
172  string cryDirName = "Cry_"+chnl;
173  TDirectory* cryDir = FEDdir->mkdir(cryDirName.c_str());
174  cryDir->cd();
175  hist->SetDirectory(cryDir);
176  hist->Write();
177  hist = mapHistos[name2];
178  hist->SetDirectory(cryDir);
179  hist->Write();
180  hist = mapHistos[name3];
181  hist->SetDirectory(cryDir);
182  hist->Write();
183  //root_file_.cd(dir.c_str());
184  root_file_.cd();
185  }
186  else
187  {
188  cerr << "EcalPedHists: Error: This shouldn't happen!" << endl;
189  }
190  }
191  root_file_.cd();
192  }
193  root_file_.Close();
194  }
195 }
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:64
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:63
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
bool histsFilled_
Definition: EcalPedHists.h:54
EcalFedMap * fedMap_
Definition: EcalPedHists.h:65
std::vector< int > listChannels_
Definition: EcalPedHists.h:59
std::string fileName_
Definition: EcalPedHists.h:55
dbl *** dir
Definition: mlp_gen.cc:35
TFile * root_file_
Definition: EcalPedHists.h:66
void EcalPedHists::initHists ( int  FED)
private

Definition at line 275 of file EcalPedHists.cc.

References FEDsAndHistMaps_, intToString(), and listChannels_.

Referenced by analyze().

276 {
277  using namespace std;
278  //using namespace edm;
279 
280  std::map<string,TH1F*> histMap;
281  //debug
282  //cout << "Initializing map for FED:" << *FEDitr << endl;
283  for (vector<int>::const_iterator intIter = listChannels_.begin(); intIter != listChannels_.end(); ++intIter)
284  {
285  //Put 3 histos (1 per gain) for the channel into the map
286  string FEDid = intToString(FED);
287  string chnl = intToString(*intIter);
288  string title1 = "Gain1 ADC Counts for channel ";
289  title1.append(chnl);
290  string name1 = "Cry";
291  name1.append(chnl+"Gain1");
292  string title2 = "Gain6 ADC Counts for channel ";
293  title2.append(chnl);
294  string name2 = "Cry";
295  name2.append(chnl+"Gain6");
296  string title3 = "Gain12 ADC Counts for channel ";
297  title3.append(chnl);
298  string name3 = "Cry";
299  name3.append(chnl+"Gain12");
300  histMap.insert(make_pair(name1,new TH1F(name1.c_str(),title1.c_str(),75,175.0,250.0)));
301  histMap[name1]->SetDirectory(0);
302  histMap.insert(make_pair(name2,new TH1F(name2.c_str(),title2.c_str(),75,175.0,250.0)));
303  histMap[name2]->SetDirectory(0);
304  histMap.insert(make_pair(name3,new TH1F(name3.c_str(),title3.c_str(),75,175.0,250.0)));
305  histMap[name3]->SetDirectory(0);
306  }
307  FEDsAndHistMaps_.insert(make_pair(FED,histMap));
308 }
std::string intToString(int num)
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:63
std::vector< int > listChannels_
Definition: EcalPedHists.h:59
std::string EcalPedHists::intToString ( int  num)
private

Definition at line 424 of file EcalPedHists.cc.

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

425 {
426  using namespace std;
427  //
428  // outputs the number into the string stream and then flushes
429  // the buffer (makes sure the output is put into the stream)
430  //
431  ostringstream myStream; //creates an ostringstream object
432  myStream << num << flush;
433  return(myStream.str()); //returns the string form of the stringstream object
434 }
void EcalPedHists::readEBdigis ( edm::Handle< EBDigiCollection digis)
private

Definition at line 311 of file EcalPedHists.cc.

References ecalMGPA::adc(), ecal_dqm_sourceclient-live_cfg::cerr, EcalElectronicsId::dccId(), ecalElectronicsMap_, FEDsAndHistMaps_, spr::find(), ecalMGPA::gainId(), EcalElectronicsMapping::getElectronicsId(), estimatePileup::hist, histsFilled_, EBDetId::ic(), intToString(), listChannels_, listSamples_, compare_using_db::sample, and theRealFedSet_.

Referenced by analyze().

312 {
313  using namespace std;
314  using namespace edm;
315  //debug
316  //cout << "readEBdigis" << endl;
317 
318  // Loop over digis
319  for (EBDigiCollection::const_iterator digiItr= digis->begin();digiItr != digis->end(); ++digiItr )
320  {
321  EBDetId detId = EBDetId(digiItr->id());
323  int FEDid = 600+elecId.dccId();
324  int crystalId = detId.ic();
325 
326  //debug
327  //cout << "FEDid:" << FEDid << " cryId:" << crystalId << endl;
328  //cout << "FEDid:" << FEDid << endl;
329  //Select desired supermodules only
330  set<int>::const_iterator fedIter = find(theRealFedSet_.begin(), theRealFedSet_.end(), FEDid);
331  if (fedIter == theRealFedSet_.end())
332  continue;
333 
334  // Select desired channels only
335  vector<int>::iterator icIter;
336  icIter = find(listChannels_.begin(), listChannels_.end(), crystalId);
337  if (icIter == listChannels_.end())
338  continue;
339 
340  // Get the adc counts from the selected samples and fill the corresponding histogram
341  // Must subtract 1 from user-given sample list (e.g., user's sample 1 -> sample 0)
342  for (vector<int>::iterator itr = listSamples_.begin(); itr!=listSamples_.end(); itr++)
343  {
344  histsFilled_ = true;
345  map<string,TH1F*> mapHistos = FEDsAndHistMaps_[FEDid];
346  string chnl = intToString(crystalId);
347  string name1 = "Cry";
348  name1.append(chnl+"Gain1");
349  string name2 = "Cry";
350  name2.append(chnl+"Gain6");
351  string name3 = "Cry";
352  name3.append(chnl+"Gain12");
353  TH1F* hist = 0;
354  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==3)
355  hist = mapHistos[name1];
356  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==2)
357  hist = mapHistos[name2];
358  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==1)
359  hist = mapHistos[name3];
360  if(hist!=0)
361  hist->Fill(((EBDataFrame)(*digiItr)).sample(*itr-1).adc());
362  else
363  cerr << "EcalPedHistDumper: Error: This shouldn't happen!" << endl;
364  }
365  }
366 }
int adc(sample_type sample)
get the ADC sample (12 bits)
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:64
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int gainId(sample_type sample)
get the gainId (2 bits)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string intToString(int num)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:63
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
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:46
bool histsFilled_
Definition: EcalPedHists.h:54
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:67
std::vector< int > listChannels_
Definition: EcalPedHists.h:59
std::vector< int > listSamples_
Definition: EcalPedHists.h:60
void EcalPedHists::readEEdigis ( edm::Handle< EEDigiCollection digis)
private

Definition at line 369 of file EcalPedHists.cc.

References ecalMGPA::adc(), ecal_dqm_sourceclient-live_cfg::cerr, EcalElectronicsId::dccId(), ecalElectronicsMap_, FEDsAndHistMaps_, spr::find(), ecalMGPA::gainId(), EcalElectronicsMapping::getElectronicsId(), estimatePileup::hist, histsFilled_, intToString(), listChannels_, listSamples_, compare_using_db::sample, and theRealFedSet_.

Referenced by analyze().

370 {
371  using namespace std;
372  using namespace edm;
373  //debug
374  //cout << "readEEdigis" << endl;
375 
376  // Loop over digis
377  for (EEDigiCollection::const_iterator digiItr= digis->begin();digiItr != digis->end(); ++digiItr )
378  {
379  EEDetId detId = EEDetId(digiItr->id());
381  int FEDid = 600+elecId.dccId();
382  int crystalId = 10000*FEDid+100*elecId.towerId()+5*(elecId.stripId()-1)+elecId.xtalId();
383 
384  //Select desired FEDs only
385  set<int>::const_iterator fedIter = find(theRealFedSet_.begin(), theRealFedSet_.end(), FEDid);
386  if (fedIter == theRealFedSet_.end())
387  continue;
388 
389  // Select desired channels only
390  vector<int>::iterator icIter;
391  icIter = find(listChannels_.begin(), listChannels_.end(), crystalId);
392  if (icIter == listChannels_.end())
393  continue;
394 
395  // Get the adc counts from the selected samples and fill the corresponding histogram
396  // Must subtract 1 from user-given sample list (e.g., user's sample 1 -> sample 0)
397  for (vector<int>::iterator itr = listSamples_.begin(); itr!=listSamples_.end(); itr++)
398  {
399  histsFilled_ = true;
400  map<string,TH1F*> mapHistos = FEDsAndHistMaps_[FEDid];
401  string chnl = intToString(crystalId);
402  string name1 = "Cry";
403  name1.append(chnl+"Gain1");
404  string name2 = "Cry";
405  name2.append(chnl+"Gain6");
406  string name3 = "Cry";
407  name3.append(chnl+"Gain12");
408  TH1F* hist = 0;
409  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==3)
410  hist = mapHistos[name1];
411  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==2)
412  hist = mapHistos[name2];
413  if(((EBDataFrame)(*digiItr)).sample(*itr-1).gainId()==1)
414  hist = mapHistos[name3];
415  if(hist!=0)
416  hist->Fill(((EBDataFrame)(*digiItr)).sample(*itr-1).adc());
417  else
418  cerr << "EcalPedHistDumper: Error: This shouldn't happen!" << endl;
419  }
420  }
421 }
int adc(sample_type sample)
get the ADC sample (12 bits)
std::set< int > theRealFedSet_
Definition: EcalPedHists.h:64
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int gainId(sample_type sample)
get the gainId (2 bits)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::string intToString(int num)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< int, stringHistMap > FEDsAndHistMaps_
Definition: EcalPedHists.h:63
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
bool histsFilled_
Definition: EcalPedHists.h:54
const EcalElectronicsMapping * ecalElectronicsMap_
Definition: EcalPedHists.h:67
std::vector< int > listChannels_
Definition: EcalPedHists.h:59
std::vector< int > listSamples_
Definition: EcalPedHists.h:60

Member Data Documentation

bool EcalPedHists::allFEDsSelected_
private

Definition at line 53 of file EcalPedHists.h.

Referenced by analyze(), and EcalPedHists().

edm::InputTag EcalPedHists::barrelDigiCollection_
private

Definition at line 56 of file EcalPedHists.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalPedHists::ecalElectronicsMap_
private

Definition at line 67 of file EcalPedHists.h.

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

edm::InputTag EcalPedHists::endcapDigiCollection_
private

Definition at line 57 of file EcalPedHists.h.

Referenced by analyze().

EcalFedMap* EcalPedHists::fedMap_
private

Definition at line 65 of file EcalPedHists.h.

Referenced by EcalPedHists(), and endJob().

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

Definition at line 63 of file EcalPedHists.h.

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

std::string EcalPedHists::fileName_
private

Definition at line 55 of file EcalPedHists.h.

Referenced by endJob().

edm::InputTag EcalPedHists::headerProducer_
private

Definition at line 58 of file EcalPedHists.h.

Referenced by analyze().

bool EcalPedHists::histsFilled_
private

Definition at line 54 of file EcalPedHists.h.

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

bool EcalPedHists::inputIsOk_
private

Definition at line 52 of file EcalPedHists.h.

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

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

Definition at line 59 of file EcalPedHists.h.

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

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

Definition at line 62 of file EcalPedHists.h.

Referenced by EcalPedHists().

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

Definition at line 61 of file EcalPedHists.h.

Referenced by EcalPedHists().

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

Definition at line 60 of file EcalPedHists.h.

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

TFile* EcalPedHists::root_file_
private

Definition at line 66 of file EcalPedHists.h.

Referenced by endJob().

int EcalPedHists::runNum_
private

Definition at line 51 of file EcalPedHists.h.

Referenced by analyze(), and endJob().

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

Definition at line 64 of file EcalPedHists.h.

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