diff --git a/macro/beamtime/hd2020/ana_trks.C b/macro/beamtime/hd2020/ana_trks.C index e9499edd6a0bc808af9b26dc4390bc5a18d0560e..de66018ecc080dd381402a99f5428a6c83dcd67c 100644 --- a/macro/beamtime/hd2020/ana_trks.C +++ b/macro/beamtime/hd2020/ana_trks.C @@ -11,7 +11,7 @@ void ana_trks(Int_t nEvents = 10000, TString cCalId = "", Int_t iAnaCor = 1, Bool_t bUseSigCalib = kFALSE, - Int_t iCalSet = 900920910, + Int_t iCalSet = 900920910, Int_t iCalOpt = 1, Int_t iMc = 0) { Int_t iVerbose = 1; @@ -42,16 +42,16 @@ void ana_trks(Int_t nEvents = 10000, TString cHstFile = paramDir + Form( - "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", - cFileId.Data(), - dDeadtime, - cSet.Data(), - iSel, - iSel2, - dScalFac, - dChi2Lim2, - iTrackingSetup, - cCalId.Data()); + "/hst/%s_%03.0f_%s_%06d_%03d_%03.1f_%03.1f_trk%03d_Cal%s_Ana.hst.root", + cFileId.Data(), + dDeadtime, + cSet.Data(), + iSel, + iSel2, + dScalFac, + dChi2Lim2, + iTrackingSetup, + cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data()); @@ -216,7 +216,7 @@ void ana_trks(Int_t nEvents = 10000, //tofFindTracks->SetStation(8, 6, 1, 0); //tofFindTracks->SetStation(9, 6, 1, 1); break; - + case 11: // for calibration mode of full setup iMinNofHits = 3; iNStations = 6; @@ -227,7 +227,7 @@ void ana_trks(Int_t nEvents = 10000, tofFindTracks->SetStation(3, 9, 0, 1); tofFindTracks->SetStation(4, 6, 0, 0); tofFindTracks->SetStation(5, 6, 0, 1); - break; + break; case 2: iMinNofHits = 6; @@ -618,7 +618,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/hd2020/dis_digi.C b/macro/beamtime/hd2020/dis_digi.C index d77c67cc67e0b126b46ba18e4481afe2fefcc787..c70f557b9c09dc59a251ba8b37b4af1df86b3c00 100644 --- a/macro/beamtime/hd2020/dis_digi.C +++ b/macro/beamtime/hd2020/dis_digi.C @@ -1,19 +1,7 @@ -void dis_digi(Int_t nEvents = 100, - Int_t calMode = 93, - Int_t calSel = 1, - Int_t calSm = 0, - Int_t RefSel = 1, - TString cFileId = "68.50.7.1", - Int_t iCalSet = 10500, - Bool_t bOut = 0, - Int_t iSel2 = 20, - Double_t dDeadtime = 50, - Int_t iGenCor = 1, - Int_t iTrackingSetup = 1, - Double_t dScalFac = 5., - Double_t dChi2Lim2 = 10., - TString cCalId = "XXX", - Bool_t bUseSigCalib = kFALSE) { +void dis_digi(Int_t nEvents = 100, Int_t calMode=93, Int_t calSel=1, Int_t calSm=0, Int_t RefSel=1, +TString cFileId="68.50.7.1", Int_t iCalSet=10500, Bool_t bOut=0, Int_t iSel2=20, Double_t dDeadtime=50, +Int_t iGenCor=1, Int_t iTrackingSetup=1, Double_t dScalFac=5., Double_t dChi2Lim2=10., TString cCalId="XXX", Bool_t bUseSigCalib=kFALSE) +{ Int_t iVerbose = 1; //Specify log level (INFO, DEBUG, DEBUG1, ...) //TString logLevel = "FATAL"; @@ -26,370 +14,351 @@ void dis_digi(Int_t nEvents = 100, FairLogger::GetLogger(); gLogger->SetLogScreenLevel(logLevel); gLogger->SetLogVerbosityLevel("MEDIUM"); - - TString workDir = gSystem->Getenv("VMCWORKDIR"); + + TString workDir = gSystem->Getenv("VMCWORKDIR"); /* TString workDir = (TString)gInterpreter->ProcessLine(".! pwd"); cout << "workdir = "<< workDir.Data() << endl; return; */ - TString paramDir = workDir + "/macro/beamtime/hd2020/"; - TString ParFile = paramDir + "data/" + cFileId + ".params.root"; - TString InputFile = paramDir + "data/" + cFileId + ".root"; - TString OutputFile = paramDir + "data/disdigi_" + cFileId - + Form("_%09d%03d", iCalSet, iSel2) + ".out.root"; - - TString cTrkFile = Form("%s_tofFindTracks.hst.root", cFileId.Data()); - - TList* parFileList = new TList(); - - TString FId = cFileId; - //TString TofGeo="v18o_cosmicHD"; - TString TofGeo = "v20b_cosmicHD"; // for Buc2020 sandwiched - cout << "Geometry version " << TofGeo << endl; - - TObjString* tofDigiFile = new TObjString( - workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file - parFileList->Add(tofDigiFile); - - // TObjString tofDigiBdfFile = new TObjString( paramDir + "/tof." + FPar + "digibdf.par"); - 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; - } - - if (0) { - TGeoVolume* master = geoMan->GetTopVolume(); - master->SetVisContainers(1); - master->Draw("ogl"); - } + TString paramDir = workDir + "/macro/beamtime/hd2020/"; + TString ParFile = paramDir + "data/" + cFileId + ".params.root"; + TString InputFile = paramDir + "data/" + cFileId + ".root"; + TString OutputFile = paramDir + "data/disdigi_" + cFileId + Form("_%09d%03d",iCalSet,iSel2) + ".out.root"; + + TString cTrkFile=Form("%s_tofFindTracks.hst.root",cFileId.Data()); + + TList *parFileList = new TList(); + + TString FId=cFileId; + //TString TofGeo="v18o_cosmicHD"; + TString TofGeo="v20b_cosmicHD"; // for Buc2020 sandwiched + cout << "Geometry version "<<TofGeo<<endl; + + TObjString *tofDigiFile = new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file + parFileList->Add(tofDigiFile); + + // TObjString tofDigiBdfFile = new TObjString( paramDir + "/tof." + FPar + "digibdf.par"); + 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; + } + + if(0){ + TGeoVolume* master=geoMan->GetTopVolume(); + master->SetVisContainers(1); + master->Draw("ogl"); + } // ----- Reconstruction run ------------------------------------------- - FairRunAna* run = new FairRunAna(); + FairRunAna *run= new FairRunAna(); run->SetInputFile(InputFile.Data()); //run->SetOutputFile(OutputFile); - run->SetUserOutputFileName(OutputFile.Data()); - run->SetSink(new FairRootFileSink(run->GetUserOutputFileName())); - - CbmTofEventClusterizer* tofClust = - new CbmTofEventClusterizer("TOF Event Clusterizer", iVerbose, bOut); - - tofClust->SetCalMode(calMode); - tofClust->SetCalSel(calSel); - tofClust->SetCaldXdYMax(50.); // geometrical matching window in cm - tofClust->SetCalCluMulMax( - 4.); // Max Counter Cluster Multiplicity for filling calib histos - tofClust->SetCalRpc(calSm); // select detector for calibration update - tofClust->SetTRefId(RefSel); // reference trigger for offset calculation - tofClust->SetTotMax(20.); // Tot upper limit for walk corection - tofClust->SetTotMin( - 0.01); //(12000.); // Tot lower limit for walk correction - tofClust->SetTotPreRange( - 2.); // effective lower Tot limit in ns from peak position - tofClust->SetTotMean(2.); // Tot calibration target value in ns - tofClust->SetMaxTimeDist(1.0); // default cluster range in ns - //tofClust->SetMaxTimeDist(0.); //Deb// default cluster range in ns - tofClust->SetDelTofMax( - 60.); // acceptance range for cluster correlation in cm (!) - tofClust->SetSel2MulMax(4); // limit Multiplicity in 2nd selector - tofClust->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns - tofClust->SetEnableAvWalk(kTRUE); - tofClust->SetYFitMin(1.E4); - //tofClust->SetTimePeriod(6.25); // ignore coarse time - //tofClust->SetCorMode(2); // correct missing hits - - Int_t calSelRead = calSel; - if (calSel < 0) calSelRead = 0; - TString cFname = Form("%s_set%09d_%02d_%01dtofClust.hst.root", - cFileId.Data(), - iCalSet, - calMode, - calSelRead); - tofClust->SetCalParFileName(cFname); - TString cOutFname = - Form("tofClust_%s_set%09d.hst.root", cFileId.Data(), iCalSet); - tofClust->SetOutHstFileName(cOutFname); - - TString cAnaFile = - Form("%s_%09d%03d_tofAnaCosmic.hst.root", cFileId.Data(), iCalSet, iSel2); - - switch (calMode) { - case -1: // initial calibration - tofClust->SetTotMax(256.); // range in bin number - tofClust->SetTotPreRange(256.); - //tofClust->SetTotMin(1.); - tofClust->SetTRefDifMax(50000.); // in ns - tofClust->PosYMaxScal(10000.); // in % of length - tofClust->SetMaxTimeDist(0.); // no cluster building - //tofClust->SetTimePeriod(0.); // inspect coarse time - break; - case 0: // initial calibration - tofClust->SetTotMax(256.); // range in bin number - tofClust->SetTotPreRange(256.); - //tofClust->SetTotMin(1.); - tofClust->SetTRefDifMax(50.); // in ns - tofClust->PosYMaxScal(10.); // in % of length - tofClust->SetMaxTimeDist(0.); // no cluster building - //tofClust->SetTimePeriod(0.); // inspect coarse time - break; - case 1: // save offsets, update walks, for diamonds - tofClust->SetTotMax(256.); // range in bin number - tofClust->SetTotPreRange(256.); - tofClust->SetTRefDifMax(6.25); // in ns - //tofClust->SetTimePeriod(6.25); // inspect coarse time - tofClust->PosYMaxScal(10.); // in % of length - break; - case 11: - tofClust->SetTRefDifMax(5.); // in ns - tofClust->PosYMaxScal(3.0); // in % of length - break; - case 21: - tofClust->SetTRefDifMax(2.5); // in ns - tofClust->PosYMaxScal(2.0); // in % of length - break; - case 31: - tofClust->SetTRefDifMax(2.); // in ns - tofClust->PosYMaxScal(1.5); // in % of length - break; - case 41: - tofClust->SetTRefDifMax(1.); // in ns - tofClust->PosYMaxScal(0.8); // in % of length - break; - case 51: - tofClust->SetTRefDifMax(0.7); // in ns - tofClust->PosYMaxScal(0.7); // in % of length - break; - case 61: - tofClust->SetTRefDifMax(0.5); // in ns - tofClust->PosYMaxScal(0.7); // in % of length - break; - case 71: - tofClust->SetTRefDifMax(0.4); // in ns - tofClust->PosYMaxScal(0.6); // in % of length - break; - - case 2: // time difference calibration - tofClust->SetTRefDifMax(300.); // in ns - tofClust->PosYMaxScal(1000.); //in % of length - break; - - case 3: // time offsets - tofClust->SetTRefDifMax(200.); // in ns - tofClust->PosYMaxScal(100.); //in % of length - tofClust->SetMaxTimeDist(0.); // no cluster building - break; - case 12: - case 13: - tofClust->SetTRefDifMax(100.); // in ns - tofClust->PosYMaxScal(50.); //in % of length - break; - case 22: - case 23: - tofClust->SetTRefDifMax(50.); // in ns - tofClust->PosYMaxScal(20.); //in % of length - break; - case 32: - case 33: - tofClust->SetTRefDifMax(25.); // in ns - tofClust->PosYMaxScal(10.); //in % of length - break; - case 42: - case 43: - tofClust->SetTRefDifMax(12.); // in ns - tofClust->PosYMaxScal(5.); //in % of length - break; - case 52: - case 53: - tofClust->SetTRefDifMax(5.); // in ns - tofClust->PosYMaxScal(3.); //in % of length - break; - case 62: - case 63: - tofClust->SetTRefDifMax(3.); // in ns - tofClust->PosYMaxScal(2.); //in % of length - break; - case 72: - case 73: - tofClust->SetTRefDifMax(2.); // in ns - tofClust->PosYMaxScal(1.5); //in % of length - break; - case 82: - case 83: - tofClust->SetTRefDifMax(1.); // in ns - tofClust->PosYMaxScal(1.0); //in % of length - break; - case 92: - case 93: - tofClust->SetTRefDifMax(0.6); // in ns - tofClust->PosYMaxScal(1.0); //in % of length - break; - - case 4: // velocity dependence (DelTOF) - tofClust->SetTRefDifMax(6.); // in ns - tofClust->PosYMaxScal(1.5); //in % of length - break; - case 14: - tofClust->SetTRefDifMax(5.); // in ns - tofClust->PosYMaxScal(1.); //in % of length - break; - case 24: - tofClust->SetTRefDifMax(3.); // in ns - tofClust->PosYMaxScal(1.0); //in % of length - break; - case 34: - tofClust->SetTRefDifMax(2.); // in ns - tofClust->PosYMaxScal(1.0); //in % of length - break; - case 44: - tofClust->SetTRefDifMax(1.); // in ns - tofClust->PosYMaxScal(1.0); //in % of length - break; - case 54: - tofClust->SetTRefDifMax(0.7); // in ns - tofClust->PosYMaxScal(0.7); //in % of length - break; - case 64: - tofClust->SetTRefDifMax(0.5); // in ns - tofClust->PosYMaxScal(0.7); //in % of length - break; - default: - cout << "<E> Calib mode not implemented! stop execution of script" - << endl; - return; - } - run->AddTask(tofClust); - - Int_t iBRef = iCalSet % 1000; - Int_t iSet = (iCalSet - iBRef) / 1000; - Int_t iRSel = 0; - Int_t iRSelTyp = 0; - Int_t iRSelSm = 0; - Int_t iRSelRpc = 0; - iRSel = iBRef; // use diamond - if (iSel2 == 0) { - // iSel2=iBRef; - } else { - if (iSel2 < 0) iSel2 = -iSel2; - } - - Int_t iRSelin = iRSel; - iRSelRpc = iRSel % 10; - iRSelTyp = (iRSel - iRSelRpc) / 10; - iRSelSm = iRSelTyp % 10; - iRSelTyp = (iRSelTyp - iRSelSm) / 10; - - tofClust->SetBeamRefId(iRSelTyp); // define Beam reference counter - tofClust->SetBeamRefSm(iRSelSm); - tofClust->SetBeamRefDet(iRSelRpc); - tofClust->SetBeamAddRefMul(-1); - tofClust->SetBeamRefMulMax(3); - - Int_t iSel2in = iSel2; - Int_t iSel2Rpc = iSel2 % 10; - iSel2 = (iSel2 - iSel2Rpc) / 10; - Int_t iSel2Sm = iSel2 % 10; - iSel2 = (iSel2 - iSel2Sm) / 10; - if (iSel2 > 0) { - tofClust->SetSel2Id(iSel2); - tofClust->SetSel2Sm(iSel2Sm); - tofClust->SetSel2Rpc(iSel2Rpc); - } - - Int_t iRef = iSet % 1000; - Int_t iDut = (iSet - iRef) / 1000; - Int_t iDutRpc = iDut % 10; - iDut = (iDut - iDutRpc) / 10; - Int_t iDutSm = iDut % 10; - iDut = (iDut - iDutSm) / 10; - - tofClust->SetDutId(iDut); - tofClust->SetDutSm(iDutSm); - tofClust->SetDutRpc(iDutRpc); - - Int_t iRefRpc = iRef % 10; - iRef = (iRef - iRefRpc) / 10; - Int_t iRefSm = iRef % 10; - iRef = (iRef - iRefSm) / 10; - - tofClust->SetSelId(iRef); - tofClust->SetSelSm(iRefSm); - tofClust->SetSelRpc(iRefRpc); - - cout << "Run with iRSel = " << iRSel << ", iSel2 = " << iSel2in << endl; - - // ========================================================================= - // === Tracking === - // ========================================================================= - CbmStsDigitize* stsDigitize = new CbmStsDigitize(); //necessary for kalman !! - CbmKF* kalman = new CbmKF(); - - CbmTofTrackFinder* tofTrackFinder = new CbmTofTrackFinderNN(); - tofTrackFinder->SetMaxTofTimeDifference(5.); // in ns/cm - tofTrackFinder->SetTxLIM(1.6); // max slope dx/dz - tofTrackFinder->SetTyLIM(1.6); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz - tofTrackFinder->SetMaxTofTimeDifference(1.); // in ns/cm - - 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->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - 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->SetBeamCounter(9,0,1); - //tofFindTracks->SetBeamCounter(1,1,1); - - 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.1); // 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, 9, 0, 0); // Diamond - break; - case 1: // for calibration mode of full setup - iMinNofHits = 3; - iNStations = 10; - iNReqStations = 4; - // tofFindTracks->SetStation(0, 9, 0, 0); - tofFindTracks->SetStation(0, 9, 1, 0); - tofFindTracks->SetStation(1, 9, 2, 0); - tofFindTracks->SetStation(2, 9, 0, 0); - tofFindTracks->SetStation(3, 9, 1, 1); - tofFindTracks->SetStation(4, 9, 2, 1); - tofFindTracks->SetStation(5, 9, 0, 1); - tofFindTracks->SetStation(6, 6, 0, 0); - tofFindTracks->SetStation(7, 6, 0, 1); - tofFindTracks->SetStation(8, 6, 1, 0); - tofFindTracks->SetStation(9, 6, 1, 1); - /* + run->SetUserOutputFileName(OutputFile.Data()); + run->SetSink(new FairRootFileSink(run->GetUserOutputFileName())); + + CbmTofEventClusterizer* tofClust = new CbmTofEventClusterizer("TOF Event Clusterizer",iVerbose, bOut); + + tofClust->SetCalMode(calMode); + tofClust->SetCalSel(calSel); + tofClust->SetCaldXdYMax(50.); // geometrical matching window in cm + tofClust->SetCalCluMulMax(4.); // Max Counter Cluster Multiplicity for filling calib histos + tofClust->SetCalRpc(calSm); // select detector for calibration update + tofClust->SetTRefId(RefSel); // reference trigger for offset calculation + tofClust->SetTotMax(20.); // Tot upper limit for walk corection + tofClust->SetTotMin(0.01); //(12000.); // Tot lower limit for walk correction + tofClust->SetTotPreRange(2.); // effective lower Tot limit in ns from peak position + tofClust->SetTotMean(2.); // Tot calibration target value in ns + tofClust->SetMaxTimeDist(1.0); // default cluster range in ns + //tofClust->SetMaxTimeDist(0.); //Deb// default cluster range in ns + tofClust->SetDelTofMax(60.); // acceptance range for cluster correlation in cm (!) + tofClust->SetSel2MulMax(4); // limit Multiplicity in 2nd selector + tofClust->SetChannelDeadtime(dDeadtime); // artificial deadtime in ns + tofClust->SetEnableAvWalk(kTRUE); + tofClust->SetYFitMin(1.E4); + //tofClust->SetTimePeriod(6.25); // ignore coarse time + //tofClust->SetCorMode(2); // correct missing hits + + Int_t calSelRead = calSel; + if (calSel<0) calSelRead=0; + TString cFname=Form("%s_set%09d_%02d_%01dtofClust.hst.root",cFileId.Data(),iCalSet,calMode,calSelRead); + tofClust->SetCalParFileName(cFname); + TString cOutFname=Form("tofClust_%s_set%09d.hst.root",cFileId.Data(),iCalSet); + tofClust->SetOutHstFileName(cOutFname); + + TString cAnaFile=Form("%s_%09d%03d_tofAnaCosmic.hst.root",cFileId.Data(),iCalSet,iSel2); + + switch (calMode) { + case -1: // initial calibration + tofClust->SetTotMax(256.); // range in bin number + tofClust->SetTotPreRange(256.); + //tofClust->SetTotMin(1.); + tofClust->SetTRefDifMax(50000.); // in ns + tofClust->PosYMaxScal(10000.); // in % of length + tofClust->SetMaxTimeDist(0.); // no cluster building + //tofClust->SetTimePeriod(0.); // inspect coarse time + break; + case 0: // initial calibration + tofClust->SetTotMax(256.); // range in bin number + tofClust->SetTotPreRange(256.); + //tofClust->SetTotMin(1.); + tofClust->SetTRefDifMax(50.); // in ns + tofClust->PosYMaxScal(10.); // in % of length + tofClust->SetMaxTimeDist(0.); // no cluster building + //tofClust->SetTimePeriod(0.); // inspect coarse time + break; + case 1: // save offsets, update walks, for diamonds + tofClust->SetTotMax(256.); // range in bin number + tofClust->SetTotPreRange(256.); + tofClust->SetTRefDifMax(6.25); // in ns + //tofClust->SetTimePeriod(6.25); // inspect coarse time + tofClust->PosYMaxScal(10.); // in % of length + break; + case 11: + tofClust->SetTRefDifMax(5.); // in ns + tofClust->PosYMaxScal(3.0); // in % of length + break; + case 21: + tofClust->SetTRefDifMax(2.5); // in ns + tofClust->PosYMaxScal(2.0); // in % of length + break; + case 31: + tofClust->SetTRefDifMax(2.); // in ns + tofClust->PosYMaxScal(1.5); // in % of length + break; + case 41: + tofClust->SetTRefDifMax(1.); // in ns + tofClust->PosYMaxScal(0.8); // in % of length + break; + case 51: + tofClust->SetTRefDifMax(0.7); // in ns + tofClust->PosYMaxScal(0.7); // in % of length + break; + case 61: + tofClust->SetTRefDifMax(0.5); // in ns + tofClust->PosYMaxScal(0.7); // in % of length + break; + case 71: + tofClust->SetTRefDifMax(0.4); // in ns + tofClust->PosYMaxScal(0.6); // in % of length + break; + + case 2: // time difference calibration + tofClust->SetTRefDifMax(300.); // in ns + tofClust->PosYMaxScal(1000.); //in % of length + break; + + case 3: // time offsets + tofClust->SetTRefDifMax(200.); // in ns + tofClust->PosYMaxScal(100.); //in % of length + tofClust->SetMaxTimeDist(0.); // no cluster building + break; + case 12: + case 13: + tofClust->SetTRefDifMax(100.); // in ns + tofClust->PosYMaxScal(50.); //in % of length + break; + case 22: + case 23: + tofClust->SetTRefDifMax(50.); // in ns + tofClust->PosYMaxScal(20.); //in % of length + break; + case 32: + case 33: + tofClust->SetTRefDifMax(25.); // in ns + tofClust->PosYMaxScal(10.); //in % of length + break; + case 42: + case 43: + tofClust->SetTRefDifMax(12.); // in ns + tofClust->PosYMaxScal(5.); //in % of length + break; + case 52: + case 53: + tofClust->SetTRefDifMax(5.); // in ns + tofClust->PosYMaxScal(3.); //in % of length + break; + case 62: + case 63: + tofClust->SetTRefDifMax(3.); // in ns + tofClust->PosYMaxScal(2.); //in % of length + break; + case 72: + case 73: + tofClust->SetTRefDifMax(2.); // in ns + tofClust->PosYMaxScal(1.5); //in % of length + break; + case 82: + case 83: + tofClust->SetTRefDifMax(1.); // in ns + tofClust->PosYMaxScal(1.0); //in % of length + break; + case 92: + case 93: + tofClust->SetTRefDifMax(0.6); // in ns + tofClust->PosYMaxScal(1.0); //in % of length + break; + + case 4: // velocity dependence (DelTOF) + tofClust->SetTRefDifMax(6.); // in ns + tofClust->PosYMaxScal(1.5); //in % of length + break; + case 14: + tofClust->SetTRefDifMax(5.); // in ns + tofClust->PosYMaxScal(1.); //in % of length + break; + case 24: + tofClust->SetTRefDifMax(3.); // in ns + tofClust->PosYMaxScal(1.0); //in % of length + break; + case 34: + tofClust->SetTRefDifMax(2.); // in ns + tofClust->PosYMaxScal(1.0); //in % of length + break; + case 44: + tofClust->SetTRefDifMax(1.); // in ns + tofClust->PosYMaxScal(1.0); //in % of length + break; + case 54: + tofClust->SetTRefDifMax(0.7); // in ns + tofClust->PosYMaxScal(0.7); //in % of length + break; + case 64: + tofClust->SetTRefDifMax(0.5); // in ns + tofClust->PosYMaxScal(0.7); //in % of length + break; + default: + cout << "<E> Calib mode not implemented! stop execution of script"<<endl; + return; + } + run->AddTask(tofClust); + + Int_t iBRef=iCalSet%1000; + Int_t iSet = (iCalSet - iBRef)/1000; + Int_t iRSel=0; + Int_t iRSelTyp=0; + Int_t iRSelSm=0; + Int_t iRSelRpc=0; + iRSel=iBRef; // use diamond + if(iSel2==0){ + // iSel2=iBRef; + }else{ + if(iSel2<0) iSel2=-iSel2; + } + + Int_t iRSelin=iRSel; + iRSelRpc=iRSel%10; + iRSelTyp = (iRSel-iRSelRpc)/10; + iRSelSm=iRSelTyp%10; + iRSelTyp = (iRSelTyp-iRSelSm)/10; + + tofClust->SetBeamRefId(iRSelTyp); // define Beam reference counter + tofClust->SetBeamRefSm(iRSelSm); + tofClust->SetBeamRefDet(iRSelRpc); + tofClust->SetBeamAddRefMul(-1); + tofClust->SetBeamRefMulMax(3); + + Int_t iSel2in=iSel2; + Int_t iSel2Rpc= iSel2%10; + iSel2=(iSel2-iSel2Rpc)/10; + Int_t iSel2Sm=iSel2%10; + iSel2=(iSel2-iSel2Sm)/10; + if(iSel2 > 0) { + tofClust->SetSel2Id(iSel2); + tofClust->SetSel2Sm(iSel2Sm); + tofClust->SetSel2Rpc(iSel2Rpc); + } + + Int_t iRef = iSet %1000; + Int_t iDut = (iSet - iRef)/1000; + Int_t iDutRpc = iDut%10; + iDut = (iDut - iDutRpc)/10; + Int_t iDutSm = iDut%10; + iDut = (iDut - iDutSm)/10; + + tofClust->SetDutId(iDut); + tofClust->SetDutSm(iDutSm); + tofClust->SetDutRpc(iDutRpc); + + Int_t iRefRpc = iRef%10; + iRef = (iRef - iRefRpc)/10; + Int_t iRefSm = iRef%10; + iRef = (iRef - iRefSm)/10; + + tofClust->SetSelId(iRef); + tofClust->SetSelSm(iRefSm); + tofClust->SetSelRpc(iRefRpc); + + cout << "Run with iRSel = "<<iRSel<<", iSel2 = "<<iSel2in<<endl; + + // ========================================================================= + // === Tracking === + // ========================================================================= + CbmStsDigitize* stsDigitize = new CbmStsDigitize(); //necessary for kalman !! + CbmKF* kalman = new CbmKF(); + + CbmTofTrackFinder* tofTrackFinder= new CbmTofTrackFinderNN(); + tofTrackFinder->SetMaxTofTimeDifference(5.); // in ns/cm + tofTrackFinder->SetTxLIM(1.6); // max slope dx/dz + tofTrackFinder->SetTyLIM(1.6); // max dev from mean slope dy/dz + tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + tofTrackFinder->SetMaxTofTimeDifference(1.); // in ns/cm + + 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->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 + 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->SetBeamCounter(9,0,1); + //tofFindTracks->SetBeamCounter(1,1,1); + + 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.1); // 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, 9, 0, 0); // Diamond + break; + case 1: // for calibration mode of full setup + iMinNofHits=3; + iNStations=10; + iNReqStations=4; + // tofFindTracks->SetStation(0, 9, 0, 0); + tofFindTracks->SetStation(0, 9, 1, 0); + tofFindTracks->SetStation(1, 9, 2, 0); + tofFindTracks->SetStation(2, 9, 0, 0); + tofFindTracks->SetStation(3, 9, 1, 1); + tofFindTracks->SetStation(4, 9, 2, 1); + tofFindTracks->SetStation(5, 9, 0, 1); + tofFindTracks->SetStation(6, 6, 0, 0); + tofFindTracks->SetStation(7, 6, 0, 1); + tofFindTracks->SetStation(8, 6, 1, 0); + tofFindTracks->SetStation(9, 6, 1, 1); + /* tofFindTracks->SetStation(8, 8, 0, 0); tofFindTracks->SetStation(9, 8, 0, 1); tofFindTracks->SetStation(10, 8, 0, 2); @@ -399,223 +368,209 @@ void dis_digi(Int_t nEvents = 100, tofFindTracks->SetStation(14, 8, 0, 6); tofFindTracks->SetStation(15, 8, 0, 7); */ - break; - - case 11: // for debugging - iMinNofHits = 3; - iNStations = 5; - iNReqStations = 5; - // tofFindTracks->SetStation(0, 9, 0, 0); - tofFindTracks->SetStation(0, 9, 1, 0); - tofFindTracks->SetStation(1, 9, 2, 0); - tofFindTracks->SetStation(2, 9, 2, 1); - tofFindTracks->SetStation(3, 9, 0, 1); - tofFindTracks->SetStation(4, 1, 0, 1); - break; - - case 2: - iMinNofHits = 6; - iNStations = 7; - iNReqStations = 7; - tofFindTracks->SetStation(0, 9, 1, 0); - tofFindTracks->SetStation(1, 9, 2, 0); - tofFindTracks->SetStation(2, 9, 1, 1); - tofFindTracks->SetStation(3, 9, 2, 1); - tofFindTracks->SetStation(4, 9, 0, 0); - tofFindTracks->SetStation(5, 9, 0, 1); - tofFindTracks->SetStation(6, 1, 0, 1); - // tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc); - break; - - case 21: - iMinNofHits = 5; - iNStations = 6; - iNReqStations = 6; - tofFindTracks->SetStation(0, 9, 1, 0); - tofFindTracks->SetStation(1, 9, 2, 0); - tofFindTracks->SetStation(2, 9, 1, 1); - tofFindTracks->SetStation(3, 9, 2, 1); - //tofFindTracks->SetStation(4, 9, 0, 0); - tofFindTracks->SetStation(4, 9, 0, 1); - tofFindTracks->SetStation(5, 1, 0, 1); - // tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc); - break; - - case 3: - iMinNofHits = 4; - iNStations = 5; - iNReqStations = 5; - tofFindTracks->SetStation(0, 9, 1, 1); - tofFindTracks->SetStation(1, 9, 2, 1); - tofFindTracks->SetStation(2, 9, 1, 0); - tofFindTracks->SetStation(3, 9, 2, 0); - tofFindTracks->SetStation(4, 9, 0, 1); - break; - - case 4: iMinNofHits = 5; break; - - case 5: // for calibration of 2-stack and add-on counters (STAR2, CERN) - iMinNofHits = 5; - iNStations = 7; - iNReqStations = 7; - // tofFindTracks->SetStation(0, 9, 0, 0); - tofFindTracks->SetStation(0, 9, 1, 0); - tofFindTracks->SetStation(1, 9, 2, 0); - tofFindTracks->SetStation(2, 9, 1, 1); - tofFindTracks->SetStation(3, 9, 2, 1); - tofFindTracks->SetStation(4, 9, 0, 1); - tofFindTracks->SetStation(5, 6, 0, 0); - tofFindTracks->SetStation(6, 6, 0, 1); - break; - - 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); - - //CbmTofAnaTestbeam defaults - tofAnaTestbeam->SetReqTrg(0); // 0 - no selection - tofAnaTestbeam->SetDXMean(0.); - tofAnaTestbeam->SetDYMean(0.); - tofAnaTestbeam->SetDTMean(0.); // in ps - tofAnaTestbeam->SetDXWidth(0.4); - tofAnaTestbeam->SetDYWidth(0.4); - tofAnaTestbeam->SetDTWidth(80.); // in ps - tofAnaTestbeam->SetCalParFileName(cAnaFile); - tofAnaTestbeam->SetPosY4Sel( - 0.5); // Y Position selection in fraction of strip length - tofAnaTestbeam->SetDTDia(0.); // Time difference to additional diamond - tofAnaTestbeam->SetCorMode(RefSel); // 1 - DTD4, 2 - X4 - tofAnaTestbeam->SetMul0Max(30); // Max Multiplicity in dut - tofAnaTestbeam->SetMul4Max(30); // Max Multiplicity in Ref - RPC - tofAnaTestbeam->SetMulDMax(10); // Max Multiplicity in Diamond - tofAnaTestbeam->SetHitDistMin(30.); // initialization - tofAnaTestbeam->SetEnableMatchPosScaling(kFALSE); - - tofAnaTestbeam->SetPosYS2Sel( - 0.5); // 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->SetTShift(0.); // Shift DTD4 to 0 - tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 - tofAnaTestbeam->SetTOffD4(13.); // Shift DTD4 to physical value - - 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 - - tofAnaTestbeam->SetChi2Lim(10.); // initialization of Chi2 selection limit - - if (0) switch (iSet) { - case 0: // upper part of setup: P2 - P5 - case 3: // upper part of setup: P2 - P5 - case 34: // upper part of setup: P2 - P5 - case 400300: - switch (iRSel) { - case 4: - tofAnaTestbeam->SetTShift(0.); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value - tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 - break; - - case 5: - tofAnaTestbeam->SetTShift(-3.); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value - tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 - break; - - case 9: - tofAnaTestbeam->SetChi2Lim( - 100.); // initialization of Chi2 selection limit - tofAnaTestbeam->SetMulDMax( - 3); // Max Multiplicity in BeamRef // Diamond - tofAnaTestbeam->SetTShift(0.1); // Shift DTD4 to 0 - tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value - tofAnaTestbeam->SetSel2TOff(0.5); // Shift Sel2 time peak to 0 - break; - - default:; - } - - default: - cout << "<E> detector setup " << iSet << " unknown, stop!" << endl; - return; - ; - } // end of different subsets - - //run->AddTask(tofAnaTestbeam); - // ========================================================================= - /* + break; + + case 11: // for debugging + iMinNofHits=3; + iNStations=5; + iNReqStations=5; + // tofFindTracks->SetStation(0, 9, 0, 0); + tofFindTracks->SetStation(0, 9, 1, 0); + tofFindTracks->SetStation(1, 9, 2, 0); + tofFindTracks->SetStation(2, 9, 2, 1); + tofFindTracks->SetStation(3, 9, 0, 1); + tofFindTracks->SetStation(4, 1, 0, 1); + break; + + case 2: + iMinNofHits=6; + iNStations=7; + iNReqStations=7; + tofFindTracks->SetStation(0, 9, 1, 0); + tofFindTracks->SetStation(1, 9, 2, 0); + tofFindTracks->SetStation(2, 9, 1, 1); + tofFindTracks->SetStation(3, 9, 2, 1); + tofFindTracks->SetStation(4, 9, 0, 0); + tofFindTracks->SetStation(5, 9, 0, 1); + tofFindTracks->SetStation(6, 1, 0, 1); + // tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc); + break; + + case 21: + iMinNofHits=5; + iNStations=6; + iNReqStations=6; + tofFindTracks->SetStation(0, 9, 1, 0); + tofFindTracks->SetStation(1, 9, 2, 0); + tofFindTracks->SetStation(2, 9, 1, 1); + tofFindTracks->SetStation(3, 9, 2, 1); + //tofFindTracks->SetStation(4, 9, 0, 0); + tofFindTracks->SetStation(4, 9, 0, 1); + tofFindTracks->SetStation(5, 1, 0, 1); + // tofFindTracks->SetStation(6, iDut, iDutSm, iDutRpc); + break; + + case 3: + iMinNofHits=4; + iNStations=5; + iNReqStations=5; + tofFindTracks->SetStation(0, 9, 1, 1); + tofFindTracks->SetStation(1, 9, 2, 1); + tofFindTracks->SetStation(2, 9, 1, 0); + tofFindTracks->SetStation(3, 9, 2, 0); + tofFindTracks->SetStation(4, 9, 0, 1); + break; + + case 4: + iMinNofHits=5; + + break; + + case 5: // for calibration of 2-stack and add-on counters (STAR2, CERN) + iMinNofHits=5; + iNStations=7; + iNReqStations=7; + // tofFindTracks->SetStation(0, 9, 0, 0); + tofFindTracks->SetStation(0, 9, 1, 0); + tofFindTracks->SetStation(1, 9, 2, 0); + tofFindTracks->SetStation(2, 9, 1, 1); + tofFindTracks->SetStation(3, 9, 2, 1); + tofFindTracks->SetStation(4, 9, 0, 1); + tofFindTracks->SetStation(5, 6, 0, 0); + tofFindTracks->SetStation(6, 6, 0, 1); + break; + + 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); + + //CbmTofAnaTestbeam defaults + tofAnaTestbeam->SetReqTrg(0); // 0 - no selection + tofAnaTestbeam->SetDXMean(0.); + tofAnaTestbeam->SetDYMean(0.); + tofAnaTestbeam->SetDTMean(0.); // in ps + tofAnaTestbeam->SetDXWidth(0.4); + tofAnaTestbeam->SetDYWidth(0.4); + tofAnaTestbeam->SetDTWidth(80.); // in ps + tofAnaTestbeam->SetCalParFileName(cAnaFile); + tofAnaTestbeam->SetPosY4Sel(0.5); // Y Position selection in fraction of strip length + tofAnaTestbeam->SetDTDia(0.); // Time difference to additional diamond + tofAnaTestbeam->SetCorMode(RefSel); // 1 - DTD4, 2 - X4 + tofAnaTestbeam->SetMul0Max(30); // Max Multiplicity in dut + tofAnaTestbeam->SetMul4Max(30); // Max Multiplicity in Ref - RPC + tofAnaTestbeam->SetMulDMax(10); // Max Multiplicity in Diamond + tofAnaTestbeam->SetHitDistMin(30.); // initialization + tofAnaTestbeam->SetEnableMatchPosScaling(kFALSE); + + tofAnaTestbeam->SetPosYS2Sel(0.5); // 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->SetTShift(0.); // Shift DTD4 to 0 + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + tofAnaTestbeam->SetTOffD4(13.); // Shift DTD4 to physical value + + 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 + + tofAnaTestbeam->SetChi2Lim(10.); // initialization of Chi2 selection limit + + if(0) + switch (iSet) { + case 0: // upper part of setup: P2 - P5 + case 3: // upper part of setup: P2 - P5 + case 34: // upper part of setup: P2 - P5 + case 400300: + switch (iRSel){ + case 4: + tofAnaTestbeam->SetTShift(0.); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + break; + + case 5: + tofAnaTestbeam->SetTShift(-3.); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + break; + + case 9: + tofAnaTestbeam->SetChi2Lim(100.); // initialization of Chi2 selection limit + tofAnaTestbeam->SetMulDMax(3); // Max Multiplicity in BeamRef // Diamond + tofAnaTestbeam->SetTShift(0.1); // Shift DTD4 to 0 + tofAnaTestbeam->SetTOffD4(16.); // Shift DTD4 to physical value + tofAnaTestbeam->SetSel2TOff(0.5); // Shift Sel2 time peak to 0 + break; + + default: + ; + } + + default: + cout<<"<E> detector setup "<<iSet<<" unknown, stop!"<<endl; + return; + ; + } // end of different subsets + + //run->AddTask(tofAnaTestbeam); + // ========================================================================= + /* CbmTofOnlineDisplay* display = new CbmTofOnlineDisplay(); display->SetUpdateInterval(1000); run->AddTask(display); */ // ----- 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); + + 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); + CbmPixelHitSetDraw *TofUHits = new CbmPixelHitSetDraw ("TofUHit", kRed, kOpenCross ); fMan->AddTask(TofUHits); - CbmPointSetArrayDraw* TofHits = new CbmPointSetArrayDraw( - "TofHit", - 1, - 1, - 4, - kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren - // CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare); - fMan->AddTask(TofHits); + CbmPointSetArrayDraw *TofHits = new CbmPointSetArrayDraw ("TofHit", 1, 1, 4, kTRUE); //name, colorMode, markerMode, verbosity, RnrChildren + // CbmPixelHitSetDraw *TofHits = new CbmPixelHitSetDraw ("TofHit", kRed, kOpenCircle, 4);// kFullSquare); + fMan->AddTask(TofHits); TGeoVolume* top = gGeoManager->GetTopVolume(); @@ -623,9 +578,9 @@ void dis_digi(Int_t nEvents = 100, 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(); + 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->SetTransparency(90); /* switch (char *) not allowed any more in root 6 :( @@ -650,31 +605,32 @@ void dis_digi(Int_t nEvents = 100, */ } // gGeoManager->SetVisLevel(3); - // top->SetTransparency(80); + // top->SetTransparency(80); // top->Draw("ogl"); - // fMan->Init(1,4,10000); - 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 + // fMan->Init(1,4,10000); + 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); // gEve->TEveProjectionAxes()->SetDrawOrigin(kTRUE); - { // 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(); - } + { // 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(); + } } // ----- Intialise and run -------------------------------------------- @@ -682,7 +638,7 @@ void dis_digi(Int_t nEvents = 100, // cout << "Starting run" << endl; // run->Run(0, nEvents); // ------------------------------------------------------------------------ - // default display + // default display /* TString Display_Status = "pl_over_Mat04D4best.C"; TString Display_Funct = "pl_over_Mat04D4best()"; diff --git a/macro/beamtime/hd2020/pl_all_3D.C b/macro/beamtime/hd2020/pl_all_3D.C index 6a94e7f91bacc8593fef98baee7269abf3f1b152..9582590d67d502633894b06877dc29a1528b6cb6 100644 --- a/macro/beamtime/hd2020/pl_all_3D.C +++ b/macro/beamtime/hd2020/pl_all_3D.C @@ -1,69 +1,65 @@ -void pl_all_3D(Int_t iOpt = 0, Int_t iSel = 0, Int_t iNSt = 2) { +void pl_all_3D(Int_t iOpt=0, Int_t iSel=0, Int_t iNSt=2) +{ // TCanvas *can = new TCanvas("can22","can22"); - // can->Divide(2,2); + // can->Divide(2,2); // TCanvas *can = new TCanvas("can","can",48,55,700,900); - TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900); - can->Divide(4, 3, 0.01, 0.01); - // can->Divide(2,2,0,0); - Float_t lsize = 0.07; + TCanvas *can = new TCanvas("can","can",48,56,900,900); + can->Divide(4,3,0.01,0.01); + // can->Divide(2,2,0,0); + Float_t lsize=0.07; - gPad->SetFillColor(0); - gStyle->SetPalette(1); - gStyle->SetLabelSize(lsize); + gPad->SetFillColor(0); + gStyle->SetPalette(1); + gStyle->SetLabelSize(lsize); - //gStyle->SetOptStat(kTRUE); - //gROOT->cd(); - //gROOT->SetDirLevel(2); + //gStyle->SetOptStat(kTRUE); + //gROOT->cd(); + //gROOT->SetDirLevel(2); - TH3* h; - TH2* h2; - const Int_t iType[6] = {9, 6, 7, 5, 6, 8}; - const Int_t iSmNum[6] = {3, 2, 1, 1, 1, 1}; - const Int_t iRpcNum[6] = {2, 2, 1, 1, 2, 8}; - TString cOpt; + TH3 *h; + TH2 *h2; + const Int_t iType[6]={9,6,7,5,6,8}; + const Int_t iSmNum[6]={3,2,1,1,1,1}; + const Int_t iRpcNum[6]={2,2,1,1,2,8}; + TString cOpt; - Int_t iCanv = 0; - // if (h!=NULL) h->Delete(); + Int_t iCanv=0; + // if (h!=NULL) h->Delete(); - for (Int_t iSt = 0; iSt < iNSt; iSt++) { - for (Int_t iSm = 0; iSm < iSmNum[iSt]; iSm++) { - for (Int_t iRp = 0; iRp < iRpcNum[iSt]; iRp++) { - can->cd(iCanv + 1); - iCanv++; - gROOT->cd(); - TString hname = Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2", - iType[iSt], - iSm, - iRp, - iSel); - h = (TH3*) gROOT->FindObjectAny(hname); - if (h != NULL) { - switch (iOpt) { - case 0: - cOpt = "yx"; - h->Project3D(cOpt)->Draw("colz"); - break; + for(Int_t iSt=0; iSt<iNSt; iSt++){ + for(Int_t iSm=0; iSm<iSmNum[iSt];iSm++){ + for(Int_t iRp=0; iRp<iRpcNum[iSt];iRp++){ + can->cd(iCanv+1); iCanv++; + gROOT->cd(); + TString hname=Form("cl_SmT%01d_sm%03d_rpc%03d_Sel%02d_Walk2",iType[iSt],iSm,iRp,iSel); + h=(TH3 *)gROOT->FindObjectAny(hname); + if (h!=NULL) { + switch(iOpt){ + case 0: + cOpt="yx"; + h->Project3D(cOpt)->Draw("colz"); + break; - case 1: - cOpt = "yx"; - h->Project3D(cOpt)->Draw("colz"); - gPad->SetLogz(); - break; + case 1: + cOpt="yx"; + h->Project3D(cOpt)->Draw("colz"); + gPad->SetLogz(); + break; - case 2: - cOpt = "pfyx"; - h2 = (TH2*) h->Project3DProfile("yx"); - h2->SetMinimum(-0.2); - h2->SetMaximum(0.2); - h2->Draw("colz"); - break; - default:; - } - } else { - cout << "Histogram " << hname << " not existing. " << endl; - } - } + case 2: + cOpt="pfyx"; + h2 = (TH2 *)h->Project3DProfile("yx"); + h2->SetMinimum(-0.2); + h2->SetMaximum(0.2); + h2->Draw("colz"); + break; + default: + ; + } + }else{cout<<"Histogram "<<hname<<" not existing. "<<endl;} } } - can->SaveAs(Form("pl_all_%s.pdf", cOpt.Data())); -} + } + can->SaveAs(Form("pl_all_%s.pdf",cOpt.Data())); + +} diff --git a/macro/beamtime/hd2020/pl_all_Track2D.C b/macro/beamtime/hd2020/pl_all_Track2D.C index 37df67135158c54b95db7c2a07bce77a92732a8a..668b37b101b8cc23e208050a265f647bf0ad0c54 100644 --- a/macro/beamtime/hd2020/pl_all_Track2D.C +++ b/macro/beamtime/hd2020/pl_all_Track2D.C @@ -1,122 +1,136 @@ -void pl_all_Track2D(Int_t iOpt = 1, Int_t iNSt = 2) { +void pl_all_Track2D(Int_t iOpt=1, Int_t iNSt=2) +{ // TCanvas *can = new TCanvas("can22","can22"); - // can->Divide(2,2); + // can->Divide(2,2); // TCanvas *can = new TCanvas("can","can",48,55,700,900); - TCanvas* can = new TCanvas("can", "can", 48, 56, 900, 900); - can->Divide(4, 2, 0.01, 0.01); - // can->Divide(2,2,0,0); - Float_t lsize = 0.07; + TCanvas *can = new TCanvas("can","can",48,56,900,900); + can->Divide(5,6,0.01,0.01); + // can->Divide(2,2,0,0); + Float_t lsize=0.07; - gPad->SetFillColor(0); - gStyle->SetPalette(1); - gStyle->SetLabelSize(lsize); + gPad->SetFillColor(0); + gStyle->SetPalette(1); + gStyle->SetLabelSize(lsize); - //gStyle->SetOptStat(kTRUE); - //gROOT->cd(); - //gROOT->SetDirLevel(2); + //gStyle->SetOptStat(kTRUE); + //gROOT->cd(); + //gROOT->SetDirLevel(2); - TH2* h; - TH2* h2; - const Int_t iType[6] = {9, 6, 6, 5, 7, 8}; - const Int_t iSmNum[6] = {3, 1, 1, 1, 1, 1}; - const Int_t iRpcNum[6] = {2, 2, 2, 1, 1, 8}; - TString cOpt; + TH2 *h; + TH2 *h2; + const Int_t iType[6]={0,9,5,5,7,8}; + const Int_t iSmNum[6]={5,1,1,1,1,1}; + const Int_t iRpcNum[6]={5,1,1,1,1,8}; + 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 = "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:; - } + 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="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 = ""; - 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; - } - } - } - } + 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/mcbm2018/ana_digi_cal.C b/macro/beamtime/mcbm2018/ana_digi_cal.C index c77b47b8c67577b0c12501b1bd62e8e183938b1b..eb9b70872e86db3cbb2cd07e2e56700ef9efacde 100644 --- a/macro/beamtime/mcbm2018/ana_digi_cal.C +++ b/macro/beamtime/mcbm2018/ana_digi_cal.C @@ -44,16 +44,16 @@ void ana_digi_cal(Int_t nEvents = 10000000, TList* parFileList = new TList(); TString FId = cFileId; - TString TofGeo = "v18m_mCbm"; + TString TofGeo = "v18m_mcbm"; cout << "Geometry version " << TofGeo << endl; - +/* TObjString* tofDigiFile = new TObjString( workDir + "/parameters/tof/tof_" + TofGeo + ".digi.par"); // TOF digi file parFileList->Add(tofDigiFile); - +*/ // TObjString tofDigiBdfFile = new TObjString( paramDir + "/tof." + FPar + "digibdf.par"); TObjString* tofDigiBdfFile = - new TObjString(workDir + "/parameters/tof/" + TofGeo + ".digibdf.par"); + new TObjString(workDir + "/parameters/tof/tof_" + TofGeo + ".digibdf.par"); parFileList->Add(tofDigiBdfFile); TString geoDir = gSystem->Getenv("VMCWORKDIR"); diff --git a/macro/beamtime/mcbm2018/ana_trks.C b/macro/beamtime/mcbm2018/ana_trks.C index 08b1e823e14bfd2cd449e955cb0713fa0171a961..3fea1fc9adf651d7afea7fd8c69f27ac679d125b 100644 --- a/macro/beamtime/mcbm2018/ana_trks.C +++ b/macro/beamtime/mcbm2018/ana_trks.C @@ -10,9 +10,15 @@ void ana_trks(Int_t nEvents = 10000, Double_t dDeadtime = 50, TString cCalId = "", Int_t iAnaCor = 1, - Bool_t bUseSigCalib = kFALSE) { + 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"; @@ -21,14 +27,20 @@ void ana_trks(Int_t nEvents = 10000, //TString logLevel = "DEBUG1"; //TString logLevel = "DEBUG2"; //TString logLevel = "DEBUG3"; - TString workDir = gSystem->Getenv("VMCWORKDIR"); - //TString workDir = "../../.."; - TString paramDir = workDir + "/macro/beamtime/mcbm2018"; + TString workDir = gSystem->Getenv("VMCWORKDIR"); + TString paramDir = workDir + "/macro/beamtime/mcbm2018"; + //TString paramDir = "."; + TString ParFile = paramDir + "/data/" + cFileId.Data() + ".params.root"; TString InputFile = paramDir + "/data/" + cFileId.Data() + ".root"; 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"; @@ -46,7 +58,7 @@ void ana_trks(Int_t nEvents = 10000, iTrackingSetup, cCalId.Data()); TString cTrkFile = Form("%s_tofFindTracks.hst.root", cCalId.Data()); - TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cCalId.Data()); + TString cAnaFile = Form("%s_TrkAnaTestBeam.hst.root", cFileId.Data()); cout << " InputDigiFile = " << InputDigiFile << endl; @@ -54,28 +66,35 @@ void ana_trks(Int_t nEvents = 10000, gSystem->Exec(shcmd.Data()); TList* parFileList = new TList(); - - TString TofGeo = "v18m_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 = "v18m_mcbm"; //default + + 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_2019_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 ------------------------------------------- @@ -87,9 +106,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("VERYHIGH"); FairLogger::GetLogger()->SetLogVerbosityLevel("MEDIUM"); // ----- Local selection variables ------------------------------------------- @@ -111,22 +133,58 @@ void ana_trks(Int_t nEvents = 10000, 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 === // ========================================================================= - CbmStsDigitize* stsDigitize = new CbmStsDigitize(); //necessary for kalman !! - CbmKF* kalman = new CbmKF(); - - /* - 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.2); // in ns/cm - tofTrackFinder->SetTxLIM(0.3); // max slope dx/dz - tofTrackFinder->SetTyLIM(0.3); // max dev from mean slope dy/dz - tofTrackFinder->SetTyMean(0.); // mean slope dy/dz + 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 dx/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; + case 2: // for triple stack 012 counter evaluation + tofTrackFinder->SetTxMean(0.0); // mean slope dx/dz + tofTrackFinder->SetTyMean(-0.03); // mean slope dy/dz + tofTrackFinder->SetTxLIM(0.06); // max slope dx/dz + tofTrackFinder->SetTyLIM(0.03); // max dev from mean slope dy/dz + break; + } CbmTofTrackFitter* tofTrackFitter = new CbmTofTrackFitterKF(0, 211); TFitter* MyFit = new TFitter(1); // initialize Minuit @@ -134,28 +192,34 @@ 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, 2 - update walk, 0 - bypass tofFindTracks->SetCorMode(iGenCor); // valid options: 0,1,2,3,4,5,6, 10 - 19 - tofFindTracks->SetTtTarg( - 0.041); // target value for inverse velocity, > 0.033 ns/cm! - //tofFindTracks->SetTtTarg(0.035); // target value for inverse velocity, > 0.033 ns/cm! + //tofFindTracks->SetTtTarg(0.041); // Mar19, Run 159 + //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 + tofFindTracks->SetR0Lim(0.); // for calibration 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.45); // default in cm - tofFindTracks->SetSIGZ(0.05); // default in cm + tofFindTracks->SetSIGX(0.45); // local-y default in cm + tofFindTracks->SetSIGY(0.3); // local-x default in cm + tofFindTracks->SetSIGZ(10.05); // default in cm tofFindTracks->SetUseSigCalib( bUseSigCalib); // ignore resolutions in CalPar file tofTrackFinder->SetSIGLIM(dChi2Lim2 * 2.); // matching window in multiples of chi2 + tofTrackFinder->SetSIGLIMMOD(1.5); // search window modifier for last hit (DUT) tofTrackFinder->SetChiMaxAccept(dChi2Lim2); // max tracklet chi2 - Int_t iMinNofHits = -1; Int_t iNStations = 0; Int_t iNReqStations = 3; @@ -168,6 +232,10 @@ void ana_trks(Int_t nEvents = 10000, 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 = 39; iNReqStations = 4; @@ -277,31 +345,30 @@ void ana_trks(Int_t nEvents = 10000, 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(2, 0, 0, 2); + tofFindTracks->SetStation(3, 0, 1, 2); break; - - case 14: + + case 14: // for eval 012 iMinNofHits = 3; - iNStations = 15; + iNStations = 4; iNReqStations = 4; + tofFindTracks->SetStation(3, 5, 0, 0); tofFindTracks->SetStation(0, 0, 2, 2); - tofFindTracks->SetStation(1, 0, 1, 2); - tofFindTracks->SetStation(2, 0, 0, 2); - tofFindTracks->SetStation(0, 0, 2, 1); - tofFindTracks->SetStation(1, 0, 1, 1); - tofFindTracks->SetStation(2, 0, 0, 1); - tofFindTracks->SetStation(0, 0, 2, 0); - tofFindTracks->SetStation(1, 0, 1, 0); - tofFindTracks->SetStation(2, 0, 0, 0); - tofFindTracks->SetStation(0, 0, 2, 3); - tofFindTracks->SetStation(1, 0, 1, 3); - tofFindTracks->SetStation(2, 0, 0, 3); - tofFindTracks->SetStation(0, 0, 2, 4); - tofFindTracks->SetStation(1, 0, 1, 4); - tofFindTracks->SetStation(2, 0, 0, 4); + tofFindTracks->SetStation(1, 0, 0, 2); + tofFindTracks->SetStation(2, 0, 1, 2); + break; + + case 24: // for geometry tuning 012 + iMinNofHits = 3; + iNStations = 3; + iNReqStations = 3; + tofFindTracks->SetStation(0, 0, 2, 2); + tofFindTracks->SetStation(1, 0, 0, 2); + tofFindTracks->SetStation(2, 0, 1, 2); break; + case 5: // for calibration of 2-stack and add-on counters (STAR2, CERN) iMinNofHits = 5; iNStations = 6; @@ -356,6 +423,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 " @@ -378,9 +446,13 @@ 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 + 0.); // limit distance of fitted track to nominal vertex tofAnaTestbeam->SetDXMean(0.); tofAnaTestbeam->SetDYMean(0.); tofAnaTestbeam->SetDTMean(0.); // in ns @@ -427,7 +499,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( @@ -436,6 +508,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 @@ -493,7 +568,7 @@ void ana_trks(Int_t nEvents = 10000, case 901041: switch (iRSelin) { case 500: - tofAnaTestbeam->SetTShift(5.3); // Shift DTD4 to 0 + tofAnaTestbeam->SetTShift(0.8); // Shift DTD4 to 0 tofAnaTestbeam->SetTOffD4(11.); // Shift DTD4 to physical value switch (iSel2in) { @@ -501,7 +576,10 @@ void ana_trks(Int_t nEvents = 10000, tofAnaTestbeam->SetSel2TOff(-0.3); // Shift Sel2 time peak to 0 break; case 31: - tofAnaTestbeam->SetSel2TOff(0.52); // Shift Sel2 time peak to 0 + tofAnaTestbeam->SetSel2TOff(0.); // Shift Sel2 time peak to 0 + break; + case 600: + tofAnaTestbeam->SetSel2TOff(-0.2); // Shift Sel2 time peak to 0 break; default:; @@ -567,30 +645,30 @@ 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 + /* TString Display_Status = "pl_over_Mat04D4best.C"; TString Display_Funct; - if (iGenCor < 0) { + if (iGenCor<0) { Display_Funct = "pl_over_Mat04D4best(1)"; - } else { + }else{ Display_Funct = "pl_over_Mat04D4best(0)"; } gROOT->LoadMacro(Display_Status); - cout << "Exec " << Display_Funct.Data() << endl; + 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"); gROOT->LoadMacro("pl_TIR.C"); gROOT->LoadMacro("pl_Eff_XY.C"); @@ -598,11 +676,19 @@ void ana_trks(Int_t nEvents = 10000, gROOT->LoadMacro("pl_Eff_TIS.C"); gROOT->LoadMacro("pl_Dut_Res.C"); - gInterpreter->ProcessLine("pl_over_MatD4sel()"); - gInterpreter->ProcessLine("pl_TIS()"); - gInterpreter->ProcessLine("pl_TIR()"); + 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/pl_XY_trk.C b/macro/beamtime/pl_XY_trk.C index 18194c2524717df345942a7ba6ec389e690b99c5..15c848a20961d9e7c29c220bf3d345cab77554c5 100644 --- a/macro/beamtime/pl_XY_trk.C +++ b/macro/beamtime/pl_XY_trk.C @@ -37,9 +37,13 @@ void pl_XY_trk(Int_t NSt = 4, Double_t MinEff = 0.5, Double_t dThr = 0.1) { h2acc->Reset(); Int_t Nbins = h2->GetNbinsX() * h2->GetNbinsY(); Double_t dMax = dThr * h2->GetMaximum(); - for (Int_t i = 0; i < Nbins; i++) - h2->GetBinContent(i + 1) < dMax ? h2acc->SetBinContent(i + 1, 0.) - : h2acc->SetBinContent(i + 1, 1.); + for (Int_t i = 0; i < (Int_t)h2->GetNbinsX(); i++) + for (Int_t j = 0; j < (Int_t)h2->GetNbinsY(); j++) + { + h2->GetBinContent(i+1, j+1) < dMax ? h2acc->SetBinContent(i+1, j+1, 0.) + : h2acc->SetBinContent(i+1, j+1, 1.); + //cout << "Bin "<<i<<","<<j<<": "<< h2->GetBinContent(i+1,j+1) <<" filled with "<<h2acc->GetBinContent(i+1,j+1)<<endl; + } TH2D* h2aall = (TH2D*) h2->Clone(Form("ALL_acc%d", iSt)); h2aall->Multiply(h2aall, h2acc, 1., 1., "B"); Nall = h2aall->Integral(); diff --git a/macro/beamtime/pl_over_trk.C b/macro/beamtime/pl_over_trk.C index 5e59feda5df18a0935ab18a950935d47496cddbd..500bdd27284b0652cbd37a8190a66860d766598b 100644 --- a/macro/beamtime/pl_over_trk.C +++ b/macro/beamtime/pl_over_trk.C @@ -193,6 +193,7 @@ void pl_over_trk(Int_t NSt = 4) { can->cd(13); gROOT->cd(); + /************* hname = Form("hTrklTtHMul"); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { @@ -201,6 +202,15 @@ void pl_over_trk(Int_t NSt = 4) { } else { cout << hname << " not found" << endl; } + */ + hname = Form("hCalR0"); + h1 = (TH1*) gROOT->FindObjectAny(hname); + if (h1 != NULL) { + h1->Draw(""); + gPad->SetLogy(); + } else { + cout << hname << " not found" << endl; + } can->cd(14); gROOT->cd(); diff --git a/macro/beamtime/pl_pull_trk.C b/macro/beamtime/pl_pull_trk.C index 5ef13fb643d0881afa1c606417d2bef87b409e6b..233406789cfa2a8d605cf2bea61b6c7b9137fbc5 100644 --- a/macro/beamtime/pl_pull_trk.C +++ b/macro/beamtime/pl_pull_trk.C @@ -1,4 +1,4 @@ -void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { +void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0, Int_t iDrop=-1) { // TCanvas *can = new TCanvas("can22","can22"); // can->Divide(2,2); TCanvas* can = new TCanvas("can", "can", 50, 0, 800, 800); @@ -32,6 +32,7 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { Double_t vResErr[MSt]; // if (h!=NULL) h->Delete(); Int_t iCan = 1; + Int_t iIndSt=0; TString var; Double_t Nall; @@ -42,7 +43,6 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { case 3: var = "T"; break; case 4: var = "TB"; break; } - for (Int_t iSt = 0; iSt < NSt; iSt++) { can->cd(iCan++); gROOT->cd(); @@ -56,28 +56,36 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { if (iFit > 0) { Double_t dFMean = h1->GetMean(); Double_t dFLim = 3.0 * h1->GetRMS(); + Double_t dBinSize = h1->GetBinWidth(1); + dFLim=TMath::Max(dFLim,5.*dBinSize); TFitResultPtr fRes = h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); //cout << " fRes = "<< fRes <<endl; if (-1 == fRes) return; - vSt[iSt] = iSt; - vMean[iSt] = fRes->Parameter(1); - vSig[iSt] = fRes->Parameter(2); - vStErr[iSt] = 0.; - vMeanErr[iSt] = fRes->ParError(1); - vSigErr[iSt] = fRes->ParError(2); - //vSig[iSt]=TMath::Max(20.,vSig[iSt]); + if ( iDrop == iSt ) { // drop station from deconvolution + continue; + } + cout << "Add " << iSt << " as station index " << iIndSt << endl; + vSt[iIndSt] = iSt; + vMean[iIndSt] = fRes->Parameter(1); + vSig[iIndSt] = fRes->Parameter(2); + vStErr[iIndSt] = 0.; + vMeanErr[iIndSt] = fRes->ParError(1); + vSigErr[iIndSt] = fRes->ParError(2); + //vSig[iIndSt]=TMath::Max(20.,vSig[iSt]); + iIndSt++; } } else { cout << hname << " not found" << endl; } } if (0 == iFit) return; + cout << "Process " << iIndSt << " fit values " << endl; can->cd(iCan++); Double_t dLMargin = 0.35; Double_t dTitOffset = 1.8; gPad->SetLeftMargin(dLMargin); - TGraphErrors* grm = new TGraphErrors(NSt, vSt, vMean, vStErr, vMeanErr); + TGraphErrors* grm = new TGraphErrors(iIndSt, vSt, vMean, vStErr, vMeanErr); grm->SetTitle("Mean"); grm->GetXaxis()->SetTitle("Station number"); switch (iVar) { @@ -93,7 +101,7 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { can->cd(iCan++); gPad->SetLeftMargin(dLMargin); - TGraphErrors* grs = new TGraphErrors(NSt, vSt, vSig, vStErr, vSigErr); + TGraphErrors* grs = new TGraphErrors(iIndSt, vSt, vSig, vStErr, vSigErr); grs->SetTitle("Gaussian width"); grs->GetXaxis()->SetTitle("Station number"); switch (iVar) { @@ -109,10 +117,10 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { can->cd(iCan++); gPad->SetLeftMargin(dLMargin); - Double_t val = (NSt - 1) * (NSt - 1); - TMatrixD a(NSt, NSt); - for (Int_t i = 0; i < NSt; i++) - for (Int_t j = 0; j < NSt; j++) { + Double_t val = (iIndSt - 1) * (iIndSt - 1); + TMatrixD a(iIndSt, iIndSt); + for (Int_t i = 0; i < iIndSt; i++) + for (Int_t j = 0; j < iIndSt; j++) { if (i == j) { a[i][j] = 1; } else { @@ -127,8 +135,8 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { ainv.Invert(); ainv.Draw("colz"); ainv.Print(); - TMatrixD aSig(NSt, 1); - for (Int_t i = 0; i < NSt; i++) + TMatrixD aSig(iIndSt, 1); + for (Int_t i = 0; i < iIndSt; i++) aSig[i][0] = vSig[i] * vSig[i]; cout << "Measured gaussian widths: " << endl; @@ -138,11 +146,11 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { xRes.Print(); //can->cd(iCan++); - for (Int_t i = 0; i < NSt; i++) { + for (Int_t i = 0; i < iIndSt; i++) { vRes[i] = TMath::Sqrt(TMath::Abs(xRes[i][0])); vResErr[i] = vSigErr[i]; } - TGraphErrors* grr = new TGraphErrors(NSt, vSt, vRes, vStErr, vResErr); + TGraphErrors* grr = new TGraphErrors(iIndSt, vSt, vRes, vStErr, vResErr); grr->SetTitle("Final resolution"); grr->GetXaxis()->SetTitle("Station number"); switch (iVar) { @@ -157,7 +165,7 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { grr->SetMarkerStyle(24); grr->Draw("APLE"); - for (Int_t i = 0; i < NSt; i++) + for (Int_t i = 0; i < iIndSt; i++) cout << Form( "GMean %6.3f +/- %6.5f, GSig: %6.3f +/- %6.5f => ResC %d: %6.3f ", vMean[i], @@ -169,7 +177,7 @@ void pl_pull_trk(Int_t NSt = 8, Int_t iVar = 0, Int_t iFit = 0) { << endl; cout << "Res-summary " << iVar << ": Nall, sigs = " << Nall; - for (Int_t i = 0; i < NSt; i++) + for (Int_t i = 0; i < iIndSt; i++) cout << Form(", %7.4f", vRes[i]); cout << endl; diff --git a/macro/beamtime/pl_vert_trk.C b/macro/beamtime/pl_vert_trk.C index b4cb95b2dc236934f2831695eb7f86def23b4e3e..49121bf97af3e4d2eedbed025791f725a20f938f 100644 --- a/macro/beamtime/pl_vert_trk.C +++ b/macro/beamtime/pl_vert_trk.C @@ -18,7 +18,7 @@ void pl_vert_trk() { can->cd(1); gROOT->cd(); - TString hname = Form("hTrklXY0_3"); + TString hname = Form("hTrklXY0_0"); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); @@ -29,22 +29,111 @@ void pl_vert_trk() { can->cd(2); gROOT->cd(); - hname = Form("hTrklXY0_4"); - h2 = (TH2*) gROOT->FindObjectAny(hname); - if (h2 != NULL) { - h2->Draw("colz"); - gPad->SetLogz(); - } else { - cout << hname << " not found" << endl; + Double_t MeanX0=0.; + Double_t SigX0=0.; + Double_t MeanX0Err=0.; + Double_t SigX0Err=0.; + h1 = (TH1*) h2->ProjectionX(); + if (h1 != NULL) { + Double_t dFMean = h1->GetMean(); + Double_t dFLim = 3.0 * h1->GetRMS(); + dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); + dFLim=15.; + TFitResultPtr fRes = + h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); + //cout << " fRes = "<< fRes <<endl; + if (-1 != fRes) { + MeanX0 = fRes->Parameter(1); + SigX0 = fRes->Parameter(2); + MeanX0Err = 0.; + MeanX0Err = fRes->ParError(1); + SigX0Err = fRes->ParError(2); + } } + Double_t MeanY0=0.; + Double_t SigY0=0.; + Double_t MeanY0Err=0.; + Double_t SigY0Err=0.; + h1 = (TH1*) h2->ProjectionY(); + if (h1 != NULL) { + Double_t dFMean = h1->GetMean(); + Double_t dFLim = 3.0 * h1->GetRMS(); + dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); + dFLim=15.; + TFitResultPtr fRes = + h1->Fit("gaus", "S", "same", dFMean - dFLim, dFMean + dFLim); + h1->SetLineColor(7); + //cout << " fRes = "<< fRes <<endl; + if (-1 != fRes) { + MeanY0 = fRes->Parameter(1); + SigY0 = fRes->Parameter(2); + MeanY0Err = 0.; + MeanY0Err = fRes->ParError(1); + SigY0Err = fRes->ParError(2); + } + } + + + cout << Form("TrkXY0_0: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",MeanX0, MeanX0Err, SigX0, SigX0Err) + << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",MeanY0, MeanY0Err, SigY0, SigY0Err) << endl; + can->cd(3); gROOT->cd(); - hname = Form("hTrklXY0_5"); + hname = Form("hTrklXY0_1"); h2 = (TH2*) gROOT->FindObjectAny(hname); if (h2 != NULL) { h2->Draw("colz"); gPad->SetLogz(); + Double_t MeanX1=0.; + Double_t SigX1=0.; + Double_t MeanX1Err=0.; + Double_t SigX1Err=0.; + h1 = (TH1*) h2->ProjectionX(); + if (h1 != NULL) { + Double_t dFMean = h1->GetMean(); + Double_t dFLim = 3.0 * h1->GetRMS(); + dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); + dFLim=15.; + TFitResultPtr fRes = + h1->Fit("gaus", "S", "", dFMean - dFLim, dFMean + dFLim); + //cout << " fRes = "<< fRes <<endl; + if (-1 != fRes) { + MeanX1 = fRes->Parameter(1); + SigX1 = fRes->Parameter(2); + MeanX1Err = 0.; + MeanX1Err = fRes->ParError(1); + SigX1Err = fRes->ParError(2); + } + + Double_t MeanY1=0.; + Double_t SigY1=0.; + Double_t MeanY1Err=0.; + Double_t SigY1Err=0.; + h1 = (TH1*) h2->ProjectionY(); + if (h1 != NULL) { + Double_t dFMean = h1->GetMean(); + Double_t dFLim = 3.0 * h1->GetRMS(); + dFMean=h1->GetBinCenter( h1-> GetMaximumBin() ); + dFLim=15.; + TFitResultPtr fRes = + h1->Fit("gaus", "S", "same", dFMean - dFLim, dFMean + dFLim); + h1->SetLineColor(7); + //cout << " fRes = "<< fRes <<endl; + if (-1 != fRes) { + MeanY1 = fRes->Parameter(1); + SigY1 = fRes->Parameter(2); + MeanY1Err = 0.; + MeanY1Err = fRes->ParError(1); + SigY1Err = fRes->ParError(2); + } + } + + cout << Form("TrkXY0_1: MeanX %6.2f (%5.2f), SigX %6.2f (%5.2f) ",MeanX1, MeanX1Err, SigX1, SigX1Err) + << Form(" MeanY %6.2f (%5.2f), SigY %6.2f (%5.2f) ",MeanY1, MeanY1Err, SigY1, SigY1Err) << endl; + + } + } else { cout << hname << " not found" << endl; } @@ -115,4 +204,5 @@ void pl_vert_trk() { cout << hname << " not found" << endl; } can->SaveAs(Form("pl_vtx.pdf")); + } diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_mcbm.C index c7ca105b6c3a9f51ccfb8800a44b1138cae8d4d2..376674e6d860d794599e8c8357a321b2ebd6378a 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_mcbm.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20a_mcbm.C @@ -210,7 +210,7 @@ const Float_t Outer_Module_Number[Outer_Module_NTypes][Outer_Module_Col] = const Float_t Star2_First_Z_Position = TOF_Z_Front + 34.; const Float_t Star2_Delta_Z_Position = 0.; -const Float_t Star2_First_Y_Position = 32.; // +const Float_t Star2_First_Y_Position = 30.; //32. const Float_t Star2_Delta_Y_Position = 0.; // const Float_t Star2_rotate_Z = -90.; const Int_t Star2_NTypes = 1; @@ -316,7 +316,7 @@ void Create_TOF_Geometry_v20a_mcbm() { TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); TGeoRotation* stand_rot = new TGeoRotation(); - stand_rot->RotateY(-3.0); //-2.7); + stand_rot->RotateY(-3.0); TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot); //tof->AddNode(tofstand, 1, stand_combi_trans); diff --git a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C index 836416d775d3661df36c25750f2c1eb05000ec80..1f25574ab2f1fea1c78afff400dd89cffead7e35 100644 --- a/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C +++ b/macro/mcbm/geometry/tof/Create_TOF_Geometry_v20b_mcbm.C @@ -325,9 +325,9 @@ void Create_TOF_Geometry_v20b_mcbm() { new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); // Nov 2019 run // TGeoTranslation* stand_trans = new TGeoTranslation("", 12., 0., TOF_Z_Front_Stand); - // TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); + // TGeoTranslation* stand_trans = new TGeoTranslation("", 0., 0., TOF_Z_Front_Stand); TGeoRotation* stand_rot = new TGeoRotation(); - stand_rot->RotateY(-3.0); //-2.7); + stand_rot->RotateY(-1.5); //-2.7); TGeoCombiTrans* stand_combi_trans = new TGeoCombiTrans(*stand_trans, *stand_rot); //tof->AddNode(tofstand, 1, stand_combi_trans);