////////////////////////////////////////////////////////// // // // AnnularDetector // // // // //Some description of this very useful class, //its properties and a short example how to //use it. This text may be partly used in //PhD thesis. // //Description of the detector itself. // // // ////////////////////////////////////////////////////////// #include "AnnularDetector.h" ClassImp(AnnularDetector); TRandom3 AnnularDetector::ranTheta(1); TRandom3 AnnularDetector::ranPhi(1); AnnularDetector::AnnularDetector() { } AnnularDetector::~AnnularDetector() { } Int_t AnnularDetector::GetChMultiplicity(Bool_t sec) { //Calculate the number of strips which detected signal in one event Int_t mult = 0; if (sec == 1) { for (Int_t i = 0; i < 32; i++) { if (fChSec[i] != 0) { mult++; } } } else { for (Int_t i = 0; i < 32; i++) { if (fChRing[i] != 0) { mult++; } } } return mult; } Int_t AnnularDetector::GetEMultiplicity(Bool_t sec) { //Calculate the number of strips which detected signal over particular energy threshold in one event Int_t mult = 0; if (sec == 1) { for (Int_t i = 0; i < 32; i++) { if (fESec[i] > 0) { mult++; } } } else { for (Int_t i = 0; i < 32; i++) { if (fERing[i] > 0) { mult++; } } } return mult; } Int_t AnnularDetector::Reset() { //Reset variables with energy and angle information for (Int_t i = 0; i < 32; i++) { fChRing[i] = 0; fChSec[i] = 0; fERing[i] = 0.; fESec[i] = 0.; } fMultChRing = 0; fMultChSec = 0; fMultERing = 0; fMultESec = 0; return 0; } Int_t AnnularDetector::FindSec() { //Find first sector where E != 0 Int_t i = 0; for (i = 0; i < fSecNumber; i++) { if (fESec[i] > 0.) { break; } } if (i == fSecNumber) { return (-1); } return i; } Int_t AnnularDetector::FindRing() { //Find first ring where E != 0 if (fDSD == kFALSE) { Warning("FindRing", "May not be used for this detector (SSD)"); } Int_t i = 0; for (i = 0; i < fRingsNumber; i++) { if (fERing[i] > 0.) { break; } } if (i == fRingsNumber) { return -1; } return i; } Double_t AnnularDetector::GetTheta(Int_t ring) { //Get the angle theta in radians which was measured in the ring. if (ring >= fRingsNumber) { Warning("GetTheta", "Number of rings in this detector is equal to %d.", fRingsNumber); return 0.; //zamyslet se } if (ring < 0) { Warning("GetTheta", "You cannot input negative ring number."); return 0.; //zamyslet se } Double_t theta; theta = TMath::ATan(( fInnerR + ( ring+ranTheta.Uniform(1) )*(fOuterR - fInnerR)/fRingsNumber )/fZ); return theta; } Double_t AnnularDetector::GetPhi(Int_t sec) { //Get the angle phi in radians which was measured in the sector sec. if (sec >= fSecNumber) { Warning("GetPhi", "Number of sectors in this detector is equal to %d.", fRingsNumber); return -1.; //zamyslet se } if (sec < 0) { Warning("GetPhi", "You cannot input negative sector number."); return -1.; //zamyslet se } // Double_t theta; // theta = TMath::ATan(( fInnerR + ( ring+ranTheta.Uniform(1) )*(fOuterR - fInnerR)/fRingsNumber )/fZ); return (2*TMath::Pi()/fSecNumber)*( sec + ranTheta.Uniform(1) ); } Double_t AnnularDetector::GetX(Int_t ring, Int_t sec) { TVector2 flat; //vector in detector plane Double_t r = fInnerR + ( ring+ranTheta.Uniform(1) )*(fOuterR - fInnerR)/fRingsNumber; // Double_t phi = 2 * TMath::Pi() // - (2*TMath::Pi()/fSecNumber)*( sec + ranTheta.Uniform(1) ) // - TMath::Pi() / 2.; Double_t phi = //2 * TMath::Pi() - (2 * TMath::Pi() / fSecNumber) * (sec + ranTheta.Uniform(1)) + TMath::Pi() / 2.; // printf("sec: %d\tphi: %3.2f\n", sec, phi); flat.SetMagPhi(r, phi); // printf("sec: %d\tphi: %3.2f\tphiV: %3.2f\t\t", sec, phi*TMath::RadToDeg(), flat.Phi()*TMath::RadToDeg()); return flat.X(); } Double_t AnnularDetector::GetY(Int_t ring, Int_t sec) { TVector2 flat; //vector in detector plane Double_t r = fInnerR + ( ring+ranTheta.Uniform(1) )*(fOuterR - fInnerR)/fRingsNumber; Double_t phi = //2 * TMath::Pi() - (2*TMath::Pi()/fSecNumber)*( sec + ranTheta.Uniform(1) ) + TMath::Pi() / 2.; flat.SetMagPhi(r, phi); return flat.Y(); } void AnnularDetector::InitDetector(Bool_t dsd, Int_t nosecs, Int_t norings, Double_t innerr, Double_t outerr, Double_t thick, Double_t deadthick, Double_t z) { //dsd = 1 for DSSD; dsd = 0 for SSSD //nosecs - number of sectors //norings - number of rings //innerr - inner radius in mm //outerr - outer radius in mm //thick - thickness of the detector in microns //deadthick - thickness of the dead layer in microns //z - distance of the detector from the target SetDSD(dsd); SetSecNumber(nosecs); if (fDSD == 1) { SetRingsNumber(norings); } SetInnerR(innerr); SetOuterR(outerr); SetThickness(thick); SetDeadLayerThickness(deadthick); SetZ(z); return; }