Changeset 226 in Idarraga
- Timestamp:
- Aug 2, 2011, 8:10:17 PM (13 years ago)
- Location:
- allpix
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
allpix/include/AllPixDetectorConstruction.hh
r192 r226 70 70 public: 71 71 72 AllPixDetectorConstruction(); 73 ~AllPixDetectorConstruction(); 74 void DefineSensitiveDetector(); 75 void VolumesG4Properties(); 76 //void BuildMediPix(vector<G4ThreeVector>, vector<G4RotationMatrix *>); 77 void BuildPixelDevices(map<int, AllPixGeoDsc *>); 78 79 // check setup 80 void CheckAllPixSetup(); 81 82 // test structures 83 void SetBuildTestStructure(bool flg){m_buildTestStructureFlag = flg;}; 84 void SetBuildAppliances(bool flg){m_buildAppliancesFlag = flg;}; 85 86 void SetTestStructurePosition(G4ThreeVector); 87 void SetTestStructureRotation(G4ThreeVector); 88 void SetTestStructureDetectorLink(G4int); 89 void SetAppliancePosition(G4ThreeVector); 90 void SetWrapperEnhancement(G4ThreeVector); 91 92 // mag field 93 void SetPeakMagField(G4double fieldValue); 94 95 // world volume from macro 96 void SetWorldMaterial(G4String); 97 98 // builders 99 void BuildTestStructure(G4int); 100 void BuildAppliances(G4int); 101 102 void SetDetectorPosition(G4ThreeVector); 103 void SetDetectorRotation(G4ThreeVector); 104 void SetDetectorID(G4int); 105 106 void SetLowTHL(G4double); 107 void UpdateGeometry(); 72 AllPixDetectorConstruction(); 73 ~AllPixDetectorConstruction(); 74 void DefineSensitiveDetector(); 75 void VolumesG4Properties(); 76 //void BuildMediPix(vector<G4ThreeVector>, vector<G4RotationMatrix *>); 77 void BuildPixelDevices(map<int, AllPixGeoDsc *>); 78 79 // check setup 80 void CheckAllPixSetup(); 81 82 // test structures 83 void SetBuildTestStructure(bool flg){m_buildTestStructureFlag = flg;}; 84 void SetBuildAppliances(bool flg){m_buildAppliancesFlag = flg;}; 85 86 void SetTestStructurePosition(G4ThreeVector); 87 void SetTestStructureRotation(G4ThreeVector); 88 void SetTestStructureDetectorLink(G4int); 89 void SetAppliancePosition(G4ThreeVector); 90 void SetWrapperEnhancement(G4ThreeVector); 91 92 // mag field 93 void SetPeakMagField(G4double fieldValue); 94 95 // world volume from macro 96 void SetWorldMaterial(G4String); 97 98 // builders 99 void BuildTestStructure(G4int); 100 void BuildAppliances(G4int); 101 102 void SetDetectorPosition(G4ThreeVector); 103 void SetDetectorRotation(G4ThreeVector); 104 void SetDetectorID(G4int); 105 106 void SetLowTHL(G4double); 107 void UpdateGeometry(); 108 109 // Specific EUTelescope 110 #ifdef _EUTELESCOPE 111 void SetScintPos(G4ThreeVector); 112 #endif 108 113 109 114 public: 110 115 111 112 116 G4VPhysicalVolume* Construct(); 117 113 118 private: 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 119 // flags 120 bool m_clearanceToBuildGeometry; 121 122 // pos rot detector 123 vector<G4int> m_detId; 124 vector<G4int>::iterator m_detIdItr; 125 126 map<int, G4ThreeVector> m_posVector; // position of medipix(es), key is detector Id 127 map<int, G4RotationMatrix *> m_rotVector; // rotation 128 G4int m_nPositions; 129 G4int m_nRotations; 130 G4int m_nIds; 131 132 vector<G4double> m_lowThlVector; // lowTHL 133 // for user information. Absolute position (center) of the Si wafers 134 vector<G4ThreeVector> m_absolutePosSiWafer; 135 136 137 // pos,rot test structure 138 map<int, G4ThreeVector> m_posVectorTestStructure; // position of test structure 139 map<int, G4RotationMatrix *> m_rotVectorTestStructure; // rotation of test structure 140 map<G4int, G4int> m_detectorLinkTestStructure; 141 G4int m_nTestPositions; 142 G4int m_nTestRotation; 143 144 // pos appliance 145 //vector<G4ThreeVector> m_posVectorAppliances; 146 map<int, G4ThreeVector> m_posVectorAppliances; 147 G4int m_nAppliancesPositions; 148 //vector<G4ThreeVector> m_vectorWrapperEnhancement; 149 map<int, G4ThreeVector> m_vectorWrapperEnhancement; 150 G4int m_nWrapperEnhancement; 151 152 // Geometry in G4 153 AllPixGeoDsc * gD; // geo bits for 1 detector 154 ReadGeoDescription * m_geoDsc; 155 156 // world 157 G4LogicalVolume * expHall_log; 158 G4VPhysicalVolume * expHall_phys; 159 160 161 map<int, G4LogicalVolume *> m_wrapper_log; 162 map<int, G4VPhysicalVolume *> m_wrapper_phys; 163 164 map<int, G4LogicalVolume *> m_PCB_log; 165 map<int, G4VPhysicalVolume*> m_PCB_phys; 166 167 map<int, G4LogicalVolume *> m_Box_log; 168 map<int, G4VPhysicalVolume*> m_Box_phys; 169 170 map<int, G4LogicalVolume *> m_GuardRings_log; 171 map<int, G4VPhysicalVolume*> m_GuardRings_phys; 172 173 map<int, G4LogicalVolume *> m_Slice_log; 174 map<int, G4LogicalVolume *> m_Pixel_log; 175 176 /* 172 177 ////////////////////////////////// 173 178 // wrapper … … 188 193 G4LogicalVolume ** m_Pixel_log; 189 194 ////////////////////////////////// 190 */ 191 192 // test Structure 193 bool m_buildTestStructureFlag; 194 G4LogicalVolume * m_TestStructure_log; 195 G4VPhysicalVolume * m_TestStructure_phys; 196 197 // appliances 198 bool m_buildAppliancesFlag; 199 200 // messenger 201 AllPixDetectorMessenger* m_detectorMessenger; 202 203 // materials 204 G4Material * m_Air; 205 G4Material * m_Vacuum; 206 G4Material * m_fillingWorldMaterial; 207 bool m_userDefinedWorldMaterial; 208 209 // mad field 210 //G4UniformMagField * m_magField; // pointer to the magnetic field 211 MorourgoMagField * m_magField; 195 */ 196 197 // test Structure 198 bool m_buildTestStructureFlag; 199 G4LogicalVolume * m_TestStructure_log; 200 G4VPhysicalVolume * m_TestStructure_phys; 201 202 // appliances 203 bool m_buildAppliancesFlag; 204 205 // messenger 206 AllPixDetectorMessenger* m_detectorMessenger; 207 208 // materials 209 G4Material * m_Air; 210 G4Material * m_Vacuum; 211 G4Material * m_fillingWorldMaterial; 212 bool m_userDefinedWorldMaterial; 213 214 // mad field 215 //G4UniformMagField * m_magField; // pointer to the magnetic field 216 MorourgoMagField * m_magField; 217 218 // Eutelescope specifig 219 #ifdef _EUTELESCOPE 220 vector<G4ThreeVector> m_scintPos; 221 vector<G4ThreeVector> m_scintRot; 222 #endif 212 223 213 224 }; … … 216 227 217 228 #define _BUILD_MEDIPIX_MSG() \ 218 219 220 221 222 223 224 229 G4cout << " In order to place a detector you must include in your macro at least" << G4endl; \ 230 G4cout << " the following lines: (setId must go first !)" << G4endl; \ 231 G4cout << " /allpix/det/setId 5" << G4endl; \ 232 G4cout << " /allpix/det/setPosition 0.0 0.0 0.0 mm" << G4endl; \ 233 G4cout << " /allpix/det/setRotation 0.0 0.0 0.0 deg" << G4endl; \ 234 G4cout << " /allpix/det/setLowTHL 13. keV" << G4endl; \ 235 G4cout << " see an example in \"allpix_vis.in\"" << G4endl; 225 236 226 237 #define _WRONG_CONFIG_ABORT_MSG() \ 227 238 G4cout << "[ERROR] wrong configuration. Aborting job." << G4endl; 228 239 229 240 #endif /*AllPixDetectorConstruction_h*/ -
allpix/include/AllPixDetectorMessenger.hh
r194 r226 81 81 #ifdef _EUTELESCOPE 82 82 // Specific EUTelescope 83 G4UIcmdWith3VectorAndUnit * m_scint1Pos ;84 G4UIcmdWith3VectorAndUnit * m_scint2Pos ;85 G4UIcmdWith3VectorAndUnit * m_scint3Pos ;86 G4UIcmdWith3VectorAndUnit * m_scint4Pos ;83 G4UIcmdWith3VectorAndUnit * m_scint1PosCmd; 84 G4UIcmdWith3VectorAndUnit * m_scint2PosCmd; 85 G4UIcmdWith3VectorAndUnit * m_scint3PosCmd; 86 G4UIcmdWith3VectorAndUnit * m_scint4PosCmd; 87 87 #endif 88 88 -
allpix/include/AllPixRun.hh
r193 r226 32 32 class SimpleHits; 33 33 34 #ifdef _EUTELESCOPE 34 35 #define __magic_trigger_cntr_ack 4 // 4 scintillators with 4 primary particle hits 36 #endif 35 37 36 38 class AllPixRun : public G4Run { -
allpix/macros/telescope1_Inventor_vis.in
r210 r226 127 127 /allpix/det/setRotation 0.0 0.0 180.0 deg 128 128 /allpix/det/setLowTHL 13. keV 129 130 #################################################################### 131 # Scintillators 132 /allpix/eudet/scint1Pos 0.0 0.0 -24.0 mm # offset of 18mm +/- 6mm with of scinti 133 /allpix/eudet/scint2Pos 0.0 0.0 -18.0 mm 134 /allpix/eudet/scint3Pos 0.0 0.0 1011.8 mm 135 /allpix/eudet/scint4Pos 0.0 0.0 1017.8 mm 129 136 130 137 #################################################################### -
allpix/src/AllPixDetectorConstruction.cc
r210 r226 193 193 ReadGeoDescription * m_geoDsc = new ReadGeoDescription("./models/pixeldetector.xml"); 194 194 195 // don't keep in the database the detectors which are not used196 // doing by searching the id's195 // Don't keep in the database the detectors which are not used. 196 // Searching the id's 197 197 G4int nErased = m_geoDsc->UseTheseDetectorsOnly(m_detId); 198 198 if(nErased) G4cout << "[INFO] " << nErased << " detectors have been erased from the data base" … … 361 361 362 362 } 363 364 #ifdef _EUTELESCOPE 365 void AllPixDetectorConstruction::SetScintPos(G4ThreeVector pos){ 366 m_scintPos.push_back(pos); 367 } 368 369 #endif 363 370 364 371 //void AllPixDetectorConstruction::BuildMediPix(vector<G4ThreeVector> pos, vector<G4RotationMatrix *> rot) { -
allpix/src/AllPixDetectorConstructionTestStructure.cc
r191 r226 40 40 void AllPixDetectorConstruction::BuildTestStructure(G4int){ 41 41 42 43 44 #ifdef _EUTELESCOPE 42 45 //////////////////////////////////////////////////////////////////////// 43 46 // Get GDML volume … … 68 71 } 69 72 */ 70 71 72 73 73 74 74 // I will extract the wrapper from this volume … … 109 109 110 110 ////////////////////////////////////////////////////////// 111 // Case for Scintillators111 // Scintillators for EUDET 112 112 // Materials 113 113 114 114 if( m_scintPos.empty() ) { 115 G4cout << "[ERROR] no scintillators defined. In the macro use the command" 116 << " /allpix/eudet/scint1Pos 0.0 0.0 -24.0 mm" 117 << " Can't recover ... giving up." 118 << G4endl; 119 exit(1); 120 } 121 122 /* 115 123 // first plane at 0. mm 116 124 G4double z1 = -24*mm; … … 119 127 G4double z3 = 523*mm; 120 128 G4double z4 = 529*mm; 129 */ 121 130 122 131 G4NistManager * nistman = G4NistManager::Instance(); … … 128 137 5.4*mm, 129 138 3*mm); // scintillators 6mm thick 139 130 140 G4VisAttributes * scintAtt = new G4VisAttributes(G4Color(1,0,1,1)); 131 141 scintAtt->SetLineWidth(1); 132 142 scintAtt->SetForceSolid(true); 133 143 134 144 // Place scintillators 145 vector<G4ThreeVector>::iterator scintItr = m_scintPos.begin(); 146 147 TString labelLog = ""; 148 TString labelPlacement = ""; 149 TString labelSD = ""; 150 Int_t cntr = 1; 151 G4SDManager * SDman = G4SDManager::GetSDMpointer(); 152 153 for( ; scintItr != m_scintPos.end() ; scintItr++) { 154 155 labelLog = "scint"; 156 labelLog += cntr; 157 labelLog += "_log"; 158 159 labelPlacement = "Scint"; 160 labelPlacement += cntr; 161 162 G4LogicalVolume * scint_log = new G4LogicalVolume( 163 scintb, 164 scplastic, 165 labelLog.Data()); 166 scint_log->SetVisAttributes(scintAtt); 167 G4RotationMatrix* matrix_s = new G4RotationMatrix(); 168 matrix_s->rotateX(0.*deg); 169 170 new G4PVPlacement( matrix_s, 171 (*scintItr), 172 scint_log, 173 labelPlacement.Data(), 174 expHall_log, 175 false, 176 0, 177 true); 178 179 labelSD = "sdscint"; 180 labelSD += cntr; 181 AllPixTrackerSD * scintTrack = new AllPixTrackerSD( labelSD.Data(), (*scintItr), 0); 182 SDman->AddNewDetector( scintTrack ); 183 scint_log->SetSensitiveDetector( scintTrack ); 184 185 cntr++; 186 } 187 188 /* 135 189 // 136 190 G4LogicalVolume * scint1_log = new G4LogicalVolume( … … 199 253 true); 200 254 255 256 201 257 // SD manager 202 258 G4SDManager * SDman = G4SDManager::GetSDMpointer(); … … 216 272 SDman->AddNewDetector( scintTrack4 ); 217 273 scint4_log->SetSensitiveDetector( scintTrack4 ); 274 275 */ 218 276 219 277 /* … … 251 309 */ 252 310 311 #endif 312 253 313 } 254 314 /* -
allpix/src/AllPixDetectorMessenger.cc
r194 r226 57 57 m_detDir->SetGuidance("extras"); 58 58 59 #ifdef _EUTELESCOPE 60 m_detDir = new G4UIdirectory("/allpix/eudet/"); 61 m_detDir->SetGuidance("EUDET"); 62 #endif 63 59 64 m_detIdCmd = new G4UIcmdWithAnInteger("/allpix/det/setId", this); 60 65 m_detIdCmd->SetGuidance("Detector ID"); … … 169 174 #ifdef _EUTELESCOPE 170 175 // Specific EUTelescope 171 172 176 m_scint1PosCmd = new G4UIcmdWith3VectorAndUnit("/allpix/eudet/scint1Pos", this); 177 m_scint2PosCmd = new G4UIcmdWith3VectorAndUnit("/allpix/eudet/scint2Pos", this); 178 m_scint3PosCmd = new G4UIcmdWith3VectorAndUnit("/allpix/eudet/scint3Pos", this); 179 m_scint4PosCmd = new G4UIcmdWith3VectorAndUnit("/allpix/eudet/scint4Pos", this); 173 180 #endif 174 181 … … 190 197 delete m_detDir; 191 198 delete m_allpixDir; 199 200 #ifdef _EUTELESCOPE 201 delete m_scint1PosCmd; 202 delete m_scint2PosCmd; 203 delete m_scint3PosCmd; 204 delete m_scint4PosCmd; 205 #endif 206 192 207 } 193 208 … … 282 297 } 283 298 299 300 301 #ifdef _EUTELESCOPE 302 if( command == m_scint1PosCmd ) 303 { 304 m_AllPixDetector->SetScintPos( 305 m_scint1PosCmd->GetNew3VectorValue(newValue) 306 ); 307 } 308 if( command == m_scint2PosCmd ) 309 { 310 m_AllPixDetector->SetScintPos( 311 m_scint2PosCmd->GetNew3VectorValue(newValue) 312 ); 313 } 314 if( command == m_scint3PosCmd ) 315 { 316 m_AllPixDetector->SetScintPos( 317 m_scint3PosCmd->GetNew3VectorValue(newValue) 318 ); 319 } 320 if( command == m_scint4PosCmd ) 321 { 322 m_AllPixDetector->SetScintPos( 323 m_scint4PosCmd->GetNew3VectorValue(newValue) 324 ); 325 } 326 #endif 327 284 328 } 285 329 -
allpix/src/AllPixRun.cc
r193 r226 321 321 void AllPixRun::RecordDigits(const G4Event* evt){ 322 322 323 // First check if this event triggered ! 323 // Check if this event triggered for EUTELESCOPE only 324 #ifdef _EUTELESCOPE 325 324 326 G4HCofThisEvent* HCe = evt->GetHCofThisEvent(); 327 328 G4int scintillatorsCntr = 0; 325 329 G4int triggerCntr = 0; 326 G4int scintillatorsCntr = 0;327 330 328 331 for(int i = 0 ; i < HCe->GetNumberOfCollections() ; i++){ … … 341 344 342 345 hit = (AllPixTrackerHit *) hc->GetHit(j); 343 if(hit->GetTrackPdgId() == 211) // pion for now 346 // pdgId of primary particle. Triggering on it. 347 G4int pdgPrim = evt->GetPrimaryVertex()->GetPrimary(0)->GetPDGcode(); 348 if(hit->GetTrackPdgId() == pdgPrim) // pion for now 344 349 triggerCntr++; 345 350 … … 355 360 G4cout << "Trigger ON --> " << scintillatorsCntr << " scintillators fired" << G4endl; 356 361 } 362 #endif 357 363 358 364 // get digits in this event -
allpix/src/ReadGeoDescription.cc
r220 r226 82 82 map<int, AllPixGeoDsc *>::iterator detItr = m_detsGeo.begin(); 83 83 bool found = false; 84 vector<G4int> scheduledErase; 84 85 85 86 for( ; detItr != m_detsGeo.end() ; detItr++){ … … 87 88 G4int aDet = (*detItr).first; 88 89 found = false; 90 89 91 for( itr = useDetectors.begin() ; itr != useDetectors.end() ; itr++ ){ 92 93 90 94 if(aDet == *itr){ 91 95 found = true; … … 94 98 } 95 99 100 96 101 if(!found){ 97 m_detsGeo.erase(aDet); 102 G4cout << " ----> schedule for erasing " << aDet << G4endl; 103 // don't erase right away, schedule and delete later, otherwise the 104 // vector over which I am looping shrinks. 105 scheduledErase.push_back(aDet); 106 //m_detsGeo.erase(aDet); 98 107 nErased++; 99 108 } 109 110 } 111 112 // and finally erase 113 vector<G4int>::iterator eraseItr = scheduledErase.begin(); 114 for( ; eraseItr != scheduledErase.end() ; eraseItr++ ) { 115 m_detsGeo.erase(*eraseItr); 100 116 } 101 117 … … 334 350 else if(m_currentNodeName == __sensor_Resistivity){ 335 351 336 337 338 339 352 float val = atof(tempContent.c_str()); 353 m_detsGeo[m_firstIndx]->SetResistivity(val); 354 355 } 340 356 341 357
Note: See TracChangeset
for help on using the changeset viewer.