CMS 3D CMS Logo

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

#include <EcalMipGraphs.h>

Inheritance diagram for EcalMipGraphs:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EcalMipGraphs (const edm::ParameterSet &)
 
 ~EcalMipGraphs () 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)
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
std::string floatToString (float num)
 
int getEEIndex (EcalElectronicsId elecId)
 
void initHists (int)
 
std::string intToString (int num)
 
TGraph * selectDigi (DetId det, int ievt)
 
void selectHits (edm::Handle< EcalRecHitCollection > hits, int ievt, edm::ESHandle< CaloTopology > caloTopo)
 
void writeGraphs ()
 

Private Attributes

int abscissa [10]
 
TH1F * allFedsTimingHist_
 
TTree * canvasNames_
 
std::map< int, float > crysAndAmplitudesMap_
 
edm::InputTag EBDigis_
 
edm::Handle< EBDigiCollectionEBdigisHandle
 
edm::InputTag EBRecHitCollection_
 
const EcalElectronicsMappingecalElectronicsMap_
 
edm::InputTag EEDigis_
 
edm::Handle< EEDigiCollectionEEdigisHandle
 
edm::InputTag EERecHitCollection_
 
EcalFedMapfedMap_
 
std::map< int, EcalDCCHeaderBlockFEDsAndDCCHeaders_
 
std::map< int, TH1F * > FEDsAndTimingHists_
 
TFile * file_
 
edm::InputTag headerProducer_
 
std::set< EBDetIdlistEBChannels
 
std::set< EEDetIdlistEEChannels
 
std::vector< int > maskedChannels_
 
std::vector< std::string > maskedEBs_
 
std::vector< int > maskedFEDs_
 
double minTimingAmp_
 
int naiveEvtNum_
 
std::vector< std::string > * names
 
int ordinate [10]
 
int runNum_
 
std::vector< int > seedCrys_
 
std::map< std::string, int > seedFrequencyMap_
 
int side_
 
double threshold_
 

Static Private Attributes

static edm::Service< TFileServicefileService
 
static float gainRatio [3] = {1., 2., 12.}
 

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

Detailed Description

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

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

Definition at line 59 of file EcalMipGraphs.h.

Constructor & Destructor Documentation

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

Definition at line 42 of file EcalMipGraphs.cc.

References abscissa, allFedsTimingHist_, fedMap_, fileService, edm::ParameterSet::getUntrackedParameter(), mps_fire::i, TFileService::make(), maskedChannels_, maskedEBs_, maskedFEDs_, naiveEvtNum_, and seedCrys_.

