CMS 3D CMS Logo

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

#include <EcalURecHitHists.h>

Inheritance diagram for EcalURecHitHists:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalURecHitHists (const edm::ParameterSet &)
 
 ~EcalURecHitHists ()
 
- 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 ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
void initHists (int)
 
std::string intToString (int num)
 

Private Attributes

TH1F * allFedsHist_
 
TH1F * allFedsTimingHist_
 
edm::InputTag EBUncalibratedRecHitCollection_
 
const EcalElectronicsMappingecalElectronicsMap_
 
edm::InputTag EEUncalibratedRecHitCollection_
 
EcalFedMapfedMap_
 
std::map< int, TH1F * > FEDsAndHists_
 
std::map< int, TH1F * > FEDsAndTimingHists_
 
TFile * file
 
std::string fileName_
 
double histRangeMax_
 
double histRangeMin_
 
std::vector< int > maskedChannels_
 
std::vector< std::string > maskedEBs_
 
std::vector< int > maskedFEDs_
 
int runNum_
 

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 &)
 
- 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)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 55 of file EcalURecHitHists.h.

Constructor & Destructor Documentation

EcalURecHitHists::EcalURecHitHists ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file EcalURecHitHists.cc.

References allFedsHist_, allFedsTimingHist_, fedMap_, edm::ParameterSet::getUntrackedParameter(), histRangeMax_, histRangeMin_, createfilelist::int, maskedChannels_, maskedEBs_, and maskedFEDs_.

36  :
37  EBUncalibratedRecHitCollection_ (iConfig.getParameter<edm::InputTag>("EBUncalibratedRecHitCollection")),
38  EEUncalibratedRecHitCollection_ (iConfig.getParameter<edm::InputTag>("EEUncalibratedRecHitCollection")),
39  runNum_(-1),
40  histRangeMax_ (iConfig.getUntrackedParameter<double>("histogramMaxRange",200.0)),
41  histRangeMin_ (iConfig.getUntrackedParameter<double>("histogramMinRange",-10.0)),
42  fileName_ (iConfig.getUntrackedParameter<std::string>("fileName", std::string("ecalURechHitHists")))
43 {
44  vector<int> listDefaults;
45  listDefaults.push_back(-1);
46 
47  maskedChannels_ = iConfig.getUntrackedParameter<vector<int> >("maskedChannels", listDefaults);
48  maskedFEDs_ = iConfig.getUntrackedParameter<vector<int> >("maskedFEDs", listDefaults);
49 
50  vector<string> defaultMaskedEBs;
51  defaultMaskedEBs.push_back("none");
52  maskedEBs_ = iConfig.getUntrackedParameter<vector<string> >("maskedEBs",defaultMaskedEBs);
53 
54  fedMap_ = new EcalFedMap();
55  string title1 = "Uncalib Rec Hits (ADC counts)";
56  string name1 = "URecHitsAllFEDs";
57  int numBins = (int)round(histRangeMax_-histRangeMin_)+1;
58  allFedsHist_ = new TH1F(name1.c_str(),title1.c_str(),numBins,histRangeMin_,histRangeMax_);
59  title1 = "Jitter for all FEDs";
60  name1 = "JitterAllFEDs";
61  allFedsTimingHist_ = new TH1F(name1.c_str(),title1.c_str(),14,-7,7);
62 
63  // load up the maskedFED list with the proper FEDids
64  if(maskedFEDs_[0]==-1)
65  {
66  //if "actual" EB id given, then convert to FEDid and put in listFEDs_
67  if(maskedEBs_[0] != "none")
68  {
69  maskedFEDs_.clear();
70  for(vector<string>::const_iterator ebItr = maskedEBs_.begin(); ebItr != maskedEBs_.end(); ++ebItr)
71  {
72  maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
73  }
74  }
75  }
76 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string fileName_
edm::InputTag EBUncalibratedRecHitCollection_
edm::InputTag EEUncalibratedRecHitCollection_
std::vector< int > maskedChannels_
std::vector< std::string > maskedEBs_
std::vector< int > maskedFEDs_
EcalFedMap * fedMap_
EcalURecHitHists::~EcalURecHitHists ( )

Definition at line 79 of file EcalURecHitHists.cc.

80 {
81 }

Member Function Documentation

void EcalURecHitHists::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 90 of file EcalURecHitHists.cc.

References allFedsHist_, allFedsTimingHist_, EcalUncalibratedRecHit::amplitude(), edm::SortedCollection< T, SORT >::begin(), EcalElectronicsId::dccId(), EBUncalibratedRecHitCollection_, ecalElectronicsMap_, EEUncalibratedRecHitCollection_, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), FEDsAndHists_, FEDsAndTimingHists_, spr::find(), edm::Event::getByLabel(), EcalElectronicsMapping::getElectronicsId(), ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), EBDetId::ic(), EEDetId::ic(), EcalUncalibratedRecHit::id(), edm::EventBase::id(), initHists(), EcalUncalibratedRecHit::jitter(), LogDebug, maskedChannels_, maskedFEDs_, mps_fire::result, edm::EventID::run(), runNum_, and edm::SortedCollection< T, SORT >::size().

