Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /* 26 /* 27 * =========================================== 27 * ============================================================================ 28 * 28 * 29 * Filename: CexmcReconstructor.cc 29 * Filename: CexmcReconstructor.cc 30 * 30 * 31 * Description: reconstructor base class 31 * Description: reconstructor base class 32 * 32 * 33 * Version: 1.0 33 * Version: 1.0 34 * Created: 02.12.2009 16:21:15 34 * Created: 02.12.2009 16:21:15 35 * Revision: none 35 * Revision: none 36 * Compiler: gcc 36 * Compiler: gcc 37 * 37 * 38 * Author: Alexey Radkov (), 38 * Author: Alexey Radkov (), 39 * Company: PNPI 39 * Company: PNPI 40 * 40 * 41 * =========================================== 41 * ============================================================================ 42 */ 42 */ 43 43 44 #include "CexmcReconstructor.hh" 44 #include "CexmcReconstructor.hh" 45 #include "CexmcReconstructorMessenger.hh" 45 #include "CexmcReconstructorMessenger.hh" 46 #include "CexmcEnergyDepositStore.hh" 46 #include "CexmcEnergyDepositStore.hh" 47 #include "CexmcRunManager.hh" 47 #include "CexmcRunManager.hh" 48 48 49 49 50 CexmcReconstructor::CexmcReconstructor() : has << 50 CexmcReconstructor::CexmcReconstructor() : >> 51 hasBasicTrigger( false ), 51 epDefinitionAlgorithm( CexmcEntryPointBySq 52 epDefinitionAlgorithm( CexmcEntryPointBySqrtEDWeights ), 52 epDepthDefinitionAlgorithm( CexmcEntryPoin 53 epDepthDefinitionAlgorithm( CexmcEntryPointDepthPlain ), 53 csAlgorithm( CexmcSelectAllCrystals ), use 54 csAlgorithm( CexmcSelectAllCrystals ), useInnerRefCrystal( false ), 54 epDepth( 0 ), theAngle( 0 ), calorimeterED << 55 epDepth( 0 ), theAngle( 0 ), targetEPInitialized( false ), messenger( NULL ) 55 calorimeterEDRightAdjacent( 0 ), collectED << 56 targetEPInitialized( false ), messenger( N << 57 { 56 { 58 G4RunManager * runManager( G4RunManag 57 G4RunManager * runManager( G4RunManager::GetRunManager() ); 59 const CexmcSetup * setup( static_cast< co 58 const CexmcSetup * setup( static_cast< const CexmcSetup * >( 60 runManager->Ge 59 runManager->GetUserDetectorConstruction() ) ); 61 calorimeterGeometry = setup->GetCalorimete 60 calorimeterGeometry = setup->GetCalorimeterGeometry(); 62 targetTransform = setup->GetTargetTransfor 61 targetTransform = setup->GetTargetTransform(); 63 calorimeterLeftTransform = setup->GetCalor 62 calorimeterLeftTransform = setup->GetCalorimeterLeftTransform(); 64 calorimeterRightTransform = setup->GetCalo 63 calorimeterRightTransform = setup->GetCalorimeterRightTransform(); 65 64 66 messenger = new CexmcReconstructorMessenge 65 messenger = new CexmcReconstructorMessenger( this ); 67 } 66 } 68 67 69 68 70 CexmcReconstructor::~CexmcReconstructor() 69 CexmcReconstructor::~CexmcReconstructor() 71 { 70 { 72 delete messenger; 71 delete messenger; 73 } 72 } 74 73 75 74 76 void CexmcReconstructor::Reconstruct( << 75 void CexmcReconstructor::Reconstruct( const CexmcEnergyDepositStore * edStore ) 77 const Cexm << 78 { 76 { 79 ReconstructEntryPoints( edStore ); 77 ReconstructEntryPoints( edStore ); 80 if ( hasBasicTrigger ) 78 if ( hasBasicTrigger ) 81 ReconstructTargetPoint(); 79 ReconstructTargetPoint(); 82 if ( hasBasicTrigger ) 80 if ( hasBasicTrigger ) 83 ReconstructAngle(); 81 ReconstructAngle(); 84 } 82 } 85 83 86 84 87 G4bool CexmcReconstructor::HasFullTrigger( vo 85 G4bool CexmcReconstructor::HasFullTrigger( void ) const 88 { 86 { 89 return hasBasicTrigger; 87 return hasBasicTrigger; 90 } 88 } 91 89 92 90 93 void CexmcReconstructor::ReconstructEntryPoin 91 void CexmcReconstructor::ReconstructEntryPoints( 94 const Cexm << 92 const CexmcEnergyDepositStore * edStore ) 95 { 93 { 96 G4int columnLeft( edStore->calorimeter << 94 G4int nCrystalsInColumn( calorimeterGeometry.nCrystalsInColumn ); 97 G4int rowLeft( edStore->calorimeterEDL << 95 G4int nCrystalsInRow( calorimeterGeometry.nCrystalsInRow ); 98 G4int columnRight( edStore->calorimete << 96 G4double crystalWidth( calorimeterGeometry.crystalWidth ); 99 G4int rowRight( edStore->calorimeterED << 97 G4double crystalHeight( calorimeterGeometry.crystalHeight ); 100 G4double crystalLength( calorimeterGeomet 98 G4double crystalLength( calorimeterGeometry.crystalLength ); 101 99 102 if ( useInnerRefCrystal ) << 103 { << 104 TransformToAdjacentInnerCrystal( colum << 105 TransformToAdjacentInnerCrystal( colum << 106 } << 107 << 108 calorimeterEPLeftPosition.setX( 0 ); 100 calorimeterEPLeftPosition.setX( 0 ); 109 calorimeterEPLeftPosition.setY( 0 ); 101 calorimeterEPLeftPosition.setY( 0 ); 110 calorimeterEPLeftPosition.setZ( -crystalLe 102 calorimeterEPLeftPosition.setZ( -crystalLength / 2 + epDepth ); 111 calorimeterEPLeftDirection.setX( 0 ); 103 calorimeterEPLeftDirection.setX( 0 ); 112 calorimeterEPLeftDirection.setY( 0 ); 104 calorimeterEPLeftDirection.setY( 0 ); 113 calorimeterEPLeftDirection.setZ( 0 ); 105 calorimeterEPLeftDirection.setZ( 0 ); 114 calorimeterEPRightPosition.setX( 0 ); 106 calorimeterEPRightPosition.setX( 0 ); 115 calorimeterEPRightPosition.setY( 0 ); 107 calorimeterEPRightPosition.setY( 0 ); 116 calorimeterEPRightPosition.setZ( -crystalL 108 calorimeterEPRightPosition.setZ( -crystalLength / 2 + epDepth ); 117 calorimeterEPRightDirection.setX( 0 ); 109 calorimeterEPRightDirection.setX( 0 ); 118 calorimeterEPRightDirection.setY( 0 ); 110 calorimeterEPRightDirection.setY( 0 ); 119 calorimeterEPRightDirection.setZ( 0 ); 111 calorimeterEPRightDirection.setZ( 0 ); 120 112 121 G4bool edInAdjacentCrystalsCollected( fal << 113 G4int columnLeft( edStore->calorimeterEDLeftMaxX ); 122 << 114 G4int rowLeft( edStore->calorimeterEDLeftMaxY ); 123 switch ( epDefinitionAlgorithm ) << 115 G4int columnRight( edStore->calorimeterEDRightMaxX ); 124 { << 116 G4int rowRight( edStore->calorimeterEDRightMaxY ); 125 case CexmcEntryPointInTheCenter : << 117 G4double xInCalorimeterLeftOffset( 126 break; << 127 case CexmcEntryPointInTheCenterOfCrystalWi << 128 { << 129 G4int nCrystalsInColumn( << 130 calorimete << 131 G4int nCrystalsInRow( calorime << 132 G4double crystalWidth( calorimete << 133 G4double crystalHeight( calorimet << 134 << 135 calorimeterEPLeftPosition.setX( << 136 ( G4double( columnLeft ) - G4d 118 ( G4double( columnLeft ) - G4double( nCrystalsInRow ) / 2 ) * 137 crysta 119 crystalWidth + crystalWidth / 2 ); 138 calorimeterEPLeftPosition.setY( << 120 G4double yInCalorimeterLeftOffset( 139 ( G4double( rowLeft ) - G4doub 121 ( G4double( rowLeft ) - G4double( nCrystalsInColumn ) / 2 ) * 140 crysta 122 crystalHeight + crystalHeight / 2 ); 141 calorimeterEPRightPosition.setX( << 123 G4double xInCalorimeterRightOffset( 142 ( G4double( columnRight ) - G4 124 ( G4double( columnRight ) - G4double( nCrystalsInRow ) / 2 ) * 143 crysta 125 crystalWidth + crystalWidth / 2 ); 144 calorimeterEPRightPosition.setY( << 126 G4double yInCalorimeterRightOffset( 145 ( G4double( rowRight ) - G4dou 127 ( G4double( rowRight ) - G4double( nCrystalsInColumn ) / 2 ) * 146 crysta 128 crystalHeight + crystalHeight / 2 ); 147 } << 129 G4int i( 0 ); >> 130 G4double xWeightsSum( 0 ); >> 131 G4double yWeightsSum( 0 ); >> 132 G4double energySum( 0 ); >> 133 >> 134 switch ( epDefinitionAlgorithm ) >> 135 { >> 136 case CexmcEntryPointInTheCenter : >> 137 break; >> 138 case CexmcEntryPointInTheCenterOfCrystalWithMaxED : >> 139 calorimeterEPLeftPosition.setX( xInCalorimeterLeftOffset ); >> 140 calorimeterEPLeftPosition.setY( yInCalorimeterLeftOffset ); >> 141 calorimeterEPRightPosition.setX( xInCalorimeterRightOffset ); >> 142 calorimeterEPRightPosition.setY( yInCalorimeterRightOffset ); 148 break; 143 break; 149 case CexmcEntryPointByLinearEDWeights : 144 case CexmcEntryPointByLinearEDWeights : >> 145 for ( CexmcEnergyDepositCalorimeterCollection::const_iterator >> 146 k( edStore->calorimeterEDLeftCollection.begin() ); >> 147 k != edStore->calorimeterEDLeftCollection.end(); ++k ) >> 148 { >> 149 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 150 ( i - rowLeft > 1 || i - rowLeft < -1 ) ) >> 151 { >> 152 ++i; >> 153 continue; >> 154 } >> 155 >> 156 G4int j( 0 ); >> 157 for ( CexmcEnergyDepositCrystalRowCollection::const_iterator >> 158 l( k->begin() ); l != k->end(); ++l ) >> 159 { >> 160 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 161 ( j - columnLeft > 1 || j - columnLeft < -1 ) ) >> 162 { >> 163 ++j; >> 164 continue; >> 165 } >> 166 >> 167 xInCalorimeterLeftOffset = ( G4double( j ) - >> 168 G4double( nCrystalsInRow ) / 2 ) * >> 169 crystalWidth + crystalWidth / 2; >> 170 xWeightsSum += *l * xInCalorimeterLeftOffset; >> 171 yInCalorimeterLeftOffset = ( G4double( i ) - >> 172 G4double( nCrystalsInColumn ) / 2 ) * >> 173 crystalHeight + crystalHeight / 2; >> 174 yWeightsSum += *l * yInCalorimeterLeftOffset; >> 175 energySum += *l; >> 176 ++j; >> 177 } >> 178 ++i; >> 179 } >> 180 calorimeterEPLeftPosition.setX( xWeightsSum / energySum ); >> 181 calorimeterEPLeftPosition.setY( yWeightsSum / energySum ); >> 182 i = 0; >> 183 xWeightsSum = 0; >> 184 yWeightsSum = 0; >> 185 energySum = 0; >> 186 for ( CexmcEnergyDepositCalorimeterCollection::const_iterator >> 187 k( edStore->calorimeterEDRightCollection.begin() ); >> 188 k != edStore->calorimeterEDRightCollection.end(); ++k ) >> 189 { >> 190 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 191 ( i - rowRight > 1 || i - rowRight < -1 ) ) >> 192 { >> 193 ++i; >> 194 continue; >> 195 } >> 196 >> 197 G4int j( 0 ); >> 198 for ( CexmcEnergyDepositCrystalRowCollection::const_iterator >> 199 l( k->begin() ); l != k->end(); ++l ) >> 200 { >> 201 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 202 ( j - columnRight > 1 || j - columnRight < -1 ) ) >> 203 { >> 204 ++j; >> 205 continue; >> 206 } >> 207 >> 208 xInCalorimeterRightOffset = ( G4double( j ) - >> 209 G4double( nCrystalsInRow ) / 2 ) * >> 210 crystalWidth + crystalWidth / 2; >> 211 xWeightsSum += *l * xInCalorimeterRightOffset; >> 212 yInCalorimeterRightOffset = ( G4double( i ) - >> 213 G4double( nCrystalsInColumn ) / 2 ) * >> 214 crystalHeight + crystalHeight / 2; >> 215 yWeightsSum += *l * yInCalorimeterRightOffset; >> 216 energySum += *l; >> 217 ++j; >> 218 } >> 219 ++i; >> 220 } >> 221 calorimeterEPRightPosition.setX( xWeightsSum / energySum ); >> 222 calorimeterEPRightPosition.setY( yWeightsSum / energySum ); >> 223 break; 150 case CexmcEntryPointBySqrtEDWeights : 224 case CexmcEntryPointBySqrtEDWeights : >> 225 for ( CexmcEnergyDepositCalorimeterCollection::const_iterator >> 226 k( edStore->calorimeterEDLeftCollection.begin() ); >> 227 k != edStore->calorimeterEDLeftCollection.end(); ++k ) 151 { 228 { 152 G4double x( 0 ); << 229 if ( csAlgorithm == CexmcSelectAdjacentCrystals && 153 G4double y( 0 ); << 230 ( i - rowLeft > 1 || i - rowLeft < -1 ) ) >> 231 { >> 232 ++i; >> 233 continue; >> 234 } 154 235 155 CalculateWeightedEPPosition( edSto << 236 G4int j( 0 ); 156 rowLe << 237 for ( CexmcEnergyDepositCrystalRowCollection::const_iterator 157 calor << 238 l( k->begin() ); l != k->end(); ++l ) 158 calorimeterEPLeftPosition.setX( x << 239 { 159 calorimeterEPLeftPosition.setY( y << 240 if ( csAlgorithm == CexmcSelectAdjacentCrystals && 160 CalculateWeightedEPPosition( edSto << 241 ( j - columnLeft > 1 || j - columnLeft < -1 ) ) 161 rowRi << 242 { 162 calor << 243 ++j; 163 calorimeterEPRightPosition.setX( x << 244 continue; 164 calorimeterEPRightPosition.setY( y << 245 } >> 246 >> 247 xInCalorimeterLeftOffset = ( G4double( j ) - >> 248 G4double( nCrystalsInRow ) / 2 ) * >> 249 crystalWidth + crystalWidth / 2; >> 250 xWeightsSum += std::sqrt( *l ) * xInCalorimeterLeftOffset; >> 251 yInCalorimeterLeftOffset = ( G4double( i ) - >> 252 G4double( nCrystalsInColumn ) / 2 ) * >> 253 crystalHeight + crystalHeight / 2; >> 254 yWeightsSum += std::sqrt( *l ) * yInCalorimeterLeftOffset; >> 255 energySum += std::sqrt( *l ); >> 256 ++j; >> 257 } >> 258 ++i; >> 259 } >> 260 calorimeterEPLeftPosition.setX( xWeightsSum / energySum ); >> 261 calorimeterEPLeftPosition.setY( yWeightsSum / energySum ); >> 262 i = 0; >> 263 xWeightsSum = 0; >> 264 yWeightsSum = 0; >> 265 energySum = 0; >> 266 for ( CexmcEnergyDepositCalorimeterCollection::const_iterator >> 267 k( edStore->calorimeterEDRightCollection.begin() ); >> 268 k != edStore->calorimeterEDRightCollection.end(); ++k ) >> 269 { >> 270 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 271 ( i - rowRight > 1 || i - rowRight < -1 ) ) >> 272 { >> 273 ++i; >> 274 continue; >> 275 } 165 276 166 if ( csAlgorithm == CexmcSelectAdj << 277 G4int j( 0 ); 167 edInAdjacentCrystalsCollected << 278 for ( CexmcEnergyDepositCrystalRowCollection::const_iterator >> 279 l( k->begin() ); l != k->end(); ++l ) >> 280 { >> 281 if ( csAlgorithm == CexmcSelectAdjacentCrystals && >> 282 ( j - columnRight > 1 || j - columnRight < -1 ) ) >> 283 { >> 284 ++j; >> 285 continue; >> 286 } >> 287 >> 288 xInCalorimeterRightOffset = ( G4double( j ) - >> 289 G4double( nCrystalsInRow ) / 2 ) * >> 290 crystalWidth + crystalWidth / 2; >> 291 xWeightsSum += std::sqrt( *l ) * xInCalorimeterRightOffset; >> 292 yInCalorimeterRightOffset = ( G4double( i ) - >> 293 G4double( nCrystalsInColumn ) / 2 ) * >> 294 crystalHeight + crystalHeight / 2; >> 295 yWeightsSum += std::sqrt( *l ) * yInCalorimeterRightOffset; >> 296 energySum += std::sqrt( *l ); >> 297 ++j; >> 298 } >> 299 ++i; 168 } 300 } >> 301 calorimeterEPRightPosition.setX( xWeightsSum / energySum ); >> 302 calorimeterEPRightPosition.setY( yWeightsSum / energySum ); 169 break; 303 break; 170 default : 304 default : 171 break; 305 break; 172 } 306 } 173 307 174 switch ( epDepthDefinitionAlgorithm ) 308 switch ( epDepthDefinitionAlgorithm ) 175 { 309 { 176 case CexmcEntryPointDepthPlain : 310 case CexmcEntryPointDepthPlain : 177 break; 311 break; 178 case CexmcEntryPointDepthSphere : 312 case CexmcEntryPointDepthSphere : 179 { 313 { 180 G4double calorimeterEPLeftRadiusO 314 G4double calorimeterEPLeftRadiusOfTheSphere( 181 calorimeterLeftTr 315 calorimeterLeftTransform.NetTranslation().mag() + 182 calorimeterEPLeft 316 calorimeterEPLeftPosition.z() ); 183 G4double calorimeterEPLeftRadiusO 317 G4double calorimeterEPLeftRadiusOfTheSphere2( 184 calorime 318 calorimeterEPLeftRadiusOfTheSphere * 185 calorime 319 calorimeterEPLeftRadiusOfTheSphere ); 186 G4double calorimeterEPLeftPositio 320 G4double calorimeterEPLeftPositionX2( 187 ca 321 calorimeterEPLeftPosition.x() * 188 ca 322 calorimeterEPLeftPosition.x() ); 189 G4double calorimeterEPLeftPositio 323 G4double calorimeterEPLeftPositionY2( 190 ca 324 calorimeterEPLeftPosition.y() * 191 ca 325 calorimeterEPLeftPosition.y() ); 192 G4double calorimeterEPLeftPositio 326 G4double calorimeterEPLeftPositionZOffset( 193 calorimeterEPLeftRa 327 calorimeterEPLeftRadiusOfTheSphere - std::sqrt( 194 calorimeterE 328 calorimeterEPLeftRadiusOfTheSphere2 - 195 calorimeterE 329 calorimeterEPLeftPositionX2 - 196 calorimeterE 330 calorimeterEPLeftPositionY2 ) ); 197 G4double calorimeterEPRightRadius 331 G4double calorimeterEPRightRadiusOfTheSphere( 198 calorimeterRight 332 calorimeterRightTransform.NetTranslation().mag() + 199 calorimeterEPRig 333 calorimeterEPRightPosition.z() ); 200 G4double calorimeterEPRightRadius 334 G4double calorimeterEPRightRadiusOfTheSphere2( 201 calorim 335 calorimeterEPRightRadiusOfTheSphere * 202 calorim 336 calorimeterEPRightRadiusOfTheSphere ); 203 G4double calorimeterEPRightPositi 337 G4double calorimeterEPRightPositionX2( 204 ca 338 calorimeterEPRightPosition.x() * 205 ca 339 calorimeterEPRightPosition.x() ); 206 G4double calorimeterEPRightPositi 340 G4double calorimeterEPRightPositionY2( 207 ca 341 calorimeterEPRightPosition.y() * 208 ca 342 calorimeterEPRightPosition.y() ); 209 G4double calorimeterEPRightPositi 343 G4double calorimeterEPRightPositionZOffset( 210 calorimeterEPRight 344 calorimeterEPRightRadiusOfTheSphere - std::sqrt( 211 calorimete 345 calorimeterEPRightRadiusOfTheSphere2 - 212 calorimete 346 calorimeterEPRightPositionX2 - 213 calorimete 347 calorimeterEPRightPositionY2 ) ); 214 calorimeterEPLeftPosition.setZ( ca 348 calorimeterEPLeftPosition.setZ( calorimeterEPLeftPosition.z() - 215 ca 349 calorimeterEPLeftPositionZOffset ); 216 calorimeterEPRightPosition.setZ( c 350 calorimeterEPRightPosition.setZ( calorimeterEPRightPosition.z() - 217 calor 351 calorimeterEPRightPositionZOffset ); 218 } 352 } 219 break; 353 break; 220 default : << 221 break; << 222 } 354 } 223 355 224 calorimeterEPLeftWorldPosition = calorimet 356 calorimeterEPLeftWorldPosition = calorimeterLeftTransform.TransformPoint( 225 357 calorimeterEPLeftPosition ); 226 calorimeterEPLeftWorldDirection = calorime 358 calorimeterEPLeftWorldDirection = calorimeterLeftTransform.TransformAxis( 227 359 calorimeterEPLeftDirection ); 228 calorimeterEPRightWorldPosition = calorime 360 calorimeterEPRightWorldPosition = calorimeterRightTransform.TransformPoint( 229 361 calorimeterEPRightPosition ); 230 calorimeterEPRightWorldDirection = calorim 362 calorimeterEPRightWorldDirection = calorimeterRightTransform.TransformAxis( 231 363 calorimeterEPRightDirection ); 232 364 233 if ( collectEDInAdjacentCrystals && ! edIn << 234 { << 235 CollectEDInAdjacentCrystals( edStore-> << 236 rowLeft, << 237 calorimet << 238 CollectEDInAdjacentCrystals( edStore-> << 239 rowRight, << 240 calorimet << 241 } << 242 << 243 hasBasicTrigger = true; 365 hasBasicTrigger = true; 244 } 366 } 245 367 246 368 247 void CexmcReconstructor::ReconstructTargetPoi 369 void CexmcReconstructor::ReconstructTargetPoint( void ) 248 { 370 { 249 if ( ! targetEPInitialized ) 371 if ( ! targetEPInitialized ) 250 { 372 { 251 targetEPWorldPosition = targetTransfor 373 targetEPWorldPosition = targetTransform.TransformPoint( 252 374 G4ThreeVector( 0, 0, 0 ) ); 253 targetEPWorldDirection.setX( 0 ); 375 targetEPWorldDirection.setX( 0 ); 254 targetEPWorldDirection.setY( 0 ); 376 targetEPWorldDirection.setY( 0 ); 255 targetEPWorldDirection.setZ( 1 ); 377 targetEPWorldDirection.setZ( 1 ); 256 378 257 targetEPPosition = targetTransform.Inv 379 targetEPPosition = targetTransform.Inverse().TransformPoint( 258 380 targetEPWorldPosition ); 259 targetEPDirection = targetTransform.In 381 targetEPDirection = targetTransform.Inverse().TransformAxis( 260 382 targetEPWorldDirection ); 261 targetEPInitialized = true; 383 targetEPInitialized = true; 262 } 384 } 263 385 264 hasBasicTrigger = true; 386 hasBasicTrigger = true; 265 } 387 } 266 388 267 389 268 void CexmcReconstructor::ReconstructAngle( vo 390 void CexmcReconstructor::ReconstructAngle( void ) 269 { 391 { 270 G4ThreeVector epLeft( calorimeterEPLeftWo 392 G4ThreeVector epLeft( calorimeterEPLeftWorldPosition - 271 targetEPWorldPositi 393 targetEPWorldPosition ); 272 G4ThreeVector epRight( calorimeterEPRight 394 G4ThreeVector epRight( calorimeterEPRightWorldPosition - 273 targetEPWorldPosit 395 targetEPWorldPosition ); 274 theAngle = epLeft.angle( epRight ); 396 theAngle = epLeft.angle( epRight ); 275 397 276 hasBasicTrigger = true; 398 hasBasicTrigger = true; 277 } << 278 << 279 << 280 void CexmcReconstructor::CollectEDInAdjacentC << 281 const CexmcEnergyDepos << 282 G4int row, G4int col << 283 { << 284 G4int i( 0 ); << 285 << 286 for ( CexmcEnergyDepositCalorimeterCollect << 287 k( edHits.begi << 288 { << 289 if ( i - row > 1 || i - row < -1 ) << 290 { << 291 ++i; << 292 continue; << 293 } << 294 << 295 G4int j( 0 ); << 296 for ( CexmcEnergyDepositCrystalRowColl << 297 l( k->begin() ); l != k->end << 298 { << 299 if ( j - column > 1 || j - column << 300 { << 301 ++j; << 302 continue; << 303 } << 304 ed += *l; << 305 ++j; << 306 } << 307 ++i; << 308 } << 309 } << 310 << 311 << 312 void CexmcReconstructor::CalculateWeightedEPP << 313 const CexmcEnergyDepositCalori << 314 G4int row, G4int column, G4d << 315 G4double & ed ) << 316 { << 317 G4int nCrystalsInColumn( calorimeterGe << 318 G4int nCrystalsInRow( calorimeterGeome << 319 G4double crystalWidth( calorimeterGeometr << 320 G4double crystalHeight( calorimeterGeomet << 321 << 322 G4int i( 0 ); << 323 G4double xWeightsSum( 0 ); << 324 G4double yWeightsSum( 0 ); << 325 G4double energyWeightsSum( 0 ); << 326 << 327 if ( csAlgorithm == CexmcSelectAdjacentCry << 328 ed = 0.; << 329 << 330 for ( CexmcEnergyDepositCalorimeterCollect << 331 k( edHits.begi << 332 { << 333 if ( csAlgorithm == CexmcSelectAdjacen << 334 ( i - << 335 { << 336 ++i; << 337 continue; << 338 } << 339 << 340 G4int j( 0 ); << 341 for ( CexmcEnergyDepositCrystalRowColl << 342 l( k->begin() ); l != k->end << 343 { << 344 if ( csAlgorithm == CexmcSelectAdj << 345 ( j - << 346 { << 347 ++j; << 348 continue; << 349 } << 350 << 351 if ( csAlgorithm == CexmcSelectAdj << 352 ed += *l; << 353 << 354 G4double xInCalorimeterOffset( << 355 ( G4double( j ) - G4do << 356 crystalWidth + crysta << 357 G4double energyWeight( << 358 epDefinitionAlgorithm << 359 CexmcE << 360 << 361 xWeightsSum += energyWeight * xInC << 362 G4double yInCalorimeterOffset( << 363 ( G4double( i ) - G4do << 364 crystalHeight + cryst << 365 yWeightsSum += energyWeight * yInC << 366 energyWeightsSum += energyWeight; << 367 ++j; << 368 } << 369 ++i; << 370 } << 371 << 372 x = xWeightsSum / energyWeightsSum; << 373 y = yWeightsSum / energyWeightsSum; << 374 } 399 } 375 400 376 401