X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ZDC%2FTestZDCPreprocessor.C;h=b66059cd2c722c619c5b37a6de791dab608c13f7;hb=f0315837c11ca1282b6ceb3c0feb2b10091018ef;hp=71db0f02247df92cb6a7d378a3c633b5e320e7bf;hpb=1ee299a5e5df4d617f01c09fa86761ab914a975f;p=u%2Fmrichter%2FAliRoot.git diff --git a/ZDC/TestZDCPreprocessor.C b/ZDC/TestZDCPreprocessor.C index 71db0f02247..b66059cd2c7 100644 --- a/ZDC/TestZDCPreprocessor.C +++ b/ZDC/TestZDCPreprocessor.C @@ -8,23 +8,24 @@ // ReadDCSAliasMap() reads from a file // CreateInputFilesMap() creates a list of local files, that can be accessed by the shuttle -void TestZDCPreprocessor() +void TestZDCPreprocessor(const char* runType="PHYSICS") { // load library - gSystem->Load("libTestShuttle.so"); + gSystem->Load("libTestShuttle"); // 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::SetMainCDB("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB"); + AliTestShuttle::SetMainCDB("local://$ALICE_ROOT/OCDB"); + //AliTestShuttle::SetMainCDB("alien://folder=/alice/data/2009/OCDB/"); AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestReference"); - printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data()); - printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data()); - + printf("\n Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data()); + printf(" Test Reference storage Uri: %s\n\n", AliShuttleInterface::GetMainRefStorage().Data()); // TODO(1) // @@ -42,6 +43,7 @@ void TestZDCPreprocessor() // To use it uncomment the following line: // TMap* dcsAliasMap = CreateDCSAliasMap(); + dcsAliasMap->Print(""); //WriteDCSAliasMap(); // now give the alias map to the shuttle @@ -61,28 +63,37 @@ 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", "ALL", "LDC0", "ZDCChMapping.dat"); // - shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDESTALS", "LDC0", "ZDCPedestal.dat"); - shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "LASER", "LDC0", "ZDCLaserCalib.dat"); - shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "EMDCALIB", "LDC0", "ZDCEMDCalib.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDESTALDATA", "LDC", "ZDCPedestal.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "PEDESTALHISTOS", "LDC", "ZDCPedHisto.root"); + // + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "LASERDATA", "LDC", "ZDCLaserCalib.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "LASERHISTOS", "LDC", "ZDCLaserHisto.root"); + // + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "EMDENERGYCALIB", "LDC", "ZDCEnergyCalib.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "EMDTOWERCALIB", "LDC", "ZDCTowerCalib.dat"); + // + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "MBCALIB", "LDC", "ZDCMBCalib.root"); + // + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "MAPPING", "MON", "ZDCChMapping.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "TDCDATA", "MON", "ZDCTDCCalib.dat"); + shuttle->AddInputFile(AliTestShuttle::kDAQ, "ZDC", "TDCHISTOS", "MON", "ZDCTDCHisto.root"); - // TODO(3) + // 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("STANDALONE_PEDESTAL"); - shuttle->SetInputRunType("STANDALONE_LASER"); - //shuttle->SetInputRunType("STANDALONE_EMD"); - + shuttle->SetInputRunType(runType); + // TODO(4) // // The shuttle can read run parameters stored in the DAQ run logbook. // 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", "A-A"); + shuttle->AddInputRunParameter("beamEnergy", "1380"); //shuttle->AddInputRunParameter("beamType", "p-p"); shuttle->AddInputRunParameter("totalEvents", "1000"); shuttle->AddInputRunParameter("NumberOfGDCs", "1"); @@ -114,9 +125,11 @@ void TestZDCPreprocessor() // TODO(6) // Create the preprocessor that should be tested, it registers itself automatically to the shuttle AliPreprocessor* test = new AliZDCPreprocessor(shuttle); - + shuttle->Print(); + // Test the preprocessor shuttle->Process(); + //printf(" Back to test macro: final checks! \n"); // TODO(7) // In the preprocessor AliShuttleInterface::Store should be called to put the final @@ -125,27 +138,36 @@ void TestZDCPreprocessor() // // Check the file which should have been created AliCDBEntry* chkEntry0 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) - ->Get("ZDC/Calib/ChMap", 7); - /*AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) - ->Get("ZDC/Calib/Pedestals", 7); - */ - /*AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) - ->Get("ZDC/Calib/EMDCalib", 7); - */ - AliCDBEntry* chkEntry = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) - ->Get("ZDC/Calib/LaserCalib", 7); + ->Get("ZDC/Calib/ChMap", 0); + TString str(runType); + AliCDBEntry* chkEntry1; + if((str.CompareTo("STANDALONE_PEDESTAL")) == 0) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) + ->Get("ZDC/Calib/Pedestals", 0); + else if((str.CompareTo("STANDALONE_LASER")) == 0) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) + ->Get("ZDC/Calib/LaserCalib", 0); + else if((str.CompareTo("CALIBRATION_EMD")) == 0) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) + ->Get("ZDC/Calib/EnergyCalib", 0); + else if((str.CompareTo("PHYSICS")) == 0) chkEntry1 = AliCDBManager::Instance()->GetStorage(AliShuttleInterface::GetMainCDB()) + ->Get("ZDC/Calib/TDCCalib", 0); - if (!chkEntry) - { - printf("The file is not there. Something went wrong.\n"); + if(!chkEntry0){ + printf("No file in ZDC/Calib/ChMap\n"); return; } + if(!chkEntry1){ + if((str.CompareTo("STANDALONE_PEDESTAL")) == 0) printf("No file in ZDC/Calib/Pedestal\n"); + else if((str.CompareTo("STANDALONE_LASER")) == 0) printf("No file in ZDC/Calib/LaserCalib\n"); + else if((str.CompareTo("CALIBRATION_EMD")) == 0) printf("No file in ZDC/Calib/EnergyCalib\n"); + else if((str.CompareTo("PHYSICS")) == 0) printf("No file in ZDC/Calib/TDCCalib\n"); + return; + } + - AliTestDataDCS* output = dynamic_cast (chkEntry->GetObject()); + /*AliTestDataDCS* output = dynamic_cast (chkEntry1->GetObject()); // If everything went fine, draw the result if (output) - output->Draw(); + output->Draw();*/ } TMap* CreateDCSAliasMap() @@ -173,20 +195,18 @@ TMap* CreateDCSAliasMap() aliasNames[2] = "ZDC_ZNC_POS.actual.position"; aliasNames[3] = "ZDC_ZPC_POS.actual.position"; // - for(int nAlias=0; nAlias<4; nAlias++) - { + for(int nAlias=0; nAlias<4; nAlias++){ TObjArray* valueSet = new TObjArray; 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}; + int timeStamp1[5] = {0,500,1000,1500,2000}; + for(int i=0;i<5;i++){ 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); @@ -222,22 +242,22 @@ TMap* CreateDCSAliasMap() aliasNames[26] = "ZDC_REFA_HV.actual.vMon"; aliasNames[27] = "ZDC_REFC_HV.actual.vMon"; // - for(int nAlias=4;nAlias<28;nAlias++) - { - TObjArray* valueSet = new TObjArray; - valueSet->SetOwner(1); + for(int nAlias=4;nAlias<28;nAlias++){ +// if(nAlias<14 || nAlias>18){ + TObjArray* valueSet = new TObjArray; + valueSet->SetOwner(1); - TString aliasName = aliasNames[nAlias]; - 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()); - valueSet->Add(dcsVal); - } - aliasMap->Add(new TObjString(aliasName), valueSet); + TString aliasName = aliasNames[nAlias]; + //printf("\n\n alias: %s\n\n",aliasName.Data()); + + for(int timeStamp=0;timeStamp<=2000;timeStamp+=500){ + Float_t simVal = (Float_t) (random.Gaus()*600.+1800.); + AliDCSValue* dcsVal = new AliDCSValue(simVal, timeStamp); + //printf("%s\n",dcsVal->ToString()); + valueSet->Add(dcsVal); + } + aliasMap->Add(new TObjString(aliasName), valueSet); +// } } return aliasMap; @@ -251,7 +271,11 @@ TMap* ReadDCSAliasMap() // The file contains an AliCDBEntry that contains a TMap with the DCS structure. // An explanation of the structure can be found in CreateDCSAliasMap() - AliCDBEntry *entry = AliCDBManager::Instance()->Get("ZDC/DCS/Data", 0); + AliCDBManager *manager = AliCDBManager::Instance(); + AliCDBStorage *sto = manager->GetStorage("local://$ALICE_ROOT/SHUTTLE/TestShuttle/TestCDB/"); + AliCDBId id("ZDC/DCS/Data",0,999999999); + AliCDBEntry *entry = sto->Get("ZDC/DCS/Data", 0); + if(!entry) printf("TestZDCPreprocessor.C -> ERROR! No entry found as DCS Map! \n"); return dynamic_cast (entry->GetObject()); } @@ -266,10 +290,10 @@ void WriteDCSAliasMap() metaData.SetResponsible("Chiara Oppedisano"); metaData.SetComment("Test object for TestZDCPreprocessor.C"); - AliCDBId id("ZDC/DCS/Data", 0, 0); + AliCDBId id("ZDC/DCS/Data", 0, 999999999); // 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); }