void sim(Int_t embrun) { IlcSimulation sim; if (embrun == 4) { IlcCDBManager *cdbm = IlcCDBManager::Instance(); cdbm->SetRun(atoi(gSystem->Getenv("DC_RUN"))); cdbm->SetDefaultStorage("local://$ILC_ROOT/OCDB"); cdbm->SetSpecificStorage("GRP/GRP/Data",Form("local://%s",gSystem->pwd())); sim.SetMakeSDigits("ITS TPC TRD TOF VZERO"); sim.ConvertRaw2SDigits("raw.root","IlcESDs.root"); return; } if (embrun == 2) { sim.SetRunGeneration(kFALSE); sim.SetMakeSDigits(""); sim.SetMakeDigitsFromHits(""); } else { sim.SetRunGeneration(kTRUE); sim.SetMakeSDigits("ITS TPC TRD TOF VZERO"); } sim.SetRunSimulation(kTRUE); sim.SetMakeDigits("ITS TPC TRD TOF VZERO"); sim.SetWriteRawData("ITS TPC TRD TOF VZERO","raw.root",kTRUE); if (embrun == 1) sim.MergeWith("../BackgroundSDigits/gilc.root",1); sim.SetDefaultStorage("local://$ILC_ROOT/OCDB"); sim.SetSpecificStorage("GRP/GRP/Data", Form("local://%s",gSystem->pwd())); sim.SetRunQA(":") ; IlcQA::SetQARefStorage("local://$ILC_ROOT/OCDB") ; for (Int_t det = 0 ; det < IlcQA::kNDET ; det++) { sim.SetQACycles(det, 1) ; } // sim.SetDefaultStorage("alien://Folder=/ilc/simulation/2008/v4-15-Release/Full/"); // sim.SetRunHLT(""); // sim.SetQA(kFALSE); sim.Run(1); }
void UpdateCDBCTPConfig(const char *CTPcfg, const char* cdbUri, const char* cfgFile){ // Produces a trigger configuration starting from a 'cfg' file in the // GRP/CTP folder (CTPcfg argument). Stores the configuration in the specified CDB. // The third argument allows to specify the config file against which // the trigger confiuration is checked. IlcCDBManager* cdb = IlcCDBManager::Instance(); // we set the default storage to the repository because some dets require // already at the time of geometry creation to find calibration objects in the cdb if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ILC_ROOT/OCDB"); IlcCDBStorage* storage = cdb->GetStorage(cdbUri); cdb->SetRun(0); IlcCDBId id("GRP/CTP/Config",0,IlcCDBRunRange::Infinity()); IlcCDBMetaData *md= new IlcCDBMetaData(); // Get root and IlcRoot versions const char* rootv = gROOT->GetVersion(); gROOT->ProcessLine(".L $ILC_ROOT/macros/GetARversion.C"); TString av(GetARversion()); md->SetIlcRootVersion(av.Data()); md->SetComment(Form("Default CTP configuration for p-p mode produced with root version %s and IlcRoot version %s",rootv,av.Data())); // construct the CTP configuration starting from GRP/CTP/<CTPcfg>.cfg file IlcTriggerConfiguration *trconfig = IlcTriggerConfiguration::LoadConfiguration(CTPcfg); if (!trconfig) { Printf("Invalid cfg file! Exiting..."); return; } if (!trconfig->CheckConfiguration(cfgFile)) { Printf("CTP configuration is incompatible with the specified Config.C and IlcRoot version! Exiting..."); return; } Printf("Storing in CDB geometry produced with root version %s and IlcRoot version %s",rootv,av.Data()); storage->Put(trconfig,id,md); // This is to allow macros lauched after this one in the same session to find the // newly produced geometry. storage->QueryCDB(cdb->GetRun()); }
void MergeSetsOfIlcgnObjs(const char* filename1, const char* filename2, const char* det="ITS") { // example macro: building an array by merging the non-SSD entries // from one file (or OCDB entry) with the remaining SSD entries taken // from another file (or OCDB entry); the first two arguments can be local filenames // or URLs of the OCDB folders // const char* macroname = "MergeSetsOfIlcgnObjs"; TClonesArray* array1 = 0; TClonesArray* array2 = 0; TString arName(det); arName+="AlignObjs"; TString path(det); path+="/Align/Data"; TString f1(filename1); TString f2(filename2); IlcCDBStorage* stor1 = 0; IlcCDBStorage* stor2 = 0; Bool_t fromOcdb1=kFALSE; Bool_t fromOcdb2=kFALSE; if(f1.Contains("alien://folder=") || f1.Contains("local://")) fromOcdb1=kTRUE; if(f2.Contains("alien://folder=") || f2.Contains("local://")) fromOcdb2=kTRUE; IlcCDBManager* cdb = IlcCDBManager::Instance(); cdb->SetDefaultStorage("local://$ILC_ROOT/OCDB"); cdb->SetRun(0); if(fromOcdb1){ stor1 = cdb->GetStorage(f1.Data()); IlcCDBEntry* entry = stor1->Get(path.Data(),0); array1 = (TClonesArray*) entry->GetObject(); }else{ TFile* filein1 = TFile::Open(f1.Data(),"READ"); if(!filein1) { Info(macroname,Form("Unable to open file %s! Exiting ...", f1.Data())); return; } array1 = (TClonesArray*) filein1->Get(arName.Data()); } if(array1){ Info(macroname,Form("First array has %d entries", array1->GetEntriesFast())); }else{ Info(macroname,"Unable to get first array! Exiting ..."); return; } if(fromOcdb2){ stor2 = cdb->GetStorage(f2.Data()); IlcCDBEntry* entry = stor2->Get(path.Data(),0); array2 = (TClonesArray*) entry->GetObject(); }else{ TFile* filein2 = TFile::Open(f2.Data(),"READ"); if(!filein2) { Info(macroname,Form("Unable to open file %s! Exiting ...", f2.Data())); return; } array2 = (TClonesArray*) filein2->Get(arName.Data()); } if(array2){ Info(macroname,Form("Second array has %d entries", array2->GetEntriesFast())); }else{ Info(macroname,"Unable to get second array! Exiting ..."); return; } TClonesArray *mergedArr = new TClonesArray("IlcAlignObjParams",3000); Info(macroname,"Merging objects for SPD and SDD from the first array ..."); // SSD starts from 500 for(Int_t i=0; i<500; i++) { (*mergedArr)[i] = (IlcAlignObjParams*) array1->UncheckedAt(i); } Info(macroname,"Merging objects for SSD from the second array ..."); for(Int_t i=500; i<array2->GetEntriesFast(); i++) { (*mergedArr)[i] = (IlcAlignObjParams*) array2->UncheckedAt(i); } TString foutName("merged"); foutName+=det; foutName+="Alignment.root"; Info(macroname,Form("... in a single array into the file %s", foutName.Data())); TFile* fileout = TFile::Open(foutName.Data(),"RECREATE"); fileout->cd(); fileout->WriteObject(mergedArr,arName.Data(),"kSingleKey"); fileout->Close(); mergedArr->Delete(); }
void UpdateCDBVertexDiamondOld(Double_t xmed = 0., Double_t ymed = 0., Double_t sigx = 0.0060, Double_t sigy = 0.0060, Double_t sigz = 3.8) { // produce the mean vertex with the current IlcRoot and store it in the // CDB IlcCDBManager* man = IlcCDBManager::Instance(); man->SetDefaultStorage("local://$ILC_ROOT/OCDB"); man->SetRun(0); IlcCDBId id("GRP/Calib/MeanVertex",0,IlcCDBRunRange::Infinity()); IlcCDBId idTPC("GRP/Calib/MeanVertexTPC",0,IlcCDBRunRange::Infinity()); IlcCDBId idSPD("GRP/Calib/MeanVertexSPD",0,IlcCDBRunRange::Infinity()); IlcCDBMetaData *metadata= new IlcCDBMetaData(); // Get root and IlcRoot versions const char* rootv = gROOT->GetVersion(); TString av(ILCROOT_SVN_BRANCH); Int_t revnum = ILCROOT_SVN_REVISION; metadata->SetResponsible("*****@*****.**"); metadata->SetComment("Default mean vertex position"); metadata->SetIlcRootVersion(av.Data()); metadata->SetComment(Form("Default mean vertex produced with root version %s and IlcRoot %s, revision number %d",rootv,av.Data(),revnum)); Printf(Form("Storing in CDB the default mean vertex produced with root version %s and" "IlcRoot version %s, revision number %d", rootv, av.Data(), revnum)); Double_t resolx=5./10000.; // this is error on the weighted mean (5 micron) Double_t resoly=5./10000.; // this is error on the weighted mean (5 micron) Double_t sigma[3],position[3]; position[0]=xmed; position[1]=ymed; position[2]=0.; sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx); sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly); sigma[2]=sigz; IlcESDVertex *vertex = new IlcESDVertex(position,sigma,"vtxmean"); vertex->PrintStatus(); man->Put(vertex,id,metadata); position[0]=xmed; position[1]=ymed; position[2]=0.; sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx); sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly); sigma[2]=sigz; IlcESDVertex *vertexTPC = new IlcESDVertex(position,sigma,"vtxmean"); vertexTPC->PrintStatus(); man->Put(vertexTPC,idTPC,metadata); position[0]=xmed; position[1]=ymed; position[2]=0.; sigma[0]=TMath::Sqrt(sigx*sigx+resolx*resolx); sigma[1]=TMath::Sqrt(sigy*sigy+resoly*resoly); sigma[2]=sigz; IlcESDVertex *vertexSPD = new IlcESDVertex(position,sigma,"vtxmean"); vertexSPD->PrintStatus(); man->Put(vertexSPD,idSPD,metadata); }