//////////////////////////////////////////////////////////////////// // // Using: // root [0] .x target.C(); // or // root [0] .x target.C("file_name"); // or // root [0] .x target.C("file_name","inDir_name"); // //////////////////////////////////////////////////////////////////// #include "targetMonGrep.h" #include "rpcdef.h" #include "tofdef.h" #include "htofdetector.h" #include "hrpcdetector.h" #include "hldfilesource.h" #include "htoftrb2unpacker.h" #include "hrpctrb2unpacker.h" #include "hflexfiller.h" //#include "selectMultiplicity.C" #include "htboxunpacker.h" #include "hdst.h" #include "hmdctrackdset.h" // #include "TRint.h" // #include "TThread.h" //TThread *thread; TString fileName("be1834507002801.hld"); //be1209600021302.hld"); //no field //TString inputDir("../hld"); // Default input hld files directory TString inputDir("/lustre/hebe/hades/raw/jul18/default/tsm"); // Default input hld files directory Bool_t getMonParamFromFile = kTRUE; TString monitorParametersFile("./vertexReconstrParam.txt"); Int_t nFiles = 8; const Char_t* inFiles[8] = { // "be1834507015301.hld", // "be1834507015302.hld", // "be1834507015303.hld", // "be1834507015305.hld", // "be1834507015306.hld", // "be1834507015307.hld", // "be1834507015309.hld", // "be1834507015310.hld" "be1834505012201.hld", "be1834505020901.hld", "be1834505025701.hld", "be1834505034601.hld", "be1834505043601.hld", "be1834505052101.hld", "be1834505060801.hld", "be1834505065801.hld" }; //============================================================================ //============================================================================ //============================================================================ void setMonParam(HMdcTargetMon* targetMon) { Int_t nLayers[6][4]={ {0,6,0,6}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0} }; HMdcTrackDSet::setTrFnNLayers(nLayers[0]); Int_t level4s1 = 5; Int_t level5s1 = 20; Int_t level4s2 = 5; Int_t level5s2 = 20; HMdcTrackDSet::setTrackFinderLevel(level4s1, level5s1, level4s2, level5s2); //============================================================================ Int_t numEventsSave = 900; // Save canvas each "numEventsSave" events Int_t trBits = 8192; //-1; //2048+8192; // select events with setted bits //======= Histogramm Z' parameters: ========================================== Int_t nBins = 800; // 400; // Number of bins Double_t zMin = -200.; //-600.; //-250.; // Low limit Double_t zMax = 600.; // 500.; //+150.; // Up limit //======= Collect and save each "numRunsCollect" runs: ======================= Int_t numRunsCollect = 100; //======= Histogramm num.tracks_in_target_region / total_number_of_tracks : == Int_t nRunsDraw = 5; // Show "nnRunsDraw" runs (<2 - no hist.) Double_t lowTargetPoint = -90.; //-55.; // Target regioh Double_t upTargetPoint = 10.; //50.; // -/- //======= Canvas size: ======================================================= Int_t canvasWidth = 750; Int_t canvasHeight = 400; //======= Dir.names for figures (=0 - save to the current dir.): ============= const Char_t* pathForHistOneRun = "./figure"; // For one run const Char_t* pathForHistSumRun = "./figure"; // For sum of runs //------- Save canvases as ... // Example: // saveAs = ".jpg.root.pdf"; - save canvases as jpg, ROOT and pdf files. const Char_t* saveAs = ".jpg"; // save canvases as PS, EPS and ROOT files //======= Histogramm type: =================================================== Int_t histType = 0; // default type // = 1 - histogramms for triggered and downScaled events // = 2 - histogramms for each trigger condition //======= Cut for minimal distance from track to the beam line: ============== Double_t r0Cut = 5.; //10.; //20.; //======= Set target position instead position in rtdb: ====================== // Bool_t setTargetPos[6] = {kTRUE,kTRUE,kTRUE,kTRUE,kTRUE,kTRUE}; // =kFALSE - use rtdb pos.// Bool_t setTargetPos[6] = {kFALSE,kFALSE,kFALSE,kFALSE,kFALSE,kFALSE}; // =kFALSE - use rtdb pos.// Double_t xTarg[6] = { 0., 0., 0., 0., 0., 0.}; Double_t yTarg[6] = { 0., 0., 0., 0., 0., 0.}; Double_t zTarg[6] = { -85., -85., -85., -85., -85., -85.}; //============================================================================ targetMon->setHistPar(nBins,zMin,zMax); if(trBits!=-1) targetMon->selectEventWithTBits(trBits); if(histType==1) targetMon->drawDownScalHist(); if(histType==2) targetMon->drawTrigCondHist(); for(Int_t s=0;s<6;s++) if(setTargetPos[s]) targetMon->setTargPos(xTarg[s],yTarg[s],zTarg[s],s); if(r0Cut>1.) targetMon->setRCut(r0Cut); targetMon->setMode(kFALSE); targetMon->setDrawEachRun(); targetMon->setEachNEventsSave(numEventsSave); targetMon->setCollectNRuns(numRunsCollect); targetMon->setCanvasSize(canvasWidth,canvasHeight); targetMon->doNormalization(kTRUE); // targetMon->doNormalization(kFALSE); if(pathForHistOneRun) targetMon->setPathOneRunHist (pathForHistOneRun); if(pathForHistSumRun) targetMon->setPathSumRunsHist(pathForHistSumRun); if(nRunsDraw>2) targetMon->setTargetZRegion(lowTargetPoint, upTargetPoint,nRunsDraw); targetMon->setGraphicFormat(saveAs); } //========================================================================================== //========================================================================================== //========================================================================================== void targetMon(Char_t* fileI=NULL) { TString beamtime = "aug18"; Int_t maxNumEv = kMaxInt; //5000000; // Limit for number of events Int_t refrunID = 208536802; //-1000 !!!!!!!!!!!!! TString paramrelease = "now"; // now, APR12_gen2_dst //======= Save tracks segments to the output tree: =========================== Bool_t maketree = kFALSE; TString outDir = "./"; // default dir.for output files TString outFileSuffix = "_dst.root"; //======= Parameters input files: ============================================ TString paramSource = "ascii,root"; // root, ascii, oracle TString asciiParFile = "./all_params_ver2.txt"; TString rootParFile = "./allParam_AUG18_gen0_09072018_170916.root"; //======= List of mdc modules: =============================================== // Int_t mdcMods[6][4]= { // {1,1,1,1}, // {1,1,1,1}, // {1,1,1,1}, // {1,1,1,1}, // {1,1,1,1}, // {1,1,1,1} }; //======= Mdc drift time cuts: =============================================== Bool_t doDriftTimeCuts = kTRUE; // kFALSE - don't do drift time cuts Bool_t setDrTimeCutsHere = kTRUE; // kFALSE; // kTRUE - setting of cut parameters in // this macro. Otherwise - rtdb // Cuts: // [4] - 4 mdc planes // cutTime1Low[mdc]-cutTime1Up[mdc] - cut for time1 // cutTime2Low[mdc]-cutTime2Up[mdc] - cut for time2 // cutTAbThreshLowmdc]-cutTAbThreshUp[mdc] - cut for time above threshold Float_t cutTime1Low[4] = { -80., -90., -90., -100.}; Float_t cutTime1Up[4] = { 1100., 1200., 1700., 1700.}; Float_t cutTime2Low[4] = {-2000.,-2000.,-2000.,-2000.}; Float_t cutTime2Up[4] = { 2000., 2000., 2000., 2000.}; Float_t cutTAbThreshLow[4] = { 22., 24., 26., 38.}; Float_t cutTAbThreshUp[4] = { 500., 500., 600., 700.}; Float_t cutReplace [4] = { 0., 0., 0., 0.}; // Mdc drift time calibration: // calibrater1Ver = 1 - No Start and Cal (default) // calibrater1Ver = 2 - Start and Cal // calibrater1Ver = 3 - No Start and no Cal Int_t calibrater1Ver = 1; // ATTENTION!!! ORACLE keep drift time cuts for calibrated drift time. // If doDriftTimeCuts=kTRUE and setDrTimeCutsHere=kFALSE // use calibrater1Ver = 1 or 2 only (not 3!). //=Parameters of track finder: ======================================== Bool_t isCoilOff = kTRUE; //kTRUE; // kTRUE - current in coil is switched off //====================================================================== HMdcTargetMon* targetMon; //====================================================================== gStyle->SetPalette(1); new Hades(); gHades->setQuietMode(); //(2); !!!!!!!!!!!!!!!! //?? Int_t splitLevel=2; //?? gHades->setSplitLevel(splitLevel); // HDst::setupSpectrometer(beamtime,mdcMods,"mdc,start,tbox,tof,rpc"); // HDst::setupSpectrometer(beamtime,mdcMods,"mdc"); HDst::setupSpectrometer(beamtime,NULL,"mdc"); // Int_t mdcset[6][4] setup mdc. If not used put NULL (default). // if not NULL it will overwrite settings given by beamtime // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,start HDst::setupParameterSources(paramSource,asciiParFile,rootParFile,paramrelease); // now, APR12_gen2_dst //HDst::setupParameterSources("oracle",asciiParFile,rootParFile,"now"); // use to create param file // parsource = oracle,ascii,root (order matters) // if source is "ascii" a ascii param file has to provided // if source is "root" a root param file has to provided // The histDate paramter (default "now") is used wit the oracle source //Set HldStream data source /* HldStreamSource* source = new HldStreamSource(eventbuilder.Data()+7,2.); source->setRefId(refrunID); gHades->setDataSource(source); */ //Set the data source (here from Lmd file) /* Char_t opt[100]; sprintf(opt,"File: %s",fileName.Data()); sprintf(opt,"Date: 13/11/2010 11:23:00"); HldGrepFileSource *source=new HldGrepFileSource(inputDir.Data(),opt,4,refrunID,1,1); source->setMaxEventPerFile(maxNumEv); gHades->setDataSource(source); */ // Data source settings: if(fileI != NULL) { HDst::setDataSource(0,inputDir.Data(),fileI,refrunID); // Int_t sourceType,TString inDir,TString inFile,Int_t refrunId, TString eventbuilder" } else { Int_t numInFiles = sizeof(inFiles)/sizeof(*inFiles); HDst::setDataSource(0,inputDir.Data(),inFiles[0],refrunID); for(Int_t n=1;ngetDataSource())->addFile(inFiles[n],refrunID); fileName = inFiles[0]; } // Unpackers: //HDst::setupUnpackers(beamtime,"mdc,tbox,latch,start,tof,rpc"); // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,latch,start HDst::setupUnpackers(beamtime,"mdc,latch"); // detectors (default)= rich,mdc,tof,rpc,shower,wall,tbox,latch,start // Drift time cuts setting:----------------------------------------- if(doDriftTimeCuts && setDrTimeCutsHere) { HMdcTimeCut* fcut=new HMdcTimeCut(); gHades->getRuntimeDb()->addContainer(fcut); fcut->setCut(cutTime1Low,cutTime1Up, cutTime2Low,cutTime2Up, cutTAbThreshLow,cutTAbThreshUp, cutReplace,cutReplace,cutReplace,cutReplace); fcut->setStatic(kTRUE); } // Tasks:-------------------------------------------------------------- HMdcTrackFinder* trackFinder; HTaskSet* tasks = new HTaskSet("MDC","Mdc Track Finding Display"); // HFlexFiller* flexfiller = new HFlexFiller("FlexFiller","FlexFiller"); // flexfiller->setUserFill(selectMultiplicity,NULL,NULL,kFALSE); // function,HHIstMap*,TObjArray*,CreateFlexCat // tasks->add(flexfiller); tasks->add(new HMdcCalibrater1("MdcCali1","MdcCali1",calibrater1Ver, doDriftTimeCuts ? 1:0));; tasks->add(trackFinder=new HMdcTrackFinder("MdcTrackD","MdcTrackD",isCoilOff,1)); tasks->add(new HMdcClusterToHit("ClHit","ClHit",-1,-1)); tasks->add(targetMon=new HMdcTargetMon("TargMon","TargMon",isCoilOff,2)); if(maketree) { tasks->add(new HMdcVertexFind("vertexfinder","vertexfinder",HMdcVertexFind::kSegments,kTRUE)); } gHades->getTaskSet("real")->connect(tasks); gHades->getTaskSet("real")->print(); // -------------------------------------------------------------------- if(getMonParamFromFile) targetMon->readMonParam(monitorParametersFile); else setMonParam(targetMon); if(maketree) targetMon->setFillSegFlag(); // -------------------------------------------------------------------- if (!gHades->init()) { Error("init()","Hades did not initialize ..."); exit(1); } // Set output file:------------------------------------------------- if(maketree) { // gHades->setTreeBufferSize(8000); // HEvent *event = gHades->getCurrentEvent(); // event->getCategory(catMdcRaw)->setPersistency(kFALSE); // event->getCategory(catMdcCal1)->setPersistency(kFALSE); // event->getCategory(catMdcClusInf)->setPersistency(kFALSE); Int_t compLevel = 2; TString outFile = outDir+fileName+outFileSuffix; gHades->setOutputFile((Text_t*)outFile.Data(),"RECREATE",(Text_t*)"runs",compLevel); gHades->makeTree(); } gHades->eventLoop(maxNumEv); // delete gHades; return; }