--- DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp 2007/01/11 09:32:54 1.10 +++ DarthVader/CalorimeterLevel2/src/CaloLevel2.cpp 2007/07/20 09:13:07 1.13 @@ -92,6 +92,12 @@ this->Clear(); // }; +/** + * Create the TClonesArray +**/ +void CaloLevel2::Set(){//ELENA + if(!CaloTrk)CaloTrk = new TClonesArray("CaloTrkVar",1); //ELENA +}//ELENA /** * Clear the CaloLevel2 object @@ -103,10 +109,8 @@ // nstrip = 0; qtot = 0.; - impx = 0.; - impy = 0.; - tanx = 0.; - tany = 0.; + // impx = 0.; + // impy = 0.; qmax = 0.; nx22 = 0; qx22 = 0.; @@ -116,8 +120,11 @@ 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(varcfit, 0, 4*sizeof(Float_t)); + memset(npcfit, 0, 4*sizeof(Int_t)); + memset(tanx, 0, 2*sizeof(Int_t)); + memset(tany, 0, 2*sizeof(Int_t)); + memset(fitmode, 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)); @@ -148,10 +155,10 @@ l2->qtot = qtot; l2->qx22 = qx22; l2->qmax = qmax; - l2->impx = impx; - l2->impy = impy; - l2->tanx = tanx; - l2->tany = tany; + // l2->impx = impx; + // l2->impy = impy; + // l2->tanx = tanx; + // l2->tany = tany; l2->elen = elen; l2->selen = selen; @@ -204,6 +211,49 @@ } /** + * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself. + * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!) +**/ +Float_t CaloLevel2::impx(Int_t tr){ + if ( tr == 0 ) return(cbar[0][0]); + if ( tr == 1 ) { + if ( !CaloTrk ) return(-110.); + TClonesArray &t = *(CaloTrk); + for (Int_t itrk=0; itrktrkseqno == -1 ) return(calotrack->tbar[0][0]); + }; + }; + if ( tr !=0 && tr !=1 ){ + printf(" Cannot get impx for other than calo or selftrigger tracks!\n"); + } else { + printf(" Cannot find selftrigger block\n"); + }; + return(-100.); +}; + +/** + * Returns the impact position on the top of the calorimeter as determined by the calorimeter itself. + * @param tr : if tr = 0 use the calorimeter "normal" fit, if 1 use the calorimeter "selftrigger" fit (if any!) +**/ +Float_t CaloLevel2::impy(Int_t tr){ + if ( tr == 0 ) return(cbar[0][1]); + if ( tr == 1 ) { + if ( !CaloTrk ) return(-110.); + TClonesArray &t = *(CaloTrk); + for (Int_t itrk=0; itrktrkseqno == -1 ) return(calotrack->tbar[0][1]); + }; + }; + if ( tr !=0 && tr !=1 ){ + printf(" Cannot get impy for other than calo or selftrigger tracks!\n"); + } else { + printf(" Cannot find selftrigger block\n"); + }; + return(-100.); +}; +/** * Should return the energy in GeV if the particle would be an electron * using a parametrization taken from Monte Carlo simulation **/ @@ -230,3 +280,30 @@ CaloTrkVar *calotrack = (CaloTrkVar*)t[itrk]; return calotrack; } + +/** + * Retrieves the calorimeter track matching the seqno-th tracker stored track. + * (If seqno = -1 retrieves the self-trigger calorimeter track) + */ +CaloTrkVar *CaloLevel2::GetCaloStoredTrack(int seqno){ + + if( ntrk()==0 ){ + printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i but no Calorimeter tracks are stored\n",seqno); + return NULL; + }; + + CaloTrkVar *c = 0; + Int_t it_calo=0; + + do { + c = GetCaloTrkVar(it_calo); + it_calo++; + } while( c && seqno != c->trkseqno && it_calo < ntrk()); + + if(!c || seqno != c->trkseqno){ + c = 0; + if(seqno!=-1 && seqno !=-2 && seqno!=-3 ) printf("CaloLevel2::GetCaloStoredTrack(int) : requested tracker SeqNo %i does not match Calorimeter stored tracks\n",seqno); + }; + return c; + +};