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;
75 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::runStrip] id= " <<
id_ <<
105 for (
size_t imax = 0; imax !=
theMaxima.size(); ++imax ) {
127 int maximum_to_left = 99;
128 int maximum_to_right = 99;
135 if(fabs(maximum_to_right) < fabs(maximum_to_left)){
146 short int aDeadStrip = 0;
147 if(!deadStripL && !deadStripR){
150 else if(deadStripL && deadStripR){
164 std::vector<int> theL1AStrips;
165 for(
int ila=0; ila<(int)
theStrips.size(); ila++){
166 bool stripMatchCounter=
false;
168 int stripNproto = (*itl1).getStrip();
171 stripMatchCounter=
true;
172 std::vector<int> L1AP=(*itl1).getL1APhase();
174 for(
int iBit=0; iBit<(int)L1AP.size(); iBit++){
175 L1AbitOnPlace=L1AbitOnPlace|(L1AP[iBit] << (15-iBit));
177 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
181 for(
int tripl=0; tripl<3; ++tripl){
182 if(
theStrips[ila]==(stripNproto+tripl*16)){
183 stripMatchCounter=
true;
184 std::vector<int> L1AP=(*itl1).getL1APhase();
186 for(
int iBit=0; iBit<(int)L1AP.size(); iBit++){
187 L1AbitOnPlace=L1AbitOnPlace|(L1AP[iBit] << (15-iBit));
189 theL1AStrips.push_back(
theStrips[ila] | L1AbitOnPlace);
194 if(!stripMatchCounter){
202 hitsInLayer.push_back( striphit );
221 float strippos = -1.;
223 std::vector<CSCStripHitData> stripDataV;
230 if ( centerStrip - i < 1 || centerStrip + i >
int(
nstrips_) ) {
238 stripDataV.push_back( data );
243 LogTrace(
"CSCHitFromStripOnly") <<
"[CSCHitFromStripOnly::makeCluster] centerStrip= " << centerStrip <<
244 " strippos=" << strippos;
256 int thisStrip = centerStrip+
offset;
261 std::vector<float>
adc(4);
262 std::vector<float> adcRaw(4);
270 if ( tmax > 2 && tmax < 7 ) {
271 int ibin = thisStrip-1;
285 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::makeStripData] Tmax out of range: contact CSC expert!";
291 int sign = offset>0 ? 1 : -1;
297 int testStrip = thisStrip + sign*
i;
306 std::vector<float> adc1(4);
307 std::vector<float> adcRaw1(4);
308 std::vector<float> adc2(4);
309 std::vector<float> adcRaw2(4);
317 if ( tmax > 2 && tmax < 7 ) {
318 int ibin = testStrip-1;
319 int jbin = centerStrip-1;
342 for (
size_t k = 0;
k < 4; ++
k){
343 if(adc1[
k]>0 && adc2[
k]>0) adc[
k] = adc[
k] * adc2[
k] / ( adc1[
k]+adc2[
k] );
344 if(adcRaw1[
k]>0 && adcRaw2[
k]>0) adcRaw[
k] = adcRaw[
k] * adcRaw2[
k] / ( adcRaw1[
k]+adcRaw2[
k] );
366 std::vector<float> sca;
369 int thisChannel = (*it).getStrip();
370 std::vector<int> scaRaw = (*it).getADCCounts();
373 std::copy( scaRaw.begin(), scaRaw.end(), std::back_inserter( sca ));
376 int tmax = std::max_element( sca.begin(), sca.end() ) - sca.begin();
387 if ( tmax > 2 && tmax < 7 ) {
401 for (
int j = 1;
j < 3; ++
j ) {
425 float heightCluster = 0.;
427 bool maximumFound =
false;
461 int numberOfConsecutiveStrips = 1;
462 float testThreshold = 10.;
465 for(
int l = 0;
l<8; ++
l){
466 if(j<0)
edm::LogWarning(
"FailedStripCountingWrongConsecutiveStripNumber") <<
"This should never occur!!! Contact CSC expert!";
468 bool signalPresent =
false;
469 for(
int k = 0;
k<2; ++
k){
471 int anotherConsecutiveStrip =
i+
j;
472 if(anotherConsecutiveStrip>=0 && anotherConsecutiveStrip<
int(
thePulseHeightMap.size() )){
474 ++numberOfConsecutiveStrips;
475 signalPresent =
true;
505 float strippos = -1.;
507 if ( data.size() < 1 )
return strippos;
512 int biggestStrip = max_element(data.begin(), data.end()) - data.begin();
513 strippos = data[biggestStrip].strip() * 1.;
520 std::vector<float>
w(4);
521 std::vector<float> wRaw(4);
523 for (
size_t i = 0;
i != data.size(); ++
i ) {
525 wRaw = data[
i].phRaw();
540 if ( data[
i].strip() < 1 ){
541 LogTrace(
"CSCRecHit") <<
"[CSCHitFromStripOnly::findHitOnStripPosition] problem in indexing of strip, strip= "
545 sum += w[1] * data[
i].strip();
548 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
virtual float pedestal(const std::vector< float > &sca, const CSCRecoConditions *cond=0, const CSCDetId id=0, int ichan=0)=0
bool gangedStrips() const
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
void stripWeights(const CSCDetId &id, short int nstrips, float *weights) const
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