//////////////////////////////////////////////////////////////////////////// // PndFtsGeometricTracker // // Class for digitalization for FTS // // authors: Pablo Genova - Pavia University // Lia Lavezzi - Pavia University // // modified for forward tracking by Isabella Garzia - Ferrara Univertsity //////////////////////////////////////////////////////////////////////////// #include "PndFtsGeometricTracker.h" #include "PndFtsHit.h" #include "PndFtsHitInfo.h" #include "PndFtsPoint.h" #include "PndFtsSingleStraw.h" #include "PndGeoFtsPar.h" #include "PndFtsTube.h" #include "PndFtsMapCreator.h" #include "PndFtsSignalOverlap.h" #include "PndTrackCand.h" #include "PndTrack.h" #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" #include "FairGeoNode.h" #include "FairGeoTransform.h" #include "FairGeoRotation.h" #include "FairGeoVector.h" #include "TGeoManager.h" #include "TClonesArray.h" #include "TVector3.h" #include "TRandom.h" #include #include #include #include #include using namespace std; using std::cout; using std::endl; using std::sqrt; unsigned PndFtsGeometricTracker::IN_TRK_COUNTER; unsigned PndFtsGeometricTracker::OUT_TRK_COUNTER; // ----- Default constructor ------------------------------------------- PndFtsGeometricTracker::PndFtsGeometricTracker(): FairTask("Ideal FTS Hit Producer",0), /*fPointArray(0),*/ fHitArray(0), fVolumeArray(0), /*fHitInfoArray(0),*/ fevtn(0), fFtsParameters(new PndGeoFtsPar()), fPersistence(kTRUE), fOverlap(kFALSE) { } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- PndFtsGeometricTracker::~PndFtsGeometricTracker() { } // ------------------------------------------------------------------------- // ----- Public method Init -------------------------------------------- InitStatus PndFtsGeometricTracker::Init() { fevtn=0; std::cout<<"#########################################################"<GetObject("FTSPoint"); //if ( ! fPointArray ) { //cout << "-W- PndFtsGeometricTracker::Init: " //<< "No FTSPoint array!" << endl; //return kERROR; //} // Create and register output array: without fOverlap //fHitArray = new TClonesArray("PndFtsHit"); //ioman->Register("FTSHit","FTS",fHitArray, fPersistence); ////new part: create and register output array //if(!fOverlap){ //fHitArray = new TClonesArray("PndFtsHit"); //ioman->Register("FTSHit","FTS",fHitArray, fPersistence); //} //else{ ////if overlap on, save the overlapped hits in regular ////output TCA (FTSHit) and the "original" hits (non overlapped) ////in another TCA (FTSOriginalHit) //fOverlapHitArray = new TClonesArray("PndFtsHit"); //ioman->Register("FTSHit","FTS",fOverlapHitArray,fPersistence); //fHitArray = new TClonesArray("PndFtsHit"); //ioman->Register("FTSOriginalHit","FTS",fHitArray, fPersistence); //} fHitArray = (TClonesArray*) ioman->GetObject("FTSHit"); if ( ! fHitArray ) { cout << "-W- PndFtsGeometricTracker::Init: " << "No FTSHit array!" << endl; return kERROR; } fTrackCandArray = ioman->Register("TrackCand", "PndTrackCand","FTS", kTRUE); fTrackArray = ioman->Register("Track", "PndTrack","FTS", kTRUE); // Create and register output array //fHitInfoArray = new TClonesArray("PndFtsHitInfo"); //ioman->Register("FTSHitInfo", "FTS", fHitInfoArray, kFALSE); fVolumeArray = gGeoManager->GetListOfVolumes(); cout << "-I- PndFTSHitProducerRealFast: INITIALIZATION SUCCESSFUL" << endl; //CHECK added PndFtsMapCreator *mapper = new PndFtsMapCreator(fFtsParameters); fTubeArray = mapper->FillTubeArray(); readgeom(); return kSUCCESS; } // ------------------------------------------------------------------------- void PndFtsGeometricTracker::SetParContainers() { FairRuntimeDb* rtdb = FairRunAna::Instance()->GetRuntimeDb(); fFtsParameters = (PndGeoFtsPar*) rtdb->getContainer("PndGeoFtsPar"); } // ----- Public method Exec -------------------------------------------- void PndFtsGeometricTracker::Exec(Option_t*) { //std::cout<<"PndFtsHitProducer Exec ########"<= 3) cout << "Event Number "<Delete(); //fHitInfoArray->Clear(); //if(fOverlap) fOverlapHitArray->Delete(); //Int_t detID = 0; // detectorID TVector3 pos, dpos; // position and error vectors // Declare some variables PndFtsHit* hit = NULL; // Loop over FtsPoints Int_t nHits = fHitArray->GetEntriesFast(); DataHit.clear(); // cout << "------------ " << nPoints << endl; ////for (Int_t iPoint = 0; iPoint < nPoints; iPoint++) { ////point = (PndFtsPoint*) fPointArray->At(iPoint); ////if (point == NULL) continue; ////detID = point->GetDetectorID(); ////// tubeID CHECK added ////Int_t skew = 0; ////Int_t tubeID = point->GetTubeID(); ////Int_t chamberID=point->GetChamberID(); ////Int_t layerID=point->GetLayerID(); ////PndFtsTube *tube = (PndFtsTube*) fTubeArray->At(tubeID); //////if skewed tube: skew==1 ////if(layerID>=3 && layerID<=6){skew=1;} //skewed tudes fts1 ////if(layerID>=11 && layerID<=14){skew=1;} //skewed tudes fts2 ////if(layerID>=19 && layerID<=22){skew=1;} //skewed tudes fts3 ////if(layerID>=27 && layerID<=30){skew=1;} //skewed tudes fts4 ////if(layerID>=35 && layerID<=38){skew=1;} //skewed tudes fts5 ////if(layerID>=43 && layerID<=46){skew=1;} //skewed tudes fts6 ////double InOut[6]; ////memset(InOut, 0, sizeof(InOut)); ////InOut[0] = point->GetXInLocal(); ////InOut[1] = point->GetYInLocal(); ////InOut[2] = point->GetZInLocal(); ////InOut[3] = point->GetXOutLocal(); ////InOut[4] = point->GetYOutLocal(); ////InOut[5] = point->GetZOutLocal(); ////// single straw tube simulation ----------------------- ////PndFtsSingleStraw fts; //////setting the single straw tube simulation constants ////// 3 options currently available: ////// TConst(tube radius (cm), gas pressure (bar), Ar%, CO2%) ////// fts.TConst(0.4, 1, 0.9, 0.1); //////fts.TConst(0.5, 1, 0.9, 0.1);//1 bar ////fts.TConst(0.5, 2, 0.8, 0.2); //2 bar ////// wire positioning->controllare bene ////fts.PutWireXYZ(0., 0., -75., 0., 0., 75.); ////// get particle momentum ////TVector3 momentum(point->GetPxOut(),point->GetPyOut(),point->GetPzOut()); // GeV/c ////Double_t GeV=1.; ////// position in cm (already in cm); momentum in GeV (already in GeV); mass in GeV (already in GeV) ////// drift time calculation ////Double_t pulset =-1; //////pulset = fts.PartToTime(point->GetMass()/GeV, momentum.Mag()/GeV, InOut); ////// constant initialization ////fts.TInit(point->GetMass()/GeV, momentum.Mag()/GeV, InOut); ////// true radius (cm) ////Double_t true_rad = fts.TrueDist(InOut); ////// simulated radius (cm) //////Double_t radius = fts.TimnsToDiscm(pulset); //////if(radius < 0.) radius = 0.; // CHECK //////if(radius <0. ||radius==0.) radius =-999; ////// fast simulation ////Double_t radius= fts.FastRec(true_rad,1) ; //,0) standard curve ,1) Juelich exp curve //////Juelich is at 2 bar pressure ////// dE calculation ////// double depCharge = fts.PartToADC(); ////// dE calculation ------- check ////// charge calculation ////Double_t depcharge = fts.FastPartToADC(); // CHECK arbitrary units! ////// dE/dx calculation postponed //////Double_t dedx = -999; //[R.K. 01/2017] unused variable? ////Double_t closestDistanceError = GetError(radius);//calculates the error according to Juelich experimental curves //////cout<<"radius "<GetX(), point->GetY(), point->GetZ()); // use this for hits having same coordinates as MC points ////TVector3 position = tube->GetPosition(); // use this for realistic hit production ////pos.SetXYZ(position.X(), position.Y(), position.Z()); // <--- stt1 ////// dpos.SetXYZ(innerStrawDiameter / 2., innerStrawDiameter / 2., GetLongitudinalResolution(position.Z())); ////dpos.SetXYZ(0.5, 0.5, 3.); // per adesso (stessi che in Ideal: ////// innerStrawDiameter/2 = 0.5, ////// longitudinalResolution = 3.) for (Int_t iHit = 0; iHit < nHits; iHit++) { hit = (PndFtsHit*) fHitArray->At(iHit); if (hit == NULL) continue; /* ********************* INFO ******************************************* - numer eventu WE point->GetEventID() - numer toru symulacyjny WE point->GetTrackID() - -1 by default (z MC) - numer layeru Int_t layerID=point->GetLayerID(); - numer slomki Int_t layerID=point->GetLayerID(); - radius jako WE radius (jak wyzej) - najblizszy punkt wziety z point->GetX(); point->GetY(); point->GetZ(); GEOMETRIA - pozycja geometryczna drutu WE point = (PndFtsPoint*) Double_t GetXWireDirection() const { return fX_wire_dir; } Double_t GetYWireDirection() const { return fY_wire_dir; } Double_t GetZWireDirection() const { return fZ_wire_dir; } - radius jako WY - z procedury dla danej slomki Int_t chamberID=point->GetChamberID(); // ********************* INFO *******************************************/ // create hit //if ( layerID <= 8 ) { // but why ??? //cout << " layerID " << layerID << endl; // *********************************************** ////AddHit(detID, tubeID, chamberID, layerID, skew, iHit, pos, dpos, pulset, radius, closestDistanceError, depcharge); // *********************************************** ////AddHitInfo(0, 0, point->GetTrackID(), iHit, 0, kFALSE); // *********************************************** //cout << " tubeID === " << tubeID << " point->GetTrackID() === " << point->GetTrackID() << endl; // copy info for tracker // TODO: rewrite to use hits directly, not copies. //AddDataHit( fevtn, detID, tubeID, chamberID, layerID, skew, iHit, pos, dpos, pulset, radius, closestDistanceError, depcharge, point->GetTrackID(), point->GetPxOut(),point->GetPyOut(),point->GetPzOut() ); pos.SetXYZ(hit->GetX(),hit->GetY(),hit->GetZ()); dpos.SetXYZ(hit->GetDx(),hit->GetDy(),hit->GetDz()); AddDataHit( fevtn, hit->GetDetectorID() , hit->GetTubeID(), hit->GetChamberID(), hit->GetLayerID(), hit->GetSkewed(), hit->GetRefIndex(), pos, dpos, hit->GetPulse(), hit->GetIsochrone(), hit->GetIsochroneError(), hit->GetDepCharge(), iHit, 0,0,0 ); //} }// Loop over MCPoints // *** here ALGORITHM //cout << " rozmiar input = " << DataHit.size() << endl; int trackmults[10] = { 0 }; // I need to check MC mult of each track before I plot IDEAL int testmults[10] = { 0 }; // I need to check MC mult of each track before I plot IDEAL int in_mults[10] = { 0 }; // I need to check MC mult of each track before I plot IDEAL int out_mults[10] = { 0 }; // I need to check MC mult of each track before I plot IDEAL double mom_mults_x[10] = { 0 }; double mom_mults_y[10] = { 0 }; double mom_mults_z[10] = { 0 }; for ( auto h : DataHit ) { if (h.trackID<10) ++trackmults[static_cast(h.trackID)]; /*cout << "track id = " << h.trackID << endl;*/ } for ( unsigned i=0; i(DataHit[i].trackID) ] < 0 ) DataHit[i].active = false; for ( auto h : DataHit ) { if (h.trackID<10 && h.active) ++testmults[static_cast(h.trackID)]; /*cout << "track id = " << h.trackID << endl;*/ } //for ( unsigned i{0}; i<10; ++i ) // if ( trackmults[i] > 0 ) cout << "track id - " << i << " mult - " << trackmults[i] << " test = " << testmults[i] << endl; DataHitIn.clear(); for (const auto& a : DataHit) if ( a.active ) { DataHitIn.push_back( a ); } // ONLY GOOD FOR MC EVALUATION //{ DataHitIn.push_back( a ); } // ALL for ALGORITHM INPUT DataHitOut.clear(); if ( !DataHitIn.empty() && DataHitIn.size() < 350. ) { DataHitOut = trackFinder( DataHitIn ); matchEmpty( DataHitOut, DataHitIn ); //cout << " rozmiar output = " << DataHitOut.size() << endl; } for ( const auto& h : DataHitIn ) { if (h.trackID<10 && h.active) { ++in_mults[static_cast(h.trackID)]; mom_mults_x[static_cast(h.trackID)]=h.mx; mom_mults_y[static_cast(h.trackID)]=h.my; mom_mults_z[static_cast(h.trackID)]=h.mz; } } std::map > trackcand; //[R.K.] int itrdh=0; //[R.K.] for ( const auto& h : DataHitOut ) { if (h.trackID<10 && h.active) ++out_mults[static_cast(h.trackID)]; trackcand[h.trackID].push_back(itrdh); //[R.K.] itrdh++; //[R.K.] } //[R.K.] for ( unsigned i{0}; i<10; ++i ) { if ( in_mults[i] > 0 || out_mults[i] > 0 ) cout << "track id - " << i << " IN mult - " << in_mults[i] << " OUT mult = " << out_mults[i] << " --- mom = " << mom_mults_x[i] <<" " << mom_mults_y[i] <<" " << mom_mults_z[i]; if (in_mults[i]==0 && out_mults[i] > 0) cout << " *ZONK* " << endl; cout << endl; if ( in_mults[i] > 0 ) ++IN_TRK_COUNTER; if ( out_mults[i] > 0 ) ++OUT_TRK_COUNTER; } //if ( DataHit.size()>=40. ) for (auto d : DataHitOut) { // ALGORITHM //for (auto d : DataHitIn) { //cout << " AddHit --- " << endl; //cout << "R = " << d.r << " strawId = " << d.tubeID << endl; TVector3 pos2; pos2.SetXYZ(d.x, d.y, d.z); TVector3 dpos2; dpos2.SetXYZ(d.dx, d.dy, d.dz); ////AddHit(d.detID, d.tubeID, d.chamberID, d.layerID, d.skew, d.iHit, pos2, dpos2, d.p, d.r, d.closestDistanceError, d.depcharge); ////AddHitInfo(0, d.evtNr, d.trackID, d.iHit, 0, kFALSE); //cout << "evt trkid tubeid chaberid layerid " << d.evtNr <<","<At(DataHitOut[hititer].iHit); //[R.K.] if(DataHitOut[hititer].z < DataHitOut[idfirst].z) idfirst=hititer; //[R.K.] if(DataHitOut[hititer].z > DataHitOut[idlast].z) idlast=hititer; //[R.K.] mycand.AddHit(myhit->GetEntryNr(),DataHitOut[hititer].z); //[R.K.] // Modifiers ----------------------- //[R.K.] //AddHit(UInt_t detId, UInt_t hitId, Double_t rho); //[R.K.] //AddHit(TString branchName, UInt_t hitId, Double_t rho); //[R.K.] //AddHit(FairLink link, Double_t rho); //[R.K.] } //[R.K.] //[R.K.] //create track from candidate //[R.K.] TVector3 mom(0.,0.,1.); //(px,py,pz);//TODO set proper seed for kalman filter //[R.K.] // Use the radius R in the circle() function. //[R.K.] //Having a struct for tracks (mom,q,vect) would help a lot! //[R.K.] TVector3 dmom(1.,1.,1.);//TODO set proper seed for kalman filter //[R.K.] int q=1; //TODO set proper charge from curve //[R.K.] //[R.K.] TVector3 o(0.,0.,0.), dj(1.,0.,0.), dk(0.,1.,0.); //[R.K.] //[R.K.] TVector3 posfirst(DataHitOut[idfirst].x,DataHitOut[idfirst].y,DataHitOut[idfirst].z); //[R.K.] TVector3 dposfirst(1.,1.,1.);//TODO set proper seed for kalman filter //[R.K.] o.SetZ(posfirst.Z()); //[R.K.] FairTrackParP myfirst(posfirst,mom,dposfirst,dmom,q,o,dj,dk); //[R.K.] //[R.K.] TVector3 poslast(DataHitOut[idlast].x,DataHitOut[idlast].y,DataHitOut[idlast].z); //[R.K.] TVector3 dposlast(1.,1.,1.); //[R.K.] o.SetZ(poslast.Z()); //[R.K.] FairTrackParP mylast(poslast,mom,dposlast,dmom,q,o,dj,dk); //[R.K.] //[R.K.] new( (*fTrackCandArray)[trknum] ) PndTrackCand(mycand); // copy to output //[R.K.] new( (*fTrackArray)[trknum] ) PndTrack(myfirst,mylast,mycand); // //[R.K.] trknum++; //[R.K.] //[R.K.] } //[R.K.] } cout << "IN OUT state = " << IN_TRK_COUNTER << " , " << OUT_TRK_COUNTER << endl; //if(fOverlap){ //PndFtsSignalOverlap *myoverlap=new PndFtsSignalOverlap(fHitArray); //myoverlap->OverlapSimultaneousSignals(fOverlapHitArray); //} // Event summary //cout << "-I- PndSttHitProducerRealFast: " << nPoints << " FtsPoints, " //<< nPoints << " Hits created." << endl; } // ------------------------------------------------------------------------- void PndFtsGeometricTracker::FoldZPosWithResolution(Double_t &zpos, Double_t &zposError, TVector3 , TVector3 ) // localInPos localOutPos //[R.K.03/2017] unused variable(s) { //Double_t //zPosInStrawFrame = (localOutPos.Z() - localInPos.Z()) / 2.; //[R.K. 01/2017] unused variable? //FIXME We have dummy Error calculation // zposError = gRandom->Gaus(0., GetLongitudinalResolution(zPosInStrawFrame)); zposError = gRandom->Gaus(0., 3.); // per adesso (stesso che in Ideal: // longitudinalResolution = 3.) zpos += zposError; } //---------------------------------------------------------------------------------------------------------------------------------------------------- void PndFtsGeometricTracker::AddDataHit( Int_t evtNr, Int_t detID, Int_t tubeID, Int_t chamberID, Int_t layerID, Int_t skew, Int_t iHit, TVector3& pos, TVector3& dpos, Double_t p, Double_t rsim, Double_t closestDistanceError, Double_t depcharge, Double_t tid, Double_t mmx, Double_t mmy, Double_t mmz ) { //cout << "PndFtsGeometricTracker::AddDataHit working here " << mm << endl; //if ( rand() % 2 == 0 ) { DataHit.push_back( PndFtsGeometricTracker::DataHitUnit( evtNr, detID, tubeID, chamberID, layerID, skew, iHit, pos.X(), pos.Y(), pos.Z(), dpos.X(), dpos.Y(), dpos.Z(), p, rsim, closestDistanceError, depcharge, tid, mmx,mmy,mmz ) ); //} /* Int_t evtNr; Int_t detID; Int_t tubeID; Int_t chamberID; Int_t layerID; Int_t skew; Int_t iHit; Double_t x; Double_t y; Double_t z; Double_t dx; Double_t dy; Double_t dz; Double_t p; Double_t r; Double_t closestDistanceError; Double_t depcharge; */ } //---------------------------------------------------------------------------------------------------------------------------------------------------- //// ----- Private method AddHit -------------------------------------------- //PndFtsHit* PndFtsGeometricTracker::AddHit(Int_t detID, Int_t tubeID, Int_t chamberID, Int_t layerID, Int_t skew, Int_t iHit, TVector3& pos, TVector3& dpos, Double_t p, Double_t rsim, Double_t closestDistanceError, Double_t depcharge) { //// see PndFtsHit for hit description //TClonesArray& clref = *fHitArray; //Int_t size = clref.GetEntriesFast(); //PndFtsHit *hitnew = new(clref[size]) PndFtsHit(detID, tubeID, chamberID, layerID, skew, iHit, pos, dpos, p, rsim, closestDistanceError, depcharge); //return hitnew; //} //// ---- //// ----- Private method AddHitInfo -------------------------------------------- //PndFtsHitInfo* PndFtsGeometricTracker::AddHitInfo(Int_t fileNumber, Int_t eventNumber, Int_t trackID, Int_t pointID, Int_t nMerged, Bool_t isFake){ //// see PndFtsHitInfo for hit description //TClonesArray& clref = *fHitInfoArray; //Int_t size = clref.GetEntriesFast(); //return new(clref[size]) PndFtsHitInfo(fileNumber, eventNumber, trackID, pointID, nMerged, isFake); //} Double_t PndFtsGeometricTracker::GetError(Double_t TrueDcm) { // data from julich Double_t resmic=-1; if(TrueDcm < 0.48){ resmic = 20. +1.48048e+02 -3.35951e+02*TrueDcm -1.87575e+03*pow(TrueDcm,2) +1.92910e+04*pow(TrueDcm,3) -6.90036e+04*pow(TrueDcm,4) +1.07960e+05*pow(TrueDcm,5) -5.90064e+04*pow(TrueDcm,6) ; } else resmic=65.; return resmic*0.0001; } //************************************************************************************************************** //************************************************************************************************************** //************************************************************************************************************** //************************************************************************************************************** //************************************************************************************************************** //************************************************************************************************************** //************************************************************************************************************** /************************************************************************/ vector< PndFtsGeometricTracker::DataHitUnit > PndFtsGeometricTracker::trackFinder( const vector< PndFtsGeometricTracker::DataHitUnit >& input ){ /************************************************************************/ vector< PndFtsGeometricTracker::DataHitUnit > output; map T; map::iterator it; int iv12,is12,iv34,is34,iv56,is56; int i,j,k,lsz,e,n,l,ilslread; size_t count; float f; int nbTr12,nbTr56; int sumasl=0,sumazn=0; //cout << endl << "START trackFinder!" << endl << endl; //for (int count = 0; count < input.size(); count++) //cout << input[count].evtNr << " " << input[count].trackID << " -1 " << input[count].layerID << " " << input[count].tubeID << " " << input[count].r << " " << input[count].x << " " << input[count].y << " " << input[count].z << endl; T.clear(); lf12v=lf12s=lf34v=lf34s=lf56v=lf56s=0; for (count = 0; count < input.size(); count++) { e=input[count].tubeID; f=input[count].r; it=T.find(e); if(it==T.end()){ if(e<289) lf12v++; else if(e<865) lf12s++; else if(e<1441) lf12v++; else if(e<2017) lf12s++; else if(e<2305) lf12v++; else if(e<2689) lf34v++; else if(e<3457) lf34s++; else if(e<4289) lf34v++; else if(e<5185) lf34s++; else if(e<5633) lf34v++; else if(e<6457) lf56v++; else if(e<8105) lf56s++; else if(e<9753) lf56v++; else if(e<11401) lf56s++; else if(e<12225) lf56v++; T.insert(pair(e,f)); } else if((it->second)>f) (it->second)=f; } if(lf12v!=0) F12v = new straw[lf12v]; if(lf12s!=0) F12s = new straw[lf12s]; if(lf34v!=0) F34v = new straw[lf34v]; if(lf34s!=0) F34s = new straw[lf34s]; if(lf56v!=0) F56v = new straw[lf56v]; if(lf56s!=0) F56s = new straw[lf56s]; iv12=0;is12=0;iv34=0;is34=0;iv56=0;is56=0; for (it = T.begin();it != T.end(); ++it) { n=it->first; l=G[n].l; if(l==1||l==2||l==7||l==8||l==9||l==10||l==15||l==16) { F12v[iv12].nr=n; F12v[iv12].l=l; F12v[iv12].r=it->second; F12v[iv12].x=G[n].x; F12v[iv12].y=G[n].y; F12v[iv12].z=G[n].z; iv12++; } else if(l<17) { F12s[is12].nr=n; F12s[is12].l=l; F12s[is12].r=it->second; F12s[is12].x=G[n].x; F12s[is12].y=G[n].y; F12s[is12].z=G[n].z; is12++; } else if(l==17||l==18||l==23||l==24||l==25||l==26||l==31||l==32) { F34v[iv34].nr=n; F34v[iv34].l=l; F34v[iv34].r=it->second; F34v[iv34].x=G[n].x; F34v[iv34].y=G[n].y; F34v[iv34].z=G[n].z; iv34++; } else if(l==19||l==20||l==21||l==22||l==27||l==28||l==29||l==30) { F34s[is34].nr=n; F34s[is34].l=l; F34s[is34].r=it->second; F34s[is34].x=G[n].x; F34s[is34].y=G[n].y; F34s[is34].z=G[n].z; is34++; } else if(l==33||l==34||l==39||l==40||l==41||l==42||l==47||l==48) { F56v[iv56].nr=n; F56v[iv56].l=l; F56v[iv56].r=it->second; F56v[iv56].x=G[n].x; F56v[iv56].y=G[n].y; F56v[iv56].z=G[n].z; iv56++; } else if(l==35||l==36||l==37||l==38||l==43||l==44||l==45||l==46) { F56s[is56].nr=n; F56s[is56].l=l; F56s[is56].r=it->second; F56s[is56].x=G[n].x; F56s[is56].y=G[n].y; F56s[is56].z=G[n].z; is56++; } } if((iv12+is12+iv34+is34+iv56+is56) != (lf12v+lf12s+lf34v+lf34s+lf56v+lf56s)) ilslread=0; else { lf12v=iv12; lf12s=is12; lf34v=iv34; lf34s=is34; lf56v=iv56; lf56s=is56; } for(i=0;i<100;i++){ for(j=0;j<49;j++) SF[i][j]=0; for(j=0;j<17;j++) { SF12[i][j]=0; SF34[i][j]=0; SF56[i][j]=0; fg[i][j]=-99999; }} f=12;nbTr12=0; if((lf12v*lf12s)!=0)track(f,&nbTr12,F12v,lf12v,F12s,lf12s); if(nbTr12>0) { f=56;nbTr56=0; if((lf56v*lf56s) !=0) track(f,&nbTr56,F56v,lf56v,F56s,lf56s); for(i=0;i0) for(j=1;j<17;j++) {SF[i][16+j]=SF34[i][j];} else continue; for(j=1;j<17;j++) {SF[i][16+j]=SF34[i][j];} // *** WPWP *** k=SF12[i][0]; SF[i][0]=k; if(k>=0) for(j=1;j<17;j++) {SF[i][32+j]=SF56[k][j];} for(j=1;j<49;j++) if(SF[i][j]!=0) {it=T.find(SF[i][j]); output.push_back(DataHitUnit( input[0].evtNr, 0, SF[i][j], 0, G[SF[i][j]].l, 0, 0, G[SF[i][j]].x,G[SF[i][j]].y, G[SF[i][j]].z, 0, 0, 0, 0, it->second, 0, 0, i )); }} //dopasuj(f,nbTr12,&lsz); } /* if(ilsladow12>0)*/ else lsz=0; sumasl=sumasl+ilslread; sumazn=sumazn+lsz; cout << "evt in out " << input[0].evtNr << " " << input.size() << " " << output.size() << endl; //cout << endl << "OUTPUT IN trackFinder!" << endl << endl; return output; } void PndFtsGeometricTracker::readgeom() { auto tmp = {294.895,295.77,299.39,300.265,304.39,305.265,309.39, 310.265,326.895,327.77,331.39,332.265,336.39,337.265, 341.39,342.265,393.995,394.87,400.965,401.84,415.49, 416.365,422.965,423.84,437.49,438.365,444.965,445.84, 459.49,460.365,466.965,467.84,606.995,607.87,611.49, 612.365,616.49,617.365,621.49,622.365,638.995,639.87, 643.49,644.365,648.49,649.365,653.49,654.365};//! copy( tmp.begin(), tmp.end(), zcoord ); // int nic; //cout << "FULL STOP" << endl; //cin >> nic; const char* env_p = std::getenv("VMCWORKDIR"); TString geopath(env_p); geopath += "/fts/geom.txt"; ifstream pp(geopath.Data()); //ifstream pp("/lustre/nyx/hades/user/przygoda/PANDAROOT/fts/geom.txt"); if (!pp) { cerr << "ERROR: PndFtsGeometricTracker: geom.txt not found in \""<>a>>b>>c>>d>>e>>f>>g>>h>>j>>k>>l>>m>>n; G[a].l=c; G[a].x=d; G[a].y=e; G[a].z=f; } pp.close(); //cout << "FULL STOP END" << endl; //cin >> nic; } /* circle */ void PndFtsGeometricTracker::circle(int i,straw *Fv,int lfv,straw *Fs,int lfs, int tr12,int tr56) { point P16, P,P1,PS,S;//P17,P33, int k,jj,SP[17],pom[17]; //yy,j,kk,licz, float ii,R,a1,a2,b1,b2,wa,wb; //alfa,beta,RR,ff[5],,energ float d,dmin,dall,dallmin,d1,d2,y1,y2,y; //dd, float aa,delta,dzox,dzoy;//,dzoxmin,dzoymin dv,ds, int l,layer,kmin,str_max; delta=0.5; //energ=0.55; //dv=0.5; //ds=0.5; P16.x=zcoord[15]; //P17.x=zcoord[16]; for(k=0;k<17;k++)SP[k]=0; //for(k=0;k<5;k++)ff[k]=0; //kk=1;licz=0; dallmin=5.0;str_max=0; for(jj=lfv-1;jj>=0 && Fv[jj].l>30;jj--){ P1.x=Fv[jj].z; P1.y=Fv[jj].x; //for(ii=zcoord[15]; ii