43  : EBRecHitCollection_(iConfig.getParameter<edm::InputTag>("EcalRecHitCollectionEB")),
44  EERecHitCollection_(iConfig.getParameter<edm::InputTag>("EcalRecHitCollectionEE")),
45  EBDigis_(iConfig.getParameter<edm::InputTag>("EBDigiCollection")),
46  EEDigis_(iConfig.getParameter<edm::InputTag>("EEDigiCollection")),
47  headerProducer_(iConfig.getParameter<edm::InputTag>("headerProducer")),
48  runNum_(-1),
49  side_(iConfig.getUntrackedParameter<int>("side", 3)),
50  threshold_(iConfig.getUntrackedParameter<double>("amplitudeThreshold", 12.0)),
51  minTimingAmp_(iConfig.getUntrackedParameter<double>("minimumTimingAmplitude", 0.100)) {
52  vector<int> listDefaults;
53  listDefaults.push_back(-1);
54 
55  maskedChannels_ = iConfig.getUntrackedParameter<vector<int> >("maskedChannels", listDefaults);
56  maskedFEDs_ = iConfig.getUntrackedParameter<vector<int> >("maskedFEDs", listDefaults);
57  seedCrys_ = iConfig.getUntrackedParameter<vector<int> >("seedCrys", vector<int>());
58 
59  vector<string> defaultMaskedEBs;
60  defaultMaskedEBs.push_back("none");
61  maskedEBs_ = iConfig.getUntrackedParameter<vector<string> >("maskedEBs", defaultMaskedEBs);
62 
63  fedMap_ = new EcalFedMap();
64 
65  string title1 = "Jitter for all FEDs";
66  string name1 = "JitterAllFEDs";
67  allFedsTimingHist_ = fileService->make<TH1F>(name1.c_str(), title1.c_str(), 150, -7, 7);
68 
69  // load up the maskedFED list with the proper FEDids
70  if (maskedFEDs_[0] == -1) {
71  //if "actual" EB id given, then convert to FEDid and put in listFEDs_
72  if (maskedEBs_[0] != "none") {
73  maskedFEDs_.clear();
74  for (vector<string>::const_iterator ebItr = maskedEBs_.begin(); ebItr != maskedEBs_.end(); ++ebItr) {
75  maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
76  }
77  }
78  }
79 
80  for (int i = 0; i < 10; i++)
81  abscissa[i] = i;
82 
83  naiveEvtNum_ = 0;
84 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > maskedFEDs_
edm::InputTag headerProducer_
Definition: EcalMipGraphs.h:82
EcalFedMap * fedMap_
edm::InputTag EERecHitCollection_
Definition: EcalMipGraphs.h:79
std::vector< std::string > maskedEBs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static edm::Service< TFileService > fileService
Definition: EcalMipGraphs.h:99
int abscissa[10]
Definition: EcalMipGraphs.h:95
edm::InputTag EEDigis_
Definition: EcalMipGraphs.h:81
double threshold_
Definition: EcalMipGraphs.h:89
edm::InputTag EBRecHitCollection_
Definition: EcalMipGraphs.h:78
std::vector< int > seedCrys_
std::vector< int > maskedChannels_
double minTimingAmp_
Definition: EcalMipGraphs.h:90
TH1F * allFedsTimingHist_
edm::InputTag EBDigis_
Definition: EcalMipGraphs.h:80
EcalMipGraphs::~EcalMipGraphs ( )
override

Definition at line 86 of file EcalMipGraphs.cc.

86 {}

Member Function Documentation

void EcalMipGraphs::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 93 of file EcalMipGraphs.cc.

References edm::SortedCollection< T, SORT >::begin(), canvasNames_, EBDigis_, EBdigisHandle, EBRecHitCollection_, EEDigis_, EEdigisHandle, EERecHitCollection_, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), FEDsAndDCCHeaders_, fileService, edm::EventSetup::get(), edm::Event::getByLabel(), headerProducer_, edm::EventBase::id(), listEBChannels, listEEChannels, TFileService::make(), naiveEvtNum_, names, edm::EventID::run(), runNum_, and selectHits().

93  {
94  // get the headers
95  // (one header for each supermodule)
97  iEvent.getByLabel(headerProducer_, DCCHeaders);
98 
99  for (EcalRawDataCollection::const_iterator headerItr = DCCHeaders->begin(); headerItr != DCCHeaders->end();
100  ++headerItr) {
101  FEDsAndDCCHeaders_[headerItr->id() + 600] = *headerItr;
102  }
103 
104  int ievt = iEvent.id().event();
105  naiveEvtNum_++;
106 
107  if (runNum_ == -1) {
108  runNum_ = iEvent.id().run();
109  canvasNames_ = fileService->make<TTree>("canvasNames", "Names of written canvases");
110  names = new std::vector<string>();
111  canvasNames_->Branch("names", "vector<string>", &names);
112  }
113 
114  //We only want the 3x3's for this event...
115  listEBChannels.clear();
116  listEEChannels.clear();
119  ESHandle<CaloTopology> caloTopo;
120  iSetup.get<CaloTopologyRecord>().get(caloTopo);
121  iEvent.getByLabel(EBRecHitCollection_, EBhits);
122  iEvent.getByLabel(EERecHitCollection_, EEhits);
123  // Now, retrieve the crystal digi from the event
124  iEvent.getByLabel(EBDigis_, EBdigisHandle);
125  iEvent.getByLabel(EEDigis_, EEdigisHandle);
126  //debug
127  //LogWarning("EcalMipGraphs") << "event " << ievt << " EBhits collection size " << EBhits->size();
128  //LogWarning("EcalMipGraphs") << "event " << ievt << " EEhits collection size " << EEhits->size();
129 
130  selectHits(EBhits, ievt, caloTopo);
131  selectHits(EEhits, ievt, caloTopo);
132 }
edm::InputTag headerProducer_
Definition: EcalMipGraphs.h:82
std::vector< T >::const_iterator const_iterator
edm::InputTag EERecHitCollection_
Definition: EcalMipGraphs.h:79
TTree * canvasNames_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static edm::Service< TFileService > fileService
Definition: EcalMipGraphs.h:99
edm::InputTag EEDigis_
Definition: EcalMipGraphs.h:81
std::set< EEDetId > listEEChannels
Definition: EcalMipGraphs.h:93
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
std::set< EBDetId > listEBChannels
Definition: EcalMipGraphs.h:92
int iEvent
Definition: GenABIO.cc:224
void selectHits(edm::Handle< EcalRecHitCollection > hits, int ievt, edm::ESHandle< CaloTopology > caloTopo)
edm::InputTag EBRecHitCollection_
Definition: EcalMipGraphs.h:78
const_iterator end() const
edm::Handle< EEDigiCollection > EEdigisHandle
Definition: EcalMipGraphs.h:85
std::vector< std::string > * names
edm::Handle< EBDigiCollection > EBdigisHandle
Definition: EcalMipGraphs.h:84
const_iterator begin() const
edm::InputTag EBDigis_
Definition: EcalMipGraphs.h:80
void EcalMipGraphs::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 330 of file EcalMipGraphs.cc.

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

