| 29 |
debug = false; |
debug = false; |
| 30 |
dolong = true; |
dolong = true; |
| 31 |
dofull = false; |
dofull = false; |
| 32 |
|
sntr = 0; |
| 33 |
// |
// |
| 34 |
Clear(); |
Clear(); |
| 35 |
// |
// |
| 40 |
OBT = 0; |
OBT = 0; |
| 41 |
PKT = 0; |
PKT = 0; |
| 42 |
atime = 0; |
atime = 0; |
| 43 |
longtzeta = 0.; |
longtzeta = -100.; |
| 44 |
fulltzeta = 0.; |
fulltzeta = -100.; |
| 45 |
|
degfre = 0; |
| 46 |
memset(estrip, 0, 2*22*96*sizeof(Float_t)); |
memset(estrip, 0, 2*22*96*sizeof(Float_t)); |
| 47 |
memset(qplane, 0, 2*22*sizeof(Float_t)); |
memset(qplane, 0, 2*22*sizeof(Float_t)); |
| 48 |
// |
// |
| 62 |
} |
} |
| 63 |
|
|
| 64 |
void CaloFranzini::Delete(){ |
void CaloFranzini::Delete(){ |
| 65 |
|
// |
| 66 |
if ( file ) file->Close(); |
if ( file ) file->Close(); |
| 67 |
|
// |
| 68 |
Clear(); |
Clear(); |
| 69 |
|
// |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
void CaloFranzini::Process(){ |
| 74 |
|
this->Process(0); |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
void CaloFranzini::Process(Int_t itr){ |
| 78 |
|
// |
| 79 |
|
if ( !L2 ){ |
| 80 |
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
| 81 |
|
printf(" ERROR: CaloFranzini variables _NOT_ filled \n"); |
| 82 |
|
return; |
| 83 |
|
}; |
| 84 |
|
// |
| 85 |
|
if ( !nbin || !file || !brig ){ |
| 86 |
|
printf(" ERROR: it seems covariance matrix file has not been opened (CaloFranzini::Open()) \n"); |
| 87 |
|
printf(" ERROR: CaloFranzini variables _NOT_ filled \n"); |
| 88 |
|
return; |
| 89 |
|
}; |
| 90 |
|
// |
| 91 |
|
Bool_t newentry = false; |
| 92 |
|
// |
| 93 |
|
if ( L2->IsORB() ){ |
| 94 |
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || itr != sntr ){ |
| 95 |
|
newentry = true; |
| 96 |
|
OBT = L2->GetOrbitalInfo()->OBT; |
| 97 |
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
| 98 |
|
atime = L2->GetOrbitalInfo()->absTime; |
| 99 |
|
sntr = itr; |
| 100 |
|
}; |
| 101 |
|
} else { |
| 102 |
|
newentry = true; |
| 103 |
|
}; |
| 104 |
|
// |
| 105 |
|
if ( !newentry ) return; |
| 106 |
|
// |
| 107 |
|
// Some variables |
| 108 |
|
// |
| 109 |
|
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
| 110 |
|
// |
| 111 |
|
this->Clear(); |
| 112 |
|
// |
| 113 |
|
Float_t rig = L2->GetTrack(itr)->GetTrkTrack()->GetRigidity(); |
| 114 |
|
// |
| 115 |
|
// Fill the estrip matrix |
| 116 |
|
// |
| 117 |
|
Int_t nplane = 0; |
| 118 |
|
Int_t view = 0; |
| 119 |
|
Int_t plane = 0; |
| 120 |
|
Int_t strip = 0; |
| 121 |
|
Float_t mip = 0.; |
| 122 |
|
for ( Int_t i=0; i<L2->GetCaloLevel1()->istrip; i++ ){ |
| 123 |
|
// |
| 124 |
|
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 125 |
|
// |
| 126 |
|
estrip[view][plane][strip] = mip; |
| 127 |
|
nplane = 1 - view + 2 * plane; |
| 128 |
|
qplane[nplane] += mip; |
| 129 |
|
// |
| 130 |
|
}; |
| 131 |
|
// |
| 132 |
|
// |
| 133 |
|
// |
| 134 |
|
if ( dolong ){ |
| 135 |
|
// |
| 136 |
|
degfre = 44; |
| 137 |
|
// |
| 138 |
|
for (Int_t i=0; i < 22; i++){ |
| 139 |
|
if ( L2->GetTrack(itr)->GetCaloTrack()->tibar[i][1] < 0 ){ |
| 140 |
|
degfre = 2 * i; |
| 141 |
|
break; |
| 142 |
|
}; |
| 143 |
|
if ( L2->GetTrack(itr)->GetCaloTrack()->tibar[i][0] < 0 ){ |
| 144 |
|
degfre = 1 + 2 * i; |
| 145 |
|
break; |
| 146 |
|
}; |
| 147 |
|
}; |
| 148 |
|
// |
| 149 |
|
if ( degfre > 0 ){ |
| 150 |
|
TArrayF *qplmean = this->LoadLongAverage(rig); |
| 151 |
|
TMatrixD *lmatrix = this->LoadCovarianceMatrix(rig); |
| 152 |
|
for (Int_t i = 0; i < degfre; i++){ |
| 153 |
|
for (Int_t j = 0; j < degfre; j++){ |
| 154 |
|
longtzeta += (qplane[i]-qplmean->At(i)) * (*lmatrix)[i][j] * (qplane[j]-qplmean->At(j)); |
| 155 |
|
}; |
| 156 |
|
}; |
| 157 |
|
}; |
| 158 |
|
}; |
| 159 |
|
if ( dofull ){ |
| 160 |
|
printf(" ERROR: NOT IMPLEMENTED YET\n"); |
| 161 |
printf(" ERROR: CaloFranzini variables _NOT_ filled \n"); |
printf(" ERROR: CaloFranzini variables _NOT_ filled \n"); |
| 162 |
}; |
}; |
| 163 |
// |
// |
| 164 |
if ( debug ) this->Print(); |
if ( debug ) this->Print(); |
| 165 |
if ( debug ) printf(" exit \n"); |
if ( debug ) printf(" exit \n"); |
| 166 |
// |
} |
| 167 |
|
|
| 168 |
|
|
| 169 |
|
Float_t CaloFranzini::GetNormLongTZeta(){ |
| 170 |
|
Process(); |
| 171 |
|
Float_t normz = 0.; |
| 172 |
|
if ( degfre > 0 ) normz = longtzeta/(Float_t)degfre; |
| 173 |
|
return normz; |
| 174 |
|
} |
| 175 |
|
|
| 176 |
|
Float_t CaloFranzini::GetNormFullTZeta(){ |
| 177 |
|
Process(); |
| 178 |
|
Float_t normz = 0.; |
| 179 |
|
if ( degfre > 0 ) normz = fulltzeta/(Float_t)degfre; |
| 180 |
|
return normz; |
| 181 |
} |
} |
| 182 |
|
|
| 183 |
Bool_t CaloFranzini::CreateMatrixFile(TString matrixfile){ |
Bool_t CaloFranzini::CreateMatrixFile(TString matrixfile){ |