Пример #1
0
//_________________________________________________________________________________________________
void GetTimeRange(Int_t runNumber, time_t& start, time_t& end)
{
  AliCDBManager::Instance()->SetRun(runNumber);

  AliCDBEntry* e = AliCDBManager::Instance()->Get("GRP/GRP/Data");

  AliGRPObject* grp = static_cast<AliGRPObject*>(e->GetObject());

  start = grp->GetTimeStart();
  end = grp->GetTimeEnd();

  TDatime dstart(start);
  TDatime dend(end);

  dstart.Set(dstart.GetYear(),dstart.GetMonth(),dstart.GetDay(),dstart.GetHour(),0,0);
  dend.Set(dend.GetYear(),dend.GetMonth(),dend.GetDay(),dend.GetHour()+1,0,0);
  
  std::cout << TDatime(start).AsString() << std::endl;
  std::cout << TDatime(end).AsString() << std::endl;

  std::cout << dstart.AsString() << std::endl;
  std::cout << dend.AsString() << std::endl;

  start = dstart.Convert(kFALSE);
  end = dend.Convert(kFALSE);
}
Пример #2
0
void
ProcessEnvironment()
{

  // run number
  if (gSystem->Getenv("CONFIG_RUN"))
    runNumber = atoi(gSystem->Getenv("CONFIG_RUN"));

  // number of events configuration
  neventsConfig = 200;
  if (gSystem->Getenv("CONFIG_NEVENTS"))
    neventsConfig = atoi(gSystem->Getenv("CONFIG_NEVENTS"));

  // magnetic field configuration
  magnetConfig = kMagnetDefault;
  if (gSystem->Getenv("CONFIG_MAGNET")) {
    Bool_t valid = kFALSE;
    for (Int_t imag = 0; imag < kNMagnets; imag++)
      if (strcmp(gSystem->Getenv("CONFIG_MAGNET"), MagnetName[imag]) == 0) {
	magnetConfig = imag;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown magnetic field configuration: %s \n", gSystem->Getenv("CONFIG_MAGNET"));
      abort();
    }
  }
	
  // detector configuration
  detectorConfig = kDetectorDefault;
  if (gSystem->Getenv("CONFIG_DETECTOR")) {
    Bool_t valid = kFALSE;
    for (Int_t idet = 0; idet < kNDetectors; idet++)
      if (strcmp(gSystem->Getenv("CONFIG_DETECTOR"), DetectorName[idet]) == 0) {
	detectorConfig = idet;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown detector configuration: %s \n", gSystem->Getenv("CONFIG_DETECTOR"));
      abort();
    }
  }
	
//   // generator configuration
   generatorConfig = kGeneratorCustom;
//   if (gSystem->Getenv("CONFIG_GENERATOR")) {
//     Bool_t valid = kFALSE;
//     for (Int_t igen = 0; igen < kNGenerators; igen++)
//       if (strcmp(gSystem->Getenv("CONFIG_GENERATOR"), GeneratorName[igen]) == 0) {
// 	generatorConfig = igen;
// 	valid = kTRUE;
// 	break;
//       }
//     if (!valid) {
//       printf(">>>>> Unknown MC generator configuration: %s \n", gSystem->Getenv("CONFIG_GENERATOR"));
//       abort();
//     }
//   }
  
  // energy configuration
  energyConfig = SetEnergyFromGRP();
  if (gSystem->Getenv("CONFIG_ENERGY"))
    energyConfig = atoi(gSystem->Getenv("CONFIG_ENERGY"));
  if (energyConfig <= 0) {
    printf(">>>>> Invalid CMS energy: %f \n", energyConfig);
    abort();
  }

  // trigger configuration
  triggerConfig = kGeneratorDefault;
  if (gSystem->Getenv("CONFIG_TRIGGER")) {
    Bool_t valid = kFALSE;
    for (Int_t itrg = 0; itrg < kNTriggers; itrg++)
      if (strcmp(gSystem->Getenv("CONFIG_TRIGGER"), TriggerName[itrg]) == 0) {
	triggerConfig = itrg;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown trigger configuration: %s \n", gSystem->Getenv("CONFIG_TRIGGER"));
      abort();
    }
  }
  
  // impact parameter configuration
  bminConfig = 0.;
  if (gSystem->Getenv("CONFIG_BMIN"))
    bminConfig = atoi(gSystem->Getenv("CONFIG_BMIN"));
  if (bminConfig < 0) {
    printf(">>>>> Invalid min impact parameter: %f \n", bminConfig);
    abort();
  }
  bmaxConfig = 20.;
  if (gSystem->Getenv("CONFIG_BMAX"))
    bmaxConfig = atoi(gSystem->Getenv("CONFIG_BMAX"));
  if (bmaxConfig <= bminConfig) {
    printf(">>>>> Invalid max impact parameter: %f \n", bmaxConfig);
    abort();
  }

  // seed configuration
  seedConfig = TDatime().Get();
  if (gSystem->Getenv("CONFIG_SEED"))
    seedConfig = atoi(gSystem->Getenv("CONFIG_SEED"));
  
  // unique ID configuration
  uidConfig = 1;
  if (gSystem->Getenv("CONFIG_UID"))
    uidConfig = atoi(gSystem->Getenv("CONFIG_UID"));
  
}
Пример #3
0
void
ProcessEnvironment()
{

  // run number
  if (gSystem->Getenv("CONFIG_RUN"))
    runNumber = atoi(gSystem->Getenv("CONFIG_RUN"));

  // number of events configuration
  neventsConfig = 200;
  if (gSystem->Getenv("CONFIG_NEVENTS"))
    neventsConfig = atoi(gSystem->Getenv("CONFIG_NEVENTS"));

  // magnetic field configuration
  magnetConfig = kMagnetDefault;
  if (gSystem->Getenv("CONFIG_MAGNET")) {
    Bool_t valid = kFALSE;
    for (Int_t imag = 0; imag < kNMagnets; imag++)
      if (strcmp(gSystem->Getenv("CONFIG_MAGNET"), MagnetName[imag]) == 0) {
	magnetConfig = imag;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown magnetic field configuration: %s \n", gSystem->Getenv("CONFIG_MAGNET"));
      abort();
    }
  }
	
  // detector configuration
  detectorConfig = kDetectorDefault;
  if (gSystem->Getenv("CONFIG_DETECTOR")) {
    Bool_t valid = kFALSE;
    for (Int_t idet = 0; idet < kNDetectors; idet++)
      if (strcmp(gSystem->Getenv("CONFIG_DETECTOR"), DetectorName[idet]) == 0) {
	detectorConfig = idet;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown detector configuration: %s \n", gSystem->Getenv("CONFIG_DETECTOR"));
      abort();
    }
  }
	
  // generator configuration
  generatorConfig = kGeneratorDefault;
  if (gSystem->Getenv("CONFIG_GENERATOR")) {
    Bool_t valid = kFALSE;
    for (Int_t igen = 0; igen < kNGenerators; igen++)
      if (strcmp(gSystem->Getenv("CONFIG_GENERATOR"), GeneratorName[igen]) == 0) {
	generatorConfig = igen;
	valid = kTRUE;
	break;
      }
    // check PWG tag
    if (!valid) {
      TString str = gSystem->Getenv("CONFIG_GENERATOR");
      if (str.Contains(":")) {
	printf(">>>>> PWG custom MC generator configuration: %s \n", gSystem->Getenv("CONFIG_GENERATOR"));
	generatorConfig = kGeneratorPWG;	  
	valid = kTRUE;
      }
    }
    // unknown generator
    if (!valid) {
      printf(">>>>> Unknown MC generator configuration: %s \n", gSystem->Getenv("CONFIG_GENERATOR"));
      abort();
    }
  }
  
  // process configuration
  processConfig = "";
  if (gSystem->Getenv("CONFIG_PROCESS")) {
    processConfig = gSystem->Getenv("CONFIG_PROCESS");
  }
  
  // system configuration
  systemConfig = "";
  if (gSystem->Getenv("CONFIG_SYSTEM")) {
    systemConfig = gSystem->Getenv("CONFIG_SYSTEM");
  }
  
  // energy configuration
  energyConfig = 0.;
  if (gSystem->Getenv("CONFIG_ENERGY"))
    energyConfig = atoi(gSystem->Getenv("CONFIG_ENERGY"));
  if (energyConfig <= 0) {
    printf(">>>>> Invalid CMS energy: %f \n", energyConfig);
    abort();
  }

  // trigger configuration
  triggerConfig = kTriggerDefault;
  if (gSystem->Getenv("CONFIG_TRIGGER")) {
    Bool_t valid = kFALSE;
    for (Int_t itrg = 0; itrg < kNTriggers; itrg++)
      if (strcmp(gSystem->Getenv("CONFIG_TRIGGER"), TriggerName[itrg]) == 0) {
	triggerConfig = itrg;
	valid = kTRUE;
	break;
      }
    if (!valid) {
      printf(">>>>> Unknown trigger configuration: %s \n", gSystem->Getenv("CONFIG_TRIGGER"));
      abort();
    }
  }

  // PDG value for single particles
  if (gSystem->Getenv("CONFIG_PDG"))
    pdgConfig = atoi(gSystem->Getenv("CONFIG_PDG"));

  // impact parameter configuration
  bminConfig = 0.;
  if (gSystem->Getenv("CONFIG_BMIN"))
    bminConfig = atof(gSystem->Getenv("CONFIG_BMIN"));
  if (bminConfig < 0) {
    printf(">>>>> Invalid min impact parameter: %f \n", bminConfig);
    abort();
  }
  bmaxConfig = 20.;
  if (gSystem->Getenv("CONFIG_BMAX"))
    bmaxConfig = atof(gSystem->Getenv("CONFIG_BMAX"));
  if (bmaxConfig <= bminConfig) {
    printf(">>>>> Invalid max impact parameter: %f \n", bmaxConfig);
    abort();
  }

  // ptHardMin for HIJING simulation
  ptHardMinHijing = 2.9;
  if (gSystem->Getenv("CONFIG_PTHARDMINHIJING"))
     ptHardMinHijing= atof(gSystem->Getenv("CONFIG_PTHARDMINHIJING"));

  // rapidity, phi, pT configuration
  yminConfig = -1.e6;
  if (gSystem->Getenv("CONFIG_YMIN"))
    yminConfig = atof(gSystem->Getenv("CONFIG_YMIN"));
  ymaxConfig = 1.e6;
  if (gSystem->Getenv("CONFIG_YMAX"))
    ymaxConfig = atof(gSystem->Getenv("CONFIG_YMAX"));
  if (ymaxConfig <= yminConfig) {
    printf(">>>>> Invalid max rapidity: %f \n", ymaxConfig);
    abort();
  }
  phiminConfig = 0.;
  if (gSystem->Getenv("CONFIG_PHIMIN"))
    phiminConfig = atof(gSystem->Getenv("CONFIG_PHIMIN"));
  phimaxConfig = 360.;
  if (gSystem->Getenv("CONFIG_PHIMAX"))
    phimaxConfig = atof(gSystem->Getenv("CONFIG_PHIMAX"));
  if (phimaxConfig <= phiminConfig) {
    printf(">>>>> Invalid max phi: %f \n", phimaxConfig);
    abort();
  }
  if (phimaxConfig <= 2.*TMath::Pi()) {
    printf(">>>>> WARNING: phi is expected to be in degree\n");
    printf(">>>>> WARNING: max phi = %f suspected to be in rad. \n", phimaxConfig);
  }
  ptminConfig = 0.;
  if (gSystem->Getenv("CONFIG_PTMIN"))
    ptminConfig = atof(gSystem->Getenv("CONFIG_PTMIN"));
  ptmaxConfig = -1.;
  if (gSystem->Getenv("CONFIG_PTMAX"))
    ptmaxConfig = atof(gSystem->Getenv("CONFIG_PTMAX"));
  if (ptmaxConfig != -1 && ptmaxConfig <= ptminConfig) {
    printf(">>>>> Invalid max pt: %f \n", ptmaxConfig);
    abort();
  }
  
  // pt-hard, pt-trigger and quenching configuration
  pthardminConfig = 0.;
  if (gSystem->Getenv("CONFIG_PTHARDMIN"))
    pthardminConfig = atof(gSystem->Getenv("CONFIG_PTHARDMIN"));
  pthardmaxConfig = -1.;
  if (gSystem->Getenv("CONFIG_PTHARDMAX"))
    pthardmaxConfig = atof(gSystem->Getenv("CONFIG_PTHARDMAX"));
  if (pthardmaxConfig != -1 && pthardmaxConfig <= pthardminConfig) {
    printf(">>>>> Invalid max pt-hard: %f \n", pthardmaxConfig);
    abort();
  }
  pttrigminConfig = 0.;
  if (gSystem->Getenv("CONFIG_PTTRIGMIN"))
    pttrigminConfig = atof(gSystem->Getenv("CONFIG_PTTRIGMIN"));
  pttrigmaxConfig = -1.;
  if (gSystem->Getenv("CONFIG_PTTRIGMAX"))
    pttrigmaxConfig = atof(gSystem->Getenv("CONFIG_PTTRIGMAX"));
  if (pttrigmaxConfig != -1 && pttrigmaxConfig <= pttrigminConfig) {
    printf(">>>>> Invalid max pt-trigger: %f \n", pttrigmaxConfig);
    abort();
  }
  quenchingConfig = 0;
  if (gSystem->Getenv("CONFIG_QUENCHING"))
    quenchingConfig = atoi(gSystem->Getenv("CONFIG_QUENCHING"));
  qhatConfig = 1.7;
  if (gSystem->Getenv("CONFIG_QHAT"))
    qhatConfig = atof(gSystem->Getenv("CONFIG_QHAT"));
  
  // seed configuration
  seedConfig = TDatime().Get();
  if (gSystem->Getenv("CONFIG_SEED"))
    seedConfig = atoi(gSystem->Getenv("CONFIG_SEED"));
  
  // unique ID configuration
  uidConfig = 1;
  if (gSystem->Getenv("CONFIG_UID"))
    uidConfig = atoi(gSystem->Getenv("CONFIG_UID"));
  
  // Geant4 configuration
  isGeant4 = kFALSE;
  if (gSystem->Getenv("CONFIG_GEANT4"))
    isGeant4 = kTRUE;

  // PurifyKine OFF
  purifyKine = kTRUE;
  if (gSystem->Getenv("CONFIG_PURIFYKINEOFF"))
    purifyKine = kFALSE;

  // Fluka configuration
  isFluka = kFALSE;
  if (gSystem->Getenv("CONFIG_FLUKA"))
    isFluka = kTRUE;

}
Пример #4
0
void replay_pff(){

    gSystem->Load("libsbs.so");

    SBSBigBite   *sbs = new SBSBigBite("sbs", "Generic apparatus");

    SBSGEMStand *gems = new SBSGEMStand("gems", "Collection of GEMs in stand", sbs);
    sbs->AddDetector(gems);

    // HCal
    // sbs->AddDetector(hcal);

    SBSEArm *earm = new SBSEArm("earm", "Generic apparatus");
    SBSCDet *cdet= new SBSCDet("cdet", "CDet", earm);
    SBSECal *ecal= new SBSECal("ecal", "ECal", earm);


  //
  //  Steering script for Hall A analyzer demo
  //
  
  // Set up the equipment to be analyzed.
  
  // add the two spectrometers with the "standard" configuration
  // (VDC planes, S1, and S2)
  // Collect information about a easily modified random set of channels
  // (see DB_DIR/*/db_D.dat)
  /*
  THaApparatus* DECDAT = new THaDecData("D","Misc. Decoder Data");
  gHaApps->Add( DECDAT );
  */
  

  // Set up the analyzer - we use the standard one,
  // but this could be an experiment-specific one as well.
  // The Analyzer controls the reading of the data, executes
  // tests/cuts, loops over Apparatus's and PhysicsModules,
  // and executes the output routines.
  THaAnalyzer* analyzer = new THaAnalyzer;
  
  gHaApps->Add(sbs);

  // A simple event class to be output to the resulting tree.
  // Creating your own descendant of THaEvent is one way of
  // defining and controlling the output.
  THaEvent* event = new THaEvent;
  
  // Define the run(s) that we want to analyze.
  // We just set up one, but this could be many.
//  THaRun* run = new THaRun( "prod12_4100V_TrigRate25_4.dat" );
  THaRun* run = new THaRun( "5GEM_sample.dat" );
  run->SetLastEvent(-1);

  run->SetDataRequired(0);
  run->SetDate(TDatime());

  analyzer->SetVerbosity(0);
  
  // Define the analysis parameters
  analyzer->SetEvent( event );
  analyzer->SetOutFile( "Afile.root" );
  // File to record cuts accounting information
  analyzer->SetSummaryFile("summary_example.log"); // optional
  
  //analyzer->SetCompressionLevel(0); // turn off compression
  analyzer->Process(run);     // start the actual analysis
}