Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:10

0001 // -*- C++ -*-
0002 //
0003 /* 
0004  Description: <one line class summary>
0005 
0006  Implementation:
0007      <Notes on implementation>
0008 */
0009 
0010 //
0011 //          Original Author: Riccardo Ranieri
0012 //                  Created: Wed May 3 10:30:00 CEST 2006
0013 // Modified for Hybrid & LB: Fri July 31 by E. Brownson
0014 //
0015 
0016 // system include files
0017 #include <memory>
0018 
0019 // user include files
0020 #include "FWCore/Framework/interface/Frameworkfwd.h"
0021 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0022 
0023 #include "FWCore/Framework/interface/Event.h"
0024 #include "FWCore/Framework/interface/EventSetup.h"
0025 #include "FWCore/Framework/interface/ESHandle.h"
0026 #include "FWCore/Framework/interface/MakerMacros.h"
0027 //#include "FWCore/Utilities/interface/Exception.h"
0028 
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
0031 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
0032 #include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
0033 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0034 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0035 #include "Geometry/CommonDetUnit/interface/PixelGeomDetType.h"
0036 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
0037 //#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"
0038 #include "Geometry/CommonTopologies/interface/PixelTopology.h"
0039 #include "Geometry/CommonTopologies/interface/Topology.h"
0040 
0041 #include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"
0042 #include "DataFormats/GeometrySurface/interface/BoundSurface.h"
0043 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0044 
0045 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0046 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0047 #include "Geometry/Records/interface/IdealGeometryRecord.h"
0048 #include "Geometry/TrackerNumberingBuilder/interface/CmsTrackerStringToEnum.h"
0049 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0050 #include "DetectorDescription/Core/interface/DDRoot.h"
0051 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0052 #include "DetectorDescription/Core/interface/DDFilter.h"
0053 #include "DetectorDescription/Core/interface/DDFilteredView.h"
0054 #include "DetectorDescription/Core/interface/DDCompactView.h"
0055 #include "DetectorDescription/Core/interface/DDMaterial.h"
0056 
0057 // output
0058 #include <iostream>
0059 #include <fstream>
0060 #include <iomanip>
0061 #include <cmath>
0062 #include <bitset>
0063 
0064 //
0065 //
0066 // class decleration
0067 //
0068 
0069 class ModuleInfo_Phase2 : public edm::one::EDAnalyzer<> {
0070 public:
0071   explicit ModuleInfo_Phase2(const edm::ParameterSet&);
0072   ~ModuleInfo_Phase2();
0073 
0074   virtual void analyze(const edm::Event&, const edm::EventSetup&);
0075 
0076 private:
0077   // ----------member data ---------------------------
0078   edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geom_esToken;
0079   edm::ESGetToken<GeometricDet, IdealGeometryRecord> geomDet_esToken;
0080   edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topo_esToken;
0081   bool fromDDD_;
0082   bool printDDD_;
0083 };
0084 
0085 //
0086 // constants, enums and typedefs
0087 //
0088 
0089 //
0090 // constructors and destructor
0091 //
0092 ModuleInfo_Phase2::ModuleInfo_Phase2(const edm::ParameterSet& ps) {
0093   fromDDD_ = ps.getParameter<bool>("fromDDD");
0094   printDDD_ = ps.getUntrackedParameter<bool>("printDDD", true);
0095   //now do what ever initialization is needed
0096 }
0097 
0098 ModuleInfo_Phase2::~ModuleInfo_Phase2() = default;
0099 //
0100 // member functions
0101 //
0102 
0103 // ------------ method called to produce the data  ------------
0104 void ModuleInfo_Phase2::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0105   //Retrieve tracker topology from geometry
0106   const TrackerTopology* const tTopo = &iSetup.getData(topo_esToken);
0107 
0108   edm::LogInfo("ModuleInfo_Phase2") << "begins";
0109 
0110   // output file
0111   std::ofstream Output("ModuleInfo_Phase2.log", std::ios::out);
0112   // TEC output as Martin Weber's
0113   std::ofstream TECOutput("TECLayout_CMSSW.dat", std::ios::out);
0114   // Numbering Scheme
0115   std::ofstream NumberingOutput("ModuleNumbering.dat", std::ios::out);
0116   // Geometry summaries
0117   std::ofstream GeometryOutput("GeometrySummary.log", std::ios::out);
0118   std::ofstream GeometryXLS("GeometryXLS.log", std::ios::out);
0119   //
0120 
0121   //
0122   // get the GeometricDet
0123   //
0124   const GeometricDet* rDD = &iSetup.getData(geomDet_esToken);
0125 
0126   edm::LogInfo("ModuleInfo_Phase2") << " Top node is  " << rDD << " " << rDD->name() << std::endl;
0127   edm::LogInfo("ModuleInfo_Phase2") << " And Contains  Daughters: " << rDD->deepComponents().size() << std::endl;
0128   //first instance tracking geometry
0129   const TrackerGeometry* pDD = &iSetup.getData(geom_esToken);
0130   //
0131 
0132   // counters
0133   //unsigned int MAXPXBLAY = 8;
0134   unsigned int pxbN = 0;
0135   unsigned int pxb_fullN = 0;
0136   unsigned int pxb_halfN = 0;
0137   unsigned int pxb_stackN = 0;
0138   //unsigned int pxb_full_strx12N = 0;
0139   //unsigned int pxb_half_strx12N = 0;
0140   //unsigned int pxb_full_strx34N = 0;
0141   //unsigned int pxb_half_strx34N = 0;
0142   unsigned int pxb_full_L[16] = {0};
0143   unsigned int pxb_half_L[16] = {0};
0144   unsigned int pxb_stack[16] = {0};
0145   double psi_pxb_L[16] = {0};
0146   double psi_pxb[16] = {0};
0147   double psi_pxb_strx12[16] = {0};
0148   double psi_pxb_strx34[16] = {0};
0149   double pxbR_L[16] = {0.0};
0150   double pxbZ_L[16] = {0.0};
0151   double pxbpitchx[16] = {0.0};
0152   double pxbpitchy[16] = {0.0};
0153   unsigned int pxfN = 0;
0154   unsigned int pxf_D_N = 0;
0155   unsigned int pxf_1x2N = 0;
0156   unsigned int pxf_1x5N = 0;
0157   unsigned int pxf_2x3N = 0;
0158   unsigned int pxf_2x4N = 0;
0159   unsigned int pxf_2x5N = 0;
0160   unsigned int pxf_D[6] = {0};
0161   unsigned int pxf_1x2_D[6] = {0};
0162   unsigned int pxf_1x5_D[6] = {0};
0163   unsigned int pxf_2x3_D[6] = {0};
0164   unsigned int pxf_2x4_D[6] = {0};
0165   unsigned int pxf_2x5_D[6] = {0};
0166   double pxfpitchx[6] = {0};
0167   double pxfpitchy[6] = {0};
0168   double psi_pxf_D[6] = {0};
0169   double psi_pxf[16] = {0};
0170   double pxfR_min_D[6] = {9999.0, 9999.0, 9999.0};
0171   double pxfR_max_D[6] = {0.0};
0172   double pxfZ_D[6] = {0.0};
0173   unsigned int tibN = 0;
0174   unsigned int tib_L12_rphiN = 0;
0175   unsigned int tib_L12_sterN = 0;
0176   unsigned int tib_L34_rphiN = 0;
0177   unsigned int tib_L12_rphi_L[6] = {0};
0178   unsigned int tib_L12_ster_L[6] = {0};
0179   unsigned int tib_L34_rphi_L[6] = {0};
0180   double tib_apv_L[6] = {0};
0181   double apv_tib = 0;
0182   double tibR_L[6] = {0.0};
0183   double tibZ_L[6] = {0.0};
0184   unsigned int tidN = 0;
0185   unsigned int tid_r1_rphiN = 0;
0186   unsigned int tid_r1_sterN = 0;
0187   unsigned int tid_r2_rphiN = 0;
0188   unsigned int tid_r2_sterN = 0;
0189   unsigned int tid_r3_rphiN = 0;
0190   unsigned int tid_r1_rphi_D[3] = {0};
0191   unsigned int tid_r1_ster_D[3] = {0};
0192   unsigned int tid_r2_rphi_D[3] = {0};
0193   unsigned int tid_r2_ster_D[3] = {0};
0194   unsigned int tid_r3_rphi_D[3] = {0};
0195   double tid_apv_D[3] = {0};
0196   double apv_tid = 0;
0197   double tidR_min_D[3] = {9999.0, 9999.0, 9999.0};
0198   double tidR_max_D[3] = {0.0};
0199   double tidZ_D[3] = {0.0};
0200   unsigned int tobN = 0;
0201   unsigned int tob_L12_rphiN = 0;
0202   unsigned int tob_L12_sterN = 0;
0203   unsigned int tob_L34_rphiN = 0;
0204   unsigned int tob_L56_rphiN = 0;
0205   unsigned int tob_L12_rphi_L[6] = {0};
0206   unsigned int tob_L12_ster_L[6] = {0};
0207   unsigned int tob_L34_rphi_L[6] = {0};
0208   unsigned int tob_L56_rphi_L[6] = {0};
0209   double tob_apv_L[6] = {0};
0210   double apv_tob = 0;
0211   double tobR_L[6] = {0.0};
0212   double tobZ_L[6] = {0.0};
0213   unsigned int tecN = 0;
0214   unsigned int tec_r1_rphiN = 0;
0215   unsigned int tec_r1_sterN = 0;
0216   unsigned int tec_r2_rphiN = 0;
0217   unsigned int tec_r2_sterN = 0;
0218   unsigned int tec_r3_rphiN = 0;
0219   unsigned int tec_r4_rphiN = 0;
0220   unsigned int tec_r5_rphiN = 0;
0221   unsigned int tec_r5_sterN = 0;
0222   unsigned int tec_r6_rphiN = 0;
0223   unsigned int tec_r7_rphiN = 0;
0224   unsigned int tec_r1_rphi_D[9] = {0};
0225   unsigned int tec_r1_ster_D[9] = {0};
0226   unsigned int tec_r2_rphi_D[9] = {0};
0227   unsigned int tec_r2_ster_D[9] = {0};
0228   unsigned int tec_r3_rphi_D[9] = {0};
0229   unsigned int tec_r4_rphi_D[9] = {0};
0230   unsigned int tec_r5_rphi_D[9] = {0};
0231   unsigned int tec_r5_ster_D[9] = {0};
0232   unsigned int tec_r6_rphi_D[9] = {0};
0233   unsigned int tec_r7_rphi_D[9] = {0};
0234   double tec_apv_D[9] = {0};
0235   double apv_tec = 0;
0236   double tecR_min_D[9] = {9999.0, 9999.0, 9999.0, 9999.0, 9999.0, 9999.0, 9999.0, 9999.0, 9999.0};
0237   double tecR_max_D[9] = {0.0};
0238   double tecZ_D[9] = {0.0};
0239   double thepixROCRowsB[16] = {0.0};
0240   double thepixROCColsB[16] = {0.0};
0241   double thepixROCRowsD[16] = {0.0};
0242   double thepixROCColsD[16] = {0.0};
0243   //
0244   unsigned int nlayersPXB = 0;  //  number of layers
0245   unsigned int nlayersTIB = 0;  //  number of layers
0246   unsigned int nlayersTOB = 0;  //  number of layers
0247   unsigned int ndisksPXF = 0;
0248   unsigned int ndisksTID = 0;
0249   unsigned int nwheelsTEC = 0;
0250 
0251   std::vector<const GeometricDet*> modules = (*rDD).deepComponents();
0252   Output << "************************ List of modules with positions ************************" << std::endl;
0253   // MEC: 2010-04-13: need to find corresponding GeometricDetExtra.
0254 
0255   for (unsigned int i = 0; i < modules.size(); i++) {
0256     unsigned int rawid = modules[i]->geographicalId().rawId();
0257 
0258     GeometricDet::nav_type detNavType = modules[i]->navType();
0259     Output << std::fixed << std::setprecision(6);  // set as default 6 decimal digits
0260     std::bitset<32> binary_rawid(rawid);
0261     Output << " ******** raw Id = " << rawid << " (" << binary_rawid << ") ";
0262 
0263     Output << std::endl;
0264     int subdetid = modules[i]->geographicalId().subdetId();
0265     double thickness = modules[i]->bounds()->thickness() * 10000;  // cm-->um
0266     double length = (modules[i]->bounds()->length());              // already in cm
0267     double polarRadius = std::sqrt(modules[i]->translation().X() * modules[i]->translation().X() +
0268                                    modules[i]->translation().Y() * modules[i]->translation().Y());
0269     double positionZ = std::abs(modules[i]->translation().Z()) / 10.;  //cm
0270 
0271     switch (subdetid) {
0272         // PXB
0273       case 1: {
0274         pxbN++;
0275         std::string name = modules[i]->name();
0276         if (name == "PixelBarrelActiveFull" || name == "PixelBarrelActiveFull0" || name == "PixelBarrelActiveFull1" ||
0277             name == "PixelBarrelActiveFull2" || name == "PixelBarrelActiveFull3")
0278           pxb_fullN++;
0279         if (name == "PixelBarrelActiveHalf" || name == "PixelBarrelActiveHalf1")
0280           pxb_halfN++;
0281         if (name == "PixelBarrelActiveStack0" || name == "PixelBarrelActiveStack1" ||
0282             name == "PixelBarrelActiveStack2" || name == "PixelBarrelActiveStack3" ||
0283             name == "PixelBarrelActiveStack4" || name == "PixelBarrelActiveStack5" ||
0284             name == "PixelBarrelActiveStack6" || name == "PixelBarrelActiveStack7" ||
0285             name == "PixelBarrelActiveStack8" || name == "PixelBarrelActiveStack9")
0286           pxb_stackN++;
0287         //if(name == "PixelBarrelActiveFull2") pxb_full_strx12N++; // Outdated ?
0288         //if(name == "PixelBarrelActiveHalf2") pxb_half_strx12N++;
0289         //if(name == "PixelBarrelActiveFull3") pxb_full_strx34N++;
0290         //if(name == "PixelBarrelActiveHalf3") pxb_half_strx34N++;
0291 
0292         unsigned int theLayer = tTopo->pxbLayer(rawid);
0293         unsigned int theLadder = tTopo->pxbLadder(rawid);
0294         unsigned int theModule = tTopo->pxbModule(rawid);
0295         thepixROCRowsB[theLayer - 1] = modules[i]->pixROCRows();
0296         thepixROCColsB[theLayer - 1] = modules[i]->pixROCCols();
0297         {
0298           const DetId& detid = modules[i]->geographicalId();
0299           DetId detIdObject(detid);
0300           const GeomDetUnit* genericDet = pDD->idToDetUnit(detIdObject);
0301           const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
0302           //std::cout << "  "<<__LINE__<<" PixelGeomDetUnit "<<pixDet->surface().position().perp()<<" , "<<pixDet->surface().position().z()<<"\n";
0303           const PixelTopology* theTopol = &(pixDet->specificTopology());
0304           std::pair<float, float> pitchxy = theTopol->pitch();
0305           pxbpitchx[theLayer - 1] = double(int(0.5 + (10000 * pitchxy.first)));
0306           pxbpitchy[theLayer - 1] = double(int(0.5 + (10000 * pitchxy.second)));
0307           //std::cout<<"  "<<" BPix Layer "<< theLayer << " with Pitch = " << pxbpitchx[theLayer-1]<<" , "<<pxbpitchy[theLayer-1]<<"\n";
0308         }  // Discard some transitional variables.
0309         if (theLayer > nlayersPXB)
0310           nlayersPXB = theLayer;
0311         // The following sums will need to be verified...
0312         if (name == "PixelBarrelActiveFull" || name == "PixelBarrelActiveFull0" || name == "PixelBarrelActiveFull1" ||
0313             name == "PixelBarrelActiveFull2" || name == "PixelBarrelActiveFull3")
0314           pxb_full_L[theLayer - 1]++;
0315         if (name == "PixelBarrelActiveHalf" || name == "PixelBarrelActiveHalf1" || name == "PixelBarrelActiveHalf2" ||
0316             name == "PixelBarrelActiveHalf3")
0317           pxb_half_L[theLayer - 1]++;
0318         if (name == "PixelBarrelActiveStack0" || name == "PixelBarrelActiveStack1" ||
0319             name == "PixelBarrelActiveStack2" || name == "PixelBarrelActiveStack3" ||
0320             name == "PixelBarrelActiveStack4" || name == "PixelBarrelActiveStack5" ||
0321             name == "PixelBarrelActiveStack6" || name == "PixelBarrelActiveStack7" ||
0322             name == "PixelBarrelActiveStack8" || name == "PixelBarrelActiveStack9")
0323           pxb_stack[theLayer - 1]++;
0324         if (name == "PixelBarrelActiveFull" || name == "PixelBarrelActiveHalf" || name == "PixelBarrelActiveFull0" ||
0325             name == "PixelBarrelActiveFull1" || name == "PixelBarrelActiveHalf1" || name == "PixelBarrelActiveStack0" ||
0326             name == "PixelBarrelActiveStack1" || name == "PixelBarrelActiveStack2" ||
0327             name == "PixelBarrelActiveStack3" || name == "PixelBarrelActiveStack4" ||
0328             name == "PixelBarrelActiveStack5" || name == "PixelBarrelActiveStack6" ||
0329             name == "PixelBarrelActiveStack7" || name == "PixelBarrelActiveStack8" || name == "PixelBarrelActiveStack9")
0330           psi_pxb[theLayer - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0331 
0332         if (name == "PixelBarrelActiveFull2" || name == "PixelBarrelActiveHalf2")
0333           psi_pxb_strx12[theLayer - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0334         if (name == "PixelBarrelActiveFull3" || name == "PixelBarrelActiveHalf3")
0335           psi_pxb_strx34[theLayer - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0336 
0337         // Make sure there are no new names we didn't know about.
0338         if ((name == "PixelBarrelActiveStack0" || name == "PixelBarrelActiveStack1" ||
0339              name == "PixelBarrelActiveStack2" || name == "PixelBarrelActiveStack3" ||
0340              name == "PixelBarrelActiveStack4" || name == "PixelBarrelActiveStack5" ||
0341              name == "PixelBarrelActiveStack6" || name == "PixelBarrelActiveStack7" ||
0342              name == "PixelBarrelActiveStack8" || name == "PixelBarrelActiveStack9" ||
0343              name == "PixelBarrelActiveFull" || name == "PixelBarrelActiveFull1" || name == "PixelBarrelActiveHalf" ||
0344              name == "PixelBarrelActiveHalf1" || name == "PixelBarrelActiveFull2" || name == "PixelBarrelActiveHalf2" ||
0345              name == "PixelBarrelActiveFull3" || name == "PixelBarrelActiveHalf3" ||
0346              name == "PixelBarrelActiveFull0") == 0)
0347           std::cout << "\nYou have added PXB layers that are not taken into account! \ti.e. " << name << "\n";
0348         if (16 < theLayer)
0349           std::cout << "\nYou need to increase the PXB array sizes!\n";
0350         psi_pxb_L[theLayer - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0351 
0352         if (pxbZ_L[theLayer - 1] < positionZ + length / 2)
0353           pxbZ_L[theLayer - 1] = positionZ + length / 2;
0354         pxbR_L[theLayer - 1] += polarRadius / 10;  // cm
0355         Output << " PXB"
0356                << "\t"
0357                << "Layer " << theLayer << " Ladder " << theLadder << "\t"
0358                << " module " << theModule << " " << name << "\t";
0359         break;
0360       }
0361 
0362         // PXF
0363       case 2: {
0364         pxfN++;
0365         std::string name = modules[i]->name();
0366         if (name == "PixelForwardSensor" || name == "PixelForwardSensor1" || name == "PixelForwardSensor2" ||
0367             name == "PixelForwardSensor3")
0368           pxf_D_N++;
0369         if (name == "PixelForwardActive1x2")
0370           pxf_1x2N++;
0371         if (name == "PixelForwardActive1x5")
0372           pxf_1x5N++;
0373         if (name == "PixelForwardActive2x3")
0374           pxf_2x3N++;
0375         if (name == "PixelForwardActive2x4")
0376           pxf_2x4N++;
0377         if (name == "PixelForwardActive2x5")
0378           pxf_2x5N++;
0379 
0380         unsigned int thePanel = tTopo->pxfPanel(rawid);
0381         unsigned int theDisk = tTopo->pxfDisk(rawid);
0382         unsigned int theBlade = tTopo->pxfBlade(rawid);
0383         unsigned int theModule = tTopo->pxfModule(rawid);
0384         thepixROCRowsD[theDisk - 1] = modules[i]->pixROCRows();
0385         thepixROCColsD[theDisk - 1] = modules[i]->pixROCCols();
0386         {
0387           const DetId& detid = modules[i]->geographicalId();
0388           DetId detIdObject(detid);
0389           const GeomDetUnit* genericDet = pDD->idToDetUnit(detIdObject);
0390           const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
0391           const PixelTopology* theTopol = &(pixDet->specificTopology());
0392           std::pair<float, float> pitchxy = theTopol->pitch();
0393           pxfpitchx[theDisk - 1] = double(int(0.5 + (10000 * pitchxy.first)));
0394           pxfpitchy[theDisk - 1] = double(int(0.5 + (10000 * pitchxy.second)));
0395         }  // Discard some transitional variables.
0396         if (theDisk > ndisksPXF)
0397           ndisksPXF = theDisk;
0398         if (name == "PixelForwardSensor" || name == "PixelForwardSensor1" || name == "PixelForwardSensor2" ||
0399             name == "PixelForwardSensor3")
0400           pxf_D[theDisk - 1]++;
0401         if (name == "PixelForwardActive1x2")
0402           pxf_1x2_D[theDisk - 1]++;
0403         if (name == "PixelForwardActive1x5")
0404           pxf_1x5_D[theDisk - 1]++;
0405         if (name == "PixelForwardActive2x3")
0406           pxf_2x3_D[theDisk - 1]++;
0407         if (name == "PixelForwardActive2x4")
0408           pxf_2x4_D[theDisk - 1]++;
0409         if (name == "PixelForwardActive2x5")
0410           pxf_2x5_D[theDisk - 1]++;
0411         // Make sure there are no new names we didn't know about.
0412         if ((name == "PixelForwardSensor" || name == "PixelForwardActive1x2" || name == "PixelForwardActive1x5" ||
0413              name == "PixelForwardActive2x3" || name == "PixelForwardActive2x4" || name == "PixelForwardActive2x5" ||
0414              name == "PixelForwardSensor1" || name == "PixelForwardSensor2" || name == "PixelForwardSensor3") == 0)
0415           std::cout << "\nYou have added PXF layers that are not taken into account! \ti.e. " << name << "\n";
0416         if (3 < theDisk)
0417           std::cout << "\nYou need to increase the PXF array sizes!\n";
0418         psi_pxf_D[theDisk - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0419         psi_pxf[theDisk - 1] += modules[i]->pixROCx() * modules[i]->pixROCy();
0420         pxfZ_D[theDisk - 1] += positionZ;
0421         polarRadius = polarRadius / 10.;
0422         if (pxfR_min_D[theDisk - 1] > polarRadius - length / 2)
0423           pxfR_min_D[theDisk - 1] = polarRadius - length / 2;
0424         if (pxfR_max_D[theDisk - 1] < polarRadius + length / 2)
0425           pxfR_max_D[theDisk - 1] = polarRadius + length / 2;
0426         std::string side;
0427         side = (tTopo->pxfSide(rawid) == 1) ? "-" : "+";
0428         Output << " PXF" << side << "\t"
0429                << "Disk " << theDisk << " Blade " << theBlade << " Panel " << thePanel << "\t"
0430                << " module " << theModule << "\t" << name << "\t";
0431         break;
0432       }
0433 
0434         // TIB
0435       case 3: {
0436         tibN++;
0437         std::string name = modules[i]->name();
0438         if (name == "TIBActiveRphi0")
0439           tib_L12_rphiN++;
0440         if (name == "TIBActiveSter0")
0441           tib_L12_sterN++;
0442         if (name == "TIBActiveRphi2")
0443           tib_L34_rphiN++;
0444 
0445         unsigned int theLayer = tTopo->tibLayer(rawid);
0446         std::vector<unsigned int> theString = tTopo->tibStringInfo(rawid);
0447         unsigned int theModule = tTopo->tibModule(rawid);
0448         if (theLayer > nlayersTIB)
0449           nlayersTIB = theLayer;
0450         if (name == "TIBActiveRphi0")
0451           tib_L12_rphi_L[theLayer - 1]++;
0452         if (name == "TIBActiveSter0")
0453           tib_L12_ster_L[theLayer - 1]++;
0454         if (name == "TIBActiveRphi2")
0455           tib_L34_rphi_L[theLayer - 1]++;
0456         if ((name == "TIBActiveRphi0" || name == "TIBActiveSter0" || name == "TIBActiveRphi2") == 0)
0457           std::cout << "\nYou have added TIB layers that are not taken into account!\n\n";
0458         if (6 < theLayer)
0459           std::cout << "\nYou need to increase the TIB array sizes!\n";
0460         tib_apv_L[theLayer - 1] += modules[i]->siliconAPVNum();
0461         apv_tib += modules[i]->siliconAPVNum();
0462         if (tibZ_L[theLayer - 1] < positionZ + length / 2)
0463           tibZ_L[theLayer - 1] = positionZ + length / 2;
0464         tibR_L[theLayer - 1] += polarRadius / 10;  // cm
0465         std::string side;
0466         std::string part;
0467         side = (theString[0] == 1) ? "-" : "+";
0468         part = (theString[1] == 1) ? "int" : "ext";
0469 
0470         Output << " TIB" << side << "\t"
0471                << "Layer " << theLayer << " " << part << "\t"
0472                << "string " << theString[2] << "\t"
0473                << " module " << theModule << " " << name << "\t";
0474         Output << " " << modules[i]->translation().X() << "   \t" << modules[i]->translation().Y() << "   \t"
0475                << modules[i]->translation().Z() << std::endl;
0476         break;
0477       }
0478 
0479         // TID
0480       case 4: {
0481         tidN++;
0482         std::string name = modules[i]->name();
0483         if (name == "TIDModule0RphiActive")
0484           tid_r1_rphiN++;
0485         if (name == "TIDModule0StereoActive")
0486           tid_r1_sterN++;
0487         if (name == "TIDModule1RphiActive")
0488           tid_r2_rphiN++;
0489         if (name == "TIDModule1StereoActive")
0490           tid_r2_sterN++;
0491         if (name == "TIDModule2RphiActive")
0492           tid_r3_rphiN++;
0493 
0494         unsigned int theDisk = tTopo->tidWheel(rawid);
0495         unsigned int theRing = tTopo->tidRing(rawid);
0496         std::vector<unsigned int> theModule = tTopo->tidModuleInfo(rawid);
0497         if (theDisk > ndisksTID)
0498           ndisksTID = theDisk;
0499         if (name == "TIDModule0RphiActive")
0500           tid_r1_rphi_D[theDisk - 1]++;
0501         if (name == "TIDModule0StereoActive")
0502           tid_r1_ster_D[theDisk - 1]++;
0503         if (name == "TIDModule1RphiActive")
0504           tid_r2_rphi_D[theDisk - 1]++;
0505         if (name == "TIDModule1StereoActive")
0506           tid_r2_ster_D[theDisk - 1]++;
0507         if (name == "TIDModule2RphiActive")
0508           tid_r3_rphi_D[theDisk - 1]++;
0509         if ((name == "TIDModule0RphiActive" || name == "TIDModule0StereoActive" || name == "TIDModule1RphiActive" ||
0510              name == "TIDModule1StereoActive" || name == "TIDModule2RphiActive") == 0)
0511           std::cout << "\nYou have added TID layers that are not taken into account!\n\n";
0512         if (3 < theDisk)
0513           std::cout << "\nYou need to increase the TID array sizes!\n";
0514         tid_apv_D[theDisk - 1] += modules[i]->siliconAPVNum();
0515         apv_tid += modules[i]->siliconAPVNum();
0516         tidZ_D[theDisk - 1] += positionZ;
0517         polarRadius = polarRadius / 10.;
0518         if (tidR_min_D[theDisk - 1] > polarRadius - length / 2)
0519           tidR_min_D[theDisk - 1] = polarRadius - length / 2;
0520         if (tidR_max_D[theDisk - 1] < polarRadius + length / 2)
0521           tidR_max_D[theDisk - 1] = polarRadius + length / 2;
0522         std::string side;
0523         std::string part;
0524         side = (tTopo->tidSide(rawid) == 1) ? "-" : "+";
0525         part = (theModule[0] == 1) ? "back" : "front";
0526         Output << " TID" << side << "\t"
0527                << "Disk " << theDisk << " Ring " << theRing << " " << part << "\t"
0528                << " module " << theModule[1] << "\t" << name << "\t";
0529         Output << " " << modules[i]->translation().X() << "   \t" << modules[i]->translation().Y() << "   \t"
0530                << modules[i]->translation().Z() << std::endl;
0531         break;
0532       }
0533 
0534         // TOB
0535       case 5: {
0536         tobN++;
0537         std::string name = modules[i]->name();
0538         if (name == "TOBActiveRphi0")
0539           tob_L12_rphiN++;
0540         if (name == "TOBActiveSter0")
0541           tob_L12_sterN++;
0542         if (name == "TOBActiveRphi2")
0543           tob_L34_rphiN++;
0544         if (name == "TOBActiveRphi4")
0545           tob_L56_rphiN++;
0546 
0547         unsigned int theLayer = tTopo->tobLayer(rawid);
0548         std::vector<unsigned int> theRod = tTopo->tobRodInfo(rawid);
0549         unsigned int theModule = tTopo->tobModule(rawid);
0550         if (theLayer > nlayersTOB)
0551           nlayersTOB = theLayer;
0552         if (name == "TOBActiveRphi0")
0553           tob_L12_rphi_L[theLayer - 1]++;
0554         if (name == "TOBActiveSter0")
0555           tob_L12_ster_L[theLayer - 1]++;
0556         if (name == "TOBActiveRphi2")
0557           tob_L34_rphi_L[theLayer - 1]++;
0558         if (name == "TOBActiveRphi4")
0559           tob_L56_rphi_L[theLayer - 1]++;
0560         if ((name == "TOBActiveRphi0" || name == "TOBActiveSter0" || name == "TOBActiveRphi2" ||
0561              name == "TOBActiveRphi4") == 0)
0562           std::cout << "\nYou have added TOB layers that are not taken into account!\n\n";
0563         if (6 < theLayer)
0564           std::cout << "\nYou need to increase the TOB array sizes!\n";
0565         tob_apv_L[theLayer - 1] += modules[i]->siliconAPVNum();
0566         apv_tob += modules[i]->siliconAPVNum();
0567         if (tobZ_L[theLayer - 1] < positionZ + length / 2)
0568           tobZ_L[theLayer - 1] = positionZ + length / 2;
0569         tobR_L[theLayer - 1] += polarRadius / 10;  // cm
0570         std::string side;
0571         std::string part;
0572         side = (theRod[0] == 1) ? "-" : "+";
0573         Output << " TOB" << side << "\t"
0574                << "Layer " << theLayer << "\t"
0575                << "rod " << theRod[1] << " module " << theModule << "\t" << name << "\t";
0576         Output << " " << modules[i]->translation().X() << "   \t" << modules[i]->translation().Y() << "   \t"
0577                << modules[i]->translation().Z() << std::endl;
0578         break;
0579       }
0580 
0581         // TEC
0582       case 6: {
0583         tecN++;
0584         std::string name = modules[i]->name();
0585         if (name == "TECModule0RphiActive")
0586           tec_r1_rphiN++;
0587         if (name == "TECModule0StereoActive")
0588           tec_r1_sterN++;
0589         if (name == "TECModule1RphiActive")
0590           tec_r2_rphiN++;
0591         if (name == "TECModule1StereoActive")
0592           tec_r2_sterN++;
0593         if (name == "TECModule2RphiActive")
0594           tec_r3_rphiN++;
0595         if (name == "TECModule3RphiActive")
0596           tec_r4_rphiN++;
0597         if (name == "TECModule4RphiActive")
0598           tec_r5_rphiN++;
0599         if (name == "TECModule4StereoActive")
0600           tec_r5_sterN++;
0601         if (name == "TECModule5RphiActive")
0602           tec_r6_rphiN++;
0603         if (name == "TECModule6RphiActive")
0604           tec_r7_rphiN++;
0605 
0606         unsigned int theWheel = tTopo->tecWheel(rawid);
0607         unsigned int theModule = tTopo->tecModule(rawid);
0608         std::vector<unsigned int> thePetal = tTopo->tecPetalInfo(rawid);
0609         unsigned int theRing = tTopo->tecRing(rawid);
0610         if (theWheel > nwheelsTEC)
0611           nwheelsTEC = theWheel;
0612         if (name == "TECModule0RphiActive")
0613           tec_r1_rphi_D[theWheel - 1]++;
0614         if (name == "TECModule0StereoActive")
0615           tec_r1_ster_D[theWheel - 1]++;
0616         if (name == "TECModule1RphiActive")
0617           tec_r2_rphi_D[theWheel - 1]++;
0618         if (name == "TECModule1StereoActive")
0619           tec_r2_ster_D[theWheel - 1]++;
0620         if (name == "TECModule2RphiActive")
0621           tec_r3_rphi_D[theWheel - 1]++;
0622         if (name == "TECModule3RphiActive")
0623           tec_r4_rphi_D[theWheel - 1]++;
0624         if (name == "TECModule4RphiActive")
0625           tec_r5_rphi_D[theWheel - 1]++;
0626         if (name == "TECModule4StereoActive")
0627           tec_r5_ster_D[theWheel - 1]++;
0628         if (name == "TECModule5RphiActive")
0629           tec_r6_rphi_D[theWheel - 1]++;
0630         if (name == "TECModule6RphiActive")
0631           tec_r7_rphi_D[theWheel - 1]++;
0632         if ((name == "TECModule0RphiActive" || name == "TECModule0StereoActive" || name == "TECModule1RphiActive" ||
0633              name == "TECModule1StereoActive" || name == "TECModule2RphiActive" || name == "TECModule3RphiActive" ||
0634              name == "TECModule4RphiActive" || name == "TECModule4StereoActive" || name == "TECModule5RphiActive" ||
0635              name == "TECModule6RphiActive") == 0)
0636           std::cout << "\nYou have added TOB layers that are not taken into account!,\t" << name << "\n";
0637         if (9 < theWheel)
0638           std::cout << "\nYou need to increase the TEC array sizes!\n";
0639         tec_apv_D[theWheel - 1] += modules[i]->siliconAPVNum();
0640         apv_tec += modules[i]->siliconAPVNum();
0641         tecZ_D[theWheel - 1] += positionZ;
0642         polarRadius = polarRadius / 10.;
0643         if (tecR_min_D[theWheel - 1] > polarRadius - length / 2)
0644           tecR_min_D[theWheel - 1] = polarRadius - length / 2;
0645         if (tecR_max_D[theWheel - 1] < polarRadius + length / 2)
0646           tecR_max_D[theWheel - 1] = polarRadius + length / 2;
0647         std::string side;
0648         std::string petal;
0649         side = (tTopo->tecSide(rawid) == 1) ? "-" : "+";
0650         petal = (thePetal[0] == 1) ? "back" : "front";
0651         Output << " TEC" << side << "\t"
0652                << "Wheel " << theWheel << " Petal " << thePetal[1] << " " << petal << " Ring " << theRing << "\t"
0653                << "\t"
0654                << " module " << theModule << "\t" << name << "\t";
0655         Output << " " << modules[i]->translation().X() << "   \t" << modules[i]->translation().Y() << "   \t"
0656                << modules[i]->translation().Z() << std::endl;
0657 
0658         // TEC output as Martin Weber's
0659         int out_side = (tTopo->tecSide(rawid) == 1) ? -1 : 1;
0660         unsigned int out_disk = tTopo->tecWheel(rawid);
0661         unsigned int out_sector = thePetal[1];
0662         int out_petal = (thePetal[0] == 1) ? 1 : -1;
0663         // swap sector numbers for TEC-
0664         if (out_side == -1) {
0665           // fine for back petals, substract 1 for front petals
0666           if (out_petal == -1) {
0667             out_sector = (out_sector + 6) % 8 + 1;
0668           }
0669         }
0670         unsigned int out_ring = tTopo->tecRing(rawid);
0671         int out_sensor = 0;
0672         if (name == "TECModule0RphiActive")
0673           out_sensor = -1;
0674         if (name == "TECModule0StereoActive")
0675           out_sensor = 1;
0676         if (name == "TECModule1RphiActive")
0677           out_sensor = -1;
0678         if (name == "TECModule1StereoActive")
0679           out_sensor = 1;
0680         if (name == "TECModule2RphiActive")
0681           out_sensor = -1;
0682         if (name == "TECModule3RphiActive")
0683           out_sensor = -1;
0684         if (name == "TECModule4RphiActive")
0685           out_sensor = -1;
0686         if (name == "TECModule4StereoActive")
0687           out_sensor = 1;
0688         if (name == "TECModule5RphiActive")
0689           out_sensor = -1;
0690         if (name == "TECModule6RphiActive")
0691           out_sensor = -1;
0692         unsigned int out_module;
0693         if (out_ring == 1 || out_ring == 2 || out_ring == 5) {
0694           // rings with stereo modules
0695           // create number odd by default
0696           out_module = 2 * (tTopo->tecModule(rawid) - 1) + 1;
0697           if (out_sensor == 1) {
0698             // in even rings, stereo modules are the even ones
0699             if (out_ring == 2)
0700               out_module += 1;
0701           } else
0702             // in odd rings, stereo modules are the odd ones
0703             if (out_ring != 2)
0704               out_module += 1;
0705         } else {
0706           out_module = tTopo->tecModule(rawid);
0707         }
0708         double out_x = modules[i]->translation().X();
0709         double out_y = modules[i]->translation().Y();
0710         double out_z = modules[i]->translation().Z();
0711         double out_r = sqrt(modules[i]->translation().X() * modules[i]->translation().X() +
0712                             modules[i]->translation().Y() * modules[i]->translation().Y());
0713         double out_phi_rad = atan2(modules[i]->translation().Y(), modules[i]->translation().X());
0714         TECOutput << out_side << " " << out_disk << " " << out_sector << " " << out_petal << " " << out_ring << " "
0715                   << out_module << " " << out_sensor << " " << out_x << " " << out_y << " " << out_z << " " << out_r
0716                   << " " << out_phi_rad << std::endl;
0717         //
0718         break;
0719       }
0720       default:
0721         Output << " WARNING no Silicon Strip detector, I got a " << rawid << std::endl;
0722         ;
0723     }
0724 
0725     // Local axes from Reco
0726     const GeomDet* geomdet = pDD->idToDet(modules[i]->geographicalId());
0727     // Global Coordinates (i,j,k)
0728     LocalVector xLocal(1, 0, 0);
0729     LocalVector yLocal(0, 1, 0);
0730     LocalVector zLocal(0, 0, 1);
0731     // Versor components
0732     GlobalVector xGlobal = (geomdet->surface()).toGlobal(xLocal);
0733     GlobalVector yGlobal = (geomdet->surface()).toGlobal(yLocal);
0734     GlobalVector zGlobal = (geomdet->surface()).toGlobal(zLocal);
0735     //
0736 
0737     // Output: set as default 4 decimal digits (0.1 um or 0.1 deg/rad)
0738     // active area center
0739     Output << "\t"
0740            << "thickness " << std::fixed << std::setprecision(0) << thickness << " um \n";
0741     Output << "\tActive Area Center" << std::endl;
0742     Output << "\t O = (" << std::fixed << std::setprecision(4) << modules[i]->translation().X() << "," << std::fixed
0743            << std::setprecision(4) << modules[i]->translation().Y() << "," << std::fixed << std::setprecision(4)
0744            << modules[i]->translation().Z() << ")" << std::endl;
0745     //
0746     //double polarRadius = std::sqrt(modules[i]->translation().X()*modules[i]->translation().X()+modules[i]->translation().Y()*modules[i]->translation().Y());
0747     double phiDeg = atan2(modules[i]->translation().Y(), modules[i]->translation().X()) * 360. / 6.283185307;
0748     double phiRad = atan2(modules[i]->translation().Y(), modules[i]->translation().X());
0749     //
0750     Output << "\t\t polar radius " << std::fixed << std::setprecision(4) << polarRadius << "\t"
0751            << "phi [deg] " << std::fixed << std::setprecision(4) << phiDeg << "\t"
0752            << "phi [rad] " << std::fixed << std::setprecision(4) << phiRad << std::endl;
0753     // active area versors (rotation matrix)
0754     DD3Vector x, y, z;
0755     modules[i]->rotation().GetComponents(x, y, z);
0756     Output << "\tActive Area Rotation Matrix" << std::endl;
0757     Output << "\t z = n = (" << std::fixed << std::setprecision(4) << z.X() << "," << std::fixed << std::setprecision(4)
0758            << z.Y() << "," << std::fixed << std::setprecision(4) << z.Z() << ")" << std::endl
0759            << "\t [Rec] = (" << std::fixed << std::setprecision(4) << zGlobal.x() << "," << std::fixed
0760            << std::setprecision(4) << zGlobal.y() << "," << std::fixed << std::setprecision(4) << zGlobal.z() << ")"
0761            << std::endl
0762            << "\t x = t = (" << std::fixed << std::setprecision(4) << x.X() << "," << std::fixed << std::setprecision(4)
0763            << x.Y() << "," << std::fixed << std::setprecision(4) << x.Z() << ")" << std::endl
0764            << "\t [Rec] = (" << std::fixed << std::setprecision(4) << xGlobal.x() << "," << std::fixed
0765            << std::setprecision(4) << xGlobal.y() << "," << std::fixed << std::setprecision(4) << xGlobal.z() << ")"
0766            << std::endl
0767            << "\t y = k = (" << std::fixed << std::setprecision(4) << y.X() << "," << std::fixed << std::setprecision(4)
0768            << y.Y() << "," << std::fixed << std::setprecision(4) << y.Z() << ")" << std::endl
0769            << "\t [Rec] = (" << std::fixed << std::setprecision(4) << yGlobal.x() << "," << std::fixed
0770            << std::setprecision(4) << yGlobal.y() << "," << std::fixed << std::setprecision(4) << yGlobal.z() << ")"
0771            << std::endl;
0772 
0773     // NumberingScheme
0774     NumberingOutput << rawid;
0775 
0776     //    if ( fromDDD_ && printDDD_ ) {
0777     //      NumberingOutput << " " << detNavType;
0778     //    }
0779     //nav_type typedef changed in 3_6_2; comment out for now.  idr 10/6/10
0780 
0781     NumberingOutput << " " << std::fixed << std::setprecision(4) << modules[i]->translation().X() << " " << std::fixed
0782                     << std::setprecision(4) << modules[i]->translation().Y() << " " << std::fixed
0783                     << std::setprecision(4) << modules[i]->translation().Z() << " " << std::endl;
0784     //
0785   }
0786 
0787   // params
0788   // Pixel
0789   unsigned int chan_per_psiB[16] = {0}, chan_per_psiD[16] = {0};
0790   double chan_pxb = 0.0;
0791   double chan_strx12 = 0.0;
0792   double chan_strx34 = 0.0;
0793   double chan_pxf = 0.0;
0794   unsigned int psi_pxbN = 0, psi_pxb_strx12N = 0, psi_pxb_strx34N = 0, psi_pxfN = 0;
0795   for (int i = 0; i < 16; i++) {
0796     chan_per_psiB[i] = (unsigned int)(thepixROCRowsB[i] * thepixROCColsB[i]);
0797     chan_per_psiD[i] = (unsigned int)(thepixROCRowsD[i] * thepixROCColsD[i]);
0798     chan_pxb += psi_pxb[i] * chan_per_psiB[i];
0799     chan_strx12 += psi_pxb_strx12[i] * chan_per_psiB[i];
0800     chan_strx34 += psi_pxb_strx34[i] * chan_per_psiB[i];
0801     chan_pxf += psi_pxf[i] * chan_per_psiD[i];
0802     psi_pxbN += (unsigned int)psi_pxb[i];
0803     psi_pxb_strx12N += (unsigned int)psi_pxb_strx12[i];
0804     psi_pxb_strx34N += (unsigned int)psi_pxb_strx34[i];
0805     psi_pxfN += (unsigned int)psi_pxf[i];
0806   }
0807 
0808   // Strip
0809   unsigned int chan_per_apv = 128;
0810   double chan_tib = apv_tib * chan_per_apv;
0811   double chan_tid = apv_tid * chan_per_apv;
0812   double chan_tob = apv_tob * chan_per_apv;
0813   double chan_tec = apv_tec * chan_per_apv;
0814   double psi_tot = psi_pxbN + psi_pxb_strx12N + psi_pxb_strx34N + psi_pxfN;
0815   double apv_tot = apv_tib + apv_tid + apv_tob + apv_tec;
0816   double chan_pixel = chan_pxb + chan_strx12 + chan_strx34 + chan_pxf;
0817   double chan_strip = chan_tib + chan_tid + chan_tob + chan_tec;
0818   double chan_tot = chan_pixel + chan_strip;
0819   //
0820 
0821   // summary
0822   Output << "---------------------" << std::endl;
0823   Output << " Counters " << std::endl;
0824   Output << "---------------------" << std::endl;
0825   Output << " Total number of PXB layers   = " << nlayersPXB << std::endl;
0826   Output << " PXB Total   = " << pxbN << std::endl;
0827   Output << "   Inner: Full = " << pxb_fullN << std::endl;
0828   Output << "   Inner: Half = " << pxb_halfN << std::endl;
0829   Output << "        Stacks = " << pxb_stackN << std::endl;
0830   //Output << "   Strx12: Full = " << pxb_full_strx12N << std::endl;
0831   //Output << "   Strx12: Half = " << pxb_half_strx12N << std::endl;
0832   //Output << "   Strx34: Full = " << pxb_full_strx34N << std::endl;
0833   //Output << "   Strx34: Half = " << pxb_half_strx34N << std::endl;
0834   Output << "   Active Silicon Detectors" << std::endl;
0835   Output << "        NEED TO VERIFY THE NEXT 6 LINES!!!!!!!!!!!!!!!!! " << std::endl;
0836   Output << "        PSI46s Inner  = " << (int)psi_pxbN << std::endl;
0837   Output << "        PSI46s Strx12  = " << (int)psi_pxb_strx12N << std::endl;
0838   Output << "        PSI46s Strx34  = " << (int)psi_pxb_strx34N << std::endl;
0839   Output << "        channels Inner = " << (int)chan_pxb << std::endl;
0840   Output << "        channels Strx12 = " << (int)chan_strx12 << std::endl;
0841   Output << "        channels Strx34 = " << (int)chan_strx34 << std::endl;
0842   Output << " PXF    = " << pxfN << std::endl;
0843   Output << "   PH1 = " << pxf_D_N << std::endl;
0844   Output << "   1x2 = " << pxf_1x2N << std::endl;
0845   Output << "   1x5 = " << pxf_1x5N << std::endl;
0846   Output << "   2x3 = " << pxf_2x3N << std::endl;
0847   Output << "   2x4 = " << pxf_2x4N << std::endl;
0848   Output << "   2x5 = " << pxf_2x5N << std::endl;
0849   Output << "   Active Silicon Detectors" << std::endl;
0850   Output << "        PSI46s   = " << (int)psi_pxfN << std::endl;
0851   Output << "        channels = " << (int)chan_pxf << std::endl;
0852   Output << " TIB    = " << tibN << std::endl;
0853   Output << "   L12 rphi   = " << tib_L12_rphiN << std::endl;
0854   Output << "   L12 stereo = " << tib_L12_sterN << std::endl;
0855   Output << "   L34        = " << tib_L34_rphiN << std::endl;
0856   Output << "   Active Silicon Detectors" << std::endl;
0857   Output << "        APV25s   = " << (int)apv_tib << std::endl;
0858   Output << "        channels = " << (int)chan_tib << std::endl;
0859   Output << " TID    = " << tidN << std::endl;
0860   Output << "   r1 rphi    = " << tid_r1_rphiN << std::endl;
0861   Output << "   r1 stereo  = " << tid_r1_sterN << std::endl;
0862   Output << "   r2 rphi    = " << tid_r2_rphiN << std::endl;
0863   Output << "   r2 stereo  = " << tid_r2_sterN << std::endl;
0864   Output << "   r3 rphi    = " << tid_r3_rphiN << std::endl;
0865   Output << "   Active Silicon Detectors" << std::endl;
0866   Output << "        APV25s   = " << (int)apv_tid << std::endl;
0867   Output << "        channels = " << (int)chan_tid << std::endl;
0868   Output << " TOB    = " << tobN << std::endl;
0869   Output << "   L12 rphi   = " << tob_L12_rphiN << std::endl;
0870   Output << "   L12 stereo = " << tob_L12_sterN << std::endl;
0871   Output << "   L34        = " << tob_L34_rphiN << std::endl;
0872   Output << "   L56        = " << tob_L56_rphiN << std::endl;
0873   Output << "   Active Silicon Detectors" << std::endl;
0874   Output << "        APV25s   = " << (int)apv_tob << std::endl;
0875   Output << "        channels = " << (int)chan_tob << std::endl;
0876   Output << " TEC    = " << tecN << std::endl;
0877   Output << "   r1 rphi    = " << tec_r1_rphiN << std::endl;
0878   Output << "   r1 stereo  = " << tec_r1_sterN << std::endl;
0879   Output << "   r2 rphi    = " << tec_r2_rphiN << std::endl;
0880   Output << "   r2 stereo  = " << tec_r2_sterN << std::endl;
0881   Output << "   r3 rphi    = " << tec_r3_rphiN << std::endl;
0882   Output << "   r4 rphi    = " << tec_r4_rphiN << std::endl;
0883   Output << "   r5 rphi    = " << tec_r5_rphiN << std::endl;
0884   Output << "   r5 stereo  = " << tec_r5_sterN << std::endl;
0885   Output << "   r6 rphi    = " << tec_r6_rphiN << std::endl;
0886   Output << "   r7 rphi    = " << tec_r7_rphiN << std::endl;
0887   Output << "   Active Silicon Detectors" << std::endl;
0888   Output << "        APV25s   = " << (int)apv_tec << std::endl;
0889   Output << "        channels = " << (int)chan_tec << std::endl;
0890   Output << "---------------------" << std::endl;
0891   Output << "        PSI46s   = " << (int)psi_tot << std::endl;
0892   Output << "        APV25s   = " << (int)apv_tot << std::endl;
0893   Output << "        pixel channels = " << (int)chan_pixel << std::endl;
0894   Output << "        strip channels = " << (int)chan_strip << std::endl;
0895   Output << "        total channels = " << (int)chan_tot << std::endl;
0896   //
0897   for (unsigned int i = 0; i < nlayersPXB; i++) {
0898     GeometryOutput << "   PXB Layer no. " << i + 1 << std::endl;
0899     GeometryOutput << "        Mean radius of layer no. " << i + 1 << ": "
0900                    << pxbR_L[i] / (pxb_full_L[i] + pxb_half_L[i] + pxb_stack[i]) << " [cm]" << std::endl;
0901     GeometryOutput << "        Maximum length in Z of layer no. " << i + 1 << ": " << pxbZ_L[i] << " [cm]" << std::endl;
0902     GeometryOutput << "        Number of Full module in PXB layer no. " << i + 1 << ": " << pxb_full_L[i] << std::endl;
0903     GeometryOutput << "        Number of Half module in PXB layer no. " << i + 1 << ": " << pxb_half_L[i] << std::endl;
0904     GeometryOutput << "        Number of stack module in PXB layer no. " << i + 1 << ": " << pxb_stack[i] << std::endl;
0905     GeometryOutput << "        Number of PSI46s in PXB layer no. " << i + 1 << ": " << psi_pxb_L[i] << std::endl;
0906     GeometryOutput << "        Number of pixel channels in PXB layer no. " << i + 1 << ": "
0907                    << (int)psi_pxb_L[i] * chan_per_psiB[i] << std::endl;
0908     GeometryOutput << "        Pitch X & Y (microns) of PXB layer no. " << i + 1 << ": " << pxbpitchx[i] << " & "
0909                    << pxbpitchy[i] << std::endl;
0910     GeometryOutput << std::endl;
0911     GeometryXLS << "PXB" << i + 1 << " " << pxbR_L[i] / (pxb_full_L[i] + pxb_half_L[i] + pxb_stack[i]) << " " << 0
0912                 << " " << pxbZ_L[i] << " " << psi_pxb_L[i] << " " << (int)psi_pxb_L[i] * chan_per_psiB[i] << " "
0913                 << pxb_full_L[i] + pxb_half_L[i] + pxb_stack[i] << " " << pxb_full_L[i] << " " << pxb_half_L[i] << " "
0914                 << pxb_stack[i] << std::endl;
0915   }
0916   for (unsigned int i = 0; i < nlayersTIB; i++) {
0917     GeometryOutput << "   TIB Layer no. " << i + 1 << std::endl;
0918     GeometryOutput << "        Meam radius of layer no. " << i + 1 << ": "
0919                    << tibR_L[i] / (tib_L12_rphi_L[i] + tib_L12_ster_L[i] + tib_L34_rphi_L[i]) << " [cm]" << std::endl;
0920     GeometryOutput << "        Maximum length in Z of layer no. " << i + 1 << ": " << tibZ_L[i] << " [cm]" << std::endl;
0921     if (tib_L12_rphi_L[i] != 0)
0922       GeometryOutput << "        Number of IB1 rphi minimodules in TIB layer no. " << i + 1 << ": " << tib_L12_rphi_L[i]
0923                      << std::endl;
0924     if (tib_L12_ster_L[i] != 0)
0925       GeometryOutput << "        Number of IB1 stereo minimodules in TIB layer no. " << i + 1 << ": "
0926                      << tib_L12_ster_L[i] << std::endl;
0927     if (tib_L34_rphi_L[i] != 0)
0928       GeometryOutput << "        Number of IB2 rphi minimodules in TIB layer no. " << i + 1 << ": " << tib_L34_rphi_L[i]
0929                      << std::endl;
0930     GeometryOutput << "        Active Silicon surface in TIB layer no. " << i + 1 << ": " << std::endl;
0931     GeometryOutput << "        Number of APV25s in TIB layer no. " << i + 1 << ": " << tib_apv_L[i] << std::endl;
0932     GeometryOutput << "        Number of strip channels in TIB layer no. " << i + 1 << ": "
0933                    << (int)tib_apv_L[i] * chan_per_apv << std::endl;
0934     GeometryOutput << std::endl;
0935     GeometryXLS << "TIB" << i + 1 << " " << tibR_L[i] / (tib_L12_rphi_L[i] + tib_L12_ster_L[i] + tib_L34_rphi_L[i])
0936                 << " " << 0 << " " << tibZ_L[i] << " "
0937                 << " " << tib_apv_L[i] << " " << (int)tib_apv_L[i] * chan_per_apv << " "
0938                 << tib_L12_rphi_L[i] + tib_L12_ster_L[i] + tib_L34_rphi_L[i] << " " << tib_L12_rphi_L[i] << " "
0939                 << tib_L12_ster_L[i] << " " << tib_L34_rphi_L[i] << std::endl;
0940   }
0941   for (unsigned int i = 0; i < nlayersTOB; i++) {
0942     GeometryOutput << "   TOB Layer no. " << i + 1 << std::endl;
0943     GeometryOutput << "        Meam radius of layer no. " << i + 1 << ": "
0944                    << tobR_L[i] / (tob_L12_rphi_L[i] + tob_L12_ster_L[i] + tob_L34_rphi_L[i] + tob_L56_rphi_L[i])
0945                    << " [cm]" << std::endl;
0946     GeometryOutput << "        Maximum length in Z of layer no. " << i + 1 << ": " << tobZ_L[i] << " [cm]" << std::endl;
0947     if (tob_L12_rphi_L[i] != 0)
0948       GeometryOutput << "        Number of OB1 rphi minimodules in TOB layer no. " << i + 1 << ": " << tob_L12_rphi_L[i]
0949                      << std::endl;
0950     if (tob_L12_ster_L[i] != 0)
0951       GeometryOutput << "        Number of OB1 stereo minimodules in TOB layer no. " << i + 1 << ": "
0952                      << tob_L12_ster_L[i] << std::endl;
0953     if (tob_L34_rphi_L[i] != 0)
0954       GeometryOutput << "        Number of OB1 rphi minimodules in TOB layer no. " << i + 1 << ": " << tob_L34_rphi_L[i]
0955                      << std::endl;
0956     if (tob_L56_rphi_L[i] != 0)
0957       GeometryOutput << "        Number of OB2 rphi minimodules in TOB layer no. " << i + 1 << ": " << tob_L56_rphi_L[i]
0958                      << std::endl;
0959     GeometryOutput << "        Number of APV25s in TOB layer no. " << i + 1 << ": " << tob_apv_L[i] << std::endl;
0960     GeometryOutput << "        Number of strip channels in TOB layer no. " << i + 1 << ": "
0961                    << (int)tob_apv_L[i] * chan_per_apv << std::endl;
0962     GeometryOutput << std::endl;
0963     GeometryXLS << "TOB" << i + 1 << " "
0964                 << tobR_L[i] / (tob_L12_rphi_L[i] + tob_L12_ster_L[i] + tob_L34_rphi_L[i] + tob_L56_rphi_L[i]) << " "
0965                 << 0 << " " << tobZ_L[i] << " "
0966                 << " " << tob_apv_L[i] << " " << (int)tob_apv_L[i] * chan_per_apv << " "
0967                 << tob_L12_rphi_L[i] + tob_L12_ster_L[i] + tob_L34_rphi_L[i] + tob_L56_rphi_L[i] << " "
0968                 << tob_L12_rphi_L[i] << " " << tob_L12_ster_L[i] << " " << tob_L34_rphi_L[i] << " " << tob_L56_rphi_L[i]
0969                 << std::endl;
0970   }
0971   for (unsigned int i = 0; i < ndisksPXF; i++) {
0972     GeometryOutput << "   PXF Disk no. " << i + 1 << " (numbers are the total for both sides)" << std::endl;
0973     GeometryOutput << "        Minimum radius of disk no. " << i + 1 << ": " << pxfR_min_D[i] << " [cm]" << std::endl;
0974     GeometryOutput << "        Maximum radius of disk no. " << i + 1 << ": " << pxfR_max_D[i] << " [cm]" << std::endl;
0975     GeometryOutput << "        Position in Z of disk no. " << i + 1 << ": "
0976                    << pxfZ_D[i] / (pxf_D[i] + pxf_1x2_D[i] + pxf_1x5_D[i] + pxf_2x3_D[i] + pxf_2x4_D[i] + pxf_2x5_D[i])
0977                    << " [cm]" << std::endl;
0978     GeometryOutput << "        Number of 1x2 modules in PXF disk no. " << i + 1 << ": " << pxf_1x2_D[i] << std::endl;
0979     GeometryOutput << "        Number of 1x5 modules in PXF disk no. " << i + 1 << ": " << pxf_1x5_D[i] << std::endl;
0980     GeometryOutput << "        Number of 2x3 modules in PXF disk no. " << i + 1 << ": " << pxf_2x3_D[i] << std::endl;
0981     GeometryOutput << "        Number of 2x4 modules in PXF disk no. " << i + 1 << ": " << pxf_2x4_D[i] << std::endl;
0982     GeometryOutput << "        Number of 2x5 modules in PXF disk no. " << i + 1 << ": " << pxf_2x5_D[i] << std::endl;
0983     GeometryOutput << "        Number of 2x8 modules in PXF disk no. " << i + 1 << ": " << pxf_D[i] << std::endl;
0984     GeometryOutput << "        Number of PSI46s in PXF disk no. " << i + 1 << ": " << psi_pxf_D[i] << std::endl;
0985     GeometryOutput << "        Number of pixel channels in PXF disk no. " << i + 1 << ": "
0986                    << (int)psi_pxf_D[i] * chan_per_psiD[i] << std::endl;
0987     GeometryOutput << "        Pitch X & Y (microns) of PXF disk no. " << i + 1 << ": " << pxfpitchx[i] << " & "
0988                    << pxfpitchy[i] << std::endl;
0989     GeometryOutput << std::endl;
0990     GeometryXLS << "PXF" << i + 1 << " " << pxfR_min_D[i] << " " << pxfR_max_D[i] << " "
0991                 << pxfZ_D[i] / (pxf_D[i] + pxf_1x2_D[i] + pxf_1x5_D[i] + pxf_2x3_D[i] + pxf_2x4_D[i] + pxf_2x5_D[i])
0992                 << " " << psi_pxf_D[i] << " " << (int)psi_pxf_D[i] * chan_per_psiD[i] << " "
0993                 << pxf_D[i] + pxf_1x2_D[i] + pxf_1x5_D[i] + pxf_2x3_D[i] + pxf_2x4_D[i] + pxf_2x5_D[i] << " "
0994                 << pxf_D[i] << " " << pxf_1x2_D[i] << " " << pxf_1x5_D[i] << " " << pxf_2x3_D[i] << " " << pxf_2x4_D[i]
0995                 << " " << pxf_2x5_D[i] << std::endl;
0996   }
0997   for (unsigned int i = 0; i < ndisksTID; i++) {
0998     GeometryOutput << "   TID Disk no. " << i + 1 << " (numbers are the total for both sides)" << std::endl;
0999     GeometryOutput << "        Minimum radius of disk no. " << i + 1 << ": " << tidR_min_D[i] << " [cm]" << std::endl;
1000     GeometryOutput << "        Maximum radius of disk no. " << i + 1 << ": " << tidR_max_D[i] << " [cm]" << std::endl;
1001     int tot = tid_r1_rphi_D[i] + tid_r1_ster_D[i] + tid_r2_rphi_D[i] + tid_r2_ster_D[i] + tid_r3_rphi_D[i];
1002     GeometryOutput << "        Position in Z of disk no. " << i + 1 << ": " << tidZ_D[i] / tot << " [cm]" << std::endl;
1003     GeometryOutput << "        Number of r1_rphi modules in TID disk no. " << i + 1 << ": " << tid_r1_rphi_D[i]
1004                    << std::endl;
1005     GeometryOutput << "        Number of r1_ster modules in TID disk no. " << i + 1 << ": " << tid_r1_ster_D[i]
1006                    << std::endl;
1007     GeometryOutput << "        Number of r2_rphi modules in TID disk no. " << i + 1 << ": " << tid_r2_rphi_D[i]
1008                    << std::endl;
1009     GeometryOutput << "        Number of r2_ster modules in TID disk no. " << i + 1 << ": " << tid_r2_ster_D[i]
1010                    << std::endl;
1011     GeometryOutput << "        Number of r3_rphi modules in TID disk no. " << i + 1 << ": " << tid_r3_rphi_D[i]
1012                    << std::endl;
1013     GeometryOutput << "        Number of APV25s in TID disk no. " << i + 1 << ": " << tid_apv_D[i] << std::endl;
1014     GeometryOutput << "        Number of strip channels in TID disk no. " << i + 1 << ": "
1015                    << (int)tid_apv_D[i] * chan_per_apv << std::endl;
1016     GeometryOutput << std::endl;
1017     GeometryXLS << "TID" << i + 1 << " " << tidR_min_D[i] << " " << tidR_max_D[i] << " " << tidZ_D[i] / tot << " "
1018                 << " " << tid_apv_D[i] << " " << (int)tid_apv_D[i] * chan_per_apv << " " << tot << " "
1019                 << tid_r1_rphi_D[i] << " " << tid_r1_ster_D[i] << " " << tid_r2_rphi_D[i] << " " << tid_r2_ster_D[i]
1020                 << " " << tid_r3_rphi_D[i] << std::endl;
1021   }
1022   for (unsigned int i = 0; i < nwheelsTEC; i++) {
1023     GeometryOutput << "   TEC Disk no. " << i + 1 << " (numbers are the total for both sides)" << std::endl;
1024     GeometryOutput << "        Minimum radius of wheel no. " << i + 1 << ": " << tecR_min_D[i] << " [cm]" << std::endl;
1025     GeometryOutput << "        Maximum radius of wheel no. " << i + 1 << ": " << tecR_max_D[i] << " [cm]" << std::endl;
1026     int tot = tec_r1_rphi_D[i] + tec_r1_ster_D[i] + tec_r2_rphi_D[i] + tec_r2_ster_D[i] + tec_r3_rphi_D[i] +
1027               tec_r4_rphi_D[i] + tec_r5_rphi_D[i] + tec_r5_ster_D[i] + tec_r6_rphi_D[i] + tec_r7_rphi_D[i];
1028     GeometryOutput << "        Position in Z of wheel no. " << i + 1 << ": " << tecZ_D[i] / tot << " [cm]" << std::endl;
1029     GeometryOutput << "        Number of r1_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r1_rphi_D[i]
1030                    << std::endl;
1031     GeometryOutput << "        Number of r1_ster modules in TEC wheel no. " << i + 1 << ": " << tec_r1_ster_D[i]
1032                    << std::endl;
1033     GeometryOutput << "        Number of r2_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r2_rphi_D[i]
1034                    << std::endl;
1035     GeometryOutput << "        Number of r2_ster modules in TEC wheel no. " << i + 1 << ": " << tec_r2_ster_D[i]
1036                    << std::endl;
1037     GeometryOutput << "        Number of r3_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r3_rphi_D[i]
1038                    << std::endl;
1039     GeometryOutput << "        Number of r4_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r4_rphi_D[i]
1040                    << std::endl;
1041     GeometryOutput << "        Number of r5_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r5_rphi_D[i]
1042                    << std::endl;
1043     GeometryOutput << "        Number of r5_ster modules in TEC wheel no. " << i + 1 << ": " << tec_r5_ster_D[i]
1044                    << std::endl;
1045     GeometryOutput << "        Number of r6_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r6_rphi_D[i]
1046                    << std::endl;
1047     GeometryOutput << "        Number of r7_rphi modules in TEC wheel no. " << i + 1 << ": " << tec_r7_rphi_D[i]
1048                    << std::endl;
1049     GeometryOutput << "        Number of APV25s in TEC wheel no. " << i + 1 << ": " << tec_apv_D[i] << std::endl;
1050     GeometryOutput << "        Number of strip channels in TEC wheel no. " << i + 1 << ": "
1051                    << (int)tec_apv_D[i] * chan_per_apv << std::endl;
1052     GeometryOutput << std::endl;
1053     GeometryXLS << "TEC" << i + 1 << " " << tecR_min_D[i] << " " << tecR_max_D[i] << " " << tecZ_D[i] / tot << " "
1054                 << tec_apv_D[i] << " " << (int)tec_apv_D[i] * chan_per_apv << " " << tot << " " << tec_r1_rphi_D[i]
1055                 << " " << tec_r1_ster_D[i] << " " << tec_r2_rphi_D[i] << " " << tec_r2_ster_D[i] << " "
1056                 << tec_r3_rphi_D[i] << " " << tec_r4_rphi_D[i] << " " << tec_r5_rphi_D[i] << " " << tec_r5_ster_D[i]
1057                 << " " << tec_r6_rphi_D[i] << " " << tec_r7_rphi_D[i] << std::endl;
1058   }
1059 }
1060 
1061 //define this as a plug-in
1062 DEFINE_FWK_MODULE(ModuleInfo_Phase2);