| 8 |
ClassImp(CaloStrip); |
ClassImp(CaloStrip); |
| 9 |
ClassImp(CaloLevel1); |
ClassImp(CaloLevel1); |
| 10 |
|
|
| 11 |
|
Float_t CaloStrip::UXal = CTX; |
| 12 |
|
Float_t CaloStrip::UYal = CTY; |
| 13 |
|
Float_t CaloStrip::UZal = CTZ; |
| 14 |
|
Bool_t CaloStrip::paramload = false; |
| 15 |
|
|
| 16 |
/** |
/** |
| 17 |
* CaloStrip default constructor |
* CaloStrip default constructor |
| 18 |
**/ |
**/ |
| 19 |
CaloStrip::CaloStrip() { |
CaloStrip::CaloStrip() { |
| 20 |
c1 = 0; |
c1 = 0; |
| 21 |
this->Clear(); |
this->Clear(); |
| 22 |
UseStandardAlig(); |
}; |
| 23 |
|
|
| 24 |
|
/** |
| 25 |
|
* CaloStrip default constructor |
| 26 |
|
**/ |
| 27 |
|
CaloStrip::CaloStrip(Bool_t mechalig) { |
| 28 |
|
c1 = 0; |
| 29 |
|
this->Clear(); |
| 30 |
|
if ( mechalig ){ |
| 31 |
|
ismech = true; |
| 32 |
|
paramload = true; |
| 33 |
|
UXal = MECHCTX; |
| 34 |
|
UYal = MECHCTY; |
| 35 |
|
UZal = MECHCTZ; |
| 36 |
|
} else { |
| 37 |
|
ismech = false; |
| 38 |
|
UseStandardAlig(); |
| 39 |
|
}; |
| 40 |
}; |
}; |
| 41 |
|
|
| 42 |
/** |
/** |
| 45 |
CaloStrip::CaloStrip(CaloLevel1 *calo) { |
CaloStrip::CaloStrip(CaloLevel1 *calo) { |
| 46 |
c1 = calo->GetCaloLevel1(); |
c1 = calo->GetCaloLevel1(); |
| 47 |
this->Clear(); |
this->Clear(); |
| 48 |
ismech = false; |
ismech = false; |
| 49 |
|
UseStandardAlig(); |
| 50 |
|
}; |
| 51 |
|
|
| 52 |
|
/** |
| 53 |
|
* CaloStrip default constructor |
| 54 |
|
**/ |
| 55 |
|
CaloStrip::CaloStrip(CaloLevel1 *calo, Bool_t mechalig) { |
| 56 |
|
c1 = calo->GetCaloLevel1(); |
| 57 |
|
this->Clear(); |
| 58 |
|
if ( mechalig ){ |
| 59 |
|
ismech = true; |
| 60 |
|
paramload = true; |
| 61 |
|
UXal = MECHCTX; |
| 62 |
|
UYal = MECHCTY; |
| 63 |
|
UZal = MECHCTZ; |
| 64 |
|
} else { |
| 65 |
|
ismech = false; |
| 66 |
|
UseStandardAlig(); |
| 67 |
|
}; |
| 68 |
}; |
}; |
| 69 |
|
|
| 70 |
/** |
/** |
| 85 |
**/ |
**/ |
| 86 |
void CaloStrip::UseStandardAlig(){ |
void CaloStrip::UseStandardAlig(){ |
| 87 |
// |
// |
| 88 |
ismech = false; |
if ( !paramload ){ |
|
// |
|
|
stringstream aligfile; |
|
|
Int_t error = 0; |
|
|
FILE *f = 0; |
|
|
ifstream badfile; |
|
|
GL_PARAM *glparam = new GL_PARAM(); |
|
|
// |
|
|
TString host = "mysql://localhost/pamelaprod"; |
|
|
TString user = "anonymous"; |
|
|
TString psw = ""; |
|
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
|
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
|
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
|
|
if ( !pamdbhost ) pamdbhost = ""; |
|
|
if ( !pamdbuser ) pamdbuser = ""; |
|
|
if ( !pamdbpsw ) pamdbpsw = ""; |
|
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
|
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
|
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
|
|
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
|
|
// |
|
|
UXal = 0.; |
|
|
UYal = 0.; |
|
|
UZal = 0.; |
|
|
// |
|
|
if ( dbc ){ |
|
|
// |
|
|
// determine where I can find calorimeter ADC to MIP conversion file |
|
|
// |
|
|
printf(" Querying DB for calorimeter parameters files...\n"); |
|
| 89 |
// |
// |
| 90 |
|
paramload = true; |
| 91 |
|
ismech = false; |
| 92 |
// |
// |
| 93 |
|
stringstream aligfile; |
| 94 |
|
Int_t error = 0; |
| 95 |
|
FILE *f = 0; |
| 96 |
|
ifstream badfile; |
| 97 |
|
GL_PARAM *glparam = new GL_PARAM(); |
| 98 |
|
// |
| 99 |
|
TString host = "mysql://localhost/pamelaprod"; |
| 100 |
|
TString user = "anonymous"; |
| 101 |
|
TString psw = ""; |
| 102 |
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
| 103 |
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
| 104 |
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
| 105 |
|
if ( !pamdbhost ) pamdbhost = ""; |
| 106 |
|
if ( !pamdbuser ) pamdbuser = ""; |
| 107 |
|
if ( !pamdbpsw ) pamdbpsw = ""; |
| 108 |
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
| 109 |
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
| 110 |
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
| 111 |
|
TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 112 |
|
// |
| 113 |
|
UXal = 0.; |
| 114 |
|
UYal = 0.; |
| 115 |
|
UZal = 0.; |
| 116 |
// |
// |
| 117 |
error = 0; |
if ( dbc ){ |
| 118 |
error = glparam->Query_GL_PARAM(1000,102,dbc); |
// |
| 119 |
if ( error >= 0 ){ |
// determine where I can find calorimeter ADC to MIP conversion file |
| 120 |
|
// |
| 121 |
|
printf(" Querying DB for calorimeter parameters files...\n"); |
| 122 |
|
// |
| 123 |
// |
// |
|
aligfile.str(""); |
|
|
aligfile << glparam->PATH.Data() << "/"; |
|
|
aligfile << glparam->NAME.Data(); |
|
| 124 |
// |
// |
| 125 |
printf("\n Using parameter file: \n %s \n",aligfile.str().c_str()); |
error = 0; |
| 126 |
f = fopen(aligfile.str().c_str(),"rb"); |
error = glparam->Query_GL_PARAM(1000,102,dbc); |
| 127 |
if ( f ){ |
if ( error >= 0 ){ |
| 128 |
// |
// |
| 129 |
fread(&UXal,sizeof(UXal),1,f); |
aligfile.str(""); |
| 130 |
fread(&UYal,sizeof(UYal),1,f); |
aligfile << glparam->PATH.Data() << "/"; |
| 131 |
fread(&UZal,sizeof(UZal),1,f); |
aligfile << glparam->NAME.Data(); |
| 132 |
|
// |
| 133 |
|
printf("\n Using parameter file: \n %s \n",aligfile.str().c_str()); |
| 134 |
|
f = fopen(aligfile.str().c_str(),"rb"); |
| 135 |
|
if ( f ){ |
| 136 |
|
// |
| 137 |
|
fread(&UXal,sizeof(UXal),1,f); |
| 138 |
|
fread(&UYal,sizeof(UYal),1,f); |
| 139 |
|
fread(&UZal,sizeof(UZal),1,f); |
| 140 |
|
// |
| 141 |
|
fclose(f); |
| 142 |
|
}; |
| 143 |
// |
// |
|
fclose(f); |
|
| 144 |
}; |
}; |
| 145 |
|
dbc->Close(); |
| 146 |
|
}; |
| 147 |
|
if ( !UXal ){ |
| 148 |
// |
// |
| 149 |
|
printf(" No able to query DB for calorimeter parameters files\n Using hard-coded parameters \n"); |
| 150 |
|
UXal = CTX; |
| 151 |
|
UYal = CTY; |
| 152 |
|
UZal = CTZ; |
| 153 |
}; |
}; |
| 154 |
dbc->Close(); |
// |
|
}; |
|
|
if ( !UXal ){ |
|
|
// |
|
|
printf(" No able to query DB for calorimeter parameters files\n Using hard-coded parameters \n"); |
|
|
UXal = CTX; |
|
|
UYal = CTY; |
|
|
UZal = CTZ; |
|
| 155 |
}; |
}; |
| 156 |
// |
// |
| 157 |
}; |
}; |
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
/** |
/** |
| 160 |
* Given a strip returns its position in the PAMELA reference system |
* Given a strip returns its position in the PAMELA reference system |
| 161 |
**/ |
**/ |
| 187 |
fView = view + 1; |
fView = view + 1; |
| 188 |
fPlane = plane + 1; |
fPlane = plane + 1; |
| 189 |
fStrip = strip + 1; |
fStrip = strip + 1; |
| 190 |
|
// |
| 191 |
if ( fPlane%2 ){ |
if ( fPlane%2 ){ |
| 192 |
lShift = -0.5; |
lShift = +0.5; |
| 193 |
} else { |
} else { |
| 194 |
lShift = 0.5; |
lShift = -0.5; |
| 195 |
}; |
}; |
| 196 |
// |
// |
|
if ( fView == 2 ) lShift = - lShift; |
|
|
// |
|
| 197 |
shift_.shift = lShift; |
shift_.shift = lShift; |
| 198 |
// |
// |
| 199 |
Float_t zplane[22]; |
Float_t zplane[22]; |
| 217 |
fX = (lPos - UXal)/10.; |
fX = (lPos - UXal)/10.; |
| 218 |
fY = 0.; |
fY = 0.; |
| 219 |
fZ = (zplane[fPlane-1] - 5.81 + UZal)/10.; |
fZ = (zplane[fPlane-1] - 5.81 + UZal)/10.; |
| 220 |
} else { |
// |
| 221 |
|
} else { |
| 222 |
// |
// |
| 223 |
// Y view |
// Y view |
| 224 |
// |
// |