330  {
332  c.get<EcalMappingRcd>().get(handle);
333  ecalElectronicsMap_ = handle.product();
334 }
const EcalElectronicsMapping * ecalElectronicsMap_
T const * product() const
Definition: ESHandle.h:86
void EcalMipGraphs::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 337 of file EcalMipGraphs.cc.

References canvasNames_, intToString(), maskedChannels_, maskedFEDs_, seedFrequencyMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by o2olib.O2ORunMgr::executeJob().

337  {
338  canvasNames_->Fill();
339 
340  string frequencies = "";
341  for (std::map<std::string, int>::const_iterator itr = seedFrequencyMap_.begin(); itr != seedFrequencyMap_.end();
342  ++itr) {
343  if (itr->second > 1) {
344  frequencies += itr->first;
345  frequencies += " Frequency: ";
346  frequencies += intToString(itr->second);
347  frequencies += "\n";
348  }
349  }
350  LogWarning("EcalMipGraphs") << "Found seeds with frequency > 1: "
351  << "\n\n"
352  << frequencies;
353 
354  std::string channels;
355  for (std::vector<int>::const_iterator itr = maskedChannels_.begin(); itr != maskedChannels_.end(); ++itr) {
356  channels += intToString(*itr);
357  channels += ",";
358  }
359 
360  std::string feds;
361  for (std::vector<int>::const_iterator itr = maskedFEDs_.begin(); itr != maskedFEDs_.end(); ++itr) {
362  feds += intToString(*itr);
363  feds += ",";
364  }
365 
366  LogWarning("EcalMipGraphs") << "Masked channels are: " << channels;
367  LogWarning("EcalMipGraphs") << "Masked FEDs are: " << feds << " and that is all!";
368 }
std::vector< int > maskedFEDs_
std::string intToString(int num)
TTree * canvasNames_
std::map< std::string, int > seedFrequencyMap_
std::vector< int > maskedChannels_
std::string EcalMipGraphs::floatToString ( float  num)
private

Definition at line 377 of file EcalMipGraphs.cc.

Referenced by selectDigi().

377  {
378  using namespace std;
379  ostringstream myStream;
380  myStream << num << flush;
381  return (myStream.str()); //returns the string form of the stringstream object
382 }
int EcalMipGraphs::getEEIndex ( EcalElectronicsId  elecId)
private

Definition at line 312 of file EcalMipGraphs.cc.

References EcalElectronicsId::dccId(), EcalElectronicsId::stripId(), EcalElectronicsId::towerId(), and EcalElectronicsId::xtalId().

Referenced by selectDigi(), and selectHits().

312  {
313  int FEDid = 600 + elecId.dccId();
314  return 10000 * FEDid + 100 * elecId.towerId() + 5 * (elecId.stripId() - 1) + elecId.xtalId();
315 }
int xtalId() const
get the channel id
int stripId() const
get the tower id
int towerId() const
get the tower id
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void EcalMipGraphs::initHists ( int  FED)
private

Definition at line 318 of file EcalMipGraphs.cc.

References fedMap_, FEDsAndTimingHists_, fileService, EcalFedMap::getSliceFromFed(), intToString(), and TFileService::make().

Referenced by selectHits().

