--- DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp 2006/08/04 10:31:26 1.5 +++ DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp 2006/11/22 08:31:11 1.9 @@ -5,6 +5,8 @@ **/ #include #include + +// ClassImp(CaloTrkVar); ClassImp(CaloLevel2); @@ -12,6 +14,13 @@ * CaloTrkVar constructor **/ CaloTrkVar::CaloTrkVar() { + this->Clear(); +}; + +/** + * Clear variables +**/ +void CaloTrkVar::Clear() { trkseqno = 0; noint = 0; ncore = 0; @@ -79,31 +88,13 @@ // CaloTrk = new TClonesArray("CaloTrkVar",1); // - nstrip = 0; - qtot = 0.; - impx = 0.; - impy = 0.; - tanx = 0.; - tany = 0.; - qmax = 0.; - nx22 = 0; - qx22 = 0.; - elen = 0.; - selen = 0.; - memset(perr, 0, 4*sizeof(Int_t)); - memset(swerr, 0, 4*sizeof(Int_t)); - memset(crc, 0, 4*sizeof(Int_t)); - memset(qq, 0, 4*sizeof(Int_t)); - memset(varcfit, 0, 2*sizeof(Float_t)); - memset(npcfit, 0, 2*sizeof(Int_t)); - memset(planemax, 0, 2*sizeof(Int_t)); - memset(cibar, 0, 2*22*sizeof(Int_t)); - memset(cbar, 0, 2*22*sizeof(Float_t)); - good = 0; - selftrigger = 0; - estrip = TArrayF(0,NULL); + this->Clear(); + // }; +/** + * Clear the CaloLevel2 object + **/ void CaloLevel2::Clear() { // CaloTrk->Clear(); @@ -130,7 +121,7 @@ memset(cbar, 0, 2*22*sizeof(Float_t)); good = 0; selftrigger = 0; - estrip.Reset(); + // }; @@ -192,64 +183,19 @@ l2->qmean[i] = ((CaloTrkVar *)CaloTrk->At(i))->qmean; l2->qlow[i] = ((CaloTrkVar *)CaloTrk->At(i))->qlow; l2->dX0l[i] = ((CaloTrkVar *)CaloTrk->At(i))->dX0l; + for (Int_t j=0; j<2; j++){ + for (Int_t k=0; k<22; k++){ + l2->tbar[i][k][j] = ((CaloTrkVar *)CaloTrk->At(i))->tbar[k][j]; + }; + }; } } /** - * Gives the detected energy for the given strip once loaded the event + * Should return the energy in GeV if the particle would be an electron + * using a parametrization taken from Monte Carlo simulation **/ -Float_t CaloLevel2::GetEstrip(Int_t view, Int_t plane, Int_t strip){ - Int_t splane = 0; - Int_t sstrip = 0; - // - if ( nstrip == 0 ) return(0.); - // - for (Int_t i = 0; i 0. ){ - splane = (Int_t)trunc(estrip.At(i)/1000000.); - sstrip = (Int_t)trunc((estrip.At(i)-((Float_t)splane*1000000.))/10000.); - if ( splane == plane && sstrip == strip ) return(estrip.At(i)-(Float_t)splane*1000000.-(Float_t)sstrip*10000.); - }; - } else { - if ( estrip.At(i) < 0. ){ - splane = (Int_t)trunc(-estrip.At(i)/1000000.); - sstrip = (Int_t)trunc((-estrip.At(i)-((Float_t)splane*1000000.))/10000.); - if ( splane == plane && sstrip == strip ) return(-estrip.At(i)-(Float_t)splane*1000000.-(Float_t)sstrip*10000.); - }; - }; - }; - return(0.); -}; - -/** - * Given estrip entry returns energy and strip -**/ -Float_t CaloLevel2::DecodeEstrip(Int_t entry, Int_t &view, Int_t &plane, Int_t &strip){ - if ( entry>nstrip ) return(0.); - // - if ( estrip.At(entry) > 0. ){ - view = 0; - plane = (Int_t)trunc(estrip.At(entry)/1000000.); - strip = (Int_t)trunc((estrip.At(entry)-((Float_t)plane*1000000.))/10000.); - return(estrip.At(entry)-(Float_t)plane*1000000.-(Float_t)strip*10000.); - }; - if ( estrip.At(entry) < 0. ){ - view = 1; - plane = (Int_t)trunc(-estrip.At(entry)/1000000.); - strip = (Int_t)trunc((-estrip.At(entry)-((Float_t)plane*1000000.))/10000.); - return(-estrip.At(entry)-(Float_t)plane*1000000.-(Float_t)strip*10000.); - }; - // - printf(" WARNING: problems decoding value %f at entry %i \n",estrip.At(entry),entry); - // - view = -1; - plane = -1; - strip = -1; - return(0.); -} - void CaloLevel2::GetElectronEnergy(Float_t &energy, Float_t &sigma){ if ( nstrip == 0 ) return; energy = qtot * 40.82 * 0.000106;