Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /* 27 * =========================================== 28 * 29 * Filename: CexmcTrackPointsDigitizer. 30 * 31 * Description: track points collector 32 * 33 * Version: 1.0 34 * Created: 24.11.2009 16:34:43 35 * Revision: none 36 * Compiler: gcc 37 * 38 * Author: Alexey Radkov (), 39 * Company: PNPI 40 * 41 * =========================================== 42 */ 43 44 #include <G4DigiManager.hh> 45 #include <G4RunManager.hh> 46 #include <G4String.hh> 47 #include "CexmcTrackPointsDigitizer.hh" 48 #include "CexmcTrackPoints.hh" 49 #include "CexmcTrackPointsInLeftRightSet.hh" 50 #include "CexmcTrackPointsInCalorimeter.hh" 51 #include "CexmcSensitiveDetectorsAttributes.hh 52 #include "CexmcCommon.hh" 53 54 55 CexmcTrackPointsDigitizer::CexmcTrackPointsDig 56 G4VDigitizerModule( name ), hasTriggered( 57 { 58 G4RunManager * runManager( G4RunManag 59 const CexmcSetup * setup( static_cast< co 60 runManager->Ge 61 calorimeterGeometry = setup->GetCalorimete 62 } 63 64 65 void CexmcTrackPointsDigitizer::InitializeDat 66 { 67 monitorTP.trackId = CexmcInvalidTrackId; 68 targetTPBeamParticle.trackId = CexmcInvali 69 targetTPOutputParticle.trackId = CexmcInva 70 targetTPNucleusParticle.trackId = CexmcInv 71 targetTPOutputParticleDecayProductParticle 72 73 targetTPOutputParticleDecayProductParticle 74 75 vetoCounterTPLeft.trackId = CexmcInvalidTr 76 vetoCounterTPRight.trackId = CexmcInvalidT 77 calorimeterTPLeft.trackId = CexmcInvalidTr 78 calorimeterTPRight.trackId = CexmcInvalidT 79 hasTriggered = false; 80 } 81 82 83 void CexmcTrackPointsDigitizer::Digitize( voi 84 { 85 InitializeData(); 86 87 G4int nCrystalsInColumn( calorimeterGe 88 G4int nCrystalsInRow( calorimeterGeome 89 G4double crystalWidth( calorimeterGeometr 90 G4double crystalHeight( calorimeterGeomet 91 92 G4DigiManager * digiManager( G4DigiManage 93 G4int hcId( digiManager->GetHitsCollect 94 CexmcDetectorRoleName[ Cex 95 "/" + CexmcDetectorTypeNam 96 const CexmcTrackPointsCollection * 97 hitsCollection( static_cast< cons 98 digiManage 99 100 if ( hitsCollection ) 101 { 102 for ( CexmcTrackPointsCollectionData:: 103 k( hitsCollection->GetMap()- 104 k != hitsCollection->Get 105 { 106 monitorTP = *k->second; 107 break; 108 } 109 } 110 111 hcId = digiManager->GetHitsCollectionID( 112 CexmcDetectorRoleName[ Cex 113 "/" + CexmcDetectorTypeNam 114 hitsCollection = static_cast< const CexmcT 115 digiManage 116 117 if ( hitsCollection ) 118 { 119 for ( CexmcTrackPointsCollectionData:: 120 k( hitsCollection->GetMap()- 121 k != hitsCollection->Get 122 { 123 do 124 { 125 if ( k->second->trackType == C 126 { 127 targetTPBeamParticle = *k- 128 break; 129 } 130 if ( k->second->trackType == C 131 { 132 targetTPOutputParticle = * 133 hasTriggered = targetTPOut 134 break; 135 } 136 if ( k->second->trackType == C 137 { 138 targetTPNucleusParticle = 139 break; 140 } 141 if ( k->second->trackType == 142 CexmcO 143 { 144 /* NB: if there are more t 145 * products then the chose 146 * which entered calorimet 147 * critical issue as far a 148 * is not necessary in rec 149 * histograming */ 150 G4int index( 151 targetTPOutputPart 152 153 targetTPOutputParticleDeca 154 *k->second; 155 break; 156 } 157 } while ( false ); 158 } 159 } 160 161 hcId = digiManager->GetHitsCollectionID( 162 CexmcDetectorRoleName[ Cex 163 "/" + CexmcDetectorTypeNam 164 hitsCollection = static_cast< const CexmcT 165 digiManage 166 167 if ( hitsCollection ) 168 { 169 for ( CexmcTrackPointsCollectionData:: 170 k( hitsCollection->GetMap()- 171 k != hitsCollection->Get 172 { 173 if ( k->second->trackType != Cexmc 174 continue; 175 176 G4int index( k->first ); 177 CexmcSide side( CexmcTrackPointsI 178 179 switch ( side ) 180 { 181 case CexmcLeft : 182 vetoCounterTPLeft = *k->second 183 break; 184 case CexmcRight : 185 vetoCounterTPRight = *k->secon 186 break; 187 default : 188 break; 189 } 190 } 191 } 192 193 hcId = digiManager->GetHitsCollectionID( 194 CexmcDetectorRoleName[ Cex 195 "/" + CexmcDetectorTypeNam 196 hitsCollection = static_cast< const CexmcT 197 digiManage 198 199 if ( hitsCollection ) 200 { 201 for ( CexmcTrackPointsCollectionData:: 202 k( hitsCollection->GetMap()- 203 k != hitsCollection->Get 204 { 205 if ( k->second->trackType != Cexmc 206 continue; 207 208 G4int index( k->first ); 209 CexmcSide side( CexmcTrackPointsI 210 211 G4int row( CexmcTrackPointsIn 212 G4int column( CexmcTrackPoint 213 214 G4double xInCalorimeterOffset( 215 ( G4double( column ) - G4d 216 crysta 217 G4double yInCalorimeterOffset( 218 ( G4double( row ) - G4doub 219 crysta 220 switch ( side ) 221 { 222 case CexmcLeft : 223 calorimeterTPLeft = *k->second 224 calorimeterTPLeft.positionLoca 225 calori 226 calorimeterTPLeft.positionLoca 227 calori 228 break; 229 case CexmcRight : 230 calorimeterTPRight = *k->secon 231 calorimeterTPRight.positionLoc 232 calori 233 calorimeterTPRight.positionLoc 234 calori 235 break; 236 default : 237 break; 238 } 239 } 240 } 241 } 242 243