Ejemplo n.º 1
0
/************************************************************************
 * $Id: doEStructEmpty.C,v 1.2 2007/05/27 22:46:27 msd Exp $
 *
 * Author: Jeff Porter 
 *
 *  example code for reading in MuDst files contained int "fileListFile"
 *  and running the 2pt correlations analysis, producing hist files in,
 *
 *  outputDir/jobName/data/XX/
 *  
 *    where XX = event level selection imposed by the cut files.
 *               This example (from PP) contains 3 selections on event mult
 *
 *************************************************************************/
void doEStructEmpty(const char* fileListFile, const char* outputDir, const char* cutFile, const char* jobName, int cutBinMode=0, int maxNumEvents=0, int analysisMode=0){

  gROOT->LoadMacro("load2ptLibs.C");
  load2ptLibs();
  gROOT->LoadMacro("getOutFileName.C"); // for laying out file names

  // define centrality
  StEStructCentrality* cent=StEStructCentrality::Instance();
  
  //int numCent = 2;
  //const double temp[2]={0,2000}; //=1 centrality
  int numCent = 2;
  const double temp[2]={2,2000}; //=1 centrality
  //int numCent = 5;
  //const double temp[5]={2,250,500,750,2000}; //=1 centrality

  cent->setCentralities(temp,numCent);
  int numberOfAnalyses=numCent-1;

  // choose the mode for the binning
  StEStructCutBin* cb=StEStructCutBin::Instance();
  cb->setMode(cutBinMode);
  int mbNCutBins = cb->getNumBins();
 
  // create the low-level reader (here for MuDst)
  //  reader = reader interface + pointer to Data Maker + cut classes
  StMuDstMaker* mk = new StMuDstMaker(0,0,"",fileListFile,".",5000);

  // create the generic EStructAnalysisMaker
  StEStructAnalysisMaker *estructMaker = new StEStructAnalysisMaker("EStruct2pt");

  // Set up the reader with event/track cuts
  StEStructEventCuts*    ecuts = new StEStructEventCuts(cutFile);
  StEStructTrackCuts*    tcuts = new StEStructTrackCuts(cutFile);
  StEStructMuDstReader* reader = new StEStructMuDstReader(mk,ecuts,tcuts);
  estructMaker->SetEventReader(reader);

  // create the QAHist object (must come after centrality and cutbin objects)
  int EventType = 0; // real data
  //StEStructQAHists* qaHists = new StEStructQAHists(EventType);
  //qaHists->initHistograms();
  //estructMaker->SetQAHists(qaHists);

  //StEStruct2ptCorrelations** analysis = new StEStruct2ptCorrelations*[numberOfAnalyses];
  StEStructEmptyAnalysis** analysis = new StEStructEmptyAnalysis*[numberOfAnalyses];
  //StEStructPairCuts* pcuts = new StEStructPairCuts(cutFile);

  for(int i=0;i<numberOfAnalyses;i++){
   int ic=i;
   if(numberOfAnalyses==1)ic=-1;
   //analysis[i]=new StEStruct2ptCorrelations(pcuts,analysisMode);
   analysis[i]=new StEStructEmptyAnalysis();
   analysis[i]->setOutputFileName(getOutFileName(outputDir,jobName,"data",ic));
   //analysis[i]->setQAHists(qaHists); // only 1 QA Object in this case
   //analysis[i]->setZBuffLimits(ecuts); // common to all
   //analysis[i]->setAnalysisIndex(i);
  }
  estructMaker->SetAnalyses(analysis,numberOfAnalyses);

  // --- now do the work ---
    estructMaker->Init();
    estructMaker->startTimer();
    int counter=0, istat=0, i=0;

    while (istat!=2) {
      istat=estructMaker->Make(); // now includes filling qa histograms
      i++; counter++;
      if (counter==200) {
          cout<<"doing event ="<<i<<endl;
          counter=0;
          //estructMaker->writeDiagnostics(0);
      }
      if ( maxNumEvents!=0 && i>=maxNumEvents ) {
          istat=2;
      }
    }
    estructMaker->stopTimer();

  //--- now write out stats and cuts ---
   ofstream ofs(getOutFileName(outputDir,jobName,"stats"));
    estructMaker->logAllStats(ofs);
    ecuts->printCuts(ofs);
    tcuts->printCuts(ofs);
    //pcuts->printCuts(ofs);
   ofs<<endl;
   ofs.close();
   
   // --> root cut file 
   TFile* tf=new TFile(getOutFileName(outputDir,jobName,"cuts"),"RECREATE");
   ecuts->writeCutHists(tf);
   tcuts->writeCutHists(tf);
   tf->Close();

   // --> root qa histogram file 
   //estructMaker->writeQAHists(getOutFileName(outputDir,jobName,"QA"));

   // --- write out the data 
   estructMaker->Finish();
}
Ejemplo n.º 2
0
void writeEStructExample( const char* filelist,
                   const char* outputDir,
                   const char* scriptDir,
                   int maxNumEvents = 0 ) {


  gROOT->LoadMacro("load2ptLibs.C");
  load2ptLibs();

  char cutFile[1024];
  sprintf(cutFile,"%s/CutsFile.txt",scriptDir);

  gROOT->LoadMacro("getOutFileName.C"); // for laying out file names
  const char* scratchDir = "CuCu200data";

  // define centrality (just making stuff up below!!!)
  StEStructCentrality* cent=StEStructCentrality::Instance();
  const double mbBins[]={2,30,100,180,240,320,400,999999}; 
  int mbNBins=1+1+1+1+1+1+1+1;
  cent->setCentralities(mbBins,mbNBins);
  int numberOfAnalyses=mbNBins-1;

  // create the low-level reader (here for MuDst)
  //  reader = reader interface + pointer to Data Maker + cut classes

  //***** depends on PDSF vs RCF .... below is RCF version of scheduler
  //  char fileListFile[1024];
  //  sprintf(fileListFile,"%s/%s",scriptDir,filelist);
  StMuDstMaker* mk = new StMuDstMaker(0,0,"",filelist,".",5000);

  // create the generic EStructAnalysisMaker
  StEStructAnalysisMaker *estructMaker = new StEStructAnalysisMaker("EStruct2pt");

  // Set up the reader with event/track cuts
  StEStructEventCuts*    ecuts = new StEStructEventCuts(cutFile);
  StEStructTrackCuts*    tcuts = new StEStructTrackCuts(cutFile);
  StEStructMuDstReader* reader = new StEStructMuDstReader(mk,ecuts,tcuts,false);

  estructMaker->SetEventReader(reader);

  // create the QAHist object (must come after centrality and cutbin objects)
  int EventType = 0; // real data
  StEStructQAHists* qaHists = new StEStructQAHists(EventType);
  qaHists->initHistograms();
  estructMaker->SetQAHists(qaHists);

  StEStructEventWriter** analysis    = new StEStructEventWriter*[mbNBins];
  StEStructEventMaker**  writeMakers = new StEStructEventMaker*[mbNBins];

  int analysisMode = 0; // 2pt correlations mode selection

  for(int i=0;i<numberOfAnalyses;i++){
   int ic=i;
   if(numberOfAnalyses==1)ic=-1;

   TString writerName("EStructWriterMaker");  writerName+=i;
   writeMakers[i]=new StEStructEventMaker(writerName.Data());
   
   analysis[i]=new StEStructEventWriter(writeMakers[i]);
   analysis[i]->setOutputFileName(getOutFileName(outputDir,scratchDir,"event",ic));
   /*
   analysis[i]->setQAHists(qaHists); // only 1 QA Object in this case
   analysis[i]->setZBuffLimits(ecuts); // common to all
   */
   analysis[i]->setAnalysisIndex(i);
  }
  estructMaker->SetAnalyses(analysis,numberOfAnalyses);

  // --- now do the work ---

    estructMaker->Init();
    estructMaker->startTimer();

    int counter=0, istat=0, i=0;

    while (istat!=2) {

      istat=estructMaker->Make(); // now includes filling qa histograms

      i++; counter++;
      if (counter==200) {
          cout<<"doing event ="<<i<<endl;
          counter=0;
          estructMaker->writeDiagnostics(0);
      }
      if ( maxNumEvents!=0 && i>=maxNumEvents ) {
          istat=2;
      }
    }
    estructMaker->stopTimer();

  //--- now write out stats and cuts ---
   ofstream ofs(getOutFileName(outputDir,scratchDir,"stats"));
    estructMaker->logAllStats(ofs);
    ecuts->printCuts(ofs);
    tcuts->printCuts(ofs);
   ofs<<endl;
   ofs.close();
   
   // --> root cut file 
   TFile* tf=new TFile(getOutFileName(outputDir,scratchDir,"cuts"),"RECREATE");
   ecuts->writeCutHists(tf);
   tcuts->writeCutHists(tf);
   tf->Close();


   // --- write out the data 
   estructMaker->Finish();
}
Ejemplo n.º 3
0
/************************************************************************
 * $Id: doEStructPythia.C,v 1.4 2006/04/04 22:15:57 porter Exp $
 *
 * Author: Jeff Porter 
 *
 *  example code for reading in MuDst files contained int "fileListFile"
 *  and running the 2pt correlations analysis, producing hist files in,
 *
 *  outputDir/jobName/data/XX/
 *  
 *    where XX = event level selection imposed by the cut files.
 *               This example (from PP) contains 3 selections on event mult
 *
 *************************************************************************/
