ROOT logo
//*-- AUTHOR : Y.C.Pachmayer
//*-- Modified :
///////////////////////////////////////////////////////////////////////////////
//
// HMdcCosmicsCandidate
//
//
///////////////////////////////////////////////////////////////////////////////


using namespace std;
#include "hmdccosmicscandidate.h"
#include "TH1.h"
#include "TH2.h"
#include "TROOT.h"
#include "TMath.h"
#include "hades.h"
#include "hevent.h"
#include "hruntimedb.h"
#include "haddef.h"
#include "hiterator.h"
#include "hmdcdef.h"
#include "hmdctrackddef.h"
#include "hmdcdetector.h"
#include "tofdef.h"
#include "rpcdef.h"
#include "hspectrometer.h"
#include "htofgeompar.h"
#include "hmdccal1sim.h"
#include "htofhit.h"
#include "htofcluster.h"
#include "hrpchit.h"
#include "hrpccluster.h"
#include "hmdcclussim.h"
#include "hmdcsizescells.h"
#include "hcategory.h"
#include "hgeomtransform.h"
#include "hmdcgetcontainers.h"
#include "hgeomvolume.h"
#include <iostream>
#include <fstream>

ClassImp(HMdcCosmicsCandidate)
ClassImp(HCosmicCalibEvSkip)


HMdcCosmicsCandidate::HMdcCosmicsCandidate(const Text_t *name,const Text_t *title) 
    : HReconstructor(name,title) {
  initVariables();
}

HMdcCosmicsCandidate::HMdcCosmicsCandidate(void)
    : HReconstructor("HMdcCosmicsCandidate","HMdcCosmicsCandidate") {
  initVariables();
}

HMdcCosmicsCandidate::~HMdcCosmicsCandidate(void) {
  HMdcSizesCells::deleteCont();
  HMdcGetContainers::deleteCont();
  if(histFile != NULL) delete histFile;
  histFile = NULL;
}

void HMdcCosmicsCandidate::initVariables(void) {
  returnFlag     = kSkipEvent;
  pCatTof        = NULL;
  pCatRpc        = NULL;
  pCatMdcCal1    = NULL;
  useTofCat      = 0;
  useRpcCat      = 0;
  hsBeta         = NULL;
  plStat         = NULL;
  plQualVsWrLo   = NULL;
  for(Int_t s=0;s<6;s++) for(Int_t m=0;m<4;m++) {
    hsDCell[s][m] = NULL;
    for(Int_t l=0;l<6;l++) hsDCellL[s][m][l] = NULL;
  }

  makeHists      = kFALSE;
  histFile       = NULL;
  histFileName   = "./cosmCandHists.root";
  histFileOption = "NEW";
  setParContStat = kFALSE;
  zTofShift      = 0.;
  zRpcShift      = 0.;
  isGeant        = kFALSE;
  
  // Cuts:
  betaMin        = 0.5;
  betaMax        = 1.5;
  maxNWiresOutTr = 4;
  selQualCut     = 0.85;
  for(Int_t m=0; m<4; m++) dCellWind[m]    = 15.;
  nLayInModCut   = 3;
  nEventsTot     = 0;
  nEventsSel     = 0;
  nEventsSelSc   = 0;
  for(Int_t i=0;i<9;i++) {
    nSelTr[i]       = 0;
    trackScaling[i] = i<4 ? 0. : 1.1;
    nSelTrSc[i]     = 0;
  }
}

void HMdcCosmicsCandidate::setBetaCut(Double_t min,Double_t max) {
  if(max>0. && min>=0. && max>min) {
    betaMin = min;
    betaMax = max;
  } else {
    Error("setBetaCut","Error in beta cut setting: min=%f max=%f",min,max);
    exit(1);
  }
}

void HMdcCosmicsCandidate::setDCellWindow(Float_t wM1,Float_t wM2,Float_t wM3,Float_t wM4) {
  if(wM1>=0.) dCellWind[0] = wM1;
  if(wM2>=0.) dCellWind[1] = wM2;
  if(wM3>=0.) dCellWind[2] = wM3;
  if(wM4>=0.) dCellWind[3] = wM4;
}
  
Bool_t HMdcCosmicsCandidate::init(void) {
  cout << " HMdcCosmicsCandidate " << endl;
  if(!gHades) return kFALSE;

  sizes = HMdcSizesCells::getObject();
  pGetCont = HMdcGetContainers::getObject();

  if     (useTofCat==1) pCatTof = gHades->getCurrentEvent()->getCategory(catTofHit);
  else if(useTofCat==2) pCatTof = gHades->getCurrentEvent()->getCategory(catTofCluster);
  if(useTofCat>0 && pCatTof==NULL) {
    Error("HMdcCosmicsCandidate::init()","NO TOF hits! Stop!");
    return kFALSE;
  }

  if     (useRpcCat==1) pCatRpc = gHades->getCurrentEvent()->getCategory(catRpcHit);
  else if(useRpcCat==2) pCatRpc = gHades->getCurrentEvent()->getCategory(catRpcCluster);
  if(useRpcCat>0 && pCatRpc==NULL) {
    Error("HMdcCosmicsCandidate::init()","NO RPC hits! Stop!");
    return kFALSE;
  }
  
  if(pCatTof==NULL && pCatRpc==NULL) {
    Error("HMdcCosmicsCandidate::init()","NO META hits! Stop!");
    return kFALSE;
  }
      
  pCatMdcCal1 = gHades->getCurrentEvent()->getCategory(catMdcCal1);
  if (pCatMdcCal1 == NULL) {
    Error("HMdcCosmics::init()","NO catMdcCal1!");
    return kFALSE;
  }
  pCatMdcClus = pGetCont->getCatMdcClus(kTRUE);
  if(pCatMdcClus == NULL) {
    Error("HMdcCosmics::init()","NO catMdcClus!");
    return kFALSE;
  }

  //  MDC setup:
  HMdcDetector*  fMdcDet = pGetCont->getMdcDetector();
  for(Int_t s=0; s<6; s++) for(Int_t m=0; m<4; m++) {
    if(fMdcDet->getModule(s,m) == 0) mdcsetup[s][m] = 0;
    else                             mdcsetup[s][m] = 1;
  }

  printParam();
  if(makeHists && !createHists()) return kFALSE;
  return kTRUE;

}

Bool_t HMdcCosmicsCandidate::reinit(void) { 
  if(!sizes->initContainer()) return kFALSE;
  isGeant = HMdcGetContainers::isGeant(); 
  for(Int_t m=0;m<4;m++) {
    for(Int_t s=0;s<6;s++) if(pGetCont->isModActive(s,m)) {
      HMdcSizesCellsMod &scMod = (*sizes)[s][m];
      HMdcSizesCellsLayer &scLay = scMod[3]; // layer 2 only!
      HGeomVolume *layVol = scLay.getGeomVolume();
      HGeomVector* pnt1   = layVol->getPoint(0);
      HGeomVector* pnt2   = layVol->getPoint(1);
      laySize[m].y1       = pnt1->getY();
      laySize[m].x2       = pnt2->getX();
      laySize[m].y2       = pnt2->getY();
      laySize[m].inc      = (pnt1->getX()-pnt2->getX())/(pnt1->getY()-pnt2->getY());
      break;
    }
  }
  return kTRUE;
}

void HMdcCosmicsCandidate::printParam(void) {
  printf("------------------------------------------------------------\n");
  printf("  HMdcCosmicsCandidate:\n  ");
  if     (useTofCat == 1) printf("TofHits");
  else if(useTofCat == 2) printf("TofClusters");
  if(useTofCat>0 && useRpcCat>0) printf(" & ");
  if     ( useRpcCat==1 ) printf("RpcHits");
  else if( useRpcCat==2 ) printf("RpcClusters");
  printf(" are used for cosmic track finder.\n");
  printf("  Beta cut                   : betaMin=%g, betaMax=%g\n",betaMin,betaMax);
  if(zTofShift != 0.f) printf("  Shift of TofHits Z position: %.1f mm\n",zTofShift);
  printf("  Cells cut (MDC I,II,III,IV): %.1f, %.1f, %.1f, %.1f\n",
         dCellWind[0],dCellWind[1],dCellWind[2],dCellWind[3]);
  if(makeHists) printf("  (See histograms in the file)\n");
  printf("  Min.number of layres per module = %i\n",nLayInModCut);
  printf("------------------------------------------------------------\n");
}

