Go to the documentation of this file.00001
00008 #include "DataFormats/CSCDigi/interface/CSCStripDigi.h"
00009 #include <iostream>
00010 #include <stdint.h>
00011
00012
00013 CSCStripDigi::CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts, const std::vector<uint16_t> & vADCOverflow, const std::vector<uint16_t> & vOverlap, const std::vector<uint16_t> & vErrorstat ):
00014 strip(istrip),
00015 ADCCounts(vADCCounts),
00016 ADCOverflow(vADCOverflow),
00017 OverlappedSample(vOverlap),
00018 Errorstat(vErrorstat)
00019 {
00020 }
00021
00022 CSCStripDigi::CSCStripDigi (const int & istrip, const std::vector<int> & vADCCounts):
00023 strip(istrip),
00024 ADCCounts(vADCCounts),
00025 ADCOverflow(8,0),
00026 OverlappedSample(8,0),
00027 Errorstat(8,0)
00028 {
00029 }
00030
00031
00032 CSCStripDigi::CSCStripDigi ():
00033 strip(0),
00034 ADCCounts(8,0),
00035 ADCOverflow(8,0),
00036 OverlappedSample(8,0),
00037 Errorstat(8,0)
00038 {
00039 }
00040
00041 std::vector<int> CSCStripDigi::getADCCounts() const { return ADCCounts; }
00042
00043
00045 std::vector<int> CSCStripDigi::getL1APhase() const {
00046 std::vector<int> L1APhaseResult;
00047 for (int i=0; i<(int)getOverlappedSample().size(); i++) {
00048 L1APhaseResult.push_back((getOverlappedSample()[i]>>8) & 0x1);}
00049 return L1APhaseResult;
00050 }
00051
00052
00053 bool
00054 CSCStripDigi::operator == (const CSCStripDigi& digi) const {
00055 if ( getStrip() != digi.getStrip() ) return false;
00056 if ( getADCCounts().size() != digi.getADCCounts().size() ) return false;
00057 if ( getADCCounts() != digi.getADCCounts() ) return false;
00058 return true;
00059 }
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072 void CSCStripDigi::setADCCounts(std::vector<int>vADCCounts) {
00073 bool badVal = false;
00074 for (int i=0; i<(int)vADCCounts.size(); i++) {
00075 if (vADCCounts[i] < 1) badVal = true;
00076 }
00077 if ( !badVal ) {
00078 ADCCounts = vADCCounts;
00079 } else {
00080 std::vector<int> ZeroCounts(8,0);
00081 ADCCounts = ZeroCounts;
00082 }
00083 }
00084
00085
00086 void
00087 CSCStripDigi::print() const {
00088 std::cout << "CSC Strip: " << getStrip() << " ADC Counts: ";
00089 for (int i=0; i<(int)getADCCounts().size(); i++) {std::cout << getADCCounts()[i] << " ";}
00090 std::cout << "\n";
00091 std::cout << " " << " ADCOverflow: ";
00092 for (int i=0; i<(int)getADCOverflow().size(); i++) {std::cout << getADCOverflow()[i] << " ";}
00093 std::cout << "\n";
00094 std::cout << " " << " OverflappedSample: ";
00095 for (int i=0; i<(int)getOverlappedSample().size(); i++) {
00096
00097 std::cout << getOverlappedSample()[i] << " ";}
00098 std::cout << "\n";
00099 std::cout << " " << " L1APhases: ";
00100 for(int i=0; i<(int)getL1APhase().size(); i++){
00101 std::cout << getL1APhase()[i] << " ";
00102 }
00103 std::cout << "\n";
00104 }
00105
00106 std::ostream & operator<<(std::ostream & o, const CSCStripDigi& digi) {
00107 o << " " << digi.getStrip();
00108 for (size_t i = 0; i<digi.getADCCounts().size(); ++i ){
00109 o <<" " <<(digi.getADCCounts())[i]; }
00110 return o;
00111
00112 }
00113
00114
00115