]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
DA parameters are read from in external test files
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Dec 2007 12:59:16 +0000 (12:59 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 7 Dec 2007 12:59:16 +0000 (12:59 +0000)
T0/T0Laserda.cxx
T0/T0Physda.cxx
T0/inLaser.dat [new file with mode: 0644]
T0/inPhys.dat [new file with mode: 0644]

index 989e08f10ddd0c0ba17ca59199ed882d6d50fe8d..5d744e28a1aaea9602593ac9fef0cee5372a5f16 100644 (file)
@@ -1,19 +1,19 @@
 /*
-TOF DA for online calibration
+T0 DA for online calibration
 
 Contact: Michal.Oledzki@cern.ch
-Link: www.if.pw.edu.pl:/~oledzki
-Run Type: PHYSICS
+Link: http://users.jyu.fi/~mioledzk/
+Run Type: T0_STANDALONE_LASER
 DA Type: MON
-Number of events needed: depending on the run, being run-level
-Input Files: 
+Number of events needed: 400000 
+Input Files: inLaser.dat, external parameters
 Output Files: daLaser.root, to be exported to the DAQ FXS
 Trigger types used: PHYSICS_EVENT
 
 */
 
 #define FILE_OUT "daLaser.root"
-
+#define FILE_IN "inLaser.dat"
 #include <daqDA.h>
 #include <event.h>
 #include <monitor.h>
@@ -31,7 +31,6 @@ Trigger types used: PHYSICS_EVENT
 #include "TROOT.h"
 #include "TPluginManager.h"
 #include "TFile.h"
-#include "TFile.h"
 #include "TKey.h"
 #include "TH2S.h"
 #include "TObject.h"
@@ -45,7 +44,8 @@ Trigger types used: PHYSICS_EVENT
 #include "TSpectrum.h"
 #include "TVirtualFitter.h"
 #include "TProfile.h"
-
+int cqbx,cqby,clbx,clby,cbx;
+float cqlx,cqmx,cqly,cqmy,cllx,clmx,clly,clmy,clx,cmx;
 /* Main routine
       Arguments: 
       1- monitoring data source
@@ -59,7 +59,30 @@ int main(int argc, char **argv) {
                                        "TStreamerInfo",
                                        "RIO",
                                        "TStreamerInfo()"); 
-  
+  FILE *inp;
+  char c;
+  inp = fopen(FILE_IN, "r");  
+  while((c=getc(inp))!=EOF) {
+    switch(c) {
+      case 'a': {fscanf(inp, "%d", &cqbx ); break;} //N of X bins hCFD_QTC
+      case 'b': {fscanf(inp, "%f", &cqlx ); break;} //Low x hCFD_QTC
+      case 'c': {fscanf(inp, "%f", &cqmx ); break;} //High x hCFD_QTC
+      case 'd': {fscanf(inp, "%d", &cqby ); break;} //N of Y bins hCFD_QTC
+      case 'e': {fscanf(inp, "%f", &cqly ); break;} //Low y hCFD_QTC
+      case 'f': {fscanf(inp, "%f", &cqmy ); break;} //High y hCFD_QTC
+      case 'g': {fscanf(inp, "%d", &clbx ); break;} //N of X bins hCFD_LED
+      case 'h': {fscanf(inp, "%f", &cllx ); break;} //Low x hCFD_LED
+      case 'i': {fscanf(inp, "%f", &clmx ); break;} //High x hCFD_LED
+      case 'j': {fscanf(inp, "%d", &clby ); break;} //N of Y bins hCFD_LED
+      case 'k': {fscanf(inp, "%f", &clly ); break;} //Low y hCFD_LED
+      case 'l': {fscanf(inp, "%f", &clmy ); break;} //High y hCFD_LED
+      case 'm': {fscanf(inp, "%d", &cbx ); break;}  //N of Y bins hCFD 
+      case 'n': {fscanf(inp, "%f", &clx ); break;}  //Low x hCFD
+      case 'o': {fscanf(inp, "%f", &cmx ); break;}  //High x hCFD
+    }
+  }
+  fclose(inp);
+
   if (argc!=2) {
     printf("Wrong number of arguments\n");
     return -1;
@@ -96,13 +119,13 @@ int main(int argc, char **argv) {
   TH2F *hCFD_LED[24]; 
 
    for(Int_t ic=0; ic<24; ic++) {
-      hCFD_QTC[ic] = new TH2F(Form("CFD_QTC%d",ic+1),"CFD_QTC",800,0.5,8000.5,200,10000.5,20000.5);
-      hCFD_LED[ic] = new TH2F(Form("CFD_LED%d",ic+1),"CFD_LED",100,-500.0,500.0,100,14600.0,14700.0);
+      hCFD_QTC[ic] = new TH2F(Form("CFD_QTC%d",ic+1),"CFD_QTC",cqbx,cqlx,cqmx,cqby,cqly,cqmy);
+      hCFD_LED[ic] = new TH2F(Form("CFD_LED%d",ic+1),"CFD_LED",clbx,cllx,clmx,clby,clly,clmy);
       if(ic<12){
-       hCFD[ic] = new TH1F(Form("T0_C_%d_CFD",ic+1),"CFD", 3000,0., 30000.);   
+       hCFD[ic] = new TH1F(Form("T0_C_%d_CFD",ic+1),"CFD", cbx,clx,cmx);       
       }
       else{
-        hCFD[ic] = new TH1F(Form("T0_A_%d_CFD",ic-11),"CFD", 3000,0., 30000.); 
+        hCFD[ic] = new TH1F(Form("T0_A_%d_CFD",ic-11),"CFD", cbx,clx,cmx); 
       }
     }
 
@@ -227,7 +250,7 @@ int main(int argc, char **argv) {
       break;
     }
   }
-printf("After loop, before writing histos\n");
+  printf("After loop, before writing histos\n");
   // write a file with the histograms
   TFile *hist = new TFile(FILE_OUT,"RECREATE");
 
@@ -239,6 +262,13 @@ printf("After loop, before writing histos\n");
   hist->Close();
   delete hist;
 
+  status=0;
+
+  /* export file to FXS */
+  if (daqDA_FES_storeFile(FILE_OUT, FILE_OUT)) {
+    status=-2;
+  }
+
   return status;
 }
 
index 25e1774eea9f0d2fbeaf06115a73d62ba31b8cef..e85656f56e7b6c245d466873f6fd32e797e00714 100644 (file)
@@ -1,7 +1,20 @@
-//extern "C" 
+/*
+T0 DA for online calibration
+
+Contact: Michal.Oledzki@cern.ch
+Link: http://users.jyu.fi/~mioledzk/
+Run Type: PHYSICS
+DA Type: MON
+Number of events needed: 500000 
+Input Files: inPhys.dat, external parameters
+Output Files: daPhys.root, to be exported to the DAQ FXS
+Trigger types used: PHYSICS_EVENT
 
-#include <daqDA.h>
+*/
 
+#define FILE_OUT "daPhys.root"
+#define FILE_IN "inPhys.dat"
+#include <daqDA.h>
 #include <event.h>
 #include <monitor.h>
  
 #include <AliRawReaderDate.h>
 #include <AliRawReader.h>
 #include <AliT0RawReader.h>
-#include <AliCDBManager.h>
 
 //ROOT
+#include "TROOT.h"
+#include "TPluginManager.h"
 #include "TFile.h"
 #include "TKey.h"
 #include "TH2S.h"
 #include "TObject.h"
 #include "TBenchmark.h"
 #include "TRandom.h"
-
 #include "TCanvas.h"
 #include "TString.h"
 #include "TH1.h"
 #include "TF1.h"
 #include "TSpectrum.h"
 #include "TVirtualFitter.h"
-
-
+int cbx, ccbx;
+float clx,cmx,cclx,ccmx;
 
 /* Main routine
       Arguments: 
 int main(int argc, char **argv) {
 //int main(){
   int status;
+
+  /* magic line */
+  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                        "*",
+                                        "TStreamerInfo",
+                                        "RIO",
+                                        "TStreamerInfo()");
   
-  
+  FILE *inp;
+  char c;
+  inp = fopen(FILE_IN, "r");
+  while((c=getc(inp))!=EOF) {
+    switch(c) {
+      case 'a': {fscanf(inp, "%d", &ccbx ); break;} //N of X bins hCFD1_CFD
+      case 'b': {fscanf(inp, "%f", &cclx ); break;} //Low x hCFD1_CFD
+      case 'c': {fscanf(inp, "%f", &ccmx ); break;} //High x hCFD1_CFD
+      case 'd': {fscanf(inp, "%d", &cbx ); break;} //N of X bins hCFD
+      case 'e': {fscanf(inp, "%f", &clx ); break;} //Low x hCFD
+      case 'f': {fscanf(inp, "%f", &cmx ); break;} //High x hCFD
+    }
+  }
+  fclose(inp);
+
   if (argc!=2) {
     printf("Wrong number of arguments\n");
     return -1;
@@ -75,20 +109,15 @@ int main(int argc, char **argv) {
 
   TH1F *hCFD1_CFD[24];  
   TH1F *hCFD[24];
-  Char_t  buf1[15], buf2[15],buf3[15],buf4[15];
-
+   
    for(Int_t ic=0; ic<24; ic++) {
       if(ic<12) {
-       sprintf(buf1,"CFD1-CFD%i",ic+1);
-        hCFD1_CFD[ic] = new TH1F(buf1,"CFD-CFD",200000,-100000,100000);
-        sprintf(buf3,"CFD%i",ic+1);
-        hCFD[ic] = new TH1F(buf3,"CFD",100000,0,100000);
+        hCFD1_CFD[ic] = new TH1F(Form("CFD1-CFD%d",ic+1),"CFD-CFD",ccbx,cclx,ccmx);
+        hCFD[ic] = new TH1F(Form("CFD%i",ic+1),"CFD",cbx,clx,cmx);
        }
       if(ic>11){
-       sprintf(buf2,"CFD13-CFD%i",ic+1);
-        hCFD1_CFD[ic] = new TH1F(buf2,"CFD-CFD",200000,-100000,100000);
-        sprintf(buf4,"CFD%i",ic+1);
-        hCFD[ic] = new TH1F(buf4,"CFD",100000,0,100000);
+        hCFD1_CFD[ic] = new TH1F(Form("CFD13-CFD%i",ic+1),"CFD-CFD",ccbx,cclx,ccmx);
+        hCFD[ic] = new TH1F(Form("CFD%i",ic+1),"CFD",cbx,clx,cmx);
        }
     }
 
@@ -200,11 +229,9 @@ int main(int argc, char **argv) {
       break;
     }
   }
-printf("After loop, before writing histos\n");
+  printf("After loop, before writing histos\n");
   // write a file with the histograms
-  Char_t filehist[21];
-  sprintf(filehist,"daPhys.root");
-  TFile *hist = new TFile(filehist,"RECREATE");
+  TFile *hist = new TFile(FILE_OUT,"RECREATE");
 
   for(Int_t j=0;j<24;j++){
      hCFD1_CFD[j]->Write();
@@ -213,6 +240,13 @@ printf("After loop, before writing histos\n");
   hist->Close();
   delete hist;
 
+  status=0;
+
+  /* export file to FXS */
+  if (daqDA_FES_storeFile(FILE_OUT, FILE_OUT)) {
+    status=-2;
+  }
+
   return status;
 }
 
diff --git a/T0/inLaser.dat b/T0/inLaser.dat
new file mode 100644 (file)
index 0000000..0b8f143
--- /dev/null
@@ -0,0 +1,15 @@
+a 100
+b 0.5
+c 8000.5
+d 100
+e 10000.5
+f 20000.5
+g 100
+h -500.0
+i 500.0
+j 100
+k 14600.0
+l 14700.0
+m 1000
+n 14000.0
+o 30000.0
diff --git a/T0/inPhys.dat b/T0/inPhys.dat
new file mode 100644 (file)
index 0000000..ab5b963
--- /dev/null
@@ -0,0 +1,6 @@
+a 2000
+b -1000.0
+c 1000.0
+d 1000
+e 0.0
+f 100000.0