Int_t HMdcCosmicsCandidate::execute(void) {
  
  if(nEventsTot==0 && setParContStat) {
    gHades->getRuntimeDb()->setContainersStatic();
    gHades->setEnableCloseInput(kFALSE);
  }
  
  nEventsTot++;

  nMetaHits = 0;
  nSectors  = 0;
  for(Int_t s=0;s<6;s++) {
    nMetaHitSec[s] = 0;
    for(Int_t m=0;m<4;m++) nWiresStat[s][m] = 0;
  }
  
  collectTofHits();
  collectRpcHits();
  if(nMetaHits>120) return returnFlag;
  
  numWiresAllMod = pCatMdcCal1->getEntries();
  if(numWiresAllMod<5) return returnFlag;
  for(Int_t n=0;n<numWiresAllMod;n++) {
    HMdcCal1 *pCal1 = (HMdcCal1*)pCatMdcCal1->getObject(n);
    Int_t sector = pCal1->getSector();
    Int_t module = pCal1->getModule();
    nWiresStat[sector][module]++;
  }

  if(nMetaHits < 2 || nSectors!=2) return returnFlag;

  Int_t s1 = 0;
  for(;s1<6;s1++) if(nMetaHitSec[s1]>0) break;
  Int_t s2 = s1+1;
  for(;s2<6;s2++) if(nMetaHitSec[s2]>0) break;
  bestTrCand.init(-1,-1);
  for(Int_t i1=0;i1<nMetaHits;i1++) if(metaHits[i1].sec == s1) { 
    for(Int_t i2=0;i2<nMetaHits;i2++) if(metaHits[i2].sec == s2) {
      currTrCand.init(i1,i2);
      if( !calcSectors(currTrCand) ) continue;
      if(currTrCand.nSecs < 2) continue;
      if(!testTrack()) continue;
      if(currTrCand.nLayers < bestTrCand.nLayers) continue;
      if(currTrCand.nLayers == bestTrCand.nLayers) {
        if(currTrCand.nModules < bestTrCand.nModules) continue;
        if(currTrCand.nModules == bestTrCand.nModules && currTrCand.dCellMean>bestTrCand.dCellMean) continue;
      }
      bestTrCand.copy(currTrCand);
    }
  }
  if(  bestTrCand.metaInd1< 0 )   return returnFlag;
  if( !bestTrCand.trackStatus() ) return returnFlag;
  
  plQualVsWrLo->Fill(bestTrCand.numWiresOutTrack() + 0.5,bestTrCand.selectQual());
  
  if(bestTrCand.numWiresOutTrack() > maxNWiresOutTr) return returnFlag;
  if(bestTrCand.selectQual() < selQualCut)           return returnFlag;
  if(bestTrCand.numLayersPerMod() < nLayInModCut)    return returnFlag;
  if(bestTrCand.nModules < 4)                        return returnFlag;
  
//---------------------------------------------------------
// while(bestTrCand.nSecs>2) { // Two sectors can be fitted now only!!!!!!!!!!!
//   Int_t sec = 0;
//   Int_t min = 100;
//   for(Int_t s=0;s<6;s++) if(bestTrCand.nLaySec[s]>0 && bestTrCand.nLaySec[s]<=min) {
//     sec = s;
//     min = bestTrCand.nLaySec[s];
//   }
// //  bestTrCand.nLayers -= min;
//   bestTrCand.nSecs--;
//   bestTrCand.nModules -= bestTrCand.nModSec[sec];
//   bestTrCand.nModSec[sec] = 0;
// //  bestTrCand.nLaySec[sec] = 0;
//   bestTrCand.modList[sec] = 0;
// // ---------------  return returnFlag;
// }
//------------------------------------------------------------

  if( !fillTrack(bestTrCand) )                       return returnFlag;
  
  Int_t &nModules = bestTrCand.nModules;
  nSelTr[nModules]++;
  nEventsSel++;

  if(trackScaling[nModules] <= 0.)                                       return returnFlag;
  if(trackScaling[nModules] < 1.&& rndm.Rndm() > trackScaling[nModules]) return returnFlag;
  nSelTrSc[nModules]++;
  nEventsSelSc++;
// static Int_t nnn={0};
// if(bestTrCand.nSecs>2) {
//   nnn++;
//   printf("nnn=%i   nSecs=%i\n",nnn,bestTrCand.nSecs);
// }
  
  return 0;
 }

void HMdcCosmicsCandidate::collectTofHits(void) {
  if(pCatTof == NULL) return;
  Int_t nHits = pCatTof->getEntries();
  if(nHits>120) return;
  for(Int_t n=0;n<nHits;n++) {
    HTofHit *tofHit = (HTofHit*) pCatTof->getObject(n);
    MetaHit &mHit   = metaHits[nMetaHits];
    Int_t sec = tofHit->getSector();
    if( !pGetCont->isSecActive(sec) ) continue;
    Float_t xlab,ylab,zlab;
    tofHit->getXYZLab(xlab,ylab,zlab);
    if( TMath::IsNaN(xlab) ) continue;
    mHit.hit.setXYZ(xlab,ylab,zlab + zTofShift);
    mHit.sec  = sec;
    mHit.tof  = tofHit->getTof();
    mHit.isTOF = kTRUE;
    nMetaHits++;
    if(nMetaHitSec[sec] == 0) nSectors++;
    nMetaHitSec[sec]++;
  }
}

void HMdcCosmicsCandidate::collectRpcHits(void) {
  if(pCatRpc == NULL) return;
  Int_t nHits = pCatRpc->getEntries();
  if(nHits>120) return;
  for(Int_t n=0;n<nHits;n++) {
    MetaHit &mHit   = metaHits[nMetaHits];
    Float_t xlab,ylab,zlab;
    if(useRpcCat==1) {
      HRpcHit *rpcHit = (HRpcHit*)pCatRpc->getObject(n);
      mHit.sec = rpcHit->getSector();
      mHit.tof = rpcHit->getTof();
      rpcHit->getXYZLab(xlab,ylab,zlab);      
    } else {
      HRpcCluster *rpcHit = (HRpcCluster*)pCatRpc->getObject(n);
      mHit.sec = rpcHit->getSector();
      mHit.tof = rpcHit->getTof();
      rpcHit->getXYZLab(xlab,ylab,zlab);
    }
    if( !pGetCont->isSecActive(mHit.sec) ) continue;
    mHit.hit.setXYZ(xlab,ylab,zlab + zRpcShift);
    mHit.isTOF = kFALSE;
    nMetaHits++;
    if(nMetaHitSec[mHit.sec] == 0) nSectors++;
    nMetaHitSec[mHit.sec]++;
  }
}

Bool_t HMdcCosmicsCandidate::testBeta(const MetaHit &h1,const MetaHit &h2,Bool_t mHists) {
  Double_t dt   = h1.tof  - h2.tof;
  if(dt == 0.) return kFALSE;
  Double_t path = (h1.hit-h2.hit).length();
  Double_t beta = path/TMath::Abs(dt)*1.e+6/TMath::C();
  if(mHists) hsBeta->Fill(beta);
//????if(h1.isTOF && h2.isTOF)  //  ????? RPC is not in triger! ... 
  if(beta < betaMin || beta > betaMax) return kFALSE;
  if(mHists) {
    if(dt < 0.) plStat->Fill(h1.sec+0.5,h2.sec+0.5);
    else        plStat->Fill(h2.sec+0.5,h1.sec+0.5);
  }
  return kTRUE;
} 

