28 #include "CLHEP/GenericFunctions/Erf.hh"
63 edm::LogInfo(
"CaloRecHitsProducer") <<
"Uniform noise simulation selected in the barrel";
66 if(highNoiseParameters_.size()==4)
67 EBHotFraction_ = 0.5-0.5*myErf(highNoiseParameters_[3]/highNoiseParameters_[2]/
sqrt(2.));
68 if(highNoiseParameters_.size()==3)
70 edm::LogInfo(
"CaloRecHitsProducer")<<
" The gaussian model for high noise fluctuation cells after ZS is selected (best model), hot fraction " <<
EBHotFraction_ << std::endl;
75 double c1=CalibParameters.
getParameter<
double>(
"EBs25notContainment");
90 for(
unsigned ic=0;ic<
size;++ic)
102 for(
unsigned itt=0;itt<
size;++itt)
111 for(
unsigned itt=0;itt<
size;++itt)
137 for(
unsigned ihit=0;ihit<nhit;++ihit)
201 for (cficalo=colcalo->begin(); cficalo!=cficaloend;cficalo++)
218 float energy=(cficalo->energy()==0.) ? 0.000001 : cficalo->energy() ;
249 for(
unsigned itt=0;itt<
nTT;++itt)
256 unsigned nneighbors=neighbors.size();
259 for(
unsigned in=0;
in<nneighbors;++
in)
266 theFiredTTs_.push_back(neighbors[in]);
290 unsigned nxtals=xtals.size();
293 for(
unsigned ic=0;ic<nxtals;++ic)
295 unsigned hashedindex=xtals[ic];
302 float energy = calib*random->
gaussShoot(0.,noise);
338 while(icell < ncells)
340 unsigned cellindex= (!fullInjection) ?
355 energy=random->
gaussShoot(noisemean,noisesigma);
433 unsigned size=vec.size();
434 for(
unsigned ic=0; ic<
size; ++ic)
468 for(
unsigned iTT=0;iTT<nTTs;++iTT)
475 if(ietamin==0) ietamin=-1;
477 if(ietamax==0) ietamax=1;
480 for(
int ieta=ietamin;ieta<=ietamax;)
482 int iz=(ieta>0)? 1 : -1;
483 for(
int iphi=iphimin;iphi<=iphimax;)
486 if(riphi<1) riphi+=72;
487 else if(riphi>72) riphi-=72;
490 if(ieta!=ietaPivot||riphi!=iphiPivot)
518 const std::vector<float>& ICMC = jcal->
barrelItems();
529 const std::vector<float> & IC = ical->
barrelItems();
532 unsigned nic = IC.size();
533 for (
unsigned ic=0; ic <nic ; ++ic ) {
535 float factor = IC[ic]/ICMC[ic];
540 rms+=(factor-1.)*(factor-1.);
554 rms=
sqrt(rms-mean*mean);
555 meanIC = 1.+ meanIC/ncells;
559 edm::LogInfo(
"CaloRecHitsProducer") <<
"Found " << ncells <<
" cells in the barrel calibration map. RMS is " << rms << std::endl;
601 unsigned size=tts.size();
603 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
void randomNoisifier(RandomEngineAndDistribution const *)
const GaussianTail * myGaussianTailGenerator_
double flatShoot(double xmin=0.0, double xmax=1.0) const
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)
std::vector< float > sinTheta_
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< float > theCalorimeterHits_
double shoot(RandomEngineAndDistribution const *) const
Geom::Theta< T > theta() const
std::vector< float > noisesigma_
void geVtoGainAdc(float e, unsigned &gain, unsigned &adc) const
int hashedIndex(int ieta, int iphi)
void noisifyTriggerTowers(RandomEngineAndDistribution const *)
MVATrainerComputer * calib
EcalBarrelRecHitsMaker(edm::ParameterSet const &p)
std::vector< uint32_t > barrelRawId_
Abs< T >::type abs(const T &t)
std::vector< double > highNoiseParameters_
std::vector< unsigned > theFiredTTs_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void reserve(size_t isize)
void loadPCaloHits(const edm::Event &iEvent, RandomEngineAndDistribution const *)
const EcalTrigTowerConstituentsMap * eTTmap_
std::vector< float > TTTEnergy_
bool noisifyTriggerTower(unsigned tthi, RandomEngineAndDistribution const *)
T const * product() const
T const * product() 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_
static std::atomic< unsigned int > counter
std::vector< float > theCalibConstants_
std::vector< int > theTTofHighInterest_
double gaussShoot(double mean=0.0, double sigma=1.0) const
unsigned int poissonShoot(double mean) const
void reserve(size_type n)
std::vector< int > applyZSCells_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void loadEcalBarrelRecHits(edm::Event &iEvent, EBRecHitCollection &ecalHits, EBDigiCollection &ecaldigis, RandomEngineAndDistribution const *)
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_