91 {
92  int ievt = iEvent.id().event();
95 
96  iEvent.getByLabel(EBUncalibratedRecHitCollection_, EBhits);
97  LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EBhits->size();
98 
99  iEvent.getByLabel(EEUncalibratedRecHitCollection_, EEhits);
100  LogDebug("EcalURecHitHists") << "event " << ievt << " hits collection size " << EEhits->size();
101 
102  for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EBhits->begin(); hitItr != EBhits->end(); ++hitItr)
103  {
104  EcalUncalibratedRecHit hit = (*hitItr);
105  EBDetId ebDet = hit.id();
106  int ic = ebDet.ic();
107  int hashedIndex = ebDet.hashedIndex();
109  int FEDid = 600+elecId.dccId();
110  float ampli = hit.amplitude();
111 
112  vector<int>::iterator result;
113  result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid);
114  if(result != maskedFEDs_.end())
115  {
116  LogWarning("EcalURecHitHists") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli;
117  continue;
118  }
119 
120  result = find(maskedChannels_.begin(), maskedChannels_.end(), hashedIndex);
121  if (result != maskedChannels_.end())
122  {
123  LogWarning("EcalURecHitHists") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli ;
124  continue;
125  }
126 
127  // fill the proper hist
128  TH1F* uRecHist = FEDsAndHists_[FEDid];
129  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
130  if(uRecHist==0)
131  {
132  initHists(FEDid);
133  uRecHist = FEDsAndHists_[FEDid];
134  timingHist = FEDsAndTimingHists_[FEDid];
135  }
136 
137  uRecHist->Fill(ampli);
138  allFedsHist_->Fill(ampli);
139  timingHist->Fill(hit.jitter());
140  allFedsTimingHist_->Fill(hit.jitter());
141  }
142 
143  // Again for the endcap
144  for (EcalUncalibratedRecHitCollection::const_iterator hitItr = EEhits->begin(); hitItr != EEhits->end(); ++hitItr)
145  {
146  EcalUncalibratedRecHit hit = (*hitItr);
147  EEDetId eeDet = hit.id();
148  int ic = eeDet.ic();
149  int hashedIndex = eeDet.hashedIndex();
151  int FEDid = 600+elecId.dccId();
152  float ampli = hit.amplitude();
153 
154  vector<int>::iterator result;
155  result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid);
156  if(result != maskedFEDs_.end())
157  {
158  LogWarning("EcalURecHitHists") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli;
159  continue;
160  }
161 
162  result = find(maskedChannels_.begin(), maskedChannels_.end(), hashedIndex);
163  if (result != maskedChannels_.end())
164  {
165  LogWarning("EcalURecHitHists") << "skipping uncalRecHit for channel: " << ic << " with amplitude " << ampli ;
166  continue;
167  }
168 
169  // fill the proper hist
170  TH1F* uRecHist = FEDsAndHists_[FEDid];
171  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
172  if(uRecHist==0)
173  {
174  initHists(FEDid);
175  uRecHist = FEDsAndHists_[FEDid];
176  timingHist = FEDsAndTimingHists_[FEDid];
177  }
178 
179  uRecHist->Fill(ampli);
180  allFedsHist_->Fill(ampli);
181  timingHist->Fill(hit.jitter());
182  allFedsTimingHist_->Fill(hit.jitter());
183  }
184 
185  if(runNum_==-1)
186  {
187  runNum_ = iEvent.id().run();
188  }
189 }
#define LogDebug(id)
const EcalElectronicsMapping * ecalElectronicsMap_
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
int ic() const
Definition: EEDetId.cc:324
edm::InputTag EBUncalibratedRecHitCollection_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::vector< EcalUncalibratedRecHit >::const_iterator const_iterator
edm::InputTag EEUncalibratedRecHitCollection_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int iEvent
Definition: GenABIO.cc:230
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
std::map< int, TH1F * > FEDsAndHists_
const_iterator end() const
int hashedIndex() const
Definition: EEDetId.h:182
std::vector< int > maskedChannels_
std::map< int, TH1F * > FEDsAndTimingHists_
size_type size() const
std::vector< int > maskedFEDs_
const_iterator begin() const
void EcalURecHitHists::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 218 of file EcalURecHitHists.cc.

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

