@@ -98,26 +98,30 @@ struct HGCalSiliconRotatedCassette {
9898 edm::LogVerbatim (" HGCalGeom" ) << st1.str ();
9999 }
100100#endif
101- passiveFull_ = args.value <std::vector<std::string>>(" PassiveNamesFull" );
102- passivePart_ = args.value <std::vector<std::string>>(" PassiveNamesPartial" );
103- #ifdef EDM_ML_DEBUG
104- edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: " << passiveFull_.size () << " full and "
105- << passivePart_.size () << " partial passive modules" ;
106- i1max = static_cast <unsigned int >(passiveFull_.size ());
101+ passiveAbsorb_ = args.value <std::vector<std::string>>(" PassiveNamesFull" );
102+ passiveCool_ = args.value <std::vector<std::string>>(" PassiveNamesPartial" );
103+ if ((passiveAbsorb_.size () == 1 ) && (passiveAbsorb_[0 ] == " NULL" ))
104+ passiveAbsorb_.clear ();
105+ if ((passiveCool_.size () == 1 ) && (passiveCool_[0 ] == " NULL" ))
106+ passiveCool_.clear ();
107+ #ifdef EDM_ML_DEBUG
108+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: " << passiveAbsorb_.size () << " full and "
109+ << passiveCool_.size () << " partial passive modules" ;
110+ i1max = static_cast <unsigned int >(passiveAbsorb_.size ());
107111 for (unsigned int i1 = 0 ; i1 < i1max; i1 += 2 ) {
108112 std::ostringstream st1;
109113 unsigned int i2 = std::min ((i1 + 2 ), i1max);
110114 for (unsigned int i = i1; i < i2; ++i)
111- st1 << " [" << i << " ] " << passiveFull_ [i];
115+ st1 << " [" << i << " ] " << passiveAbsorb_ [i];
112116 edm::LogVerbatim (" HGCalGeom" ) << st1.str ();
113117 }
114118 edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: Partial Modules:" ;
115- i1max = static_cast <unsigned int >(passivePart_ .size ());
119+ i1max = static_cast <unsigned int >(passiveCool_ .size ());
116120 for (unsigned int i1 = 0 ; i1 < i1max; i1 += 2 ) {
117121 std::ostringstream st1;
118122 unsigned int i2 = std::min ((i1 + 2 ), i1max);
119123 for (unsigned int i = i1; i < i2; ++i)
120- st1 << " [" << i << " ] " << passivePart_ [i];
124+ st1 << " [" << i << " ] " << passiveCool_ [i];
121125 edm::LogVerbatim (" HGCalGeom" ) << st1.str ();
122126 }
123127#endif
@@ -226,6 +230,9 @@ struct HGCalSiliconRotatedCassette {
226230 int laymax = laymin + layers_[i];
227231 double zz = zi;
228232 double thickTot (0 );
233+ #ifdef EDM_ML_DEBUG
234+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: Section " << i << " Layers " << laymin << " :" << laymax << " zi " << cms::convert2mm (zi);
235+ #endif
229236 for (int ly = laymin; ly < laymax; ++ly) {
230237 int ii = layerType_[ly];
231238 int copy = copyNumber_[ii];
@@ -297,7 +304,10 @@ struct HGCalSiliconRotatedCassette {
297304 if (layerSense_[ly] > 0 ) {
298305 positionSensitive (ctxt, e, glog, (copy - firstLayer_));
299306 } else if (passiveMode_ > 0 ) {
300- positionPassive2 (ctxt, e, glog, (copy - firstLayer_), -layerSense_[ly]);
307+ unsigned int num = (-layerSense_[ly] <= waferTypes_) ? passiveAbsorb_.size () : passiveCool_.size ();
308+ if (num > 0 )
309+ positionPassiveNew (ctxt, e, glog, i, -layerSense_[ly]);
310+ // positionPassiveNew(ctxt, e, glog, (copy - firstLayer_), -layerSense_[ly]);
301311 } else {
302312 positionPassive (ctxt, e, glog, (copy - firstLayer_), -layerSense_[ly]);
303313 }
@@ -510,7 +520,7 @@ struct HGCalSiliconRotatedCassette {
510520 int i (999 );
511521 if (part == HGCalTypes::WaferFull) {
512522 i = absType - 1 ;
513- passive = passiveFull_ [i];
523+ passive = passiveAbsorb_ [i];
514524#ifdef EDM_ML_DEBUG
515525 edm::LogVerbatim (" HGCalGeom" ) << " layertype:abstype:part:orien:cassette:offsets:ind " << layertype << " :"
516526 << absType << " :" << part << " :" << orien << " :" << cassette << " :"
@@ -527,9 +537,9 @@ struct HGCalSiliconRotatedCassette {
527537 edm::LogVerbatim (" HGCalGeom" ) << " layertype:abstype:part:orien:cassette:3Types:offset:ind " << layertype << " :"
528538 << absType << " :" << part << " :" << orien << " :" << cassette << " :"
529539 << partialTypes_ << " :" << facingTypes_ << " :" << orientationTypes_ << " :"
530- << partoffset << " :" << i << " :" << passivePart_ .size ();
540+ << partoffset << " :" << i << " :" << passiveCool_ .size ();
531541#endif
532- passive = passivePart_ [i];
542+ passive = passiveCool_ [i];
533543 }
534544 int copy = HGCalTypes::packTypeUV (absType, u, v);
535545#ifdef EDM_ML_DEBUG
@@ -560,37 +570,37 @@ struct HGCalSiliconRotatedCassette {
560570 }
561571
562572 // Position the passive modules (mode > 0)
563- void positionPassive2 (cms::DDParsingContext& ctxt, xml_h e, const dd4hep::Volume& glog, int layer, int absType) {
573+ void positionPassiveNew (cms::DDParsingContext& ctxt, xml_h e, const dd4hep::Volume& glog, int layer, int absType) {
564574 cms::DDNamespace ns (ctxt, e, true );
565575#ifdef EDM_ML_DEBUG
566- edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: positionPassive2 is called" ;
576+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: positionPassiveNew is called" ;
567577 int kount (0 );
578+ #endif
579+ bool type = (absType <= waferTypes_);
580+ int num = type ? (passiveAbsorb_.size () / (cassettes_ * layers_.size ()))
581+ : (passiveCool_.size () / (cassettes_ * layers_.size ()));
582+ #ifdef EDM_ML_DEBUG
583+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: Type " << type << " number per cassette " << num;
568584#endif
569585 for (int k = 0 ; k < cassettes_; ++k) {
570- int cassette = k + 1 ;
571- auto cshift = cassette_.getShift (layer + 1 , -1 , cassette);
572- double xpos = -cshift.first ;
573- double ypos = cshift.second ;
574- int i = layer * cassettes_ + k;
586+ double xpos (0 ), ypos (0 );
587+ for (int n = 0 ; n < num; ++n) {
588+ int i1 = num * k + n;
589+ int i2 = num * layer * cassettes_ + i1;
575590#ifdef EDM_ML_DEBUG
576- edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette::Passive2: layer " << layer + 1 << " cassette "
577- << cassette << " Shift " << cms::convert2mm (cshift.first ) << " :"
578- << cms::convert2mm (cshift.second ) << " PassiveIndex " << i << " :"
579- << passiveFull_.size () << " :" << passivePart_.size ();
591+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette::Passive2: layer " << layer + 1 << " cassette " << " PassiveIndex " << i1 << " :" << i2 << " :" << passiveAbsorb_.size () << " :" << passiveCool_.size ();
580592#endif
581- std::string passive = (absType <= waferTypes_ ) ? passiveFull_[i ] : passivePart_[i ];
593+ std::string passive = (type ) ? passiveAbsorb_[i2 ] : passiveCool_[i2 ];
582594#ifdef EDM_ML_DEBUG
583- edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: Passive2 " << passive << " number " << cassette
584- << " pos " << cms::convert2mm (xpos) << " :" << cms::convert2mm (ypos);
585- kount++;
595+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette::Passive2 " << passive << " number " << i2 << " pos " << cms::convert2mm (xpos) << " :" << cms::convert2mm (ypos) << " :0" ;
596+ kount++;
586597#endif
587- dd4hep::Position tran (xpos, ypos, 0.0 );
588- glog.placeVolume (ns.volume (passive), cassette , tran);
598+ dd4hep::Position tran (xpos, ypos, 0.0 );
599+ glog.placeVolume (ns.volume (passive), i2 , tran);
589600#ifdef EDM_ML_DEBUG
590- edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: " << passive << " number " << cassette
591- << " positioned in " << glog.name () << " at (" << cms::convert2mm (xpos) << " ,"
592- << cms::convert2mm (ypos) << " ,0) with no rotation" ;
601+ edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: " << passive << " number " << i2 << " positioned in " << glog.name () << " at (" << cms::convert2mm (xpos) << " ," << cms::convert2mm (ypos) << " ,0) with no rotation" ;
593602#endif
603+ }
594604 }
595605#ifdef EDM_ML_DEBUG
596606 edm::LogVerbatim (" HGCalGeom" ) << " DDHGCalSiliconRotatedCassette: " << kount << " passives of type " << absType
@@ -620,8 +630,8 @@ struct HGCalSiliconRotatedCassette {
620630 std::string rotstr_; // Rotation matrix (if needed)
621631 std::vector<std::string> waferFull_; // Names of full wafer modules
622632 std::vector<std::string> waferPart_; // Names of partial wafer modules
623- std::vector<std::string> passiveFull_; // Names of full passive modules
624- std::vector<std::string> passivePart_ ; // Names of partial passive modules
633+ std::vector<std::string> passiveAbsorb_; // Names of full passive modules
634+ std::vector<std::string> passiveCool_ ; // Names of partial passive modules
625635 std::vector<std::string> materials_; // names of materials
626636 std::vector<std::string> names_; // Names of volumes
627637 std::vector<double > thick_; // Thickness of the material
0 commit comments