00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #include "Conventions/ReadoutType.h"
00013 #include "MessageService/MsgService.h"
00014 #include "Plex/PlexStripEndId.h"
00015
00016 #include "CalDetTracker/CDMapMaker.h"
00017
00018 CVSID("$Id: CDMapMaker.cxx,v 1.5 2003/10/12 19:41:31 cbs Exp $");
00019
00020
00021
00022 CDMapMaker::CDMapMaker()
00023 {
00024
00025 fcdlh=0;
00026 fcslh=0;
00027 }
00028
00029
00030
00031 CDMapMaker::CDMapMaker(CandDigitListHandle *cdlh)
00032 {
00033 if(!this->SetDigitList(cdlh)){
00034 MSG("CDMapMaker",Msg::kFatal)
00035 << "No Digit List" <<endl;
00036 }
00037 }
00038
00039
00040
00041 CDMapMaker::CDMapMaker(CandStripListHandle *cslh)
00042 {
00043 if(!this->SetStripList(cslh)){
00044 MSG("CDMapMaker",Msg::kFatal)
00045 << "No Strip List" <<endl;
00046 }
00047 }
00048
00049
00050
00051 map<int,CandDigitHandle> CDMapMaker::GetDigitMap()
00052 {
00053 map<int,CandDigitHandle> digitmap;
00054
00055
00056 if (fcdlh==0){
00057 MSG("CDMapMaker",Msg::kFatal)
00058 << "No digit list set" <<endl;
00059 return digitmap;
00060 }
00061
00062 TIter cdhItr(fcdlh->GetDaughterIterator());
00063 while (CandDigitHandle *digit=
00064 dynamic_cast<CandDigitHandle*>(cdhItr())){
00065
00066 int theKey = digit->GetPlexSEIdAltL().GetBestSEId().
00067 BuildPlnStripEndKey();
00068
00069 if(digit->GetChannelId().GetElecType()==ElecType::kQIE){
00070 MSG("CDMapMaker",Msg::kVerbose) << "Got a QIE digit" << std::endl;
00071 if(digitmap.find(theKey)==digitmap.end()) {
00072 digitmap[theKey] = *digit;
00073 }
00074 }
00075 else {
00076 digitmap[theKey] = *digit;
00077 }
00078 }
00079
00080 return digitmap;
00081 }
00082
00083
00084
00085 map<int,CandStripHandle> CDMapMaker::GetStripMap()
00086 {
00087
00088 map<int,CandStripHandle> stripmap;
00089
00090
00091 if (fcslh==0){
00092 MSG("CDMapMaker",Msg::kFatal)
00093 << "No strip list set" <<endl;
00094 return stripmap;
00095 }
00096
00097 TIter cshItr(fcslh->GetDaughterIterator());
00098
00099
00100 while (CandStripHandle *csh=dynamic_cast<CandStripHandle*>(cshItr())){
00101 int theKey = -1;
00102
00103 theKey=csh->GetStripEndId().Build18BitPlnStripKey();
00104
00105
00106 if (theKey!=-1) stripmap[theKey]=*csh;
00107 else MSG("CDTracker",Msg::kWarning)<<"Bad StripEndKey"<<endl;
00108 }
00109 return stripmap;
00110 }
00111
00112
00113
00114 int CDMapMaker::SetDigitList(CandDigitListHandle *cdlh)
00115 {
00116 if(cdlh!=0){
00117 fcdlh=cdlh;
00118 return 1;
00119 }
00120 else return 0;
00121 }
00122
00123
00124
00125 int CDMapMaker::SetStripList(CandStripListHandle *cslh)
00126 {
00127 if(cslh!=0){
00128 fcslh=cslh;
00129 return 1;
00130 }
00131 else return 0;
00132 }
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143