Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:27:44

0001 #include "Phase2OTtiltedBarrelLayer.h"
0002 
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 
0005 #include "DetGroupMerger.h"
0006 #include "CompatibleDetToGroupAdder.h"
0007 
0008 #include "TrackingTools/DetLayers/interface/DetLayerException.h"
0009 #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h"
0010 #include "TrackingTools/DetLayers/interface/CylinderBuilderFromDet.h"
0011 #include "Phase2EndcapLayerBuilder.h"
0012 
0013 using namespace std;
0014 
0015 typedef GeometricSearchDet::DetWithState DetWithState;
0016 
0017 Phase2OTtiltedBarrelLayer::Phase2OTtiltedBarrelLayer(std::vector<const Phase2OTBarrelRod*>& innerRods,
0018                                                      std::vector<const Phase2OTBarrelRod*>& outerRods,
0019                                                      vector<const Phase2EndcapRing*>& negRings,
0020                                                      vector<const Phase2EndcapRing*>& posRings)
0021     : Phase2OTBarrelLayer(innerRods, outerRods),
0022       theNegativeRingsComps(negRings.begin(), negRings.end()),
0023       thePositiveRingsComps(posRings.begin(), posRings.end()) {
0024   std::vector<const GeometricSearchDet*> theComps;
0025   theComps.assign(Phase2OTBarrelLayer::components().begin(), Phase2OTBarrelLayer::components().end());
0026   theComps.insert(theComps.end(), negRings.begin(), negRings.end());
0027   theComps.insert(theComps.end(), posRings.begin(), posRings.end());
0028 
0029   for (vector<const GeometricSearchDet*>::const_iterator it = theComps.begin(); it != theComps.end(); it++) {
0030     theBasicComps.insert(theBasicComps.end(), (**it).basicComponents().begin(), (**it).basicComponents().end());
0031   }
0032 
0033   BarrelDetLayer::initialize();
0034   theCylinder = cylinder(theComps);
0035 
0036 #ifdef EDM_ML_DEBUG
0037   //--------- DEBUG INFO --------------
0038   LogDebug("TkDetLayers") << "==== DEBUG Phase2OTtiltedBarrelLayer =====";
0039   LogTrace("TkDetLayers") << "Phase2OTtiltedBarrelLayer Cyl r,lenght: " << theCylinder->radius() << " , "
0040                           << theCylinder->bounds().length();
0041 
0042   for (vector<const GeometricSearchDet*>::const_iterator i = theNegativeRingsComps.begin();
0043        i != theNegativeRingsComps.end();
0044        i++) {
0045     LogTrace("TkDetLayers") << "negative rings in Phase2OT tilted barrel pos z,perp,eta,phi: " << (**i).position().z()
0046                             << " , " << (**i).position().perp() << " , " << (**i).position().eta() << " , "
0047                             << (**i).position().phi();
0048   }
0049 
0050   for (vector<const GeometricSearchDet*>::const_iterator i = Phase2OTBarrelLayer::components().begin();
0051        i != Phase2OTBarrelLayer::components().end();
0052        i++) {
0053     LogTrace("TkDetLayers") << "rods in Phase2OT tilted barrel pos z,perp,eta,phi: " << (**i).position().z() << " , "
0054                             << (**i).position().perp() << " , " << (**i).position().eta() << " , "
0055                             << (**i).position().phi();
0056   }
0057 
0058   for (vector<const GeometricSearchDet*>::const_iterator i = thePositiveRingsComps.begin();
0059        i != thePositiveRingsComps.end();
0060        i++) {
0061     LogTrace("TkDetLayers") << "positive rings in Phase2OT tilted barrel pos z,perp,eta,phi: " << (**i).position().z()
0062                             << " , " << (**i).position().perp() << " , " << (**i).position().eta() << " , "
0063                             << (**i).position().phi();
0064   }
0065   LogTrace("TkDetLayers") << "==== end DEBUG Phase2OTtiltedBarrelLayer =====";
0066   //-----------------------------------
0067 #endif
0068 }
0069 
0070 Phase2OTtiltedBarrelLayer::~Phase2OTtiltedBarrelLayer() {
0071   vector<const GeometricSearchDet*>::const_iterator i;
0072   for (i = theNegativeRingsComps.begin(); i != theNegativeRingsComps.end(); i++) {
0073     delete *i;
0074   }
0075   for (i = thePositiveRingsComps.begin(); i != thePositiveRingsComps.end(); i++) {
0076     delete *i;
0077   }
0078 }
0079 
0080 void Phase2OTtiltedBarrelLayer::groupedCompatibleDetsV(const TrajectoryStateOnSurface& tsos,
0081                                                        const Propagator& prop,
0082                                                        const MeasurementEstimator& est,
0083                                                        std::vector<DetGroup>& result) const {
0084   vector<DetGroup> closestResultRods;
0085   vector<DetGroup> closestResultNeg;
0086   vector<DetGroup> closestResultPos;
0087   Phase2OTBarrelLayer::groupedCompatibleDetsV(tsos, prop, est, closestResultRods);
0088   if (tsos.globalPosition().z() < 0) {
0089     for (auto& ring : theNegativeRingsComps) {
0090       ring->groupedCompatibleDetsV(tsos, prop, est, closestResultNeg);
0091     }
0092   } else {
0093     for (auto& ring : thePositiveRingsComps) {
0094       ring->groupedCompatibleDetsV(tsos, prop, est, closestResultPos);
0095     }
0096   }
0097   result.assign(closestResultRods.begin(), closestResultRods.end());
0098   result.insert(result.end(), closestResultPos.begin(), closestResultPos.end());
0099   result.insert(result.end(), closestResultNeg.begin(), closestResultNeg.end());
0100 
0101 #ifdef EDM_ML_DEBUG
0102   LogDebug("TkDetLayers") << "==== output di Phase2OTtiltedBarrelLayer =====";
0103   if (closestResultRods.size() != 0) {
0104     for (auto gr : closestResultRods) {
0105       LogTrace("TkDetLayers") << "New Rod group:";
0106       for (auto dge : gr) {
0107         LogTrace("TkDetLayers") << "new det with geom det at r:" << dge.det()->position().perp()
0108                                 << " id:" << dge.det()->geographicalId().rawId()
0109                                 << " tsos at:" << dge.trajectoryState().globalPosition();
0110       }
0111     }
0112   }
0113   if (closestResultNeg.size() != 0) {
0114     for (auto gr : closestResultNeg) {
0115       LogTrace("TkDetLayers") << "New negative group:";
0116       for (auto dge : gr) {
0117         LogTrace("TkDetLayers") << "new det with geom det at r:" << dge.det()->position().perp()
0118                                 << " id:" << dge.det()->geographicalId().rawId()
0119                                 << " tsos at:" << dge.trajectoryState().globalPosition();
0120       }
0121     }
0122   }
0123   if (closestResultPos.size() != 0) {
0124     for (auto gr : closestResultPos) {
0125       LogTrace("TkDetLayers") << "New positive group:";
0126       for (auto dge : gr) {
0127         LogTrace("TkDetLayers") << "new det with geom det at r:" << dge.det()->position().perp()
0128                                 << " id:" << dge.det()->geographicalId().rawId()
0129                                 << " tsos at:" << dge.trajectoryState().globalPosition();
0130       }
0131     }
0132   }
0133 
0134   if (result.size() != 0) {
0135     for (auto gr : result) {
0136       LogTrace("TkDetLayers") << "Total group:";
0137       for (auto dge : gr) {
0138         LogTrace("TkDetLayers") << "new det with geom det at r:" << dge.det()->position().perp()
0139                                 << " id:" << dge.det()->geographicalId().rawId()
0140                                 << " tsos at:" << dge.trajectoryState().globalPosition();
0141       }
0142     }
0143   } else {
0144     LogTrace("TkDetLayers") << "result size is zero";
0145   }
0146 #endif
0147 }