PlexusReroot Class Reference

#include <PlexusReroot.h>

Inheritance diagram for PlexusReroot:
Plexus PlexusABC

List of all members.

Public Member Functions

virtual RawChannelId GetRawChannelId (const PlexStripEndId &pseid) const
virtual RawChannelId GetRawChannelId (const PlexPixelSpotId &psid) const
virtual RawChannelId GetRawChannelId (const PlexPinDiodeId &diodeid) const
virtual PlexPinDiodeId GetPinDiodeId (const RawChannelId &rcid) const
virtual PlexSEIdAltL GetSEIdAltL (const RawChannelId &rcid, const PlexCalib *calib=0, Int_t adc=0, Double_t time=0) const
virtual ReadoutType::Readout_t GetReadoutType (const RawChannelId &rcid) const
 PlexusReroot ()

Protected Member Functions

 PlexusReroot (const VldContext &vldc)
virtual ~PlexusReroot ()
virtual void BuildPixelMaps (const VldContext &vldc) const
virtual void BuildReadoutMap (const VldContext &vldc) const
virtual void BuildPinDiodeMap (const VldContext &vldc) const

Private Member Functions

 PlexusReroot (const PlexusReroot &tf)
PlexusRerootoperator= (const PlexusReroot &tf)
void BuildPermute (const Int_t steelpln) const

Static Private Member Functions

static void MangleFakeCrate (const Int_t plane, const Int_t pixel, const StripEnd::StripEnd_t end, Int_t &crate, Int_t &subcrate)
static void DemangleFakeCrate (const Int_t crate, Int_t subcrate, Int_t &plane, Int_t &pixel, StripEnd::StripEnd_t &end)

Private Attributes

TString fActvNameStrip2Pixel
Int_t fNStrips
 plane type for the following:
Int_t * fStripToPixelModulo
 # of non-zero length strips
Int_t * fStripToPixelPermute
 [fNStrips] map strip-to-pixel unpermuted

Friends

class PlexLoanPool

Detailed Description

Definition at line 18 of file PlexusReroot.h.


Constructor & Destructor Documentation

PlexusReroot::PlexusReroot (  ) 

Definition at line 26 of file PlexusReroot.cxx.

References RerootExodus::BuildVldRange(), Msg::kVerbose, and MSG.

00027    : Plexus(), fNStrips(0), fStripToPixelModulo(0), fStripToPixelPermute(0)
00028 {
00029    // Default constructor
00030 
00031    MSG("Plex",Msg::kVerbose) << "default ctor" << endl;
00032 
00033    fVldRange = RerootExodus::BuildVldRange();
00034 }

PlexusReroot::PlexusReroot ( const VldContext vldc  )  [protected]

Definition at line 37 of file PlexusReroot.cxx.

References RerootExodus::BuildVldRange(), Plexus::fVldRange, Msg::kInfo, and MSG.

00038    : Plexus(), fNStrips(0), fStripToPixelModulo(0), fStripToPixelPermute(0)
00039 {
00040    // normal constructor
00041 
00042    MSG("Plex",Msg::kInfo) << " PlexusReroot vldc ctor " << endl;
00043 
00044    fVldRange = RerootExodus::BuildVldRange();
00045 }

PlexusReroot::~PlexusReroot (  )  [protected, virtual]

Definition at line 48 of file PlexusReroot.cxx.

References fStripToPixelModulo, and fStripToPixelPermute.

00049 {
00050    // delete all the owned sub-objects
00051 
00052    delete [] fStripToPixelModulo;
00053    delete [] fStripToPixelPermute;
00054 
00055 }

PlexusReroot::PlexusReroot ( const PlexusReroot tf  )  [private]

Member Function Documentation

void PlexusReroot::BuildPermute ( const Int_t  steelpln  )  const [private]

Definition at line 244 of file PlexusReroot.cxx.

References RerootExodus::ActvPlaneName(), fActvNameStrip2Pixel, fNStrips, fStripToPixelModulo, fStripToPixelPermute, DataUtil::GetDetector(), Detector::kFar, Detector::kNear, RerootExodus::NStripsNonZero(), and RerootExodus::SteelToRerootPlane().

Referenced by GetRawChannelId(), and GetSEIdAltL().