318  {
319  using namespace std;
320 
321  string title1 = "Jitter for ";
322  title1.append(fedMap_->getSliceFromFed(FED));
323  string name1 = "JitterFED";
324  name1.append(intToString(FED));
325  TH1F* timingHist = fileService->make<TH1F>(name1.c_str(), title1.c_str(), 150, -7, 7);
326  FEDsAndTimingHists_[FED] = timingHist;
327 }
EcalFedMap * fedMap_
std::string intToString(int num)
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static edm::Service< TFileService > fileService
Definition: EcalMipGraphs.h:99
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:86
std::map< int, TH1F * > FEDsAndTimingHists_
std::string EcalMipGraphs::intToString ( int  num)
private

Definition at line 370 of file EcalMipGraphs.cc.

Referenced by endJob(), initHists(), selectDigi(), and selectHits().

370  {
371  using namespace std;
372  ostringstream myStream;
373  myStream << num << flush;
374  return (myStream.str()); //returns the string form of the stringstream object
375 }
TGraph * EcalMipGraphs::selectDigi ( DetId  det,
int  ievt 
)
private

Definition at line 134 of file EcalMipGraphs.cc.

References abscissa, EcalMGPASample::adc(), edm::DataFrameContainer::begin(), crysAndAmplitudesMap_, EcalElectronicsId::dccId(), DetId::det(), EBdigisHandle, DetId::Ecal, ecalElectronicsMap_, EEdigisHandle, edm::DataFrameContainer::end(), randomXiThetaGunProducer_cfi::energy, fedMap_, FEDsAndDCCHeaders_, fileService, objects.autophobj::float, floatToString(), ecalMGPA::gainId(), EcalMGPASample::gainId(), gainRatio, getEEIndex(), EcalElectronicsMapping::getElectronicsId(), EcalFedMap::getSliceFromFed(), mps_fire::i, intToString(), GeomDetEnumerators::isBarrel(), TFileService::make(), naiveEvtNum_, dataset::name, ordinate, muonCSCDigis_cfi::pedestal, EcalDataFrame::sample(), EcalDataFrame::size(), and fftjetcommon_cfi::title.

Referenced by selectHits().

