4 CSCRecHit2D::CSCRecHit2D() :
6 thePositionWithinStrip(-999.),
7 theErrorWithinStrip(-999.),
8 theEnergyDeposit( -994. ),
10 theScaledWireTime( 0 ),
16 theLocalPosition(0.,0.),
17 theLocalError(0.,0.,0.)
19 for (
unsigned int i=0;
i< MAXSTRIPS;
i++) theStrips_[
i]=0;
20 for (
unsigned int i=0;
i< MAXSTRIPS;
i++)
21 for (
unsigned int j=0;
j< MAXTIMEBINS;
j++)
22 theADCs_[
i*MAXTIMEBINS+
j]=0;
25 CSCRecHit2D::CSCRecHit2D(
const CSCDetId&
id,
28 const ChannelContainer& channels,
29 const ADCContainer& adcs,
30 const ChannelContainer& wgroups,
34 int quality,
short int badStrip,
short int badWireGroup,
39 thePositionWithinStrip( posInStrip ),
40 theErrorWithinStrip( errInStrip ),
41 theEnergyDeposit( energyDeposit ),
42 theQuality( quality ),
43 theScaledWireTime ( scaledWireTime ),
44 theBadStrip( badStrip ), theBadWireGroup( badWireGroup ),
45 theLocalPosition( pos ),
48 nStrips_=channels.size();
49 nWireGroups_=wgroups.size();
51 if ( nStrips_ > MAXSTRIPS ) {
52 std::cout <<
"CSCRecHit2D: not enough strips in DataFormat! " << unsigned(nStrips_) << std::endl;
56 for (
unsigned int i=0;
i< MAXSTRIPS;
i++) theStrips_[
i]=0;
57 for (
unsigned int i=0;
i< MAXSTRIPS;
i++) theL1APhaseBits_[
i]=0;
58 for (
unsigned int i=0;
i< MAXSTRIPS;
i++)
59 for (
unsigned int j=0;
j< MAXTIMEBINS;
j++)
60 theADCs_[
i*MAXTIMEBINS+
j]=0;
63 for (
unsigned int i=0;
i<nStrips_;
i++) {
64 theStrips_[
i]=channels[
i] & 0x000000FF;
65 theL1APhaseBits_[
i]=channels[
i] & 0x0000FF00;
69 hitWire_=wgroups[nWireGroups_/2] & 0x0000FFFF;
70 theWGroupsBX_= (wgroups[nWireGroups_/2] >> 16)& 0x0000FFFF;
76 ADCContainer
tmp(adcs);
77 nTimeBins_=
tmp.size()/nStrips_;
79 for (
unsigned int i=0;
i<nStrips_;
i++)
80 for (
unsigned int j=0;
j<nTimeBins_;
j++) {
81 theADCs_[
i*MAXTIMEBINS+
j]=
tmp[
k];
86 CSCRecHit2D::~CSCRecHit2D() {}
93 CSCRecHit2D::SharedInputType cscWhat =
static_cast<CSCRecHit2D::SharedInputType
>(what);
94 return sharesInput(other, cscWhat);
97 bool CSCRecHit2D::sharesInput(
const TrackingRecHit *other, CSCRecHit2D::SharedInputType what)
const {
105 return sharesInput(otherRecHit, what);
109 bool CSCRecHit2D::sharesInput(
const CSCRecHit2D *otherRecHit, CSCRecHit2D::SharedInputType what)
const {
112 if (geographicalId() != otherRecHit->geographicalId())
return false;
115 if (nStrips() == 0 && otherRecHit->nStrips() == 0 && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0)
return true;
116 if ((what == allWires || what == someWires) && nWireGroups() == 0 && otherRecHit->nWireGroups() == 0)
return true;
117 if ((what == allStrips || what == someStrips) && nStrips() == 0 && otherRecHit->nStrips() == 0)
return true;
120 if ((what ==
all || what == allWires) && nWireGroups() != otherRecHit->nWireGroups())
return false;
123 if ((what ==
all || what == allStrips) && nStrips() != otherRecHit->nStrips())
return false;
125 bool foundWire =
false;
127 if (what != allStrips && what != someStrips) {
129 if ( hitWire() != otherRecHit->hitWire() )
return false;
133 bool foundStrip =
false;
134 if (what != allWires && what != someWires) {
135 for (
unsigned int i=0;
i< nStrips();
i++) {
137 for (
unsigned int j=0;
j< nStrips();
j++) {
139 if(cscDetId().channel(channels(
i))==otherRecHit->cscDetId().channel(otherRecHit->channels(
j))){
140 if (what == some || what == someStrips)
return true;
148 if ((what ==
all || what == allStrips) && !
found)
return false;
150 if (what == someStrips && !foundStrip)
return false;
154 if (!foundWire && !foundStrip)
return false;
166 std::cout <<
"CSCRecHit in CSC Detector: " << cscDetId() << std::endl;
167 std::cout <<
" local x = " << localPosition().x() <<
" +/- " <<
sqrt( localPositionError().xx() ) <<
" y = " << localPosition().y() <<
" +/- " <<
sqrt( localPositionError().yy() ) << std::endl;
169 std::cout <<
" tpeak " << theTpeak <<
" psoInStrip " << thePositionWithinStrip <<
" errorinstrip " << theErrorWithinStrip <<
" " <<
" qual " << theQuality <<
" wiretime " << theScaledWireTime <<
" tbs " << theBadStrip <<
" bwg " << theBadWireGroup << std::endl;
172 for (
unsigned int i=0;
i<nStrips();
i++) {
std::cout << std::dec << channels(
i) <<
" "
173 <<
" (" <<
"HEX: " << std::hex << channels(
i) <<
")" <<
" ";
180 for (
int i=0;
i<(int)nStrips();
i++) {
182 for (
int k=0; k<8 ; k++){
183 std::cout << ((channelsl1a(i) >> (15-
k)) & 0x1) <<
" ";}
188 std::cout <<
"nWireGroups " << (int)nWireGroups() <<
" central wire " << hitWire_ <<std::endl;
193 os <<
"CSCRecHit2D: " <<
194 "local x: " << rh.localPosition().x() <<
" +/- " <<
sqrt( rh.localPositionError().xx() ) <<
195 " y: " << rh.localPosition().y() <<
" +/- " <<
sqrt( rh.localPositionError().yy() ) <<
196 " in strip X: " << rh.positionWithinStrip() <<
" +/- " << rh.errorWithinStrip() <<
197 " quality: " << rh.quality() <<
" tpeak: " << rh.tpeak() <<
" wireTime: " << rh.wireTime() << std::endl;
199 for(
size_t iS =0;iS< rh.nStrips();++iS){
200 os <<rh.channels(iS)<<
" ";
202 int nwgs = rh.nWireGroups();
204 os <<
"central wire: " << rh.hitWire() <<
" of " << nwgs <<
" wiregroup" << std::endl; }
206 os <<
"central wire: " << rh.hitWire() <<
" of " << nwgs <<
" wiregroups" << std::endl; }
SharedInputType
definition of equality via shared input
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
std::ostream & operator<<(std::ostream &out, const ALILine &li)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
std::vector< std::vector< double > > tmp
DetId geographicalId() const