Bool_t HMdcCosmicsCandidate::fillTrack(TrackCand &bestCand) {
  MetaHit &mHit1 = metaHits[bestCand.metaInd1];
  MetaHit &mHit2 = metaHits[bestCand.metaInd2];
  if( !testBeta(mHit1,mHit2,makeHists) ) return kFALSE;
  HMdcClus* prevClus = NULL;
 
  HMdcList12GroupCells listCells;
  for(Int_t sec=0;sec<6;sec++) if(bestCand.secStatus(sec)) {
    HMdcSizesCellsSec&  scSec = (*sizes)[sec];
    hit1 = scSec.getLabTrans()->transTo(mHit1.hit);  // transf. lab => sec.coor.sytem
    hit2 = scSec.getLabTrans()->transTo(mHit2.hit);  // transf. lab => sec.coor.sytem
    for(Int_t seg=0; seg<2;seg++) if(bestCand.segStatus(sec,seg) != 0) {
      Short_t listCrLayers = 0;  // One bit per layers (12 bits). Bit[l]=1 -track cross this layer
      listCells.clear();
      for(Int_t mod=seg*2; mod<seg*2+2;mod++) if(bestCand.modStatus(sec,mod) != 0) {
	HMdcSizesCellsMod& szMod = scSec[mod];
        Int_t ilay = (mod&1)*6;
	for(Int_t lay=0;lay<6;lay++,ilay++) {
	  HMdcSizesCellsLayer& szLayer = szMod[lay];
          Float_t cell1, cell2;
	  if( !szLayer.calcCrossedCells(hit1.getX(),hit1.getY(),hit1.getZ(),
                                        hit2.getX(),hit2.getY(),hit2.getZ(),
                                        cell1, cell2) ) continue;  // Track don't cross layer!          
          Float_t cell12  = (cell1+cell2)/2;
          listCrLayers |= 1<<ilay;

          Short_t nCells   = szLayer.getNCells();

          Int_t nFCell     = TMath::Max(Int_t(cell1 - 30.),0);
          Int_t nLCell     = TMath::Min(Int_t(cell2 + 30.),nCells-1);
	  Int_t nFirstCell = TMath::Max(Int_t(cell1 - dCellWind[mod]),nFCell);
 	  Int_t nLastCell  = TMath::Min(Int_t(cell2 + dCellWind[mod]),nLCell);

          Int_t lCells[nLCell-nFCell+1];
          Int_t   nCs   = 0;
          Int_t   cM    = -1;
          Float_t dCell = 1.e+30;
	  for(Int_t cell=nFCell; cell<=nLCell;cell++) {
	    locCal1.set(4,sec,mod,lay,cell);
	    HMdcCal1* cal1 = (HMdcCal1*)pCatMdcCal1->getObject(locCal1);
	    if(cal1 == NULL) continue;
            Float_t dC = Float_t(cell) - cell12;
            // Fill histograms:
            if(makeHists) {
              hsDCell[sec][mod]->Fill(dC);
              hsDCellL[sec][mod][lay]->Fill(dC);
            }
            if(cell>=nFirstCell && cell<=nLastCell) {
              lCells[nCs] = cell;
              if(TMath::Abs(dC) < dCell) {
                dCell = TMath::Abs(dC);
                cM    = nCs;
              }
              nCs++;
            }
	  }
          if(nCs>0) {
            Int_t layInd = lay+(mod%2)*6;
            listCells.setTime(layInd, lCells[cM], 1);
            // Collecting of wires around "lCells[cM]":
            for(Int_t i=cM-1;i>=0 &&lCells[i+1]-lCells[i]==1;i--) listCells.setTime(layInd,lCells[i],1);
            for(Int_t i=cM+1;i<nCs&&lCells[i]-lCells[i-1]==1;i++) listCells.setTime(layInd,lCells[i],1);
          }
	}
      }
      //???      if(listCells.getNCells() == 0) continue;

      prevClus = fillCluster(sec,seg,listCells,prevClus);
      if(prevClus != NULL) prevClus->setStatus(listCrLayers);  // List of layers crossed by track
    }
  }

  return bestCand.trackStatus(); // Test track:
}


Bool_t HMdcCosmicsCandidate::calcSectors(TrackCand &trackCand) {
  MetaHit &mHit1 = metaHits[trackCand.metaInd1];
  MetaHit &mHit2 = metaHits[trackCand.metaInd2];
  if(mHit1.sec == mHit2.sec) return kFALSE;
  testSectors(trackCand,mHit1.sec,0);
  testSectors(trackCand,mHit2.sec,1);
  Int_t dSec = TMath::Abs(mHit1.sec-mHit2.sec);
  if(dSec == 3) {
    testSectors(trackCand,mHit1.sec-1,0);
    testSectors(trackCand,mHit2.sec-1,1);
    testSectors(trackCand,mHit1.sec+1,0);
    testSectors(trackCand,mHit2.sec+1,1); 
  } else if(dSec == 2 || dSec==4) {
    Int_t sec = TMath::Abs(mHit1.sec+mHit2.sec)/2;
    if(dSec == 4) sec += 3;
    testSectors(trackCand,sec,0);
  }
  return kTRUE;
}

void HMdcCosmicsCandidate::testSectors(TrackCand &trackCand,Int_t sec,Int_t part) {
  if     (sec < 0) sec = 5;
  else if(sec > 5) sec = 0;
  part &= 1;
  if( !pGetCont->isSecActive(sec) ) return;
  HMdcSizesCellsSec&  scSec = (*sizes)[sec];
  MetaHit &metaHit1 = metaHits[trackCand.metaInd1];
  MetaHit &metaHit2 = metaHits[trackCand.metaInd2];
  hit1 = scSec.getLabTrans()->transTo(metaHit1.hit);  // from lab to sec.coor.sytem
  hit2 = scSec.getLabTrans()->transTo(metaHit2.hit);  // from lab to sec.coor.sytem

  for(Int_t mod=0;mod<4;mod++) if(nWiresStat[sec][mod] > 0 && isCrossMod(sec,mod)) {
    trackCand.addMod(sec,mod,nWiresStat[sec][mod]);
  }  
}

Bool_t HMdcCosmicsCandidate::isCrossMod(Int_t sec,Int_t mod) {
  if(mdcsetup[sec][mod]==0) return kFALSE;  // No this mdc in setup
  HMdcSizesCellsMod &scMod = (*sizes)[sec][mod];
  Double_t x1 = hit1.getX();
  Double_t y1 = hit1.getY();
  Double_t z1 = hit1.getZ();
  Double_t x2 = hit2.getX();
  Double_t y2 = hit2.getY();
  Double_t z2 = hit2.getZ();
  HMdcSizesCellsLayer &pScLay = scMod[3];
  pScLay.transTo(x1,y1,z1);
  pScLay.transTo(x2,y2,z2);
  LayerSize &laySz = laySize[mod];
  Double_t yc = -z2/(z1-z2)*(y1-y2)+y2;
  if(yc < laySz.y1 || yc > laySz.y2) return kFALSE;
  Double_t xc = TMath::Abs(x2-z2/(z1-z2)*(x1-x2));
  Double_t xu = (yc-laySz.y2)*laySz.inc+laySz.x2;
  if(xc > xu) return kFALSE;
  return kTRUE;
}

