|
// $Id: BrDetectorParamsDC.cxx,v 1.1.1.1 2001/06/21 14:55:00 hagel Exp $ // #include <stdio.h> #include <iostream.h> //BRAT Includes #include "BrDetectorParamsDC.h" //ROOT Includes //#include "TClass.h" ClassImp(BrDetectorParamsDC); //////////////////////////////////////////////////////////// // // BrDetectorParams is a BRAHMS data class for DC Parameters // //////////////////////////////////////////////////////////// BrDetectorParamsDC::BrDetectorParamsDC() { // Constructor. Set counter and list data members to zero. // Don't use this constructor unless you have to and know // what you are doing // Use TBrDetectorParams(Int_t run, Int_t event) instead fDCDriver = 0; } BrDetectorParamsDC::BrDetectorParamsDC(Char_t *name, Char_t *title) : BrDetectorParamsBase(name,title) { //Normal constructor. Set the default params and create DCPlaneList SetDefaultParams(); fDCPlaneList = new TObjArray(); fDCDriver = new BrDriverDC(GetName(),GetName()); SetDefaultPlanes(); } BrDetectorParamsDC::BrDetectorParamsDC(Char_t *name,Char_t *title,Char_t *asciifilename) : BrDetectorParamsBase(name,title) { //Constructor to read parameters from an ASCII detector parameter file SetDefaultParams(); //set default parameters in case not all specified in ASCII file fDCPlaneList = new TObjArray(); fDCDriver = new BrDriverDC(GetName(),GetName()); ReadASCIIFile(asciifilename); //read the ASCII file } BrDetectorParamsDC::BrDetectorParamsDC(Char_t *name, Char_t *title, BrDCPlane *p1, BrDCPlane *p2, BrDCPlane *p3, BrDCPlane *p4, BrDCPlane *p5, BrDCPlane *p6, BrDCPlane *p7, BrDCPlane *p8, BrDCPlane *p9, BrDCPlane *p10,BrDCPlane *p11,BrDCPlane *p12, BrDCPlane *p13,BrDCPlane *p14,BrDCPlane *p15,BrDCPlane *p16) : BrDetectorParamsBase(name,title) { //Constructor with a number of planes that can be defined at time of creation SetDefaultParams(); fDCPlaneList = new TObjArray(); if(p1) AddPlane(p1); if(p2) AddPlane(p2); if(p3) AddPlane(p3); if(p4) AddPlane(p4); if(p5) AddPlane(p5); if(p6) AddPlane(p6); if(p7) AddPlane(p7); if(p8) AddPlane(p8); if(p9) AddPlane(p9); if(p10) AddPlane(p10); if(p11) AddPlane(p11); if(p12) AddPlane(p12); if(p13) AddPlane(p13); if(p14) AddPlane(p14); if(p15) AddPlane(p15); if(p16) AddPlane(p16); } BrDetectorParamsDC::~BrDetectorParamsDC() { // int ijk = 1; } void BrDetectorParamsDC::SetDefaultParams() { fTwoPar = (Float_t)0.20; fEff = (Float_t)0.98; fDriftv = (Float_t)0.0052; fPldis = (Float_t)1.5; fNplane = 0; fPosres = (Float_t)0.025; } void BrDetectorParamsDC::SetDefaultPlanes() { //Create the default planes. This assumes that SetDefaultParams has already //been executed. /* if(!strcasecmp(GetName(),"T3")) { Int_t nplane = 10; AddPlane(new BrDCPlane("xa00","xa00",1.0, 0, 0.0,GetDefaultPlaneZ(1,nplane))); AddPlane(new BrDCPlane("xa01","xa01",1.0, 0,0.25,GetDefaultPlaneZ(2,nplane))); AddPlane(new BrDCPlane("xa02","xa02",1.0, 0, 0.0,GetDefaultPlaneZ(3,nplane))); AddPlane(new BrDCPlane("ya00","ya00",1.0,-90, 0.0,GetDefaultPlaneZ(4,nplane))); AddPlane(new BrDCPlane("ya01","ya01",1.0,-90,0.25,GetDefaultPlaneZ(5,nplane))); AddPlane(new BrDCPlane("ya02","ya02",1.0,-90, 0.0,GetDefaultPlaneZ(6,nplane))); AddPlane(new BrDCPlane("ua00","ua00",1.0,-18, 0.0,GetDefaultPlaneZ(7,nplane))); AddPlane(new BrDCPlane("ua01","ua01",1.0,-18,0.25,GetDefaultPlaneZ(8,nplane))); AddPlane(new BrDCPlane("va00","va00",1.0, 18, 0.0,GetDefaultPlaneZ(9,nplane))); AddPlane(new BrDCPlane("va01","va01",1.0, 18,0.25,GetDefaultPlaneZ(10,nplane))); } if(!strcasecmp(GetName(),"T4")) { Int_t nplane = 8; AddPlane(new BrDCPlane("xb00","xb00",2.2, 0, 0.0,GetDefaultPlaneZ(1,nplane))); AddPlane(new BrDCPlane("xb01","xb01",2.2, 0,0.55,GetDefaultPlaneZ(2,nplane))); AddPlane(new BrDCPlane("yb00","yb00",2.2,-90, 0.0,GetDefaultPlaneZ(3,nplane))); AddPlane(new BrDCPlane("yb01","yb01",2.2,-90,0.55,GetDefaultPlaneZ(4,nplane))); AddPlane(new BrDCPlane("ub00","ub00",2.2,-18, 0.0,GetDefaultPlaneZ(5,nplane))); AddPlane(new BrDCPlane("ub01","ub01",2.2,-18,0.55,GetDefaultPlaneZ(6,nplane))); AddPlane(new BrDCPlane("vb00","vb00",2.2, 18, 0.0,GetDefaultPlaneZ(7,nplane))); AddPlane(new BrDCPlane("vb01","vb01",2.2, 18,0.55,GetDefaultPlaneZ(8,nplane))); } if(!strcasecmp(GetName(),"T5")) { Int_t nplane = 8; AddPlane(new BrDCPlane("xb00","xb00",2.2, 0, 0.0,GetDefaultPlaneZ(1,nplane))); AddPlane(new BrDCPlane("xb01","xb01",2.2, 0,0.55,GetDefaultPlaneZ(2,nplane))); AddPlane(new BrDCPlane("yb00","yb00",2.2,-90, 0.0,GetDefaultPlaneZ(3,nplane))); AddPlane(new BrDCPlane("yb01","yb01",2.2,-90,0.55,GetDefaultPlaneZ(4,nplane))); AddPlane(new BrDCPlane("ub00","ub00",2.2,-18, 0.0,GetDefaultPlaneZ(5,nplane))); AddPlane(new BrDCPlane("ub01","ub01",2.2,-18,0.55,GetDefaultPlaneZ(6,nplane))); AddPlane(new BrDCPlane("vb00","vb00",2.2, 18, 0.0,GetDefaultPlaneZ(7,nplane))); AddPlane(new BrDCPlane("vb01","vb01",2.2, 18,0.55,GetDefaultPlaneZ(8,nplane))); } */ //Temporary fix to get plane positions out of BrDriverDC. Only a bandage //to get us going. In the end, we need to make parameter objects for each //submodule which had not been done in prototype version. Float_t z[10],planeAngle[10]; Int_t nPlane; fDCDriver->AtSubModule(0); nPlane = fDCDriver->GetMaxPlaneNum(); for(Int_t i=0;i<nPlane;i++) { fDCDriver->AtPlane(i); z[i] = fDCDriver->SubModulePlanePosition(); planeAngle[i] = fDCDriver->GetAngle(); } if(!strcasecmp(GetName(),"T3")) { //Int_t nplane = 10; AddPlane(new BrDCPlane("xa00","xa00",1.0,planeAngle[0],0.00,z[0])); AddPlane(new BrDCPlane("xa01","xa01",1.0,planeAngle[1],0.25,z[1])); AddPlane(new BrDCPlane("xa02","xa02",1.0,planeAngle[2],0.00,z[2])); AddPlane(new BrDCPlane("ya00","ya00",1.0,planeAngle[3],0.00,z[3])); AddPlane(new BrDCPlane("ya01","ya01",1.0,planeAngle[4],0.25,z[4])); AddPlane(new BrDCPlane("ya02","ya02",1.0,planeAngle[5],0.00,z[5])); AddPlane(new BrDCPlane("ua00","ua00",1.0,planeAngle[6],0.00,z[6])); AddPlane(new BrDCPlane("ua01","ua01",1.0,planeAngle[7],0.25,z[7])); AddPlane(new BrDCPlane("va00","va00",1.0,planeAngle[8],0.00,z[8])); AddPlane(new BrDCPlane("va01","va01",1.0,planeAngle[9],0.25,z[9])); } if(!strcasecmp(GetName(),"T4")) { //Int_t nplane = 8; AddPlane(new BrDCPlane("xb00","xb00",2.2,planeAngle[0],0.00,z[0])); AddPlane(new BrDCPlane("xb01","xb01",2.2,planeAngle[1],0.55,z[1])); AddPlane(new BrDCPlane("yb00","yb00",2.2,planeAngle[2],0.00,z[2])); AddPlane(new BrDCPlane("yb01","yb01",2.2,planeAngle[3],0.55,z[3])); AddPlane(new BrDCPlane("ub00","ub00",2.2,planeAngle[4],0.00,z[4])); AddPlane(new BrDCPlane("ub01","ub01",2.2,planeAngle[5],0.55,z[5])); AddPlane(new BrDCPlane("vb00","vb00",2.2,planeAngle[6],0.00,z[6])); AddPlane(new BrDCPlane("vb01","vb01",2.2,planeAngle[7],0.55,z[7])); } if(!strcasecmp(GetName(),"T5")) { //Int_t nplane = 8; AddPlane(new BrDCPlane("xb00","xb00",2.2,planeAngle[0],0.00,z[0])); AddPlane(new BrDCPlane("xb01","xb01",2.2,planeAngle[1],0.55,z[1])); AddPlane(new BrDCPlane("yb00","yb00",2.2,planeAngle[2],0.00,z[2])); AddPlane(new BrDCPlane("yb01","yb01",2.2,planeAngle[3],0.55,z[3])); AddPlane(new BrDCPlane("ub00","ub00",2.2,planeAngle[4],0.00,z[4])); AddPlane(new BrDCPlane("ub01","ub01",2.2,planeAngle[5],0.55,z[5])); AddPlane(new BrDCPlane("vb00","vb00",2.2,planeAngle[6],0.00,z[6])); AddPlane(new BrDCPlane("vb01","vb01",2.2,planeAngle[7],0.55,z[7])); } } Float_t BrDetectorParamsDC::GetDefaultPlaneZ(Int_t ipl,Int_t nplanes) { // Get the z position of the plane. This assumes that Pldis has // already been set. It also assumes that the numbering of ipl // starts with 1. Float_t z; z = GetPldis()*(ipl - (nplanes + 1)/(Float_t)2.); return z; } //___________________________________________________________________ void BrDetectorParamsDC::ListParameters() const { printf("DC Parameters: The name is %sn",GetName()); printf("Efficiency is %f, two particle resolution is %fn",fEff,fTwoPar); } void BrDetectorParamsDC::AddPlane(BrDCPlane* plane) { if(!fDCPlaneList) fDCPlaneList = new TObjArray(); fDCPlaneList->Add(plane); } void BrDetectorParamsDC::SetASCIIParameters(Char_t *line) { //Interpret a line for DC params. Form is ParamName:value. Eg //Eg fTwopar:.20 or fEff: 0.95 Char_t ParamName[80]; //Find first non-blank character in the line (in case user didn't // *start in column 1 Int_t i = 0; for(i = 0; i < Int_t(strlen(line)); i++) { if(strncmp(&line[i]," ",1)) break; } //Copy that to ParamName strcpy(ParamName,&line[i]); Char_t *iloc = strchr(ParamName,':'); Char_t *value_loc = iloc+1; if(iloc) { iloc[0] = 0; //blank out the semicolon Char_t *ilocc = strchr(ParamName,' '); if(ilocc) ilocc[0] = 0; //blank out space at end if it exists if(!strcasecmp(ParamName,"fTwoPar")) { sscanf(value_loc,"%f",&fTwoPar); // printf("Found fTwoPar to have value of %fn",fTwoPar); } else if(!strcasecmp(ParamName,"fEff")) { sscanf(value_loc,"%f",&fEff); // printf("Found fEff to have value of %fn",fEff); } else if(!strcasecmp(ParamName,"fDriftv")) { sscanf(value_loc,"%f",&fDriftv); // printf("Found fDriftv to have value of %fn",fDriftv); } else if(!strcasecmp(ParamName,"fPldis")) { sscanf(value_loc,"%f",&fPldis); // printf("Found fPldis to have value of %fn",fPldis); } else if(!strcasecmp(ParamName,"fNplane")) { sscanf(value_loc,"%d",&fNplane); // printf("Found fNplane to have value of %fn",fNplane); } else if(!strcasecmp(ParamName,"fPosres")) { sscanf(value_loc,"%f",&fPosres); // printf("Found fPosres to have value of %fn",fPosres); } else if(!strcasecmp(ParamName,"DCPlane")) { Char_t name[64],title[64]; Float_t stag_dist; Float_t wiredis,angle; Float_t z = 0; // sscanf(value_loc,"%s %s %d %f %f %f", // name,title,&stag_dist,&wiredis,&angle,&z); sscanf(value_loc,"%s %s %f %f %f %f", name,title,&wiredis,&angle,&z,&stag_dist); //create if not already done if(!fDCPlaneList) fDCPlaneList = new TObjArray(); if(z==(Float_t)0.0) { // Coming here means we have a parameter file with z not // specified. Or Z was set = 0 which will not happen // with an even number of planes. If we come here, try // to be intelligent about how to set the z value. We // should not come here very often as the detector // parameter file should evolve to specify the z // position of the plane. cout<<"Detected an obsolete DC Params file; " << "z position of plane not specified" <<endl; cout<<"Please update parameter file you are using!!!"<<endl; Int_t nplanes; if(!strcasecmp("T3",GetName())) nplanes = 10; if(!strcasecmp("T4",GetName())) nplanes = 8; if(!strcasecmp("T5",GetName())) nplanes = 8; if(fPldis == 0) fPldis = 1.5; Int_t ipl = fDCPlaneList->GetEntries() + 1; z = GetDefaultPlaneZ(ipl,nplanes); cout<<"Assuming nplanes = "<<nplanes; cout<<" Calculate z for plane "<<ipl<<" to be "<<z<<endl; cout<<"If this is not correct, " "change your parameter file now!!!"<<endl; } //Here we use the angle and z from Pawel's DC driver instead of what is //in the file!!! The driver should be up to date!!! Int_t ipl = fDCPlaneList->GetEntries(); //Assume for the moment that a given plane in all submodules is at same Z??? //Is that safe??? Can be enhanced once we have more intelligent parameter //object which has submodules. fDCDriver->AtSubModule(0); fDCDriver->AtPlane(ipl); Float_t planeZ = fDCDriver->SubModulePlanePosition(); Float_t planeAngle = fDCDriver->GetAngle(); //fDCPlaneList->Add(new BrDCPlane(name,title,wiredis,angle,stag_dist,z)); fDCPlaneList->Add(new BrDCPlane(name,title,wiredis,planeAngle,stag_dist,planeZ)); fNplane = fDCPlaneList->GetEntries(); } else { cout<<"Error: "<<ParamName<<" is not one of the parameters"<<endl; return; } return; //this is a normal return } else { cout<<"Error, : missing to delineate name from value"<<endl; cout<<"The string is "<<line<<endl; cout<<"No value set!!!"<<endl; return; } } // $Log: BrDetectorParamsDC.cxx,v $ // Revision 1.1.1.1 2001/06/21 14:55:00 hagel // Initial revision of brat2 // // Revision 1.19 2000/11/23 01:32:56 brahmlib // Cleaned up code in general. BrDriverDC now usess ClassImp/ClassDef. // // Revision 1.18 2000/10/25 17:58:06 hagel // Further development of BrDCTrackingModule // // Revision 1.17 2000/10/12 11:58:07 staszel // Modified default parameters to be in better agreement to what we know // about DCs. // // Revision 1.16 2000/03/24 21:11:27 videbaek // Reove declaraion of i from inner loop. // // Revision 1.15 2000/03/21 21:22:01 cholm // Several changes: A few hacks where needed to compile on Digital Unix, noticably in my - Christian Holm - classes for the DB and Exceptions. Proberly still need to do something to some of Konstantins stuff. Also, I removed a lot of warnings fromt the compiler, by teddying up the code. Several places, old C-style indecies in for loops were assumed. Corrected. Unused variables have been commented out. // // Revision 1.14 2000/03/17 17:17:58 cholm // Corrected bug in ReadASCIILine : scope of loop variable i should be method not loop // // Revision 1.13 1999/12/30 19:43:41 videbaek // leanup of code comments - a few places // // Revision 1.12 1999/04/12 21:57:02 hagel // Fix bugs in staggering // // Revision 1.11 1999/04/07 21:08:53 hagel // Add support for BrDCPlane to specify stagger // // Revision 1.10 1999/03/16 21:04:12 hagel // 1. Make BrDCPlane inherit from BrPlane3D. BrDCPlane how has information about // where it is located. // 2. Change BrDigitizeDC and BrLocalTrackDC to make use of new BrDCPlane information. // 3. Move Decode(...) from BrDigitizeDC to BrLocalTrackDC. // 4. Change cut parameters to be member data with defaults rather than hardwired. // // Revision 1.9 1999/03/07 00:00:43 hagel // // Revision 1.8 1999/02/04 18:15:30 hagel // Fixed bug in SetASCIIParameters() // // Revision 1.7 1999/02/04 18:14:33 hagel // Fixed bug in SetASCIIParameters() // // Revision 1.6 1999/02/04 17:23:03 hagel // Added ReadASCIIFile() // // Revision 1.5 1999/01/12 20:25:13 hagel // Add CVS logs to several modules missing it // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|