Skip to content
Snippets Groups Projects
Commit 6a6f8838 authored by Joseph Boudreau's avatar Joseph Boudreau
Browse files

Merge branch 'splitAlignment' into 'main'

Add support for split modules in alignment

See merge request !260
parents 9f02b6d2 204bf317
Branches
Tags
1 merge request!260Add support for split modules in alignment
Pipeline #6880729 passed with warnings
Showing with 132 additions and 12 deletions
......@@ -67,7 +67,7 @@ void GmxInterface::addSensor(const string& name, map<string, int> &index, int se
void GmxInterface::addSplitSensor(const string& name, map<string, int> &index, std::pair<std::string, int> &extraIndex, int sequentialId, GeoVFullPhysVol *fpv,int splitLevel) {
std::stringstream idString;
msglog << MSG::DEBUG << "GmxInterface::addSensor called for " << fpv->getLogVol()->getName() << ", type " << name <<
msglog << MSG::DEBUG << "GmxInterface::addSplitSensor called for " << fpv->getLogVol()->getName() << ", type " << name <<
". Indices: ";
for (map<string, int>::iterator i = index.begin(); i != index.end(); ++i) {
msglog << i->second << " ";
......@@ -111,7 +111,7 @@ void GmxInterface::addSplitAlignable(int level, map<std::string, int> &index, st
std::stringstream idString;
// debug message
msglog << MSG::DEBUG
<< "GmxInterface::addAlignable called for a physvol. Logvol name "
<< "GmxInterface::addSplitAlignable called for a physvol. Logvol name "
<< fpv->getLogVol()->getName() << ". Level = " << level << ". Indices: ";
for (map<string, int>::iterator i = index.begin(); i != index.end(); ++i) {
msglog << i->second << " ";
......
......@@ -295,7 +295,6 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
XMLString::release(&splitLevel_tmp);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
......@@ -303,6 +302,7 @@ void LogvolProcessor::process(const DOMElement *element, GmxUtil &gmxUtil, GeoNo
}
}
else gmxUtil.gmxInterface()->addSensor(sensitiveName, index, sensId, dynamic_cast<GeoVFullPhysVol *> (pv));
XMLString::release(&splitLevel_tmp);
}
}
else {
......
......@@ -242,10 +242,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -261,10 +261,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,(GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -237,10 +237,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,(GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -255,10 +255,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,(GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -238,10 +238,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,(GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -239,10 +239,27 @@ DOMDocument *doc = element->getOwnerDocument();
gmxUtil.positionIndex.incrementLevel(); // Logvol has unfortunately already decremented this; temp. restore it
gmxUtil.positionIndex.indices(index, gmxUtil.eval);
gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,(GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index, (GeoVFullPhysVol *) toAdd[lastTransform + 3],
(GeoAlignableTransform *) toAdd[lastTransform]);
gmxUtil.positionIndex.decrementLevel(); // Put it back where it was
index.clear();
XMLString::release(&splitLevel_tmp);
}
}
......
......@@ -81,7 +81,25 @@ char *tagName;
//now check that the AlignableTransform is actually valid!
GeoAlignableTransform * gat = dynamic_cast<GeoAlignableTransform *>(toAdd.back());
if(fpv && gat) gmxUtil.gmxInterface()->addAlignable(level, index,fpv,gat);
if(fpv && gat) {
//splitting sensors where we would like multiple DetectorElements per GeoVFullPhysVol (e.g.ITk Strips)
XMLCh * splitLevel_tmp = XMLString::transcode("splitLevel");
bool split = element->hasAttribute(splitLevel_tmp);
char* splitString;
int splitLevel = 1;
if (split) {
splitString = XMLString::transcode(element->getAttribute(splitLevel_tmp));
splitLevel = gmxUtil.evaluate(splitString);
XMLString::release(&splitString);
for(int i=0;i<splitLevel;i++){
std::string field = "eta_module";//eventually specify in Xml the field to split in?
std::pair<std::string,int> extraIndex(field,i);
gmxUtil.gmxInterface()->addSplitAlignable(level, index, extraIndex,fpv,gat);
}
}
else gmxUtil.gmxInterface()->addAlignable(level, index,fpv,gat);
XMLString::release(&splitLevel_tmp);
}
else{
std::cout<<"WARNING:";
if(!gat) std::cout<<" No valid AlignableTransform";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment