]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/TestZDCPreprocessor.C
Error in Digits2Raw method corrected
[u/mrichter/AliRoot.git] / ZDC / TestZDCPreprocessor.C
index 60d83ab4fac714aaa9dac183adef1a2271d25820..3b3337ce5e3ad2799bed8702e7d4b36ca6b06441 100644 (file)
@@ -8,24 +8,23 @@
 //   ReadDCSAliasMap() reads from a file
 //   CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle
 
-void TestZDCPreprocessor()
+void TestZDCPreprocessor(Int_t obj=0)
 {
   // load library
   gSystem->Load("libTestShuttle.so");
 
   // create AliTestShuttle instance
   // The parameters are run, startTime, endTime
-  AliTestShuttle* shuttle = new AliTestShuttle(7, 0, 1);
+  AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
 
   // TODO if needed, change location of OCDB and Reference test folders
   // by default they are set to $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB and TestReference
-  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
-  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference");
+  AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB");
+  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
 
   printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
   printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
 
-
   // TODO(1)
   //
   // The shuttle can read DCS data, if the preprocessor should be tested to process DCS data,
@@ -42,7 +41,7 @@ void TestZDCPreprocessor()
   //     To use it uncomment the following line:
   //
   TMap* dcsAliasMap = CreateDCSAliasMap();
-  //WriteDCSAliasMap();
+  WriteDCSAliasMap();
 
   // now give the alias map to the shuttle
   shuttle->SetDCSInput(dcsAliasMap);
@@ -61,17 +60,31 @@ void TestZDCPreprocessor()
   // Three files originating from different LDCs but with the same id are also added
   // Note that the test preprocessor name is TPC. The name of the detector's preprocessor must follow
   // the "online" naming convention ALICE-INT-2003-039.
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDESTALS", "LDC0", "ZDCPedestal.dat");
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "EMDCALIB",  "LDC0", "ZDCEMDCalib.dat");
-  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "EMDCALIB",  "LDC0", "ZDCEMDEqual.dat");
+  //
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDESTALDATA", "LDC0", "ZDCPedestal.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDHISTOS",    "LDC0", "ZDCPedHisto.root");
+  //
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "LASERDATA",   "LDC0", "ZDCLaserCalib.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "LASERHISTOS", "LDC0", "ZDCLasHisto.root");
+  //
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "ENERGYCALIB", "LDC0", "ZDCEnergyCalib.dat");
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "TOWERCALIB", "LDC0", "ZDCTowerCalib.dat");
+  //
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PHYSICS", "LDC0", "ZDCChMapping.dat");
+  //
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "BC", "LDC0", "ZDCChMapping.dat");
 
   // TODO(3)
   //
   // The shuttle can read run type stored in the DAQ logbook.
   // To test it, we must provide the run type manually. They will be retrieved in the preprocessor
   // using GetRunType function.
-//  shuttle->SetInputRunType("PEDESTALS");
-  shuttle->SetInputRunType("PULSER_RUN");
+  if(obj==1)      shuttle->SetInputRunType("STANDALONE_PEDESTAL");
+  else if(obj==2) shuttle->SetInputRunType("STANDALONE_LASER");
+  else if(obj==3) shuttle->SetInputRunType("CALIBRATION_EMD");
+  else if(obj==4) shuttle->SetInputRunType("STANDALONE_COSMIC");
+  else if(obj==5) shuttle->SetInputRunType("CALIBRATION_BC");
+  else if(obj==6) shuttle->SetInputRunType("PHYSICS");
 
   // TODO(4)
   //
@@ -79,6 +92,8 @@ void TestZDCPreprocessor()
   // To test it, we must provide the run parameters manually. They will be retrieved in the preprocessor
   // using GetRunParameter function.
   // In real life the parameters will be retrieved automatically from the run logbook;
+  //shuttle->AddInputRunParameter("beamType", "Pb-Pb");
+  shuttle->AddInputRunParameter("beamType", "p-p");
   shuttle->AddInputRunParameter("totalEvents", "1000");
   shuttle->AddInputRunParameter("NumberOfGDCs", "1");
 
@@ -90,21 +105,22 @@ void TestZDCPreprocessor()
   // a bool directly. 1 = HLT ON, 0 = HLT OFF
   //
   Bool_t hltStatus=kFALSE;
-  //shuttle->SetInputHLTStatus(hltStatus);
+  shuttle->SetInputHLTStatus(hltStatus);
 
   // TODO(6)
   //
   // The shuttle can query condition parameters valid from the current run from the OCDB
   // To test it, we must first store the object into the OCDB. It will be retrieved in the preprocessor
   // using GetFromOCDB function.
-/*
-  TObjString obj("This is a condition parameter stored in OCDB");
+
+  /*TObjString obj("This is a condition parameter stored in OCDB");
   AliCDBId id("ZDC/Calib/Data", 0, AliCDBRunRange::Infinity());
   AliCDBMetaData md;
   AliCDBEntry entry(&obj, id, &md);
 
   shuttle->AddInputCDBEntry(&entry);
-*/
+  */
+  
   // TODO(6)
   // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
   AliPreprocessor* test = new AliZDCPreprocessor(shuttle);
@@ -118,18 +134,33 @@ void TestZDCPreprocessor()
   // $ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/<detector>/SHUTTLE/Data
   //
   // Check the file which should have been created
-  AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
-                       ->Get("ZDC/Calib/Data", 7);
-  if (!chkEntry)
-  {
-    printf("The file is not there. Something went wrong.\n");
+  AliCDBEntry* chkEntry0 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("ZDC/Calib/ChMap", 0);
+  AliCDBEntry* chkEntry1;
+  if(obj==1) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("ZDC/Calib/Pedestals", 0);
+  else if(obj==2) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("ZDC/Calib/LaserCalib", 0);
+  else if(obj==3) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB())
+                       ->Get("ZDC/Calib/EnergyCalib", 0);
+  
+  
+  if(!chkEntry0){
+    printf("No file in ZDC/Calib/ChMap\n");
     return;
   }
+  if(!chkEntry1){
+    if(obj==1) printf("No file in ZDC/Calib/Pedestal\n");
+    else if(obj==2) printf("No file in ZDC/Calib/LaserCalib\n");
+    else if(obj==3) printf("No file in ZDC/Calib/EnergyCalib\n");
+    return;
+  }
+  
 
-  AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (chkEntry->GetObject());
+  /*AliTestDataDCS* output = dynamic_cast<AliTestDataDCS*> (chkEntry1->GetObject());
   // If everything went fine, draw the result
   if (output)
-    output->Draw();
+    output->Draw();*/
 }
 
 TMap* CreateDCSAliasMap()
@@ -163,32 +194,19 @@ TMap* CreateDCSAliasMap()
     valueSet->SetOwner(1);
 
     TString aliasName = aliasNames[nAlias];
-    printf("\n\n alias: %s\n\n",aliasName.Data());
+    //printf("\n\n alias: %s\n\n",aliasName.Data());
 
     Float_t simVal = (Float_t) (random.Rndm()*0.025+random.Rndm()*0.1);
     for(int i=0;i<3;i++)
     {
       int timeStamp1[3] = {0,500,1000};
       AliDCSValue* dcsVal = new AliDCSValue(simVal, timeStamp1[i]);
-      printf("%s\n",dcsVal->ToString());
+      //printf("%s\n",dcsVal->ToString());
       valueSet->Add(dcsVal);
     }
     aliasMap->Add(new TObjString(aliasName), valueSet);
   }
   // ******************************** HV values
-  /*TString ZNAAlias = "ZNA_HV.actual.vMon";
-  TString ZPAAlias = "ZPA_HV.actual.vMon";
-  TString ZNCAlias = "ZNC_HV.actual.vMon";
-  TString ZPCAlias = "ZPC_HV.actual.vMon";
-  TString idat[5];
-  for(int i=0;i<5;i++)
-  {
-    idat[i] = i;
-    aliasNames[i+3]  = ZNAAlias.Insert(6,idat[i]);
-    aliasNames[i+7]  = ZPAAlias.Insert(6,idat[i]);
-    aliasNames[i+11] = ZNCAlias.Insert(6,idat[i]);
-    aliasNames[i+15] = ZPCAlias.Insert(6,idat[i]);
-  }*/
   aliasNames[4]  = "ZDC_ZNA_HV0.actual.vMon";
   aliasNames[5]  = "ZDC_ZNA_HV1.actual.vMon";
   aliasNames[6]  = "ZDC_ZNA_HV2.actual.vMon";
@@ -216,8 +234,8 @@ TMap* CreateDCSAliasMap()
   aliasNames[24]  = "ZDC_ZEM_HV0.actual.vMon";
   aliasNames[25]  = "ZDC_ZEM_HV1.actual.vMon";
   //
-  aliasNames[26]  = "ZDC_REFA_HV0.actual.vMon";
-  aliasNames[27]  = "ZDC_REFC_HV1.actual.vMon";
+  aliasNames[26]  = "ZDC_REFA_HV.actual.vMon";
+  aliasNames[27]  = "ZDC_REFC_HV.actual.vMon";
   //
   for(int nAlias=4;nAlias<28;nAlias++)
   {
@@ -225,13 +243,13 @@ TMap* CreateDCSAliasMap()
     valueSet->SetOwner(1);
    
     TString aliasName = aliasNames[nAlias];
-    printf("\n\n alias: %s\n\n",aliasName.Data());
+    //printf("\n\n alias: %s\n\n",aliasName.Data());
 
     for(int timeStamp=0;timeStamp<=1000;timeStamp+=500)
     {
       Float_t simVal = (Float_t) (random.Gaus()*600.+1800.);
       AliDCSValue* dcsVal = new AliDCSValue(simVal, timeStamp);
-      printf("%s\n",dcsVal->ToString());
+      //printf("%s\n",dcsVal->ToString());
       valueSet->Add(dcsVal);
     }
     aliasMap->Add(new TObjString(aliasName), valueSet);
@@ -260,13 +278,13 @@ void WriteDCSAliasMap()
 
   AliCDBMetaData metaData;
        metaData.SetBeamPeriod(0);
-       metaData.SetResponsible("Responsible person");
-       metaData.SetComment("Test object for TestPreprocessor.C");
+       metaData.SetResponsible("Chiara Oppedisano");
+       metaData.SetComment("Test object for TestZDCPreprocessor.C");
 
   AliCDBId id("ZDC/DCS/Data", 0, 0);
 
   // initialize location of CDB
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB");
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestCDB");
 
   AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
 }