Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-13 01:44:05

0001 // -*- C++ -*-
0002 //
0003 // Package:     Forward
0004 // Class  :     TotemT2OrganizationGem
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:
0010 //         Created:  Tue May 16 10:14:34 CEST 2006
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "SimG4CMS/Forward/interface/TotemT2OrganizationGem.h"
0017 #include "SimG4CMS/Forward/interface/TotemNumberMerger.h"
0018 #include "SimG4CMS/Forward/interface/ForwardName.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 
0021 #include "G4VPhysicalVolume.hh"
0022 #include "G4VTouchable.hh"
0023 
0024 //
0025 // constructors and destructor
0026 //
0027 
0028 TotemT2OrganizationGem ::TotemT2OrganizationGem() {
0029   edm::LogVerbatim("ForwardSim") << "Creating TotemT2OrganizationGem";
0030 }
0031 
0032 TotemT2OrganizationGem ::~TotemT2OrganizationGem() {}
0033 
0034 uint32_t TotemT2OrganizationGem ::getUnitID(const G4Step* aStep) const {
0035   G4VPhysicalVolume* physVol;
0036   uint32_t UNITA = 0;
0037   const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable();
0038   int ii = 0;
0039   for (ii = 0; ii < touch->GetHistoryDepth(); ii++) {
0040     physVol = touch->GetVolume(ii);
0041 
0042 #ifdef SCRIVI
0043     LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level=" << ii
0044                            << ", physVol->GetCopyNo()=" << physVol->GetCopyNo();
0045 #endif
0046   }
0047 
0048   physVol = touch->GetVolume(0);
0049 
0050   std::string dName = ForwardName::getName(physVol->GetName());
0051   if (dName == "TotemT2gem")
0052     UNITA = 10 + physVol->GetCopyNo();
0053   else if (dName == "TotemT2gem_supporto")
0054     UNITA = 20 + physVol->GetCopyNo();
0055   else if (dName == "TotemT2gem_detector7r")
0056     UNITA = 100 + physVol->GetCopyNo() + (touch->GetVolume(2)->GetCopyNo()) * 1000;
0057   else if (dName == "TotemT2gem_HC7r")
0058     UNITA = 200 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0059   else if (dName == "TotemT2gem_drift7r")
0060     UNITA = 300 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0061   else if (dName == "TotemT2gem_driftspace7r")
0062     UNITA = 400 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0063   else if (dName == "TotemT2gem_GEMa7r")
0064     UNITA = 500 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0065   else if (dName == "TotemT2gem_GEMb7r")
0066     UNITA = 600 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0067   else if (dName == "TotemT2gem_GEMc7r")
0068     UNITA = 700 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0069   else if (dName == "TotemT2gem_GAS7r")
0070     UNITA = 800 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0071   else if (dName == "TotemT2gem_GEMa17r")
0072     UNITA = 900 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0073   else if (dName == "TotemT2gem_GEMb17r")
0074     UNITA = 1000 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0075   else if (dName == "TotemT2gem_GEMc17r")
0076     UNITA = 1100 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0077   else if (dName == "TotemT2gem_GAS17r")
0078     UNITA = 1200 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0079   else if (dName == "TotemT2gem_GEMa27r")
0080     UNITA = 1300 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0081   else if (dName == "TotemT2gem_GEMb27r")
0082     UNITA = 1400 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0083   else if (dName == "TotemT2gem_GEMc27r")
0084     UNITA = 1500 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0085   else if (dName == "TotemT2gem_GAS27r")
0086     UNITA = 1600 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0087   else if (dName == "TotemT2gem_strips7r")
0088     UNITA = 1700 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0089   else if (dName == "TotemT2gem_isol7r")
0090     UNITA = 1800 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0091   else if (dName == "TotemT2gem_pads7r")
0092     UNITA = 1900 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0093   else if (dName == "TotemT2gem_HC17r")
0094     UNITA = 2000 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0095 
0096   return UNITA;
0097 }