Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-22 04:03:26

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