// ------------------------------------------------------------------------- // ----- PndLmdTrackFinderCATask ----- // ----- Created 18/05/11 by A. Karavdina ----- // ------------------------------------------------------------------------- #include #include "TClonesArray.h" #include "TArrayD.h" #include "TVectorD.h" #include "TGeoManager.h" #include "FairRootManager.h" #include "FairRun.h" #include "FairRuntimeDb.h" #include "PndLmdTrackFinderCATask.h" #include "PndSdsDigiStrip.h" #include "TStopwatch.h" #include "PndLmdDim.h" // #include "PndSdsPixelCluster.h" // ----- Default constructor ------------------------------------------- PndLmdTrackFinderCATask::PndLmdTrackFinderCATask() : FairTask("LMD Track Finding Task (Cellular Automation)") { missPlAlgo = false; flagTrkCandCuts=true; fHitBranchStrip = "LMDHitsStrip"; fClusterBranchStrip = "LMDStripClusterCand"; fDigiBranchStrip = "LMDStripDigis"; dXY = 0.5; rule_max = 1e-6; // hdist = new TH1D("hdist","distance from common point",1e4,0,10.); // hcosPSI = new TH1D("hcosPSI","",1e4,0,1e-4); // // htthetatphi = new TNtuple("htthetatphi","ntthetatphi","tg_theta:tg_phi"); // htthetatphiTrk = new TNtuple("htthetatphiTrk","ntthetatphiTrk","tg_theta:tg_phi:nHits"); // htthetatphiCells = new TNtuple("htthetatphiCells","ntthetatphiCells","tg_theta:tg_phi:x0:y0:z0:x1:y1:z1"); // // hthetaphi = new TH2D("hthetaphi",";#theta;#phi",1e3,0,1.,1e3,-3.15,3.15); // /// hcosPSI = new TH1D("hcosPSI","breaking angle",1e3,-1.5,1.5); // // htheta = new TH2D("htheta",";length;#theta angle",1e3,0,25,1e3,0,3.15); // // htime = new TH2D("htime",";time distance;time angle",1e2,0,10,1e2,0,10); nSensPP = 8; nP = 4; flagStipSens = false; flagPixelSens = false; // dXY = 0.01;//TEST } // ------------------------------------------------------------------------- // ----- Constructor ------------------------------------------- PndLmdTrackFinderCATask::PndLmdTrackFinderCATask(const bool missPl, const double setdmax, int innSensPP, int innP, TString hitBranch, TString clusterBranch, TString digiBranch) : FairTask("LMD Track Finding Task (Cellular Automation) with/without <> algoritm") { missPlAlgo = missPl; // fHitBranchStrip = "LMDHitsStrip"; // fClusterBranchStrip = "LMDStripClusterCand"; // fDigiBranchStrip = "LMDStripDigis"; fHitBranchStrip = hitBranch; fClusterBranchStrip = clusterBranch; fDigiBranchStrip = digiBranch; dXY = 0.5; // hdist = new TH1D("hdist","distance from common point",1e3,0,1.); // // htthetatphi = new TH2D("htthetatphi",";tg#theta;tg#phi",1e3,0,10,1e3,-10,10); // htthetatphiTrk = new TNtuple("htthetatphiTrk","ntthetatphiTrk","tg_theta:tg_phi:nHits"); // htthetatphiCells = new TNtuple("htthetatphiCells","ntthetatphiCells","tg_theta:tg_phi:x0:y0:z0:x1:y1:z1"); // // hthetaphi = new TH2D("hthetaphi",";#theta;#phi",1e3,0,1.,1e3,-3.15,3.15); // hcosPSI= new TH1D("hcosPSI","",1e4,0,1e-4); // // hcosPSI = new TH1D("hcosPSI","breaking angle",1e3,-1.5,1.5); // // htheta = new TH2D("htheta",";length;#theta angle",1e3,0,25,1e3,0,3.15); // // htime = new TH2D("htime",";time distance, ns;time angle,ns",5e3,0,5e3,5e3,0,5e3); rule_max = setdmax; nSensPP = innSensPP; nP = innP; flagStipSens = false;//default flagPixelSens = true;//default // dXY = 0.01;//TEST } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- PndLmdTrackFinderCATask::~PndLmdTrackFinderCATask() { // if(fVerbose<2) { // delete hdist; // delete htthetatphi; // delete hthetaphi; // } // else{ // } } // ------------------------------------------------------------------------- // ----- Initialization of Parameter Containers ------------------------- void PndLmdTrackFinderCATask::SetParContainers() { // Get Base Container /* FairRun* ana = FairRun::Instance(); FairRuntimeDb* rtdb=ana->GetRuntimeDb(); fGeoPar = (PndSdsGeoPar*)(rtdb->getContainer("PndSdsGeoPar")); */ } InitStatus PndLmdTrackFinderCATask::ReInit() { InitStatus stat=kERROR; return stat; /* FairRun* ana = FairRun::Instance(); FairRuntimeDb* rtdb=ana->GetRuntimeDb(); fGeoPar=(PndSdsGeoPar*)(rtdb->getContainer("PndSdsGeoPar")); return kSUCCESS; */ } // ----- Private method SortHitsByDet -------------------------------------------- bool PndLmdTrackFinderCATask::SortHitsByDet(std::vector< std::vector < std::pair > > &hitsd, Int_t nStripHits) { Int_t nPlanes=0; //sort in plane's for(Int_t iHit = 0; iHit < nStripHits; iHit++){ PndSdsHit* myHit = (PndSdsHit*)(fStripHitArray->At(iHit)); Int_t sensid = myHit->GetSensorID(); // Sensors: 1..32 Int_t planeid = floor((sensid)/(double)nSensPP); //nSensPP sensors/plane => Planes: 0..3 hitsd.at(planeid).push_back( make_pair (iHit,false) ); } for(Int_t iPlane = 0; iPlane < nP; iPlane++){ if(hitsd.at(iPlane).size()>0) nPlanes++; } // cout << "Hits: " << nStripHits << endl; if(fVerbose>2) { cout << "Hits: " << nStripHits << " in " << nPlanes << " plane(s)." << endl; for(Int_t idet = 0; idet < nP; idet++) cout << "Plane: "<< idet <<" DiscHits: "<< hitsd.at(idet).size() <2) return true; return false; } // ------------------------------------------------------------------------- // ----- Private method SortHitsByDet -------------------------------------------- bool PndLmdTrackFinderCATask::SortHitsByDetSimple(std::vector< std::vector< Int_t > > &hitsd, Int_t nStripHits) { // cout<<"PndLmdTrackFinderCATask::SortHitsByDetSimple! nStripHits = "<At(iHit)); Int_t sensid = myHit->GetSensorID(); // Sensors: 1..32 // cout<<"sensid = "< Planes: 0..3 // cout<<" planeid = "<< planeid<0) nPlanes++; // cout<<"nPlanes = "<2) { cout << "Hits: " << nStripHits << " in " << nPlanes << " plane(s)." << endl; for(Int_t idet = 0; idet < nP; idet++) cout << "Plane: "<< idet <<" DiscHits: "<< hitsd.at(idet).size() <2) return true; return false; } // ------------------------------------------------------------------------- // ----- Private method SortHitsByDet -------------------------------------------- bool PndLmdTrackFinderCATask::SortHitsByDetSimple2(std::vector< std::vector< Int_t > > &hitsd, Int_t nStripHits) { // cout<<"PndLmdTrackFinderCATask::SortHitsByDetSimple! nStripHits = "<At(iHit)); Int_t sensid = myHit->GetSensorID(); // Sensors: 1..32 // cout<<"sensid = "< Planes: 0..3 // cout<<" planeid = "<< planeid<Get_sensor_by_id(sensid,ihalf,iplane,imodule,iside,idie,isensor); // hitsd.at(iplane).push_back(iHit); int virtplane = iplane;//merged hits if(nP>4) virtplane = 2*iplane+iside;// single hits hitsd.at(virtplane).push_back(iHit); } for(Int_t iPlane = 0; iPlane < nP; iPlane++){ if(hitsd.at(iPlane).size()>0) nPlanes++; // cout<<"nPlanes = "<2) { cout << "Hits: " << nStripHits << " in " << nPlanes << " plane(s)." << endl; for(Int_t idet = 0; idet < nP; idet++) cout << "Plane: "<< idet <<" DiscHits: "<< hitsd.at(idet).size() <2) return true; return false; } // ------------------------------------------------------------------------- // ----- Private method SortHitsByZ -------------------------------------------- bool PndLmdTrackFinderCATask::SortHitsByZ(std::vector< std::vector< std::pair > > &hitsd, Int_t nStripHits) { std::vector detZ; //find plane positions for (Int_t iHit = 0; iHit < nStripHits; iHit++){ Double_t tmp = ((PndSdsHit*) (fStripHitArray->At(iHit)))->GetZ(); bool newZ = true; for(unsigned int idet = 0; idet < detZ.size(); idet++){ // if(tmp == detZ.at(idet)){ //check if already found // cout<<"tmp = "<2) { cout << "Hits: " << nStripHits << " in " << detZ.size() << " plane(s)." << endl; for(unsigned int idet = 0; idet < detZ.size(); idet++) cout << "Plane: "<< idet <<" DiscHits: "<< hitsd.at(idet).size() <3) return true; return false; } // ------------------------------------------------------------------------- // ----- Public method Init -------------------------------------------- InitStatus PndLmdTrackFinderCATask::Init() { lmddim = PndLmdDim::Instance(); // lmddim -> Read_transformation_matrices("matrices.txt", true); lmddim -> Read_transformation_matrices("matrices_perfect.txt", false); FairRootManager* ioman = FairRootManager::Instance(); if ( ! ioman ) { std::cout << "-E- PndLmdTrackFinderCATask::Init: " << "RootManager not instantiated!" << std::endl; return kFATAL; } // Get input array fStripHitArray = (TClonesArray*) ioman->GetObject(fHitBranchStrip); if ( !fStripHitArray){ std::cout << "-W- PndLmdTrackFinderCATask::Init: " << "No fStripHitArray!" << std::endl; return kERROR; } fStripClusterArray = (TClonesArray*) ioman->GetObject(fClusterBranchStrip); if ( !fStripClusterArray){ std::cout << "-W- PndLmdTrackFinderCATask::Init: " << "No StripclusterArray!" << std::endl; return kERROR; } fStripDigiArray = (TClonesArray*) ioman->GetObject(fDigiBranchStrip); if ( !fStripDigiArray){ std::cout << "-W- PndLmdTrackFinderCATask::Init: " << "No StripdigiArray!" << std::endl; return kERROR; } // fTrackCandArrayTemp = new TClonesArray("PndTrackCand"); //delete it! fTrackCandArray = new TClonesArray("PndTrackCand"); ioman->Register("LMDTrackCand", "PndLmd", fTrackCandArray, kTRUE); std::cout << "-I- PndLmdTrackFinderCATask: Initialisation successfull" << std::endl; if(missPlAlgo) std::cout << "-I- PndLmdTrackFinderCATask: missing plane(s) algorithm will be used" << std::endl; return kSUCCESS; } // ------------------------------------------------------------------------- // ----- Public method Exec -------------------------------------------- void PndLmdTrackFinderCATask::Exec(Option_t* opt) { // TStopwatch *timer_exec = new TStopwatch(); // if(fVerbose>0){ // timer_exec->Start(); // cout << "Evt started--------------"<Clear(); Int_t nStripHits = fStripHitArray->GetEntriesFast(); if(nStripHits<2){ if(fVerbose>2) cout << "Evt finsihed: too less hits-----"<9){ // if(nStripHits!=4){ // cout << "!!! TEST cuts on CA cells Evt finsihed: too many hits-----"< > hitsd(nP); //hit'ids splitted by detectorplane // std::vector< std::vector< std::pair > > hitsd(4); bool resSortHits; if(flagStipSens) resSortHits = SortHitsByDetSimple(hitsd, nStripHits);//! strip sensors else{ if(flagPixelSens) resSortHits = SortHitsByDetSimple2(hitsd, nStripHits);//! pixel sensors else{ std::cout<<"Algorithm depend on sensor type! Please, set it via SetSensStripFlag(bool fS) or SetSensPixelFlag(bool fS)"<2) cout << "Evt finsihed: too less planes-----"<2){ for(Int_t iPlane = 0; iPlane < nP; iPlane++){ if(hitsd.at(iPlane).size()>0){ for (unsigned int i=0; iAt(hitsd.at(iPlane).at(i)); cout<<"Plane"<GetX()<<", "<GetY()<<", "<GetZ()<<") with err=(" <GetDx()<<", "<GetDy()<<", "<GetDz()<<")"<<", MChitID = "<GetRefIndex()<Print(); // timer_array->Stop(); // TStopwatch *timer_cook_cells = new TStopwatch(); // if(fVerbose>0){ // timer_cook_cells->Start(); // } // int Npoints=0; const unsigned int nplanes = nP; // unsigned int NpointsI[nplanes]; std::vector NpointsI; // int cell_arr_size=0; for(unsigned int i=0;i > cells(11,std::vector(cell_arr_size)); // std::vector< std::vector > cells(11,std::vector());//= new std::vector< std::vector > cells(11,std::vector()); std::vector cells0;//x0 std::vector cells1;//y0 std::vector cells2;//z0 std::vector cells3;//x1 std::vector cells4;//y1 std::vector cells5;//z1 std::vector cells6;//hit0 id std::vector cells7;//hit1 id std::vector cells8;//hit0 plane std::vector cells9;//hit1 plane std::vector cells10;//pos.value int count = 0; for(unsigned int j=0;j<(nplanes-1);j++){ unsigned int maxI = NpointsI[j]; unsigned int maxK1 = NpointsI[j+1]; unsigned int maxK2 = 0; unsigned int maxK3 = 0; if(j<(nplanes-2)){ maxK2 = NpointsI[j+2]; } else{ if(j<(nplanes-3)) maxK3 = NpointsI[j+3]; } unsigned int maxK = maxK1; if(maxK2>maxK) maxK=maxK2; if(maxK3>maxK) maxK=maxK3; // if(fVerbose>4) cout<<" maxI[j] = "<=(nplanes-jp)) continue; if(kAt(hitsd.at(j+jp).at(k)); double x2 = hit2->GetX(); double y2 = hit2->GetY(); double z2 = hit2->GetZ(); // if(fVerbose>4){ // double xvec = x2-x0; double yvec = y2-y0; double zvec = z2-z0; // double tgPhi = yvec/xvec; // double tgTheta = sqrt(xvec*xvec+yvec*yvec)/zvec; // // htthetatphiCells->Fill(tgTheta,tgPhi,x0,y0,z0,x2,y2,z2); // } // bool goodDir = true; // if(flagTrkCandCuts){ // double xvec = x2-x0; double yvec = y2-y0; double zvec = z2-z0; // double tgPhi = yvec/xvec; // if(tgPhi<0) tgPhi*=-1; // if(tgPhi>0.25){ // goodDir = false; // } // else{ // double tgTheta = sqrt(xvec*xvec+yvec*yvec)/zvec; // if(tgTheta<0.03 || tgTheta>0.05){ // goodDir = false; // } // } // } // if(fVerbose>4){ // double xvec = x2-x0; double yvec = y2-y0; double zvec = z2-z0; // double tgPhi = yvec/xvec; // double tgTheta = sqrt(xvec*xvec+yvec*yvec)/zvec; // htthetatphi->Fill(tgTheta,tgPhi); // if(!goodDir) // cout<<"BAD cell between #"<<(j)<<"."<4) // cout<<"Number of good cells:"<4) // cout<<"Number of cells after cleaning:"<0){ // timer_cook_cells->Stop(); // Double_t rtime_cook_cells = timer_cook_cells->RealTime(); // Double_t ctime_cook_cells = timer_cook_cells->CpuTime(); // cout << "Real time for Cells cooking:" << rtime_cook_cells << " s, CPU time " << ctime_cook_cells << " s" << endl; // } // TStopwatch *timer_neighbors_cells = new TStopwatch(); // if(fVerbose>0) // timer_cook_cells->Start(); //Find neighbors between cells vector connect;//save position connected cells // for(int itter=0; itter<1; itter++){ for(int ic=0; ic1e-1) continue; // if(fabs(cells7.at(ic)-cells6.at(jc))>1e-1) continue; if((cells9.at(ic))!=(cells8.at(jc))) continue; if((cells7.at(ic))!=(cells6.at(jc))) continue; // /// v - vector of track direction // /// w - vector between middle point and another end of cell // /// d= [v,w]/|v| - distance // /// [v,w]=(v_y*w_z-v_z*w_y, v_z*w_x-v_x*w_z,v_x*w_y-v_y*w_x) // /// |v|=sqrt(v_x^2+v_y^2+v_z^2) // double x0 = cells0.at(ic); double y0 = cells1.at(ic); double z0 = cells2.at(ic); // double x1 = cells3.at(jc); double y1 = cells4.at(jc); double z1 = cells5.at(jc); // double xt = cells3.at(ic); double yt = cells4.at(ic); double zt = cells5.at(ic); // double dx10 = (x1-x0); double dy10 = (y1-y0); double dz10 = (z1-z0); // double dx0t = (x0-xt); double dy0t = (y0-yt); double dz0t = (z0-zt); // double d_x2 = pow((dy10*dz0t-dz10*dy0t),2); // double d_y2 = pow((dz10*dx0t-dx10*dz0t),2); // double d_z2 = pow((dx10*dy0t-dy10*dx0t),2); // // double norm_v = sqrt(pow((x1-x0),2)+pow((y1-y0),2)+pow((z1-z0),2)); // double norm_v = dz10; // if(10*dx10 > dz10){ // double dx10_2 = (x1-x0)*(x1-x0); double dy10_2 = (y1-y0)*(y1-y0); double dz10_2 = (z1-z0)*(z1-z0); // norm_v = sqrt(dx10_2+dy10_2+dz10_2); // } // double d = sqrt(d_x2+d_y2+d_z2)/norm_v; // // timerD.Stop(); // // Double_t rtimeD = 1e9*(timerD.RealTime()); // // Double_t ctimeD = 1e9*(timerD.CpuTime()); // // cout<<"Timer for distance calculation: real "<4) // cout<<"Ooops, smth wrong with cells #"<4) // cout<<"Cells #"<="<4) // cout<<"Number of connected cells "<4){ cout<<"connect:"<Start(); // if(fVerbose>0) // timer_build_trk_combinations->Start(); // TStopwatch *timer_build_all_trk_combinations = new TStopwatch(); // if(fVerbose>0) // timer_build_all_trk_combinations->Start(); //Build track from cells combination -------------------------------- //find max number of cells in a track unsigned int pcmax = 0; for(unsigned int cid=1;cidpcmax) pcmax = tag_cur; } if(fVerbose>4) cout<<"track can contain "< > trk_cells(trk_arr_size); int trk_count=-1; for(unsigned int newpcmax=pcmax;newpcmax>0;newpcmax--){// loop over possible number of cells in trk unsigned int cur_max_tag = newpcmax; if(fVerbose>4) cout<<"Now we are looking for trk with max "<=0;){// loop over all connections between cells bool nextloop=false; unsigned int con1,con2; int curr_arr; if(newtrk){// here we check both cells //check last array in trk_cells was filled by data bool add_new=false; if(trk_count<0) add_new=true; else{ curr_arr=trk_arr_size; while(curr_arr>0){ // cout<<"curr_arr = "<0) add_new=true; } } if(add_new){ if(fVerbose>4) cout<<"**************** Hey, here comes new trk-cand! *****************"<0){ curr_arr--; trk_cells.at(curr_arr).push_back(-1); } } cur_max_tag = newpcmax; con2 = connect[con]; con--; con1 = connect[con]; con--; if((cells10.at(con2))==cur_max_tag) nextloop=true; } else{// here we check only one cell, another one is already known con2 = con1; //trk should be connected to cell from previous part for(int coni=connect.size()-1;coni>=0;){ if(con2==connect[coni]){ coni--; con1 = connect[coni]; nextloop=true; } coni -=2; } if(con2==con1) break; // cout<<" con2 = "<0) continue; // else{ // for(int conN=0;conN4) cout<<" con3:"<4) cout<<" con2:"<0) newtrk=false; // if(cur_max_tag>0) continue; // else{ // for(int conN=0;conN4) cout<<" con3:"< trk_accept; // for(unsigned int itrk=0;itrkStop(); //filter ----------------------------------------------- TStopwatch *timer_filter_trk_combinations = new TStopwatch(); timer_filter_trk_combinations->Start(); // if(fVerbose>0) // timer_filter_trk_combinations->Start(); if(fVerbose>4) cout<<"--- filter trk-cand array: "<4) cout<<" Attention each trk candidate with repeated cells, but smaller cells number will be deleted!"< cell_parts; vector trk_accept; for(unsigned int itrk=0;itrk0){ curr_arr--; if(fVerbose>4) cout<<" we have: trk_cells.at("<0) trk_accept.push_back(true); else trk_accept.push_back(false); if(fVerbose>4) cout<<" with:"<=0;itrc--){ if(!trk_accept[itrc]) continue; int cup=itrc-1; for(int itrc2=cup;itrc2>=0;itrc2--){ if(!trk_accept[itrc]) break; if(!trk_accept[itrc2]) continue; // cout<<"compare trk#"<0){ curr_arr--; int cellnum1=trk_cells.at(curr_arr).at(itrc); int cellnum2=trk_cells.at(curr_arr).at(itrc2); //check by cells if(cellnum1<0 || cellnum2<0) continue; if(cellnum1==cellnum2) count_re++; //check by cells ends (hits) int hit0_0 = cells6.at(cellnum1); int hit1_0 = cells7.at(cellnum1); int hit0_1 = cells6.at(cellnum2); int hit1_1 = cells7.at(cellnum2); if(hit0_0==hit0_1 || hit1_0==hit1_1 || hit0_0==hit1_1 || hit1_0==hit0_1) count_hits++; } if(fVerbose>3) cout<<"Cand.No"<=0;itrc--){ // for(int itrc2=itrc-1;itrc2>=0;itrc2--){ // // if(itc==itrc2) continue; // if(cell_parts[itrc]==cell_parts[itrc2]){ // //reject trk-cand with the same number of cells and similar cells // int count_re=0; // int curr_arr=trk_arr_size; // while(curr_arr>0){ // curr_arr--; // if(trk_cells.at(curr_arr).at(itrc)<0 || trk_cells.at(curr_arr).at(itrc2)<0) continue; // if(trk_cells.at(curr_arr).at(itrc)==trk_cells.at(curr_arr).at(itrc2)){ // count_re++; // } // } // if(fVerbose>3) // cout<<"Cand.No"<Stop(); // Double_t rtime_filter_trk_combinations = timer_filter_trk_combinations->RealTime(); // Double_t ctime_filter_trk_combinations = timer_filter_trk_combinations->CpuTime(); // cout << "Real time for filtering trk combinations :" << rtime_filter_trk_combinations << " s, CPU time " << ctime_filter_trk_combinations << " s" << endl; //filter(end)------------------------------------------------ // if(fVerbose>0){ // timer_filter_trk_combinations->Stop(); // timer_build_trk_combinations->Stop(); // Double_t rtime_filter_trk_combinations = timer_filter_trk_combinations->RealTime(); // Double_t ctime_filter_trk_combinations = timer_filter_trk_combinations->CpuTime(); // cout << "Real time for filtering trk combinations :" << rtime_filter_trk_combinations << " s, CPU time " << ctime_filter_trk_combinations << " s" << endl; // } // if(fVerbose>0){ // // timer_build_trk_combinations->Stop(); // Double_t rtime_build_trk_combinations = timer_build_trk_combinations->RealTime(); // Double_t ctime_build_trk_combinations = timer_build_trk_combinations->CpuTime(); // cout << "Real time for build trk combinations :" << rtime_build_trk_combinations << " s, CPU time " << ctime_build_trk_combinations << " s" << endl; // } // TStopwatch *timer_save_trks = new TStopwatch(); // if(fVerbose>0) // timer_save_trks->Start(); //save trk-cands ---------------------------------------- int NtrkRec = 0; // for(int itrk=0;itrk3) cout<<"Trk uses hit#"<At(hitsd.at(pl).at(id))); PndSdsClusterStrip* myCluster = (PndSdsClusterStrip*)(fStripClusterArray->At(myHit->GetClusterIndex())); PndSdsDigiStrip* astripdigi = (PndSdsDigiStrip*)fStripDigiArray->At(myCluster->GetDigiIndex(0)); myTCand->AddHit(astripdigi->GetDetID(),hitsd.at(pl).at(id),myHit->GetPosition().Z()); // myTCand->AddHit(0,hitsd.at(pl).at(id),myHit->GetPosition().Z()); double startX = cells0.at(cellNum); double startY = cells1.at(cellNum); double startZ = cells2.at(cellNum); // TVector3 posSeed(startX,startY,startZ); int cellNumNext=trk_cells.at(icell+1).at(itrk); if(cellNumNext<0){//next plane is missing cellNumNext=trk_cells.at(icell+2).at(itrk); } double dirX = cells3.at(cellNumNext)-cells0.at(cellNum); double dirY = cells4.at(cellNumNext)-cells1.at(cellNum); double dirZ = cells5.at(cellNumNext)-cells2.at(cellNum); dir.SetXYZ(dirX,dirY,dirZ); if(fVerbose>3) cout<<"Trk-cand direction is taking based on "<2){ // // cout<<"posSeed:"<setTrackSeed(posSeed,dir,-1); firstHit=false; } unsigned int id = cells7.at(cellNum); unsigned int pl = cells9.at(cellNum); if(fVerbose>3) cout<<"Trk uses hit#"<At(hitsd.at(pl).at(id))); PndSdsClusterStrip* myCluster = (PndSdsClusterStrip*)(fStripClusterArray->At(myHit->GetClusterIndex())); PndSdsDigiStrip* astripdigi = (PndSdsDigiStrip*)fStripDigiArray->At(myCluster->GetDigiIndex(0)); myTCand->AddHit(astripdigi->GetDetID(),hitsd.at(pl).at(id),myHit->GetPosition().Z()); // myTCand->AddHit(0,hitsd.at(pl).at(id),myHit->GetPosition().Z()); } if(fVerbose>3){ if(flagTrkCandCuts && ((dir.Theta()<0.03 || dir.Theta()>0.05) || fabs(dir.Phi())>0.25)) cout<<"Ooops, trk-cand has: theta="<3) cout<<"Ntrk No. "<0){ // timer_save_trks->Stop(); // Double_t rtime_save_trks = timer_save_trks->RealTime(); // Double_t ctime_save_trks = timer_save_trks->CpuTime(); // cout << "Real time for save trks :" << rtime_save_trks << " s, CPU time " << ctime_save_trks << " s" << endl; // } // // erase cells; // for(int icell=0;icell<11;icell++) // cells.at(icell).erase(cells.at(icell).begin(),cells.at(icell).end()); cells0.erase(cells0.begin(),cells0.end()); cells1.erase(cells1.begin(),cells1.end()); cells2.erase(cells2.begin(),cells2.end()); cells3.erase(cells3.begin(),cells3.end()); cells4.erase(cells4.begin(),cells4.end()); cells5.erase(cells5.begin(),cells5.end()); cells6.erase(cells6.begin(),cells6.end()); cells7.erase(cells7.begin(),cells7.end()); cells8.erase(cells8.begin(),cells8.end()); cells9.erase(cells9.begin(),cells9.end()); cells10.erase(cells10.begin(),cells10.end()); hitsd.erase(hitsd.begin(),hitsd.end()); // if(fVerbose>0){ // timer_exec->Stop(); // Double_t rtime_exec = timer_exec->RealTime(); // Double_t ctime_exec = timer_exec->CpuTime(); // cout << "Real time for Exec:" << rtime_exec << " s, CPU time " << ctime_exec << " s" << endl; // } if(fVerbose>2){ Int_t ntcandFin=fTrackCandArray->GetEntriesFast(); cout<<"Number of Trk-Cands is "<GetMomentum(); return (2/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py())); } // ------------------------------------------------------------------------- Double_t PndLmdTrackFinderCATask::GetTrackDip(PndMCTrack* myTrack) { TVector3 p= myTrack->GetMomentum(); return (p.Mag()/TMath::Sqrt(p.Px()*p.Px() + p.Py()*p.Py())); } void PndLmdTrackFinderCATask::FinishTask(){ //cout<<"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! HO-HO!!!!"<4){ // // htthetatphi->Print(); // TTree *nout1 = htthetatphiTrk->CloneTree(); // nout1->Write(); // TTree *nout2 = htthetatphiCells->CloneTree(); // nout2->Write(); // } // fout->Write(); // fout->Close(); } // ------------------------------------------------------------------------- ClassImp(PndLmdTrackFinderCATask)