134  {
135  int emptyY[10];
136  for (int i = 0; i < 10; i++)
137  emptyY[i] = 0;
138  TGraph* emptyGraph = fileService->make<TGraph>(10, abscissa, emptyY);
139  emptyGraph->SetTitle("NOT ECAL");
140 
141  //If the DetId is not from Ecal, return
142  if (thisDet.det() != DetId::Ecal)
143  return emptyGraph;
144 
145  emptyGraph->SetTitle("NO DIGIS");
146  //find digi we need -- can't get find() to work; need DataFrame(DetId det) to work?
148  int FEDid = 600 + elecId.dccId();
149  bool isBarrel = true;
150  if (FEDid < 610 || FEDid > 645)
151  isBarrel = false;
152  int cryIndex = isBarrel ? ((EBDetId)thisDet).hashedIndex() : getEEIndex(elecId);
153  int ic = isBarrel ? ((EBDetId)thisDet).ic() : cryIndex;
154 
155  string sliceName = fedMap_->getSliceFromFed(FEDid);
156  EcalDataFrame df;
157  if (isBarrel) {
159  while (digiItr != EBdigisHandle->end() && ((*digiItr).id() != (EBDetId)thisDet)) {
160  ++digiItr;
161  }
162  if (digiItr == EBdigisHandle->end()) {
163  //LogWarning("EcalMipGraphs") << "Cannot find digi for ic:" << ic
164  // << " FED:" << FEDid << " evt:" << naiveEvtNum_;
165  return emptyGraph;
166  } else
167  df = *digiItr;
168  } else {
170  while (digiItr != EEdigisHandle->end() && ((*digiItr).id() != (EEDetId)thisDet)) {
171  ++digiItr;
172  }
173  if (digiItr == EEdigisHandle->end()) {
174  //LogWarning("EcalMipGraphs") << "Cannot find digi for ic:" << ic
175  // << " FED:" << FEDid << " evt:" << naiveEvtNum_;
176  return emptyGraph;
177  } else
178  df = *digiItr;
179  }
180 
181  int gainId = FEDsAndDCCHeaders_[FEDid].getMgpaGain();
182  int gainHuman;
183  if (gainId == 1)
184  gainHuman = 12;
185  else if (gainId == 2)
186  gainHuman = 6;
187  else if (gainId == 3)
188  gainHuman = 1;
189  else
190  gainHuman = -1;
191 
192  double pedestal = 200;
193 
194  emptyGraph->SetTitle("FIRST TWO SAMPLES NOT GAIN12");
195  if (df.sample(0).gainId() != 1 || df.sample(1).gainId() != 1)
196  return emptyGraph; //goes to the next digi
197  else {
198  ordinate[0] = df.sample(0).adc();
199  ordinate[1] = df.sample(1).adc();
200  pedestal = (double)(ordinate[0] + ordinate[1]) / (double)2;
201  }
202 
203  for (int i = 0; i < df.size(); ++i) {
204  if (df.sample(i).gainId() != 0)
205  ordinate[i] = (int)(pedestal + (df.sample(i).adc() - pedestal) * gainRatio[df.sample(i).gainId() - 1]);
206  else
207  ordinate[i] = 49152; //Saturation of gain1
208  }
209 
210  TGraph* oneGraph = fileService->make<TGraph>(10, abscissa, ordinate);
211  string name = "Graph_ev" + intToString(naiveEvtNum_) + "_ic" + intToString(ic) + "_FED" + intToString(FEDid);
212  string gainString = (gainId == 1) ? "Free" : intToString(gainHuman);
213  string title = "Event" + intToString(naiveEvtNum_) + "_lv1a" + intToString(ievt) + "_ic" + intToString(ic) + "_" +
214  sliceName + "_gain" + gainString;
215 
216  float energy = 0;
217  map<int, float>::const_iterator itr;
218  itr = crysAndAmplitudesMap_.find(cryIndex);
219  if (itr != crysAndAmplitudesMap_.end()) {
220  //edm::LogWarning("EcalMipGraphs")<< "itr->second(ampli)="<< itr->second;
221  energy = (float)itr->second;
222  }
223  //else
224  //edm::LogWarning("EcalMipGraphs") << "cry " << ic << "not found in ampMap";
225 
226  title += "_Energy" + floatToString(round(energy * 1000));
227 
228  oneGraph->SetTitle(title.c_str());
229  oneGraph->SetName(name.c_str());
230  oneGraph->GetXaxis()->SetTitle("sample");
231  oneGraph->GetYaxis()->SetTitle("ADC");
232  return oneGraph;
233 }
std::string floatToString(float num)
int getEEIndex(EcalElectronicsId elecId)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalFedMap * fedMap_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
bool isBarrel(GeomDetEnumerators::SubDetector m)
std::string intToString(int num)
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:29
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
const_iterator begin() const
const EcalElectronicsMapping * ecalElectronicsMap_
static edm::Service< TFileService > fileService
Definition: EcalMipGraphs.h:99
int abscissa[10]
Definition: EcalMipGraphs.h:95
int gainId() const
get the gainId (2 bits)
int size() const
Definition: EcalDataFrame.h:26
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:86
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
std::map< int, float > crysAndAmplitudesMap_
int ordinate[10]
Definition: EcalMipGraphs.h:96
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
edm::Handle< EEDigiCollection > EEdigisHandle
Definition: EcalMipGraphs.h:85
const_iterator end() const
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
static float gainRatio[3]
Definition: EcalMipGraphs.h:98
edm::Handle< EBDigiCollection > EBdigisHandle
Definition: EcalMipGraphs.h:84
int adc() const
get the ADC sample (12 bits)
void EcalMipGraphs::selectHits ( edm::Handle< EcalRecHitCollection hits,
int  ievt,
edm::ESHandle< CaloTopology caloTopo 
)
private

Definition at line 235 of file EcalMipGraphs.cc.

