| 1 |
mocchiut |
1.1 |
/** |
| 2 |
|
|
* \file CaloPreSampler.cpp |
| 3 |
|
|
* \author Emiliano Mocchiutti (2007/07/18) |
| 4 |
|
|
*/ |
| 5 |
|
|
// |
| 6 |
|
|
// headers |
| 7 |
|
|
// |
| 8 |
|
|
#include <CaloPreSampler.h> |
| 9 |
|
|
//-------------------------------------- |
| 10 |
|
|
/** |
| 11 |
|
|
* Default constructor |
| 12 |
|
|
*/ |
| 13 |
|
|
CaloPreSampler::CaloPreSampler(){ |
| 14 |
|
|
Clear(); |
| 15 |
mocchiut |
1.6 |
} |
| 16 |
mocchiut |
1.1 |
|
| 17 |
|
|
CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){ |
| 18 |
|
|
// |
| 19 |
|
|
L2 = l2p; |
| 20 |
|
|
// |
| 21 |
|
|
if ( !L2->IsORB() ) printf(" WARNING: OrbitalInfo Tree is needed, the plugin could not work properly without it \n"); |
| 22 |
|
|
// |
| 23 |
|
|
OBT = 0; |
| 24 |
|
|
PKT = 0; |
| 25 |
|
|
atime = 0; |
| 26 |
|
|
// |
| 27 |
|
|
// Default variables |
| 28 |
|
|
// |
| 29 |
|
|
event = new CaloLevel0(); |
| 30 |
|
|
cstrip = new CaloStrip(false); |
| 31 |
|
|
// c1 = new CaloLevel1(); |
| 32 |
|
|
pcalo = new CaloLevel2(); |
| 33 |
mocchiut |
1.6 |
N = 4; |
| 34 |
|
|
NC = 22-N; |
| 35 |
mocchiut |
1.1 |
debug = false; |
| 36 |
|
|
sel = true; |
| 37 |
|
|
cont = false; |
| 38 |
|
|
emulate18 = true; |
| 39 |
|
|
simulation = false; |
| 40 |
mocchiut |
1.4 |
withtrk = true; |
| 41 |
|
|
rigdefault = 50.; |
| 42 |
mocchiut |
1.5 |
nox = false; |
| 43 |
|
|
noy = false; |
| 44 |
mocchiut |
1.1 |
// |
| 45 |
|
|
Clear(); |
| 46 |
|
|
// |
| 47 |
|
|
// loading magnetic field... |
| 48 |
|
|
// |
| 49 |
|
|
TrkLevel2 *trk = new TrkLevel2(); |
| 50 |
|
|
GL_PARAM *q4 = new GL_PARAM(); |
| 51 |
|
|
TSQLServer *dbc = 0; |
| 52 |
|
|
TString host = "mysql://localhost/pamelaprod"; |
| 53 |
|
|
TString user = "anonymous"; |
| 54 |
|
|
TString psw = ""; |
| 55 |
|
|
const char *pamdbhost=gSystem->Getenv("PAM_DBHOST"); |
| 56 |
|
|
const char *pamdbuser=gSystem->Getenv("PAM_DBUSER"); |
| 57 |
|
|
const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW"); |
| 58 |
|
|
if ( !pamdbhost ) pamdbhost = ""; |
| 59 |
|
|
if ( !pamdbuser ) pamdbuser = ""; |
| 60 |
|
|
if ( !pamdbpsw ) pamdbpsw = ""; |
| 61 |
|
|
if ( strcmp(pamdbhost,"") ) host = pamdbhost; |
| 62 |
|
|
if ( strcmp(pamdbuser,"") ) user = pamdbuser; |
| 63 |
|
|
if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw; |
| 64 |
|
|
dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data()); |
| 65 |
|
|
// |
| 66 |
|
|
q4->Query_GL_PARAM(1,1,dbc); |
| 67 |
|
|
printf(" Reading magnetic field maps at %s\n",(q4->PATH+q4->NAME).Data()); |
| 68 |
|
|
trk->LoadField(q4->PATH+q4->NAME); |
| 69 |
|
|
// |
| 70 |
mocchiut |
1.6 |
} |
| 71 |
|
|
|
| 72 |
|
|
void CaloPreSampler::SetNoWpreSampler(Int_t n){ |
| 73 |
|
|
if ( NC+n < 23 ){ |
| 74 |
|
|
N = n; |
| 75 |
|
|
} else { |
| 76 |
|
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
| 77 |
|
|
printf(" you are giving N presampler = %i and N calo = %i \n",n,NC); |
| 78 |
|
|
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
| 79 |
|
|
NC = 18; |
| 80 |
|
|
N = 4; |
| 81 |
|
|
}; |
| 82 |
|
|
} |
| 83 |
|
|
|
| 84 |
|
|
void CaloPreSampler::SetNoWcalo(Int_t n){ |
| 85 |
|
|
if ( N+n < 23 ){ |
| 86 |
|
|
NC = n; |
| 87 |
|
|
} else { |
| 88 |
|
|
printf(" ERROR! Calorimeter is made of 22 W planes\n"); |
| 89 |
|
|
printf(" you are giving N W presampler = %i and N W calo = %i \n",N,n); |
| 90 |
|
|
printf(" WARNING: using default values NWpre = 4, NWcalo = 18\n"); |
| 91 |
|
|
NC = 18; |
| 92 |
|
|
N = 4; |
| 93 |
|
|
}; |
| 94 |
|
|
} |
| 95 |
mocchiut |
1.1 |
|
| 96 |
|
|
void CaloPreSampler::Clear(){ |
| 97 |
|
|
// |
| 98 |
|
|
pcalo->Clear(); |
| 99 |
|
|
// |
| 100 |
mocchiut |
1.6 |
} |
| 101 |
mocchiut |
1.1 |
|
| 102 |
|
|
void CaloPreSampler::Print(){ |
| 103 |
|
|
// |
| 104 |
|
|
Process(); |
| 105 |
|
|
// |
| 106 |
|
|
printf("========================================================================\n"); |
| 107 |
|
|
printf(" OBT: %u PKT: %u ATIME: %u \n",OBT,PKT,atime); |
| 108 |
|
|
printf(" debug [debug flag]:.. %i\n",debug); |
| 109 |
|
|
printf(" simulation [simulation flag]:.. %i\n",simulation); |
| 110 |
|
|
printf(" emulate18 [emulate dead plane 18]:.. %i\n",emulate18); |
| 111 |
|
|
printf(" selection mode :.. %i\n",sel); |
| 112 |
|
|
printf(" contamination mode :.. %i\n",cont); |
| 113 |
|
|
printf(" pre-sampler planes :.. %i\n",N); |
| 114 |
|
|
printf(" pcalo->qtot :.. %f\n",pcalo->qtot); |
| 115 |
|
|
printf(" pcalo->nstrip :.. %i\n",pcalo->nstrip); |
| 116 |
mocchiut |
1.2 |
if ( pcalo->ntrk() > 0 ){ |
| 117 |
|
|
printf(" pcalo->track0->qtrack :.. %f\n",pcalo->GetCaloTrkVar(0)->qtrack); |
| 118 |
|
|
printf(" pcalo->track0->dX0l :.. %f\n",pcalo->GetCaloTrkVar(0)->dX0l); |
| 119 |
|
|
}; |
| 120 |
mocchiut |
1.1 |
printf("========================================================================\n"); |
| 121 |
|
|
// |
| 122 |
mocchiut |
1.6 |
} |
| 123 |
mocchiut |
1.1 |
|
| 124 |
|
|
void CaloPreSampler::Delete(){ |
| 125 |
|
|
Clear(); |
| 126 |
|
|
delete pcalo; |
| 127 |
|
|
//delete this; |
| 128 |
mocchiut |
1.6 |
} |
| 129 |
mocchiut |
1.1 |
|
| 130 |
|
|
|
| 131 |
|
|
void CaloPreSampler::Process(){ |
| 132 |
|
|
// |
| 133 |
|
|
if ( !L2 ){ |
| 134 |
|
|
printf(" ERROR: cannot find PamLevel2 object, use the correct constructor or check your program!\n"); |
| 135 |
|
|
printf(" ERROR: CaloPreSampler variables _NOT_ filled \n"); |
| 136 |
|
|
return; |
| 137 |
|
|
}; |
| 138 |
|
|
// |
| 139 |
|
|
Bool_t newentry = false; |
| 140 |
|
|
// |
| 141 |
|
|
if ( L2->IsORB() ){ |
| 142 |
|
|
if ( L2->GetOrbitalInfo()->pkt_num != PKT || L2->GetOrbitalInfo()->OBT != OBT || L2->GetOrbitalInfo()->absTime != atime || sel != ssel ){ |
| 143 |
|
|
newentry = true; |
| 144 |
|
|
OBT = L2->GetOrbitalInfo()->OBT; |
| 145 |
|
|
PKT = L2->GetOrbitalInfo()->pkt_num; |
| 146 |
|
|
atime = L2->GetOrbitalInfo()->absTime; |
| 147 |
|
|
ssel = sel; |
| 148 |
|
|
}; |
| 149 |
|
|
} else { |
| 150 |
|
|
newentry = true; |
| 151 |
|
|
}; |
| 152 |
|
|
// |
| 153 |
|
|
if ( !newentry ) return; |
| 154 |
|
|
// |
| 155 |
|
|
// Some variables |
| 156 |
|
|
// |
| 157 |
|
|
Int_t S3 = 0; |
| 158 |
|
|
Int_t S2 = 0; |
| 159 |
|
|
Int_t S12 = 0; |
| 160 |
|
|
Int_t S11 = 0; |
| 161 |
|
|
Float_t tmptrigty = -1.; |
| 162 |
|
|
Bool_t trackanyway = true; |
| 163 |
mocchiut |
1.4 |
// Float_t rigdefault = 50.; |
| 164 |
mocchiut |
1.1 |
Bool_t hZn = true; |
| 165 |
mocchiut |
1.4 |
// Bool_t withtrk = true; |
| 166 |
mocchiut |
1.1 |
Bool_t st = true; |
| 167 |
|
|
Int_t ntrkentry = 0; |
| 168 |
|
|
TrkLevel2 *trk = L2->GetTrkLevel2(); |
| 169 |
|
|
Bool_t filled = false; |
| 170 |
|
|
// |
| 171 |
|
|
if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); |
| 172 |
|
|
// |
| 173 |
|
|
this->Clear(); |
| 174 |
|
|
// |
| 175 |
|
|
// find out if we have trkseqno = -1, -2 or -3 |
| 176 |
|
|
// |
| 177 |
|
|
Bool_t m1 = false; |
| 178 |
|
|
Bool_t m2 = false; |
| 179 |
|
|
Bool_t m3 = false; |
| 180 |
|
|
for (Int_t mm=0; mm < L2->GetCaloLevel2()->ntrk(); mm++ ){ |
| 181 |
|
|
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -1 ) m1 = true; |
| 182 |
|
|
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -2 ) m2 = true; |
| 183 |
|
|
if ( L2->GetCaloLevel2()->GetCaloTrkVar(mm)->trkseqno == -3 ) m3 = true; |
| 184 |
|
|
}; |
| 185 |
mocchiut |
1.4 |
if ( !withtrk ) m3 = true; |
| 186 |
mocchiut |
1.1 |
// |
| 187 |
|
|
if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n"); |
| 188 |
|
|
// |
| 189 |
|
|
// Fill the estrip matrix |
| 190 |
|
|
// |
| 191 |
|
|
memset(event->clevel1->estrip, 0, 2*22*96*sizeof(Float_t)); |
| 192 |
|
|
Int_t view = 0; |
| 193 |
|
|
Int_t plane = 0; |
| 194 |
|
|
Int_t strip = 0; |
| 195 |
|
|
Float_t mip = 0.; |
| 196 |
|
|
for ( Int_t i=0; i<L2->GetCaloLevel1()->istrip; i++ ){ |
| 197 |
|
|
// |
| 198 |
|
|
mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); |
| 199 |
|
|
// |
| 200 |
mocchiut |
1.5 |
// Mask x or y view if nox and/or noy are true (default false) |
| 201 |
|
|
// |
| 202 |
|
|
if ( nox && view == 0 ) mip = 0.; |
| 203 |
|
|
if ( noy && view == 1 ) mip = 0.; |
| 204 |
|
|
// |
| 205 |
mocchiut |
1.1 |
// Selection mode: fill the matrix only for plane < (22 - N) REMEMBER N = number of W planes to be used as presampler, ie if N = 2 then we want to use planes from 0 to 19 |
| 206 |
|
|
// included so plane < (22 - 2) |
| 207 |
|
|
// |
| 208 |
|
|
if ( sel ){ |
| 209 |
|
|
if ( plane < (22 - N) ){ |
| 210 |
|
|
// |
| 211 |
|
|
if ( emulate18 && plane == (18 - N) ) mip = 0.; |
| 212 |
mocchiut |
1.6 |
if ( plane >= NC ) mip = 0.; |
| 213 |
mocchiut |
1.1 |
event->clevel1->estrip[strip][plane][view] = mip; |
| 214 |
|
|
// |
| 215 |
|
|
}; |
| 216 |
|
|
}; |
| 217 |
|
|
// |
| 218 |
|
|
// Contamination mode: fill the matrix only for planes from N to 22 but shift all planes up to the first one |
| 219 |
|
|
// |
| 220 |
|
|
if ( cont ){ |
| 221 |
|
|
if ( plane >= N ){ |
| 222 |
|
|
// |
| 223 |
|
|
if ( emulate18 && plane == (18 + N) ) mip = 0.; |
| 224 |
mocchiut |
1.6 |
if ( (plane-N) >= NC ) mip = 0.; |
| 225 |
mocchiut |
1.1 |
event->clevel1->estrip[strip][(plane-N)][view] = mip; |
| 226 |
|
|
// |
| 227 |
|
|
}; |
| 228 |
|
|
}; |
| 229 |
|
|
// |
| 230 |
|
|
}; |
| 231 |
|
|
// |
| 232 |
|
|
// if data comes from the simulation we must use mechanical alignment parameters (default is flight parameters) |
| 233 |
|
|
// |
| 234 |
|
|
if ( simulation ){ |
| 235 |
|
|
cstrip->UseMechanicalAlig(); |
| 236 |
|
|
}; |
| 237 |
|
|
// |
| 238 |
|
|
// Set alignment parameter |
| 239 |
|
|
// |
| 240 |
|
|
event->clevel1->xalig = cstrip->GetXalig(); |
| 241 |
|
|
event->clevel1->yalig = cstrip->GetYalig(); |
| 242 |
|
|
event->clevel1->zalig = cstrip->GetZalig(); |
| 243 |
|
|
// |
| 244 |
|
|
event->clevel1->emin = 0.7; |
| 245 |
|
|
// |
| 246 |
|
|
// in case of the contamination mode we must play with the Z alignment in order to have the correct track in the calo since we have moved the planes up... |
| 247 |
|
|
// |
| 248 |
|
|
if ( cont ){ |
| 249 |
|
|
if ( !(N%2) ){ |
| 250 |
|
|
event->clevel1->reverse = 0; // if the number of planes is even we have taken away a full module no need to do anything strange... |
| 251 |
|
|
event->clevel1->zalig -= (N/2) * (8.09 + 10.09); |
| 252 |
|
|
} else { |
| 253 |
|
|
event->clevel1->reverse = 1; // if the number of planes is odd we have taken away half a module, we need to reverse silicon planes shifting |
| 254 |
|
|
event->clevel1->zalig -= ((N+1)/2) * 8.09 + ((N-1)/2) * 10.09; |
| 255 |
|
|
}; |
| 256 |
|
|
}; |
| 257 |
|
|
if ( debug ) printf(" xalig = %f \n",event->clevel1->xalig); |
| 258 |
|
|
if ( debug ) printf(" yalig = %f \n",event->clevel1->yalig); |
| 259 |
|
|
if ( debug ) printf(" zalig = %f \n",event->clevel1->zalig); |
| 260 |
|
|
// |
| 261 |
|
|
if ( debug ) printf(" Calculate variables as done in CaloCore, N = %i \n",N); |
| 262 |
|
|
// |
| 263 |
|
|
// Calculate variables |
| 264 |
|
|
// |
| 265 |
|
|
// |
| 266 |
|
|
// use only N W planes |
| 267 |
|
|
// |
| 268 |
|
|
event->clevel1->npla = 22-N; |
| 269 |
|
|
// |
| 270 |
|
|
S3 = 0; |
| 271 |
|
|
S2 = 0; |
| 272 |
|
|
S12 = 0; |
| 273 |
|
|
S11 = 0; |
| 274 |
|
|
S3 = L2->GetTrigLevel2()->patterntrig[2]; |
| 275 |
|
|
S2 = L2->GetTrigLevel2()->patterntrig[3]; |
| 276 |
|
|
S12 = L2->GetTrigLevel2()->patterntrig[4]; |
| 277 |
|
|
S11 = L2->GetTrigLevel2()->patterntrig[5]; |
| 278 |
|
|
if ( L2->GetTrigLevel2()->patterntrig[1] & (1<<0) ) tmptrigty = 1.; |
| 279 |
|
|
if ( L2->GetTrigLevel2()->patterntrig[0] ) tmptrigty = 2.; |
| 280 |
|
|
if ( S3 || S2 || S12 || S11 ) tmptrigty = 0.; |
| 281 |
|
|
if ( !(L2->GetTrigLevel2()->patterntrig[1] & (1<<0)) && !L2->GetTrigLevel2()->patterntrig[0] && !S3 && !S2 && !S12 && !S11 ) tmptrigty = 1.; |
| 282 |
|
|
event->clevel2->trigty = tmptrigty; |
| 283 |
|
|
// |
| 284 |
|
|
// do we have at least one track from the tracker? this check has been disabled |
| 285 |
|
|
// |
| 286 |
|
|
event->clevel1->good2 = 1; |
| 287 |
|
|
// |
| 288 |
mocchiut |
1.3 |
// copy variables calculated during calibration process which is skipped here... |
| 289 |
|
|
// |
| 290 |
|
|
event->clevel2->good = L2->GetCaloLevel2()->good; |
| 291 |
|
|
memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); |
| 292 |
|
|
memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); |
| 293 |
|
|
memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); |
| 294 |
|
|
event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; |
| 295 |
|
|
// |
| 296 |
mocchiut |
1.1 |
// Calculate variables common to all tracks (qtot, nstrip, etc.) |
| 297 |
|
|
// |
| 298 |
|
|
if ( debug ) printf("1 Call GetCommonVar() \n"); |
| 299 |
|
|
event->GetCommonVar(); |
| 300 |
|
|
// |
| 301 |
|
|
// Fill common variables |
| 302 |
|
|
// |
| 303 |
|
|
if ( debug ) printf("1 Call FillCommonVar() \n"); |
| 304 |
|
|
event->FillCommonVar(NULL,pcalo); |
| 305 |
|
|
// |
| 306 |
|
|
// Calculate variables related to tracks only if we have at least one track (from selftrigger and/or tracker) |
| 307 |
|
|
// |
| 308 |
|
|
ntrkentry = 0; |
| 309 |
|
|
// |
| 310 |
|
|
filled = false; |
| 311 |
|
|
// |
| 312 |
|
|
// Run over tracks (tracker or calorimeter ) |
| 313 |
|
|
// |
| 314 |
|
|
if ( withtrk ){ |
| 315 |
|
|
// |
| 316 |
|
|
for (Int_t nt=0; nt < trk->ntrk(); nt++){ |
| 317 |
|
|
// |
| 318 |
|
|
event->clevel1->good2 = 1; |
| 319 |
|
|
// |
| 320 |
|
|
TrkTrack *ptt = trk->GetStoredTrack(nt); |
| 321 |
|
|
// |
| 322 |
|
|
event->clevel1->trkchi2 = 0; |
| 323 |
|
|
// |
| 324 |
|
|
// Copy the alpha vector in the input structure |
| 325 |
|
|
// |
| 326 |
|
|
for (Int_t e = 0; e < 5 ; e++){ |
| 327 |
|
|
event->clevel1->al_p[e][0] = ptt->al[e]; |
| 328 |
|
|
}; |
| 329 |
|
|
// |
| 330 |
|
|
// Get tracker related variables for this track |
| 331 |
|
|
// |
| 332 |
|
|
if ( debug ) printf("track %i Call GetTrkVar() \n",nt); |
| 333 |
|
|
event->GetTrkVar(); |
| 334 |
|
|
if ( debug ) printf(" event->clevel2->dX0l %f \n",event->clevel2->dX0l); |
| 335 |
|
|
// |
| 336 |
|
|
// Save tracker track sequence number |
| 337 |
|
|
// |
| 338 |
|
|
event->trkseqno = nt; |
| 339 |
|
|
// |
| 340 |
|
|
// Copy values in the class ca from the structure clevel2 |
| 341 |
|
|
// |
| 342 |
|
|
if ( debug ) printf("track %i Call FillTrkVar() \n",nt); |
| 343 |
|
|
event->FillTrkVar(pcalo,ntrkentry); |
| 344 |
|
|
|
| 345 |
|
|
|
| 346 |
|
|
ntrkentry++; |
| 347 |
|
|
filled = true; |
| 348 |
|
|
// |
| 349 |
|
|
}; // loop on all the tracks |
| 350 |
|
|
}; |
| 351 |
|
|
// |
| 352 |
|
|
// if no tracks found but there is the possibility to have a good track we should try to calculate anyway the track related variables using the calorimeter |
| 353 |
|
|
// fit of the track (to be used for example when TRK is off due to any reason like IPM3/5 off). |
| 354 |
|
|
// here we make an event selection so it must be done very carefully... |
| 355 |
|
|
// |
| 356 |
|
|
// conditions are: 0) no track from the tracker 1) we have a track fit both in x and y 2) no problems with calo for this event 3) no selftrigger event |
| 357 |
|
|
// |
| 358 |
|
|
// if ( trackanyway && !filled && event->clevel2->npcfit[0] >= 2 && event->clevel2->npcfit[1] >= 2 && event->clevel2->good != 0 && event->clevel2->trigty < 2. ){ |
| 359 |
|
|
if ( trackanyway && m3 ){ |
| 360 |
|
|
if ( debug ) printf(" Event with a track not fitted by the tracker \n"); |
| 361 |
|
|
// |
| 362 |
|
|
// Disable "track mode" in the fortran routine |
| 363 |
|
|
// |
| 364 |
|
|
event->clevel1->good2 = 0; |
| 365 |
|
|
event->clevel1->riginput = rigdefault; |
| 366 |
|
|
if ( debug ) printf(" Using as default rigidity: %f \n",event->clevel1->riginput); |
| 367 |
|
|
// |
| 368 |
|
|
// We have a selftrigger event to analyze. |
| 369 |
|
|
// |
| 370 |
|
|
for (Int_t e = 0; e < 5 ; e++){ |
| 371 |
|
|
event->clevel1->al_p[e][0] = 0.; |
| 372 |
|
|
event->clevel1->al_p[e][1] = 0.; |
| 373 |
|
|
}; |
| 374 |
|
|
event->clevel1->trkchi2 = 0; |
| 375 |
|
|
// |
| 376 |
|
|
if ( debug ) printf("-3 a Call GetTrkVar() \n"); |
| 377 |
|
|
event->GetTrkVar(); |
| 378 |
|
|
// |
| 379 |
|
|
// if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on |
| 380 |
|
|
// |
| 381 |
|
|
if ( event->clevel1->good2 == 0 ) { |
| 382 |
|
|
// |
| 383 |
|
|
// In selftrigger mode the trkentry variable is set to -1 |
| 384 |
|
|
// |
| 385 |
|
|
event->trkseqno = -3; |
| 386 |
|
|
// |
| 387 |
|
|
// Copy values in the class ca from the structure clevel2 |
| 388 |
|
|
// |
| 389 |
|
|
if ( debug ) printf("-3 a Call FillTrkVar() \n"); |
| 390 |
|
|
event->FillTrkVar(pcalo,ntrkentry); |
| 391 |
|
|
ntrkentry++; |
| 392 |
|
|
filled = true; |
| 393 |
|
|
// |
| 394 |
|
|
} else { |
| 395 |
|
|
if ( debug ) printf(" Selftrigger: problems with event \n"); |
| 396 |
|
|
}; |
| 397 |
|
|
// |
| 398 |
|
|
}; |
| 399 |
|
|
// |
| 400 |
|
|
// Call high energy nuclei routine |
| 401 |
|
|
// |
| 402 |
|
|
// if ( hZn && event->clevel2->trigty >= 2. ){ |
| 403 |
|
|
if ( hZn && m2 ){ |
| 404 |
|
|
if ( debug ) printf(" Calling selftrigger high energy nuclei routine \n"); |
| 405 |
|
|
// |
| 406 |
|
|
// Disable "track mode" in the fortran routine |
| 407 |
|
|
// |
| 408 |
|
|
event->clevel1->good2 = 0; |
| 409 |
|
|
// |
| 410 |
|
|
// Set high energy nuclei flag to one |
| 411 |
|
|
// |
| 412 |
|
|
event->clevel1->hzn = 1; |
| 413 |
|
|
event->clevel1->riginput = rigdefault; |
| 414 |
|
|
// |
| 415 |
|
|
// We have a selftrigger event to analyze. |
| 416 |
|
|
// |
| 417 |
|
|
for (Int_t e = 0; e < 5 ; e++){ |
| 418 |
|
|
event->clevel1->al_p[e][0] = 0.; |
| 419 |
|
|
event->clevel1->al_p[e][1] = 0.; |
| 420 |
|
|
}; |
| 421 |
|
|
event->clevel1->trkchi2 = 0; |
| 422 |
|
|
// |
| 423 |
|
|
if ( debug ) printf("-2 a Call GetTrkVar() \n"); |
| 424 |
|
|
event->GetTrkVar(); |
| 425 |
|
|
// |
| 426 |
|
|
// if we had no problem (clevel1->good2 = 0, NOTICE zero, not one in this mode!), fill and go on |
| 427 |
|
|
// |
| 428 |
|
|
if ( event->clevel1->good2 == 0 ) { |
| 429 |
|
|
// |
| 430 |
|
|
// In selftrigger mode the trkentry variable is set to -1 |
| 431 |
|
|
// |
| 432 |
|
|
event->trkseqno = -2; |
| 433 |
|
|
// |
| 434 |
|
|
// Copy values in the class ca from the structure clevel2 |
| 435 |
|
|
// |
| 436 |
|
|
if ( debug ) printf("-2 a Call FillTrkVar() \n"); |
| 437 |
|
|
event->FillTrkVar(pcalo,ntrkentry); |
| 438 |
|
|
ntrkentry++; |
| 439 |
|
|
filled = true; |
| 440 |
|
|
// |
| 441 |
|
|
} else { |
| 442 |
|
|
if ( debug ) printf(" Selftrigger: problems with event \n"); |
| 443 |
|
|
}; |
| 444 |
|
|
// |
| 445 |
|
|
}; |
| 446 |
|
|
// |
| 447 |
|
|
// self trigger event |
| 448 |
|
|
// |
| 449 |
|
|
// if ( st && event->clevel2->trigty >= 2. ){ |
| 450 |
|
|
if ( st && m1 ){ |
| 451 |
|
|
if ( debug ) printf(" Selftrigger event \n"); |
| 452 |
|
|
// |
| 453 |
|
|
// Disable "track mode" in the fortran routine |
| 454 |
|
|
// |
| 455 |
|
|
event->clevel1->good2 = 0; |
| 456 |
|
|
// |
| 457 |
|
|
// disable high enery nuclei flag; |
| 458 |
|
|
// |
| 459 |
|
|
event->clevel1->hzn = 0; |
| 460 |
|
|
// |
| 461 |
|
|
// We have a selftrigger event to analyze. |
| 462 |
|
|
// |
| 463 |
|
|
for (Int_t e = 0; e < 5 ; e++){ |
| 464 |
|
|
event->clevel1->al_p[e][0] = 0.; |
| 465 |
|
|
event->clevel1->al_p[e][1] = 0.; |
| 466 |
|
|
}; |
| 467 |
|
|
event->clevel1->trkchi2 = 0; |
| 468 |
|
|
// |
| 469 |
|
|
if ( debug ) printf("-1 a Call GetTrkVar() \n"); |
| 470 |
|
|
event->GetTrkVar(); |
| 471 |
|
|
// |
| 472 |
|
|
// if we had no problem (clevel2->good = 0, NOTICE zero, not one in selftrigger mode!), fill and go on |
| 473 |
|
|
// |
| 474 |
|
|
if ( event->clevel1->good2 == 0 ) { |
| 475 |
|
|
// |
| 476 |
|
|
// In selftrigger mode the trkentry variable is set to -1 |
| 477 |
|
|
// |
| 478 |
|
|
event->trkseqno = -1; |
| 479 |
|
|
// |
| 480 |
|
|
// Copy values in the class ca from the structure clevel2 |
| 481 |
|
|
// |
| 482 |
|
|
if ( debug ) printf("-1 a Call FillTrkVar() \n"); |
| 483 |
|
|
event->FillTrkVar(pcalo,ntrkentry); |
| 484 |
|
|
ntrkentry++; |
| 485 |
|
|
filled = true; |
| 486 |
|
|
// |
| 487 |
|
|
} else { |
| 488 |
|
|
if ( debug ) printf(" Selftrigger: problems with event \n"); |
| 489 |
|
|
}; |
| 490 |
|
|
}; |
| 491 |
|
|
// |
| 492 |
|
|
// Clear structures used to communicate with fortran |
| 493 |
|
|
// |
| 494 |
|
|
event->ClearStructs(); |
| 495 |
|
|
// |
| 496 |
|
|
// |
| 497 |
|
|
// |
| 498 |
|
|
if ( debug ) this->Print(); |
| 499 |
|
|
if ( debug ) printf(" exit \n"); |
| 500 |
|
|
// |
| 501 |
mocchiut |
1.6 |
} |