--- calo/flight/CaloPreSampler/src/CaloPreSampler.cpp 2009/09/10 12:52:51 1.14 +++ calo/flight/CaloPreSampler/src/CaloPreSampler.cpp 2014/01/23 11:23:54 1.19 @@ -14,6 +14,11 @@ Clear(); } +void CaloPreSampler::SetCaloLevel2Pointer(CaloLevel2 *cl2p){ + if ( pcalo ) delete pcalo; + pcalo = cl2p; +} + CaloPreSampler::CaloPreSampler(PamLevel2 *l2p){ // L2 = l2p; @@ -36,6 +41,7 @@ sel = true; cont = false; emulate18 = true; + usepl18x = false; simulation = false; withtrk = true; rigdefault = 50.; @@ -72,6 +78,15 @@ // } +CaloTrkVar* CaloPreSampler::GetCaloTrack(Int_t t){ + this->Process(); + if ( t < 0 ) return pcalo->GetCaloStoredTrack(t); + if ( L2->GetTrack(t) ){ + return pcalo->GetCaloStoredTrack(L2->GetTrack(t)->GetTrkTrack()->GetSeqNo()); + }; + return NULL; +} + void CaloPreSampler::SetNoWpreSampler(Int_t n){ if ( NC+n < 23 ){ N = n; @@ -195,12 +210,10 @@ Bool_t st = true; Int_t ntrkentry = 0; TrkLevel2 *trk = L2->GetTrkLevel2(); - Bool_t filled = false; + // Bool_t filled = false; // if ( debug ) printf(" Processing event at OBT %u PKT %u time %u \n",OBT,PKT,atime); // - this->Clear(); - // // find out if we have trkseqno = -1, -2 or -3 // Bool_t m1 = false; @@ -213,6 +226,18 @@ }; if ( !withtrk ) m3 = true; // + // copy variables calculated during calibration process which is skipped here... this has been moved before this->Clear() for reprocessing purpose + // + event->clevel2->good = L2->GetCaloLevel2()->good; + memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); + memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); + memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); + event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; + // + // + this->Clear(); // moved after all calls to L2->GetCaloLevel2() since pcalo could be the same as L2->GetCaloLevel2() !!! + // + // if ( debug ) printf(" Fill estrip matrix needed to calculate variables \n"); // // Fill the estrip matrix @@ -226,6 +251,8 @@ // mip = L2->GetCaloLevel1()->DecodeEstrip(i,view,plane,strip); // + if ( !usepl18x && view==0 && plane==18 ) mip = 0.; + // // Mask x or y view if nox and/or noy are true (default false) // if ( mask[view][plane] ) mip = 0.; @@ -318,13 +345,13 @@ // event->clevel1->good2 = 1; // - // copy variables calculated during calibration process which is skipped here... + // copy variables calculated during calibration process which is skipped here... this has to be moved before this->Clear() for reprocessing purpose // - event->clevel2->good = L2->GetCaloLevel2()->good; - memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); - memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); - memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); - event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; +// event->clevel2->good = L2->GetCaloLevel2()->good; +// memcpy(event->clevel2->perr,L2->GetCaloLevel2()->perr,sizeof(L2->GetCaloLevel2()->perr)); +// memcpy(event->clevel2->swerr,L2->GetCaloLevel2()->swerr,sizeof(L2->GetCaloLevel2()->swerr)); +// memcpy(event->clevel2->crc,L2->GetCaloLevel2()->crc,sizeof(L2->GetCaloLevel2()->crc)); +// event->clevel2->selftrigger = L2->GetCaloLevel2()->selftrigger; // // Calculate variables common to all tracks (qtot, nstrip, etc.) // @@ -340,7 +367,7 @@ // ntrkentry = 0; // - filled = false; + // filled = false; // // Run over tracks (tracker or calorimeter ) // @@ -377,7 +404,7 @@ ntrkentry++; - filled = true; + // filled = true; // }; // loop on all the tracks }; @@ -422,7 +449,7 @@ if ( debug ) printf("-3 a Call FillTrkVar() \n"); event->FillTrkVar(pcalo,ntrkentry); ntrkentry++; - filled = true; + // filled = true; // } else { if ( debug ) printf(" Selftrigger: problems with event \n"); @@ -469,7 +496,7 @@ if ( debug ) printf("-2 a Call FillTrkVar() \n"); event->FillTrkVar(pcalo,ntrkentry); ntrkentry++; - filled = true; + // filled = true; // } else { if ( debug ) printf(" Selftrigger: problems with event \n"); @@ -515,7 +542,7 @@ if ( debug ) printf("-1 a Call FillTrkVar() \n"); event->FillTrkVar(pcalo,ntrkentry); ntrkentry++; - filled = true; + // filled = true; // } else { if ( debug ) printf(" Selftrigger: problems with event \n");