Skip to content

Commit

Permalink
Refs #8571 Fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
VickieLynch committed Dec 16, 2013
2 parents 2e8e7c3 + 58edeb1 commit 44727a1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
Expand Up @@ -31,6 +31,7 @@ namespace Crystal

/// Returns a confidence value that this algorithm can load a file
virtual int confidence(Kernel::FileDescriptor & descriptor) const;
int findPixelID(Geometry::Instrument_const_sptr inst, std::string bankName, int col, int row);

private:
/// Sets documentation strings for this algorithm
Expand Down
46 changes: 36 additions & 10 deletions Code/Mantid/Framework/Crystal/src/LoadIsawPeaks.cpp
Expand Up @@ -238,8 +238,9 @@ namespace Crystal
}

std::string SbankNum = boost::lexical_cast<std::string>(bankNum);

std::string bankName = "bank"+SbankNum;
std::string bankName = "bank";
if (instr->getName() == "WISH") bankName = "WISHpanel0";
bankName += SbankNum;
boost::shared_ptr<const Geometry::IComponent> bank =instr_old->getComponentByName( bankName );

if( !bank)
Expand All @@ -262,6 +263,8 @@ namespace Crystal
boost::shared_ptr< const Geometry::RectangularDetector>bankR= boost::dynamic_pointer_cast
<const Geometry::RectangularDetector>( bank);

if (!bankR)return startChar;

double DetWScale = 1, DetHtScale = 1;
if( bank)
{
Expand Down Expand Up @@ -431,15 +434,11 @@ namespace Crystal
// Find the detector ID from row/col
Instrument_const_sptr inst = outWS->getInstrument();
if (!inst) throw std::runtime_error("No instrument in PeaksWorkspace!");
IComponent_const_sptr bank = inst->getComponentByName(bankName);
if (!bank) throw std::runtime_error("Bank named " + bankName + " not found!");
RectangularDetector_const_sptr rect = boost::dynamic_pointer_cast<const RectangularDetector>(bank);
if (!rect) throw std::runtime_error("Bank named " + bankName + " is not a RectangularDetector!");
IDetector_sptr det = rect->getAtXY(int(col), int(row));
if (!det) throw std::runtime_error("Detector not found on " + bankName + "!");
LoadIsawPeaks u;
int pixelID = u.findPixelID(inst, bankName, static_cast<int>(col), static_cast<int>(row));

//Create the peak object
Peak peak(outWS->getInstrument(), det->getID(), wl);
Peak peak(outWS->getInstrument(), pixelID, wl);
// HKL's are flipped by -1 because of the internal Q convention
peak.setHKL(-h,-k,-l);
peak.setIntensity(Inti);
Expand All @@ -449,6 +448,31 @@ namespace Crystal
return peak;
}

int LoadIsawPeaks::findPixelID(Instrument_const_sptr inst, std::string bankName, int col, int row)
{
boost::shared_ptr<const IComponent> parent = inst->getComponentByName(bankName);
if (parent->type().compare("RectangularDetector") == 0)
{
boost::shared_ptr<const RectangularDetector> RDet = boost::dynamic_pointer_cast<
const RectangularDetector>(parent);

boost::shared_ptr<Detector> pixel = RDet->getAtXY(col, row);
return pixel->getID();
}
else
{
std::vector<Geometry::IComponent_const_sptr> children;
boost::shared_ptr<const Geometry::ICompAssembly> asmb = boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(parent);
asmb->getChildren(children, false);
int col0 = (col%2==0 ? col/2+75 : (col-1)/2);
boost::shared_ptr<const Geometry::ICompAssembly> asmb2 = boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(children[col0]);
std::vector<Geometry::IComponent_const_sptr> grandchildren;
asmb2->getChildren(grandchildren,false);
Geometry::IComponent_const_sptr first = grandchildren[row-1];
Geometry::IDetector_const_sptr det = boost::dynamic_pointer_cast<const Geometry::IDetector>(first);
return det->getID();
}
}


//-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -548,7 +572,9 @@ namespace Crystal


std::ostringstream oss;
oss << "bank" << bankNum;
std::string bankString = "bank";
if (outWS->getInstrument()->getName() == "WISH") bankString = "WISHpanel0";
oss << bankString << bankNum;
std::string bankName = oss.str();

int seqNum = -1;
Expand Down
6 changes: 4 additions & 2 deletions Code/Mantid/scripts/Reflectometry/isis_reflectometry/quick.py
Expand Up @@ -143,9 +143,11 @@ def quick_explicit(run, i0_monitor_index, lambda_min, lambda_max, background_mi
_monInt = Integration(InputWorkspace=_I0P,RangeLower=int_min,RangeUpper=int_max)
IvsLam = Divide(LHSWorkspace=_detector_ws,RHSWorkspace=_monInt)
names = mtd.getObjectNames()
IvsLam = transCorr(trans, IvsLam, lambda_min, lambda_max, background_min, background_max,
int_min, int_max, detector_index_ranges, i0_monitor_index)

IvsLam = transCorr(trans, IvsLam)
RenameWorkspace(InputWorkspace=IvsLam, OutputWorkspace="IvsLam") # TODO: Hardcoded names are bad


# Convert to I vs Q
# check if detector in direct beam
if (theta == 0 or theta == ''):
Expand Down

0 comments on commit 44727a1

Please sign in to comment.