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

Public Member Functions

 EcalMipGraphs (const edm::ParameterSet &)
 
 ~EcalMipGraphs ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

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

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

Definition at line 62 of file EcalMipGraphs.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file EcalMipGraphs.cc.

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

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

Definition at line 93 of file EcalMipGraphs.cc.

94 {
95 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 104 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, TFileDirectory::make(), naiveEvtNum_, names, edm::EventID::run(), runNum_, and selectHits().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 370 of file EcalMipGraphs.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 379 of file EcalMipGraphs.cc.

References canvasNames_, intToString(), maskedChannels_, maskedFEDs_, and seedFrequencyMap_.

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

Referenced by selectDigi().

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

Definition at line 349 of file EcalMipGraphs.cc.

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

Referenced by selectDigi(), and selectHits().

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

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

Referenced by selectHits().

357 {
358  using namespace std;
359 
360  string title1 = "Jitter for ";
361  title1.append(fedMap_->getSliceFromFed(FED));
362  string name1 = "JitterFED";
363  name1.append(intToString(FED));
364  TH1F* timingHist = fileService->make<TH1F>(name1.c_str(),title1.c_str(),150,-7,7);
365  FEDsAndTimingHists_[FED] = timingHist;
366 }
EcalFedMap * fedMap_
std::string intToString(int num)
static edm::Service< TFileService > fileService
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:93
std::map< int, TH1F * > FEDsAndTimingHists_
T * make() const
make new ROOT object
std::string EcalMipGraphs::intToString ( int  num)
private

Definition at line 418 of file EcalMipGraphs.cc.

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

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

Definition at line 152 of file EcalMipGraphs.cc.

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

Referenced by selectHits().

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

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

Referenced by analyze().

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

Member Data Documentation

int EcalMipGraphs::abscissa[10]
private

Definition at line 100 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectDigi().

TH1F* EcalMipGraphs::allFedsTimingHist_
private

Definition at line 116 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

TTree* EcalMipGraphs::canvasNames_
private

Definition at line 119 of file EcalMipGraphs.h.

Referenced by analyze(), and endJob().

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

Definition at line 112 of file EcalMipGraphs.h.

Referenced by selectDigi(), and selectHits().

edm::InputTag EcalMipGraphs::EBDigis_
private

Definition at line 85 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 89 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EBRecHitCollection_
private

Definition at line 83 of file EcalMipGraphs.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalMipGraphs::ecalElectronicsMap_
private

Definition at line 121 of file EcalMipGraphs.h.

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

edm::InputTag EcalMipGraphs::EEDigis_
private

Definition at line 86 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 90 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

edm::InputTag EcalMipGraphs::EERecHitCollection_
private

Definition at line 84 of file EcalMipGraphs.h.

Referenced by analyze().

EcalFedMap* EcalMipGraphs::fedMap_
private

Definition at line 120 of file EcalMipGraphs.h.

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

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

Definition at line 113 of file EcalMipGraphs.h.

Referenced by analyze(), and selectDigi().

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

Definition at line 111 of file EcalMipGraphs.h.

Referenced by initHists(), and selectHits().

TFile* EcalMipGraphs::file_
private

Definition at line 118 of file EcalMipGraphs.h.

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

Definition at line 104 of file EcalMipGraphs.h.

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

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

Definition at line 103 of file EcalMipGraphs.h.

Referenced by selectDigi().

edm::InputTag EcalMipGraphs::headerProducer_
private

Definition at line 87 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 97 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 98 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 107 of file EcalMipGraphs.h.

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

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

Definition at line 110 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs().

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

Definition at line 108 of file EcalMipGraphs.h.

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

double EcalMipGraphs::minTimingAmp_
private

Definition at line 95 of file EcalMipGraphs.h.

Referenced by selectHits().

int EcalMipGraphs::naiveEvtNum_
private

Definition at line 123 of file EcalMipGraphs.h.

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

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

Definition at line 106 of file EcalMipGraphs.h.

Referenced by analyze(), and selectHits().

int EcalMipGraphs::ordinate[10]
private

Definition at line 101 of file EcalMipGraphs.h.

Referenced by selectDigi().

int EcalMipGraphs::runNum_
private

Definition at line 92 of file EcalMipGraphs.h.

Referenced by analyze().

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

Definition at line 109 of file EcalMipGraphs.h.

Referenced by EcalMipGraphs(), and selectHits().

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

Definition at line 114 of file EcalMipGraphs.h.

Referenced by endJob(), and selectHits().

int EcalMipGraphs::side_
private

Definition at line 93 of file EcalMipGraphs.h.

Referenced by selectHits().

double EcalMipGraphs::threshold_
private

Definition at line 94 of file EcalMipGraphs.h.

Referenced by selectHits().