00245 {
00246    // Build the permutation scheme for a given plane
00247 
00248    Int_t rpln = RerootExodus::SteelToRerootPlane(steelpln);
00249    TString reqtype = RerootExodus::ActvPlaneName(rpln);
00250 
00251    // if this map is already there simply return
00252    if (reqtype == fActvNameStrip2Pixel) return;
00253 
00254    // clear what exists
00255    delete [] fStripToPixelModulo;
00256    delete [] fStripToPixelPermute;
00257 
00258    // build the map
00259    fActvNameStrip2Pixel = reqtype;
00260    fNStrips = RerootExodus::NStripsNonZero(rpln);
00261    
00262    fStripToPixelModulo  = new Int_t [fNStrips];
00263    fStripToPixelPermute = new Int_t [fNStrips];
00264 
00265    // far detector has 192 strips, near has 64 or 96 strips per plane
00266 
00267    Int_t nstrip_swath = 1;
00268    Detector::Detector_t detector = RerootExodus::GetDetector();
00269    switch (detector) {
00270    case Detector::kNear:  nstrip_swath = 24; break;
00271    case Detector::kFar:   nstrip_swath = 24; break;
00272    default: nstrip_swath = 1;
00273    }
00274       
00275    Int_t ioff1 = 1;
00276    for (Int_t strip = 0; strip < fNStrips; strip++) {
00277       Int_t swath   = strip/nstrip_swath;
00278       Int_t inswath = strip%nstrip_swath;
00279       Int_t ioff    = swath*ioff1;
00280       Int_t permute = (strip+ioff)%nstrip_swath;
00281 
00282       fStripToPixelModulo[strip]  = inswath;
00283       fStripToPixelPermute[strip] = permute;
00284       
00285       //      MSG("Plex",Msg::kInfo) << 
00286       //         " strip "   << setw(3) << strip   <<
00287       //         " modulo "  << setw(3) << inswath << 
00288       //         " permute " << setw(3) << permute << endl;
00289 
00290       //      MSG("Plex",Msg::kInfo) << 
00291       //         " strip "   << strip   <<
00292       //         " modulo "  << inswath << 
00293       //         " permute " << permute << endl;
00294    }
00295 
00296 }

void PlexusReroot::BuildPinDiodeMap ( const VldContext vldc  )  const [protected, virtual]

Reimplemented from Plexus.

Definition at line 390 of file PlexusReroot.cxx.

References Plexus::fVldRange, Msg::kInfo, MSG, and VldRange::Print().

00391 { 
00392    // build the basic maps   RawChannel --> PinDiode
00393 
00394    MSG("Plex",Msg::kInfo) << "PlexusReroot::BuildPinDiodeMap " << endl;
00395    fVldRange.Print();
00396    return;
00397 }

void PlexusReroot::BuildPixelMaps ( const VldContext vldc  )  const [protected, virtual]

Reimplemented from Plexus.

Definition at line 370 of file PlexusReroot.cxx.

References Plexus::fVldRange, Msg::kInfo, MSG, and VldRange::Print().

00371 { 
00372    // build the basic maps   RawChannel <--> PixeSpot <--> StripEnd
00373 
00374    MSG("Plex",Msg::kInfo) << "PlexusReroot::BuildPixelMaps " << endl;
00375    fVldRange.Print();
00376    return;
00377 }

void PlexusReroot::BuildReadoutMap ( const VldContext vldc  )  const [protected, virtual]

Reimplemented from Plexus.

Definition at line 380 of file PlexusReroot.cxx.

References Plexus::fVldRange, Msg::kInfo, MSG, and VldRange::Print().

00381 { 
00382    // build the basic map   RawChannel --> ReadoutType
00383 
00384    MSG("Plex",Msg::kInfo) << "PlexusReroot::BuildReadoutMap " << endl;
00385    fVldRange.Print();
00386    return;
00387 }

void PlexusReroot::DemangleFakeCrate ( const Int_t  crate,
Int_t  subcrate,
Int_t &  plane,
Int_t &  pixel,
StripEnd::StripEnd_t end 
) [static, private]

Definition at line 340 of file PlexusReroot.cxx.

References StripEnd::kNegative, and StripEnd::kPositive.

Referenced by GetSEIdAltL().

