diff --git a/NPAnalysis/TAMU/Analysis.cxx b/NPAnalysis/TAMU/Analysis.cxx index 14e8c80c4cdfef876cd460d7623bd53eb3fe8e57..1416e0468256e896e0edb779149219638695fc37 100644 --- a/NPAnalysis/TAMU/Analysis.cxx +++ b/NPAnalysis/TAMU/Analysis.cxx @@ -342,7 +342,8 @@ int main(int argc, char** argv){ /************************************************/ // Part 5a : Implementing impact matrix for the Tiara Barrel (all 8 detecting strips) TVector3 ImpactPositionB = TB -> GetPositionOfInteraction(countTiaraBarrel); -// int xcheck = ImpactPositionB.X(); +// double xcheck = ImpactPositionB.X(); +// double ycheck = ImpactPositionB.Y(); // cout << "event x value is " << xcheck << endl; // int StripNumberB = TB -> Strip_N[countTiaraBarrel]; // cout << "Barrel resistive strip number is " << StripNumberB << endl; @@ -376,45 +377,83 @@ int main(int argc, char** argv){ // BStripNumber4Z = ImpactPositionB.Z(); // } + // The next lines randomise the above impact matrix stuff. Next week I need to move this to Part 6a) (starting on line 433) whilst I tidy EVERYTHING up. + +// double RandomNumber3 = Rand->Rndm(); +// double DeltaX = (RandomNumber3 * 6.0); +// ImpactMatrixBCoordX = ImpactMatrixBCoordX - DeltaX; // randomises X within a given barrel resistive strip + // Part 5b : Implementing impact matrix for each strip making up the octagonal Barrel individually if(DetectorNumberB==1){ BarrelStrip1CoordX = ImpactPositionB.X(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 6.0)-3.0; + BarrelStrip1CoordX = BarrelStrip1CoordX - DeltaX; // randomises X within a given barrel resistive strip BarrelStrip1CoordY = ImpactPositionB.Y(); BarrelStrip1CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==2){ BarrelStrip2CoordX = ImpactPositionB.X(); BarrelStrip2CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 4.242640687)-2.121320344; + double DeltaY = DeltaX; + BarrelStrip2CoordX = BarrelStrip2CoordX - DeltaX; + BarrelStrip2CoordY = BarrelStrip2CoordY - DeltaY; BarrelStrip2CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==3){ BarrelStrip3CoordX = ImpactPositionB.X(); BarrelStrip3CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaY = (RandomNumber3 * 6.0)-3.0; + BarrelStrip3CoordY = BarrelStrip3CoordY - DeltaY; BarrelStrip3CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==4){ BarrelStrip4CoordX = ImpactPositionB.X(); BarrelStrip4CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 4.242640687)-2.121320344; + double DeltaY = DeltaX; + BarrelStrip4CoordX = BarrelStrip4CoordX + DeltaX; + BarrelStrip4CoordY = BarrelStrip4CoordY - DeltaY; BarrelStrip4CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==5){ BarrelStrip5CoordX = ImpactPositionB.X(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 6.0)-3.0; + BarrelStrip5CoordX = BarrelStrip5CoordX + DeltaX; BarrelStrip5CoordY = ImpactPositionB.Y(); BarrelStrip5CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==6){ BarrelStrip6CoordX = ImpactPositionB.X(); BarrelStrip6CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 4.242640687)-2.121320344; + double DeltaY = DeltaX; + BarrelStrip6CoordX = BarrelStrip6CoordX + DeltaX; + BarrelStrip6CoordY = BarrelStrip6CoordY + DeltaY; BarrelStrip6CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==7){ BarrelStrip7CoordX = ImpactPositionB.X(); BarrelStrip7CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaY = (RandomNumber3 * 6.0)-3.0; + BarrelStrip7CoordY = BarrelStrip7CoordY + DeltaY; BarrelStrip7CoordZ = ImpactPositionB.Z(); } if(DetectorNumberB==8){ BarrelStrip8CoordX = ImpactPositionB.X(); BarrelStrip8CoordY = ImpactPositionB.Y(); + double RandomNumber3 = Rand->Rndm(); + double DeltaX = (RandomNumber3 * 4.242640687)-2.121320344; + double DeltaY = DeltaX; + BarrelStrip8CoordX = BarrelStrip8CoordX - DeltaX; + BarrelStrip8CoordY = BarrelStrip8CoordY + DeltaY; BarrelStrip8CoordZ = ImpactPositionB.Z(); } diff --git a/NPLib/Tiara/TTiaraBarrelPhysics.cxx b/NPLib/Tiara/TTiaraBarrelPhysics.cxx index 8888e7a50341543b69adfa90ff0e0635bc71c600..c90032d13d96d1b7577d80d6052ef6371ab4e409 100644 --- a/NPLib/Tiara/TTiaraBarrelPhysics.cxx +++ b/NPLib/Tiara/TTiaraBarrelPhysics.cxx @@ -96,7 +96,7 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){ +itoa(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i)) +"_STRIP"+itoa(m_PreTreatedData->GetFrontUpstreamEStripNbr(i)) +"_POS",(ED-EU)/(EU+ED)); - + //push back ED, EU - and check the ED vs EU graph! Strip_Pos.push_back(POS); Strip_N.push_back(m_PreTreatedData->GetFrontUpstreamEStripNbr(i)); DetectorNumber.push_back(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i)); @@ -313,7 +313,7 @@ else { /////////////////////////////////////////////////////////////////////////// void TTiaraBarrelPhysics::Clear(){ EventMultiplicity=0; - DetectorNumber .clear(); + DetectorNumber.clear(); Strip_E.clear(); Strip_T.clear(); Strip_N.clear(); @@ -349,16 +349,18 @@ void TTiaraBarrelPhysics::ReadConfiguration(string Path){ bool check_Y = false ; bool check_Z = false ; - // bool ReadingStatusWedge = false ; + bool ReadingStatusStrip = false ; bool ReadingStatus = false ; bool VerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); ; + + //while (getline(ConfigFile, LineBuffer)){ while (!ConfigFile.eof()){ getline(ConfigFile, LineBuffer); - // cout << LineBuffer << endl; - if (LineBuffer.compare(0, 11, "TiaraBarrel") == 0) + // cout << LineBuffer << endl; + if (LineBuffer.compare(0, 11, "TiaraInnerBarrel") == 0) ReadingStatus = true; while (ReadingStatus && !ConfigFile.eof()) { @@ -366,53 +368,73 @@ void TTiaraBarrelPhysics::ReadConfiguration(string Path){ // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - else if (DataBuffer == "X=") { - check_X = true; - ConfigFile >> DataBuffer ; - X= atof(DataBuffer.c_str()); - if(VerboseLevel) cout << " X= " << X << "mm" << endl; - } +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////something here? - else if (DataBuffer == "Y=") { - check_Y = true; - ConfigFile >> DataBuffer ; - Y= atof(DataBuffer.c_str()); - if(VerboseLevel) cout << " Y= " << Y << "mm" << endl; - } +// // Barrel case +// if (DataBuffer=="TiaraBarrelStrip"){ +// if(VerboseLevel) cout << "///" << endl ; +// if(VerboseLevel) cout << "Detector found: " << endl ; +// ReadingStatusStrip = true ; +// } - else if (DataBuffer == "Z=") { - check_Z = true; - ConfigFile >> DataBuffer ; - Z= atof(DataBuffer.c_str()); - if(VerboseLevel) cout << " Z= " << Z << "deg" << endl; - } +// // Reading Block +// while(ReadingStatusStrip){ +// // Pickup Next Word +// ConfigFile >> DataBuffer ; - else if (DataBuffer == "ThicknessDector=") { - /*ignore that*/ - } +// // Comment Line +// if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else{ - ReadingStatus= false; - cout << "Error: Wrong Token Sequence: Getting out " << DataBuffer << endl ; - exit(1); - } +// //Position method +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////end of something here? + +// else if (DataBuffer == "X=") { +// check_X = true; +// ConfigFile >> DataBuffer ; +// X= atof(DataBuffer.c_str()); +// if(VerboseLevel) cout << " X= " << X << "mm" << endl; +// } + +// else if (DataBuffer == "Y=") { +// check_Y = true; +// ConfigFile >> DataBuffer ; +// Y= atof(DataBuffer.c_str()); +// if(VerboseLevel) cout << " Y= " << Y << "mm" << endl; +// } + +// else if (DataBuffer == "Z=") { +// check_Z = true; +// ConfigFile >> DataBuffer ; +// Z= atof(DataBuffer.c_str()); +// if(VerboseLevel) cout << " Z= " << Z << "deg" << endl; +// } + +// else if (DataBuffer == "ThicknessDector=") { +// /*ignore that*/ +// } + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else { + ReadingStatusStrip= false; + cout << "Error: Wrong Token Sequence: Getting out " << DataBuffer << endl ; + exit(1); + } - ///////////////////////////////////////////////// - // If All necessary information there, toggle out + ///////////////////////////////////////////////// + // If All necessary information there, toggle out - if (check_X && check_Y && check_Z){ + if (check_X && check_Y && check_Z){ - ReadingStatus= false; - AddDetector(X,Y,Z); - // Reinitialisation of Check Boolean - check_X = false ; - check_Y = false ; - check_Z = false ; + ReadingStatusStrip= false; + AddDetector(X,Y,Z); + // Reinitialisation of Check Boolean + check_X = false ; + check_Y = false ; + check_Z = false ; + } } } - } InitializeStandardParameter(); ReadAnalysisConfig(); } @@ -569,13 +591,12 @@ TVector3 TTiaraBarrelPhysics::GetPositionOfInteraction(const int i) const{ double INNERBARREL_ActiveWafer_Width = 24.0; double StripPitch = INNERBARREL_ActiveWafer_Width/4. ; - double X = Strip_N[i]*StripPitch-0.5*INNERBARREL_ActiveWafer_Width; - double Y = INNERBARREL_PCB_Width*(0.5+sin(45*deg)) ; - double Z = (Strip_Pos[i]-0.5)*INNERBARREL_ActiveWafer_Length ; + double X = (Strip_N[i]*StripPitch-0.5*INNERBARREL_ActiveWafer_Width)-(0.5*StripPitch); + double Y = INNERBARREL_PCB_Width*(0.5+sin(45*deg)) ; // this constant number is 33.50928425 + double Z = Strip_Pos[i]*(0.5*INNERBARREL_ActiveWafer_Length); //original = double Z = (Strip_Pos[i]-0.5)*INNERBARREL_ActiveWafer_Length ; TVector3 POS(X,Y,-Z); POS.RotateZ((DetectorNumber[i]-1)*45*deg); return( POS ) ; - } /////////////////////////////////////////////////////////////////////////////// void TTiaraBarrelPhysics::InitializeStandardParameter(){