Bool_t HMdcCosmicsCandidate::testTrack(void) {
  MetaHit &mHit1 = metaHits[currTrCand.metaInd1];
  MetaHit &mHit2 = metaHits[currTrCand.metaInd2];
  //----------  if( !testBeta(mHit1,mHit2) ) return kFALSE;
  Double_t dCMean = 0.;
  for(Int_t sec=0;sec<6;sec++) if(currTrCand.secStatus(sec)) {
    HMdcSizesCellsSec&  scSec = (*sizes)[sec];
    hit1 = scSec.getLabTrans()->transTo(mHit1.hit);  // transf. lab => sec.coor.sytem
    hit2 = scSec.getLabTrans()->transTo(mHit2.hit);  // transf. lab => sec.coor.sytem
    for(Int_t mod=0; mod<4;mod++) if(currTrCand.modStatus(sec,mod) != 0) {
      HMdcSizesCellsMod& scMod = scSec[mod];
      Int_t modLaySt = 0;
      for(Int_t lay=0;lay<6;lay++) {
        HMdcSizesCellsLayer& szLayer = scMod[lay];
        Float_t cell1, cell2;
        if( !szLayer.calcCrossedCells(hit1.getX(),hit1.getY(),hit1.getZ(),
             hit2.getX(),hit2.getY(),hit2.getZ(),cell1, cell2) ) continue;  // Track don't cross layer!
        Float_t cell12   = (cell1+cell2)/2;
        Short_t nCells   = szLayer.getNCells();
        Int_t nFirstCell = TMath::Max(Int_t(cell1 - dCellWind[mod]),0);
        Int_t nLastCell  = TMath::Min(Int_t(cell2 + dCellWind[mod]),nCells-1);

        Int_t lCells[nLastCell-nFirstCell+1];
        Int_t   nCs   = 0;
        Int_t   cM    = -1;
        Float_t dCell = 1.e+30;
        for(Int_t cell=nFirstCell; cell<=nLastCell;cell++) {
          locCal1.set(4,sec,mod,lay,cell);
          HMdcCal1* cal1 = (HMdcCal1*)pCatMdcCal1->getObject(locCal1);
          if(cal1 == NULL) continue;
          Float_t dC = TMath::Abs(Float_t(cell) - cell12);
          lCells[nCs] = cell;
          if(dC < dCell) {
            dCell = dC;
            cM    = nCs;
          }
          nCs++;
        }
        if(nCs>0) {
          currTrCand.nWires++;
          for(Int_t i=cM-1;i>=0 &&lCells[i+1]-lCells[i]==1;i--) currTrCand.nWires++;
          for(Int_t i=cM+1;i<nCs&&lCells[i]-lCells[i-1]==1;i++) currTrCand.nWires++;
          dCMean += dCell;
          modLaySt++;
        }
      }
      if(modLaySt==0) currTrCand.unsetMod(sec,mod);
      else {
        currTrCand.nLaySec[sec] += modLaySt;
        currTrCand.nLayers      += modLaySt;
        currTrCand.nModSec[sec]++;
        currTrCand.nModules++;
      }
    }
  }
  if(!currTrCand.trackStatus()) return kFALSE;
  currTrCand.dCellMean = dCMean/currTrCand.nLayers;
  return kTRUE;
}

HMdcClus* HMdcCosmicsCandidate::fillCluster(Int_t sec,Int_t seg,HMdcList12GroupCells &listCells,
    HMdcClus* prevClus) {
  locClus.set(2,sec,seg);
  HMdcClus* fClus=(HMdcClus*)pCatMdcClus->getNewSlot(locClus, &index);
  if(fClus == NULL) return fClus;
  if(isGeant) fClus = (HMdcClus*)(new(fClus) HMdcClusSim(listCells));
  else        fClus =             new(fClus) HMdcClus   (listCells);      

  fClus->setOwnIndex(index);
  if(prevClus != NULL)  {
    prevClus->setIndexChilds(index,index);
    fClus->setIndexParent(prevClus->getOwnIndex());
  }
  
  fClus->setSec(sec);
  fClus->setIOSeg(seg);
  fClus->setMod(-1);

  fClus->setTarget(hit1.getX(),20.,hit1.getY(),30.,hit1.getZ(),30.); 
  fClus->setXY    (hit2.getX(),20.,hit2.getY(),30.);
  fClus->setPrPlane(0., 0., hit2.getZ());       // If parA=parB=0 then parD=Z
  if(isGeant) ((HMdcClusSim*)fClus)->calcTrList();
  // Cleaning:
  fClus->setMinCl(0,0);
  fClus->setRealLevel(0);
  fClus->setOwnIndex(index);
  fClus->setNBins(0);
//fClus->print(); //--------------------------------------------------!!!!!!!!!!!!!!!!!!!!!!!!
  return fClus;
}
  
void HMdcCosmicsCandidate::setHistFile(const Char_t* dir,const Char_t* fileNm,const Char_t* opt) {
  // the hist output file is set

  if(dir != NULL)                       histFileName   = dir;
  else                                  histFileName   = "./";
  if( !histFileName.EndsWith("/") )     histFileName  += '/';
  if(fileNm != NULL)                    histFileName  += fileNm;
  else                                  histFileName  += "cosmCandHists";
  if(histFileName.EndsWith(".hld"))     histFileName.Remove(histFileName.Length()-4);
  if( !histFileName.EndsWith(".root") ) histFileName  += ".root";
  if(opt != NULL)                       histFileOption = opt;
}

Bool_t HMdcCosmicsCandidate::createHists(void) {
  histFile = new TFile(histFileName.Data(),histFileOption.Data());
  if(histFile==NULL || !histFile->IsOpen()) {
    Error("createHists","Can't open file %s (opt=%s)!",histFileName.Data(),histFileOption.Data());
    return kFALSE;
  }
  char title[100];
  char name[100];
  if(hsBeta==0) {
    sprintf(title,"Cut: %.2f < #beta < %.2f;#beta",betaMin,betaMax);
    hsBeta= new TH1F("hsBeta",title,300,0.,1.5);
  }
  if(plStat==0) plStat= new TH2F("plStat",
    "Statistic;Sector of first tof;Sector of second tof",6,0.,6., 6,0.,6.);
  for(Int_t s=0;s<6;s++) for(Int_t m=0;m<4;m++) if(mdcsetup[s][m]!=0 && hsDCell[s][m]==0) {
    sprintf(name,"hsDCellS%iM%i",s+1,m+1);
    sprintf(title,"S.%i M.%i Cut: #Delta Cell <= %.1f;#Delta Cell",s+1,m+1,dCellWind[m]);
    hsDCell[s][m] = new TH1F(name,title,300,-30.,30.);
    for(Int_t l=0;l<6;l++) {
      sprintf(name,"hsDCellS%iM%iL%i",s+1,m+1,l+1);
      sprintf(title,"S.%i M.%i L.%i Cut: #Delta Cell <= %.1f;#Delta Cell",s+1,m+1,l+1,dCellWind[m]);
      hsDCellL[s][m][l] = new TH1F(name,title,300,-30.,30.);
    }
  }
  if(plQualVsWrLo==0) plQualVsWrLo = new TH2F("plQualVsWrLo","",50,0.,50.,50,0.,1.0001);
  return kTRUE;
}

Bool_t HMdcCosmicsCandidate::finalize(void) {
  printf("\n-------------------------------------------------\n");
  if(nEventsSel == nEventsSelSc) {
    for(Int_t i=0;i<9;i++) if(nSelTr[i] > 0) {
      printf("%i modules: %10i tracks (%7.2f%c)\n",
      i,nSelTr[i],Float_t(nSelTr[i])/Float_t(nEventsSel)*100.,'%');
    }
    printf("  %i events filtered from %i.\n",nEventsSel,nEventsTot);
  } else {
    for(Int_t i=0;i<9;i++) if(nSelTr[i] > 0) {
      Double_t sc = trackScaling[i] < 1. ? trackScaling[i]*100 : 100;
      printf("%i modules: %10i tracks (%7.2f%c) ==> scaling %6.2f%c => %10i tracks (%7.2f%c)\n",
      i,nSelTr[i],Float_t(nSelTr[i])/Float_t(nEventsSel)*100.,'%',sc,'%',
        nSelTrSc[i],Float_t(nSelTrSc[i])/Float_t(nEventsSelSc)*100.,'%');
    }
    printf("  %i events filtered from %i.\n",nEventsSelSc,nEventsTot);
  }
  printf("-------------------------------------------------\n");
  if(makeHists) {
    printf("  Histograms are stored to the file %s\n",histFileName.Data());
    // writing hists to the root file
    histFile->cd();
    if(hsBeta       != NULL) hsBeta->Write();
    if(plStat       != NULL) plStat->Write();
    if(plQualVsWrLo != NULL) plQualVsWrLo->Write();
    for(Int_t s=0;s<6;s++) for(Int_t m=0;m<4;m++) if(hsDCell[s][m]!=NULL) {
      hsDCell[s][m]->Write();
      for(Int_t l=0;l<6;l++) hsDCellL[s][m][l]->Write();
    }
    histFile->Close();
  }
  return kTRUE;
}