219 {
221  c.get<EcalMappingRcd>().get(elecHandle);
222  ecalElectronicsMap_ = elecHandle.product();
223 }
const EcalElectronicsMapping * ecalElectronicsMap_
T const * product() const
Definition: ESHandle.h:86
void EcalURecHitHists::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file EcalURecHitHists.cc.

References allFedsHist_, allFedsTimingHist_, MessageLogger_cfi::cerr, dir, fedMap_, FEDsAndHists_, FEDsAndTimingHists_, fileName_, EcalFedMap::getSliceFromFed(), create_public_lumi_plots::hist, intToString(), maskedChannels_, runNum_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by o2olib.O2ORunMgr::executeJob().

228 {
229  using namespace std;
230  fileName_ += "-"+intToString(runNum_)+".graph.root";
231 
232  TFile root_file_(fileName_.c_str() , "RECREATE");
233 
234  for(map<int,TH1F*>::const_iterator itr = FEDsAndHists_.begin();
235  itr != FEDsAndHists_.end(); ++itr)
236  {
237  string dir = fedMap_->getSliceFromFed(itr->first);
238  TDirectory* FEDdir = gDirectory->mkdir(dir.c_str());
239  FEDdir->cd();
240 
241  TH1F* hist = itr->second;
242  if(hist!=0)
243  hist->Write();
244  else
245  {
246  cerr << "EcalPedHists: Error: This shouldn't happen!" << endl;
247  }
248  // Write out timing hist
249  hist = FEDsAndTimingHists_[itr->first];
250  if(hist!=0)
251  hist->Write();
252  else
253  {
254  cerr << "EcalPedHists: Error: This shouldn't happen!" << endl;
255  }
256  root_file_.cd();
257  }
258  allFedsHist_->Write();
259  allFedsTimingHist_->Write();
260  root_file_.Close();
261 
262  std::string channels;
263  for(std::vector<int>::const_iterator itr = maskedChannels_.begin();
264  itr != maskedChannels_.end(); ++itr)
265  {
266  channels+=intToString(*itr);
267  channels+=",";
268  }
269 
270  LogWarning("EcalMipGraphs") << "Masked channels are: " << channels << " and that is all!";
271 }
std::string fileName_
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
std::map< int, TH1F * > FEDsAndHists_
std::vector< int > maskedChannels_
std::map< int, TH1F * > FEDsAndTimingHists_
EcalFedMap * fedMap_
std::string intToString(int num)
dbl *** dir
Definition: mlp_gen.cc:35
void EcalURecHitHists::initHists ( int  FED)
private

Definition at line 193 of file EcalURecHitHists.cc.

References fedMap_, FEDsAndHists_, FEDsAndTimingHists_, EcalFedMap::getSliceFromFed(), create_public_lumi_plots::hist, histRangeMax_, histRangeMin_, createfilelist::int, and intToString().