00343 {
00344 
00345    const Int_t mask13 = 0x1fff;
00346    const Int_t mask10 = 0x03ff;
00347    //const Int_t mask2  = 0x0003;
00348    const Int_t mask1  = 0x0001;
00349    const Int_t mask8  = 0x00ff;
00350    const Int_t mask6  = 0x003f;
00351 
00352    Int_t bits = ((crate & mask6) << 13 ) | (chadd & mask13);
00353 
00354    // remove hole from bit 4
00355    const Int_t low4   = 0x0000f;
00356    const Int_t high16 = 0xffff0 << 1;
00357    Int_t bitstmp = ((bits & high16) >> 1) | ( bits & low4 );
00358    //cout << " remove hole: 0x" << hex << bits << " -> 0x" << bitstmp << dec 
00359    //     << endl;
00360    bits = bitstmp;
00361 
00362    plane =    (bits >>  9) & mask10;
00363    //Int_t tmp   =    (bits >>  8) & mask1;
00364    //end   = (StripEnd::StripEnd_t)tmp;
00365    end = ((bits>>8)&mask1) ? StripEnd::kNegative : StripEnd::kPositive;
00366    pixel =     bits        & mask8;
00367 }

PlexPinDiodeId PlexusReroot::GetPinDiodeId ( const RawChannelId rcid  )  const [virtual]

Reimplemented from Plexus.

Definition at line 149 of file PlexusReroot.cxx.

References Msg::kError, and MSG.

00150 {
00151    // Convert RawChannelId into PlexPinDiodeId (if possible)
00152    // not supported under Reroot
00153    MSG("Exodus",Msg::kError)
00154      << "GetPinDiodeId(RawChannelId) not supported: "
00155      << rcid << endl;
00156    return PlexPinDiodeId();
00157 }

RawChannelId PlexusReroot::GetRawChannelId ( const PlexPinDiodeId diodeid  )  const [virtual]

Reimplemented from Plexus.

Definition at line 138 of file PlexusReroot.cxx.

References Msg::kError, and MSG.

00139 {
00140    // Convert PlexPinDiodeId into a RawChannelId
00141    // not supported under Reroot
00142    MSG("Exodus",Msg::kError)
00143      << "GetRawChannelId(PlexPinDiodeId) not supported: "
00144      << diodeid << endl;
00145    return RawChannelId();
00146 }

RawChannelId PlexusReroot::GetRawChannelId ( const PlexPixelSpotId psid  )  const [virtual]

Reimplemented from Plexus.

Definition at line 127 of file PlexusReroot.cxx.

References Msg::kError, and MSG.

00128 {
00129    // Convert PlexPixelSpotId into a RawChannelId
00130    // not supported under Reroot
00131    MSG("Exodus",Msg::kError)
00132      << "GetRawChannelId(PlexPixelSpotId) not supported: "
00133      << psid << endl;
00134    return RawChannelId();
00135 }

RawChannelId PlexusReroot::GetRawChannelId ( const PlexStripEndId pseid  )  const [virtual]

Reimplemented from Plexus.

Definition at line 58 of file PlexusReroot.cxx.

References bfld::AsString(), PlexStripEndId::AsString(), BuildPermute(), fActvNameStrip2Pixel, fNStrips, fStripToPixelModulo, fStripToPixelPermute, PlexPlaneId::GetDetector(), PlexStripEndId::GetEnd(), PlexPlaneId::GetPlane(), PlexStripEndId::GetStrip(), Detector::kCalDet, StripEnd::kEast, Msg::kFatal, Detector::kNear, ElecType::kReroot, StripEnd::kWest, MangleFakeCrate(), and MSG.