void HMdcCosmicsCandidate::scaleDownTrack(UInt_t nMdcTr,Double_t sc) {
  if(nMdcTr<8) trackScaling[nMdcTr] = sc;
}

void HMdcCosmicsCandidate::scaleDownTrack(Double_t *sca) {
  for(Int_t nMdcs=0;nMdcs<9;nMdcs++) trackScaling[nMdcs] = sca[nMdcs];
}

HCosmicCalibEvSkip::HCosmicCalibEvSkip(void) 
    : HReconstructor("CosmicCalibEvSkip","CosmicCalibEvSkip") {
}

HCosmicCalibEvSkip::HCosmicCalibEvSkip(const Text_t *name,const Text_t *title) 
    : HReconstructor(name,title) {

}

Int_t HCosmicCalibEvSkip::execute(void) {
  return kSkipEvent;
}

 hmdccosmicscandidate.cc:1
 hmdccosmicscandidate.cc:2
 hmdccosmicscandidate.cc:3
 hmdccosmicscandidate.cc:4
 hmdccosmicscandidate.cc:5
 hmdccosmicscandidate.cc:6
 hmdccosmicscandidate.cc:7
 hmdccosmicscandidate.cc:8
 hmdccosmicscandidate.cc:9
 hmdccosmicscandidate.cc:10
 hmdccosmicscandidate.cc:11
 hmdccosmicscandidate.cc:12
 hmdccosmicscandidate.cc:13
 hmdccosmicscandidate.cc:14
 hmdccosmicscandidate.cc:15
 hmdccosmicscandidate.cc:16
 hmdccosmicscandidate.cc:17
 hmdccosmicscandidate.cc:18
 hmdccosmicscandidate.cc:19
 hmdccosmicscandidate.cc:20
 hmdccosmicscandidate.cc:21
 hmdccosmicscandidate.cc:22
 hmdccosmicscandidate.cc:23
 hmdccosmicscandidate.cc:24
 hmdccosmicscandidate.cc:25
 hmdccosmicscandidate.cc:26
 hmdccosmicscandidate.cc:27
 hmdccosmicscandidate.cc:28
 hmdccosmicscandidate.cc:29
 hmdccosmicscandidate.cc:30
 hmdccosmicscandidate.cc:31
 hmdccosmicscandidate.cc:32
 hmdccosmicscandidate.cc:33
 hmdccosmicscandidate.cc:34
 hmdccosmicscandidate.cc:35
 hmdccosmicscandidate.cc:36
 hmdccosmicscandidate.cc:37
 hmdccosmicscandidate.cc:38
 hmdccosmicscandidate.cc:39
 hmdccosmicscandidate.cc:40
 hmdccosmicscandidate.cc:41
 hmdccosmicscandidate.cc:42
 hmdccosmicscandidate.cc:43
 hmdccosmicscandidate.cc:44
 hmdccosmicscandidate.cc:45
 hmdccosmicscandidate.cc:46
 hmdccosmicscandidate.cc:47
 hmdccosmicscandidate.cc:48
 hmdccosmicscandidate.cc:49
 hmdccosmicscandidate.cc:50
 hmdccosmicscandidate.cc:51
 hmdccosmicscandidate.cc:52
 hmdccosmicscandidate.cc:53
 hmdccosmicscandidate.cc:54
 hmdccosmicscandidate.cc:55
 hmdccosmicscandidate.cc:56
 hmdccosmicscandidate.cc:57
 hmdccosmicscandidate.cc:58
 hmdccosmicscandidate.cc:59
 hmdccosmicscandidate.cc:60
 hmdccosmicscandidate.cc:61
 hmdccosmicscandidate.cc:62
 hmdccosmicscandidate.cc:63
 hmdccosmicscandidate.cc:64
 hmdccosmicscandidate.cc:65
 hmdccosmicscandidate.cc:66
 hmdccosmicscandidate.cc:67
 hmdccosmicscandidate.cc:68
 hmdccosmicscandidate.cc:69
 hmdccosmicscandidate.cc:70
 hmdccosmicscandidate.cc:71
 hmdccosmicscandidate.cc:72
 hmdccosmicscandidate.cc:73
 hmdccosmicscandidate.cc:74
 hmdccosmicscandidate.cc:75
 hmdccosmicscandidate.cc:76
 hmdccosmicscandidate.cc:77
 hmdccosmicscandidate.cc:78
 hmdccosmicscandidate.cc:79
 hmdccosmicscandidate.cc:80
 hmdccosmicscandidate.cc:81
 hmdccosmicscandidate.cc:82
 hmdccosmicscandidate.cc:83
 hmdccosmicscandidate.cc:84
 hmdccosmicscandidate.cc:85
 hmdccosmicscandidate.cc:86
 hmdccosmicscandidate.cc:87
 hmdccosmicscandidate.cc:88
 hmdccosmicscandidate.cc:89
 hmdccosmicscandidate.cc:90
 hmdccosmicscandidate.cc:91
 hmdccosmicscandidate.cc:92
 hmdccosmicscandidate.cc:93
 hmdccosmicscandidate.cc:94
 hmdccosmicscandidate.cc:95
 hmdccosmicscandidate.cc:96
 hmdccosmicscandidate.cc:97
 hmdccosmicscandidate.cc:98
 hmdccosmicscandidate.cc:99
 hmdccosmicscandidate.cc:100
 hmdccosmicscandidate.cc:101
 hmdccosmicscandidate.cc:102
 hmdccosmicscandidate.cc:103
 hmdccosmicscandidate.cc:104
 hmdccosmicscandidate.cc:105
 hmdccosmicscandidate.cc:106
 hmdccosmicscandidate.cc:107
 hmdccosmicscandidate.cc:108
 hmdccosmicscandidate.cc:109
 hmdccosmicscandidate.cc:110
 hmdccosmicscandidate.cc:111
 hmdccosmicscandidate.cc:112
 hmdccosmicscandidate.cc:113
 hmdccosmicscandidate.cc:114
 hmdccosmicscandidate.cc:115
 hmdccosmicscandidate.cc:116
 hmdccosmicscandidate.cc:117
 hmdccosmicscandidate.cc:118
 hmdccosmicscandidate.cc:119
 hmdccosmicscandidate.cc:120
 hmdccosmicscandidate.cc:121
 hmdccosmicscandidate.cc:122
 hmdccosmicscandidate.cc:123
 hmdccosmicscandidate.cc:124
 hmdccosmicscandidate.cc:125
 hmdccosmicscandidate.cc:126
 hmdccosmicscandidate.cc:127
 hmdccosmicscandidate.cc:128
 hmdccosmicscandidate.cc:129
 hmdccosmicscandidate.cc:130
 hmdccosmicscandidate.cc:131
 hmdccosmicscandidate.cc:132
 hmdccosmicscandidate.cc:133
 hmdccosmicscandidate.cc:134
 hmdccosmicscandidate.cc:135
 hmdccosmicscandidate.cc:136
 hmdccosmicscandidate.cc:137
 hmdccosmicscandidate.cc:138
 hmdccosmicscandidate.cc:139
 hmdccosmicscandidate.cc:140
 hmdccosmicscandidate.cc:141
 hmdccosmicscandidate.cc:142
 hmdccosmicscandidate.cc:143
 hmdccosmicscandidate.cc:144
 hmdccosmicscandidate.cc:145
 hmdccosmicscandidate.cc:146
 hmdccosmicscandidate.cc:147
 hmdccosmicscandidate.cc:148
 hmdccosmicscandidate.cc:149
 hmdccosmicscandidate.cc:150
 hmdccosmicscandidate.cc:151
 hmdccosmicscandidate.cc:152
 hmdccosmicscandidate.cc:153
 hmdccosmicscandidate.cc:154
 hmdccosmicscandidate.cc:155
 hmdccosmicscandidate.cc:156
 hmdccosmicscandidate.cc:157
 hmdccosmicscandidate.cc:158
 hmdccosmicscandidate.cc:159
 hmdccosmicscandidate.cc:160
 hmdccosmicscandidate.cc:161
 hmdccosmicscandidate.cc:162
 hmdccosmicscandidate.cc:163
 hmdccosmicscandidate.cc:164
 hmdccosmicscandidate.cc:165
 hmdccosmicscandidate.cc:166
 hmdccosmicscandidate.cc:167
 hmdccosmicscandidate.cc:168
 hmdccosmicscandidate.cc:169
 hmdccosmicscandidate.cc:170
 hmdccosmicscandidate.cc:171
 hmdccosmicscandidate.cc:172
 hmdccosmicscandidate.cc:173
 hmdccosmicscandidate.cc:174
 hmdccosmicscandidate.cc:175
 hmdccosmicscandidate.cc:176
 hmdccosmicscandidate.cc:177
 hmdccosmicscandidate.cc:178
 hmdccosmicscandidate.cc:179
 hmdccosmicscandidate.cc:180
 hmdccosmicscandidate.cc:181
 hmdccosmicscandidate.cc:182
 hmdccosmicscandidate.cc:183
 hmdccosmicscandidate.cc:184
 hmdccosmicscandidate.cc:185
 hmdccosmicscandidate.cc:186
 hmdccosmicscandidate.cc:187
 hmdccosmicscandidate.cc:188
 hmdccosmicscandidate.cc:189
 hmdccosmicscandidate.cc:190
 hmdccosmicscandidate.cc:191
 hmdccosmicscandidate.cc:192
 hmdccosmicscandidate.cc:193
 hmdccosmicscandidate.cc:194
 hmdccosmicscandidate.cc:195
 hmdccosmicscandidate.cc:196
 hmdccosmicscandidate.cc:197
 hmdccosmicscandidate.cc:198
 hmdccosmicscandidate.cc:199
 hmdccosmicscandidate.cc:200
 hmdccosmicscandidate.cc:201
 hmdccosmicscandidate.cc:202
 hmdccosmicscandidate.cc:203
 hmdccosmicscandidate.cc:204
 hmdccosmicscandidate.cc:205
 hmdccosmicscandidate.cc:206
 hmdccosmicscandidate.cc:207
 hmdccosmicscandidate.cc:208
 hmdccosmicscandidate.cc:209
 hmdccosmicscandidate.cc:210
 hmdccosmicscandidate.cc:211
 hmdccosmicscandidate.cc:212
 hmdccosmicscandidate.cc:213
 hmdccosmicscandidate.cc:214
 hmdccosmicscandidate.cc:215
 hmdccosmicscandidate.cc:216
 hmdccosmicscandidate.cc:217
 hmdccosmicscandidate.cc:218
 hmdccosmicscandidate.cc:219
 hmdccosmicscandidate.cc:220
 hmdccosmicscandidate.cc:221
 hmdccosmicscandidate.cc:222
 hmdccosmicscandidate.cc:223
 hmdccosmicscandidate.cc:224
 hmdccosmicscandidate.cc:225
 hmdccosmicscandidate.cc:226
 hmdccosmicscandidate.cc:227
 hmdccosmicscandidate.cc:228
 hmdccosmicscandidate.cc:229
 hmdccosmicscandidate.cc:230
 hmdccosmicscandidate.cc:231
 hmdccosmicscandidate.cc:232
 hmdccosmicscandidate.cc:233
 hmdccosmicscandidate.cc:234
 hmdccosmicscandidate.cc:235
 hmdccosmicscandidate.cc:236
 hmdccosmicscandidate.cc:237
 hmdccosmicscandidate.cc:238
 hmdccosmicscandidate.cc:239
 hmdccosmicscandidate.cc:240
 hmdccosmicscandidate.cc:241
 hmdccosmicscandidate.cc:242
 hmdccosmicscandidate.cc:243
 hmdccosmicscandidate.cc:244
 hmdccosmicscandidate.cc:245
 hmdccosmicscandidate.cc:246
 hmdccosmicscandidate.cc:247
 hmdccosmicscandidate.cc:248
 hmdccosmicscandidate.cc:249
 hmdccosmicscandidate.cc:250
 hmdccosmicscandidate.cc:251
 hmdccosmicscandidate.cc:252
 hmdccosmicscandidate.cc:253
 hmdccosmicscandidate.cc:254
 hmdccosmicscandidate.cc:255
 hmdccosmicscandidate.cc:256
 hmdccosmicscandidate.cc:257
 hmdccosmicscandidate.cc:258
 hmdccosmicscandidate.cc:259
 hmdccosmicscandidate.cc:260
 hmdccosmicscandidate.cc:261
 hmdccosmicscandidate.cc:262
 hmdccosmicscandidate.cc:263
 hmdccosmicscandidate.cc:264
 hmdccosmicscandidate.cc:265
 hmdccosmicscandidate.cc:266
 hmdccosmicscandidate.cc:267
 hmdccosmicscandidate.cc:268
 hmdccosmicscandidate.cc:269
 hmdccosmicscandidate.cc:270
 hmdccosmicscandidate.cc:271
 hmdccosmicscandidate.cc:272
 hmdccosmicscandidate.cc:273
 hmdccosmicscandidate.cc:274
 hmdccosmicscandidate.cc:275
 hmdccosmicscandidate.cc:276
 hmdccosmicscandidate.cc:277
 hmdccosmicscandidate.cc:278
 hmdccosmicscandidate.cc:279
 hmdccosmicscandidate.cc:280
 hmdccosmicscandidate.cc:281
 hmdccosmicscandidate.cc:282
 hmdccosmicscandidate.cc:283
 hmdccosmicscandidate.cc:284
 hmdccosmicscandidate.cc:285
 hmdccosmicscandidate.cc:286
 hmdccosmicscandidate.cc:287
 hmdccosmicscandidate.cc:288
 hmdccosmicscandidate.cc:289
 hmdccosmicscandidate.cc:290
 hmdccosmicscandidate.cc:291
 hmdccosmicscandidate.cc:292
 hmdccosmicscandidate.cc:293
 hmdccosmicscandidate.cc:294
 hmdccosmicscandidate.cc:295
 hmdccosmicscandidate.cc:296
 hmdccosmicscandidate.cc:297
 hmdccosmicscandidate.cc:298
 hmdccosmicscandidate.cc:299
 hmdccosmicscandidate.cc:300
 hmdccosmicscandidate.cc:301
 hmdccosmicscandidate.cc:302
 hmdccosmicscandidate.cc:303
 hmdccosmicscandidate.cc:304
 hmdccosmicscandidate.cc:305
 hmdccosmicscandidate.cc:306
 hmdccosmicscandidate.cc:307
 hmdccosmicscandidate.cc:308
 hmdccosmicscandidate.cc:309
 hmdccosmicscandidate.cc:310
 hmdccosmicscandidate.cc:311
 hmdccosmicscandidate.cc:312
 hmdccosmicscandidate.cc:313
 hmdccosmicscandidate.cc:314
 hmdccosmicscandidate.cc:315
 hmdccosmicscandidate.cc:316
 hmdccosmicscandidate.cc:317
 hmdccosmicscandidate.cc:318
 hmdccosmicscandidate.cc:319
 hmdccosmicscandidate.cc:320
 hmdccosmicscandidate.cc:321
 hmdccosmicscandidate.cc:322
 hmdccosmicscandidate.cc:323
 hmdccosmicscandidate.cc:324
 hmdccosmicscandidate.cc:325
 hmdccosmicscandidate.cc:326
 hmdccosmicscandidate.cc:327
 hmdccosmicscandidate.cc:328
 hmdccosmicscandidate.cc:329
 hmdccosmicscandidate.cc:330
 hmdccosmicscandidate.cc:331
 hmdccosmicscandidate.cc:332
 hmdccosmicscandidate.cc:333
 hmdccosmicscandidate.cc:334
 hmdccosmicscandidate.cc:335
 hmdccosmicscandidate.cc:336
 hmdccosmicscandidate.cc:337
 hmdccosmicscandidate.cc:338
 hmdccosmicscandidate.cc:339
 hmdccosmicscandidate.cc:340
 hmdccosmicscandidate.cc:341
 hmdccosmicscandidate.cc:342
 hmdccosmicscandidate.cc:343
 hmdccosmicscandidate.cc:344
 hmdccosmicscandidate.cc:345
 hmdccosmicscandidate.cc:346
 hmdccosmicscandidate.cc:347
 hmdccosmicscandidate.cc:348
 hmdccosmicscandidate.cc:349
 hmdccosmicscandidate.cc:350
 hmdccosmicscandidate.cc:351
 hmdccosmicscandidate.cc:352
 hmdccosmicscandidate.cc:353
 hmdccosmicscandidate.cc:354
 hmdccosmicscandidate.cc:355
 hmdccosmicscandidate.cc:356
 hmdccosmicscandidate.cc:357
 hmdccosmicscandidate.cc:358
 hmdccosmicscandidate.cc:359
 hmdccosmicscandidate.cc:360
 hmdccosmicscandidate.cc:361
 hmdccosmicscandidate.cc:362
 hmdccosmicscandidate.cc:363
 hmdccosmicscandidate.cc:364
 hmdccosmicscandidate.cc:365
 hmdccosmicscandidate.cc:366
 hmdccosmicscandidate.cc:367
 hmdccosmicscandidate.cc:368
 hmdccosmicscandidate.cc:369
 hmdccosmicscandidate.cc:370
 hmdccosmicscandidate.cc:371
 hmdccosmicscandidate.cc:372
 hmdccosmicscandidate.cc:373
 hmdccosmicscandidate.cc:374
 hmdccosmicscandidate.cc:375
 hmdccosmicscandidate.cc:376
 hmdccosmicscandidate.cc:377
 hmdccosmicscandidate.cc:378
 hmdccosmicscandidate.cc:379
 hmdccosmicscandidate.cc:380
 hmdccosmicscandidate.cc:381
 hmdccosmicscandidate.cc:382
 hmdccosmicscandidate.cc:383
 hmdccosmicscandidate.cc:384
 hmdccosmicscandidate.cc:385
 hmdccosmicscandidate.cc:386
 hmdccosmicscandidate.cc:387
 hmdccosmicscandidate.cc:388
 hmdccosmicscandidate.cc:389
 hmdccosmicscandidate.cc:390
 hmdccosmicscandidate.cc:391
 hmdccosmicscandidate.cc:392
 hmdccosmicscandidate.cc:393
 hmdccosmicscandidate.cc:394
 hmdccosmicscandidate.cc:395
 hmdccosmicscandidate.cc:396
 hmdccosmicscandidate.cc:397
 hmdccosmicscandidate.cc:398
 hmdccosmicscandidate.cc:399
 hmdccosmicscandidate.cc:400
 hmdccosmicscandidate.cc:401
 hmdccosmicscandidate.cc:402
 hmdccosmicscandidate.cc:403
 hmdccosmicscandidate.cc:404
 hmdccosmicscandidate.cc:405
 hmdccosmicscandidate.cc:406
 hmdccosmicscandidate.cc:407
 hmdccosmicscandidate.cc:408
 hmdccosmicscandidate.cc:409
 hmdccosmicscandidate.cc:410
 hmdccosmicscandidate.cc:411
 hmdccosmicscandidate.cc:412
 hmdccosmicscandidate.cc:413
 hmdccosmicscandidate.cc:414
 hmdccosmicscandidate.cc:415
 hmdccosmicscandidate.cc:416
 hmdccosmicscandidate.cc:417
 hmdccosmicscandidate.cc:418
 hmdccosmicscandidate.cc:419
 hmdccosmicscandidate.cc:420
 hmdccosmicscandidate.cc:421
 hmdccosmicscandidate.cc:422
 hmdccosmicscandidate.cc:423
 hmdccosmicscandidate.cc:424
 hmdccosmicscandidate.cc:425
 hmdccosmicscandidate.cc:426
 hmdccosmicscandidate.cc:427
 hmdccosmicscandidate.cc:428
 hmdccosmicscandidate.cc:429
 hmdccosmicscandidate.cc:430
 hmdccosmicscandidate.cc:431
 hmdccosmicscandidate.cc:432
 hmdccosmicscandidate.cc:433
 hmdccosmicscandidate.cc:434
 hmdccosmicscandidate.cc:435
 hmdccosmicscandidate.cc:436
 hmdccosmicscandidate.cc:437
 hmdccosmicscandidate.cc:438
 hmdccosmicscandidate.cc:439
 hmdccosmicscandidate.cc:440
 hmdccosmicscandidate.cc:441
 hmdccosmicscandidate.cc:442
 hmdccosmicscandidate.cc:443
 hmdccosmicscandidate.cc:444
 hmdccosmicscandidate.cc:445
 hmdccosmicscandidate.cc:446
 hmdccosmicscandidate.cc:447
 hmdccosmicscandidate.cc:448
 hmdccosmicscandidate.cc:449
 hmdccosmicscandidate.cc:450
 hmdccosmicscandidate.cc:451
 hmdccosmicscandidate.cc:452
 hmdccosmicscandidate.cc:453
 hmdccosmicscandidate.cc:454
 hmdccosmicscandidate.cc:455
 hmdccosmicscandidate.cc:456
 hmdccosmicscandidate.cc:457
 hmdccosmicscandidate.cc:458
 hmdccosmicscandidate.cc:459
 hmdccosmicscandidate.cc:460
 hmdccosmicscandidate.cc:461
 hmdccosmicscandidate.cc:462
 hmdccosmicscandidate.cc:463
 hmdccosmicscandidate.cc:464
 hmdccosmicscandidate.cc:465
 hmdccosmicscandidate.cc:466
 hmdccosmicscandidate.cc:467
 hmdccosmicscandidate.cc:468
 hmdccosmicscandidate.cc:469
 hmdccosmicscandidate.cc:470
 hmdccosmicscandidate.cc:471
 hmdccosmicscandidate.cc:472
 hmdccosmicscandidate.cc:473
 hmdccosmicscandidate.cc:474
 hmdccosmicscandidate.cc:475
 hmdccosmicscandidate.cc:476
 hmdccosmicscandidate.cc:477
 hmdccosmicscandidate.cc:478
 hmdccosmicscandidate.cc:479
 hmdccosmicscandidate.cc:480
 hmdccosmicscandidate.cc:481
 hmdccosmicscandidate.cc:482
 hmdccosmicscandidate.cc:483
 hmdccosmicscandidate.cc:484
 hmdccosmicscandidate.cc:485
 hmdccosmicscandidate.cc:486
 hmdccosmicscandidate.cc:487
 hmdccosmicscandidate.cc:488
 hmdccosmicscandidate.cc:489
 hmdccosmicscandidate.cc:490
 hmdccosmicscandidate.cc:491
 hmdccosmicscandidate.cc:492
 hmdccosmicscandidate.cc:493
 hmdccosmicscandidate.cc:494
 hmdccosmicscandidate.cc:495
 hmdccosmicscandidate.cc:496
 hmdccosmicscandidate.cc:497
 hmdccosmicscandidate.cc:498
 hmdccosmicscandidate.cc:499
 hmdccosmicscandidate.cc:500
 hmdccosmicscandidate.cc:501
 hmdccosmicscandidate.cc:502
 hmdccosmicscandidate.cc:503
 hmdccosmicscandidate.cc:504
 hmdccosmicscandidate.cc:505
 hmdccosmicscandidate.cc:506
 hmdccosmicscandidate.cc:507
 hmdccosmicscandidate.cc:508
 hmdccosmicscandidate.cc:509
 hmdccosmicscandidate.cc:510
 hmdccosmicscandidate.cc:511
 hmdccosmicscandidate.cc:512
 hmdccosmicscandidate.cc:513
 hmdccosmicscandidate.cc:514
 hmdccosmicscandidate.cc:515
 hmdccosmicscandidate.cc:516
 hmdccosmicscandidate.cc:517
 hmdccosmicscandidate.cc:518
 hmdccosmicscandidate.cc:519
 hmdccosmicscandidate.cc:520
 hmdccosmicscandidate.cc:521
 hmdccosmicscandidate.cc:522
 hmdccosmicscandidate.cc:523
 hmdccosmicscandidate.cc:524
 hmdccosmicscandidate.cc:525
 hmdccosmicscandidate.cc:526
 hmdccosmicscandidate.cc:527
 hmdccosmicscandidate.cc:528
 hmdccosmicscandidate.cc:529
 hmdccosmicscandidate.cc:530
 hmdccosmicscandidate.cc:531
 hmdccosmicscandidate.cc:532
 hmdccosmicscandidate.cc:533
 hmdccosmicscandidate.cc:534
 hmdccosmicscandidate.cc:535
 hmdccosmicscandidate.cc:536
 hmdccosmicscandidate.cc:537
 hmdccosmicscandidate.cc:538
 hmdccosmicscandidate.cc:539
 hmdccosmicscandidate.cc:540
 hmdccosmicscandidate.cc:541
 hmdccosmicscandidate.cc:542
 hmdccosmicscandidate.cc:543
 hmdccosmicscandidate.cc:544
 hmdccosmicscandidate.cc:545
 hmdccosmicscandidate.cc:546
 hmdccosmicscandidate.cc:547
 hmdccosmicscandidate.cc:548
 hmdccosmicscandidate.cc:549
 hmdccosmicscandidate.cc:550
 hmdccosmicscandidate.cc:551
 hmdccosmicscandidate.cc:552
 hmdccosmicscandidate.cc:553
 hmdccosmicscandidate.cc:554
 hmdccosmicscandidate.cc:555
 hmdccosmicscandidate.cc:556
 hmdccosmicscandidate.cc:557
 hmdccosmicscandidate.cc:558
 hmdccosmicscandidate.cc:559
 hmdccosmicscandidate.cc:560
 hmdccosmicscandidate.cc:561
 hmdccosmicscandidate.cc:562
 hmdccosmicscandidate.cc:563
 hmdccosmicscandidate.cc:564
 hmdccosmicscandidate.cc:565
 hmdccosmicscandidate.cc:566
 hmdccosmicscandidate.cc:567
 hmdccosmicscandidate.cc:568
 hmdccosmicscandidate.cc:569
 hmdccosmicscandidate.cc:570
 hmdccosmicscandidate.cc:571
 hmdccosmicscandidate.cc:572
 hmdccosmicscandidate.cc:573
 hmdccosmicscandidate.cc:574
 hmdccosmicscandidate.cc:575
 hmdccosmicscandidate.cc:576
 hmdccosmicscandidate.cc:577
 hmdccosmicscandidate.cc:578
 hmdccosmicscandidate.cc:579
 hmdccosmicscandidate.cc:580
 hmdccosmicscandidate.cc:581
 hmdccosmicscandidate.cc:582
 hmdccosmicscandidate.cc:583
 hmdccosmicscandidate.cc:584
 hmdccosmicscandidate.cc:585
 hmdccosmicscandidate.cc:586
 hmdccosmicscandidate.cc:587
 hmdccosmicscandidate.cc:588
 hmdccosmicscandidate.cc:589
 hmdccosmicscandidate.cc:590
 hmdccosmicscandidate.cc:591
 hmdccosmicscandidate.cc:592
 hmdccosmicscandidate.cc:593
 hmdccosmicscandidate.cc:594
 hmdccosmicscandidate.cc:595
 hmdccosmicscandidate.cc:596
 hmdccosmicscandidate.cc:597
 hmdccosmicscandidate.cc:598
 hmdccosmicscandidate.cc:599
 hmdccosmicscandidate.cc:600
 hmdccosmicscandidate.cc:601
 hmdccosmicscandidate.cc:602
 hmdccosmicscandidate.cc:603
 hmdccosmicscandidate.cc:604
 hmdccosmicscandidate.cc:605
 hmdccosmicscandidate.cc:606
 hmdccosmicscandidate.cc:607
 hmdccosmicscandidate.cc:608
 hmdccosmicscandidate.cc:609
 hmdccosmicscandidate.cc:610
 hmdccosmicscandidate.cc:611
 hmdccosmicscandidate.cc:612
 hmdccosmicscandidate.cc:613
 hmdccosmicscandidate.cc:614
 hmdccosmicscandidate.cc:615
 hmdccosmicscandidate.cc:616
 hmdccosmicscandidate.cc:617
 hmdccosmicscandidate.cc:618
 hmdccosmicscandidate.cc:619
 hmdccosmicscandidate.cc:620
 hmdccosmicscandidate.cc:621
 hmdccosmicscandidate.cc:622
 hmdccosmicscandidate.cc:623
 hmdccosmicscandidate.cc:624
 hmdccosmicscandidate.cc:625
 hmdccosmicscandidate.cc:626
 hmdccosmicscandidate.cc:627
 hmdccosmicscandidate.cc:628
 hmdccosmicscandidate.cc:629
 hmdccosmicscandidate.cc:630
 hmdccosmicscandidate.cc:631
 hmdccosmicscandidate.cc:632
 hmdccosmicscandidate.cc:633
 hmdccosmicscandidate.cc:634
 hmdccosmicscandidate.cc:635
 hmdccosmicscandidate.cc:636
 hmdccosmicscandidate.cc:637
 hmdccosmicscandidate.cc:638
 hmdccosmicscandidate.cc:639
 hmdccosmicscandidate.cc:640
 hmdccosmicscandidate.cc:641
 hmdccosmicscandidate.cc:642
 hmdccosmicscandidate.cc:643
 hmdccosmicscandidate.cc:644
 hmdccosmicscandidate.cc:645
 hmdccosmicscandidate.cc:646
 hmdccosmicscandidate.cc:647
 hmdccosmicscandidate.cc:648
 hmdccosmicscandidate.cc:649
 hmdccosmicscandidate.cc:650
 hmdccosmicscandidate.cc:651
 hmdccosmicscandidate.cc:652
 hmdccosmicscandidate.cc:653
 hmdccosmicscandidate.cc:654
 hmdccosmicscandidate.cc:655
 hmdccosmicscandidate.cc:656
 hmdccosmicscandidate.cc:657
 hmdccosmicscandidate.cc:658
 hmdccosmicscandidate.cc:659
 hmdccosmicscandidate.cc:660
 hmdccosmicscandidate.cc:661
 hmdccosmicscandidate.cc:662
 hmdccosmicscandidate.cc:663
 hmdccosmicscandidate.cc:664
 hmdccosmicscandidate.cc:665
 hmdccosmicscandidate.cc:666
 hmdccosmicscandidate.cc:667
 hmdccosmicscandidate.cc:668
 hmdccosmicscandidate.cc:669
 hmdccosmicscandidate.cc:670
 hmdccosmicscandidate.cc:671
 hmdccosmicscandidate.cc:672
 hmdccosmicscandidate.cc:673
 hmdccosmicscandidate.cc:674
 hmdccosmicscandidate.cc:675
 hmdccosmicscandidate.cc:676
 hmdccosmicscandidate.cc:677
 hmdccosmicscandidate.cc:678
 hmdccosmicscandidate.cc:679
 hmdccosmicscandidate.cc:680
 hmdccosmicscandidate.cc:681
 hmdccosmicscandidate.cc:682
 hmdccosmicscandidate.cc:683
 hmdccosmicscandidate.cc:684
 hmdccosmicscandidate.cc:685
 hmdccosmicscandidate.cc:686
 hmdccosmicscandidate.cc:687
 hmdccosmicscandidate.cc:688
 hmdccosmicscandidate.cc:689
 hmdccosmicscandidate.cc:690
 hmdccosmicscandidate.cc:691