23 :theDischargeNoiseRate(0),
24 theIonFeedbackFirstPeakRate(0),
25 theIonFeedbackSecondPeakRate(0),
35 string pName = filepath.fullPath();
37 if (pName.find(
".") == 0)
59 "process CorrNoise = {"
60 "service = RandomNumberGeneratorService" "{" "untracked uint32 sourceSeed = 123456789" "}" "}";
71 throw cms::Exception(
"Configuration") <<
"HcalHPDNoiseLibrary requires the RandomNumberGeneratorService\n"
72 "which is not present in the configuration file. You must add the service\n"
73 "in the configuration file or remove the modules that require it.";
96 std::cerr <<
"HPD Handle Object is not valid!" << endl;
121 }
else if (zside == -1) {
124 cerr <<
" ZSide Calculation Error." << endl;
133 std::cerr <<
" HPD Name in the library is not valid." << std::endl;
146 for (
int i = 0;
i < 144; ++
i) {
159 for (
int i = 0;
i < 144; ++
i) {
174 vector <pair< HcalDetId, const float *> >
result;
184 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
194 vector <pair< HcalDetId, const float *> >
result;
203 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
206 const float* _data_ =
const_cast<const float*
>(data_);
215 vector < pair < HcalDetId, const float *> >
result;
226 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
229 const float* _data_ =
const_cast<const float*
>(data_);
238 vector < pair < HcalDetId, const float *> >
result;
249 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
260 double GeVperfC = 0.177;
261 double PedSigma = 0.8;
264 int iphi = (
id.ieta() > 0) ? (
id.iphi()) : (
id.iphi() + 72);
269 rateInTail = rateInTail * bias;
270 rateInSecondTail = rateInSecondTail * bias;
272 edm::LogError(
"HPDNoise") <<
"HPDNoise: ion feedback error (biased or unbiased selection)." << bias <<
" failed";
274 <<
"Usage of " << bias <<
" fails\n";
276 double Charge = energy / GeVperfC;
289 double p4 = 2.06117e+01;
290 double p5 = 1.09239e+01;
294 double p7 = 5.45548e+01;
295 double p8 = 1.59696e+01;
297 if (Charge > 3 * PedSigma) {
298 int npe = int (Charge / pe2Charge);
302 for (
int j = 0;
j < npe; ++
j) {
305 if (probability < rateInTail) {
306 if (probability < rateInSecondTail) {
308 noise += b * p8 + p7;
311 noise += b * p5 +
p4;
319 return (noise * GeVperfC);
325 bool isAccepted =
false;
326 vector < int >::iterator phi_iter;
336 if(timeSliceId == -1 || (timeSliceId>=10))
return;
338 float Data[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
339 for(
int i=0;
i<10;++
i){
344 for(
int i=0;
i<10;++
i){
356 for(
int i=0;
i<10;++
i){
358 int newIdx = timeSliceId+
k;
361 data[newIdx] = Data[ts_max+
k];
381 x = z * 6.28318530717958623;
382 r = TMath::Sqrt(-2 * TMath::Log(y));
383 a = r * TMath::Sin(x);
384 b = r * TMath::Cos(x);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< float > theIonFeedbackFirstPeakRate
const HPDNoiseDataFrame & getDataFrame(size_t i) const
retrive frame for the given index
static PluginManager & configure(const Config &)
const float * getFrame() const
array of 10 charges corresponding to one channel
float dischargeRate(Handle fHandle) const
discharge rate for the instance
CLHEP::RandGaussQ * theRandGaussQ
HPDNoiseLibraryReader(const edm::ParameterSet &)
std::vector< std::pair< HcalDetId, const float * > > getBiasedNoisyHcalDetIds()
Handle getHandle(const std::string &fName)
get handle to access data for one HPD instance
double getIonFeedbackNoise(HcalDetId id, double energy, double bias)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned long totalEntries(Handle fHandle) const
total number of noise events for the HPD instance in the library
static bool isAvailable()
std::vector< int > theNoisyPhi
float ionFeedbackSecondPeakRate(Handle fHandle) const
std::vector< float > theIonFeedbackSecondPeakRate
static ServiceToken createServicesFromConfig(std::string const &config)
bool valid(Handle fHandle) const
test if handle is valid
static void initializeServices()
PluginManager::Config config()
const T & max(const T &a, const T &b)
std::vector< std::string > theNames
std::pair< std::string, MonitorElement * > entry
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
HcalDetId id() const
detId for the frame
std::vector< std::pair< HcalDetId, const float * > > getNoisyHcalDetIds()
std::vector< std::string > allNames() const
all HPD instances in the library
void Rannor(double &a, double &b)
std::vector< float > theDischargeNoiseRate
CLHEP::RandFlat * theRandFlat
float ionFeedbackFirstPeakRate(Handle fHandle) const
ionfeedback rate for the instance
char data[epos_bytes_allocation]
bool IsNoiseApplicable(int iphi)
void getEntry(Handle fHandle, HPDNoiseData **fData)
retrive one entry from the sequentially
HPDNoiseData * getNoiseData(int iphi)
unsigned size() const
number of noise channels in the event
void getBiasedNoisyPhis()
void shuffleData(int timeSliceId, float *&data)
HPDNoiseReader * theReader