35 std::map<std::string,TMatrixT<Double_t>*>::const_iterator it;
36 std::map<std::string,TMatrixT<Double_t>*>::iterator it_here;
41 it_here->second =
new TMatrixT<Double_t>[
fNhits];
43 (it_here->second)[i] = (it->second)[i];
52 it_here->second =
new TMatrixT<Double_t>[
fNhits];
54 (it_here->second)[i] = (it->second)[i];
60 std::map<std::string,genf::GFDetPlane*>::const_iterator ip;
61 std::map<std::string,genf::GFDetPlane*>::iterator ip_here;
68 (ip_here->second)[i] = ((ip->second)[i]);
83 if (R__b.IsReading()) {
86 TObject::Streamer(R__b);
95 TMatrixT<Double_t> mat;
100 for(
unsigned int i=0;i<nkeys;++i){
104 for(
int j=0;j<fNhits;++j){
106 setMatrix(key,j,mat);
112 for(
unsigned int i=0;i<nkeys;++i){
115 bookGFDetPlanes(key);
116 for(
int j=0;j<fNhits;++j){
118 setDetPlane(key,j,pl);
124 for(
unsigned int i=0;i<nkeys;++i){
128 for(
int j=0;j<fNhits;++j){
130 setNumber(key,j,mat[0][0]);
136 unsigned int nFailedHits;
138 unsigned int aFailedHit;
139 for(
unsigned int i=0;i<nFailedHits;++i){
141 fFailedHits.push_back(aFailedHit);
146 TObject::Streamer(R__b);
151 std::vector<std::string> keys;
153 keys = getMatrixKeys();
154 R__b << (
unsigned int)(keys.size());
155 for(
unsigned int i=0;i<keys.size();++i){
156 TString
s(keys.at(i));
158 for(
int j=0;j<fNhits;++j){
159 ((fMatrices[keys.at(i)])[j]).Streamer(R__b);
165 keys = getGFDetPlaneKeys();
166 R__b << (
unsigned int)(keys.size());
167 for(
unsigned int i=0;i<keys.size();++i){
168 TString
s(keys.at(i));
170 for(
int j=0;j<fNhits;++j){
171 ((fPlanes[keys.at(i)])[j]).Streamer(R__b);
177 keys = getNumberKeys();
178 R__b << (
unsigned int)(keys.size());
179 for(
unsigned int i=0;i<keys.size();++i){
180 TString
s(keys.at(i));
182 for(
int j=0;j<fNhits;++j){
183 ((fNumbers[keys.at(i)])[j]).Streamer(R__b);
188 R__b << ((
unsigned int) fFailedHits.size());
189 for(
unsigned int i=0;i<fFailedHits.size();++i){
190 R__b << fFailedHits.at(i);
199 GFException exc(
"fNhits not defined",__LINE__,__FILE__);
202 if(fMatrices[key] != NULL){
203 std::ostringstream ostr;
204 ostr <<
"The key " << key
205 <<
" is already occupied in genf::GFBookkeeping::bookMatrices()";
209 fMatrices[key] =
new TMatrixT<Double_t>[fNhits];
214 GFException exc(
"fNhits not defined",__LINE__,__FILE__);
217 if(fPlanes[key] != NULL){
218 std::ostringstream ostr;
219 ostr <<
"The key " << key
220 <<
" is already occupied in genf::GFBookkeeping::bookGFDetPlanes()";
230 GFException exc(
"fNhits not defined",__LINE__,__FILE__);
233 if(fPlanes[key] != NULL){
234 std::ostringstream ostr;
235 ostr <<
"The key " << key
236 <<
" is already occupied in genf::GFBookkeeping::bookNumbers()";
240 fNumbers[key] =
new TMatrixT<Double_t>[fNhits];
241 for(
int i=0;i<fNhits;++i){
242 ((fNumbers[key])[i]).ResizeTo(1,1);
243 ((fNumbers[key])[i])[0][0] = val;
249 const TMatrixT<Double_t>& mat){
250 if(fMatrices[key] == NULL){
251 std::ostringstream ostr;
252 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::setMatrix()";
256 if(index>=(
unsigned int)fNhits){
257 std::ostringstream ostr;
258 ostr <<
"The index " << index
259 <<
" is out of range in genf::GFBookkeeping::setMatrix()";
263 (fMatrices[key])[index].ResizeTo(mat);
264 (fMatrices[key])[index] = mat;
268 if(fPlanes[key] == NULL){
269 std::ostringstream ostr;
270 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::setGFDetPlane()";
274 if(index>=(
unsigned int)fNhits){
275 std::ostringstream ostr;
276 ostr <<
"The index " << index
277 <<
" is out of range in genf::GFBookkeeping::setGFDetPlane()";
281 (fPlanes[key])[index] = pl;
285 if(fNumbers[key] == NULL){
286 std::ostringstream ostr;
287 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::setNumber()";
291 if(index>=(
unsigned int)fNhits){
292 std::ostringstream ostr;
293 ostr <<
"The index " << index
294 <<
" is out of range in genf::GFBookkeeping::setNumber()";
298 ((fNumbers[key])[index])[0][0] = num;
303 TMatrixT<Double_t>& mat)
const {
304 auto iMatrix = fMatrices.find(key);
305 if(iMatrix == fMatrices.end()){
306 std::ostringstream ostr;
307 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::getMatrix()";
311 if(index>=(
unsigned int)fNhits){
312 std::ostringstream ostr;
313 ostr <<
"The index " << index
314 <<
" is out of range in genf::GFBookkeeping::getMatrix()";
318 mat.ResizeTo(iMatrix->second[index]);
319 mat = iMatrix->second[index];
326 auto iPlane = fPlanes.find(key);
327 if(iPlane == fPlanes.end()){
328 std::ostringstream ostr;
329 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::getGFDetPlane()";
333 if(index>=(
unsigned int)fNhits){
334 std::ostringstream ostr;
335 ostr <<
"The index " << index
336 <<
" is out of range in genf::GFBookkeeping::getGFDetPlane()";
340 pl = iPlane->second[index];
346 auto iNumber = fNumbers.find(key);
347 if(iNumber == fNumbers.end()){
348 std::ostringstream ostr;
349 ostr <<
"The key " << key <<
" is unknown in genf::GFBookkeeping::getNumber()";
353 if(index>=(
unsigned int)fNhits){
354 std::ostringstream ostr;
355 ostr <<
"The index " << index
356 <<
" is out of range in genf::GFBookkeeping::getNumber()";
360 num = iNumber->second[index][0][0];
365 fFailedHits.push_back(
id );
369 return fFailedHits.size();
373 unsigned int retVal = 0;
374 for(
unsigned int i=0;i<fFailedHits.size();++i){
375 if(fFailedHits.at(i) == id){
387 std::vector<std::string> matKeys = getMatrixKeys();
388 std::vector<std::string> planeKeys = getGFDetPlaneKeys();
389 std::vector<std::string> numKeys = getNumberKeys();
394 for(
unsigned int i=0;i<matKeys.size();++i){
395 bookMatrices(matKeys.at(i));
397 for(
unsigned int i=0;i<planeKeys.size();++i){
398 bookGFDetPlanes(planeKeys.at(i));
400 for(
unsigned int i=0;i<numKeys.size();++i){
401 bookNumbers(numKeys.at(i));
407 std::map<std::string, TMatrixT<Double_t>* >::iterator itMat;
408 for(itMat=fMatrices.begin();itMat!=fMatrices.end();itMat++){
409 if(itMat->second!=NULL)
delete [] itMat->second;
411 std::map<std::string, genf::GFDetPlane* >::iterator itPl;
412 for(itPl=fPlanes.begin();itPl!=fPlanes.end();itPl++){
413 if(itPl->second!=NULL)
delete [] itPl->second;
415 std::map<std::string, TMatrixT<Double_t>* >::iterator itNum;
416 for(itNum=fNumbers.begin();itNum!=fNumbers.end();itNum++){
417 if(itNum->second!=NULL)
delete [] itNum->second;
425 std::vector< std::string > keys;
426 std::map<std::string, TMatrixT<Double_t>* >::const_iterator it;
427 for(it=fMatrices.begin();it!=fMatrices.end();it++){
428 if(it->second!=NULL) keys.push_back(it->first);
433 std::vector< std::string > keys;
434 std::map<std::string, genf::GFDetPlane* >::const_iterator it;
435 for(it=fPlanes.begin();it!=fPlanes.end();it++){
436 if(it->second!=NULL) keys.push_back(it->first);
441 std::vector< std::string > keys;
442 std::map<std::string, TMatrixT<Double_t>* >::const_iterator it;
443 for(it=fNumbers.begin();it!=fNumbers.end();it++){
444 if(it->second!=NULL) keys.push_back(it->first);
451 out <<
"=============genf::GFBookkeeping::print()==============" << std::endl;
452 out <<
"-----printing all matrices:------" << std::endl;
453 std::vector<std::string> keys = getMatrixKeys();
454 for(
unsigned int i=0;i<keys.size();++i){
455 out <<
"key " << keys.at(i) <<
" has " << fNhits
456 <<
" entries:" << std::endl;
457 for(
int j=0;j<fNhits;++j){
458 TMatrixT<Double_t>
m;
459 getMatrix(keys.at(i),j,
m);
463 out <<
"-----printing all GFDetPlanes:------" << std::endl;
464 keys = getGFDetPlaneKeys();
465 for(
unsigned int i=0;i<keys.size();++i){
466 out <<
"key " << keys.at(i) <<
" has " << fNhits
467 <<
" entries:" << std::endl;
468 for(
int j=0;j<fNhits;++j){
470 getDetPlane(keys.at(i),j,
p);
474 out <<
"-----printing all numbers:------" << std::endl;
475 keys = getNumberKeys();
476 for(
unsigned int i=0;i<keys.size();++i){
477 out <<
"key " << keys.at(i) <<
" has " << fNhits
478 <<
" entries:" << std::endl;
479 for(
int j=0;j<fNhits;++j){
481 getNumber(keys.at(i),j,
n);
482 out << n << std::endl;
485 out <<
"-----failed hits:------" << std::endl;
486 for(
unsigned int i=0;i<fFailedHits.size();++i){
487 out << fFailedHits.at(i) <<
" ";
void setDetPlane(std::string key, unsigned int index, const GFDetPlane &pl)
std::map< std::string, TMatrixT< Double_t > * > fNumbers
void Print(std::ostream &out=std::cout) const
std::map< std::string, TMatrixT< Double_t > * > fMatrices
void setNumber(std::string key, unsigned int index, const double &num)
void Print(std::ostream &out=std::cout) const
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
void setMatrix(std::string key, unsigned int index, const TMatrixT< Double_t > &mat)
void addFailedHit(unsigned int)
void bookGFDetPlanes(std::string key)
unsigned int hitFailed(unsigned int)
std::vector< unsigned int > fFailedHits
bool getNumber(std::string key, unsigned int index, double &num) const
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
then echo File list $list not found else cat $list while read file do echo $file sed s
void bookMatrices(std::string key)
std::vector< std::string > getMatrixKeys() const
std::vector< std::string > getGFDetPlaneKeys() const
bool getMatrix(std::string key, unsigned int index, TMatrixT< Double_t > &mat) const
void bookNumbers(std::string key, double val=0.)
std::vector< std::string > getNumberKeys() const
std::map< std::string, GFDetPlane * > fPlanes
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl) const
unsigned int getNumFailed()