Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 
002 #include "MuonGeoModel/Mdt.h"
003 #include "MuonGeoModel/MDT_Technology.h"
004 #include "MuonGeoModel/MYSQL.h"
005 #include "MuonGeoModel/MultiLayer.h"
006 #include "MuonGeoModel/MdtComponent.h"
007 #include "MuonGeoModel/Cutout.h"
008 #include "GeoModelKernel/GeoFullPhysVol.h"
009 #include "GeoModelKernel/GeoShape.h"
010 
011 #define verbose_mdt false
012 
013 namespace MuonGM {
014 
015 Mdt::Mdt(Component* ss, std::string lVName): DetectorElement(ss->name)
016 {
017    logVolName = lVName;
018    MdtComponent* s = (MdtComponent*)ss;
019    MDT* thism = (MDT*)(MYSQL::GetPointer()->GetTechnology(s->name));
020 
021    width = s->dx1;
022    longWidth = s->dx2;
023    thickness = s->GetThickness();
024    length = s->dy;
025    component = s;
026    component->cutoutTubeXShift = 0.;
027    layer = new MultiLayer(s->name);
028    layer->logVolName = lVName;
029    layer->cutoutNsteps = 0;
030    layer->width = width;
031    layer->longWidth = longWidth;
032    tubePitch = thism->pitch;
033    layer->length = length;
034    layer->nrOfTubes = (int)(layer->length/thism->pitch);
035    if (longWidth  > width) layer->nrOfSteps = int(length/s->tubelenStepSize);
036    tubelenStepSize = s->tubelenStepSize;
037    index = s->index;
038 }
039 
040 
041 Mdt::~Mdt()
042 {
043   delete layer;
044   layer = 0;
045 }
046     
047     
048 GeoFullPhysVol* Mdt::build()
049 {
050   layer->cutoutNsteps = 1;
051   return layer->build();
052 }
053 
054 
055 GeoFullPhysVol* Mdt::build(std::vector<Cutout*> vcutdef)
056 {
057   int Ncuts = vcutdef.size();
058   if (Ncuts > 0) {
059     if (verbose_mdt) std::cout << " mdt cutouts are on " << std::endl;
060     int cutoutNtubes[5];           // Number of tubes in sub-multilayer[i]
061     bool cutoutFullLength[5];      // True if this region is outside the cutout
062     double cutoutXtubes[5];        // Location of tube center within sub-ml[i] along x-amdb
063     double cutoutTubeLength[5];    // Tube length
064     double cutoutYmax[5];
065     for (int i = 0; i < 5; i++) {
066       cutoutNtubes[i] = 0;
067       cutoutFullLength[i] = true;
068       cutoutXtubes[i] = 0.;
069       cutoutTubeLength[i] = width;
070       cutoutYmax[i] = 0.;
071     }
072     
073     // Order cutouts by increasing dy    
074     for (int i = 0; i < Ncuts; i++) {
075       for (int j = i+1; j < Ncuts; j++) {
076         if (vcutdef[j]->dy < vcutdef[i]->dy) {
077           Cutout* c = vcutdef[i];
078           vcutdef[i] = vcutdef[j];
079           vcutdef[j] = c;
080         }
081       }
082     }
083 
084     // Set up cut location code 
085     double top = length - tubePitch/2.;
086     int cutLocationCode[3] = {0, 0, 0};
087     for (int i = 0; i < Ncuts; i++) {
088       if (vcutdef[i]->dy <= 0) cutLocationCode[i] = -1;
089       if (vcutdef[i]->dy + vcutdef[i]->lengthY >= top) cutLocationCode[i] = 1;
090     }
091 
092     // Calculate quantities needed by multilayer
093     double twidth;
094     double xmin;
095     double xmax;
096     int Nsteps = 0;
097     for (int i = 0; i < Ncuts; i++) {
098       Cutout* c = vcutdef[i];
099       twidth = width + (longWidth - width)*c->dy/length;
100       xmin = -twidth/2. < c->dx - c->widthXs/2. ? -twidth/2. : c->dx + c->widthXs/2.;
101       xmax = twidth/2. > c->dx + c->widthXs/2. ? twidth/2. : c->dx - c->widthXs/2.;
102       if (cutLocationCode[i] == -1) {
103         cutoutYmax[Nsteps] = c->lengthY;
104         cutoutTubeLength[Nsteps] = xmax - xmin; 
105         cutoutXtubes[Nsteps] = (xmax + xmin)/2.;
106         cutoutFullLength[Nsteps] = false;
107         Nsteps++;
108       } else if (cutLocationCode[i] == 1) {
109         cutoutYmax[Nsteps] = c->dy;
110         Nsteps++;
111         cutoutTubeLength[Nsteps] = xmax - xmin;
112         cutoutXtubes[Nsteps] = (xmax + xmin)/2.;
113         cutoutFullLength[Nsteps] = false;
114       } else {
115         cutoutYmax[Nsteps] = c->dy;
116         Nsteps++;
117         cutoutYmax[Nsteps] = c->dy + c->lengthY;
118         cutoutTubeLength[Nsteps] = xmax - xmin;
119         cutoutXtubes[Nsteps] = (xmax + xmin)/2.;
120         cutoutFullLength[Nsteps] = false;
121         Nsteps++;
122       }                                 
123     }
124     cutoutYmax[Nsteps] = top;
125     Nsteps++;
126 
127     double regionLength = 0.;
128     double low = 0.;
129     double tol = 6.0;     // Extra length to avoid trucation of tubes
130     int fullLengthCounter = 0;
131     int tubeCounter = 0;
132     for (int i = 0; i < Nsteps; i++) {
133       if (cutoutFullLength[i]) fullLengthCounter++;
134       regionLength = cutoutYmax[i] - low + tol;
135       cutoutNtubes[i] = int(regionLength/tubePitch);
136       if (fullLengthCounter > 1) cutoutNtubes[i]++;
137       low = cutoutYmax[i];
138       tubeCounter += cutoutNtubes[i];
139     }
140     if (tubeCounter > layer->nrOfTubes) --cutoutNtubes[Nsteps-1];
141 
142     if (verbose_mdt) for (int i = 0; i < Nsteps; i++) 
143       std::cout << " cutoutYmax[" << i << "] = " << cutoutYmax[i] 
144                 << " cutoutTubeLength[" << i << "] = " << cutoutTubeLength[i]
145                 << " cutoutXtubes[" << i << "] = " << cutoutXtubes[i]
146                 << " cutoutFullLength[" << i << "] = " << cutoutFullLength[i]
147                 << " cutoutNtubes[" << i << "] = " << cutoutNtubes[i]
148                 << std::endl; 
149 
150     // Pass information to multilayer and MdtComponent
151     layer->cutoutNsteps = Nsteps;
152     component->cutoutTubeXShift = 0.;
153     for (int i = 0; i < 5; i++) {
154       layer->cutoutNtubes[i] = cutoutNtubes[i];
155       layer->cutoutTubeLength[i] = cutoutTubeLength[i];
156       layer->cutoutFullLength[i] = cutoutFullLength[i];
157       layer->cutoutXtubes[i] = cutoutXtubes[i];
158       layer->cutoutYmax[i] = cutoutYmax[i];
159       if (!cutoutFullLength[i]) component->cutoutTubeXShift = cutoutXtubes[i];
160       // For now assume multiple cutouts have same width and take only the last value 
161     }
162     return layer->build();
163 
164   } else {        
165     return build();
166   }
167 }
168 
169 
170 void Mdt::print()
171 {
172   std::cout << "Mdt " << name.c_str() << " :" << std::endl;
173 }
174 
175 } // namespace MuonGM
176 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!