21 #include "TClonesArray.h"
43 theRootFile =
new TFile(
"report.root",
"RECREATE",
"Simple ROOT Ntuple");
45 CocoaTree =
new TTree(
"CocoaTree",
"CocoaTree");
133 ALIint nMeas = 0, nUnk = 0;
136 std::vector< Measurement* >::const_iterator vmcite;
140 double c2 = ( (*vmcite)->value(
ii) - (*vmcite)->valueSimulated(
ii) ) / (*vmcite)->sigma(
ii);
146 std::vector< Entry* >::iterator veite;
149 if ( (*veite)->quality() == 2 ) nUnk++;
150 if ( (*veite)->quality() == 1 ) {
153 double c2 = (*veite)->valueDisplacementByFitting() / (*veite)->sigma();
170 int theMinEntryQuality = 1;
172 std::vector<Entry*>::const_iterator vecite;
177 if ( (*vecite)->quality() >= theMinEntryQuality ) {
179 ALIint ipos = (*vecite)->fitPos();
191 std::cout <<
"EEE " << (*vecite)->ValueDimensionFactor() <<
" " << (*vecite)->SigmaDimensionFactor() <<
" " << fe->
getOptOName() <<
" " << fe->
getEntryName() <<
" " << fe->
getName() <<
" " << fe->
getOrder() <<
" " << fe->
getQuality() <<
" " << (*vecite)->type() <<
" " << std::endl;
201 if ((*vecite)->type()==
"centre" || (*vecite)->type()==
"length") DF = 1000.;
255 std::vector< OpticalObject* >::const_iterator vecobj;
263 if (!(*vecobj)->parent()) {
270 std::vector< OpticalObject* >::const_iterator vecobj2;
273 if ((*vecobj2)->name()==(*vecobj)->parent()->name()) {
310 int ss = 0,
dd = 0, d1 = 0,
tt = 0, cc = 0;
311 std::vector< Measurement* >::const_iterator vmcite;
313 std::vector<ALIstring> optonamelist = (*vmcite)->OptONameList();
318 if (optobj->
Name==LastOptOName) optoind = no;
321 if ((*vmcite)->type()==
"SENSOR2D") {
325 for (
ALIuint i = 0;
i<(*vmcite)->dim();
i++) {
332 if ((*vmcite)->type()==
"DISTANCEMETER") {
341 if ((*vmcite)->type()==
"DISTANCEMETER1DIM") {
351 if ((*vmcite)->type()==
"TILTMETER") {
360 if ((*vmcite)->type()==
"COPS") {
364 for (
ALIuint i = 0;
i<(*vmcite)->dim();
i++) {
385 double xx = rmGlob.xx();
if (fabs(xx)<1.
e-08) xx = 0.;
386 double xy = rmGlob.xy();
if (fabs(xy)<1.
e-08) xy = 0.;
387 double xz = rmGlob.xz();
if (fabs(xz)<1.
e-08) xz = 0.;
388 double yx = rmGlob.yx();
if (fabs(yx)<1.
e-08) yx = 0.;
389 double yy = rmGlob.yy();
if (fabs(yy)<1.
e-08) yy = 0.;
390 double yz = rmGlob.yz();
if (fabs(yz)<1.
e-08) yz = 0.;
391 double zx = rmGlob.zx();
if (fabs(zx)<1.
e-08) zx = 0.;
392 double zy = rmGlob.zy();
if (fabs(zy)<1.
e-08) zy = 0.;
393 double zz = rmGlob.zz();
if (fabs(zz)<1.
e-08) zz = 0.;
395 double beta = asin(-zx);
400 double sinalpha = zy/
cos(beta);
401 double cosalpha = zz/
cos(beta);
402 if (cosalpha>=0) alpha = asin(sinalpha);
403 else alpha =
M_PI - asin(sinalpha);
406 double singamma = yx/
cos(beta);
407 double cosgamma = xx/
cos(beta);
408 if (cosgamma>=0) gamma = asin(singamma);
409 else gamma =
M_PI - asin(singamma);
416 double singamma = yz/
sin(beta);
417 double cosgamma = yy;
418 if (cosgamma>=0) gamma = asin(singamma);
419 else gamma =
M_PI - asin(singamma);
424 int GotGlobalAngles = 0;
425 if (fabs(xy-(
sin(alpha)*
sin(beta)*
cos(gamma)-
sin(gamma)*
cos(alpha)))>1.
e-08)
426 GotGlobalAngles += 1;
427 if (fabs(xz-(
cos(alpha)*
sin(beta)*
cos(gamma)+
sin(gamma)*
sin(alpha)))>1.
e-08)
428 GotGlobalAngles += 10;
429 if (fabs(yy-(
sin(alpha)*
sin(beta)*
sin(gamma)+
cos(gamma)*
cos(alpha)))>1.
e-08)
430 GotGlobalAngles += 100;
431 if (fabs(yz-(
cos(alpha)*
sin(beta)*
sin(gamma)-
cos(gamma)*
sin(alpha)))>1.
e-08)
432 GotGlobalAngles += 1000;
433 if (GotGlobalAngles>0)
434 std::cout <<
"NtupleManager Warning: cannot get global rotation: "
435 << GotGlobalAngles << std::endl;
DistancemeterMeas * DistancemeterMeasA
ALIdouble getOrigValue() const
void GetGlobalAngles(const CLHEP::HepRotation &rmGlob, double *theta)
ALIint getQuality() const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
ALIstring getOptOName() const
ALIstring getName() const
static std::vector< Entry * > & EntryList()
TClonesArray * CloneOptObject
TClonesArray * CloneTiltmeterMeas
TClonesArray * CloneFitParam
ALIdouble getOrigSigma() const
double SimulatedPosition[2]
Cos< T >::type cos(const T &t)
ALIdouble getSigma() const
TClonesArray * CloneDistancemeterMeas
ALIstring getEntryName() const
static std::vector< OpticalObject * > & OptOList()
TClonesArray * CloneSensor2DMeas
Sensor2DMeas * Sensor2DMeasA
TClonesArray * CloneCopsMeas
static NtupleManager * getInstance()
void FillOptObjects(MatrixMeschach *AtWAMatrix)
void FillFitParameters(MatrixMeschach *AtWAMatrix)
double Chi2CalibratedParameters
TiltmeterMeas * TiltmeterMeasA
ALIdouble getValue() const
for(const auto &isodef:isoDefs)
static NtupleManager * instance
double SimulatedPosition[4]
static std::vector< Measurement * > & MeasurementList()
Distancemeter1DimMeas * Distancemeter1DimMeasA
TClonesArray * CloneDistancemeter1DimMeas