Referenced by analyze().

194 {
195  using namespace std;
196 
197  string FEDid = intToString(FED);
198  string title1 = "Uncalib Rec Hits (ADC counts) for ";
199  title1.append(fedMap_->getSliceFromFed(FED));
200  string name1 = "URecHitsFED";
201  name1.append(intToString(FED));
202  int numBins = (int)round(histRangeMax_-histRangeMin_)+1;
203  TH1F* hist = new TH1F(name1.c_str(),title1.c_str(), numBins, histRangeMin_, histRangeMax_);
204  FEDsAndHists_[FED] = hist;
205  FEDsAndHists_[FED]->SetDirectory(0);
206 
207  title1 = "Jitter for ";
208  title1.append(fedMap_->getSliceFromFed(FED));
209  name1 = "JitterFED";
210  name1.append(intToString(FED));
211  TH1F* timingHist = new TH1F(name1.c_str(),title1.c_str(),14,-7,7);
212  FEDsAndTimingHists_[FED] = timingHist;
213  FEDsAndTimingHists_[FED]->SetDirectory(0);
214 }
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
std::map< int, TH1F * > FEDsAndHists_
std::map< int, TH1F * > FEDsAndTimingHists_
EcalFedMap * fedMap_
std::string intToString(int num)
std::string EcalURecHitHists::intToString ( int  num)
private

Definition at line 274 of file EcalURecHitHists.cc.

Referenced by endJob(), and initHists().

275 {
276  using namespace std;
277  ostringstream myStream;
278  myStream << num << flush;
279  return(myStream.str()); //returns the string form of the stringstream object
280 }

Member Data Documentation

TH1F* EcalURecHitHists::allFedsHist_
private

Definition at line 82 of file EcalURecHitHists.h.

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

TH1F* EcalURecHitHists::allFedsTimingHist_
private

Definition at line 83 of file EcalURecHitHists.h.

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

edm::InputTag EcalURecHitHists::EBUncalibratedRecHitCollection_
private

Definition at line 70 of file EcalURecHitHists.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalURecHitHists::ecalElectronicsMap_
private

Definition at line 87 of file EcalURecHitHists.h.

Referenced by analyze(), and beginRun().

edm::InputTag EcalURecHitHists::EEUncalibratedRecHitCollection_
private

Definition at line 71 of file EcalURecHitHists.h.

Referenced by analyze().

EcalFedMap* EcalURecHitHists::fedMap_
private

Definition at line 86 of file EcalURecHitHists.h.

Referenced by EcalURecHitHists(), endJob(), and initHists().

std::map<int,TH1F*> EcalURecHitHists::FEDsAndHists_
private

Definition at line 79 of file EcalURecHitHists.h.

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

std::map<int,TH1F*> EcalURecHitHists::FEDsAndTimingHists_
private

Definition at line 80 of file EcalURecHitHists.h.

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

TFile* EcalURecHitHists::file
private

Definition at line 85 of file EcalURecHitHists.h.

Referenced by ztee.GZipLog::finish().

std::string EcalURecHitHists::fileName_
private

Definition at line 74 of file EcalURecHitHists.h.

Referenced by endJob().

double EcalURecHitHists::histRangeMax_
private

Definition at line 73 of file EcalURecHitHists.h.

Referenced by EcalURecHitHists(), and initHists().

double EcalURecHitHists::histRangeMin_
private

Definition at line 73 of file EcalURecHitHists.h.

Referenced by EcalURecHitHists(), and initHists().

std::vector<int> EcalURecHitHists::maskedChannels_
private

Definition at line 76 of file EcalURecHitHists.h.

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

std::vector<std::string> EcalURecHitHists::maskedEBs_
private

Definition at line 78 of file EcalURecHitHists.h.

Referenced by EcalURecHitHists().

std::vector<int> EcalURecHitHists::maskedFEDs_
private

Definition at line 77 of file EcalURecHitHists.h.

Referenced by analyze(), and EcalURecHitHists().

int EcalURecHitHists::runNum_
private

Definition at line 72 of file EcalURecHitHists.h.

Referenced by analyze(), and endJob().