File indexing completed on 2024-04-06 12:04:00
0001 #ifndef DataFormats_CSCRecHit2D_H
0002 #define DataFormats_CSCRecHit2D_H
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include "DataFormats/Common/interface/RangeMap.h"
0012 #include <DataFormats/TrackingRecHit/interface/RecHit2DLocalPos.h>
0013 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0014 #include <vector>
0015 #include <map>
0016 #include <iosfwd>
0017
0018 class CSCRecHit2D final : public RecHit2DLocalPos {
0019 public:
0020 typedef std::vector<int> ChannelContainer;
0021 typedef edm::RangeMap<int, std::vector<float> > ADCContainer;
0022
0023 enum SharedInputType {
0024 all = TrackingRecHit::all,
0025 some = TrackingRecHit::some,
0026 allWires,
0027 someWires,
0028 allStrips,
0029 someStrips
0030 };
0031
0032 static const unsigned int MAXSTRIPS = 3;
0033 static const unsigned int MAXTIMEBINS = 4;
0034 static const unsigned int N_ADC = MAXSTRIPS * MAXTIMEBINS;
0035 CSCRecHit2D();
0036
0037 CSCRecHit2D(const CSCDetId& id,
0038 const LocalPoint& pos,
0039 const LocalError& err,
0040 const ChannelContainer& channels,
0041 const ADCContainer& adcs,
0042 const ChannelContainer& wgroups,
0043 float tpeak,
0044 float posInStrip,
0045 float errInStrip,
0046 int quality,
0047 short int badStrip = 0,
0048 short int badWireGroup = 0,
0049 int scaledWireTime = 0,
0050 float energyDeposit = -995.);
0051
0052 ~CSCRecHit2D() override;
0053
0054
0055 CSCRecHit2D* clone() const override { return new CSCRecHit2D(*this); }
0056 LocalPoint localPosition() const override { return theLocalPosition; }
0057 LocalError localPositionError() const override { return theLocalError; }
0058 CSCDetId cscDetId() const { return geographicalId(); }
0059
0060
0061 int channels(unsigned int i) const { return theStrips_[i]; }
0062 unsigned int nStrips() const { return nStrips_; }
0063
0064
0065 int channelsl1a(unsigned int i) const { return theL1APhaseBits_[i]; }
0066
0067
0068 short int hitWire() const { return hitWire_; }
0069 short int wgroupsBX() const { return theWGroupsBX_; }
0070
0071 unsigned int nWireGroups() const { return nWireGroups_; }
0072
0073
0074 float adcs(unsigned int strip, unsigned int timebin) const { return theADCs_[strip * MAXTIMEBINS + timebin]; }
0075
0076 unsigned int nTimeBins() const { return nTimeBins_; }
0077
0078
0079 float tpeak() const { return theTpeak; }
0080
0081
0082 float positionWithinStrip() const { return thePositionWithinStrip; };
0083
0084
0085 float errorWithinStrip() const { return theErrorWithinStrip; };
0086
0087
0088 int quality() const { return theQuality; }
0089
0090
0091 short int badStrip() const { return theBadStrip; }
0092 short int badWireGroup() const { return theBadWireGroup; }
0093
0094
0095 float wireTime() const { return (float)theScaledWireTime / 100.; }
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106 float energyDepositedInLayer() const { return theEnergyDeposit; }
0107
0108
0109 bool sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const override;
0110
0111
0112 bool sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const;
0113
0114
0115 bool sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const;
0116
0117
0118 void print() const;
0119
0120 private:
0121 float theTpeak;
0122 float thePositionWithinStrip;
0123 float theErrorWithinStrip;
0124 float theEnergyDeposit;
0125 int theQuality;
0126 int theScaledWireTime;
0127 short int hitWire_;
0128 short int theWGroupsBX_;
0129 short int theBadStrip;
0130 short int theBadWireGroup;
0131
0132 unsigned char nStrips_, nWireGroups_, nTimeBins_;
0133
0134 unsigned char theL1APhaseBits_[MAXSTRIPS];
0135 unsigned char theStrips_[MAXSTRIPS];
0136 float theADCs_[N_ADC];
0137
0138 LocalPoint theLocalPosition;
0139 LocalError theLocalError;
0140 };
0141
0142
0143 std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh);
0144
0145 #endif