#include "Stntuple/obj/TStnPi0.hh" ClassImp(TStnPi0) //_____________________________________________________________________________ void TStnPi0::ReadV1(TBuffer &R__b) { // read V1, V2 adds fZCes and fXCes in the end... struct StnPi0_t_v1 { TLorentzVector fMomentum; // 4-momentum //----------------------------------------------------------------------------- // block of integers //----------------------------------------------------------------------------- Int_t fNumber; Int_t fEtaPhi; // , side Int_t fNClusters[2]; // 0:strips, 1:wires //----------------------------------------------------------------------------- // block of floats //----------------------------------------------------------------------------- Float_t fWeight; // handle shared clusters, normally=1 Float_t fZ0; // assigned Z-coordinate of the vertex //----------------------------------------------------------------------------- // parameters of the clusters, 0:strip, 1:wire //----------------------------------------------------------------------------- Float_t fClusterEnergy[2]; Float_t fClusterCoord [2]; Float_t fClusterSigma [2]; Float_t fClusterChi2 [2]; Pi0Candidate* fPi0Candidate; // ! backward link (internal use only) } pi0_v1; int nwi = ((Int_t* ) &pi0_v1.fWeight ) - &pi0_v1.fNumber; int nwf = ((Float_t*) &pi0_v1.fPi0Candidate) - &pi0_v1.fWeight; fMomentum.Streamer(R__b); R__b.ReadFastArray(&fNumber,nwi); R__b.ReadFastArray(&fWeight,nwf); fXCes = 0; fZCes = 0; } //_____________________________________________________________________________ void TStnPi0::Streamer(TBuffer &R__b) { // Stream an object of class TStnPi0, assume that first goes the integer // block, then - the float one int nwi = ((Int_t* ) &fWeight) - &fNumber; int nwf = ((Float_t*) &fPi0Candidate) - &fWeight; if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); if (R__v == 1) { ReadV1(R__b); } else if (R__v == 2) { //----------------------------------------------------------------------------- // read version 2 (current). V2 adds to V1 fXCes and fZCes (in the end) //----------------------------------------------------------------------------- fMomentum.Streamer(R__b); R__b.ReadFastArray(&fNumber,nwi); R__b.ReadFastArray(&fWeight,nwf); } } else { //----------------------------------------------------------------------------- // write last version, for the moment - v5. // I/O-wise v4 and v5 are the same, 2 variables were renamed :fVtxocc->fZ0, // fPtrk->fD0, to cache additional electron track parameters //----------------------------------------------------------------------------- R__b.WriteVersion(TStnPi0::IsA()); fMomentum.Streamer(R__b); R__b.WriteFastArray(&fNumber,nwi); R__b.WriteFastArray(&fWeight,nwf); } } //_____________________________________________________________________________ TStnPi0::TStnPi0(Int_t I): fNumber(I), fMomentum(0,0,0,0) { // constructor: set all the data to 0 int nwi = ((Int_t* ) &fWeight) - &fNumber; int nwf = ((Float_t*) &fPi0Candidate) - &fWeight; memset(&fNumber,0,4*nwi); memset(&fWeight,0,4*nwf); fEScale = 1; } //_____________________________________________________________________________ TStnPi0::~TStnPi0() { } //_____________________________________________________________________________ int TStnPi0::Init(int DetCode, int NCl1, int NCl2, float Weight) { fEtaPhi = DetCode; fNClusters[0] = NCl1; fNClusters[1] = NCl1; fWeight = Weight; return 0; } //_____________________________________________________________________________ void TStnPi0::ScaleMomentum(Double_t Scale) { // leave mass unchanged... // for all the practical purposes mass should be set to 0 fMomentum *= Scale; fEScale *= Scale; } //_____________________________________________________________________________ void TStnPi0::Print(Option_t* Opt) const { if ((Opt[0] == 0) || strstr(Opt,"banner")) { printf(" i ieta iphi Ns Nw Wgt Z0 XCes ZCes "); printf(" Px Py Pz E Cl_E Cl_X sigma chi2\n"); } TStnPi0* pi0 = (TStnPi0*) this; TLorentzVector* mom = (TLorentzVector*) pi0->Momentum(); if ((Opt[0] == 0) || strstr(Opt,"data")) { printf("%3i %3i %3i %2i %2i %8.2f %8.2f %8.2f %8.2f ", pi0->Number(), pi0->IEta(), pi0->IPhi(), pi0->NClusters(0), pi0->NClusters(1),pi0->Weight(), pi0->Z0(), pi0->XCes(), pi0->ZCes()); printf("%10.3f %10.3f %10.3f %10.3f", mom->Px(), mom->Py(), mom->Pz(), mom->E()); printf("%10.3f %8.2f %8.2f %8.2f\n", pi0->ClusterEnergy(0),pi0->ClusterCoord(0),pi0->ClusterSigma(0), pi0->ClusterChi2(0)); printf(" "); printf(" "); printf("%10.3f %8.2f %8.2f %8.2f\n", pi0->ClusterEnergy(1),pi0->ClusterCoord(1),pi0->ClusterSigma(1), pi0->ClusterChi2(1)); } }