#ifndef HMDCWIREDATA_H #define HMDCWIREDATA_H #include "TObject.h" #include "hsymmat.h" #include "hmdcsizescells.h" #include #include "hmdclistgroupcells.h" #include "hlocation.h" class HMdcCal1; class HMdcCal2ParSim; class HMdcCal2Par; class HMdcTrackParam; class HMdcWireFit; class HMdcTrackFitInOut; class HMdcClus; class HMdcCal1Sim; class HMdcClusFit; class HMdcEvntListCellsAndTimes; class HGeantMdc; class HMdcWireData : public TObject { // One wire data for track fitter: protected: // Input data: Int_t sector; // MDC sector Int_t module; // MDC module Int_t layer; // MDC layer Int_t cell; // MDC cell Int_t timeIndx; // =1->time1, =2->time2 in HMdcCal1 Double_t tdcTimeCal1; // drift time from HMdcCal1 HMdcCal1* fMdcCal1; // pointer to the corresponding HMdcCal1 object // Fit var. and output data: Double_t signalTimeOffset; // signal time offset (signal_path/signal_speed) Double_t tdcTime; // = tdcTimeCal1 - signal_time_offset Double_t errTdcTime; // drift time error Double_t driftTime; // calculated drift time Double_t dev0; // = driftTime - tdcTime Double_t dev; // deviation = driftTime + time_offset - tdcTime Double_t chi2; // deviation^2 = (dev/errTdcTime)^2 Double_t distance; // distance from track to wire Double_t alpha; // impact angle of track (see HMdcCal2ParSim) Bool_t inCell; // =kTRUE - track cross this cell Double_t weight; // weight of this hit in fit Char_t hitStatus; // =1 hit is used in fit // =0 hit passed fit already before this fit // -1 hit excluded from this fit but can be used // in next fit Short_t sequentialIndex; // this object index in array // Variables for time optimization: Double_t oneDErrTdcTime2; // 1./(errTdcTime^2) Double_t wtNorm; // = weight/errTdcTime^2 // Variables for derivativatives calculation: Double_t driftTimeDer; // calculated drift time Double_t devDer; // deviation // Variables for errors calculation: Double_t dTdPar[4]; // [4] for 4 parameters of track HMdcSizesCellsLayer* fSCLayer; // HMdcSizesCells[sector][module][layer] static HMdcCal2Par* fCal2Par; static HMdcCal2ParSim* fCal2ParSim; Int_t geantTrackNum; // geant track number public: HMdcWireData(void); ~HMdcWireData(void){} void setCell(Int_t s, Int_t m, Int_t l, Int_t c, Int_t it, Float_t t); void setCell(HMdcCal1* cal1, Int_t it,Bool_t isGeant=kFALSE); void setNegTdcTimeTo0(void); void setSignalTimeOffset(Double_t offset); void setSizesCellsLayer(HMdcSizesCellsLayer* fscl) {fSCLayer=fscl;} void setWeightTo1or0(Double_t maxChi2, Double_t minWeight); void setWeightAndWtNorm(Double_t wt) {weight=wt; wtNorm=wt*oneDErrTdcTime2;} void setHitStatus(Int_t st) {hitStatus=st;} static void setCal2Par(HMdcCal2Par* c2par, HMdcCal2ParSim* c2ParSim); void setErrTdcTime(Double_t err) {errTdcTime=err;} void setSequentialIndex(Short_t i) {sequentialIndex=i;} void setUnitWeight(void); void getAddress(Int_t& s, Int_t& m, Int_t& l, Int_t& c, Int_t& it); Int_t getSector(void) const {return sector;} Int_t getModule(void) const {return module;} Int_t getLayer(void) const {return layer;} Int_t getCell(void) const {return cell;} Int_t getTimeIndx(void) const {return timeIndx;} Double_t getTdcTimeCal1(void) const {return tdcTimeCal1;} Double_t getSignalTimeOffset(void) const {return signalTimeOffset;} Double_t getTdcTime(void) const {return tdcTime;} Double_t getErrTdcTime(void) const {return errTdcTime;} Double_t getDrTime(void) const {return driftTime;} Double_t getDev(void) const {return dev;} Double_t getChi2(void) const {return chi2;} Double_t getDistance(void) const {return distance;} Double_t getAlpha(void) const {return alpha;} Bool_t isInCell(void) const {return inCell;} Double_t getWeight(void) const {return weight;} Char_t getHitStatus(void) const {return hitStatus;} Double_t getOneDErrTdcTime2(void) const {return oneDErrTdcTime2;} Double_t getWtNorm(void) const {return wtNorm;} Double_t getDrTimeDer(void) const {return driftTimeDer;} Double_t* getDTdParArr(void) {return dTdPar;} Short_t getSequentialIndex(void) const {return sequentialIndex;} Int_t getGeantTrackNum(void) const {return geantTrackNum;} HMdcSizesCellsLayer* getSCLayer(void) const {return fSCLayer;} Int_t getSequentialLayNum(void) const {return layer+module*6;} void getLocation(HLocation& loc) const; void calcTdcErrors(HMdcTrackParam& par); Bool_t isPassedFit(void) const { return (hitStatus==1 && weight>0.1) ? kTRUE:kFALSE;} void calcDriftTime(HMdcTrackParam& par); void calcDriftTimeAndInCell(HMdcTrackParam& par); void calcDriftTimeForDeriv(HMdcTrackParam& par); void recalcFunctional(HMdcTrackParam& par); void calcFunctional(HMdcTrackParam& par); void calcFunctionalForDer(HMdcTrackParam& par); void calcDevAndFunct(HMdcTrackParam& par); Bool_t removeIfWeightLess(Double_t wtCut, HMdcList24GroupCells& list); Int_t unsetFittedHit(HMdcList24GroupCells& list) const; void fillWireFitCont(HMdcWireFit* fWireFit) const; void fillWireFitSimCont(HMdcWireFit* fWireFit, Int_t trackNum) const; void removeThisWire(HMdcList24GroupCells& list); Bool_t removeOneTimeIfItDoubleTime(HMdcWireData* time1, HMdcList24GroupCells& list); Bool_t removeIfOneDistOutCell(HMdcWireData* wire2, HMdcList24GroupCells& list); void calcDriftTimeAndFunct(HMdcTrackParam& par); void initDTdPar(Int_t par) {if(hitStatus==1) dTdPar[par]=driftTimeDer;} void calcDTdPar(Int_t par, Double_t oneDv2Step); Double_t getHijEll(Int_t i, Int_t j) const; void printIfDeleted(void) const; void subtractWireOffset(HMdcTrackParam& par, Double_t sigSpeed); void setHitStatM1toP1(void) {if(hitStatus==-1) hitStatus=1;} void addToTOffsetErr(HMdcTrackParam& par); void printTime(Int_t iflag, HMdcTrackParam& par, Bool_t isGeant=kFALSE); void setTukeyWeight(Double_t cwSig,Double_t c2Sig,Double_t c4Sig, Double_t& sumWt, Double_t& funct); Bool_t isAddressEq(Int_t s, Int_t m, Int_t l, Int_t c); private: void setInitVal(void); ClassDef(HMdcWireData,0) // One wire data for track piece fitter }; class HMdcWiresArr : public TObject { protected: HMdcWireData* wires; // Array of HMdcWireData objects Int_t arraySize; // Size of "wires" array Int_t nDriftTimes; // Number of drift times in track // Input data: HMdcClus * fClst1; // HMdcClus * fClst2; // is used for sector track (magnet off) Int_t segment; // segment Int_t sector; // sector Float_t xClst; // cluster position on Float_t yClst; // the project plane Float_t zClst; HMdcTrackFitInOut* fitInOut; HMdcList24GroupCells lInputCells; // sells list for fitting (input) HMdcList24GroupCells lOutputCells; // cells list passed fit Int_t nMdcTimes[4]; // Num. of hits in MDC's Int_t firstTime; Int_t lastTime; HMdcWireData* firstWire; HMdcWireData* lastWire; Int_t nModsInFit; // number of modules in this fit Int_t numOfGoodWires; // number of wires passed fit Double_t sigma2; // last sigma^2 of chi2 distr. which was // used for weights calc. HLocation locCal1; // location of HMdcCal1 object HMdcWireData* firstWireInLay[24]; // first wire in layer HMdcWireData* lastWireInLay[24]; // last wire in layer Bool_t fprint; // debuging print flag Double_t grad[4]; // Gradient of downhill direction Double_t agrad; TMatrixD grad2; TMatrixD matrH; // For GEANT events for filling HMdcClusFitSim containers: Int_t trackNum[200]; // track numbers Int_t numWiresClus[200]; // num. of wires in cluster for each tr. Int_t numWiresFit[200]; // num. of wires passed fit for each tr. public: HMdcWiresArr(void); ~HMdcWiresArr(void); void setNumDriftTimes(Int_t nDrTm); void setPrintFlag(Bool_t flag=kTRUE) {fprint=flag;} void setXYZClust(Float_t x, Float_t y, Float_t z) { xClst=x; yClst=y; zClst=z;} HMdcWireData* getWiresArray(void) {return wires;} HMdcWireData* getWireData(Int_t n) { return (n>=0 && n