22 :theDischargeNoiseRate(0),
23 theIonFeedbackFirstPeakRate(0),
24 theIonFeedbackSecondPeakRate(0),
34 string pName = filepath.fullPath();
36 if (pName.find(
".") == 0)
58 "process CorrNoise = {"
59 "service = RandomNumberGeneratorService" "{" "untracked uint32 sourceSeed = 123456789" "}" "}";
70 throw cms::Exception(
"Configuration") <<
"HcalHPDNoiseLibrary requires the RandomNumberGeneratorService\n"
71 "which is not present in the configuration file. You must add the service\n"
72 "in the configuration file or remove the modules that require it.";
95 std::cerr <<
"HPD Handle Object is not valid!" << endl;
120 }
else if (zside == -1) {
123 cerr <<
" ZSide Calculation Error." << endl;
132 std::cerr <<
" HPD Name in the library is not valid." << std::endl;
145 for (
int i = 0;
i < 144; ++
i) {
158 for (
int i = 0;
i < 144; ++
i) {
173 vector <pair< HcalDetId, const float *> >
result;
183 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
193 vector <pair< HcalDetId, const float *> >
result;
202 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
205 const float* _data_ =
const_cast<const float*
>(data_);
214 vector < pair < HcalDetId, const float *> >
result;
225 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
228 const float* _data_ =
const_cast<const float*
>(data_);
237 vector < pair < HcalDetId, const float *> >
result;
248 for (
unsigned int i = 0;
i < data->
size(); ++
i) {
259 double GeVperfC = 0.177;
260 double PedSigma = 0.8;
263 int iphi = (
id.ieta() > 0) ? (
id.iphi()) : (
id.iphi() + 72);
268 rateInTail = rateInTail * bias;
269 rateInSecondTail = rateInSecondTail * bias;
271 edm::LogError(
"HPDNoise") <<
"HPDNoise: ion feedback error (biased or unbiased selection)." << bias <<
" failed";
273 <<
"Usage of " << bias <<
" fails\n";
275 double Charge = energy / GeVperfC;
288 double p4 = 2.06117e+01;
289 double p5 = 1.09239e+01;
293 double p7 = 5.45548e+01;
294 double p8 = 1.59696e+01;
296 if (Charge > 3 * PedSigma) {
297 int npe = int (Charge / pe2Charge);
301 for (
int j = 0;
j < npe; ++
j) {
304 if (probability < rateInTail) {
305 if (probability < rateInSecondTail) {
307 noise += b * p8 + p7;
310 noise += b * p5 +
p4;
318 return (noise * GeVperfC);
324 bool isAccepted =
false;
325 vector < int >::iterator phi_iter;
335 if(timeSliceId == -1 || (timeSliceId>=10))
return;
337 float Data[10] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
338 for(
int i=0;
i<10;++
i){
343 for(
int i=0;
i<10;++
i){
355 for(
int i=0;
i<10;++
i){
357 int newIdx = timeSliceId+
k;
360 data[newIdx] = Data[ts_max+
k];
380 x = z * 6.28318530717958623;
381 r = TMath::Sqrt(-2 * TMath::Log(y));
382 a = r * TMath::Sin(x);
383 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
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