Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 /* 27 * ============================================================================= 28 * 29 * Filename: CexmcReconstructor.hh 30 * 31 * Description: reconstructor base class 32 * 33 * Version: 1.0 34 * Created: 02.12.2009 15:44:12 35 * Revision: none 36 * Compiler: gcc 37 * 38 * Author: Alexey Radkov (), 39 * Company: PNPI 40 * 41 * ============================================================================= 42 */ 43 44 #ifndef CEXMC_RECONSTRUCTOR_HH 45 #define CEXMC_RECONSTRUCTOR_HH 46 47 #include <G4ThreeVector.hh> 48 #include <G4AffineTransform.hh> 49 #include "CexmcSetup.hh" 50 #include "CexmcCommon.hh" 51 52 class CexmcReconstructorMessenger; 53 struct CexmcEnergyDepositStore; 54 55 56 class CexmcReconstructor 57 { 58 public: 59 explicit CexmcReconstructor(); 60 61 virtual ~CexmcReconstructor(); 62 63 public: 64 virtual void Reconstruct( const CexmcEnergyDepositStore * edStore ); 65 66 public: 67 void SetCalorimeterEntryPointDefinitionAlgorithm( 68 CexmcCalorimeterEntryPointDefinitionAlgorithm algo ); 69 70 void SetCalorimeterEntryPointDepthDefinitionAlgorithm( 71 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm algo ); 72 73 void SetCrystalSelectionAlgorithm( 74 CexmcCrystalSelectionAlgorithm algo ); 75 76 void UseInnerRefCrystal( G4bool on = true ); 77 78 void SetCalorimeterEntryPointDepth( G4double depth ); 79 80 CexmcCalorimeterEntryPointDefinitionAlgorithm 81 GetCalorimeterEntryPointDefinitionAlgorithm( void ) const; 82 83 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm 84 GetCalorimeterEntryPointDepthDefinitionAlgorithm( void ) const; 85 86 CexmcCrystalSelectionAlgorithm 87 GetCrystalSelectionAlgorithm( void ) const; 88 89 G4bool IsInnerRefCrystalUsed( void ) const; 90 91 G4double GetCalorimeterEntryPointDepth( void ) const; 92 93 public: 94 const G4ThreeVector & GetCalorimeterEPLeftPosition( void ) const; 95 96 const G4ThreeVector & GetCalorimeterEPRightPosition( void ) const; 97 98 const G4ThreeVector & GetCalorimeterEPLeftDirection( void ) const; 99 100 const G4ThreeVector & GetCalorimeterEPRightDirection( void ) const; 101 102 const G4ThreeVector & GetTargetEPPosition( void ) const; 103 104 const G4ThreeVector & GetTargetEPDirection( void ) const; 105 106 const G4ThreeVector & GetCalorimeterEPLeftWorldPosition( void ) const; 107 108 const G4ThreeVector & GetCalorimeterEPRightWorldPosition( void ) const; 109 110 const G4ThreeVector & GetCalorimeterEPLeftWorldDirection( void ) const; 111 112 const G4ThreeVector & GetCalorimeterEPRightWorldDirection( void ) 113 const; 114 115 const G4ThreeVector & GetTargetEPWorldPosition( void ) const; 116 117 const G4ThreeVector & GetTargetEPWorldDirection( void ) const; 118 119 G4double GetTheAngle( void ) const; 120 121 public: 122 G4bool HasBasicTrigger( void ) const; 123 124 virtual G4bool HasFullTrigger( void ) const; 125 126 protected: 127 void ReconstructEntryPoints( 128 const CexmcEnergyDepositStore * edStore ); 129 130 void ReconstructTargetPoint( void ); 131 132 void ReconstructAngle( void ); 133 134 private: 135 void CollectEDInAdjacentCrystals( 136 const CexmcEnergyDepositCalorimeterCollection & edHits, 137 G4int row, G4int column, G4double & ed ); 138 139 void CalculateWeightedEPPosition( 140 const CexmcEnergyDepositCalorimeterCollection & edHits, 141 G4int row, G4int column, G4double & x, G4double & y, 142 G4double & ed ); 143 144 void TransformToAdjacentInnerCrystal( G4int & column, 145 G4int & row ) const; 146 147 protected: 148 G4bool hasBasicTrigger; 149 150 protected: 151 CexmcCalorimeterEntryPointDefinitionAlgorithm epDefinitionAlgorithm; 152 153 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm 154 epDepthDefinitionAlgorithm; 155 156 CexmcCrystalSelectionAlgorithm csAlgorithm; 157 158 G4bool useInnerRefCrystal; 159 160 G4double epDepth; 161 162 protected: 163 G4ThreeVector calorimeterEPLeftPosition; 164 165 G4ThreeVector calorimeterEPRightPosition; 166 167 G4ThreeVector calorimeterEPLeftDirection; 168 169 G4ThreeVector calorimeterEPRightDirection; 170 171 G4ThreeVector targetEPPosition; 172 173 G4ThreeVector targetEPDirection; 174 175 G4ThreeVector calorimeterEPLeftWorldPosition; 176 177 G4ThreeVector calorimeterEPRightWorldPosition; 178 179 G4ThreeVector calorimeterEPLeftWorldDirection; 180 181 G4ThreeVector calorimeterEPRightWorldDirection; 182 183 G4ThreeVector targetEPWorldPosition; 184 185 G4ThreeVector targetEPWorldDirection; 186 187 G4double theAngle; 188 189 protected: 190 G4double calorimeterEDLeftAdjacent; 191 192 G4double calorimeterEDRightAdjacent; 193 194 G4bool collectEDInAdjacentCrystals; 195 196 private: 197 CexmcSetup::CalorimeterGeometryData calorimeterGeometry; 198 199 G4AffineTransform calorimeterLeftTransform; 200 201 G4AffineTransform calorimeterRightTransform; 202 203 G4AffineTransform targetTransform; 204 205 G4bool targetEPInitialized; 206 207 private: 208 CexmcReconstructorMessenger * messenger; 209 }; 210 211 212 inline void CexmcReconstructor::SetCalorimeterEntryPointDefinitionAlgorithm( 213 CexmcCalorimeterEntryPointDefinitionAlgorithm algo ) 214 { 215 epDefinitionAlgorithm = algo; 216 } 217 218 219 inline void 220 CexmcReconstructor::SetCalorimeterEntryPointDepthDefinitionAlgorithm( 221 CexmcCalorimeterEntryPointDepthDefinitionAlgorithm algo ) 222 { 223 epDepthDefinitionAlgorithm = algo; 224 } 225 226 227 inline void CexmcReconstructor::SetCrystalSelectionAlgorithm( 228 CexmcCrystalSelectionAlgorithm algo ) 229 { 230 csAlgorithm = algo; 231 } 232 233 234 inline void CexmcReconstructor::UseInnerRefCrystal( G4bool on ) 235 { 236 useInnerRefCrystal = on; 237 } 238 239 240 inline void CexmcReconstructor::SetCalorimeterEntryPointDepth( 241 G4double depth ) 242 { 243 epDepth = depth; 244 } 245 246 247 inline CexmcCalorimeterEntryPointDefinitionAlgorithm 248 CexmcReconstructor::GetCalorimeterEntryPointDefinitionAlgorithm( void ) 249 const 250 { 251 return epDefinitionAlgorithm; 252 } 253 254 255 inline CexmcCalorimeterEntryPointDepthDefinitionAlgorithm 256 CexmcReconstructor::GetCalorimeterEntryPointDepthDefinitionAlgorithm( 257 void ) const 258 { 259 return epDepthDefinitionAlgorithm; 260 } 261 262 263 inline CexmcCrystalSelectionAlgorithm 264 CexmcReconstructor::GetCrystalSelectionAlgorithm( void ) const 265 { 266 return csAlgorithm; 267 } 268 269 270 inline G4bool CexmcReconstructor::IsInnerRefCrystalUsed( void ) const 271 { 272 return useInnerRefCrystal; 273 } 274 275 276 inline G4double CexmcReconstructor::GetCalorimeterEntryPointDepth( void ) const 277 { 278 return epDepth; 279 } 280 281 282 inline const G4ThreeVector & 283 CexmcReconstructor::GetCalorimeterEPLeftPosition( void ) const 284 { 285 return calorimeterEPLeftPosition; 286 } 287 288 289 inline const G4ThreeVector & 290 CexmcReconstructor::GetCalorimeterEPRightPosition( void ) const 291 { 292 return calorimeterEPRightPosition; 293 } 294 295 296 inline const G4ThreeVector & 297 CexmcReconstructor::GetCalorimeterEPLeftDirection( void ) const 298 { 299 return calorimeterEPLeftDirection; 300 } 301 302 303 inline const G4ThreeVector & 304 CexmcReconstructor::GetCalorimeterEPRightDirection( void ) const 305 { 306 return calorimeterEPRightDirection; 307 } 308 309 310 inline const G4ThreeVector & 311 CexmcReconstructor::GetTargetEPPosition( void ) const 312 { 313 return targetEPPosition; 314 } 315 316 317 inline const G4ThreeVector & 318 CexmcReconstructor::GetTargetEPDirection( void ) const 319 { 320 return targetEPDirection; 321 } 322 323 324 inline const G4ThreeVector & 325 CexmcReconstructor::GetCalorimeterEPLeftWorldPosition( void ) const 326 { 327 return calorimeterEPLeftWorldPosition; 328 } 329 330 331 inline const G4ThreeVector & 332 CexmcReconstructor::GetCalorimeterEPRightWorldPosition( void ) const 333 { 334 return calorimeterEPRightWorldPosition; 335 } 336 337 338 inline const G4ThreeVector & 339 CexmcReconstructor::GetCalorimeterEPLeftWorldDirection( void ) const 340 { 341 return calorimeterEPLeftWorldDirection; 342 } 343 344 345 inline const G4ThreeVector & 346 CexmcReconstructor::GetCalorimeterEPRightWorldDirection( void ) const 347 { 348 return calorimeterEPRightWorldDirection; 349 } 350 351 352 inline const G4ThreeVector & 353 CexmcReconstructor::GetTargetEPWorldPosition( void ) const 354 { 355 return targetEPWorldPosition; 356 } 357 358 359 inline const G4ThreeVector & 360 CexmcReconstructor::GetTargetEPWorldDirection( void ) const 361 { 362 return targetEPWorldDirection; 363 } 364 365 366 inline G4double CexmcReconstructor::GetTheAngle( void ) const 367 { 368 return theAngle; 369 } 370 371 372 inline G4bool CexmcReconstructor::HasBasicTrigger( void ) const 373 { 374 return hasBasicTrigger; 375 } 376 377 378 inline void CexmcReconstructor::TransformToAdjacentInnerCrystal( 379 G4int & column, G4int & row ) const 380 { 381 if ( column == 0 ) 382 ++column; 383 if ( column == calorimeterGeometry.nCrystalsInRow - 1 ) 384 --column; 385 if ( row == 0 ) 386 ++row; 387 if ( row == calorimeterGeometry.nCrystalsInColumn - 1 ) 388 --row; 389 } 390 391 392 #endif 393 394