References allFedsTimingHist_, edm::SortedCollection< T, SORT >::begin(), crysAndAmplitudesMap_, EcalElectronicsId::dccId(), ecalElectronicsMap_, edm::SortedCollection< T, SORT >::end(), EcalRecHit::energy(), FEDsAndTimingHists_, spr::find(), getEEIndex(), EcalElectronicsMapping::getElectronicsId(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T, TOPO >::home(), mps_fire::i, EcalRecHit::id(), initHists(), intToString(), GeomDetEnumerators::isBarrel(), maskedChannels_, maskedFEDs_, minTimingAmp_, naiveEvtNum_, dataset::name, names, CaloNavigator< T, TOPO >::offsetBy(), mps_fire::result, SurveyInfoScenario_cff::seed, seedCrys_, seedFrequencyMap_, selectDigi(), side_, threshold_, EcalRecHit::time(), and fftjetcommon_cfi::title.

Referenced by analyze().

235  {
236  for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr) {
237  EcalRecHit hit = (*hitItr);
238  DetId det = hit.id();
240  int FEDid = 600 + elecId.dccId();
241  bool isBarrel = true;
242  if (FEDid < 610 || FEDid > 645)
243  isBarrel = false;
244  int cryIndex = isBarrel ? ((EBDetId)det).hashedIndex() : ((EEDetId)det).hashedIndex();
245  int ic = isBarrel ? ((EBDetId)det).ic() : getEEIndex(elecId);
246 
247  float ampli = hit.energy();
248 
249  vector<int>::iterator result;
250  result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid);
251  if (result != maskedFEDs_.end()) {
252  //LogWarning("EcalMipGraphs") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli;
253  continue;
254  }
255  result = find(maskedChannels_.begin(), maskedChannels_.end(), cryIndex);
256  if (result != maskedChannels_.end()) {
257  //LogWarning("EcalMipGraphs") << "skipping uncalRecHit for channel: " << cryIndex << " in fed: " << FEDid << " with amplitude " << ampli ;
258  continue;
259  }
260  bool cryIsInList = false;
261  result = find(seedCrys_.begin(), seedCrys_.end(), cryIndex);
262  if (result != seedCrys_.end())
263  cryIsInList = true;
264 
265  // Either we must have a user-requested cry (in which case there is no amplitude selection)
266  // Or we pick all crys that pass the amplitude cut (in which case there is no fixed crystal selection)
267  if (cryIsInList || (seedCrys_.empty() && ampli > threshold_)) {
268  // We have a winner!
269  crysAndAmplitudesMap_[cryIndex] = ampli;
270  string name = "Event" + intToString(naiveEvtNum_) + "_ic" + intToString(ic) + "_FED" + intToString(FEDid);
271  string title = "Digis";
272  string seed = "ic" + intToString(ic) + "_FED" + intToString(FEDid);
273  int freq = 1;
274  pair<map<string, int>::iterator, bool> pair = seedFrequencyMap_.insert(make_pair(seed, freq));
275  if (!pair.second) {
276  ++(pair.first->second);
277  }
278 
279  TCanvas can(name.c_str(), title.c_str(), 200, 50, 900, 900);
280  can.Divide(side_, side_);
281  TGraph* myGraph;
282  int canvasNum = 1;
283 
285  //Now put each graph in one by one
286  for (int j = side_ / 2; j >= -side_ / 2; --j) {
287  for (int i = -side_ / 2; i <= side_ / 2; ++i) {
288  cursor.home();
289  cursor.offsetBy(i, j);
290  can.cd(canvasNum);
291  myGraph = selectDigi(*cursor, ievt);
292  myGraph->Draw("A*");
293  canvasNum++;
294  }
295  }
296  can.Write();
297  names->push_back(name);
298  }
299 
300  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
301  if (timingHist == nullptr) {
302  initHists(FEDid);
303  timingHist = FEDsAndTimingHists_[FEDid];
304  }
305  if (ampli > minTimingAmp_) {
306  timingHist->Fill(hit.time());
307  allFedsTimingHist_->Fill(hit.time());
308  }
309  }
310 }
std::vector< int > maskedFEDs_
int getEEIndex(EcalElectronicsId elecId)
void initHists(int)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
bool isBarrel(GeomDetEnumerators::SubDetector m)
std::vector< EcalRecHit >::const_iterator const_iterator
std::string intToString(int num)
float time() const
Definition: EcalRecHit.h:70
const EcalElectronicsMapping * ecalElectronicsMap_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::map< std::string, int > seedFrequencyMap_
double threshold_
Definition: EcalMipGraphs.h:89
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
Definition: CaloNavigator.h:80
std::map< int, float > crysAndAmplitudesMap_
float energy() const
Definition: EcalRecHit.h:68
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
TGraph * selectDigi(DetId det, int ievt)
const_iterator end() const
void home() const
move the navigator back to the starting point
Definition: DetId.h:18
std::vector< int > seedCrys_
std::vector< int > maskedChannels_
DetId id() const
get the id
Definition: EcalRecHit.h:77
std::vector< std::string > * names
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:20
double minTimingAmp_
Definition: EcalMipGraphs.h:90
std::map< int, TH1F * > FEDsAndTimingHists_
TH1F * allFedsTimingHist_
const_iterator begin() const
void EcalMipGraphs::writeGraphs ( )
private

