test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- 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 ()
 
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 &)
 
- 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 61 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(), i, TFileService::make(), maskedChannels_, maskedEBs_, maskedFEDs_, naiveEvtNum_, and seedCrys_.

42  :
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 {
53  vector<int> listDefaults;
54  listDefaults.push_back(-1);
55 
56  maskedChannels_ = iConfig.getUntrackedParameter<vector<int> >("maskedChannels", listDefaults);
57  maskedFEDs_ = iConfig.getUntrackedParameter<vector<int> >("maskedFEDs", listDefaults);
58  seedCrys_ = iConfig.getUntrackedParameter<vector<int> >("seedCrys",vector<int>());
59 
60  vector<string> defaultMaskedEBs;
61  defaultMaskedEBs.push_back("none");
62  maskedEBs_ = iConfig.getUntrackedParameter<vector<string> >("maskedEBs",defaultMaskedEBs);
63 
64  fedMap_ = new EcalFedMap();
65 
66  string title1 = "Jitter for all FEDs";
67  string name1 = "JitterAllFEDs";
68  allFedsTimingHist_ = fileService->make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
69 
70  // load up the maskedFED list with the proper FEDids
71  if(maskedFEDs_[0]==-1)
72  {
73  //if "actual" EB id given, then convert to FEDid and put in listFEDs_
74  if(maskedEBs_[0] != "none")
75  {
76  maskedFEDs_.clear();
77  for(vector<string>::const_iterator ebItr = maskedEBs_.begin(); ebItr != maskedEBs_.end(); ++ebItr)
78  {
79  maskedFEDs_.push_back(fedMap_->getFedFromSlice(*ebItr));
80  }
81  }
82  }
83 
84  for (int i=0; i<10; i++)
85  abscissa[i] = i;
86 
87  naiveEvtNum_ = 0;
88 
89 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< int > maskedFEDs_
edm::InputTag headerProducer_
Definition: EcalMipGraphs.h:86
EcalFedMap * fedMap_
edm::InputTag EERecHitCollection_
Definition: EcalMipGraphs.h:83
std::vector< std::string > maskedEBs_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static edm::Service< TFileService > fileService
int abscissa[10]
Definition: EcalMipGraphs.h:99
edm::InputTag EEDigis_
Definition: EcalMipGraphs.h:85
double threshold_
Definition: EcalMipGraphs.h:93
edm::InputTag EBRecHitCollection_
Definition: EcalMipGraphs.h:82
std::vector< int > seedCrys_
std::vector< int > maskedChannels_
double minTimingAmp_
Definition: EcalMipGraphs.h:94
TH1F * allFedsTimingHist_
edm::InputTag EBDigis_
Definition: EcalMipGraphs.h:84
EcalMipGraphs::~EcalMipGraphs ( )

Definition at line 92 of file EcalMipGraphs.cc.

93 {
94 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 103 of file EcalMipGraphs.cc.

References canvasNames_, EBDigis_, EBdigisHandle, EBRecHitCollection_, EEDigis_, EEdigisHandle, EERecHitCollection_, 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().

104 {
105 
106  // get the headers
107  // (one header for each supermodule)
109  iEvent.getByLabel(headerProducer_, DCCHeaders);
110 
111  for (EcalRawDataCollection::const_iterator headerItr= DCCHeaders->begin();
112  headerItr != DCCHeaders->end ();
113  ++headerItr)
114  {
115  FEDsAndDCCHeaders_[headerItr->id()+600] = *headerItr;
116  }
117 
118  int ievt = iEvent.id().event();
119  naiveEvtNum_++;
120 
121  if(runNum_==-1)
122  {
123  runNum_ = iEvent.id().run();
124  canvasNames_ = fileService->make<TTree>("canvasNames","Names of written canvases");
125  names = new std::vector<string>();
126  canvasNames_->Branch("names","vector<string>",&names);
127  }
128 
129  //We only want the 3x3's for this event...
130  listEBChannels.clear();
131  listEEChannels.clear();
134  ESHandle<CaloTopology> caloTopo;
135  iSetup.get<CaloTopologyRecord>().get(caloTopo);
136  iEvent.getByLabel(EBRecHitCollection_, EBhits);
137  iEvent.getByLabel(EERecHitCollection_, EEhits);
138  // Now, retrieve the crystal digi from the event
139  iEvent.getByLabel(EBDigis_, EBdigisHandle);
140  iEvent.getByLabel(EEDigis_, EEdigisHandle);
141  //debug
142  //LogWarning("EcalMipGraphs") << "event " << ievt << " EBhits collection size " << EBhits->size();
143  //LogWarning("EcalMipGraphs") << "event " << ievt << " EEhits collection size " << EEhits->size();
144 
145  selectHits(EBhits, ievt, caloTopo);
146  selectHits(EEhits, ievt, caloTopo);
147 
148 }
edm::InputTag headerProducer_
Definition: EcalMipGraphs.h:86
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
edm::InputTag EERecHitCollection_
Definition: EcalMipGraphs.h:83
TTree * canvasNames_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
static edm::Service< TFileService > fileService
edm::InputTag EEDigis_
Definition: EcalMipGraphs.h:85
std::set< EEDetId > listEEChannels
Definition: EcalMipGraphs.h:97
std::set< EBDetId > listEBChannels
Definition: EcalMipGraphs.h:96
int iEvent
Definition: GenABIO.cc:230
void selectHits(edm::Handle< EcalRecHitCollection > hits, int ievt, edm::ESHandle< CaloTopology > caloTopo)
edm::InputTag EBRecHitCollection_
Definition: EcalMipGraphs.h:82
edm::Handle< EEDigiCollection > EEdigisHandle
Definition: EcalMipGraphs.h:89
std::vector< std::string > * names
edm::Handle< EBDigiCollection > EBdigisHandle
Definition: EcalMipGraphs.h:88
edm::InputTag EBDigis_
Definition: EcalMipGraphs.h:84
void EcalMipGraphs::beginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 369 of file EcalMipGraphs.cc.

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

370 {
372  c.get< EcalMappingRcd >().get(handle);
373  ecalElectronicsMap_ = handle.product();
374 }
const EcalElectronicsMapping * ecalElectronicsMap_
tuple handle
Definition: patZpeak.py:22
T const * product() const
Definition: ESHandle.h:86
void EcalMipGraphs::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 378 of file EcalMipGraphs.cc.

References canvasNames_, unpackBuffers-CaloStage1::feds, intToString(), maskedChannels_, maskedFEDs_, seedFrequencyMap_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by o2o.O2ORunMgr::executeJob().

379 {
380  canvasNames_->Fill();
381 
382  string frequencies = "";
383  for(std::map<std::string,int>::const_iterator itr = seedFrequencyMap_.begin();
384  itr != seedFrequencyMap_.end(); ++itr)
385  {
386  if(itr->second > 1)
387  {
388  frequencies+=itr->first;
389  frequencies+=" Frequency: ";
390  frequencies+=intToString(itr->second);
391  frequencies+="\n";
392  }
393  }
394  LogWarning("EcalMipGraphs") << "Found seeds with frequency > 1: " << "\n\n" << frequencies;
395 
396  std::string channels;
397  for(std::vector<int>::const_iterator itr = maskedChannels_.begin();
398  itr != maskedChannels_.end(); ++itr)
399  {
400  channels+=intToString(*itr);
401  channels+=",";
402  }
403 
405  for(std::vector<int>::const_iterator itr = maskedFEDs_.begin();
406  itr != maskedFEDs_.end(); ++itr)
407  {
408  feds+=intToString(*itr);
409  feds+=",";
410  }
411 
412  LogWarning("EcalMipGraphs") << "Masked channels are: " << channels;
413  LogWarning("EcalMipGraphs") << "Masked FEDs are: " << feds << " and that is all!";
414 }
std::vector< int > maskedFEDs_
std::string intToString(int num)
TTree * canvasNames_
std::vector< int > maskedChannels_
std::map< std::string, int > seedFrequencyMap_
std::string EcalMipGraphs::floatToString ( float  num)
private

Definition at line 425 of file EcalMipGraphs.cc.

Referenced by selectDigi().

426 {
427  using namespace std;
428  ostringstream myStream;
429  myStream << num << flush;
430  return(myStream.str()); //returns the string form of the stringstream object
431 }
int EcalMipGraphs::getEEIndex ( EcalElectronicsId  elecId)
private

Definition at line 348 of file EcalMipGraphs.cc.

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

Referenced by selectDigi(), and selectHits().

349 {
350  int FEDid = 600+elecId.dccId();
351  return 10000*FEDid+100*elecId.towerId()+5*(elecId.stripId()-1)+elecId.xtalId();
352 }
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 355 of file EcalMipGraphs.cc.

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

Referenced by selectHits().

356 {
357  using namespace std;
358 
359  string title1 = "Jitter for ";
360  title1.append(fedMap_->getSliceFromFed(FED));
361  string name1 = "JitterFED";
362  name1.append(intToString(FED));
363  TH1F* timingHist = fileService->make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
364  FEDsAndTimingHists_[FED] = timingHist;
365 }
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
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
std::map< int, TH1F * > FEDsAndTimingHists_
std::string EcalMipGraphs::intToString ( int  num)
private

Definition at line 417 of file EcalMipGraphs.cc.

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

418 {
419  using namespace std;
420  ostringstream myStream;
421  myStream << num << flush;
422  return(myStream.str()); //returns the string form of the stringstream object
423 }
TGraph * EcalMipGraphs::selectDigi ( DetId  det,
int  ievt 
)
private

Definition at line 151 of file EcalMipGraphs.cc.

References abscissa, EcalMGPASample::adc(), crysAndAmplitudesMap_, EcalElectronicsId::dccId(), DetId::det(), EBdigisHandle, DetId::Ecal, ecalElectronicsMap_, EEdigisHandle, relval_parameters_module::energy, fedMap_, FEDsAndDCCHeaders_, fileService, floatToString(), ecalMGPA::gainId(), EcalMGPASample::gainId(), gainRatio, getEEIndex(), EcalElectronicsMapping::getElectronicsId(), EcalFedMap::getSliceFromFed(), i, intToString(), GeomDetEnumerators::isBarrel(), TFileService::make(), naiveEvtNum_, mergeVDriftHistosByStation::name, ordinate, EcalCondDBWriter_cfi::pedestal, EcalDataFrame::sample(), EcalDataFrame::size(), and SiPixelPhase1TrackClusters_cfi::title.

Referenced by selectHits().

152 {
153  int emptyY[10];
154  for (int i=0; i<10; i++)
155  emptyY[i] = 0;
156  TGraph* emptyGraph = fileService->make<TGraph>(10, abscissa, emptyY);
157  emptyGraph->SetTitle("NOT ECAL");
158 
159  //If the DetId is not from Ecal, return
160  if(thisDet.det() != DetId::Ecal)
161  return emptyGraph;
162 
163  emptyGraph->SetTitle("NO DIGIS");
164  //find digi we need -- can't get find() to work; need DataFrame(DetId det) to work?
166  int FEDid = 600+elecId.dccId();
167  bool isBarrel = true;
168  if(FEDid < 610 || FEDid > 645)
169  isBarrel = false;
170  int cryIndex = isBarrel ? ((EBDetId)thisDet).hashedIndex() : getEEIndex(elecId);
171  int ic = isBarrel ? ((EBDetId)thisDet).ic() : cryIndex;
172 
173  string sliceName = fedMap_->getSliceFromFed(FEDid);
174  EcalDataFrame df;
175  if(isBarrel)
176  {
178  while(digiItr != EBdigisHandle->end() && ((*digiItr).id() != (EBDetId)thisDet))
179  {
180  ++digiItr;
181  }
182  if(digiItr==EBdigisHandle->end())
183  {
184  //LogWarning("EcalMipGraphs") << "Cannot find digi for ic:" << ic
185  // << " FED:" << FEDid << " evt:" << naiveEvtNum_;
186  return emptyGraph;
187  }
188  else
189  df = *digiItr;
190  }
191  else
192  {
194  while(digiItr != EEdigisHandle->end() && ((*digiItr).id() != (EEDetId)thisDet))
195  {
196  ++digiItr;
197  }
198  if(digiItr==EEdigisHandle->end())
199  {
200  //LogWarning("EcalMipGraphs") << "Cannot find digi for ic:" << ic
201  // << " FED:" << FEDid << " evt:" << naiveEvtNum_;
202  return emptyGraph;
203  }
204  else df = *digiItr;
205  }
206 
207  int gainId = FEDsAndDCCHeaders_[FEDid].getMgpaGain();
208  int gainHuman;
209  if (gainId ==1) gainHuman =12;
210  else if (gainId ==2) gainHuman =6;
211  else if (gainId ==3) gainHuman =1;
212  else gainHuman =-1;
213 
214  double pedestal = 200;
215 
216  emptyGraph->SetTitle("FIRST TWO SAMPLES NOT GAIN12");
217  if(df.sample(0).gainId()!=1 || df.sample(1).gainId()!=1) return emptyGraph; //goes to the next digi
218  else {
219  ordinate[0] = df.sample(0).adc();
220  ordinate[1] = df.sample(1).adc();
221  pedestal = (double)(ordinate[0]+ordinate[1])/(double)2;
222  }
223 
224 
225  for (int i=0; i < df.size(); ++i ) {
226  if (df.sample(i).gainId() != 0)
227  ordinate[i] = (int)(pedestal+(df.sample(i).adc()-pedestal)*gainRatio[df.sample(i).gainId()-1]);
228  else
229  ordinate[i] = 49152; //Saturation of gain1
230  }
231 
232  TGraph* oneGraph = fileService->make<TGraph>(10, abscissa, ordinate);
233  string name = "Graph_ev" + intToString(naiveEvtNum_) + "_ic" + intToString(ic)
234  + "_FED" + intToString(FEDid);
235  string gainString = (gainId==1) ? "Free" : intToString(gainHuman);
236  string title = "Event" + intToString(naiveEvtNum_) + "_lv1a" + intToString(ievt) +
237  "_ic" + intToString(ic) + "_" + sliceName + "_gain" + gainString;
238 
239  float energy = 0;
240  map<int,float>::const_iterator itr;
241  itr = crysAndAmplitudesMap_.find(cryIndex);
242  if(itr!=crysAndAmplitudesMap_.end())
243  {
244  //edm::LogWarning("EcalMipGraphs")<< "itr->second(ampli)="<< itr->second;
245  energy = (float) itr->second;
246  }
247  //else
248  //edm::LogWarning("EcalMipGraphs") << "cry " << ic << "not found in ampMap";
249 
250  title+="_Energy"+floatToString(round(energy*1000));
251 
252  oneGraph->SetTitle(title.c_str());
253  oneGraph->SetName(name.c_str());
254  oneGraph->GetXaxis()->SetTitle("sample");
255  oneGraph->GetYaxis()->SetTitle("ADC");
256  return oneGraph;
257 }
int i
Definition: DBlmapReader.cc:9
std::string floatToString(float num)
int getEEIndex(EcalElectronicsId elecId)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
int gainId(sample_type sample)
get the gainId (2 bits)
EcalFedMap * fedMap_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::map< int, EcalDCCHeaderBlock > FEDsAndDCCHeaders_
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 EcalElectronicsMapping * ecalElectronicsMap_
static edm::Service< TFileService > fileService
int abscissa[10]
Definition: EcalMipGraphs.h:99
std::map< int, float > crysAndAmplitudesMap_
int gainId() const
get the gainId (2 bits)
int size() const
Definition: EcalDataFrame.h:26
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
int ordinate[10]
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
edm::Handle< EEDigiCollection > EEdigisHandle
Definition: EcalMipGraphs.h:89
static float gainRatio[3]
edm::Handle< EBDigiCollection > EBdigisHandle
Definition: EcalMipGraphs.h:88
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 259 of file EcalMipGraphs.cc.

References allFedsTimingHist_, timingPdfMaker::can, crysAndAmplitudesMap_, EcalElectronicsId::dccId(), ecalElectronicsMap_, EcalRecHit::energy(), FEDsAndTimingHists_, spr::find(), getEEIndex(), EcalElectronicsMapping::getElectronicsId(), CaloNavigator< T, TOPO >::home(), i, EcalRecHit::id(), initHists(), intToString(), GeomDetEnumerators::isBarrel(), j, maskedChannels_, maskedFEDs_, minTimingAmp_, naiveEvtNum_, mergeVDriftHistosByStation::name, names, CaloNavigator< T, TOPO >::offsetBy(), mps_fire::result, fileCollector::seed, seedCrys_, seedFrequencyMap_, selectDigi(), side_, threshold_, EcalRecHit::time(), and SiPixelPhase1TrackClusters_cfi::title.

Referenced by analyze().

261 {
262  for (EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr)
263  {
264  EcalRecHit hit = (*hitItr);
265  DetId det = hit.id();
267  int FEDid = 600+elecId.dccId();
268  bool isBarrel = true;
269  if(FEDid < 610 || FEDid > 645)
270  isBarrel = false;
271  int cryIndex = isBarrel ? ((EBDetId)det).hashedIndex() : ((EEDetId)det).hashedIndex();
272  int ic = isBarrel ? ((EBDetId)det).ic() : getEEIndex(elecId);
273 
274  float ampli = hit.energy();
275 
276  vector<int>::iterator result;
277  result = find(maskedFEDs_.begin(), maskedFEDs_.end(), FEDid);
278  if(result != maskedFEDs_.end())
279  {
280  //LogWarning("EcalMipGraphs") << "skipping uncalRecHit for FED " << FEDid << " ; amplitude " << ampli;
281  continue;
282  }
283  result = find(maskedChannels_.begin(), maskedChannels_.end(), cryIndex);
284  if (result != maskedChannels_.end())
285  {
286  //LogWarning("EcalMipGraphs") << "skipping uncalRecHit for channel: " << cryIndex << " in fed: " << FEDid << " with amplitude " << ampli ;
287  continue;
288  }
289  bool cryIsInList = false;
290  result = find(seedCrys_.begin(), seedCrys_.end(), cryIndex);
291  if (result != seedCrys_.end())
292  cryIsInList = true;
293 
294  // Either we must have a user-requested cry (in which case there is no amplitude selection)
295  // Or we pick all crys that pass the amplitude cut (in which case there is no fixed crystal selection)
296  if(cryIsInList || (seedCrys_.empty() && ampli > threshold_))
297  {
298  // We have a winner!
299  crysAndAmplitudesMap_[cryIndex] = ampli;
300  string name = "Event" + intToString(naiveEvtNum_) + "_ic" + intToString(ic)
301  + "_FED" + intToString(FEDid);
302  string title = "Digis";
303  string seed = "ic" + intToString(ic) + "_FED" + intToString(FEDid);
304  int freq=1;
305  pair<map<string,int>::iterator,bool> pair = seedFrequencyMap_.insert(make_pair(seed,freq));
306  if(!pair.second)
307  {
308  ++(pair.first->second);
309  }
310 
311  TCanvas can(name.c_str(),title.c_str(),200,50,900,900);
312  can.Divide(side_,side_);
313  TGraph* myGraph;
314  int canvasNum = 1;
315 
316  CaloNavigator<DetId> cursor = CaloNavigator<DetId>(det,caloTopo->getSubdetectorTopology(det));
317  //Now put each graph in one by one
318  for(int j=side_/2; j>=-side_/2; --j)
319  {
320  for(int i=-side_/2; i<=side_/2; ++i)
321  {
322  cursor.home();
323  cursor.offsetBy(i,j);
324  can.cd(canvasNum);
325  myGraph = selectDigi(*cursor,ievt);
326  myGraph->Draw("A*");
327  canvasNum++;
328  }
329  }
330  can.Write();
331  names->push_back(name);
332  }
333 
334  TH1F* timingHist = FEDsAndTimingHists_[FEDid];
335  if(timingHist==0)
336  {
337  initHists(FEDid);
338  timingHist = FEDsAndTimingHists_[FEDid];
339  }
340  if(ampli > minTimingAmp_)
341  {
342  timingHist->Fill(hit.time());
343  allFedsTimingHist_->Fill(hit.time());
344  }
345  }
346 }
int i
Definition: DBlmapReader.cc:9
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_
std::map< int, float > crysAndAmplitudesMap_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
tuple result
Definition: mps_fire.py:84
double threshold_
Definition: EcalMipGraphs.h:93
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, TH1F * > FEDsAndTimingHists_
int j
Definition: DBlmapReader.cc:9
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)
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
double minTimingAmp_
Definition: EcalMipGraphs.h:94
TH1F * allFedsTimingHist_
std::map< std::string, int > seedFrequencyMap_
void EcalMipGraphs::writeGraphs ( )
private

Member Data Documentation

int EcalMipGraphs::abscissa[10]
private

Definition at line 99 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectDigi().

TH1F* EcalMipGraphs::allFedsTimingHist_
private

Definition at line 115 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

TTree* EcalMipGraphs::canvasNames_
private

Definition at line 118 of file EcalMipGraphs.h.

Referenced by analyze(), and endJob().

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

Definition at line 111 of file EcalMipGraphs.h.

Referenced by selectDigi(), and selectHits().

edm::InputTag EcalMipGraphs::EBDigis_
private

Definition at line 84 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 88 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EBRecHitCollection_
private

Definition at line 82 of file EcalMipGraphs.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalMipGraphs::ecalElectronicsMap_
private

Definition at line 120 of file EcalMipGraphs.h.

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

edm::InputTag EcalMipGraphs::EEDigis_
private

Definition at line 85 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 89 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EERecHitCollection_
private

Definition at line 83 of file EcalMipGraphs.h.

Referenced by analyze().

EcalFedMap* EcalMipGraphs::fedMap_
private

Definition at line 119 of file EcalMipGraphs.h.

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

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

Definition at line 112 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

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

Definition at line 110 of file EcalMipGraphs.h.

Referenced by initHists(), and selectHits().

TFile* EcalMipGraphs::file_
private

Definition at line 117 of file EcalMipGraphs.h.

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

Definition at line 103 of file EcalMipGraphs.h.

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

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

Definition at line 102 of file EcalMipGraphs.h.

Referenced by selectDigi().

edm::InputTag EcalMipGraphs::headerProducer_
private

Definition at line 86 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 96 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 97 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 106 of file EcalMipGraphs.h.

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

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

Definition at line 109 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs().

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

Definition at line 107 of file EcalMipGraphs.h.

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

double EcalMipGraphs::minTimingAmp_
private

Definition at line 94 of file EcalMipGraphs.h.

Referenced by selectHits().

int EcalMipGraphs::naiveEvtNum_
private

Definition at line 122 of file EcalMipGraphs.h.

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

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

Definition at line 105 of file EcalMipGraphs.h.

Referenced by analyze(), and selectHits().

int EcalMipGraphs::ordinate[10]
private

Definition at line 100 of file EcalMipGraphs.h.

Referenced by selectDigi().

int EcalMipGraphs::runNum_
private

Definition at line 91 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 108 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

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

Definition at line 113 of file EcalMipGraphs.h.

Referenced by endJob(), and selectHits().

int EcalMipGraphs::side_
private

Definition at line 92 of file EcalMipGraphs.h.

Referenced by selectHits().

double EcalMipGraphs::threshold_
private

Definition at line 93 of file EcalMipGraphs.h.

Referenced by selectHits().