/** * \file ExtTrkingAlg.cpp * \author Elena Vannuccini **/ #include #include #include using namespace std; /** * Constructor * * @param id Algorythm identifier * * id = 0 The algorythm looks for tracks with >= 3x2y hits on the tracker plane. * It fills a TClonesArray of TrkTrack objects. * id = 1 The first plane (y) of the calorimeter is also used. * It fills a TClonesArray of ExtTrack objects. * id = 2 The first two planes (y+x) of the calorimeter are also used. * It fills a TClonesArray of ExtTrack objects. * */ ExtTrkingAlg::ExtTrkingAlg(Int_t id){ _whichAlg = id; SetDebug(true); if(id == 0){ // if(_debug){ cout << "ExtTrkingAlg::ExtTrkingAlg("<= 100 && id < 144) || (id >= 200 && id < 244) || false){ //add n calo planes // if(_debug){ cout << "ExtTrkingAlg::ExtTrkingAlg("<SetZ(0,ZTRK1); // _extTrack->SetZ(1,ZTRK2); // _extTrack->SetZ(2,ZTRK3); // _extTrack->SetZ(3,ZTRK4); // _extTrack->SetZ(4,ZTRK5); // _extTrack->SetZ(5,ZTRK6); _caloStripRoto.clear(); for(int iv=0; iv<_alg_nViewCal; iv++){ //loop over calorimater tracking planes for(int is=0; is<9; is++){ //loop over calorimeter sensors CaloStripRoto s(1-iv%2, (int)(iv/2), is, false);//flight 0-order align s.ResetAligParams();//reset 1-order align parameters _caloStripRoto.push_back(s) ; } } //------------------------------------------ // read alignment parameters //------------------------------------------ if(_debug) cout << "Reading calorimeter alignment parameters"<Getenv("PAM_CALIB"); TString filep = "/trk-param/align_param_calo-0/CaloAlignParams.txt"; filep.Prepend(pamca); if(_debug)cout << " ---> "<>view >> plane>> sensor; for(int i=0; i<5; i++)fs>>par[i]>>err[i]; if(plane*2+1-view<_alg_nViewCal){ int index = (plane*2+1-view)*9 + sensor; if(_debug){ cout<> "; cout<=0; view--){ int strip = 0; CaloStrip st = CaloStrip(false);//flight align st.Set(view,plane,strip); int index = 2*plane + !view; if(index >= _alg_nViewCal)break; // _extTrack->SetZ(6+index,st.GetZ()); _zMech[6+index]=st.GetZ(); } } for(int ip =0 ; ip<_extTrack->nplanes; ip++ )_extTrack->SetZ(ip,_zMech[ip]); if ( _debug ){ cout <<" Extended-track Z-coordinates: "<nplanes; ip++ )cout << _extTrack->zm[ip]< Track array not created "<Dump(); int ngf = TrkParams::nGF; float *zgf = TrkParams::zGF; _tgf = new Trajectory(ngf,zgf); // _tgf->Dump(); Clear(); }; /** * Reset the algorythm flags and output */ // void ExtTrkingAlg::Reset(){ // if(_trkArray)_trkArray->Clear("C"); // }; /** * Clear the event and reset the algorythm */ void ExtTrkingAlg::Clear(Option_t* option){ SetTrkLevel1(); SetTrkLevel2(); SetToFLevel2(); SetCaloLevel1(); SetCaloLevel2(); if(_trkArray)_trkArray->Clear("C"); }; /** * DElete all */ void ExtTrkingAlg::Delete(){ if(_trkArray) delete _trkArray; if(_caloTj) delete _caloTj; if(_tgf) delete _tgf; if(_zMech)delete [] _zMech; } /** * Set selection parameters */ void ExtTrkingAlg::SetSelectionParams(double* par){ _sel_nClstrMAX = (Int_t)par[0]; // selection parameter: maximum number of cluster _sel_nPlaneXMIN = (Int_t)par[1]; // selection parameter: minimum number of hit x-views _sel_nPlaneYMIN = (Int_t)par[2]; // selection parameter: minimum number of hit y-views }; /** * Set algorythm parameters */ void ExtTrkingAlg::SetAlgorythmParams(double* par){ _alg_nClFixX = (Int_t)par[0]; // algorythm parameter: n.hits required on X view _alg_nClFixY = (Int_t)par[1]; // algorythm parameter:n.hits required on X view _alg_nTrackMAX = (Int_t)par[2]; // algorythm parameter: maximum num. of track candidates _alg_nViewCal= (Int_t)par[3]; // algorythm parameter: n. calorimeter planes included // _alg_nViewCalFix= (Int_t)par[4]; // }; /** * Get the track array */ TClonesArray* ExtTrkingAlg::GetTrackArray(Bool_t reset){ if( reset && _trkArray) _trkArray->Clear("C"); // if( !_procDone )ProcessEvent(); return _trkArray; }; /** * Pre-select the event */ Bool_t ExtTrkingAlg::CheckEvent(){ if(!_trk_l1)return false; TrkLevel1 *trkl1 = _trk_l1;//event->GetTrkLevel1(); int nClstrMAX = _sel_nClstrMAX; //maximum number of cluster ///////////////////////////////////////////////////////////////////// /// dump selection ///////////////////////////////////////////////////////////////////// if(_debug){ cout << " n.clusters "<nclstr()<nclstr() > nClstrMAX) return false; ///////////////////////////////////////////////////////////////////// /// count number of hit planes ///////////////////////////////////////////////////////////////////// int nPlaneXMIN = _sel_nPlaneXMIN; int nPlaneYMIN = _sel_nPlaneYMIN; int nHitX[] = {0,0,0,0,0,0}; int nHitY[] = {0,0,0,0,0,0}; for(int ic=0; icnclstr(); ic++){ if (trkl1->GetCluster(ic)->IsX() ) nHitX[trkl1->GetCluster(ic)->GetPlane()-1]++; else if (trkl1->GetCluster(ic)->IsY() ) nHitY[trkl1->GetCluster(ic)->GetPlane()-1]++; } ///////////////////////////////////////////////////////////////////// /// set minimum condition 3x+2y ///////////////////////////////////////////////////////////////////// int nPlaneX=0; for(int ip=0; ip<6; ip++)if(nHitX[ip])nPlaneX++; int nPlaneY=0; for(int ip=0; ip<6; ip++)if(nHitY[ip])nPlaneY++; ///////////////////////////////////////////////////////////////////// /// dump selection ///////////////////////////////////////////////////////////////////// if(_debug){ cout << " n.x-hit planes "<GetTrkLevel2(); // ///////////////////////////////////////////////////////////////////// // /// dump selection // ///////////////////////////////////////////////////////////////////// // if(_debug){ // cout << " n.tracks "<GetNTracks()<nclsx()<nclsy()<nclsy()<nclsy()+trkl2->nclsx() > nClstrMAX) return false; // ///////////////////////////////////////////////////////////////////// // /// count number of hit planes // ///////////////////////////////////////////////////////////////////// // int nPlaneXMIN = _sel_nPlaneXMIN; // int nPlaneYMIN = _sel_nPlaneYMIN; // int nHitX[] = {0,0,0,0,0,0}; // int nHitY[] = {0,0,0,0,0,0}; // for(int ix=0; ixnclsx(); ix++)nHitX[trkl2->GetSingletX(ix)->plane-1]++; // for(int iy=0; iynclsy(); iy++)nHitY[trkl2->GetSingletY(iy)->plane-1]++; // ///////////////////////////////////////////////////////////////////// // /// set minimum condition 3x+2y // ///////////////////////////////////////////////////////////////////// // int nPlaneX=0; // for(int ip=0; ip<6; ip++)if(nHitX[ip])nPlaneX++; // int nPlaneY=0; // for(int ip=0; ip<6; ip++)if(nHitY[ip])nPlaneY++; // ///////////////////////////////////////////////////////////////////// // /// dump selection // ///////////////////////////////////////////////////////////////////// // if(_debug){ // cout << " n.x-planes with singles "<GetNTracks()==0 && nPlaneXGetNTracks()==0 && nPlaneY trackCandidates[12]; // map: last filled view vs TrkTrack int mapIndex = 0; multimap::iterator trkBegin; multimap::iterator trkEnd; int iCand; // ------------------------------------------------ // fill a map VIEW(0-11)-CLUSTER // ------------------------------------------------ multimap clusterMap; if(_debug)cout<<"-------- CLUSTERs --------"<nclstr(); icl++){ clusterMap.insert( pair( _trk_l1->GetCluster(icl)->view-1, icl )); if(_debug)cout << icl << " - view "<<_trk_l1->GetCluster(icl)->view<<" ladder "<<_trk_l1->GetCluster(icl)->GetLadder()<<" strip "<<_trk_l1->GetCluster(icl)->maxs<::iterator, multimap::iterator> ret[12]; multimap::iterator it[12]; for(int iv=0; iv<12; iv++)ret[iv] = clusterMap.equal_range(iv); //==================================================================== // PARAMETERS //==================================================================== // ------------------------------------------------ // number of points per candidate // ------------------------------------------------ int nClFixX = _alg_nClFixX; // n.hits required on X view int nClFixY = _alg_nClFixY; // n.hits required on X view int nTrackMAX = _alg_nTrackMAX; // //================================================== // ------------------------------------------------ // start: one candidate for each cluster // ------------------------------------------------ //================================================== if(_debug)cout<<"-------- MINIMAL --------"< 6-nClFixX)continue; if( (iv%2) && (int)(0.5*iv) > 6-nClFixY)continue; for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view for (int is=0; is<2; is++){ //loop over sensors int icl = it[iv]->second; TrkCluster *cluster = _trk_l1->GetCluster(icl); int ladder = cluster->GetLadder()-1; int plane = cluster->GetPlane()-1; bool isY = (cluster->view)%2; bool isX = !isY; // // if(_debug && isX )cout << " ^^^^^^^ X plane "<maxs <maxs <(iv, TrkTrack(t_track))); } } }; //============================================================== // ------------------------------------------------------------- // next: add views to each candidate, up to nClFixX+nClFixY // ------------------------------------------------------------- //============================================================== for( ;mapIndex < nClFixX+nClFixY-1 ;++mapIndex){ trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); if(_debug)cout<<"MAP "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ TrkTrack trackCand = (*trkIter).second; int lastView = (*trkIter).first; //last inserted view int lastPlane = (int)(0.5*lastView); int lastLadder = trackCand.GetLadder(lastPlane); int lastSensor = trackCand.GetSensor(lastPlane); // if(_debug)cout<<"MAP "< 6-nClFixX+trackCand.GetNX())continue; //not enough x-view left if( !(iv%2) && (int)(0.5*iv) > 6-nClFixY+trackCand.GetNY())continue; //not enough y-view left if( (iv%2) && trackCand.GetNX()==nClFixX )continue;//ok? if( !(iv%2) && trackCand.GetNY()==nClFixY )continue;//ok? for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view int icl = it[iv]->second; TrkCluster *cluster = _trk_l1->GetCluster(icl); int ladder = cluster->GetLadder()-1;//(_trk_l1->GetCluster(icl)->maxs-1)%1024 + 1; int plane = cluster->GetPlane()-1; bool isY = (cluster->view)%2; bool isX = !isY; if( plane==lastPlane && ladder!=lastLadder)continue; for (int is=0; is<2; is++){ //loop over sensors if( plane==lastPlane && is!=lastSensor)continue; // if(_debug)cout<<"MAP "<(iv, TrkTrack(t_track))); //...and store a new candidate };//end loop over sensors };//end loop over clusters on the view iv };//endl loop over views }//end loop over candidates }//end iterations if( trackCandidates[mapIndex].size() > (uint)nTrackMAX ){ // EM, warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(_debug)cout << "n.candidates "< "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ TrkTrack &trackCand = (*trkIter).second; cout << " >> "; cout << " X: "; for(int ip=0; ip<6; ip++) if(trackCand.GetClusterX_ID(ip)>=0)cout << trackCand.GetClusterX_ID(ip)<<":"<=0)cout << trackCand.GetClusterY_ID(ip)<<":"<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; TrkTrack &trackCand = (*trkIter).second; int ifail=0; trackCand.FitReset(); trackCand.Fit(0.,ifail,0,1);//re-evaluate cluster position from level1 if(ifail!=0)trackCand.FitReset(); // ----------------------------------- // first selection of track candidates // ----------------------------------- if(TMath::IsNaN(trackCand.chi2))continue; if(trackCand.chi2 <= 0. || trackCand.chi2 > 1.e7)continue; // if(trackCand.chi2 < 0. || trackCand.chi2 > 10. )continue; iCand++; if(_debug){ cout<< " TRK chi2 "<=0)cout << trackCand.GetClusterX_ID(ip)<<":"<=0)cout << trackCand.GetClusterY_ID(ip)<<":"<(lastView, TrkTrack(trackCand))); }; if(trackCandidates[mapIndex].size()==0)return;//no good candidates if(_debug)cout << "n.candidates "<GetCaloLevel1(); // if(!l1)return; vector caloChi2; vector caloHit; int caloHitMAX=0; vector caloMip; trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ TrkTrack trackCand = ((*trkIter).second); trackCand.DoTrack(_caloTj);//integrate the trajectory through the calorimeter float chi2 = 0.; int nhit = 0; float cmip = 0.; for(Int_t ih=0; ihistrip; ih++){ Int_t view = -1; Int_t plane = -1; Int_t strip = -1; Float_t mip = l1->DecodeEstrip(ih,view,plane,strip); if(view<0)continue; if(plane<0)continue; if(strip<0)continue; if(mip<=0)continue; float dxy = _caloCoord[view][plane][strip]-(view?_caloTj->y[plane*2+(view?0:1)]:_caloTj->x[plane*2+(view?0:1)]); if(plane<11) chi2+= mip * TMath::Power(dxy,2.); // caloZ[plane*2+(view?0:1)]=st.GetZ(); if( fabs(dxy) < 2. && plane<11)nhit++; if( fabs(dxy) < 2. && plane<11)cmip+=mip; }; if(l1->istrip>0)chi2 = chi2/l1->istrip; caloHit.push_back(nhit); if(nhit>caloHitMAX)caloHitMAX=nhit; if(_debug){ cout << " CALO "; // cout << " chi2 "<< chi2 <<" "; cout << " nhit (< 11th plane) "<< nhit <<" "; // cout << " mip "<< cmip <<" "; cout <::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; TrkTrack &trackCand = (*trkIter).second; if(caloHit[iCand]==caloHitMAX)trackCandidates[mapIndex].insert(pair(lastView, TrkTrack(trackCand))); iCand++; } if(trackCandidates[mapIndex].size()==0)return;//no good candidates if(_debug)cout << "n.candidates "<GetToFLevel2(); // if(!tl2)return; iCand =0; vector tofHit; int tofHitMAX=0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ // int lastView = (*trkIter).first; TrkTrack &trackCand = (*trkIter).second; int nhit =0; for(int iToF=0; iToF<6; iToF++){ int iGF = iToF; if(iToF>3)iGF = iToF+8; int iPaddle = tl2->GetPaddleIdOfTrack( trackCand.xGF[iGF], trackCand.yGF[iGF], iToF); if( tl2->HitPaddle(iToF,iPaddle) )nhit++; } iCand++; tofHit.push_back(nhit); if(nhit>tofHitMAX)tofHitMAX=nhit; if(_debug){ cout << " TOF nhit "<< nhit <<" "; cout <::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; TrkTrack &trackCand = (*trkIter).second; if(tofHit[iCand]==tofHitMAX)trackCandidates[mapIndex].insert(pair(lastView, TrkTrack(trackCand))); iCand++; } if(trackCandidates[mapIndex].size()==0)return;//no good candidates if(_debug)cout << "n.candidates "<::iterator trkIter1 = trkBegin; trkIter1!=trkEnd; ++trkIter1){ //loop over tracks (1) TrkTrack &trackCand1 = (*trkIter1).second;// get candidate 1... TrkTrack t_track = TrkTrack();// ...create a new TrkTrack instance... trackCand1.Copy(t_track); // ...and make a copy bool HBM = false; //has been merged for( multimap::iterator trkIter2 = trkBegin; trkIter2!=trkEnd; ++trkIter2){//loop over tracks (2) TrkTrack &trackCand2 = (*trkIter2).second; // get candidate 2... // if(_debug){ // cout <<" X: "; // for(int ip=0; ip<6; ip++) // if(t_track.GetClusterX_ID(ip)>=0)cout << t_track.GetClusterX_ID(ip)<<":"<=0)cout << t_track.GetClusterY_ID(ip)<<":"<=0)cout << trackCand2.GetClusterX_ID(ip)<<":"<=0)cout << trackCand2.GetClusterY_ID(ip)<<":"< "; // } bool CBM = true; for(int ip=0; ip<6; ip++){ //loop over planes if( t_track.XGood(ip) && trackCand2.XGood(ip) && ( t_track.GetClusterX_ID(ip)!=trackCand2.GetClusterX_ID(ip) || t_track.GetSensor(ip)!=trackCand2.GetSensor(ip) ) && true )CBM=false; // if both have a x-hit and it is not the same ---> they cannot be merged if(!CBM)break; if( t_track.YGood(ip) && trackCand2.YGood(ip) && ( t_track.GetClusterY_ID(ip)!=trackCand2.GetClusterY_ID(ip) || t_track.GetSensor(ip)!=trackCand2.GetSensor(ip) ) && true )CBM=false; // if both have a y-hit and it is not the same ---> they cannot be merged if(!CBM)break; } // if(_debug)cout << " can be merged ? "<::iterator trkB = trackCandidates[mapIndex].begin(); multimap::iterator trkE = trackCandidates[mapIndex].end(); // bool ADD = true; for( multimap::iterator trkI = trkB; trkI!=trkE; ++trkI){ TrkTrack &trackC = (*trkI).second; bool SAME=true; for(int ip=0; ip<6; ip++) if( t_track.GetClusterX_ID(ip) != trackC.GetClusterX_ID(ip) || t_track.GetClusterY_ID(ip) != trackC.GetClusterY_ID(ip) || t_track.GetSensor(ip) != trackC.GetSensor(ip) || false)SAME=false; if(SAME){ ADD=false; break; } } // if(_debug)cout <<" ADD ? "< INSERT "<> HBM "<> al: ";for(int i=0; i<5; i++)cout <GetCluster(iclx); float mip = TrkParams::GetMIP(clusterx->GetLadder()-1,clusterx->view-1); t_track.dedx_x[ip] = clusterx->GetSignal()/(factor>0.?factor:1.)/(mip>0.?mip:1.); t_track.multmaxx[ip] = clusterx->GetMultiplicity()*10000+clusterx->maxs; t_track.seedx[ip] = clusterx->clsignal[clusterx->indmax]/clusterx->clsigma[clusterx->indmax];//clusterx->GetSignalToNoise(0,7); t_track.xpu[ip] = 0.;//complicato.... } if(t_track.YGood(ip)){ int icly = t_track.GetClusterY_ID(ip); TrkCluster *clustery = _trk_l1->GetCluster(icly); float mip = TrkParams::GetMIP(clustery->GetLadder()-1,clustery->view-1); t_track.dedx_y[ip] = clustery->GetSignal()/(factor>0.?factor:1.)/(mip>0.?mip:1.); t_track.multmaxy[ip] = clustery->GetMultiplicity()*10000+clustery->maxs; t_track.seedy[ip] = clustery->clsignal[clustery->indmax]/clustery->clsigma[clustery->indmax];//clustery->GetSignalToNoise(0,7); t_track.ypu[ip] = 0.;//complicato.... } } ///////////////////////////////////////////////////////// end additional info // cout << "ADD "<(t_track.GetNX()+t_track.GetNY(), TrkTrack(t_track))); if(t_track.GetNX()+t_track.GetNY()>5 && t_track.chi2::iterator, multimap::iterator> nxny[12]; for(int inxny=0; inxny<12; inxny++){ nxny[inxny] = trackCandidates[mapIndex].equal_range(inxny); for ( multimap::iterator it = nxny[inxny].first; it!=nxny[inxny].second; ++it){ TrkTrack &trackC = (*it).second; // cout << " NX+NY "<< trackC.GetNX()+trackC.GetNY() <<" chi2 "< 5 && trackC.chi2>chi2Min )continue; trackCandidates[mapIndex+1].insert(pair(inxny, TrkTrack(trackC))); } } mapIndex++; if(_debug)cout << "n.candidates "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ TrkTrack trackCand = ((*trkIter).second); trackCand.seqno = iCand; // trackCand.Dump(); new(tracks[iCand]) TrkTrack(trackCand); iCand++; }; }; /** * Fill cluster map with tracker clusters */ void ExtTrkingAlg::FillClusterMap(multimap &map,TrkLevel1* l1,Int_t vOffset){ if(_debug)cout<<"-------- TRK CLUSTERs --------"<nclstr(); icl++){ // trkCl->Reset(); // l1->GetCluster(icl)->GetLevel1Struct();// to use F77 routines //PERICOLOSO // trkCl->coordPU = (float)(l1->GetCluster(icl)->maxs) - 1. + l1->GetCluster(icl)->GetCOG(); // trkCl->coordCm = 1000.; //TEMPORANEO forse non serve // trkCl->resCm = 1000.;//TEMPORANEO // trkCl->signal = l1->GetCluster(icl)->GetSignal(); // trkCl->mult = l1->GetCluster(icl)->GetMultiplicity(); // trkCl->view = l1->GetCluster(icl)->view-1; // _trk_cl.push_back(ExtHit(*trkCl)); map.insert( pair( l1->GetCluster(icl)->view-1 + vOffset, icl )); if(_debug)cout << icl << " - view(0-11) "<GetCluster(icl)->view-1<<" ladder(012) "<GetCluster(icl)->GetLadder()-1<<" strip "<GetCluster(icl)->maxs<GetLevel1Struct(); //necessario per ritornare al contenuto originale del common if(trkCl)delete trkCl; }; /** * Fill cluster map with calorimeter clusters */ void ExtTrkingAlg::FillClusterMap(multimap &map,CaloLevel1* l1,Int_t vOffset){ if(_debug)cout<<"-------- CALO CLUSTERs -------- on VIEW < "<<_alg_nViewCal<istrip; ih++){//loop over calorimeter hits Int_t view = -1; // 0-x 1-y Int_t plane = -1; // 0-21 Int_t strip = -1; // 0-95 Float_t mip = l1->DecodeEstrip(ih,view,plane,strip); // if(strip == 0 || strip == 95)cout <<" strip "< 95)cout <<" strip "<= _alg_nViewCal ){//view not included if(!caloCl)continue; if(caloCl->mult>0){ //if there is a cluster under construction... _cal_cl.push_back(ExtHit(*caloCl));//store it map.insert( pair(caloCl->view + vOffset, nCl )); if(_debug)cout << nCl << " - view(0-43) "<< caloCl->view<<" strip "<start<<"-"<start+caloCl->mult-1<Reset(); caloCl->Set(strip,vv); // start new one... (without adding the strip) } continue; //... and skip this view } // -------------- // @first hit: // -------------- if(!caloCl){ caloCl = new ExtHit(strip,vv);//create cluster starting caloCl->Add(cc,pp,ss);//add strip continue; } //------------------- //check previous hit //------------------- if( vv != caloCl->view || //hit on a different view strip > caloCl->start + caloCl->mult ||//not adjacent to previous one strip == 32 || //different ladder strip == 64 || //different ladder false ){ // is a new cluster: // store previous one, if not already stored if(caloCl->mult > 0){ _cal_cl.push_back(ExtHit(*caloCl)); map.insert( pair(caloCl->view + vOffset, nCl )); if(_debug)cout << nCl << " - view(0-43) "<< caloCl->view<<" strip "<start<<"-"<start+caloCl->mult-1<Reset(); // reset caloCl->Set(strip,vv); // start new one from strip } caloCl->Add(cc,pp,ss); //add strip };//end loop over calorimeter hits if(caloCl)delete caloCl; return; }; /** * Evaluate positions */ bool ExtTrkingAlg::EvaluateClusterPosition_Tracker( int iclx, int icly,int lad, int sen, float *xmABar, float *ymABar, float *zmAB){ TrkParams::Load(1); if( !TrkParams::IsLoaded(1) ){ cout << "Bool_t ExtTrkingAlg::EvaluateClusterPosition_Tracker ---ERROR--- m.field not loaded "<GetCluster(TMath::Max(iclx,icly))->view-1)/2;//ip=0-5 if(ip==5 && sensor!=0)sensor=3-sensor;//<< convenzione "Elena" int ladder = lad+1; float ax = (float)xmABar[3]; float ay = (float)ymABar[3]; float v[3]; v[0]=xmABar[0]; v[1]=ymABar[0]; v[2]=zmAB[0]; float bfx = 10*TrkParams::GetBX(v);//Tesla float bfy = 10*TrkParams::GetBY(v);//Tesla int ipp=ip+1; // cout<<"xyzpam_("<=0);//if sensor is assigned (0,1,2) the strip can be rototraslated // CaloStrip st = CaloStrip(false); // //---------------------------- // // Z-coordinate // //---------------------------- // st.Set((int)isY,plane,ladder*32);// // float coordCm_Z0 = st.GetZ(); // float size = 80.5; //(cm) larghezza del sensore + zone morte // //---------------------------- // // strip-segment coordinates // //---------------------------- // float coordCm_LA = cluster.coordCm; // float coordCm_LB = cluster.coordCm; // float coordCm_SA = (-1)*size*1.5; //full calorimeter size // float coordCm_SB = (+1)*size*1.5; //full calorimeter size // float coordCm_ZA = coordCm_Z0; // float coordCm_ZB = coordCm_Z0; // //---------------------------- // // rototraslation // //---------------------------- // if(ROTO){ // //----------------------------- // // sensor origin coordinates // //----------------------------- // st.Set( (int)isY, plane, ladder*32);// // float coordCm_L0 = ( isX ? st.GetX() : st.GetY()); // st.Set((int)(!isY), plane, sensor*32 ); // float coordCm_S0 = (!isX ? st.GetX() : st.GetY()); // coordCm_SA = (-1)*size*0.5 + (sensor-1)*size; //sensor size // coordCm_SB = (+1)*size*0.5 + (sensor-1)*size; //sensor size // //----------------------------- // // alignment pamameters // //----------------------------- // float fPitch = 1.; // float shift[]= {0.,0.,0.};//(L,S,Z) // float alpha = 0.; // //----------------------------- // //coordinate relative al sensore // coordCm_LA = coordCm_LA - coordCm_L0; // coordCm_SA = coordCm_SA - coordCm_S0; // coordCm_ZA = coordCm_ZA - coordCm_Z0; // coordCm_LB = coordCm_LB - coordCm_L0; // coordCm_SB = coordCm_SB - coordCm_S0; // coordCm_ZB = coordCm_ZB - coordCm_Z0; // //variazione di pitch // coordCm_LA = coordCm_LA * fPitch; // coordCm_LB = coordCm_LB * fPitch; // //rotazione // float LA = coordCm_LA - alpha * coordCm_SA; // float SA = coordCm_SA + alpha * coordCm_LA; // float LB = coordCm_LB - alpha * coordCm_SB; // float SB = coordCm_SB + alpha * coordCm_LB; // //traslazione // coordCm_LA = LA + shift[0]; // coordCm_SA = SA + shift[1]; // coordCm_ZA = coordCm_ZA + shift[2]; // coordCm_LB = LB + shift[0]; // coordCm_SB = SB + shift[1]; // coordCm_ZB = coordCm_ZB + shift[2]; // //sistema di riferimento generale // coordCm_LA = coordCm_LA + coordCm_L0; // coordCm_SA = coordCm_SA + coordCm_S0; // coordCm_ZA = coordCm_ZA + coordCm_Z0; // coordCm_LB = coordCm_LB + coordCm_L0; // coordCm_SB = coordCm_SB + coordCm_S0; // coordCm_ZB = coordCm_ZB + coordCm_Z0; // } // xmABar[0] = -100.; // ymABar[0] = -100.; // zmAB[0] = 0.5*coordCm_ZA+0.5*coordCm_ZB; // xmABar[1] = (isX ? coordCm_LA : coordCm_SA); // ymABar[1] = (isY ? coordCm_LA : coordCm_SA); // zmAB[1] = coordCm_ZA; // xmABar[2]= (isX ? coordCm_LB : coordCm_SB); // ymABar[2]= (isY ? coordCm_LB : coordCm_SB); // zmAB[2] = coordCm_ZB; // //---------------------------- // // evaluate spatial resolution // //---------------------------- // float res_dig = 0.24/sqrt(12.); // float res_ms = 0.; // if(def!=0.){ // float rig = 1/def; if(rig<0)rig = -rig; // float factor = 0.; // factor += TMath::Power(TMath::Tan(TMath::ACos(-1)*xmABar[3]/180.),2); // factor += TMath::Power(TMath::Tan(TMath::ACos(-1)*ymABar[3]/180.),2); // factor += 1.; // factor = TMath::Sqrt(factor); // int view = cluster.view; //0... 43 // int nW = (int)((view + 1)/2); // float dW = 0.74*factor;//X0 // float dW_cm = 0.26*factor;//cm // float dSi_cm = 0.; //cm // if(isY && plane>0) dSi_cm = ( plane%2 ? 0.228 : 0.428); // dSi_cm *= factor; // // multiple scattering angle // float theta = 0.;//ms // theta = 0.0136/rig; // theta = theta * sqrt(dW) * (1.+0.038*log(dW)); // float Vt = theta*theta; //cov(theta,theta) // float Vy = Vt * dW_cm * dW_cm /3.; //cov(y,y) // float Vty = 0.87 * Vt * Vy; //cov(theta,y) // float Vc = Vy + dSi_cm * dSi_cm * Vt + 2. * dSi_cm * Vty; // float rms = sqrt( Vc ); // // if(isY)t_track.resy[ip] = sqrt(rms*rms + t_track.resy[ip]*t_track.resy[ip]); // // else t_track.resx[ip] = sqrt(rms*rms + t_track.resx[ip]*t_track.resx[ip]); // // if(isY) VMS[nW] = rms*rms; // // if(_debug)cout <=3)cout << " --> NB error computation not accurate "; // res_ms = rms; // } // xmABar[4]= (isX ? sqrt(res_dig*res_dig+res_ms*res_ms) : 1000.); // ymABar[4]= (isY ? sqrt(res_dig*res_dig+res_ms*res_ms) : 1000.); // } bool ExtTrkingAlg::EvaluateClusterPosition_Calorimeter( int icl, int& sisensor, float *xmABar, float *ymABar, float *zmAB, float def){ ExtHit cluster = _cal_cl[icl]; // int plane = 6 + cluster.view; //0...21 int plane = (int)(cluster.view / 2 ); //0...21 int ladder = (int)(cluster.coordPU / 32);//0...2 // int view = cluster.view;//0...43 // EM, unused variable bool isX = (cluster.view)%2; bool isY = !isX; // int sisensor = -1; // CaloStripRoto temp; bool ROTO = ( xmABar[0]!=0. && ymABar[0]!=0.); // ------------------------------------------------------------------------------ // // check if the cluster belongs to the hit sensor (xmABar[0],ymABar[0] must be provided) // evaluate the hit sensor number // // ------------------------------------------------------------------------------ if(ROTO){ for(int is=0;is<3; is++){ int sis = GetCaloSiSensor((int)isY,ladder,is); // cout << "view, ladder, is :"<<(int)isY< sis "< view "< plane "< sisensor "< ladder "<0) dSi_cm = ( plane%2 ? 0.228 : 0.428); dSi_cm *= factor; // multiple scattering angle float theta = 0.;//ms theta = 0.0136/rig; theta = theta * sqrt(dW) * (1.+0.038*log(dW)); float Vt = theta*theta; //cov(theta,theta) float Vy = Vt * dW_cm * dW_cm /3.; //cov(y,y) float Vty = 0.87 * Vt * Vy; //cov(theta,y) float Vc = Vy + dSi_cm * dSi_cm * Vt + 2. * dSi_cm * Vty; float rms = sqrt( Vc ); // if(isY)t_track.resy[ip] = sqrt(rms*rms + t_track.resy[ip]*t_track.resy[ip]); // else t_track.resx[ip] = sqrt(rms*rms + t_track.resx[ip]*t_track.resx[ip]); // if(isY) VMS[nW] = rms*rms; // if(_debug)cout <=3)cout << " --> NB error computation not accurate "; res_ms = rms; } xmABar[4]= (isX ? sqrt(res_dig*res_dig+res_ms*res_ms) : 1000.); ymABar[4]= (isY ? sqrt(res_dig*res_dig+res_ms*res_ms) : 1000.); } return true; // EM, warning: no return statement in function returning non-void [-Wreturn-type] } /** * Process the event */ void ExtTrkingAlg::ProcessEvent1(Bool_t force){ if(_debug)cout << " |---------------------------------------------------| "< trackCandidates[NEXTVIEWS]; // map: last hit view vs TrkTrack int mapIndex = 0; multimap::iterator trkBegin; multimap::iterator trkEnd; int iCand; // ------------------------------------------------ // fill a map VIEW-CLUSTER // ------------------------------------------------ multimap clusterMap; FillClusterMap(clusterMap,_trk_l1,0);// trk clusters FillClusterMap(clusterMap,_cal_l1,12);// calorimeter clusters // ------------------------------------------------ // define iterators over clusters on the same view // ------------------------------------------------ pair ::iterator, multimap::iterator> ret[NEXTVIEWS]; multimap::iterator it[NEXTVIEWS]; for(int iv=0; iv NEXTVIEWS/2-nClFixX)continue; if( (iv%2) && (int)(0.5*iv) > NEXTVIEWS/2-nClFixY)continue; if(iv >= NEXTVIEWS - _alg_nViewCal )continue; //skip calo hits for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view int icl = it[iv]->second; TrkCluster *cluster = _trk_l1->GetCluster(icl); // cluster->Dump(); int ladder = cluster->GetLadder()-1; // int plane = cluster->GetPlane()-1; bool isY = (cluster->view)%2;// F77 1-12 ?? bool isX = !isY; /// TRACKER ============================================================================== for (int is=0; is<2; is++){ //loop over sensors //cout <>>> insert point float xmABar[]={0.,0.,0.,0.,0.}; // inizializzare a zero l'angolo, come prima stima per il PFA float ymABar[]={0.,0.,0.,0.,0.}; float zmAB[]={t_track.zm[plane],0.,0.};//mechanical z-coordinate EvaluateClusterPosition_Tracker( (isX?icl:-1), (isY?icl:-1), ladder, is, xmABar, ymABar, zmAB); if( isX ){ t_track.SetX(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetXGood(plane,icl+1,ladder,is); // t_track.SetYGood(plane,0,ladder,is); } if( isY ){ t_track.SetY(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],ymABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetYGood(plane,icl+1,ladder,is); // t_track.SetXGood(plane,0,ladder,is); } trackCandidates[mapIndex].insert(pair(iv, t_track)); } } } //============================================================== // ------------------------------------------------------------- // next: add views to each candidate, up to nClFixX+nClFixY // ------------------------------------------------------------- //============================================================== for( ;mapIndex < nClFixX+nClFixY-1 ;++mapIndex){ trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); if(_debug)cout<<"MAP "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = (*trkIter).second; int lastView = (*trkIter).first; //last inserted view bool lastIsTrk = (lastView < NEXTVIEWS - _alg_nViewCal); int lastPlane = (int)(0.5*lastView); if(!lastIsTrk)lastPlane =lastView-6; int lastLadder = trackCand.GetLadder(lastPlane); int lastSensor = trackCand.GetSensor(lastPlane); // if(_debug)cout<<"MAP "< 6-nClFixX+trackCand.GetNX())continue; //not enough x-view left // if( !(iv%2) && (int)(0.5*iv) > 6-nClFixY+trackCand.GetNY())continue; //not enough y-view left // if( (iv%2) && trackCand.GetNX()==nClFixX )continue;//ok? // if( !(iv%2) && trackCand.GetNY()==nClFixY )continue;//ok? if( isX && trackCand.GetNX()==nClFixX )continue;//ok? if( isY && trackCand.GetNY()==nClFixY )continue;//ok? if( isX && (int)(0.5*iv) > 6+_alg_nViewCal/2 - nClFixX+trackCand.GetNX())continue; //not enough x-view left if( isY && (int)(0.5*iv) > 6+(_alg_nViewCal+1)/2 - nClFixY+trackCand.GetNY())continue; //not enough y-view left for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view int icl = it[iv]->second; if(isTrk){ /// TRACKER ================================================== TrkCluster *cluster = _trk_l1->GetCluster(icl); int ladder = cluster->GetLadder()-1;//(_trk_l1->GetCluster(icl)->maxs-1)%1024 + 1; int plane = cluster->GetPlane()-1; // bool isY = (cluster->view)%2; // bool isX = !isY; if( plane==lastPlane && ladder!=lastLadder)continue; for (int is=0; is<2; is++){ //loop over sensors if( plane==lastPlane && is!=lastSensor)continue; // if(_debug)cout<<"MAP "<(iv, t_track)); //...and store a new candidate };//end loop over sensors }else{ /// CALORIMETER ================================================= ExtHit cluster = _cal_cl[icl]; int plane = 6 + cluster.view; if( plane==lastPlane )continue; int ladder = (int)(cluster.coordPU / 32); int sensor = -1; //not yet known bool isX = (cluster.view)%2; bool isY = !isX; ExtTrack t_track = ExtTrack(); trackCand.Copy(t_track); float xmABar[]={0.,0.,0.,0.,0.}; //importante inizializzare a zero, come prima stima per il PFA float ymABar[]={0.,0.,0.,0.,0.}; // sensor is not evaluated float zmAB[]={0.,0.,0.}; EvaluateClusterPosition_Calorimeter( icl, sensor, xmABar, ymABar, zmAB); if( isX ){ t_track.SetX(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetXGood(plane,icl+1, ladder, sensor); //...add a point. t_track.SetYGood(plane, 0, ladder, sensor); //...add a point... } if( isY ){ t_track.SetY(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetYGood(plane,icl+1, ladder, sensor); t_track.SetXGood(plane, 0, ladder, sensor); } trackCandidates[mapIndex+1].insert(pair(iv, t_track)); //...and store a new ca } if( trackCandidates[mapIndex].size() > (uint)nTrackMAX ){ // EM, compilation warning comparison between signed and unsigned if(_debug)cout << "n.candidates "< "< nTrakMAX ){ // if(_debug)cout << "n.candidates "< "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ // ExtTrack &trackCand = (*trkIter).second; // cout << " >> "; // cout << " X: "; // for(int ip=0; ip::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; int ifail=0; trackCand.ResetFit(); trackCand.Fit(0.,ifail,0); if(ifail!=0)trackCand.ResetFit(); // ----------------------------------- // first selection of track candidates // ----------------------------------- if(TMath::IsNaN(trackCand.chi2))continue; if(trackCand.chi2 <= 0. || trackCand.chi2 > 1.e7)continue; // if(trackCand.chi2 < 0. || trackCand.chi2 > 10. )continue; iCand++; if(_debug){ cout<< " TRK chi2 "<=0)cout << trackCand.GetClusterX_ID(ip)<<":"<=0)cout << trackCand.GetClusterY_ID(ip)<<":"<DoTrack(trackCand.al);//<<<< integrate the trajectory // for(int ip=0; ipx[ip]; // trackCand.yGF[ip] = tgf->y[ip]; // } trackCandidates[mapIndex].insert(pair(lastView, trackCand)); } if(trackCandidates[mapIndex].size()==0)return;//no good candidates if(_debug)cout << "n.candidates "<GetCaloLevel1(); // if(!l1)return; vector caloChi2; vector caloHit; int caloHitMAX=0; vector caloMip; trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = ((*trkIter).second); // trackCand.DoTrack(&caloTj);//integrate the trajectory through the calorimeter _caloTj->DoTrack(trackCand.al,trackCand.zini); // _caloTj->Dump(); float chi2 = 0.; int nhit = 0; float cmip = 0.; for(Int_t ih=0; ihistrip; ih++){ Int_t view = -1; Int_t plane = -1; Int_t strip = -1; Float_t mip = l1->DecodeEstrip(ih,view,plane,strip); if(view<0)continue; if(plane<0)continue; if(strip<0)continue; if(mip<=0)continue; float dxy = _caloCoord[view][plane][strip]-(view?_caloTj->y[plane*2+(view?0:1)]:_caloTj->x[plane*2+(view?0:1)]); if(plane<11) chi2+= mip * TMath::Power(dxy,2.); // caloZ[plane*2+(view?0:1)]=st.GetZ(); if( fabs(dxy) < 2. && plane<11)nhit++; if( fabs(dxy) < 2. && plane<11)cmip+=mip; }; if(l1->istrip>0)chi2 = chi2/l1->istrip; caloHit.push_back(nhit); if(nhit>caloHitMAX)caloHitMAX=nhit; if(_debug){ cout << " CALO "; // cout << " chi2 "<< chi2 <<" "; cout << " nhit (< 11th plane) "<< nhit <<" "; // cout << " mip "<< cmip <<" "; cout <::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; if(caloHit[iCand]==caloHitMAX)trackCandidates[mapIndex].insert(pair(lastView, trackCand)); iCand++; } if(trackCandidates[mapIndex].size()==0)return;//no good candidates if(_debug)cout << "n.candidates "<GetToFLevel2(); // if(!tl2)return; iCand =0; vector tofHit; int tofHitMAX=0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ // int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; _tgf->DoTrack(trackCand.al);//<<<< integrate the trajectory for(int ip=0; ipx[ip]; trackCand.yGF[ip] = _tgf->y[ip]; } int nhit =0; for(int iToF=0; iToF<6; iToF++){ int iGF = iToF; if(iToF>3)iGF = iToF+8; int iPaddle = tl2->GetPaddleIdOfTrack( trackCand.xGF[iGF], trackCand.yGF[iGF], iToF); if( tl2->HitPaddle(iToF,iPaddle) )nhit++; } iCand++; tofHit.push_back(nhit); if(nhit>tofHitMAX)tofHitMAX=nhit; if(_debug){ cout << " TOF nhit "<< nhit <<" "; cout <::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; if(tofHit[iCand]==tofHitMAX)trackCandidates[mapIndex].insert(pair(lastView, ExtTrack(trackCand))); iCand++; } if(_debug)cout << "n.candidates "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack &trackCand = (*trkIter).second; cout<< " TRK chi2 "<=0) cout << setw(2)<=0) cout << setw(2)<::iterator trkIter1 = trkBegin; trkIter1!=trkEnd; ++trkIter1){ //loop over tracks (1) ExtTrack &trackCand1 = (*trkIter1).second;// get candidate 1... ExtTrack t_track = ExtTrack();// ...create a new ExtTrack instance... trackCand1.Copy(t_track); // ...and make a copy bool HBM = false; //has been merged for( multimap::iterator trkIter2 = trkBegin; trkIter2!=trkEnd; ++trkIter2){//loop over tracks (2) ExtTrack &trackCand2 = (*trkIter2).second; // get candidate 2... bool CBM = true; for(int ip=0; ip they cannot be merged if(!CBM)break; if( t_track.YGood(ip) && trackCand2.YGood(ip) && ( t_track.GetClusterY_ID(ip)!=trackCand2.GetClusterY_ID(ip) || t_track.GetSensor(ip)!=trackCand2.GetSensor(ip) ) && true )CBM=false; // if both have a y-hit and it is not the same ---> they cannot be merged if(!CBM)break; } // if(_debug)cout << " can be merged ? "<::iterator trkB = trackCandidates[mapIndex].begin(); multimap::iterator trkE = trackCandidates[mapIndex].end(); // bool ADD = true; for( multimap::iterator trkI = trkB; trkI!=trkE; ++trkI){ ExtTrack &trackC = (*trkI).second; bool SAME=true; for(int ip=0; ip INSERT "<=0) cout << setw(2)<=0) cout << setw(2)<> Merged"; } if(ADD){ // cout << " >> re-evaluate..."; // ///////////////////////////////////////////////////////// FIT START int ifail=0; t_track.ResetFit(); // t_track.Dump(); t_track.Fit(0.,ifail,0);// if( ifail != 0 || TMath::IsNaN(t_track.chi2) ){ // if(_debug){ // t_track.ResetFit(); // t_track.Fit(0.,ifail,2);// // } continue; } // t_track.Fit(0.,ifail,0,1);//evaluate again taking into account the track angle // if( TMath::IsNaN(t_track.chi2) )continue; // if( ifail != 0 )continue; // ///////////////////////////////////////////////////////// FIT FINISH // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // re-evaluated coordinates // and // evaluated other track info // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // float VMS[22];VMS[0]=0.; // EM, 2245:13: warning: variable ?VMS? set but not used [-Wunused-but-set-variable] for(int ip=0; ip NEXTPLANES - _alg_nViewCal){ // int nW = (int)((ip - 6 + 1)/2); // float dW = 0.74*factor;//X0 // float dW_cm = 0.26*factor;//cm // float dSi_cm = 0.; //cm // if(isY) dSi_cm = ( ip%2 ? 0.228 : 0.428); // dSi_cm *= factor; // float theta = 0.; // if(t_track.GetRigidity()!=0.)theta = 0.0136/t_track.GetRigidity(); // theta = theta * sqrt(dW) * (1.+0.038*log(dW)); // float Vt = theta*theta; //cov(theta,theta) // float Vy = Vt * dW_cm * dW_cm /3.; //cov(y,y) // float Vty = 0.87 * Vt * Vy; //cov(theta,y) // float Vc = Vy + dSi_cm * dSi_cm * Vt + 2. * dSi_cm * Vty; // float rms = sqrt( Vc + (nW>0 ? VMS[nW-1] : 0.) ); // if(_debug)cout <GetCluster(iclx); float mip = TrkParams::GetMIP(cluster->GetLadder()-1,cluster->view-1); smip = cluster->GetSignal()/(mip>0.?mip:1.); multmax = cluster->GetMultiplicity()*10000+cluster->maxs; }else{ ExtHit cluster = _cal_cl[iclx]; smip = cluster.signal;//mip multmax = cluster.mult*10000+lrint(cluster.coordPU); } t_track.dedx_x[ip] = smip/(factor>0.?factor:1.); t_track.multmaxx[ip] = multmax; } if(t_track.YGood(ip)){ if(isTrk){ TrkCluster *cluster = _trk_l1->GetCluster(icly); float mip = TrkParams::GetMIP(cluster->GetLadder()-1,cluster->view-1); smip = cluster->GetSignal()/(mip>0.?mip:1.); multmax = cluster->GetMultiplicity()*10000+cluster->maxs; }else{ ExtHit cluster = _cal_cl[icly]; smip = cluster.signal;//mip multmax = cluster.mult*10000+lrint(cluster.coordPU); } t_track.dedx_y[ip] = smip/(factor>0.?factor:1.); t_track.multmaxy[ip] = multmax; } } ///////////////////////////////////////////////////////// end additional info // ///////////////////////////////////////////////////////// RE-FIT START t_track.Fit(0.,ifail,0);//evaluate again taking into account the track angle if( TMath::IsNaN(t_track.chi2) )continue; if( ifail != 0 )continue; // ///////////////////////////////////////////////////////// RE-FIT FINISH if(_debug){ // cout << endl; // cout << " >> al: ";for(int i=0; i<5; i++)cout <> al: ";for(int i=0; i<5; i++)cout <=0) cout << setw(2)<=0) cout << setw(2)<> ADD "; } _caloTj->DoTrack(t_track.al,t_track.zini); for(int ip=0; ip<_caloTj->npoint; ip++){ t_track.xGF[ip] = _caloTj->x[ip]; t_track.yGF[ip] = _caloTj->y[ip]; } // cout << "ADD "<(t_track.GetNX()+t_track.GetNY(), ExtTrack(t_track))); if(t_track.GetNX()+t_track.GetNY()>5 && t_track.chi2::iterator, multimap::iterator> nxny[NEXTVIEWS]; // for(int inxny=0; inxny=nClFixX+nClFixY; inxny--){ nxny[inxny] = trackCandidates[mapIndex].equal_range(inxny); // cout << " --- n "<::iterator it = nxny[inxny].first; it!=nxny[inxny].second; ++it){ ExtTrack &trackC = (*it).second; // cout << " NX+NY "<< trackC.GetNX()+trackC.GetNY() <<" chi2 "< 5 && trackC.chi2>chi2Min ) || (trackC.GetNX()+trackC.GetNY() == 5 && NMTI ) || false)continue; trackCandidates[mapIndex+1].insert(pair(inxny, ExtTrack(trackC))); // cout << " insert "< 5 )NMTI=true; } } mapIndex++; // if(_debug)cout << "n.candidates "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack &trackCand = (*trkIter).second; cout<< " TRK chi2 "<=0) cout << setw(2)<=0) cout << setw(2)<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = ((*trkIter).second); // trackCand.seqno = iCand; // trackCand.Dump(); new(tracks[iCand]) ExtTrack(trackCand); iCand++; }; }; /** * */ void ExtTrkingAlg::ProcessEvent2(Bool_t force){ // _debug=true; if(_debug)cout << " |---------------------------------------------------| "< trackCandidates[maxSize]; // map: last hit view vs TrkTrack int mapIndex = 0; multimap::iterator trkBegin; multimap::iterator trkEnd; int iCand; // ------------------------------------------------ // fill a map VIEW-CLUSTER // ------------------------------------------------ multimap clusterMap; FillClusterMap(clusterMap,_trk_l1,0);// trk clusters FillClusterMap(clusterMap,_cal_l1,12);// calorimeter clusters // ------------------------------------------------ // define iterators over clusters on the same view // ------------------------------------------------ pair ::iterator, multimap::iterator> ret[NEXTVIEWS]; multimap::iterator it[NEXTVIEWS]; for(int iv=0; iv>>>>>>>>>> INCLUDE "<>>>>>>>>>> INCLUDE "< NEXTVIEWS/2-nClFixX)continue; if( (iv%2) && (int)(0.5*iv) > NEXTVIEWS/2-nClFixY)continue; if(iv >= NEXTVIEWS - nViewCal )continue; //skip calo hits for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view int icl = it[iv]->second; TrkCluster *cluster = _trk_l1->GetCluster(icl); // cluster->Dump(); int ladder = cluster->GetLadder()-1; // int plane = cluster->GetPlane()-1; bool isY = (cluster->view)%2;// F77 1-12 ?? bool isX = !isY; /// TRACKER ============================================================================== for (int is=0; is<2; is++){ //loop over sensors //cout <>>> insert point float xmABar[]={0.,0.,0.,0.,0.}; // inizializzare a zero l'angolo, come prima stima per il PFA float ymABar[]={0.,0.,0.,0.,0.}; float zmAB[]={t_track.zm[plane],0.,0.};//mechanical z-coordinate EvaluateClusterPosition_Tracker( (isX?icl:-1), (isY?icl:-1), ladder, is, xmABar, ymABar, zmAB); if( isX ){ t_track.SetX(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetXGood(plane,icl+1,ladder,is); // t_track.SetYGood(plane,0,ladder,is); } if( isY ){ t_track.SetY(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],ymABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetYGood(plane,icl+1,ladder,is); // t_track.SetXGood(plane,0,ladder,is); } trackCandidates[mapIndex].insert(pair(iv, t_track)); } } } //============================================================== // ------------------------------------------------------------- // next: add views to each candidate, up to nClFixX+nClFixY // ------------------------------------------------------------- //============================================================== // for( ;mapIndex < nClFixX+nClFixY-1 ;++mapIndex){ for( int iii=0; iii< nClFixX+nClFixY-1; iii++){ // if(mapIndex>0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); if(_debug)cout<<"MAP "<::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = (*trkIter).second; int lastView = (*trkIter).first; //last inserted view bool lastIsTrk = (lastView < NEXTVIEWS - nViewCal); int lastPlane = (int)(0.5*lastView); if(!lastIsTrk)lastPlane =lastView-6; int lastLadder = trackCand.GetLadder(lastPlane); int lastSensor = trackCand.GetSensor(lastPlane); // cout <<" >>> lastView "< 6-nClFixX+trackCand.GetNX())continue; //not enough x-view left // if( !(iv%2) && (int)(0.5*iv) > 6-nClFixY+trackCand.GetNY())continue; //not enough y-view left // if( (iv%2) && trackCand.GetNX()==nClFixX )continue;//ok? // if( !(iv%2) && trackCand.GetNY()==nClFixY )continue;//ok? if( isX && trackCand.GetNX()==nClFixX )continue;//ok? if( isY && trackCand.GetNY()==nClFixY )continue;//ok? if( isX && (int)(0.5*iv) > 6+nViewCal/2 - nClFixX+trackCand.GetNX())continue; //not enough x-view left if( isY && (int)(0.5*iv) > 6+(nViewCal+1)/2 - nClFixY+trackCand.GetNY())continue; //not enough y-view left for ( it[iv]=ret[iv].first; it[iv]!=ret[iv].second; ++it[iv]){ //loop over clusters on the view int icl = it[iv]->second; // cout <<" >>> icl "<GetCluster(icl); int ladder = cluster->GetLadder()-1;//(_trk_l1->GetCluster(icl)->maxs-1)%1024 + 1; int plane = cluster->GetPlane()-1; // bool isY = (cluster->view)%2; // bool isX = !isY; if( plane==lastPlane && ladder!=lastLadder)continue; for (int is=0; is<2; is++){ //loop over sensors if( plane==lastPlane && is!=lastSensor)continue; // if(_debug)cout<<"MAP "<(iv, t_track)); //...and store a new candidate };//end loop over sensors }else{ /// CALORIMETER ================================================= ExtHit cluster = _cal_cl[icl]; int plane = 6 + cluster.view; if( plane==lastPlane )continue; int ladder = (int)(cluster.coordPU / 32); int sensor = -1; //not yet known bool isX = (cluster.view)%2; bool isY = !isX; ExtTrack t_track = ExtTrack(); trackCand.Copy(t_track); float xmABar[]={0.,0.,0.,0.,0.}; //importante inizializzare a zero, come prima stima per il PFA float ymABar[]={0.,0.,0.,0.,0.}; float zmAB[]={0.,0.,0.}; EvaluateClusterPosition_Calorimeter( icl, sensor, xmABar, ymABar, zmAB); if( isX ){ t_track.SetX(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetXGood(plane,icl+1, ladder, sensor); //...add a point. t_track.SetYGood(plane, 0, ladder, sensor); //...add a point... } if( isY ){ t_track.SetY(plane,xmABar[1],xmABar[2],ymABar[1],ymABar[2],xmABar[4]); t_track.SetZ(plane,0.5*(zmAB[1]+zmAB[2])); t_track.SetYGood(plane,icl+1, ladder, sensor); t_track.SetXGood(plane, 0, ladder, sensor); } trackCandidates[mapIndex+1].insert(pair(iv, t_track)); //...and store a new ca } if( trackCandidates[mapIndex+1].size() > (uint)nTrackMAX ){ //EM, 2826:50: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(_debug)cout << "n.candidates "< "<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); mapIndex++; iCand = 0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; int ifail=0; trackCand.ResetFit(); trackCand.Fit(0.,ifail,0); if(ifail!=0)trackCand.ResetFit(); // trackCand.Dump(); // ----------------------------------- // first selection of track candidates // ----------------------------------- if(TMath::IsNaN(trackCand.chi2))continue; if(trackCand.chi2 <= 0. || trackCand.chi2 > 1.e7)continue; // if(trackCand.chi2 < 0. || trackCand.chi2 > 10. )continue; iCand++; if(_debug){ cout<< " TRK chi2 "<=0)cout << trackCand.GetClusterX_ID(ip)<<":"<=0)cout << trackCand.GetClusterY_ID(ip)<<":"<(lastView, trackCand)); } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if(trackCandidates[mapIndex].size()==0){ mapIndex++; continue;//increment one calo plane } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if(_debug)cout << "n.candidates "<GetCaloLevel1(); // if(!l1)return; vector caloChi2; vector caloHit; int caloHitMAX=0; vector caloMip; // if(mapIndex>0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = ((*trkIter).second); // trackCand.DoTrack(&caloTj);//integrate the trajectory through the calorimeter _caloTj->DoTrack(trackCand.al,trackCand.zini); // _caloTj->Dump(); float chi2 = 0.; int nhit = 0; float cmip = 0.; for(Int_t ih=0; ihistrip; ih++){ Int_t view = -1; Int_t plane = -1; Int_t strip = -1; Float_t mip = l1->DecodeEstrip(ih,view,plane,strip); if(view<0)continue; if(plane<0)continue; if(strip<0)continue; if(mip<=0)continue; float dxy = _caloCoord[view][plane][strip]-(view?_caloTj->y[plane*2+(view?0:1)]:_caloTj->x[plane*2+(view?0:1)]); if(plane<11) chi2+= mip * TMath::Power(dxy,2.); // caloZ[plane*2+(view?0:1)]=st.GetZ(); if( fabs(dxy) < 2. && plane<11)nhit++; if( fabs(dxy) < 2. && plane<11)cmip+=mip; }; if(l1->istrip>0)chi2 = chi2/l1->istrip; caloHit.push_back(nhit); if(nhit>caloHitMAX)caloHitMAX=nhit; if(_debug){ cout << " CALO "; // cout << " chi2 "<< chi2 <<" "; cout << " nhit (< 11th plane) "<< nhit <<" "; // cout << " mip "<< cmip <<" "; cout <0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); mapIndex++; iCand = 0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; if(caloHit[iCand]==caloHitMAX)trackCandidates[mapIndex].insert(pair(lastView, trackCand)); iCand++; } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if(trackCandidates[mapIndex].size()==0){ mapIndex++; continue;//increment one calo plane } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if(_debug)cout << "n.candidates "<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); ToFLevel2* tl2=_tof_l2;//event->GetToFLevel2(); // if(!tl2)return; iCand =0; vector tofHit; int tofHitMAX=0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ // int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; _tgf->DoTrack(trackCand.al);//<<<< integrate the trajectory for(int ip=0; ipx[ip]; trackCand.yGF[ip] = _tgf->y[ip]; } int nhit =0; for(int iToF=0; iToF<6; iToF++){ int iGF = iToF; if(iToF>3)iGF = iToF+8; int iPaddle = tl2->GetPaddleIdOfTrack( trackCand.xGF[iGF], trackCand.yGF[iGF], iToF); if( tl2->HitPaddle(iToF,iPaddle) )nhit++; } iCand++; tofHit.push_back(nhit); if(nhit>tofHitMAX)tofHitMAX=nhit; if(_debug){ cout << " TOF nhit "<< nhit <<" "; cout <0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); mapIndex++; iCand = 0; for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ int lastView = (*trkIter).first; ExtTrack &trackCand = (*trkIter).second; if(tofHit[iCand]==tofHitMAX)trackCandidates[mapIndex].insert(pair(lastView, ExtTrack(trackCand))); iCand++; } if(_debug)cout << "n.candidates "<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack &trackCand = (*trkIter).second; cout<< " TRK chi2 "<=0) cout << setw(2)<=0) cout << setw(2)<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); mapIndex++; float chi2Min=1e10; iCand = 0; for( multimap::iterator trkIter1 = trkBegin; trkIter1!=trkEnd; ++trkIter1){ //loop over tracks (1) ExtTrack &trackCand1 = (*trkIter1).second;// get candidate 1... ExtTrack t_track = ExtTrack();// ...create a new ExtTrack instance... trackCand1.Copy(t_track); // ...and make a copy bool HBM = false; //has been merged for( multimap::iterator trkIter2 = trkBegin; trkIter2!=trkEnd; ++trkIter2){//loop over tracks (2) ExtTrack &trackCand2 = (*trkIter2).second; // get candidate 2... bool CBM = true; for(int ip=0; ip they cannot be merged if(!CBM)break; if( t_track.YGood(ip) && trackCand2.YGood(ip) && ( t_track.GetClusterY_ID(ip)!=trackCand2.GetClusterY_ID(ip) || t_track.GetSensor(ip)!=trackCand2.GetSensor(ip) ) && true )CBM=false; // if both have a y-hit and it is not the same ---> they cannot be merged if(!CBM)break; } // if(_debug)cout << " can be merged ? "< INSERT "<=0) cout << setw(2)<=0) cout << setw(2)<> Merged"; // cout << endl; } if(ADD){ // cout << " >> re-evaluate..."; // cout << " >> Merged? "<=0) // cout << setw(2)<=0) // cout << setw(2)<GetCluster(iclx); float mip = TrkParams::GetMIP(cluster->GetLadder()-1,cluster->view-1); smip = cluster->GetSignal()/(mip>0.?mip:1.); multmax = cluster->GetMultiplicity()*10000+cluster->maxs; }else{ ExtHit cluster = _cal_cl[iclx]; smip = cluster.signal;//mip multmax = cluster.mult*10000+lrint(cluster.coordPU); } t_track.dedx_x[ip] = smip/(factor>0.?factor:1.); t_track.multmaxx[ip] = multmax; } if(t_track.YGood(ip)){ if(isTrk){ TrkCluster *cluster = _trk_l1->GetCluster(icly); float mip = TrkParams::GetMIP(cluster->GetLadder()-1,cluster->view-1); smip = cluster->GetSignal()/(mip>0.?mip:1.); multmax = cluster->GetMultiplicity()*10000+cluster->maxs; }else{ ExtHit cluster = _cal_cl[icly]; smip = cluster.signal;//mip multmax = cluster.mult*10000+lrint(cluster.coordPU); } t_track.dedx_y[ip] = smip/(factor>0.?factor:1.); t_track.multmaxy[ip] = multmax; } } ///////////////////////////////////////////////////////// end additional info // ///////////////////////////////////////////////////////// RE-FIT START t_track.Fit(0.,ifail,0);//evaluate again taking into account the track angle if( TMath::IsNaN(t_track.chi2) )continue; if( ifail != 0 )continue; // ///////////////////////////////////////////////////////// RE-FIT FINISH if(_debug){ cout << endl; // cout << " >> al: ";for(int i=0; i<5; i++)cout <=0) cout << setw(2)<=0) cout << setw(2)<> ADD "; } _caloTj->DoTrack(t_track.al,t_track.zini); for(int ip=0; ip<_caloTj->npoint; ip++){ t_track.xGF[ip] = _caloTj->x[ip]; t_track.yGF[ip] = _caloTj->y[ip]; } // cout << "ADD "<(t_track.GetNX()+t_track.GetNY(), ExtTrack(t_track))); if(t_track.GetNX()+t_track.GetNY()>5 && t_track.chi2::iterator, multimap::iterator> nxny[NEXTVIEWS]; // for(int inxny=0; inxny=nClFixX+nClFixY; inxny--){ nxny[inxny] = trackCandidates[mapIndex].equal_range(inxny); // cout << " --- n "<::iterator it = nxny[inxny].first; it!=nxny[inxny].second; ++it){ ExtTrack &trackC = (*it).second; // cout << " NX+NY "<< trackC.GetNX()+trackC.GetNY() <<" chi2 "< 5 && trackC.chi2>chi2Min ) || (trackC.GetNX()+trackC.GetNY() == 5 && NMTI ) || (trackC.GetNX()+trackC.GetNY() == 5 && trackC.chi2>1. ) || false)continue; trackCandidates[mapIndex+1].insert(pair(inxny, ExtTrack(trackC))); // cout << " insert "< 5 )NMTI=true; } } mapIndex++; //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if( trackCandidates[mapIndex].size()==0 || (trackCandidates[mapIndex].size()>1 && nViewCal < _alg_nViewCal ) || false){ mapIndex++; continue;//increment one calo plane } //-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ if(_debug){ cout<< " Selected-track SUMMARY:"<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack &trackCand = (*trkIter).second; cout<< " TRK chi2 "<=0) cout << setw(2)<=0) cout << setw(2)<=maxSize)cout <<" ORRORE!!!! mapIndex"<= "<0)trackCandidates[mapIndex-1].clear(); trkBegin = trackCandidates[mapIndex].begin(); trkEnd = trackCandidates[mapIndex].end(); iCand = 0; // TClonesArray &tracks = *_trkArray; // tracks.Clear(); for( multimap::iterator trkIter = trkBegin; trkIter!=trkEnd; ++trkIter){ ExtTrack trackCand = ((*trkIter).second); // cout << iCand << " "<< trackCand.al[4] <= 100 && _whichAlg < 144) ProcessEvent1(force); else if(_whichAlg >= 200 && _whichAlg < 244) ProcessEvent2(force); else{ cout << " Algorythm id "<< _whichAlg <<" not implemented "<8)return -1; // if(view<0||view>1)return -1; // if(!view)return (int)(sis/3); // else return sis%3; // }; // int GetLadder(int view, int sis){ // if(sis<0||sis>8)return -1; // if(view<0||view>1)return -1; // if(!view)return sis%3; // else return (int)(sis/3); // }; // int GetSiSensor(int view, int l, int s){ // if(view<0||view>1)return -1; // if(s<0||s>2)return -1; // if(!view) return 3*s+l; // else return 3*l+s; // }; int CaloStripRoto::GetSensor(){ return GetCaloSensor(GetView(),GetSiSensor()); }; int CaloStripRoto::GetLadder(){ return GetCaloLadder(GetView(),GetSiSensor()); }; void CaloStripRoto::ResetAligParams(){ fPitch = 1.; shift[0]=0.; //L shift[1]=0.; //S shift[2]=0.; //Z alpha = 0.; // siSensor = -1;; }; /*1 * * */ bool CaloStripRoto::SensorContains(float x, float y){ float toll = 0.2;//cm // cout << "S -- SetStrip("< fYB && yM0 > fYA )return false; if( yM0+toll < fYB && yM0 < fYA )return false; if( xM0-toll > fXB && xM0 > fXA )return false; if( xM0+toll < fXB && xM0 < fXA )return false; // cout << "D -- SetStrip("< 31*fPitch*0.244+2.*toll)return false; return true; }; CaloStripRoto::CaloStripRoto(int view, int plane, int sisensor, Bool_t usemechanicalalignement){ SetView(view); SetPlane(plane); SetSiSensor(sisensor); st = CaloStrip(usemechanicalalignement); ResetAligParams(); if(!usemechanicalalignement){ // cout <<" SETTA I PARAMETRI DI ALLINEAMNETO -- da implementare"< x // // relative to silicon sensor // // S ^ // | | // 2 | | <- strip direction // sensor 1 | | // 0 |...|... // ------------> L // 0 1 2 // ladder // // void CaloStripRoto::Set(Int_t view, Int_t plane, float strip, int sisensor){ SetView(view); SetPlane(plane); float size = 8.05; //(cm) larghezza del sensore + zone morte //---------------------------- // Z-coordinate //---------------------------- float coordCM_strip; if( strip >0. && strip < 95.){ st.Set( view,plane,(int)strip);// istrip coordCM_strip = ( view ? st.GetY() : st.GetX() ); coordCM_strip *= (1-strip+(int)strip); st.Set( view,plane,(int)strip+1);// istrip+1 coordCM_strip += (strip-(int)strip)*( view ? st.GetY() : st.GetX() ); }else{ // cout << "CaloStripRoto::Set( "< ERROR: 0 =< strip =< 95 " << endl; if(strip>=95.)strip=95.; if(strip<=0.)strip=0.; st.Set( view,plane,(int)strip);// istrip coordCM_strip = ( view ? st.GetY() : st.GetX() ); } float coordCm_Z0 = st.GetZ(); //---------------------------- // strip-segment coordinates //---------------------------- float coordCm_LA = coordCM_strip; float coordCm_LB = coordCM_strip; float coordCm_SA = (-1)*size*1.5; //full calorimeter size float coordCm_SB = (+1)*size*1.5; //full calorimeter size float coordCm_ZA = coordCm_Z0; float coordCm_ZB = coordCm_Z0; //---------------------------- // rototraslation //---------------------------- //if sisensor is assigned (0,...8) the strip can be rototraslated bool ROTO = (sisensor>=0&&sisensor<9); if(ROTO){ if( GetCaloSiSensor(view,(int)(strip/32),0) != sisensor && GetCaloSiSensor(view,(int)(strip/32),1) != sisensor && GetCaloSiSensor(view,(int)(strip/32),2) != sisensor && true){ cout << " Strip "<0) dSi_cm = ( st.GetPlane()%2 ? 0.228 : 0.428); dSi_cm *= factor; // multiple scattering angle float theta = 0.;//ms theta = 0.0136/rig; theta = theta * sqrt(dW) * (1.+0.038*log(dW)); float Vt = theta*theta; //cov(theta,theta) float Vy = Vt * dW_cm * dW_cm /3.; //cov(y,y) float Vty = 0.87 * Vt * Vy; //cov(theta,y) float Vc = Vy + dSi_cm * dSi_cm * Vt + 2. * dSi_cm * Vty; float rms = sqrt( Vc ); // if(isY)t_track.resy[ip] = sqrt(rms*rms + t_track.resy[ip]*t_track.resy[ip]); // else t_track.resx[ip] = sqrt(rms*rms + t_track.resx[ip]*t_track.resx[ip]); // if(isY) VMS[nW] = rms*rms; // if(_debug)cout <=3){ cout << " --> NB resolution not accurate for layer "<