00059 {
00060    // Convert PlexStripEndId into RawChannelId (m:1 mapping)
00061 
00062    // Choose a particular mapping
00063    // Assume that the "modulo" side is always on the West
00064    // and the permute side is on the East
00065    // (this keeps one-sided near spectrometer as "modulo")
00066 
00067    BuildPermute(pseid.GetPlane());
00068 
00069    ElecType::Elec_t elec = ElecType::kReroot;
00070    Int_t crate = -1;
00071    Int_t chadd = -1;
00072 
00073    Int_t plane = pseid.GetPlane();
00074    Int_t strip = pseid.GetStrip();
00075    StripEnd::StripEnd_t end = pseid.GetEnd();
00076    Int_t pixel;
00077 
00078    // map strip to pixel depending on the side
00079    switch (end) {
00080    case StripEnd::kEast:
00081       pixel = fStripToPixelPermute[strip];
00082       break;
00083    case StripEnd::kWest:
00084       pixel = fStripToPixelModulo[strip];
00085       break;
00086    default:
00087       pixel = -1;
00088       // dump out message
00089       MSG("Plex",Msg::kFatal) 
00090          << "PlexusExodus::GetRawChannelId(seid) illegal side " 
00091          << StripEnd::AsString(pseid.GetEnd()) << endl;
00092    }
00093 
00094    // special cases
00095 
00096    Detector::Detector_t detector = pseid.GetDetector();
00097 
00098    // near detector calorimeter has no MUX
00099    if (Detector::kNear == detector) {
00100       if ( pseid.GetPlane() <= 120 ) {
00101          pixel = strip;
00102       }
00103    }
00104 
00105    // calibration detector (CalDet) has no MUX
00106    if (Detector::kCalDet == detector) {
00107       pixel = strip;
00108    }
00109 
00110    // illegal strip
00111    if ( strip >= fNStrips ) {
00112       pixel = -1;
00113       // dump out message
00114       MSG("Plex",Msg::kFatal) 
00115          << "PlexusExodus::GetRawChannelId(seid) illegal strip # "
00116          << pseid.AsString() << " in " << fActvNameStrip2Pixel 
00117          << " which has " << fNStrips << " strips " << endl;
00118    }
00119 
00120    MangleFakeCrate(plane,pixel,end,crate,chadd);
00121    
00122    return RawChannelId(detector,elec,crate,chadd);
00123    
00124 }

ReadoutType::Readout_t PlexusReroot::GetReadoutType ( const RawChannelId rcid  )  const [virtual]

Reimplemented from Plexus.

Definition at line 231 of file PlexusReroot.cxx.

References ReadoutType::kScintStrip, Msg::kVerbose, and MSG.

00232 { 
00233    // Determine what (eg. scint strip, pin diode, cerenkov, tof) 
00234    // is attached to raw channel
00235 
00236    MSG("Exodus",Msg::kVerbose)
00237      << "GetReadoutType(RawChannelId) always returns kScintStrip " 
00238      << rcid
00239      << endl;
00240    return ReadoutType::kScintStrip;  // for now there isn't anything but
00241 }

PlexSEIdAltL PlexusReroot::GetSEIdAltL ( const RawChannelId rcid,
const PlexCalib calib = 0,
Int_t  adc = 0,
Double_t  time = 0 
) const [virtual]

Reimplemented from Plexus.

Definition at line 160 of file PlexusReroot.cxx.

References PlexSEIdAltL::AddStripEndId(), BuildPermute(), DemangleFakeCrate(), fNStrips, fStripToPixelModulo, fStripToPixelPermute, RawChannelId::GetChAdd(), RawChannelId::GetCrate(), PlexPlaneId::GetDetector(), Detector::kCalDet, StripEnd::kEast, Detector::kNear, StripEnd::kUnknown, StripEnd::kWest, RerootExodus::PECAB2SEId(), PlexStripEndId::SetEnd(), PlexStripEndId::SetStrip(), and RerootExodus::SteelToRerootPlane().

00163 {
00164    // Convert RawChannelId into PlexStripEndId Alternative List (1:m mapping)
00165 
00166    Int_t plane = -1;
00167    StripEnd::StripEnd_t end = StripEnd::kUnknown;
00168    Int_t pixel = -1;
00169 
00170    DemangleFakeCrate(rcid.GetCrate(),rcid.GetChAdd(),plane,pixel,end);
00171 
00172    // build a base SEId that has view&coverage correctly set
00173    // but just setting plane # (detector determined from Reroot event)
00174    Int_t rpln = RerootExodus::SteelToRerootPlane(plane,kTRUE);
00175    PlexStripEndId pseid_base = RerootExodus::PECAB2SEId(rpln,0,0,0);
00176    Detector::Detector_t detector = pseid_base.GetDetector();
00177 
00178    // Build the permutation lists
00179    BuildPermute(plane);
00180 
00181    PlexSEIdAltL   altlist;
00182    
00183    // special cases
00184 
00185    // near detector calorimeter has no MUX
00186    if ( Detector::kNear == detector && plane < 121 ) {
00187       Int_t strip = pixel;
00188       pseid_base.SetStrip(strip);
00189       pseid_base.SetEnd(end);
00190       PlexPixelSpotId spotid;
00191       altlist.AddStripEndId(pseid_base,spotid,0,calib,adc,time);
00192       return altlist;
00193    }
00194 
00195    // calibration detector (CalDet) has no MUX
00196    if ( Detector::kCalDet == detector ) {
00197       Int_t strip = pixel;
00198       pseid_base.SetStrip(strip);
00199       pseid_base.SetEnd(end);
00200       PlexPixelSpotId spotid;
00201       altlist.AddStripEndId(pseid_base,spotid,0,calib,adc,time);
00202       return altlist;
00203    }
00204 
00205    for (Int_t strip = 0; strip < fNStrips; strip++) {
00206       Bool_t test = kFALSE;
00207       switch ( end ) {
00208       case StripEnd::kWest:  
00209          if ( pixel == fStripToPixelModulo[strip] )  test = kTRUE;
00210          break;
00211       case StripEnd::kEast:
00212          if ( pixel == fStripToPixelPermute[strip] ) test = kTRUE;
00213          break;
00214       default:
00215          break;
00216       }
00217       if (test) {
00218          pseid_base.SetStrip(strip);
00219          pseid_base.SetEnd(end);
00220          PlexPixelSpotId spotid;
00221          altlist.AddStripEndId(pseid_base,spotid,0,calib,adc,time);
00222       }
00223    }
00224 
00225    return altlist;
00226 
00227 
00228 }

