Changeset 260 in Idarraga
- Timestamp:
- Nov 18, 2011, 3:28:19 PM (13 years ago)
- Location:
- allpix
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
allpix/allpix.cc
r250 r260 140 140 TString dataset = "AllPix"; 141 141 TString tempdir = ""; 142 TString outputFilePrefix = detector->GetOutputFilePrefix(); 143 AllPixRunAction * run_action = new AllPixRunAction(outputFilePrefix, dataset, tempdir, 142 AllPixRunAction * run_action = new AllPixRunAction(detector, dataset, tempdir, 144 143 "lciobridge_allpix.txt", 145 144 "lciobridge_allpix_dut.txt"); // dataset … … 249 248 G4int nHC = event_action->GetNumberOfHC(); 250 249 for(G4int i = 0 ; i < nHC ; i++) 251 Hits_WriteToNtuple::GetInstance("", "", nHC, i)->closeNtuple();250 Hits_WriteToNtuple::GetInstance("", "", "", nHC, i)->closeNtuple(); 252 251 253 252 G4cout << "[DONE]" << G4endl; -
allpix/include/AllPixRun.hh
r259 r260 9 9 #include "AllPixTrackerHit.hh" 10 10 #include "AllPixRunAction.hh" 11 #include "AllPixM edipix2Digit.hh"11 #include "AllPixMimosa26Digit.hh" 12 12 #include "AllPixDigitInterface.hh" 13 13 -
allpix/include/AllPixRunAction.hh
r258 r260 55 55 class G4Run; 56 56 class AllPixRun; 57 class AllPixDetectorConstruction; 57 58 //class FramesHandler; 58 59 //class WriteToNtuple; … … 71 72 72 73 public: 73 AllPixRunAction( TString, TString, TString, TString, TString);74 AllPixRunAction(AllPixDetectorConstruction *, TString, TString, TString, TString); 74 75 ~AllPixRunAction(); 75 76 … … 80 81 81 82 private: 82 TString m_outputFilePrefix; 83 84 AllPixDetectorConstruction * m_detectorPtr; 83 85 TString m_dataset; 84 86 TString m_tempdir; -
allpix/include/AllPix_Hits_WriteToEntuple.h
r15 r260 72 72 public: 73 73 74 Hits_WriteToNtuple(TString, TString, Int_t, TString om="RECREATE");74 Hits_WriteToNtuple(TString, TString, TString, Int_t, TString om="RECREATE"); 75 75 ~Hits_WriteToNtuple(){}; 76 76 void fillVars(SimpleHits *); 77 77 void closeNtuple(); 78 78 TString GetNtupleFileName(){return m_ntupleFileName;}; 79 static Hits_WriteToNtuple * GetInstance(TString, TString, Int_t, Int_t, TString openmode = "RECREATE");79 static Hits_WriteToNtuple * GetInstance(TString, TString, TString, Int_t, Int_t, TString openmode = "RECREATE"); 80 80 TTree * GetTree(){return t2;}; 81 81 //void SetBranchAddress(FrameStruct * fs){b2->SetAddress(fs);}; -
allpix/macros/oneDetector_Inventor_vis.in
r252 r260 25 25 # Build detectors 26 26 /allpix/det/update 27 28 #################################################################### 29 # prefix for output filename (string) Don't use quotation marks \" 30 /allpix/config/setOutputPrefixWithPath dataprefix 27 31 28 32 ######################################################################## -
allpix/macros/telescope1_Inventor_vis.in
r226 r260 127 127 /allpix/det/setRotation 0.0 0.0 180.0 deg 128 128 /allpix/det/setLowTHL 13. keV 129 130 #################################################################### 131 # prefix for output filename (string) Don't use quotation marks \" 132 /allpix/config/setOutputPrefixWithPath dataprefix 129 133 130 134 #################################################################### -
allpix/src/AllPixRun.cc
r250 r260 309 309 // fillVars rewinds values 310 310 m_datasetHits = SDman->GetHCtable()->GetHCname(itrCol); 311 Hits_WriteToNtuple::GetInstance(m_ datasetHits,311 Hits_WriteToNtuple::GetInstance(m_outputFilePrefix, m_datasetHits, 312 312 m_tempdir, 313 313 nHC, // here is the number of Hit Collections (SD), not detectors. -
allpix/src/AllPixRunAction.cc
r250 r260 41 41 #include "AllPixRun.hh" 42 42 43 #include "AllPixDetectorConstruction.hh" 43 44 #include "AllPix_Frames_WriteToEntuple.h" 44 45 #include "allpix_dm.h" … … 51 52 52 53 // this constructor is called only once in the whole program 53 AllPixRunAction::AllPixRunAction( TString ofp, TString ds, TString td, TString lciofn, TString lciofn_dut)54 AllPixRunAction::AllPixRunAction(AllPixDetectorConstruction * det, TString ds, TString td, TString lciofn, TString lciofn_dut) 54 55 { 55 56 56 m_outputFilePrefix = ofp;57 m_detectorPtr = det; 57 58 m_dataset = ds; 58 59 m_tempdir = td; … … 82 83 G4Run * AllPixRunAction::GenerateRun(){ 83 84 84 m_AllPixRun = new AllPixRun(m_outputFilePrefix, m_dataset, m_tempdir); // keep this pointer85 m_AllPixRun = new AllPixRun(m_detectorPtr->GetOutputFilePrefix(), m_dataset, m_tempdir); // keep this pointer 85 86 m_AllPixRun->SetLCIOBridgeFileDsc(m_lciobridge_f, m_lciobridge_dut_f); 86 87 … … 108 109 timer->Stop(); 109 110 G4cout << "event Id = " << aRun->GetNumberOfEvent() 110 << " " << *timer << G4endl;111 << " " << *timer << G4endl; 111 112 112 113 } -
allpix/src/AllPix_Frames_WriteToEntuple.cc
r250 r260 26 26 m_ntupleFileName += "/"; 27 27 } 28 28 29 29 30 if(prefix.Length() > 0){ -
allpix/src/AllPix_Hits_WriteToEntuple.cc
r15 r260 12 12 int g_instance_hit_Cntr = 0; 13 13 14 Hits_WriteToNtuple::Hits_WriteToNtuple(TString dataSet, TString tempScratchDir,15 14 Hits_WriteToNtuple::Hits_WriteToNtuple(TString prefix, TString dataSet, TString tempScratchDir, 15 Int_t /*detID*/, TString openmode /* default "RECREATE" */){ 16 16 17 18 17 m_MPXDataSetNumber = dataSet; 18 m_ntupleFileName = ""; 19 19 20 21 22 23 24 20 // change dir if requested 21 if(tempScratchDir.Length() > 0){ 22 m_ntupleFileName += tempScratchDir; 23 m_ntupleFileName += "/"; 24 } 25 25 26 m_ntupleFileName += "Hits_"+m_MPXDataSetNumber; 27 m_ntupleFileName += ".root"; 26 if(prefix.Length() > 0){ 27 m_ntupleFileName += prefix; 28 m_ntupleFileName += "_"; 29 m_ntupleFileName += m_MPXDataSetNumber; 30 } else { 31 m_ntupleFileName += "Hits_"+m_MPXDataSetNumber; 32 } 33 m_ntupleFileName += ".root"; 28 34 29 30 35 nt = new TFile(m_ntupleFileName, openmode); 36 t2 = new TTree("AllPixHits", dataSet); 31 37 32 33 34 38 m_storableHits = new SimpleHits; 39 m_storableHits->Rewind(); 40 t2->Branch("SimpleHits", "SimpleHits", &m_storableHits); 35 41 36 42 } … … 40 46 * 41 47 */ 42 Hits_WriteToNtuple * Hits_WriteToNtuple::GetInstance(TString dataset, TString tempdir, Int_t nOfInstances, Int_t detID, TString openmode /* RECREATE */){48 Hits_WriteToNtuple * Hits_WriteToNtuple::GetInstance(TString prefix, TString dataset, TString tempdir, Int_t nOfInstances, Int_t detID, TString openmode /* RECREATE */){ 43 49 44 if(detID >= nOfInstances){ 45 std::cout << "[ERROR] (in Hits_WriteToNtuple::GetInstance) you are asking for the " << detID << "th hits ntuple" 46 << " out of " << nOfInstances << " aborting ..." << std::endl; 47 std::cout << " (note: Indexing starts at 0)" << std::endl; 48 exit(1); 49 } 50 51 TString tempDataset = dataset; 52 if (instance_hit == 0){ 53 // create pointers for all instances 54 instance_hit = new Hits_WriteToNtuple * [nOfInstances]; 55 } 50 if(detID >= nOfInstances){ 51 std::cout << "[ERROR] (in Hits_WriteToNtuple::GetInstance) you are asking for the " << detID << "th hits ntuple" 52 << " out of " << nOfInstances << " aborting ..." << std::endl; 53 std::cout << " (note: Indexing starts at 0)" << std::endl; 54 exit(1); 55 } 56 56 57 // but instanciate only once at a time 58 if(g_instance_hit_Cntr < nOfInstances) 59 { 60 std::cout << "Creating hits file : " 61 << "\"" << tempDataset 62 << "\"" << std::endl; 63 instance_hit[detID] = new Hits_WriteToNtuple(tempDataset, tempdir, detID, openmode); 64 g_instance_hit_Cntr++; 65 } 57 TString tempDataset = dataset; 58 if (instance_hit == 0){ 59 // create pointers for all instances 60 instance_hit = new Hits_WriteToNtuple * [nOfInstances]; 61 } 66 62 67 return instance_hit[detID]; 63 // but instanciate only once at a time 64 if(g_instance_hit_Cntr < nOfInstances) 65 { 66 std::cout << "Creating hits file : " 67 << "\"" << tempDataset 68 << "\"" << std::endl; 69 instance_hit[detID] = new Hits_WriteToNtuple(prefix, tempDataset, tempdir, detID, openmode); 70 g_instance_hit_Cntr++; 71 } 72 73 return instance_hit[detID]; 68 74 } 69 75 70 76 void Hits_WriteToNtuple::fillVars(SimpleHits * hits_i){ 71 77 72 73 78 // Variables(class) in the Tree 79 m_storableHits = hits_i; 74 80 75 76 77 81 // fill the Tree 82 nt->cd(); 83 t2->Fill(); 78 84 79 80 85 // clean up 86 m_storableHits->Rewind(); 81 87 82 88 } … … 85 91 { 86 92 87 88 89 93 nt->cd(); 94 t2->Write(); 95 nt->Close(); 90 96 91 97 } … … 95 101 96 102 SimpleHits::SimpleHits(){ 97 103 Rewind(); 98 104 } 99 105 100 106 void SimpleHits::Rewind(){ 101 107 102 108 edepTotal = 0.; 103 109 104 105 106 107 108 109 110 111 112 113 114 110 interactions.clear(); 111 pos.clear(); 112 pdgId.clear(); 113 edep.clear(); 114 trackId.clear(); 115 parentId.clear(); 116 trackVolumeName.clear(); 117 parentVolumeName.clear(); 118 119 event = 0; 120 run = 0; 115 121 }
Note: See TracChangeset
for help on using the changeset viewer.