25 bool useStaticPedestals = ps.
getParameter<
bool>(
"CSCUseStaticPedestals");
26 int noOfTimeBinsForDynamicPed = ps.
getParameter<
int>(
"CSCNoOfTimeBinsForDynamicPedestal");
31 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCUseStaticPedestals = " << useStaticPedestals;
32 if ( !useStaticPedestals )
LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly] CSCNoOfTimeBinsForDynamicPedestal = "
33 << noOfTimeBinsForDynamicPed;
35 if ( useStaticPedestals ) {
39 if ( noOfTimeBinsForDynamicPed == 1 ) {
65 std::vector<CSCStripHit> hitsInLayer;
85 for (
size_t imax = 0; imax !=
theMaxima.size(); ++imax ) {
107 int maximum_to_left = 99;
108 int maximum_to_right = 99;
115 if(fabs(maximum_to_right) < fabs(maximum_to_left)){
126 short int aDeadStrip = 0;
127 if(!deadStripL && !deadStripR){
130 else if(deadStripL && deadStripR){
145 std::vector<int> theL1AStrips;
146 for(
int ila=0; ila<(int)
theStrips.size(); ila++){
147 bool stripMatchCounter=
false;
149 int stripNproto = (*itl1).getStrip();
152 stripMatchCounter=
true;
153 std::vector<int> L1AP=(*itl1).getL1APhase();
155 for(
int iBit=0; iBit<(int)L1AP.size(); iBit++){
156 L1AbitOnPlace=L1AbitOnPlace|(L1AP[iBit] << (15-iBit));
158 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
162 for(
int tripl=0; tripl<3; ++tripl){
163 if(
theStrips[ila]==(stripNproto+tripl*16)){
164 stripMatchCounter=
true;
165 std::vector<int> L1AP=(*itl1).getL1APhase();
167 for(
int iBit=0; iBit<(int)L1AP.size(); iBit++){
168 L1AbitOnPlace=L1AbitOnPlace|(L1AP[iBit] << (15-iBit));
170 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
175 if(!stripMatchCounter){
183 hitsInLayer.push_back( striphit );
201 float strippos = -1.;
203 std::vector<CSCStripHitData> stripDataV;
210 if ( centerStrip - i < 1 || centerStrip + i >
int(
nstrips_) ) {
218 stripDataV.push_back( data );
233 int thisStrip = centerStrip+
offset;
238 std::vector<float>
adc(4);
239 std::vector<float> adcRaw(4);
247 if ( tmax > 2 && tmax < 7 ) {
248 int ibin = thisStrip-1;
262 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::makeStripData] Tmax out of range: contact CSC expert!";
268 int sign = offset>0 ? 1 : -1;
274 int testStrip = thisStrip + sign*
i;
283 std::vector<float> adc1(4);
284 std::vector<float> adcRaw1(4);
285 std::vector<float> adc2(4);
286 std::vector<float> adcRaw2(4);
294 if ( tmax > 2 && tmax < 7 ) {
295 int ibin = testStrip-1;
296 int jbin = centerStrip-1;
319 for (
size_t k = 0;
k < 4; ++
k){
320 if(adc1[
k]>0 && adc2[
k]>0) adc[
k] = adc[
k] * adc2[
k] / ( adc1[
k]+adc2[
k] );
321 if(adcRaw1[
k]>0 && adcRaw2[
k]>0) adcRaw[
k] = adcRaw[
k] * adcRaw2[
k] / ( adcRaw1[
k]+adcRaw2[
k] );
343 std::vector<float> sca;
346 int thisChannel = (*it).getStrip();
347 std::vector<int> scaRaw = (*it).getADCCounts();
350 std::copy( scaRaw.begin(), scaRaw.end(), std::back_inserter( sca ));
353 int tmax = std::max_element( sca.begin(), sca.end() ) - sca.begin();
364 if ( tmax > 2 && tmax < 7 ) {
377 for (
int j = 0;
j < 3; ++
j ) {
401 float heightCluster = 0.;
403 bool maximumFound =
false;
437 int numberOfConsecutiveStrips = 1;
438 float testThreshold = 10.;
441 for(
int l = 0;
l<8; ++
l){
442 if(j<0)
edm::LogWarning(
"FailedStripCountingWrongConsecutiveStripNumber") <<
"This should never occur!!! Contact CSC expert!";
444 bool signalPresent =
false;
445 for(
int k = 0;
k<2; ++
k){
447 int anotherConsecutiveStrip =
i+
j;
448 if(anotherConsecutiveStrip>=0 && anotherConsecutiveStrip<
int(
thePulseHeightMap.size() )){
450 ++numberOfConsecutiveStrips;
451 signalPresent =
true;
481 float strippos = -1.;
483 if ( data.size() < 1 )
return strippos;
488 int biggestStrip = max_element(data.begin(), data.end()) - data.begin();
489 strippos = data[biggestStrip].strip() * 1.;
496 std::vector<float>
w(4);
497 std::vector<float> wRaw(4);
499 for (
size_t i = 0;
i != data.size(); ++
i ) {
501 wRaw = data[
i].phRaw();
516 if ( data[
i].
strip() < 1 ){
517 LogTrace(
"CSCRecHit") <<
"problem in indexing of strip, strip id is: " << data[
i].strip();
520 sum += w[1] * data[
i].strip();
523 if ( sum_w > 0.) strippos = sum / sum_w;
int adc(sample_type sample)
get the ADC sample (12 bits)
CSCPedestalChoice * calcped_
T getParameter(std::string const &) const
void findMaxima(const CSCDetId &id)
Find local maxima.
std::vector< int > theConsecutiveStrips
std::vector< CSCStripHit > runStrip(const CSCDetId &id, const CSCLayer *layer, const CSCStripDigiCollection::Range &rstripd)
std::vector< int > theStrips
bool isDeadStrip(const CSCDetId &id, int centralStrip)
Is the strip 'bad'?
bool nearBadStrip(const CSCDetId &id, int geomStrip) const
Is a neighbour bad?
std::vector< int > theClosestMaximum
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
float theThresholdForCluster
float findHitOnStripPosition(const std::vector< CSCStripHitData > &data, const int ¢erStrip)
Find position of hit in strip cluster in terms of strip #.
CSCHitFromStripOnly(const edm::ParameterSet &ps)
static const int theClusterSize
PulseHeightMap thePulseHeightMap
const CSCChamberSpecs * specs() const
const CSCRecoConditions * recoConditions_
float theThresholdForAPeak
void stripWeights(const CSCDetId &id, float *weights) const
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=0, const CSCDetId id=0, int ichan=0)=0
bool badStrip(const CSCDetId &id, int geomStrip) const
Is the strip bad?
unsigned int offset(bool)
float makeCluster(int centerStrip)
Make clusters using local maxima.
bool isNearDeadStrip(const CSCDetId &id, int centralStrip)
Is either neighbour 'bad'?
static const double tmax[3]
std::vector< DigiType >::const_iterator const_iterator
std::vector< float > strips_adcRaw
std::vector< int > theMaxima
bool isPeakOK(int iStrip, float heightCluster)
char data[epos_bytes_allocation]
std::vector< float > strips_adc
std::pair< const_iterator, const_iterator > Range
void fillPulseHeights(const CSCStripDigiCollection::Range &rstripd)
Store SCA pulseheight information from strips in digis of one layer.
CSCStripHitData makeStripData(int centerStrip, int offset)
const CSCChamber * chamber() const