// from ROOT #include "TObjString.h" #include "TString.h" #include "TSystem.h" #include "TTree.h" #include "TVector3.h" // from hydra #include "showerdef.h" #include "hstartdef.h" #include "tofdef.h" #include "walldef.h" #include "rpcdef.h" #include "richdef.h" #include "hmdcdef.h" #include "hmdctrackddef.h" #include "hmdctrackgfieldpar.h" #include "hparticledef.h" #include "hphysicsconstants.h" #include "hkaldef.h" #include "createHades.C" #include using namespace std; void exKal() { // Number of events to analyze. const Int_t nEvents = 100; const Int_t refID = 11200; // Magnetic field factor. Double_t scaleFactor = 0.9235; // Print a message after each counterstep events. Int_t counterstep = 100; // Parameter source. TString paramSource = "ASCII, ORACLE"; // Oracle date. TString oraDate = "31-DEC-2011"; // Input directory and files. TString inputDir = "/hera/hades/user/kempter/kalman/new/geant/bmax4/"; // each file contains 10000 events const Int_t nEventsPerFile = 10000; const Int_t nFiles = TMath::Max(1, 2 * nEvents / nEventsPerFile); TObjArray inputFiles(nFiles); // index of input file array Int_t iArr = 0; // file name index Int_t iFile = 1; // Loop through files. Stop when array is full or all files in the directory are added. while((iArr < nFiles) && (iFile <= 10000)) { // Input files. TObjString *file1 = new TObjString(Form("Au_Au_1250MeV_10000evts_ep_%i_1.root", iFile)); TObjString *file2 = new TObjString(Form("Au_Au_1250MeV_10000evts_ep_%i_2.root", iFile)); // Check if files are really there. if(gSystem->AccessPathName(gSystem->ConcatFileName(inputDir.Data(), file1->GetString().Data())) || gSystem->AccessPathName(gSystem->ConcatFileName(inputDir.Data(), file2->GetString().Data()))) { cout<<"could not find file "<1: print errors and warnings. Int_t verb = 0; //---------------------------------------------------------- // CREATE HADES if(!createHades(inputDir, inputFiles, refID, paramSource, oraDate, errX, errY, bUseAuAuPars, bIdealTracking, bFitWireHits, bDoDaf, bCompHits)) { Error("", "Failed to create Hades!."); exit(1); } //----------------------------------------------------------------------------// //---------------------------------------------------------- // Persistent categories Cat_t notPersistentCat[] = { catRich, catMdc, catShower, catTof, catTracks, catRichRaw, catRichDirClus, catRichHitHdr, catRichHit, catRichCal, catMdcRaw, //catMdcCal1, catMdcCal2, catMdcRawEventHeader, catMdcTrkCand, catMdcHit, catMdcSeg, catShowerCal, catShowerPID, catShowerHitHdr, catShowerRaw, catShowerHit, catTofRaw, catTofHit, catTofCluster, catRpcRaw, catRpcHit, catRpcCluster, //catRKTrackB, catSplineTrack, catMetaMatch, //catParticleCandidate, catParticleEvtInfo, catWallRaw, catWallOneHit, catWallCal, catStart2Raw, catStart2Cal, catStart2Hit, catTBoxChan }; for(UInt_t i = 0; i < sizeof(notPersistentCat) / sizeof(Cat_t); i++){ HCategory *cat = ((HCategory *)gHades->getCurrentEvent()->getCategory(notPersistentCat[i])); if(cat) cat->setPersistency(kFALSE); } //----------------------------------------------------------------------------// //---------------------------------------------------------- // Set up Kalman filter. HKalFilterTask* kalFilter = (HKalFilterTask*) gHades->getTask("KalmanFilterTask"); if(!kalFilter) { cout<<"HKalFilterTask not found."<setCounterStep(counterstep); kalFilter->setDafPars(dafChi2Cut, &dafT[0], nDafs); kalFilter->setDirection(dir); kalFilter->setDoPid(&pid[0], nPids); kalFilter->setDoEnerLoss(bDoEnerLoss); kalFilter->setDoMultScat(bDoMultScat); kalFilter->setErrors(errX, errY, TMath::Tan(0.5*TMath::DegToRad()), TMath::Tan(0.5*TMath::DegToRad()), errMom); kalFilter->setFillSites(kTRUE); kalFilter->setFilterMethod(filtType); kalFilter->setNumIterations(nIter); kalFilter->setRotation(rot); kalFilter->setVerbose(verb); //----------------------------------------------------------------------------// HRuntimeDb *rtdb = gHades->getRuntimeDb(); HMdcTrackGFieldPar *pField = (HMdcTrackGFieldPar*)(rtdb->getContainer("MdcTrackGFieldPar")); kalFilter->setFieldMap(pField->getPointer(), scaleFactor); if(gSystem->AccessPathName(outDir.Data())) { Error("createHades()", "Could not access output directory."); exit(1); } gHades->setOutputFile((Text_t*)gSystem->ConcatFileName(outDir.Data(), outFile.Data()), "RECREATE", "Test", 2); gHades->makeTree(); gHades->eventLoop(nEvents); delete gHades; }