Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:00

0001 #ifndef DataFormats_CSCRecHit2D_H
0002 #define DataFormats_CSCRecHit2D_H
0003 
0004 /**
0005  * \class CSCRecHit2D  
0006  * Describes a 2-dim reconstructed hit in one layer of an Endcap Muon CSC.
0007  *
0008  * \author Tim Cox et al.
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   /// RecHit2DLocalPos base class interface
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   /// Extracting strip channel numbers comprising the rechit - low
0061   int channels(unsigned int i) const { return theStrips_[i]; }
0062   unsigned int nStrips() const { return nStrips_; }
0063 
0064   /// Extract the L1A phase bits from the StripChannelContainer - high
0065   int channelsl1a(unsigned int i) const { return theL1APhaseBits_[i]; }  /// L1A
0066 
0067   /// Container of wire groups comprising the rechit
0068   short int hitWire() const { return hitWire_; }
0069   short int wgroupsBX() const { return theWGroupsBX_; }
0070 
0071   unsigned int nWireGroups() const { return nWireGroups_; }
0072 
0073   /// Map of strip ADCs for strips comprising the rechit
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   /// Fitted peaking time
0079   float tpeak() const { return theTpeak; }
0080 
0081   /// The estimated position within the strip
0082   float positionWithinStrip() const { return thePositionWithinStrip; };
0083 
0084   /// The uncertainty of the estimated position within the strip
0085   float errorWithinStrip() const { return theErrorWithinStrip; };
0086 
0087   /// quality flag of the reconstruction
0088   int quality() const { return theQuality; }
0089 
0090   /// flags for involvement of 'bad' channels
0091   short int badStrip() const { return theBadStrip; }
0092   short int badWireGroup() const { return theBadWireGroup; }
0093 
0094   // Calculated wire time in ns
0095   float wireTime() const { return (float)theScaledWireTime / 100.; }
0096 
0097   /// Energy deposited in the layer.  Note:  this value is dE.  In order to
0098   /// get the dE/dX, you will need to divide by the path length.
0099   /// Specific failure values...
0100   /// If the user has chosen not to use the gas gain correction --->  -998.
0101   /// If the gas gain correction from the database is a bad value ->  -997.
0102   /// If it is an edge strip -------------------------------------->  -996.
0103   /// If gas-gain is OK, but the ADC vector is the wrong size  ---->  -999.
0104   /// If the user has created the Rechit without the energy deposit>  -995.
0105   /// If the user has created the Rechit with no arguments -------->  -994.
0106   float energyDepositedInLayer() const { return theEnergyDeposit; }
0107 
0108   /// Returns true if the two TrackingRecHits are using the same input information, false otherwise.  In this case, looks at the geographical ID and channel numbers for strips and wires.
0109   bool sharesInput(const TrackingRecHit* other, TrackingRecHit::SharedInputType what) const override;
0110 
0111   /// Returns true if the two TrackingRecHits are using the same input information, false otherwise.  In this case, looks at the geographical ID and channel numbers for strips and wires.
0112   bool sharesInput(const TrackingRecHit* other, CSCRecHit2D::SharedInputType what) const;
0113 
0114   /// Returns true if the two CSCRecHits are using the same input information, false otherwise.  In this case, looks at the geographical ID and channel numbers for strips and wires.
0115   bool sharesInput(const CSCRecHit2D* otherRecHit, CSCRecHit2D::SharedInputType what) const;
0116 
0117   /// Print the content of the RecHit2D including L1A (for debugging)
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 /// Output operator for CSCRecHit2D
0143 std::ostream& operator<<(std::ostream& os, const CSCRecHit2D& rh);
0144 
0145 #endif