void doEStructPythia( const char* filelist,
                const char* outputDir,
                const char* scriptDir,
                int maxNumEvents = 0 ) {

  gROOT->LoadMacro("load2ptLibs.C");
  load2ptLibs();

  gROOT->LoadMacro("loadPythiaLibs.C");
  loadPythiaLibs();
  gROOT->LoadMacro("getPythia.C");

  char* jobid=gSystem->Getenv("JOBID"); 
  const char* rframe="CMS";
  const char* cproj ="p";
  const char* ctarg ="p";
  float rts = 200.0;
  int pythiaTune = 0; // 1=TuneA, 2=TuneB, all else = minbias standard

  TPythia6* pythia=getPythia(rframe,cproj,ctarg,rts,pythiaTune,jobid); 

  char cutFile[1024];
  sprintf(cutFile,"%s/CutsFile.txt",scriptDir);

  gROOT->LoadMacro("getOutFileName.C"); // for laying out file names
  const char* scratchDir = "PPPythia";

  // define centrality
  StEStructCentrality* cent=StEStructCentrality::Instance();
  const double temp[2]={0,2000};
  cent->setCentralities(temp,2);
  int mbNBins=cent->numCentralities()-1;

  // choose the mode for the binning
  int cutBinMode = 1;
  StEStructCutBin* cb=StEStructCutBin::Instance();
  cb->setMode(cutBinMode);
  int mbNCutBins = cb->getNumBins();
  
  // create the generic EStructAnalysisMaker
  StEStructAnalysisMaker *estructMaker = new StEStructAnalysisMaker("EStruct2Pythia");

  // create the QAHist object (must come after centrality and cutbin objects)
  int EventType = 2; // pythia from generator
  StEStructQAHists* qaHists = new StEStructQAHists(EventType);
  qaHists->initHistograms();
  estructMaker->SetQAHists(qaHists);
 
  // Set up the reader with event/track cuts
  StEStructEventCuts*    ecuts = new StEStructEventCuts(cutFile);
  StEStructTrackCuts*    tcuts = new StEStructTrackCuts(cutFile);
  StEStructPythia*      reader = new StEStructPythia(pythia,ecuts,tcuts,false,0,maxNumEvents);

  estructMaker->SetEventReader(reader);

  StEStruct2ptCorrelations** analysis = new StEStructEmptyAnalysis*[mbNBins];
  //  StEStructPairCuts* pcuts = new StEStructPairCuts(cutFile);

  int analysisMode = 0; // 2pt correlations mode selection

  for(int i=0;i<mbNBins;i++){
   int ic=i;
   if(mbNBins==1)ic=-1;
   analysis[i]=new StEStructEmptyAnalysis;
   analysis[i]->setOutputFileName(getOutFileName(outputDir,scratchDir,"data",ic));
   analysis[i]->setQAHists(qaHists); // only 1 QA Object in this case
   analysis[i]->setZBuffLimits(ecuts); // common to all
  }
  estructMaker->SetAnalyses(analysis,mbNBins);
 

  // --- now do the work ---
    estructMaker->Init();
    estructMaker->startTimer();

    int counter=0, istat=0, i=0;

    while (istat!=2) {

      istat=estructMaker->Make(); // now includes filling qa histograms

      i++; counter++;
      if (counter==100) {
          cout<<"doing event ="<<i<<endl;
          counter=0;
      }
      if ( maxNumEvents!=0 && i>=maxNumEvents ) {
          istat=2;
      }
    }
    estructMaker->stopTimer();

  //--- now write out stats and cuts ---
   ofstream ofs(getOutFileName(outputDir,scratchDir,"stats"));
    estructMaker->logAllStats(ofs);
    ecuts->printCuts(ofs);
    tcuts->printCuts(ofs);
    pcuts->printCuts(ofs);
   ofs<<endl;
   ofs.close();
  
   // --> root cut file 
   TFile* tf=new TFile(getOutFileName(outputDir,scratchDir,"cuts"),"RECREATE");
   ecuts->writeCutHists(tf);
   tcuts->writeCutHists(tf);
   tf->Close();

   // --> root qa histogram file 
   estructMaker->writeQAHists(getOutFileName(outputDir,scratchDir,"QA"));

   // --- write out the data 
   estructMaker->Finish();
}