Changeset 250 in Idarraga


Ignore:
Timestamp:
Nov 11, 2011, 4:36:29 PM (13 years ago)
Author:
idarraga
Message:
 
Location:
allpix
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • allpix/allpix.cc

    r193 r250  
    140140        TString dataset = "AllPix";
    141141        TString tempdir = "";
    142         AllPixRunAction * run_action = new AllPixRunAction(dataset, tempdir,
     142        TString outputFilePrefix = detector->GetOutputFilePrefix();
     143        AllPixRunAction * run_action = new AllPixRunAction(outputFilePrefix, dataset, tempdir,
    143144                        "lciobridge_allpix.txt",
    144145                        "lciobridge_allpix_dut.txt"); // dataset
     
    242243        // G4int nDigitizers = event_action->GetNumberOfDigitizers();
    243244        for( detItr = geoMap->begin() ; detItr != geoMap->end() ; detItr++) {
    244                 WriteToNtuple::GetInstance("", "", (int)geoMap->size(), (*detItr).first)->closeNtuple();
     245          WriteToNtuple::GetInstance("", "", "", (int)geoMap->size(), (*detItr).first)->closeNtuple();
    245246        }
    246247
  • allpix/src/AllPixDetectorConstruction.cc

    r230 r250  
    711711}
    712712
     713/**
     714 *  Someone get's informed throught the messenger about the prefix for the output file.
     715 */
     716void AllPixDetectorConstruction::SetOutputFilePrefix(G4String val){
     717  m_outputFilePrefix = val;
     718}
     719
    713720#include "G4FieldManager.hh"
    714721#include "G4TransportationManager.hh"
     
    756763
    757764}
     765
  • allpix/src/AllPixDetectorMessenger.cc

    r226 r250  
    5454        m_detDir->SetGuidance("detector control");
    5555
     56        m_configDir = new G4UIdirectory("/allpix/config/");
     57        m_configDir->SetGuidance("allpix configuration");
     58
    5659        m_detDir = new G4UIdirectory("/allpix/extras/");
    5760        m_detDir->SetGuidance("extras");
     
    119122        m_ClockCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
    120123
     124        //////////////////////////
     125        // Config
     126
     127        m_outputPrefix = new G4UIcmdWithAString("/allpix/config/setOutputPrefixWithPath", this);
     128        m_outputPrefix->SetGuidance("Set output file prefix (path can be included).  If no path is specified, the file will be written to ./");
     129        m_outputPrefix->SetParameterName("OutputPrefix", false);
     130        m_outputPrefix->SetDefaultValue("allpixoutput");
     131        m_outputPrefix->AvailableForStates(G4State_PreInit, G4State_Idle);
    121132
    122133        //////////////////////////
     
    195206        delete m_worldMaterial;
    196207
     208        delete m_outputPrefix;
     209
    197210        delete m_detDir;
    198211        delete m_allpixDir;
     
    297310        }
    298311
     312        if( command == m_outputPrefix )
     313          {
     314            G4cout << "Setting up output file prefix " << newValue << G4endl;
     315            m_AllPixDetector->SetOutputFilePrefix( newValue );
     316          }
    299317
    300318
  • allpix/src/AllPixRun.cc

    r226 r250  
    2929 * This constructor is called once per run
    3030 */
    31 AllPixRun::AllPixRun(TString dataset, TString tempDir){
     31AllPixRun::AllPixRun(TString ofp, TString dataset, TString tempDir){
    3232
    3333        // Call for an instance to write.  Need to know how
     
    4242
    4343        // digit collection info
     44        m_outputFilePrefix = ofp;
    4445        m_datasetDigits = dataset;
    4546        m_datasetDigits += "_det_";
     
    183184                //cout << " AllPixRun::FillFramesNtuple " << m_frames[i]->GetDetectorId() << endl;
    184185
    185                 WriteToNtuple::GetInstance(m_datasetDigits,
     186                WriteToNtuple::GetInstance(m_outputFilePrefix, m_datasetDigits,
    186187                                m_tempdir,
    187188                                m_nOfDetectors,
  • allpix/src/AllPixRunAction.cc

    r193 r250  
    5151
    5252// this constructor is called only once in the whole program
    53 AllPixRunAction::AllPixRunAction(TString ds, TString td, TString lciofn, TString lciofn_dut)
     53AllPixRunAction::AllPixRunAction(TString ofp, TString ds, TString td, TString lciofn, TString lciofn_dut)
    5454{
    5555
     56  m_outputFilePrefix = ofp;
    5657        m_dataset = ds;
    5758        m_tempdir = td;
     
    8182G4Run * AllPixRunAction::GenerateRun(){
    8283
    83         m_AllPixRun = new AllPixRun(m_dataset, m_tempdir); // keep this pointer
     84  m_AllPixRun = new AllPixRun(m_outputFilePrefix, m_dataset, m_tempdir); // keep this pointer
    8485        m_AllPixRun->SetLCIOBridgeFileDsc(m_lciobridge_f, m_lciobridge_dut_f);
    8586
  • allpix/src/AllPix_Frames_WriteToEntuple.cc

    r57 r250  
    1515static Int_t * indexToDetectorIdMap = 0;
    1616
    17 WriteToNtuple::WriteToNtuple(TString dataSet, TString tempScratchDir, Int_t detID, TString openmode /* default "RECREATE" */){
     17WriteToNtuple::WriteToNtuple(TString prefix, TString dataSet, TString tempScratchDir, Int_t detID, TString openmode /* default "RECREATE" */){
    1818
    1919        m_MPXDataSetNumber = dataSet;
     
    2727        }
    2828
    29         m_ntupleFileName += "MPXNtuple_"+m_MPXDataSetNumber;
     29        if(prefix.Length() > 0){
     30          m_ntupleFileName += prefix;
     31          m_ntupleFileName += "_";
     32          m_ntupleFileName += m_MPXDataSetNumber;
     33        } else {
     34          m_ntupleFileName += "MPXNtuple_"+m_MPXDataSetNumber;   
     35        }
    3036        m_ntupleFileName += ".root";
    3137
     
    5157 *
    5258 */
    53 WriteToNtuple * WriteToNtuple::GetInstance(TString dataset, TString tempdir, Int_t nOfDetectors, Int_t detID, TString openmode /* RECREATE */) {
     59WriteToNtuple * WriteToNtuple::GetInstance(TString prefix, TString dataset, TString tempdir, Int_t nOfDetectors, Int_t detID, TString openmode /* RECREATE */) {
    5460
    5561        TString tempDataset = dataset;
     
    7177                        tempDataset += (*detItr).first; // append detector id
    7278
    73                         instance[cntr] = new WriteToNtuple(tempDataset, tempdir, (*detItr).first, openmode);
     79                        instance[cntr] = new WriteToNtuple(prefix, tempDataset, tempdir, (*detItr).first, openmode);
    7480                        indexToDetectorIdMap[cntr] = (*detItr).first;
    7581
Note: See TracChangeset for help on using the changeset viewer.