Member Data Documentation

int EcalMipGraphs::abscissa[10]
private

Definition at line 95 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectDigi().

TH1F* EcalMipGraphs::allFedsTimingHist_
private

Definition at line 111 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

TTree* EcalMipGraphs::canvasNames_
private

Definition at line 114 of file EcalMipGraphs.h.

Referenced by analyze(), and endJob().

std::map<int, float> EcalMipGraphs::crysAndAmplitudesMap_
private

Definition at line 107 of file EcalMipGraphs.h.

Referenced by selectDigi(), and selectHits().

edm::InputTag EcalMipGraphs::EBDigis_
private

Definition at line 80 of file EcalMipGraphs.h.

Referenced by analyze().

edm::Handle<EBDigiCollection> EcalMipGraphs::EBdigisHandle
private

Definition at line 84 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EBRecHitCollection_
private

Definition at line 78 of file EcalMipGraphs.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalMipGraphs::ecalElectronicsMap_
private

Definition at line 116 of file EcalMipGraphs.h.

Referenced by beginRun(), selectDigi(), and selectHits().

edm::InputTag EcalMipGraphs::EEDigis_
private

Definition at line 81 of file EcalMipGraphs.h.

Referenced by analyze().

edm::Handle<EEDigiCollection> EcalMipGraphs::EEdigisHandle
private

Definition at line 85 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EERecHitCollection_
private

Definition at line 79 of file EcalMipGraphs.h.

Referenced by analyze().

EcalFedMap* EcalMipGraphs::fedMap_
private

Definition at line 115 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), initHists(), and selectDigi().

std::map<int, EcalDCCHeaderBlock> EcalMipGraphs::FEDsAndDCCHeaders_
private

Definition at line 108 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

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

Definition at line 106 of file EcalMipGraphs.h.

Referenced by initHists(), and selectHits().

TFile* EcalMipGraphs::file_
private

Definition at line 113 of file EcalMipGraphs.h.

edm::Service< TFileService > EcalMipGraphs::fileService
staticprivate

Definition at line 99 of file EcalMipGraphs.h.

Referenced by analyze(), EcalMipGraphs(), initHists(), and selectDigi().

float EcalMipGraphs::gainRatio = {1., 2., 12.}
staticprivate

Definition at line 98 of file EcalMipGraphs.h.

Referenced by selectDigi().

edm::InputTag EcalMipGraphs::headerProducer_
private

Definition at line 82 of file EcalMipGraphs.h.

Referenced by analyze().

std::set<EBDetId> EcalMipGraphs::listEBChannels
private

Definition at line 92 of file EcalMipGraphs.h.

Referenced by analyze().

std::set<EEDetId> EcalMipGraphs::listEEChannels
private

Definition at line 93 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 102 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), endJob(), and selectHits().

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

Definition at line 105 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs().

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

Definition at line 103 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), endJob(), and selectHits().

double EcalMipGraphs::minTimingAmp_
private

Definition at line 90 of file EcalMipGraphs.h.

Referenced by selectHits().

int EcalMipGraphs::naiveEvtNum_
private

Definition at line 118 of file EcalMipGraphs.h.

Referenced by analyze(), EcalMipGraphs(), selectDigi(), and selectHits().

std::vector<std::string>* EcalMipGraphs::names
private

Definition at line 101 of file EcalMipGraphs.h.

Referenced by analyze(), and selectHits().

int EcalMipGraphs::ordinate[10]
private

Definition at line 96 of file EcalMipGraphs.h.

Referenced by selectDigi().

int EcalMipGraphs::runNum_
private

Definition at line 87 of file EcalMipGraphs.h.

Referenced by analyze().

std::vector<int> EcalMipGraphs::seedCrys_
private

Definition at line 104 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

std::map<std::string, int> EcalMipGraphs::seedFrequencyMap_
private

Definition at line 109 of file EcalMipGraphs.h.

Referenced by endJob(), and selectHits().

int EcalMipGraphs::side_
private

Definition at line 88 of file EcalMipGraphs.h.

Referenced by selectHits().

double EcalMipGraphs::threshold_
private

Definition at line 89 of file EcalMipGraphs.h.

Referenced by selectHits().