Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:01

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 
0039 #ifdef SCRIVI
0040   for (int ii = 0; ii < touch->GetHistoryDepth(); ii++) {
0041     physVol = touch->GetVolume(ii);
0042     LogDebug("ForwardSim") << "physVol=" << physVol->GetName() << ", level=" << ii
0043                            << ", physVol->GetCopyNo()=" << physVol->GetCopyNo();
0044   }
0045 #endif
0046 
0047   physVol = touch->GetVolume(0);
0048 
0049   std::string dName = ForwardName::getName(physVol->GetName());
0050   if (dName == "TotemT2gem")
0051     UNITA = 10 + physVol->GetCopyNo();
0052   else if (dName == "TotemT2gem_supporto")
0053     UNITA = 20 + physVol->GetCopyNo();
0054   else if (dName == "TotemT2gem_detector7r")
0055     UNITA = 100 + physVol->GetCopyNo() + (touch->GetVolume(2)->GetCopyNo()) * 1000;
0056   else if (dName == "TotemT2gem_HC7r")
0057     UNITA = 200 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0058   else if (dName == "TotemT2gem_drift7r")
0059     UNITA = 300 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0060   else if (dName == "TotemT2gem_driftspace7r")
0061     UNITA = 400 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0062   else if (dName == "TotemT2gem_GEMa7r")
0063     UNITA = 500 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0064   else if (dName == "TotemT2gem_GEMb7r")
0065     UNITA = 600 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0066   else if (dName == "TotemT2gem_GEMc7r")
0067     UNITA = 700 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0068   else if (dName == "TotemT2gem_GAS7r")
0069     UNITA = 800 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0070   else if (dName == "TotemT2gem_GEMa17r")
0071     UNITA = 900 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0072   else if (dName == "TotemT2gem_GEMb17r")
0073     UNITA = 1000 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0074   else if (dName == "TotemT2gem_GEMc17r")
0075     UNITA = 1100 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0076   else if (dName == "TotemT2gem_GAS17r")
0077     UNITA = 1200 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0078   else if (dName == "TotemT2gem_GEMa27r")
0079     UNITA = 1300 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0080   else if (dName == "TotemT2gem_GEMb27r")
0081     UNITA = 1400 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0082   else if (dName == "TotemT2gem_GEMc27r")
0083     UNITA = 1500 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0084   else if (dName == "TotemT2gem_GAS27r")
0085     UNITA = 1600 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0086   else if (dName == "TotemT2gem_strips7r")
0087     UNITA = 1700 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0088   else if (dName == "TotemT2gem_isol7r")
0089     UNITA = 1800 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0090   else if (dName == "TotemT2gem_pads7r")
0091     UNITA = 1900 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0092   else if (dName == "TotemT2gem_HC17r")
0093     UNITA = 2000 + touch->GetVolume(1)->GetCopyNo() + (touch->GetVolume(3)->GetCopyNo()) * 1000;
0094 
0095   return UNITA;
0096 }