28 #include "CLHEP/GenericFunctions/Erf.hh"
65 edm::LogInfo(
"CaloRecHitsProducer") <<
"Uniform noise simulation selected in the barrel";
68 if(highNoiseParameters_.size()==4)
69 EBHotFraction_ = 0.5-0.5*myErf(highNoiseParameters_[3]/highNoiseParameters_[2]/
sqrt(2.));
70 if(highNoiseParameters_.size()==3)
72 edm::LogInfo(
"CaloRecHitsProducer")<<
" The gaussian model for high noise fluctuation cells after ZS is selected (best model), hot fraction " <<
EBHotFraction_ << std::endl;
77 double c1=CalibParameters.
getParameter<
double>(
"EBs25notContainment");
92 for(
unsigned ic=0;ic<
size;++ic)
104 for(
unsigned itt=0;itt<
size;++itt)
113 for(
unsigned itt=0;itt<
size;++itt)
138 for(
unsigned ihit=0;ihit<nhit;++ihit)
202 for (cficalo=colcalo->begin(); cficalo!=cficaloend;cficalo++)
219 float energy=(cficalo->energy()==0.) ? 0.000001 : cficalo->energy() ;
250 for(
unsigned itt=0;itt<
nTT;++itt)
257 unsigned nneighbors=neighbors.size();
260 for(
unsigned in=0;
in<nneighbors;++
in)
267 theFiredTTs_.push_back(neighbors[in]);
291 unsigned nxtals=xtals.size();
292 unsigned counter =0 ;
294 for(
unsigned ic=0;ic<nxtals;++ic)
296 unsigned hashedindex=xtals[ic];
339 while(icell < ncells)
341 unsigned cellindex= (!fullInjection) ?
431 const EcalBarrelGeometry * myEcalBarrelGeometry =
dynamic_cast<const EcalBarrelGeometry*
>(pG->getSubdetectorGeometry(
DetId::Ecal,
EcalBarrel));
434 unsigned size=vec.size();
435 for(
unsigned ic=0; ic<
size; ++ic)
448 sinTheta_[ietaAbs]=
std::sin(myEcalBarrelGeometry->getGeometry(myDetId)->getPosition().theta());
469 for(
unsigned iTT=0;iTT<nTTs;++iTT)
476 if(ietamin==0) ietamin=-1;
478 if(ietamax==0) ietamax=1;
481 for(
int ieta=ietamin;ieta<=ietamax;)
483 int iz=(ieta>0)? 1 : -1;
484 for(
int iphi=iphimin;iphi<=iphimax;)
487 if(riphi<1) riphi+=72;
488 else if(riphi>72) riphi-=72;
491 if(ieta!=ietaPivot||riphi!=iphiPivot)
519 const std::vector<float>& ICMC = jcal->
barrelItems();
530 const std::vector<float> & IC = ical->
barrelItems();
533 unsigned nic = IC.size();
534 for (
unsigned ic=0; ic <nic ; ++ic ) {
536 float factor = IC[ic]/ICMC[ic];
541 rms+=(factor-1.)*(factor-1.);
555 rms=
sqrt(rms-mean*mean);
556 meanIC = 1.+ meanIC/ncells;
560 edm::LogInfo(
"CaloRecHitsProducer") <<
"Found " << ncells <<
" cells in the barrel calibration map. RMS is " << rms << std::endl;
602 unsigned size=tts.size();
604 for(
unsigned itt=0;itt<size&&!
result;++itt)
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
bool isHighInterest(int tthi)
T getUntrackedParameter(std::string const &, T const &) const
int hashedIndex() const
get a compact index for arrays
const GaussianTail * myGaussianTailGenerator_
const RandomEngine * random_
const std::vector< float > * ICMC_
std::vector< int > theFiredCells_
const Items & barrelItems() const
~EcalBarrelRecHitsMaker()
Sin< T >::type sin(const T &t)
int hashedIndex() const
get a compact index for arrays [TODO: NEEDS WORK]
void push_back(T const &t)
void loadEcalBarrelRecHits(edm::Event &iEvent, EBRecHitCollection &ecalHits, EBDigiCollection &ecaldigis)
bool noisifyTriggerTower(unsigned tthi)
std::vector< float > sinTheta_
double gaussShoot(double mean=0.0, double sigma=1.0) const
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
std::vector< float > theCalorimeterHits_
std::vector< float > noisesigma_
void loadPCaloHits(const edm::Event &iEvent)
void geVtoGainAdc(float e, unsigned &gain, unsigned &adc) const
int hashedIndex(int ieta, int iphi)
MVATrainerComputer * calib
const T & max(const T &a, const T &b)
void noisifyTriggerTowers()
unsigned int poissonShoot(double mean) const
std::vector< uint32_t > barrelRawId_
std::vector< double > highNoiseParameters_
std::vector< unsigned > theFiredTTs_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void reserve(size_t isize)
const EcalTrigTowerConstituentsMap * eTTmap_
std::vector< float > TTTEnergy_
T const * product() const
EcalBarrelRecHitsMaker(edm::ParameterSet const &p, const RandomEngine *)
T const * product() const
double flatShoot(double xmin=0.0, double xmax=1.0) const
void push_back(id_type iid, data_type const *idata)
std::vector< std::vector< int > > crystalsinTT_
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
std::vector< std::vector< int > > neighboringTTs_
std::vector< float > theCalibConstants_
std::vector< int > theTTofHighInterest_
void reserve(size_type n)
std::vector< int > applyZSCells_
int ietaAbs() const
get the absolute value of the crystal ieta
tuple size
Write out results.
void init(const edm::EventSetup &es, bool dodigis, bool doMiscalib)
std::vector< EcalTrigTowerDetId > theTTDetIds_
std::vector< bool > treatedTTs_
std::vector< int > TTHighInterest_