diff --git a/macro/beamtime/hd2020/eval_tracks.sh b/macro/beamtime/hd2020/eval_tracks.sh index e1c3e474675cb78dad4b74d3e52da2345c7cbdcb..196b920faad0dbc2a58e3b1d1067743f9f6700d5 100755 --- a/macro/beamtime/hd2020/eval_tracks.sh +++ b/macro/beamtime/hd2020/eval_tracks.sh @@ -76,7 +76,9 @@ mv -v tofAnaTestBeam.hst.root ${cRun}_TrkAnaTestBeam.hst.root rm all_* if (! (test -f Test.res)); then -echo no resolution file available: return +echo no resolution file available: scan full statistics and exit +iCal=1 +root -b -q '../../ana_trks.C(-1,'$iSel',-1,"'$cRun'","'$cSet'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$dDeadtime',"'$cCalId'",'$iCal')' exit 1 fi done diff --git a/macro/beamtime/mcbm2020/ana_trks.C b/macro/beamtime/mcbm2020/ana_trks.C index 2985d9318c1924f43dec996a908efd24da049975..b2998dcc3fc0d8596320c88935db2056d4d8b1ed 100644 --- a/macro/beamtime/mcbm2020/ana_trks.C +++ b/macro/beamtime/mcbm2020/ana_trks.C @@ -269,7 +269,7 @@ void ana_trks(Int_t nEvents = 10000, case 2: iMinNofHits = 3; iNStations = 28; - iNReqStations = 3; + iNReqStations = 4; tofFindTracks->SetStation(0, 0, 2, 2); tofFindTracks->SetStation(1, 0, 0, 2); tofFindTracks->SetStation(2, 0, 1, 2); @@ -699,6 +699,7 @@ void ana_trks(Int_t nEvents = 10000, gInterpreter->ProcessLine("pl_all_Track2D(1)"); gInterpreter->ProcessLine("pl_all_Track2D(2)"); + gInterpreter->ProcessLine("pl_all_Track2D(4)"); TString over_trk = "pl_over_trk(" + (TString)(Form("%d", iNStations)) + ")"; gInterpreter->ProcessLine(over_trk); diff --git a/macro/beamtime/mcbm2020/ana_trksi.C b/macro/beamtime/mcbm2020/ana_trksi.C index f0f0ef6e862b0d328e2c5c8dfc9bdb3e63c6caab..126788eb263d6e85b7d65528691ae55e9d6160dd 100644 --- a/macro/beamtime/mcbm2020/ana_trksi.C +++ b/macro/beamtime/mcbm2020/ana_trksi.C @@ -1,4 +1,4 @@ -void ana_trks(Int_t nEvents = 10000, +void ana_trksi(Int_t nEvents = 10000, Int_t iSel = 1, Int_t iGenCor = 1, TString cFileId = "48.50.7.1", @@ -12,9 +12,13 @@ void ana_trks(Int_t nEvents = 10000, Int_t iAnaCor = 1, Bool_t bUseSigCalib = kFALSE, Int_t iCalSet = 30040500, - Int_t iCalOpt = 1) { + Int_t iCalOpt = 1, + Int_t iMc = 0) { Int_t iVerbose = 1; if (cCalId == "") cCalId = cFileId; + TString FId = cFileId; + TString cRun(FId(0, 3)); + Int_t iRun = cRun.Atoi(); // Specify log level (INFO, DEBUG, DEBUG1, ...) //TString logLevel = "FATAL"; //TString logLevel = "ERROR"; @@ -31,6 +35,11 @@ void ana_trks(Int_t nEvents = 10000, TString InputDigiFile = paramDir + "/data/digidev_" + cFileId.Data() + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime) + cCalId + ".out.root"; + if (iMc == 1) { + InputFile = paramDir + "/data/" + cFileId.Data() + ".raw.root"; + InputDigiFile = paramDir + "/data/" + cFileId.Data() + ".rec.root"; + iRun = 700; + } TString OutputFile = paramDir + "/data/hits_" + cFileId.Data() + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2) + ".out.root"; @@ -57,27 +66,38 @@ void ana_trks(Int_t nEvents = 10000, TList* parFileList = new TList(); - TString TofGeo = "v19b_mcbm"; //default - - cout << "Geometry version " << TofGeo << endl; - - TObjString* tofDigiFile = new TObjString( - workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file - parFileList->Add(tofDigiFile); - - // TObjString tofDigiBdfFile = paramDir + "/tof.digibdf.par"; - // TObjString tofDigiBdfFile = paramDir + "/tof." + FPar + "digibdf.par"; - TObjString* tofDigiBdfFile = - new TObjString(workDir + "/parameters/tof/" + TofGeo + ".digibdf.par"); - parFileList->Add(tofDigiBdfFile); - - TString geoDir = gSystem->Getenv("VMCWORKDIR"); - TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root"; - TFile* fgeo = new TFile(geoFile); - TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); - if (NULL == geoMan) { - cout << "<E> FAIRGeom not found in geoFile" << endl; - return; + Int_t iGeo = 0; //iMc; + if (iGeo == 0) { + TString TofGeo = ""; + if (iRun < 690) + TofGeo = "v20a_mcbm"; + else + TofGeo = "v20b_mcbm"; + cout << "Geometry version " << TofGeo << endl; + + TObjString* tofDigiBdfFile = + new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par"); + parFileList->Add(tofDigiBdfFile); + + TString geoDir = gSystem->Getenv("VMCWORKDIR"); + TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root"; + TFile* fgeo = new TFile(geoFile); + TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); + if (NULL == geoMan) { + cout << "<E> FAIRGeom not found in geoFile" << endl; + return; + } + } else { + TString setupName = "mcbm_beam_2020_03"; + // ----- Load the geometry setup ------------------------------------- + TString setupFile = + workDir + "/geometry/setup/setup_" + setupName.Data() + ".C"; + TString setupFunct = "setup_"; + setupFunct = setupFunct + setupName + "()"; + std::cout << "-I- Loading macro " << setupFile << std::endl; + gROOT->LoadMacro(setupFile); + gROOT->ProcessLine(setupFunct); + CbmSetup* setup = CbmSetup::Instance(); } // ----- Reconstruction run ------------------------------------------- @@ -89,10 +109,12 @@ void ana_trks(Int_t nEvents = 10000, //run->AddFriend(InputDigiFile.Data()); run->SetInputFile(InputDigiFile.Data()); //run->AddFriend(InputFile.Data()); - run->SetOutputFile(OutputFile); + //run->SetOutputFile(OutputFile); + run->SetUserOutputFileName(OutputFile.Data()); + run->SetSink(new FairRootFileSink(run->GetUserOutputFileName())); FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); + FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH"); // ----- Local selection variables ------------------------------------------- @@ -141,8 +163,6 @@ void ana_trks(Int_t nEvents = 10000, // ========================================================================= // === Tracking === // ========================================================================= - CbmStsDigitize* stsDigitize = new CbmStsDigitize(); //necessary for kalman !! - CbmKF* kalman = new CbmKF(); CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); tofTrackFinder->SetMaxTofTimeDifference(0.2); // in ns/cm @@ -168,11 +188,15 @@ void ana_trks(Int_t nEvents = 10000, CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); tofFindTracks->UseFinder(tofTrackFinder); tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCalOpt(iCalOpt); // 1 - update offsets + tofFindTracks->SetCalOpt( + iCalOpt); // 1 - update offsets, 2 - update walk, 0 - bypass tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg(0.055); // target value for Dec2019 - //tofFindTracks->SetTtTarg(0.051); // target value Nov2019 - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetTtTarg( + 0.0605); // target value for Mar2020 triple stack -> betapeak ~ 0.95 + //tofFindTracks->SetTtTarg(0.062); // target value for Mar2020 triple stack -> betapeak ~ 0.95 + //tofFindTracks->SetTtTarg(0.058); // target value for Mar2020 double stack + //tofFindTracks->SetTtTarg(0.051); // target value Nov2019 + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! tofFindTracks->SetCalParFileName( cTrkFile); // Tracker parameter value file name tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter @@ -190,7 +214,6 @@ void ana_trks(Int_t nEvents = 10000, * 2.); // matching window in multiples of chi2 tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - Int_t iMinNofHits = -1; Int_t iNStations = 0; Int_t iNReqStations = 3; @@ -244,37 +267,36 @@ void ana_trks(Int_t nEvents = 10000, case 2: iMinNofHits = 3; - iNStations = 29; + iNStations = 28; iNReqStations = 3; - tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(0, 0, 2, 2); + tofFindTracks->SetStation(1, 0, 0, 2); tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(3, 0, 2, 1); + tofFindTracks->SetStation(4, 0, 0, 1); tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(6, 0, 2, 3); + tofFindTracks->SetStation(7, 0, 0, 3); tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(9, 0, 2, 0); + tofFindTracks->SetStation(10, 0, 0, 0); tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(12, 0, 2, 4); + tofFindTracks->SetStation(13, 0, 0, 4); tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - tofFindTracks->SetStation(28, 6, 0, 0); - tofFindTracks->SetStation(0, 6, 0, 1); + tofFindTracks->SetStation(15, 0, 4, 0); + tofFindTracks->SetStation(16, 0, 3, 0); + tofFindTracks->SetStation(17, 0, 4, 1); + tofFindTracks->SetStation(18, 0, 3, 1); + tofFindTracks->SetStation(19, 0, 4, 2); + tofFindTracks->SetStation(20, 0, 3, 2); + tofFindTracks->SetStation(21, 0, 4, 3); + tofFindTracks->SetStation(22, 0, 3, 3); + tofFindTracks->SetStation(23, 0, 4, 4); + tofFindTracks->SetStation(24, 0, 3, 4); + tofFindTracks->SetStation(25, 9, 0, 0); + tofFindTracks->SetStation(26, 9, 0, 1); + tofFindTracks->SetStation(27, 5, 0, 0); break; case 3: @@ -402,6 +424,7 @@ void ana_trks(Int_t nEvents = 10000, tofFindTracks->SetStation(1, 0, 1, 2); tofFindTracks->SetStation(2, 0, 0, 2); tofFindTracks->SetStation(3, 0, 2, 2); + break; default: cout << "Tracking setup " << iTrackingSetup << " not implemented " @@ -424,6 +447,10 @@ void ana_trks(Int_t nEvents = 10000, tofAnaTestbeam->SetHitDistMin(30.); // initialization tofAnaTestbeam->SetEnableMatchPosScaling(kTRUE); tofAnaTestbeam->SetSpillDuration(3.); + if (iMc == 1) { + tofAnaTestbeam->SetSpillDuration(0.); + tofAnaTestbeam->SetSpillBreak(0.); + } //CbmTofAnaTestbeam defaults tofAnaTestbeam->SetR0LimFit( 20.); // limit distance of fitted track to nominal vertex @@ -481,7 +508,7 @@ void ana_trks(Int_t nEvents = 10000, tofAnaTestbeam->SetBeamRefSmId(iRSelSm); tofAnaTestbeam->SetBeamRefRpc(iRSelRpc); - if (iSel2 >= 0) { + if (iSel2 >= -1) { tofAnaTestbeam->SetMrpcSel2( iSel2); // initialization of second selector Mrpc Type tofAnaTestbeam->SetMrpcSel2Sm( @@ -490,6 +517,9 @@ void ana_trks(Int_t nEvents = 10000, iSel2Rpc); // initialization of second selector Mrpc RpcId } + cout << "AnaTestbeam init for Dut " << iDut << iDutSm << iDutRpc << ", Ref " + << iRef << iRefSm << iRefRpc << endl; + tofAnaTestbeam->SetDut(iDut); // Device under test tofAnaTestbeam->SetDutSm(iDutSm); // Device under test tofAnaTestbeam->SetDutRpc(iDutRpc); // Device under test @@ -499,6 +529,7 @@ void ana_trks(Int_t nEvents = 10000, cout << "dispatch iSel = " << iSel << ", iSel2in = " << iSel2in << ", iRSelin = " << iRSelin << ", iRSel = " << iRSel << endl; + if (1) { switch (iSel) { @@ -624,9 +655,6 @@ void ana_trks(Int_t nEvents = 10000, run->Run(0, nEvents); //run->Run(nEvents-1, nEvents); //debugging single events for memory leak // ------------------------------------------------------------------------ - TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")"; - gROOT->LoadMacro("save_hst.C"); - gInterpreter->ProcessLine(SaveToHstFile); // default displays, plot results /* @@ -642,12 +670,13 @@ void ana_trks(Int_t nEvents = 10000, cout << "Exec "<< Display_Funct.Data()<< endl; gInterpreter->ProcessLine(Display_Funct); */ + gROOT->LoadMacro("save_hst.C"); gROOT->LoadMacro("pl_over_MatD4sel.C"); gROOT->LoadMacro("pl_eff_XY.C"); gROOT->LoadMacro("pl_over_trk.C"); gROOT->LoadMacro("pl_calib_trk.C"); gROOT->LoadMacro("pl_XY_trk.C"); - //gROOT->LoadMacro("pl_vert_trk.C"); + gROOT->LoadMacro("pl_vert_trk.C"); gROOT->LoadMacro("pl_pull_trk.C"); gROOT->LoadMacro("pl_all_Track2D.C"); gROOT->LoadMacro("pl_TIS.C"); @@ -657,14 +686,19 @@ void ana_trks(Int_t nEvents = 10000, gROOT->LoadMacro("pl_Eff_TIS.C"); gROOT->LoadMacro("pl_Dut_Res.C"); + TString SaveToHstFile = "save_hst(\"" + cHstFile + "\")"; + gInterpreter->ProcessLine(SaveToHstFile); + //gInterpreter->ProcessLine("pl_over_MatD4sel()"); //gInterpreter->ProcessLine("pl_TIS()"); //gInterpreter->ProcessLine("pl_TIR()"); //gInterpreter->ProcessLine("pl_eff_XY()"); gInterpreter->ProcessLine("pl_calib_trk()"); + gInterpreter->ProcessLine("pl_vert_trk()"); gInterpreter->ProcessLine("pl_all_Track2D(1)"); gInterpreter->ProcessLine("pl_all_Track2D(2)"); + gInterpreter->ProcessLine("pl_all_Track2D(4)"); TString over_trk = "pl_over_trk(" + (TString)(Form("%d", iNStations)) + ")"; gInterpreter->ProcessLine(over_trk); diff --git a/macro/beamtime/mcbm2020/dis_trks.C b/macro/beamtime/mcbm2020/dis_trks.C index a6772864a3cf23589f5a0c6cf22a48d314d0bd6a..4b8961f49fcd2442b7f031d989b0b57a8a3be626 100644 --- a/macro/beamtime/mcbm2020/dis_trks.C +++ b/macro/beamtime/mcbm2020/dis_trks.C @@ -10,9 +10,16 @@ void dis_trks(Int_t nEvents = 10, Double_t dDeadtime = 50, TString cCalId = "", Int_t iAnaCor = 1, - Int_t iCalSet = 30040500) { + Bool_t bUseSigCalib = kFALSE, + Int_t iCalSet = 30040500, + Int_t iCalOpt = 1, + Int_t iMc = 0) { + Int_t iVerbose = 1; if (cCalId == "") cCalId = cFileId; + TString FId = cFileId; + TString cRun(FId(0, 3)); + Int_t iRun = cRun.Atoi(); // Specify log level (INFO, DEBUG, DEBUG1, ...) //TString logLevel = "FATAL"; //TString logLevel = "ERROR"; @@ -30,7 +37,12 @@ void dis_trks(Int_t nEvents = 10, TString InputDigiFile = paramDir + "/data/digidev_" + cFileId.Data() + Form("_%s_%02.0f_Cal", cSet.Data(), dDeadtime) + cCalId + ".out.root"; - TString OutputFile = paramDir + "/data/dishits_" + cFileId.Data() + if (iMc == 1) { + InputFile = paramDir + "/data/" + cFileId.Data() + ".raw.root"; + InputDigiFile = paramDir + "/data/" + cFileId.Data() + ".rec.root"; + iRun = 700; + } + TString OutputFile = paramDir + "/data/hits_" + cFileId.Data() + Form("_%s_%06d_%03d", cSet.Data(), iSel, iSel2) + ".out.root"; TString cHstFile = @@ -56,11 +68,17 @@ void dis_trks(Int_t nEvents = 10, TList* parFileList = new TList(); - TString TofGeo = "v20b_mcbm"; //default - cout << "Geometry version " << TofGeo << endl; - - // ----- Load the geometry setup ------------------------------------- - /* + Int_t iGeo = 0; //iMc; + if (iGeo == 0) { + TString TofGeo = ""; + if (iRun < 690) + TofGeo = "v20a_mcbm"; + else + TofGeo = "v20b_mcbm"; + cout << "Geometry version " << TofGeo << endl; + + // ----- Load the geometry setup ------------------------------------- + /* const char* setupName = "mcbm_beam_2020_03"; TString setupFile = workDir + "/geometry/setup/setup_" + setupName + ".C"; TString setupFunct = "setup_"; @@ -71,227 +89,230 @@ void dis_trks(Int_t nEvents = 10, CbmSetup* setup = CbmSetup::Instance(); */ - TString geoDir = gSystem->Getenv("VMCWORKDIR"); - TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root"; - TFile* fgeo = new TFile(geoFile); - TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); - if (NULL == geoMan) { - cout << "<E> FAIRGeom not found in geoFile" << endl; - return; - } + TString geoDir = gSystem->Getenv("VMCWORKDIR"); + TString geoFile = geoDir + "/geometry/tof/geofile_tof_" + TofGeo + ".root"; + TFile* fgeo = new TFile(geoFile); + TGeoManager* geoMan = (TGeoManager*) fgeo->Get("FAIRGeom"); + if (NULL == geoMan) { + cout << "<E> FAIRGeom not found in geoFile" << endl; + return; + } - //TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file - //parFileList->Add(tofDigiFile); - - TObjString* tofDigiBdfFile = - new TObjString(workDir + "/parameters/tof/" + TofGeo + ".digibdf.par"); - parFileList->Add(tofDigiBdfFile); - - // ----- Reconstruction run ------------------------------------------- - FairRunAna* run = new FairRunAna(); - cout << "InputFile: " << InputFile.Data() << endl; - cout << "InputDigiFile: " << InputDigiFile.Data() << endl; - - //run->SetInputFile(InputFile.Data()); - //run->AddFriend(InputDigiFile.Data()); - run->SetInputFile(InputDigiFile.Data()); - //run->AddFriend(InputFile.Data()); - run->SetOutputFile(OutputFile); - - FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); - // FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); - FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH"); - - // ----- Local selection variables ------------------------------------------- - - Int_t iRef = iSel % 1000; - Int_t iDut = (iSel - iRef) / 1000; - Int_t iDutRpc = iDut % 10; - iDut = (iDut - iDutRpc) / 10; - Int_t iDutSm = iDut % 10; - iDut = (iDut - iDutSm) / 10; - Int_t iRefRpc = iRef % 10; - iRef = (iRef - iRefRpc) / 10; - Int_t iRefSm = iRef % 10; - iRef = (iRef - iRefSm) / 10; - - Int_t iSel2in = iSel2; - Int_t iSel2Rpc = iSel2 % 10; - iSel2 = (iSel2 - iSel2Rpc) / 10; - Int_t iSel2Sm = iSel2 % 10; - iSel2 = (iSel2 - iSel2Sm) / 10; - - Int_t calMode = 93; - Int_t calSel = 1; - Bool_t bOut = kFALSE; - - CbmTofEventClusterizer* tofClust = - new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut); - Int_t calSelRead = calSel; - if (calSel < 0) calSelRead = 0; - TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cFileId.Data(), - iCalSet, - calMode, - calSelRead); - if (cCalId != "XXX") - cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cCalId.Data(), - iCalSet, - calMode, - calSelRead); - tofClust->SetCalParFileName(cFname); - TString cOutFname = - Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet); - tofClust->SetOutHstFileName(cOutFname); - - // ========================================================================= - // === Tracking === - // ========================================================================= - /* - CbmTofEventClusterizer* tofClust = new CbmTofEventClusterizer("TOF Event Clusterizer",iVerbose, bOut); - tofClust->SetMemoryTime(1000000.); // internal storage time of hits in ns - */ - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(0.4); // in ns/cm - Int_t TrackerPar = 0; - switch (TrackerPar) { - case 0: // for full mTof setup - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTxMean(0.); // mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - break; - case 1: // for double stack test counters - tofTrackFinder->SetTxMean(0.21); // mean slope dy/dz - tofTrackFinder->SetTyMean(0.18); // mean slope dy/dz - tofTrackFinder->SetTxLIM(0.15); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.18); // max dev from mean slope dy/dz - break; - } + //TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file + //parFileList->Add(tofDigiFile); + + TObjString* tofDigiBdfFile = + new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par"); + parFileList->Add(tofDigiBdfFile); + + // ----- Reconstruction run ------------------------------------------- + FairRunAna* run = new FairRunAna(); + cout << "InputFile: " << InputFile.Data() << endl; + cout << "InputDigiFile: " << InputDigiFile.Data() << endl; + + //run->SetInputFile(InputFile.Data()); + //run->AddFriend(InputDigiFile.Data()); + run->SetInputFile(InputDigiFile.Data()); + //run->AddFriend(InputFile.Data()); + run->SetOutputFile(OutputFile); + + FairLogger::GetLogger()->SetLogScreenLevel(logLevel.Data()); + // FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); + FairLogger::GetLogger()->SetLogVerbosityLevel("VERYHIGH"); + + // ----- Local selection variables ------------------------------------------- + + Int_t iRef = iSel % 1000; + Int_t iDut = (iSel - iRef) / 1000; + Int_t iDutRpc = iDut % 10; + iDut = (iDut - iDutRpc) / 10; + Int_t iDutSm = iDut % 10; + iDut = (iDut - iDutSm) / 10; + Int_t iRefRpc = iRef % 10; + iRef = (iRef - iRefRpc) / 10; + Int_t iRefSm = iRef % 10; + iRef = (iRef - iRefSm) / 10; + + Int_t iSel2in = iSel2; + Int_t iSel2Rpc = iSel2 % 10; + iSel2 = (iSel2 - iSel2Rpc) / 10; + Int_t iSel2Sm = iSel2 % 10; + iSel2 = (iSel2 - iSel2Sm) / 10; + + Int_t calMode = 93; + Int_t calSel = 1; + Bool_t bOut = kFALSE; + + CbmTofEventClusterizer* tofClust = + new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut); + Int_t calSelRead = calSel; + if (calSel < 0) calSelRead = 0; + TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root", + cFileId.Data(), + iCalSet, + calMode, + calSelRead); + if (cCalId != "XXX") + cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root", + cCalId.Data(), + iCalSet, + calMode, + calSelRead); + tofClust->SetCalParFileName(cFname); + TString cOutFname = + Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet); + tofClust->SetOutHstFileName(cOutFname); + + // ========================================================================= + // === Tracking === + // ========================================================================= + + CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(0.4); // in ns/cm + Int_t TrackerPar = 0; + switch (TrackerPar) { + case 0: // for full mTof setup + tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz + tofTrackFinder->SetTxMean(0.); // mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + break; + case 1: // for double stack test counters + tofTrackFinder->SetTxMean(0.21); // mean slope dy/dz + tofTrackFinder->SetTyMean(0.18); // mean slope dy/dz + tofTrackFinder->SetTxLIM(0.15); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.18); // max dev from mean slope dy/dz + break; + } + + CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); + TFitter* MyFit = new TFitter(1); // initialize Minuit + tofTrackFinder->SetFitter(tofTrackFitter); + CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); + tofFindTracks->UseFinder(tofTrackFinder); + tofFindTracks->UseFitter(tofTrackFitter); + tofFindTracks->SetCalOpt( + iCalOpt); // 1 - update offsets, 2 - update walk, 0 - bypass + tofFindTracks->SetCorMode( + iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + tofFindTracks->SetTtTarg( + 0.057); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + tofFindTracks->SetCalParFileName( + cTrkFile); // Tracker parameter value file name + tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter + tofFindTracks->SetStationMaxHMul( + 30); // Max Hit Multiplicity in any used station + + tofFindTracks->SetT0MAX(dScalFac); // in ns + tofFindTracks->SetSIGT(0.08); // default in ns + tofFindTracks->SetSIGX(0.3); // default in cm + tofFindTracks->SetSIGY(0.6); // default in cm + tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetUseSigCalib( + bUseSigCalib); // ignore resolutions in CalPar file + tofTrackFinder->SetSIGLIM(dChi2Lim2 + * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 + + + Int_t iMinNofHits = -1; + Int_t iNStations = 0; + Int_t iNReqStations = 3; + + switch (iTrackingSetup) { + case 0: // bypass mode + iMinNofHits = -1; + iNStations = 1; + tofFindTracks->SetStation(0, 5, 0, 0); // Diamond + break; + + case 1: // for calibration mode of full setup + { + Double_t dTsig = dScalFac * 0.03; + tofFindTracks->SetSIGT(dTsig); // allow for variable deviations in ns + } + iMinNofHits = 3; + iNStations = 30; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + tofFindTracks->SetStation(16, 0, 4, 0); + tofFindTracks->SetStation(17, 0, 3, 0); + tofFindTracks->SetStation(18, 0, 4, 1); + tofFindTracks->SetStation(19, 0, 3, 1); + tofFindTracks->SetStation(20, 0, 4, 2); + tofFindTracks->SetStation(21, 0, 3, 2); + tofFindTracks->SetStation(22, 0, 4, 3); + tofFindTracks->SetStation(23, 0, 3, 3); + tofFindTracks->SetStation(24, 0, 4, 4); + tofFindTracks->SetStation(25, 0, 3, 4); + tofFindTracks->SetStation(26, 9, 0, 0); + tofFindTracks->SetStation(27, 9, 0, 1); + tofFindTracks->SetStation(28, 6, 0, 0); + tofFindTracks->SetStation(29, 6, 0, 1); + break; + + case 2: + iMinNofHits = 3; + iNStations = 14; + iNReqStations = 5; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 1); + tofFindTracks->SetStation(2, 0, 3, 1); + tofFindTracks->SetStation(3, 0, 4, 0); + tofFindTracks->SetStation(4, 0, 3, 0); + tofFindTracks->SetStation(5, 0, 4, 2); + tofFindTracks->SetStation(6, 0, 3, 2); + tofFindTracks->SetStation(7, 0, 4, 3); + tofFindTracks->SetStation(8, 0, 3, 3); + tofFindTracks->SetStation(9, 0, 4, 4); + tofFindTracks->SetStation(10, 0, 3, 4); + tofFindTracks->SetStation(11, 9, 0, 0); + tofFindTracks->SetStation(12, 9, 0, 1); + tofFindTracks->SetStation(13, 7, 0, 0); + break; + + case 3: + iMinNofHits = 3; + iNStations = 16; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 2, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + tofFindTracks->SetStation(3, 0, 0, 2); + + tofFindTracks->SetStation(4, 0, 2, 1); + tofFindTracks->SetStation(5, 0, 1, 1); + tofFindTracks->SetStation(6, 0, 0, 1); - CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); - TFitter* MyFit = new TFitter(1); // initialize Minuit - tofTrackFinder->SetFitter(tofTrackFitter); - CbmTofFindTracks* tofFindTracks = new CbmTofFindTracks("TOF Track Finder"); - tofFindTracks->UseFinder(tofTrackFinder); - tofFindTracks->UseFitter(tofTrackFitter); - tofFindTracks->SetCalOpt(1); // 1 - update offsets - tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg( - 0.057); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! - tofFindTracks->SetCalParFileName( - cTrkFile); // Tracker parameter value file name - tofFindTracks->SetBeamCounter(5, 0, 0); // default beam counter - tofFindTracks->SetStationMaxHMul( - 30); // Max Hit Multiplicity in any used station - - tofFindTracks->SetT0MAX(dScalFac); // in ns - tofFindTracks->SetSIGT(0.08); // default in ns - tofFindTracks->SetSIGX(0.3); // default in cm - tofFindTracks->SetSIGY(0.6); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm - tofFindTracks->SetUseSigCalib(kFALSE); // ignore resolutions in CalPar file - tofTrackFinder->SetSIGLIM(dChi2Lim2 - * 2.); // matching window in multiples of chi2 - tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - - - Int_t iMinNofHits = -1; - Int_t iNStations = 0; - Int_t iNReqStations = 3; - - switch (iTrackingSetup) { - case 0: // bypass mode - iMinNofHits = -1; - iNStations = 1; - tofFindTracks->SetStation(0, 5, 0, 0); // Diamond - break; - - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 30; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - tofFindTracks->SetStation(16, 0, 4, 0); - tofFindTracks->SetStation(17, 0, 3, 0); - tofFindTracks->SetStation(18, 0, 4, 1); - tofFindTracks->SetStation(19, 0, 3, 1); - tofFindTracks->SetStation(20, 0, 4, 2); - tofFindTracks->SetStation(21, 0, 3, 2); - tofFindTracks->SetStation(22, 0, 4, 3); - tofFindTracks->SetStation(23, 0, 3, 3); - tofFindTracks->SetStation(24, 0, 4, 4); - tofFindTracks->SetStation(25, 0, 3, 4); - tofFindTracks->SetStation(26, 9, 0, 0); - tofFindTracks->SetStation(27, 9, 0, 1); - tofFindTracks->SetStation(28, 6, 0, 0); - tofFindTracks->SetStation(29, 6, 0, 1); - break; - - case 2: - iMinNofHits = 3; - iNStations = 14; - iNReqStations = 5; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 1); - tofFindTracks->SetStation(2, 0, 3, 1); - tofFindTracks->SetStation(3, 0, 4, 0); - tofFindTracks->SetStation(4, 0, 3, 0); - tofFindTracks->SetStation(5, 0, 4, 2); - tofFindTracks->SetStation(6, 0, 3, 2); - tofFindTracks->SetStation(7, 0, 4, 3); - tofFindTracks->SetStation(8, 0, 3, 3); - tofFindTracks->SetStation(9, 0, 4, 4); - tofFindTracks->SetStation(10, 0, 3, 4); - tofFindTracks->SetStation(11, 9, 0, 0); - tofFindTracks->SetStation(12, 9, 0, 1); - tofFindTracks->SetStation(13, 7, 0, 0); - break; - - case 3: - iMinNofHits = 3; - iNStations = 16; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 2, 2); - tofFindTracks->SetStation(2, 0, 1, 2); - tofFindTracks->SetStation(3, 0, 0, 2); - - tofFindTracks->SetStation(4, 0, 2, 1); - tofFindTracks->SetStation(5, 0, 1, 1); - tofFindTracks->SetStation(6, 0, 0, 1); - - tofFindTracks->SetStation(7, 0, 2, 3); - tofFindTracks->SetStation(8, 0, 1, 3); - tofFindTracks->SetStation(9, 0, 0, 3); - - tofFindTracks->SetStation(10, 0, 2, 0); - tofFindTracks->SetStation(11, 0, 1, 0); - tofFindTracks->SetStation(12, 0, 0, 0); - - tofFindTracks->SetStation(13, 0, 2, 4); - tofFindTracks->SetStation(14, 0, 1, 4); - tofFindTracks->SetStation(15, 0, 0, 4); - - /* + tofFindTracks->SetStation(7, 0, 2, 3); + tofFindTracks->SetStation(8, 0, 1, 3); + tofFindTracks->SetStation(9, 0, 0, 3); + + tofFindTracks->SetStation(10, 0, 2, 0); + tofFindTracks->SetStation(11, 0, 1, 0); + tofFindTracks->SetStation(12, 0, 0, 0); + + tofFindTracks->SetStation(13, 0, 2, 4); + tofFindTracks->SetStation(14, 0, 1, 4); + tofFindTracks->SetStation(15, 0, 0, 4); + + /* tofFindTracks->SetStation(16, 0, 3, 2); tofFindTracks->SetStation(17, 0, 4, 2); tofFindTracks->SetStation(18, 0, 3, 1); @@ -303,326 +324,330 @@ void dis_trks(Int_t nEvents = 10, tofFindTracks->SetStation(24, 0, 3, 4); tofFindTracks->SetStation(25, 0, 4, 4); */ - break; - - case 4: - iMinNofHits = 3; - iNStations = 4; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 1); - tofFindTracks->SetStation(2, 0, 3, 1); - tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); - break; - - case 5: // for calibration of 2-stack and add-on counters (STAR2, BUC) - iMinNofHits = 3; - iNStations = 5; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 1); - tofFindTracks->SetStation(2, 0, 3, 1); - tofFindTracks->SetStation(3, 9, 0, 0); - tofFindTracks->SetStation(4, 9, 0, 1); - break; - - case 6: - iMinNofHits = 3; - iNStations = 4; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 1); - tofFindTracks->SetStation(2, 0, 3, 1); - tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); - // tofFindTracks->SetStation(3, 9, 0, 0); - // tofFindTracks->SetStation(3, 9, 0, 1); - // tofFindTracks->SetStation(3, 7, 0, 0); - break; - - case 7: // for calibration of 2-stack and add-on counters (BUC) - iMinNofHits = 4; - iNStations = 5; - iNReqStations = 5; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 3); - tofFindTracks->SetStation(2, 0, 3, 3); - tofFindTracks->SetStation(3, 6, 0, 0); - tofFindTracks->SetStation(4, 6, 0, 1); - break; - - case 8: // evaluation of add-on counters (BUC) - iMinNofHits = 3; - iNStations = 4; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 4, 3); - tofFindTracks->SetStation(2, 0, 3, 3); - tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); - break; - - case 10: - iMinNofHits = 3; - iNStations = 4; - iNReqStations = 4; - tofFindTracks->SetStation(0, 5, 0, 0); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(3, 0, 2, 2); - - default: - cout << "Tracking setup " << iTrackingSetup << " not implemented " - << endl; - return; - ; - } - tofFindTracks->SetMinNofHits(iMinNofHits); - tofFindTracks->SetNStations(iNStations); - tofFindTracks->SetNReqStations(iNReqStations); - tofFindTracks->PrintSetup(); - run->AddTask(tofFindTracks); - - // ========================================================================= - // === Analysis === - // ========================================================================= - CbmTofAnaTestbeam* tofAnaTestbeam = - new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose); - tofAnaTestbeam->SetCorMode(iAnaCor); // 1 - DTD4, 2 - X4, 3 - Y4, 4 - Texp - tofAnaTestbeam->SetHitDistMin(30.); // initialization - tofAnaTestbeam->SetEnableMatchPosScaling(kTRUE); - tofAnaTestbeam->SetSpillDuration(4.); - //CbmTofAnaTestbeam defaults - tofAnaTestbeam->SetDXMean(0.); - tofAnaTestbeam->SetDYMean(0.); - tofAnaTestbeam->SetDTMean(0.); // in ns - tofAnaTestbeam->SetDXWidth(0.5); - tofAnaTestbeam->SetDYWidth(1.0); - tofAnaTestbeam->SetDTWidth(0.1); // in ns - tofAnaTestbeam->SetCalParFileName(cAnaFile); - Double_t dScalFacA = 0.9; // dScalFac is used for tracking - tofAnaTestbeam->SetPosY4Sel( - 0.5 * dScalFacA); // Y Position selection in fraction of strip length - tofAnaTestbeam->SetDTDia(0.); // Time difference to additional diamond - tofAnaTestbeam->SetMul0Max(20); // Max Multiplicity in dut - tofAnaTestbeam->SetMul4Max(30); // Max Multiplicity in Ref - RPC - tofAnaTestbeam->SetMulDMax(3); // Max Multiplicity in Diamond / BeamRef - tofAnaTestbeam->SetTOffD4(14.); // initialization - tofAnaTestbeam->SetDTD4MAX( - 6.); // initialization of Max time difference Ref - BRef - - //tofAnaTestbeam->SetTShift(-28000.);// initialization - tofAnaTestbeam->SetPosYS2Sel( - 0.55); // Y Position selection in fraction of strip length - tofAnaTestbeam->SetChS2Sel(0.); // Center of channel selection window - tofAnaTestbeam->SetDChS2Sel(100.); // Width of channel selection window - tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 - tofAnaTestbeam->SetChi2Lim(5.); // initialization of Chi2 selection limit - tofAnaTestbeam->SetChi2Lim2( - 3.); // initialization of Chi2 selection limit for Mref-Sel2 pair - tofAnaTestbeam->SetDutDX( - 15.); // limit inspection of tracklets to selected region - tofAnaTestbeam->SetDutDY( - 15.); // limit inspection of tracklets to selected region - tofAnaTestbeam->SetSIGLIM(3.); // max matching chi2 - tofAnaTestbeam->SetSIGT(0.08); // in ns - tofAnaTestbeam->SetSIGX(0.3); // in cm - tofAnaTestbeam->SetSIGY(0.6); // in cm - - Int_t iRSel = 500; - Int_t iRSelTyp = 5; - Int_t iRSelSm = 0; - Int_t iRSelRpc = 0; - Int_t iRSelin = iRSel; - - tofAnaTestbeam->SetBeamRefSmType(iRSelTyp); // common reaction reference - tofAnaTestbeam->SetBeamRefSmId(iRSelSm); - tofAnaTestbeam->SetBeamRefRpc(iRSelRpc); - - if (iSel2 >= 0) { - tofAnaTestbeam->SetMrpcSel2( - iSel2); // initialization of second selector Mrpc Type - tofAnaTestbeam->SetMrpcSel2Sm( - iSel2Sm); // initialization of second selector Mrpc SmId - tofAnaTestbeam->SetMrpcSel2Rpc( - iSel2Rpc); // initialization of second selector Mrpc RpcId - } - - tofAnaTestbeam->SetDut(iDut); // Device under test - tofAnaTestbeam->SetDutSm(iDutSm); // Device under test - tofAnaTestbeam->SetDutRpc(iDutRpc); // Device under test - tofAnaTestbeam->SetMrpcRef(iRef); // Reference RPC - tofAnaTestbeam->SetMrpcRefSm(iRefSm); // Reference RPC - tofAnaTestbeam->SetMrpcRefRpc(iRefRpc); // Reference RPC + break; - cout << "dispatch iSel = " << iSel << ", iSel2in = " << iSel2in - << ", iRSelin = " << iRSelin << ", iRSel = " << iRSel << endl; - if (1) { - switch (iSel) { + case 4: + iMinNofHits = 3; + iNStations = 4; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 1); + tofFindTracks->SetStation(2, 0, 3, 1); + tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); + break; - case 10: - switch (iRSelin) { - case 500: - tofAnaTestbeam->SetTShift(2.5); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value - switch (iSel2in) { - case 20: - tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 - break; - default:; - } - break; - default:; - } + case 5: // for calibration of 2-stack and add-on counters (STAR2, BUC) + iMinNofHits = 3; + iNStations = 5; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 1); + tofFindTracks->SetStation(2, 0, 3, 1); + tofFindTracks->SetStation(3, 9, 0, 0); + tofFindTracks->SetStation(4, 9, 0, 1); break; - case 700040: - case 900040: - case 901040: - switch (iRSelin) { - case 500: - tofAnaTestbeam->SetTShift(0.3); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value - - switch (iSel2in) { - case 30: - tofAnaTestbeam->SetSel2TOff(-0.3); // Shift Sel2 time peak to 0 - break; - case 31: - tofAnaTestbeam->SetSel2TOff( - -0.41); // Shift Sel2 time peak to 0 - break; - - default:; - } - break; - default:; - } + case 6: + iMinNofHits = 3; + iNStations = 4; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 1); + tofFindTracks->SetStation(2, 0, 3, 1); + tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); + // tofFindTracks->SetStation(3, 9, 0, 0); + // tofFindTracks->SetStation(3, 9, 0, 1); + // tofFindTracks->SetStation(3, 7, 0, 0); break; - case 700041: - case 900041: - case 901041: - switch (iRSelin) { - case 500: - tofAnaTestbeam->SetTShift(5.3); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value - - switch (iSel2in) { - case 30: - tofAnaTestbeam->SetSel2TOff(-0.3); // Shift Sel2 time peak to 0 - break; - case 31: - tofAnaTestbeam->SetSel2TOff( - -0.41); // Shift Sel2 time peak to 0 - break; - - default:; - } - break; - default:; - } + case 7: // for calibration of 2-stack and add-on counters (BUC) + iMinNofHits = 4; + iNStations = 5; + iNReqStations = 5; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 3); + tofFindTracks->SetStation(2, 0, 3, 3); + tofFindTracks->SetStation(3, 6, 0, 0); + tofFindTracks->SetStation(4, 6, 0, 1); break; - case 600043: - case 601043: - switch (iRSelin) { - case 500: - tofAnaTestbeam->SetTShift(5.3); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(11.); // Shift DTD4 to physical value - - switch (iSel2in) { - case 33: - tofAnaTestbeam->SetSel2TOff( - -0.55); // Shift Sel2 time peak to 0 - break; - - default:; - } - break; - default:; - } + case 8: // evaluation of add-on counters (BUC) + iMinNofHits = 3; + iNStations = 4; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 4, 3); + tofFindTracks->SetStation(2, 0, 3, 3); + tofFindTracks->SetStation(3, iDut, iDutSm, iDutRpc); break; + case 10: + iMinNofHits = 3; + iNStations = 4; + iNReqStations = 4; + tofFindTracks->SetStation(0, 5, 0, 0); + tofFindTracks->SetStation(1, 0, 1, 2); + tofFindTracks->SetStation(2, 0, 0, 2); + tofFindTracks->SetStation(3, 0, 2, 2); + default: - cout << "Better to define analysis setup! Running with default offset " - "parameter... " + cout << "Tracking setup " << iTrackingSetup << " not implemented " << endl; - // return; - } // end of different subsets + return; + ; + } + tofFindTracks->SetMinNofHits(iMinNofHits); + tofFindTracks->SetNStations(iNStations); + tofFindTracks->SetNReqStations(iNReqStations); + tofFindTracks->PrintSetup(); + run->AddTask(tofFindTracks); + + // ========================================================================= + // === Analysis === + // ========================================================================= + CbmTofAnaTestbeam* tofAnaTestbeam = + new CbmTofAnaTestbeam("TOF TestBeam Analysis", iVerbose); + tofAnaTestbeam->SetCorMode(iAnaCor); // 1 - DTD4, 2 - X4, 3 - Y4, 4 - Texp + tofAnaTestbeam->SetHitDistMin(30.); // initialization + tofAnaTestbeam->SetEnableMatchPosScaling(kTRUE); + tofAnaTestbeam->SetSpillDuration(4.); + //CbmTofAnaTestbeam defaults + tofAnaTestbeam->SetDXMean(0.); + tofAnaTestbeam->SetDYMean(0.); + tofAnaTestbeam->SetDTMean(0.); // in ns + tofAnaTestbeam->SetDXWidth(0.5); + tofAnaTestbeam->SetDYWidth(1.0); + tofAnaTestbeam->SetDTWidth(0.1); // in ns + tofAnaTestbeam->SetCalParFileName(cAnaFile); + Double_t dScalFacA = 0.9; // dScalFac is used for tracking + tofAnaTestbeam->SetPosY4Sel( + 0.5 * dScalFacA); // Y Position selection in fraction of strip length + tofAnaTestbeam->SetDTDia(0.); // Time difference to additional diamond + tofAnaTestbeam->SetMul0Max(20); // Max Multiplicity in dut + tofAnaTestbeam->SetMul4Max(30); // Max Multiplicity in Ref - RPC + tofAnaTestbeam->SetMulDMax(3); // Max Multiplicity in Diamond / BeamRef + tofAnaTestbeam->SetTOffD4(14.); // initialization + tofAnaTestbeam->SetDTD4MAX( + 6.); // initialization of Max time difference Ref - BRef + + //tofAnaTestbeam->SetTShift(-28000.);// initialization + tofAnaTestbeam->SetPosYS2Sel( + 0.55); // Y Position selection in fraction of strip length + tofAnaTestbeam->SetChS2Sel(0.); // Center of channel selection window + tofAnaTestbeam->SetDChS2Sel(100.); // Width of channel selection window + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + tofAnaTestbeam->SetChi2Lim(5.); // initialization of Chi2 selection limit + tofAnaTestbeam->SetChi2Lim2( + 3.); // initialization of Chi2 selection limit for Mref-Sel2 pair + tofAnaTestbeam->SetDutDX( + 15.); // limit inspection of tracklets to selected region + tofAnaTestbeam->SetDutDY( + 15.); // limit inspection of tracklets to selected region + tofAnaTestbeam->SetSIGLIM(3.); // max matching chi2 + tofAnaTestbeam->SetSIGT(0.08); // in ns + tofAnaTestbeam->SetSIGX(0.3); // in cm + tofAnaTestbeam->SetSIGY(0.6); // in cm + + Int_t iRSel = 500; + Int_t iRSelTyp = 5; + Int_t iRSelSm = 0; + Int_t iRSelRpc = 0; + Int_t iRSelin = iRSel; + + tofAnaTestbeam->SetBeamRefSmType(iRSelTyp); // common reaction reference + tofAnaTestbeam->SetBeamRefSmId(iRSelSm); + tofAnaTestbeam->SetBeamRefRpc(iRSelRpc); + + if (iSel2 >= 0) { + tofAnaTestbeam->SetMrpcSel2( + iSel2); // initialization of second selector Mrpc Type + tofAnaTestbeam->SetMrpcSel2Sm( + iSel2Sm); // initialization of second selector Mrpc SmId + tofAnaTestbeam->SetMrpcSel2Rpc( + iSel2Rpc); // initialization of second selector Mrpc RpcId + } - cout << " Initialize TSHIFT to " << tofAnaTestbeam->GetTShift() << endl; - //run->AddTask(tofAnaTestbeam); - } + tofAnaTestbeam->SetDut(iDut); // Device under test + tofAnaTestbeam->SetDutSm(iDutSm); // Device under test + tofAnaTestbeam->SetDutRpc(iDutRpc); // Device under test + tofAnaTestbeam->SetMrpcRef(iRef); // Reference RPC + tofAnaTestbeam->SetMrpcRefSm(iRefSm); // Reference RPC + tofAnaTestbeam->SetMrpcRefRpc(iRefRpc); // Reference RPC + + cout << "dispatch iSel = " << iSel << ", iSel2in = " << iSel2in + << ", iRSelin = " << iRSelin << ", iRSel = " << iRSel << endl; + if (1) { + switch (iSel) { + + case 10: + switch (iRSelin) { + case 500: + tofAnaTestbeam->SetTShift(2.5); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value + switch (iSel2in) { + case 20: + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + break; + default:; + } + break; + default:; + } + break; + + case 700040: + case 900040: + case 901040: + switch (iRSelin) { + case 500: + tofAnaTestbeam->SetTShift(0.3); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value + + switch (iSel2in) { + case 30: + tofAnaTestbeam->SetSel2TOff( + -0.3); // Shift Sel2 time peak to 0 + break; + case 31: + tofAnaTestbeam->SetSel2TOff( + -0.41); // Shift Sel2 time peak to 0 + break; + + default:; + } + break; + default:; + } + break; + + case 700041: + case 900041: + case 901041: + switch (iRSelin) { + case 500: + tofAnaTestbeam->SetTShift(5.3); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(18.); // Shift DTD4 to physical value + + switch (iSel2in) { + case 30: + tofAnaTestbeam->SetSel2TOff( + -0.3); // Shift Sel2 time peak to 0 + break; + case 31: + tofAnaTestbeam->SetSel2TOff( + -0.41); // Shift Sel2 time peak to 0 + break; + + default:; + } + break; + default:; + } + break; + + case 600043: + case 601043: + switch (iRSelin) { + case 500: + tofAnaTestbeam->SetTShift(5.3); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(11.); // Shift DTD4 to physical value + + switch (iSel2in) { + case 33: + tofAnaTestbeam->SetSel2TOff( + -0.55); // Shift Sel2 time peak to 0 + break; + + default:; + } + break; + default:; + } + break; + + default: + cout + << "Better to define analysis setup! Running with default offset " + "parameter... " + << endl; + // return; + } // end of different subsets + + cout << " Initialize TSHIFT to " << tofAnaTestbeam->GetTShift() << endl; + //run->AddTask(tofAnaTestbeam); + } - // ----- Parameter database -------------------------------------------- - FairRuntimeDb* rtdb = run->GetRuntimeDb(); - Bool_t kParameterMerged = kTRUE; - FairParRootFileIo* parIo2 = new FairParRootFileIo(kParameterMerged); - parIo2->open(ParFile.Data(), "UPDATE"); - parIo2->print(); - rtdb->setFirstInput(parIo2); - - FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); - parIo1->open(parFileList, "in"); - parIo1->print(); - rtdb->setSecondInput(parIo1); - rtdb->print(); - rtdb->printParamContexts(); - - // FairParRootFileIo* parInput1 = new FairParRootFileIo(); - // parInput1->open(ParFile.Data()); - // rtdb->setFirstInput(parInput1); - - FairEventManager* fMan = new FairEventManager(); - - CbmEvDisTracks* Tracks = new CbmEvDisTracks( - "Tof Tracks", - 1, - kFALSE, - kTRUE); //name, verbosity, RnrChildren points, RnrChildren track - // CbmEvDisTracks *Tracks = new CbmEvDisTracks("Tof Tracks",1); - fMan->AddTask(Tracks); - CbmPixelHitSetDraw* TofUHits = - new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); - fMan->AddTask(TofUHits); - CbmPointSetArrayDraw* TofHits = new CbmPointSetArrayDraw( - "TofHit", - 1, - 1, - 1, - kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren - // CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare); - fMan->AddTask(TofHits); - - TGeoVolume* top = gGeoManager->GetTopVolume(); - gGeoManager->SetVisOption(1); - gGeoManager->SetVisLevel(5); - TObjArray* allvolumes = gGeoManager->GetListOfVolumes(); - //cout<<"GeoVolumes " << gGeoManager->GetListOfVolumes()->GetEntries()<<endl; - for (Int_t i = 0; i < allvolumes->GetEntries(); i++) { - TGeoVolume* vol = (TGeoVolume*) allvolumes->At(i); - //TString name = vol->GetName(); - //cout << " GeoVolume "<<i<<" Name: "<< name << endl; - vol->SetLineColor(kRed); - vol->SetTransparency(80); - } - fMan->Init(1, 5); - - cout << "customize TEveManager gEve " << gEve << endl; - gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); - TGLViewer* v = gEve->GetDefaultGLViewer(); - TGLAnnotation* ann = new TGLAnnotation(v, cFileId, 0.01, 0.98); - ann->SetTextSize(0.03); // % of window diagonal - ann->SetTextColor(4); - - { // from readCurrentCamera(const char* fname) - TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); - const char* fname = "Cam.sav"; - TFile* f = TFile::Open(fname, "READ"); - if (!f) return; - if (f->GetKey(c.ClassName())) { - f->GetKey(c.ClassName())->Read(&c); - c.IncTimeStamp(); - gEve->GetDefaultGLViewer()->RequestDraw(); + // ----- Parameter database -------------------------------------------- + FairRuntimeDb* rtdb = run->GetRuntimeDb(); + Bool_t kParameterMerged = kTRUE; + FairParRootFileIo* parIo2 = new FairParRootFileIo(kParameterMerged); + parIo2->open(ParFile.Data(), "UPDATE"); + parIo2->print(); + rtdb->setFirstInput(parIo2); + + FairParAsciiFileIo* parIo1 = new FairParAsciiFileIo(); + parIo1->open(parFileList, "in"); + parIo1->print(); + rtdb->setSecondInput(parIo1); + rtdb->print(); + rtdb->printParamContexts(); + + // FairParRootFileIo* parInput1 = new FairParRootFileIo(); + // parInput1->open(ParFile.Data()); + // rtdb->setFirstInput(parInput1); + + FairEventManager* fMan = new FairEventManager(); + + CbmEvDisTracks* Tracks = new CbmEvDisTracks( + "Tof Tracks", + 1, + kFALSE, + kTRUE); //name, verbosity, RnrChildren points, RnrChildren track + // CbmEvDisTracks *Tracks = new CbmEvDisTracks("Tof Tracks",1); + fMan->AddTask(Tracks); + CbmPixelHitSetDraw* TofUHits = + new CbmPixelHitSetDraw("TofUHit", kRed, kOpenCross); + fMan->AddTask(TofUHits); + CbmPointSetArrayDraw* TofHits = new CbmPointSetArrayDraw( + "TofHit", + 1, + 1, + 1, + kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren + // CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare); + fMan->AddTask(TofHits); + + TGeoVolume* top = gGeoManager->GetTopVolume(); + gGeoManager->SetVisOption(1); + gGeoManager->SetVisLevel(5); + TObjArray* allvolumes = gGeoManager->GetListOfVolumes(); + //cout<<"GeoVolumes " << gGeoManager->GetListOfVolumes()->GetEntries()<<endl; + for (Int_t i = 0; i < allvolumes->GetEntries(); i++) { + TGeoVolume* vol = (TGeoVolume*) allvolumes->At(i); + //TString name = vol->GetName(); + //cout << " GeoVolume "<<i<<" Name: "<< name << endl; + vol->SetLineColor(kRed); + vol->SetTransparency(80); + } + fMan->Init(1, 5); + + cout << "customize TEveManager gEve " << gEve << endl; + gEve->GetDefaultGLViewer()->SetClearColor(kYellow - 10); + TGLViewer* v = gEve->GetDefaultGLViewer(); + TGLAnnotation* ann = new TGLAnnotation(v, cFileId, 0.01, 0.98); + ann->SetTextSize(0.03); // % of window diagonal + ann->SetTextColor(4); + + { // from readCurrentCamera(const char* fname) + TGLCamera& c = gEve->GetDefaultGLViewer()->CurrentCamera(); + const char* fname = "Cam.sav"; + TFile* f = TFile::Open(fname, "READ"); + if (!f) return; + if (f->GetKey(c.ClassName())) { + f->GetKey(c.ClassName())->Read(&c); + c.IncTimeStamp(); + gEve->GetDefaultGLViewer()->RequestDraw(); + } } } } diff --git a/macro/beamtime/mcbm2020/init_cal_all.sh b/macro/beamtime/mcbm2020/init_cal_all.sh index 98d3e62adb7f9d2abad41e4888c0a61531df2d01..9a35d9d9fca15729a681e5f0a73d3a513630eeca 100755 --- a/macro/beamtime/mcbm2020/init_cal_all.sh +++ b/macro/beamtime/mcbm2020/init_cal_all.sh @@ -2,9 +2,10 @@ # shell script to initialize clusterizer calibrations #SBATCH -J calall #SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020 -#SBATCH --time=6-00:00:00 +#SBATCH --time=8:00:00 +##SBATCH --time=6-00:00:00 #SBATCH --mem=2000 -#SBATCH --partition=long +##SBATCH --partition=long cRun=$1 echo 'Initialize clusterizer calibration for run '$cRun diff --git a/macro/beamtime/mcbm2020/iter_tracks.sh b/macro/beamtime/mcbm2020/iter_tracks.sh index dba5ba6a9c26c1c2d0929753d9b3a105060ffcf9..9e977be72b2479fbe0ea38fb4c7113efa490a3ad 100755 --- a/macro/beamtime/mcbm2020/iter_tracks.sh +++ b/macro/beamtime/mcbm2020/iter_tracks.sh @@ -2,9 +2,10 @@ # shell script to iterate tracklet calibration histograms #SBATCH -J track #SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020 -#SBATCH --time=6-00:00:00 +#SBATCH --time=8:00:00 +##SBATCH --time=6-00:00:00 #SBATCH --mem=4000 -#SBATCH --partition=long +##SBATCH --partition=long X=$((${SLURM_ARRAY_TASK_ID} - 0)) XXX=$(printf "%03d" "$X") diff --git a/macro/beamtime/mcbm2020/pl_all_Track2D.C b/macro/beamtime/mcbm2020/pl_all_Track2D.C index 14930756f7b4dcf575d3e4d9decc694db1a8c2ef..d926b0c6da7a7820d68ea0bc163734cd27c7bcff 100644 --- a/macro/beamtime/mcbm2020/pl_all_Track2D.C +++ b/macro/beamtime/mcbm2020/pl_all_Track2D.C @@ -23,63 +23,112 @@ void pl_all_Track2D(Int_t iOpt = 1, Int_t iNSt = 4) { TString cOpt; switch (iOpt) { - case 0: cOpt = "Size"; break; - case 1: cOpt = "Pos"; break; - case 2: cOpt = "TOff"; break; - case 3: cOpt = "Tot"; break; - case 4: cOpt = "AvWalk"; break; - case 5: cOpt = "AvLnWalk"; break; - case 6: cOpt = "Mul"; break; - case 7: cOpt = "Trms"; break; - case 8: cOpt = "DelPos"; break; - case 9: cOpt = "DelTOff"; break; - case 10: cOpt = "DelMatPos"; break; - case 11: cOpt = "DelMatTOff"; break; - default:; - } + case 0: + cOpt="Size"; + break; + case 1: + cOpt="Pos"; + break; + case 2: + cOpt="TOff"; + break; + case 3: + cOpt="Tot"; + break; + case 4: + cOpt="Walk"; + break; + case 5: + cOpt="Walk"; + break; + case 6: + cOpt="Mul"; + break; + case 7: + cOpt="Trms"; + break; + case 8: + cOpt="DelPos"; + break; + case 9: + cOpt="DelTOff"; + break; + case 10: + cOpt="DelMatPos"; + break; + case 11: + cOpt="DelMatTOff"; + break; + default: + ; + } - Int_t iDet = 0; - Double_t dAvMean = 0.; - Double_t dAvRMS = 0.; - Int_t iCanv = 0; + Int_t iDet=0; + Double_t dAvMean=0.; + Double_t dAvRMS=0.; + Int_t iCanv=0; - for (Int_t iSt = 0; iSt < iNSt; iSt++) { - // cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; - for (Int_t iSm = 0; iSm < iSmNum[iSt]; iSm++) { - //cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; - for (Int_t iRp = 0; iRp < iRpcNum[iSt]; iRp++) { - //cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; - can->cd(iCanv + 1); - iCanv++; - gROOT->cd(); - TString hname = Form( - "cal_SmT%01d_sm%03d_rpc%03d_%s", iType[iSt], iSm, iRp, cOpt.Data()); - h = (TH2*) gROOT->FindObjectAny(hname); - if (h != NULL) { - if (iOpt == 4 || iOpt == 5) { gPad->SetLogz(); } - h->Draw("colz"); - h->ProfileX()->Draw("same"); - iDet++; - dAvMean += h->ProfileX()->GetMean(2); - dAvRMS += h->ProfileX()->GetRMS(2); - cout << "TrackQA " << cOpt.Data() << " for TSR " << iType[iSt] << iSm - << iRp << ": Off " << h->ProfileX()->GetMean(2) << ", RMS " - << h->ProfileX()->GetRMS(2) << endl; - } else { - cout << "Histogram " << hname << " not existing. " << endl; - } - } - } + for(Int_t iSt=0; iSt<iNSt; iSt++){ + // cout << "plot station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; + for(Int_t iSm=0; iSm<iSmNum[iSt];iSm++){ + //cout << "plot module at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; + for(Int_t iRp=0; iRp<iRpcNum[iSt];iRp++){ + //cout << "plot rpc at station "<<iSt<<" with "<< iSmNum[iSt] <<" modules of "<<iRpcNum[iSt]<<" Rpcs each"<<endl; + can->cd(iCanv+1); iCanv++; + gROOT->cd(); + TString hname=""; + Int_t iCol=1; + switch(iOpt) { + case 4: + for (Int_t iSide=0; iSide<2; iSide++) + for (Int_t iCh=0; iCh<32; iCh++) { + hname=Form("cal_SmT%01d_sm%03d_rpc%03d_Ch%03d_S%d_%s",iType[iSt],iSm,iRp,iCh,iSide,cOpt.Data()); + h=(TH2 *)gROOT->FindObjectAny(hname); + if (h!=NULL) { + TProfile *hProf=h->ProfileX(Form("%s_pfx%d%d",hname.Data(),iCh,iSide)); + hProf->SetLineColor(iCol); + hProf->SetLineStyle(1); + hProf->SetMarkerColor(iCol); + hProf->SetMarkerStyle(24+iSide); + iCol++; + if(iCh==0) iCol=1; + if(iCh==0 && iSide==0) { + hProf->SetMaximum(0.4); + hProf->SetMinimum(-0.4); + hProf->GetXaxis()->SetRangeUser(0.,10.); + hProf->Draw("LP"); + } else { + hProf->Draw("LPsame"); + } + } + + } + break; + default: + hname=Form("cal_SmT%01d_sm%03d_rpc%03d_%s",iType[iSt],iSm,iRp,cOpt.Data()); + h=(TH2 *)gROOT->FindObjectAny(hname); + if (h!=NULL) { + if (iOpt == 2 || iOpt==2 ) { + gPad->SetLogz(); + } + h->Draw("colz"); + h->ProfileX()->Draw("same"); + iDet++; + dAvMean += h->ProfileX()->GetMean(2); + dAvRMS += h->ProfileX()->GetRMS(2); + cout << "TrackQA " << cOpt.Data() <<" for TSR " << iType[iSt] << iSm << iRp << ": Off "<< h->ProfileX()->GetMean(2) + << ", RMS "<< h->ProfileX()->GetRMS(2) << endl; + } + } + } } - dAvMean /= (Double_t) iDet; - dAvRMS /= (Double_t) iDet; - cout << "TrackQA " << cOpt.Data() << ": AvOff " << dAvMean << ", AvRMS " - << dAvRMS << endl; - dAvMean = TMath::Abs(dAvMean); - gROOT->ProcessLine( - Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean * 1.E4), cOpt.Data())); - gROOT->ProcessLine( - Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS * 1.E4), cOpt.Data())); + } + dAvMean /= (Double_t)iDet; + dAvRMS /= (Double_t)iDet; + cout << "TrackQA " << cOpt.Data() <<": AvOff "<< dAvMean << ", AvRMS "<< dAvRMS << endl; + dAvMean=TMath::Abs(dAvMean); + gROOT->ProcessLine(Form(".! echo %d > %sAvOff.res", (Int_t)(dAvMean*1.E4),cOpt.Data())); + gROOT->ProcessLine(Form(".! echo %d > %sAvRMS.res", (Int_t)(dAvRMS*1.E4),cOpt.Data())); - can->SaveAs(Form("pl_all_Track_%s.pdf", cOpt.Data())); + can->SaveAs(Form("pl_all_Track_%s.pdf",cOpt.Data())); } diff --git a/macro/beamtime/mcbm2020/trk_cal_digi.sh b/macro/beamtime/mcbm2020/trk_cal_digi.sh index 56240b1c0cebb7b4d7ea42d333f91e44dd5fef2b..9bdfe4682571dbdad45338dfac6bb766aa3ef458 100755 --- a/macro/beamtime/mcbm2020/trk_cal_digi.sh +++ b/macro/beamtime/mcbm2020/trk_cal_digi.sh @@ -2,9 +2,10 @@ # shell script to apply clusterizer calibrations #SBATCH -J trk_cal_digi #SBATCH -D /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020 -#SBATCH --time=5-24:00:00 +#SBATCH --time=8:00:00 +##SBATCH --time=5-24:00:00 #SBATCH --mem=4000 -#SBATCH --partition=long +##SBATCH --partition=long cRun=$1 iCalSet=$2 @@ -64,7 +65,12 @@ if [[ ${iCalOpt} = "" ]]; then iCalOpt=1 fi -CalIdSet=$7 +iTraSetup=$7 +if [[ $iTraSetup = "" ]]; then + iTraSetup=1 +fi + +CalIdSet=$8 if [[ ${CalIdSet} = "" ]]; then echo use native calibration file CalIdSet=$cCalSet @@ -73,9 +79,13 @@ else fi - echo trk_cal_digi for $cRun with iDut=$iDut, iRef=$iRef, iSet=$iCalSet, iSel2=$iSel2, iBRef=$iBRef, Deadtime=$Deadtime, CalFile=$CalFile +if [[ $iShLev = "" ]]; then + iShLev=0 +fi +echo execute trk_cal_digi at shell level $iShLev + if [ -e /lustre/cbm ]; then source /lustre/cbm/users/nh/CBM/cbmroot/trunk/build/config.sh wdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020 @@ -95,22 +105,26 @@ mkdir $cRun cd $cRun cp ../.rootrc . cp ../rootlogon.C . + +echo Execute in `pwd`: ./trk_cal_digi.sh $1 $2 $3 $4 $5 $6 $7 $8 + # get initial digi calibration - cp -v ./I*/${CalFile} . +#cp -v ./I*/${CalFile} . + # get latest tracker offsets # cp -v ../${cRun}_tofFindTracks.hst.root . rm -v TCalib.res nEvtMax=0 (( nEvtMax = nEvt*10 )) -iTraSetup=1 + #frange1 limits DT spectrum range -fRange1=3. +fRange1=2. # frange2 limits chi2 fRange2=5.0 -TRange2Limit=2.5 +TRange2Limit=3. -iSel=10 +iSel=911921 iGenCor=3 cCalSet2=${cCalSet}_$cSel2 @@ -135,22 +149,41 @@ while [[ $dDTres > 0 ]]; do if [[ $compare_TRange2 > 0 ]]; then fRange2=$TRange2Limit fi - - root -b -q '../ana_digi_cal.C('$nEvt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") ' - - root -b -q '../ana_trks.C('$nEvt','$iSel','$iGenCor',"'$cRun'","'$cCalSet2'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$Deadtime',"'$CalIdMode'",1,1,'$iCalSet','$iCalOpt')' - #root -l 'ana_trksi.C(-1,10,1,"385.50.5.0","000014500_020",20,1,1.90,7.60,50,"385.50.5.0",1,1)' - -# iTres=`cat TCalib.res` -# if [[ $iTres = 0 ]]; then -# echo All tracks lost, stop at iter = $iter -# return -# fi - -# ((TRMSres=$iTres%1000)) -# ((iTres -= TRMSres )) -# ((Tres = iTres / 1000)) - + + cd $wdir/$cRun + iCalAct=$iCalOpt + echo Enter while loop with $iCalAct in dir `pwd` + while [[ $iCalAct > 0 ]]; do + if [[ $iCalOpt = 1 ]] || [[ $iCalAct > 1 ]]; then + root -b -q '../ana_digi_cal.C('$nEvt',93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") ' + # update calibration parameter file, will only be active in next iteration + # cp -v tofClust_${cRun}_set${cCalSet}.hst.root ../${cRun}_set${cCalSet}_93_1tofClust.hst.root + + root -b -q '../ana_trks.C('$nEvt','$iSel','$iGenCor',"'$cRun'","'$cCalSet2'",'$iSel2','$iTraSetup','$fRange1','$fRange2','$Deadtime',"'$CalIdMode'",1,1,'$iCalSet','$iCalAct')' + #root -l 'ana_trksi.C(-1,10,1,"385.50.5.0","000014500_020",20,1,1.90,7.60,50,"385.50.5.0",1,1)' + + cp -v New_${CalFile} ${CalFile} + + else + cd $wdir + # store current status + dLDTres=$dDTres + dLDTRMSres=$dDTRMSres + echo Store limits $dLDTres, $dLDTRMSres + echo exec in `pwd`: trk_cal_digi.sh $1 $2 $3 $4 $5 1 $7 + (( iShLev += 1 )) + ./trk_cal_digi.sh $1 $2 $3 $4 $5 1 $7 + (( iShLev -= 1 )) + # restore old status + dDTres=$dLDTres + dDTRMSres=$dLDTRMSres + echo exec1done, resume with old status $dDTres, $dDTRMSres + fi + (( iCalAct -= 1 )) + echo Continue while loop with $iCalAct + done + + cd $wdir/$cRun Tres=`cat TOffAvOff.res` TRMSres=`cat TOffAvRMS.res` @@ -166,7 +199,11 @@ while [[ $dDTres > 0 ]]; do echo at iter=$iter got TOff = $Tres, compare to $dDTres, dTdif = $dTdif, result = $compare_result, TRMS = $TRMSres, old $dDTRMSres, dif = $dTRMSdif, result = $compare_RMS ((compare_result += $compare_RMS)) - echo result_summary: $compare_result + echo CMPR result_summary: $compare_result + +# if [ $iter = 1 ]; then +# exit 0 # for debugging +# fi if [[ $compare_result > 0 ]]; then if [[ $Tres = 0 ]]; then @@ -174,7 +211,7 @@ while [[ $dDTres > 0 ]]; do fi dDTres=$Tres dDTRMSres=$TRMSres - (( dDTRMSres -= 10 )) # next attempt should be at least 10ps better for continuation + (( dDTRMSres -= 1 )) # next attempt should be at least 1ps better for continuation cp -v New_${CalFile} ${CalFile} cp -v New_${CalFile} ${CalFile}_$iter else @@ -183,9 +220,12 @@ while [[ $dDTres > 0 ]]; do (( iter += 1 )) done +cd $wdir/$cRun # generate full statistics digi file root -b -q '../ana_digi_cal.C(-1,93,1,'$iRef',1,"'$cRun'",'$iCalSet',1,'$iSel2','$Deadtime',"'$CalIdMode'") ' -cd .. +cd $wdir -mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/TrkCalDigi_${cRun}_${iCalSet}_${iSel2}_${iCalIdMode}.out +if [[ $iShLev = 0 ]]; then + mv -v slurm-${SLURM_JOB_ID}.out ${outdir}/TrkCalDigi_${cRun}_${iCalSet}_${iSel2}_${iCalIdMode}.out +fi diff --git a/macro/beamtime/pl_vert_trk.C b/macro/beamtime/pl_vert_trk.C index fb8685d76441a372c290e2e769bd8571d28ec278..d6af4fa7496ca837fd309c9a5aed3f11f551241b 100644 --- a/macro/beamtime/pl_vert_trk.C +++ b/macro/beamtime/pl_vert_trk.C @@ -114,4 +114,6 @@ void pl_vert_trk() { } else { cout << hname << " not found" << endl; } + can->SaveAs(Form("pl_vtx.pdf")); + }