Back to index

padfuncs.C

 
#include "padfuncs.h" 
#include "recoConsts.h" 
 
void setup_pad() 
{ 
  size_t mr, nrc; 
  PHNodeIterator mainIter(topNode); 
 
  PHCompositeNode* padNode = new PHCompositeNode("PAD"); 
  topNode->addNode(padNode); 
   
  PadEvtToRaw  =  new padEvtToRaw(); 
  //rmDS  PadCalibration = new PadCalibrationObject(); 
  PadInclBad = new padInclBad(); 
  mPadDetGeo = new PHpadDetectorGeo(); 
  Pc1Rec = new PadRecModule(); 
  Pc2Rec = new PadRecModule(); 
  Pc3Rec = new PadRecModule(); 
   
  //rmPN 
  //mr=1; 
  //dPadRecParWrapper* dPadRecPar = new dPadRecParWrapper("dPadRecPar",mr); 
  //PHIODataNode<PHTable>* dPadRecParNode = new PHIODataNode<PHTable>(dPadRecPar,"dPadRecPar"); 
  //parNode->addNode(dPadRecParNode); 
  //rmPN 
     
  //rmDS   
  //PHIODataNode<PHTable>* dPadFEMParNode = (PHIODataNode<PHTable>*)mainIter.findFirst("PHIODataNode","dPadFEMPar"); 
  //if (!dPadFEMParNode) { 
  //cout << "Par Read: Could not find data node dPadFEMPar" << endl; 
  //} else { 
  //dPadFEMParWrapper* dPadFEMPar = (dPadFEMParWrapper*)dPadFEMParNode->getData(); 
  //} 
  //rmDS 
 
  //SCJ 
  mr = 1; 
  //dPad23ParWrapper* dPad23Par = new dPad23ParWrapper("dPad23Par",mr); 
  //PHIODataNode<PHTable>* dPad23ParNode = new PHIODataNode<PHTable>(dPad23Par,"dPad23Par"); 
  //parNode->addNode(dPad23ParNode); 
 
  //SCJ 
  //mr = 1; 
  //dPadGeomWrapper* dPadGeom = new dPadGeomWrapper("dPadGeom",mr); 
  //PHIODataNode<PHTable>* dPadGeomNode = new PHIODataNode<PHTable>(dPadGeom,"dPadGeom"); 
  //parNode->addNode(dPadGeomNode); 
  //SCJ 
 
  mr=60000; 
  dPadRawWrapper* dPc1Raw = new dPadRawWrapper("dPc1Raw",mr); 
  PHIODataNode<PHTable>* dPc1RawNode = new PHIODataNode<PHTable>(dPc1Raw,"dPc1Raw"); 
  dstNode->addNode(dPc1RawNode); 
 
  mr=60000; 
  dPadRawWrapper* dPc2Raw = new dPadRawWrapper("dPc2Raw",mr); 
  PHIODataNode<PHTable>* dPc2RawNode = new PHIODataNode<PHTable>(dPc2Raw,"dPc2Raw"); 
  dstNode->addNode(dPc2RawNode); 
 
  mr=60000; 
  dPadRawWrapper* dPc3Raw = new dPadRawWrapper("dPc3Raw",mr); 
  PHIODataNode<PHTable>* dPc3RawNode = new PHIODataNode<PHTable>(dPc3Raw,"dPc3Raw"); 
  dstNode->addNode(dPc3RawNode); 
 
  mr=60000; 
  dPadClusterWrapper* dPc1Cluster = new dPadClusterWrapper("dPc1Cluster",mr); 
  PHIODataNode<PHTable>* dPc1ClusterNode = new PHIODataNode<PHTable>(dPc1Cluster,"dPc1Cluster"); 
  dstNode->addNode(dPc1ClusterNode); 
 
  mr=60000; 
  dPadClusterWrapper* dPc2Cluster = new dPadClusterWrapper("dPc2Cluster",mr); 
  PHIODataNode<PHTable>* dPc2ClusterNode = new PHIODataNode<PHTable>(dPc2Cluster,"dPc2Cluster"); 
  dstNode->addNode(dPc2ClusterNode); 
 
  mr=60000; 
  dPadClusterWrapper* dPc3Cluster = new dPadClusterWrapper("dPc3Cluster",mr); 
  PHIODataNode<PHTable>* dPc3ClusterNode = new PHIODataNode<PHTable>(dPc3Cluster,"dPc3Cluster"); 
  dstNode->addNode(dPc3ClusterNode); 
 
 
  mr=60000; 
  dPadRawClusWrapper* dPc1RawClus = new dPadRawClusWrapper("dPc1RawClus",mr); 
  PHIODataNode<PHTable>* dPc1RawClusNode = new PHIODataNode<PHTable>(dPc1RawClus,"dPc1RawClus"); 
  padNode->addNode(dPc1RawClusNode); 
 
  mr=60000; 
  dPadRawClusWrapper* dPc2RawClus = new dPadRawClusWrapper("dPc2RawClus",mr); 
  PHIODataNode<PHTable>* dPc2RawClusNode = new PHIODataNode<PHTable>(dPc2RawClus,"dPc2RawClus"); 
  padNode->addNode(dPc2RawClusNode); 
 
  mr=60000; 
  dPadRawClusWrapper* dPc3RawClus = new dPadRawClusWrapper("dPc3RawClus",mr); 
  PHIODataNode<PHTable>* dPc3RawClusNode = new PHIODataNode<PHTable>(dPc3RawClus,"dPc3RawClus"); 
  padNode->addNode(dPc3RawClusNode); 
 
  //SCJ 
  // Setting dPad23Par Parameters 
  //nrc=1; 
  //dPad23Par->SetRowCount(nrc); 
  //dPad23Par->set_idatePC23(0,19981225); 
 
  //rmPN 
  // Setting dPadGeom Parameters 
  //nrc=1; 
  //dPadGeom->SetRowCount(nrc); 
  //dPadGeom->set_pdxoff(0,0,-24.31); 
  //dPadGeom->set_pdxoff(1,0,-81.2); 
  //dPadGeom->set_pdxoff(2,0,-95.7); 
  //dPadGeom->set_pdzoff(0,0,-89.5575); 
  //dPadGeom->set_pdzoff(1,0,-152.475); 
  //dPadGeom->set_pdzoff(2,0,-178.69); 
  //dPadGeom->set_pdgas(0,0,0.60); 
  //dPadGeom->set_pdgas(1,0,1.00); 
  //dPadGeom->set_pdgas(2,0,1.20); 
  //dPadGeom->set_aasep(0,0,0.84); 
  //dPadGeom->set_aasep(1,0,1.40); 
  //dPadGeom->set_aasep(2,0,1.65); 
  //dPadGeom->set_pxlen(0,0,0.82); 
  //dPadGeom->set_pxlen(1,0,1.375); 
  //dPadGeom->set_pxlen(2,0,1.622); 
  //dPadGeom->set_wside(0,0,0.27); 
  //dPadGeom->set_wside(1,0,0.47); 
  //dPadGeom->set_wside(2,0,0.55); 
  //dPadGeom->set_wcent(0,0,0.15); 
  //dPadGeom->set_wcent(1,0,0.26); 
  //dPadGeom->set_wcent(2,0,0.31); 
  //dPadGeom->set_pxsep(0,0,0.025); 
  //dPadGeom->set_pxsep(1,0,0.025); 
  //dPadGeom->set_pxsep(2,0,0.025); 
  //dPadGeom->set_clsep(0,0,0.1); 
  //dPadGeom->set_clsep(1,0,0.15); 
  //dPadGeom->set_clsep(2,0,0.2); 
  //dPadGeom->set_npdsec(0,0,16); 
  //dPadGeom->set_npdsec(1,0,8); 
  //dPadGeom->set_npdsec(2,0,8); 
  //dPadGeom->set_npdwr(0,0,58); 
  //dPadGeom->set_npdwr(1,0,116); 
  //dPadGeom->set_npdwr(2,0,116); 
  //dPadGeom->set_npdx(0,0,20); 
  //dPadGeom->set_npdx(1,0,40); 
  //dPadGeom->set_npdx(2,0,40); 
  //dPadGeom->set_npdz(0,0,216); 
  //dPadGeom->set_npdz(1,0,216); 
  //dPadGeom->set_npdz(2,0,216); 
  //dPadGeom->set_sectperarm(0,0,8); 
  //dPadGeom->set_sectperarm(1,0,4); 
  //dPadGeom->set_sectperarm(2,0,4); 
  //dPadGeom->set_inradius(0,0,248.891); 
  //dPadGeom->set_inradius(1,0,419.173); 
  //dPadGeom->set_inradius(2,0,492.012); 
  //dPadGeom->set_zgap(0,0,0.0); 
  //dPadGeom->set_zgap(1,0,8.106); 
  //dPadGeom->set_zgap(2,0,8.106); 
  //dPadGeom->set_phibote(0,213.75); 
  //dPadGeom->set_phitope(0,123.75); 
  //dPadGeom->set_phibotw(0,-33.75); 
  //dPadGeom->set_phitopw(0,56.25); 
  //rmPN 
 
 
  PHIODataNode<TObject>* mPadDetGeoNode = new PHIODataNode<TObject>(mPadDetGeo,"mPadDetGeo"); 
  parNode->addNode(mPadDetGeoNode); 
 
  // Setting padEvtToRaw parameters 
  PadEvtToRaw->setDebugLevel(0); 
 
  // Setting padInclBad parameters 
  PadInclBad->setDebugLevel(0); 
  PadInclBad->doNotInclBadChs(); 
  PadInclBad->doInclBadROCs(); 
  PadInclBad->RemoveHotROCs(); 
  PadInclBad->RemoveUnSynchROCs(); 
  PadInclBad->doNotAddHotROCs(); 
  PadInclBad->doNotAddInactiveROCs(); 
  PadInclBad->doNotAddUnSynchROCs(); 
 
  //rmPN 
  // Setting dPadRecPar Parameters 
  //nrc=1; 
  //dPadRecPar->SetRowCount(nrc); 
  //dPadRecPar->set_verbose(0,0); 
  //dPadRecPar->set_method(0,0,0); 
  //dPadRecPar->set_method(1,0,0); 
  //dPadRecPar->set_method(2,0,0); 
  //rmPN 
 
  // Setting mPadDetGeo Parameters 
  double pc1Radius = 248.891; 
  double pc2Radius = 419.173; 
  double pc3Radius = 492.012; 
  double ThetaArm[2] = { -0.589049, 2.15984}; 
  mPadDetGeo->set_pc1Radius(pc1Radius); 
  mPadDetGeo->set_pc2Radius(pc2Radius); 
  mPadDetGeo->set_pc3Radius(pc3Radius); 
  mPadDetGeo->set_Theta0(ThetaArm); 
 
  // Setting PadRecModule parameters 
  short level = 0;              // Debug level 0: no debug information 
  Pc1Rec->setDebugLevel(level); // Debug level 1: print method calls 
  Pc2Rec->setDebugLevel(level); // Debug level 2: show reconstruction 
                                //                statistics 
  Pc3Rec->setDebugLevel(level); // Debug level 3: show dPadCluster fillings 
                                // Debug level 4: Save hit information in a 
                                //                text file -> ./padrec.dat 
                                // Debug level 5: Save hit information for 
                                //                Birdseye event display 
                                //                -> ./birdseye.dat 
  short padmode = 1; 
  Pc1Rec->setSplitMode(padmode); // Split mode 0: Do not split large clusters 
  Pc2Rec->setSplitMode(padmode); // Split mode 1: Split large clusters 
  Pc3Rec->setSplitMode(padmode); 
 
  // The maximum allowed cluster size (number of cells) 
  short splitMax = 100; 
  Pc1Rec->setSplitMax(splitMax); 
  Pc2Rec->setSplitMax(splitMax); 
  Pc3Rec->setSplitMax(splitMax); 
 
  short limit = 2; // Demand two (default) out of three good pads per cell 
  Pc1Rec->setPadTypeLimit(limit); 
  Pc2Rec->setPadTypeLimit(limit); 
  Pc3Rec->setPadTypeLimit(limit); 
 
  // The idea behind the reconstruction code is to place an imaginative box 
  // around each cluster and to measure its size. These values set the maximum 
  // size of the box that covers the cluster created by a single particle. 
  short oneW = 4; // Box height 
  short oneZ = 4; // Box width 
  short oneL = 11; // Maximum number of allowed cells within a one particle box 
  short twoW = 8; 
  short twoZ = 8; 
  short twoL = 16; 
  short threeW = 100; 
  short threeZ = 100; 
  short threeL = 100; 
  Pc1Rec->setClusterSizes(oneW, oneZ, oneL, twoW, twoZ, twoL, threeW, threeZ, threeL); 
  Pc2Rec->setClusterSizes(oneW, oneZ, oneL, twoW, twoZ, twoL, threeW, threeZ, threeL); 
  Pc3Rec->setClusterSizes(oneW, oneZ, oneL, twoW, twoZ, twoL, threeW, threeZ, threeL); 
 
 
  mPadDetGeo->FetchFromDatabase(TimeStamp);  // reading from db 
  //  mPadDetGeo->FetchFromFile(); 
//    // added  this for db commit ...Julia Velkovska ------------------- 
//     mPadDetGeo->FetchFromFileDBFormat("padGeometry.adb"); 
//     PHVector uE(0.999999,0.00138,0.0); 
//     PHVector vE(-0.00138,0.999999,0.0); 
//     PHPoint originE(-1.361,-1.132,-0.05); 
//     PHFrame padEAST(originE,uE,vE); 
//     mPadDetGeo->set_eastFrame(padEAST); 
//     PHVector uW(0.999998,-0.00188,0.0); 
//     PHVector vW(0.00188,0.999998,0.0); 
//     PHPoint originW(-0.061,-1.012,0); 
//     PHFrame padWEST(originW,uW,vW); 
//     mPadDetGeo->set_westFrame(padWEST); 
//     mPadDetGeo->rotateAndTranslate(); 
//     cout<< " before commit "<<endl; 
//     mPadDetGeo->PrintGeo(1,1); 
//     mPadDetGeo->PutIntoGeoChamDatabase(); 
//     mPadDetGeo->FetchFromDatabase(TimeStamp); 
//     cout<< " after commit read from db  "<<endl; 
//   mPadDetGeo->PrintGeo(1,1); 
 
  PHBoolean padInclStat = PadInclBad->FetchCalDataFromObjy(TimeStamp); 
 
  return; 
} 
 
void ana_pad() 
{ 
 
  int eventNumber = -1; 
 
  //rmDS PadGetDCM(topNode); 
 
  // 
  // New padEvtToRaw method for reading or mixing PRDFs 
  // 
  // PHBoolean event(PHCompositeNode* topNode, Event *evt, Event *evt2=0, 
  //                 short evtreal=1, short evt2real=1); 
  // 
  // where evtreal,evt2real= 0, when we are sending a simulated event 
  //               = 1, when we are sending a real event 
 
  if(simulationFlag == 1) 
    PadEvtToRaw->event(topNode, thisEvent, 0, 0); 
  else 
    PadEvtToRaw->event(topNode,thisEvent); 
   
  PadInclBad->event(topNode); 
 
  //PN   
  Pc1Rec->event(0,mPadDetGeo,topNode); 
  Pc2Rec->event(1,mPadDetGeo,topNode); 
  Pc3Rec->event(2,mPadDetGeo,topNode); 
  //PN 
 
  return; 
} 

Back to index