void PlexusReroot::MangleFakeCrate ( const Int_t  plane,
const Int_t  pixel,
const StripEnd::StripEnd_t  end,
Int_t &  crate,
Int_t &  subcrate 
) [static, private]

Definition at line 299 of file PlexusReroot.cxx.

Referenced by GetRawChannelId().

00302 {
00303    // chadd can only be 13 bits for raw block packing
00304    // crate can only be  6 bits for RawChannelId
00305 
00306    // mangle the bits (plane#,end#,pixel#) around some more 
00307    // to form (crate,chadd)
00308    // allow 10 bits for plane #  0:1023
00309    //        1 bits for end #    0:1  (map 1->1, 2->0)
00310    //        8 bits for pixel #  0:255
00311    // then take apart into (crate,chadd) of (8,13) bits
00312 
00313    // avoid bit 4 as this gets eaten by QIE electronics
00314 
00315    const Int_t mask13 = 0x1fff;
00316    const Int_t mask10 = 0x03ff;
00317    //const Int_t mask2  = 0x0003;
00318    const Int_t mask1  = 0x0001;
00319    const Int_t mask8  = 0x00ff;
00320    const Int_t mask6  = 0x003f;
00321    
00322    Int_t bits = ((plane    & mask10) <<  9) |
00323                 ((end      & mask1)  <<  8) | 
00324                  (pixel    & mask8);
00325 
00326    // create a hole for bit 4
00327    const Int_t low4   = 0x0000f;
00328    const Int_t high16 = 0xffff0;
00329    Int_t bitstmp = ((bits & high16) << 1) | ( bits & low4 );
00330    //cout << " create hole: 0x" << hex << bits << " -> 0x" << bitstmp << dec 
00331    //     << ((bitstmp>0x7ffff)?" too big":" ") 
00332    //     << (((bitstmp>>13)>mask6)?" crate overflow":" ")
00333    //     << endl ;
00334    bits = bitstmp;
00335 
00336    crate =    (bits >> 13) & mask6;
00337    chadd =     bits        & mask13;
00338 
00339 }

PlexusReroot& PlexusReroot::operator= ( const PlexusReroot tf  )  [private]

Friends And Related Function Documentation

friend class PlexLoanPool [friend]

Reimplemented from Plexus.

Definition at line 20 of file PlexusReroot.h.


Member Data Documentation

TString PlexusReroot::fActvNameStrip2Pixel [mutable, private]

Definition at line 72 of file PlexusReroot.h.

Referenced by BuildPermute(), and GetRawChannelId().

Int_t PlexusReroot::fNStrips [mutable, private]

plane type for the following:

Definition at line 73 of file PlexusReroot.h.

Referenced by BuildPermute(), GetRawChannelId(), and GetSEIdAltL().

Int_t* PlexusReroot::fStripToPixelModulo [mutable, private]

# of non-zero length strips

Definition at line 74 of file PlexusReroot.h.

Referenced by BuildPermute(), GetRawChannelId(), GetSEIdAltL(), and ~PlexusReroot().

Int_t* PlexusReroot::fStripToPixelPermute [mutable, private]

[fNStrips] map strip-to-pixel unpermuted

Definition at line 75 of file PlexusReroot.h.

Referenced by BuildPermute(), GetRawChannelId(), GetSEIdAltL(), and ~PlexusReroot().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1