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: CexmcReconstructor.cc 30 * 31 * Description: reconstructor base class 32 * 33 * Version: 1.0 34 * Created: 02.12.2009 16:21:15 35 * Revision: none 36 * Compiler: gcc 37 * 38 * Author: Alexey Radkov (), 39 * Company: PNPI 40 * 41 * =========================================== 42 */ 43 44 #include "CexmcReconstructor.hh" 45 #include "CexmcReconstructorMessenger.hh" 46 #include "CexmcEnergyDepositStore.hh" 47 #include "CexmcRunManager.hh" 48 49 50 CexmcReconstructor::CexmcReconstructor() : has 51 epDefinitionAlgorithm( CexmcEntryPointBySq 52 epDepthDefinitionAlgorithm( CexmcEntryPoin 53 csAlgorithm( CexmcSelectAllCrystals ), use 54 epDepth( 0 ), theAngle( 0 ), calorimeterED 55 calorimeterEDRightAdjacent( 0 ), collectED 56 targetEPInitialized( false ), messenger( N 57 { 58 G4RunManager * runManager( G4RunManag 59 const CexmcSetup * setup( static_cast< co 60 runManager->Ge 61 calorimeterGeometry = setup->GetCalorimete 62 targetTransform = setup->GetTargetTransfor 63 calorimeterLeftTransform = setup->GetCalor 64 calorimeterRightTransform = setup->GetCalo 65 66 messenger = new CexmcReconstructorMessenge 67 } 68 69 70 CexmcReconstructor::~CexmcReconstructor() 71 { 72 delete messenger; 73 } 74 75 76 void CexmcReconstructor::Reconstruct( 77 const Cexm 78 { 79 ReconstructEntryPoints( edStore ); 80 if ( hasBasicTrigger ) 81 ReconstructTargetPoint(); 82 if ( hasBasicTrigger ) 83 ReconstructAngle(); 84 } 85 86 87 G4bool CexmcReconstructor::HasFullTrigger( vo 88 { 89 return hasBasicTrigger; 90 } 91 92 93 void CexmcReconstructor::ReconstructEntryPoin 94 const Cexm 95 { 96 G4int columnLeft( edStore->calorimeter 97 G4int rowLeft( edStore->calorimeterEDL 98 G4int columnRight( edStore->calorimete 99 G4int rowRight( edStore->calorimeterED 100 G4double crystalLength( calorimeterGeomet 101 102 if ( useInnerRefCrystal ) 103 { 104 TransformToAdjacentInnerCrystal( colum 105 TransformToAdjacentInnerCrystal( colum 106 } 107 108 calorimeterEPLeftPosition.setX( 0 ); 109 calorimeterEPLeftPosition.setY( 0 ); 110 calorimeterEPLeftPosition.setZ( -crystalLe 111 calorimeterEPLeftDirection.setX( 0 ); 112 calorimeterEPLeftDirection.setY( 0 ); 113 calorimeterEPLeftDirection.setZ( 0 ); 114 calorimeterEPRightPosition.setX( 0 ); 115 calorimeterEPRightPosition.setY( 0 ); 116 calorimeterEPRightPosition.setZ( -crystalL 117 calorimeterEPRightDirection.setX( 0 ); 118 calorimeterEPRightDirection.setY( 0 ); 119 calorimeterEPRightDirection.setZ( 0 ); 120 121 G4bool edInAdjacentCrystalsCollected( fal 122 123 switch ( epDefinitionAlgorithm ) 124 { 125 case CexmcEntryPointInTheCenter : 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 137 crysta 138 calorimeterEPLeftPosition.setY( 139 ( G4double( rowLeft ) - G4doub 140 crysta 141 calorimeterEPRightPosition.setX( 142 ( G4double( columnRight ) - G4 143 crysta 144 calorimeterEPRightPosition.setY( 145 ( G4double( rowRight ) - G4dou 146 crysta 147 } 148 break; 149 case CexmcEntryPointByLinearEDWeights : 150 case CexmcEntryPointBySqrtEDWeights : 151 { 152 G4double x( 0 ); 153 G4double y( 0 ); 154 155 CalculateWeightedEPPosition( edSto 156 rowLe 157 calor 158 calorimeterEPLeftPosition.setX( x 159 calorimeterEPLeftPosition.setY( y 160 CalculateWeightedEPPosition( edSto 161 rowRi 162 calor 163 calorimeterEPRightPosition.setX( x 164 calorimeterEPRightPosition.setY( y 165 166 if ( csAlgorithm == CexmcSelectAdj 167 edInAdjacentCrystalsCollected 168 } 169 break; 170 default : 171 break; 172 } 173 174 switch ( epDepthDefinitionAlgorithm ) 175 { 176 case CexmcEntryPointDepthPlain : 177 break; 178 case CexmcEntryPointDepthSphere : 179 { 180 G4double calorimeterEPLeftRadiusO 181 calorimeterLeftTr 182 calorimeterEPLeft 183 G4double calorimeterEPLeftRadiusO 184 calorime 185 calorime 186 G4double calorimeterEPLeftPositio 187 ca 188 ca 189 G4double calorimeterEPLeftPositio 190 ca 191 ca 192 G4double calorimeterEPLeftPositio 193 calorimeterEPLeftRa 194 calorimeterE 195 calorimeterE 196 calorimeterE 197 G4double calorimeterEPRightRadius 198 calorimeterRight 199 calorimeterEPRig 200 G4double calorimeterEPRightRadius 201 calorim 202 calorim 203 G4double calorimeterEPRightPositi 204 ca 205 ca 206 G4double calorimeterEPRightPositi 207 ca 208 ca 209 G4double calorimeterEPRightPositi 210 calorimeterEPRight 211 calorimete 212 calorimete 213 calorimete 214 calorimeterEPLeftPosition.setZ( ca 215 ca 216 calorimeterEPRightPosition.setZ( c 217 calor 218 } 219 break; 220 default : 221 break; 222 } 223 224 calorimeterEPLeftWorldPosition = calorimet 225 226 calorimeterEPLeftWorldDirection = calorime 227 228 calorimeterEPRightWorldPosition = calorime 229 230 calorimeterEPRightWorldDirection = calorim 231 232 233 if ( collectEDInAdjacentCrystals && ! edIn 234 { 235 CollectEDInAdjacentCrystals( edStore-> 236 rowLeft, 237 calorimet 238 CollectEDInAdjacentCrystals( edStore-> 239 rowRight, 240 calorimet 241 } 242 243 hasBasicTrigger = true; 244 } 245 246 247 void CexmcReconstructor::ReconstructTargetPoi 248 { 249 if ( ! targetEPInitialized ) 250 { 251 targetEPWorldPosition = targetTransfor 252 253 targetEPWorldDirection.setX( 0 ); 254 targetEPWorldDirection.setY( 0 ); 255 targetEPWorldDirection.setZ( 1 ); 256 257 targetEPPosition = targetTransform.Inv 258 259 targetEPDirection = targetTransform.In 260 261 targetEPInitialized = true; 262 } 263 264 hasBasicTrigger = true; 265 } 266 267 268 void CexmcReconstructor::ReconstructAngle( vo 269 { 270 G4ThreeVector epLeft( calorimeterEPLeftWo 271 targetEPWorldPositi 272 G4ThreeVector epRight( calorimeterEPRight 273 targetEPWorldPosit 274 theAngle = epLeft.angle( epRight ); 275 276 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 } 375 376