ParticleAna Class Reference

#include <ParticleAna.h>

Inheritance diagram for ParticleAna:
JobCModule

List of all members.

Public Member Functions

 ParticleAna ()
 ~ParticleAna ()
void BeginJob ()
void EndJob ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Reset ()
void FillPot (ParticleBeamMon *bmon)

Private Attributes

std::string kPOTTreeName
int lastrun
int DoMRCC
std::string outObjectName

Detailed Description

Id
ParticleAna.h,v 1.1 2009/06/19 14:32:37 scavan Exp

(Document me!)

scavan@fas.harvard.edu

Definition at line 23 of file ParticleAna.h.


Constructor & Destructor Documentation

ParticleAna::ParticleAna (  ) 

(Document me!)

Definition at line 40 of file ParticleAna.cxx.

References DoMRCC, lastrun, and outObjectName.

00041 {
00042 
00043         lastrun=-1;
00044 DoMRCC=0;
00045 outObjectName="normal";
00046 //      pot = new POT();
00047   //if(!skzpCalc)skzpCalc=new SKZPWeightCalculator("DetXs",true);
00048         
00052 }

ParticleAna::~ParticleAna (  ) 

(Document me!)

Definition at line 55 of file ParticleAna.cxx.

00056 {
00060 
00061 
00062 //  if(pot)delete pot;
00063 //  pot=0;
00064   
00065   //we can reususe it!
00066   //if(skzpCalc)delete skzpCalc;
00067   //skzpCalc=0;
00068 
00069 }


Member Function Documentation

void ParticleAna::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

(Document me!)

Reimplemented from JobCModule.

Definition at line 73 of file ParticleAna.cxx.

00074 {
00078 }

void ParticleAna::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Configure the module given the Registry r

Reimplemented from JobCModule.

Definition at line 219 of file ParticleAna.cxx.

References DoMRCC, Registry::Get(), and outObjectName.

00220 {
00224   
00225  
00226     const char* tmps;
00227     int tmpi;
00228  //   if(r.Get("POTTreeFileName",tmps)){kPOTTreeName=tmps;}
00229     if(r.Get("DoMRCC",tmpi)){DoMRCC=tmpi;}
00230     if(r.Get("OutObjectName",tmps)){outObjectName=tmps;}
00231 }

const Registry & ParticleAna::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Supply the default configuration for the module

Reimplemented from JobCModule.

Definition at line 194 of file ParticleAna.cxx.

References JobCModule::GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00195 {
00199   static Registry r; // Default configuration for module
00200 
00201   // Set name of config
00202   std::string name = this->GetName();
00203   name += ".config.default";
00204   r.SetName(name.c_str());
00205 
00206   // Set values in configuration
00207   r.UnLockValues();
00208   //r.Set("POTTreeFileName","pottree.root");
00209   r.Set("DoMRCC",0);
00210   r.Set("OutObjectName","Normal");
00211   r.LockValues();
00212 
00213 
00214   return r;
00215 }

void ParticleAna::EndJob (  )  [virtual]

Implement for notification of end of job

(Document me!)

Reimplemented from JobCModule.

Definition at line 82 of file ParticleAna.cxx.

00083 {
00087 
00088 /*   MSG("ParticleAna",Msg::kInfo)<<"Number of POT in this job: "<<pot->pot<<endl;
00089         
00090    TDirectory *savedir = gDirectory;
00091         
00092    TFile *fpf = dynamic_cast<TFile *>(gROOT->GetListOfFiles()->FindObject(kPOTTreeName.c_str()));
00093    if(fpf){
00094      fpf->cd();
00095      TTree *pottree = new TTree("pottree","pottree");
00096      pottree->Branch("ParticlePOT",&pot);
00097      pottree->Fill();
00098      pottree->Write();
00099      savedir->cd();
00100    }
00101    else{
00102      MSG("ParticleAna",Msg::kError)<<"Could not find the file to write the pottree to("<<kPOTTreeName<<"), there will be no pottree"<<endl;
00103    }
00104 */
00105 
00106 
00107 }

void ParticleAna::FillPot ( ParticleBeamMon bmon  ) 

Definition at line 245 of file ParticleAna.cxx.

References RecRecordImp< T >::GetHeader(), RecDataHeader::GetRun(), RecHeader::GetVldContext(), and lastrun.

00246 {
00247                 //int ismc=bmon->GetHeader().GetVldContext().GetSimFlag() == SimFlag::kMC;
00248                 VldContext evt_vldc = bmon->GetHeader().GetVldContext();
00249 
00250 
00251 
00252 /*
00253                 if(!ismc)
00254                 {
00255                         pot->pot+=bmon->GetPot();
00256                 }else{
00257                 
00258                         std::string relName = bmon->GetTitle();
00259 
00260                         std::string mcinfo = "";
00261                         if(bmon->GetHeader().GetVldContext().GetSimFlag() == SimFlag::kMC){
00262                         mcinfo = "Carrot";
00263         //              string temp = mchdr.geninfo.codename;
00264         //              if(temp.size() != 0){   mcinfo = temp;  }
00265                         }
00266                                         
00267                         ReleaseType::Release_t rel = ReleaseType::MakeReleaseType(relName, mcinfo);
00268                 
00269                         
00270                         //near for every snarl
00271                         if(evt_vldc.GetDetector()==Detector::kNear){
00272               pot->pot+=MCInfo::GetMCPoT(Detector::kNear, bmon->beamtype, rel);
00273               
00274       //        printf("near %d %d\n",bmon->beamtype,rel);
00275             }
00276                         
00277                         //far only once per run
00278                         if(evt_vldc.GetDetector()==Detector::kFar && 
00279                 bmon->GetHeader().GetRun()!=lastrun){
00280                         pot->pot+=MCInfo::GetMCPoT(Detector::kFar, bmon->beamtype, rel);
00281                 }
00282    
00283                 }
00284                 
00285                 / *
00286          / *    
00287                 pot->nsnarls++;
00288                 if(bmon->GetHeader().GetRun()!=lastrun)
00289                 {
00290                         pot->nruns++;
00291                         
00292 
00293 
00294                         pot->beamtype = bmon->beamtype;
00295                         
00296                         
00297                         
00298                 }
00299                 
00300         */      
00301                 lastrun=bmon->GetHeader().GetRun();
00302                 
00303 
00304 }

JobCResult ParticleAna::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

(Document me!)

Reimplemented from JobCModule.

Definition at line 111 of file ParticleAna.cxx.

References MomNavigator::AdoptFragment(), PRecordAna::ana(), RecDataHeader::GetErrorCode(), RecCandHeader::GetEvent(), MomNavigator::GetFragmentList(), RecRecordImp< T >::GetHeader(), RecPhysicsHeader::GetRemoteSpillType(), RecDataHeader::GetRun(), RecDataHeader::GetRunType(), RecPhysicsHeader::GetSnarl(), RecDataHeader::GetSubRun(), RecPhysicsHeader::GetTimeFrame(), RecPhysicsHeader::GetTrigSrc(), RecHeader::GetVldContext(), JobCResult::kPassed, n, and outObjectName.

00112 {
00116 
00117 //MSG("ParticleAna",Msg::kDebug) << "reco called\n";
00118 
00119   //std::vector<ParticleObjectHolder *>* hf;
00120   std::vector<TObject* > hft =( mom->GetFragmentList("ParticleObjectHolder",outObjectName.c_str()));
00121 
00122 
00123  
00124 //MSG("ParticleAna",Msg::kDebug) << "size of found array " << hft.size()<<endl; 
00125 
00126         ParticleBeamMon *bmon=0;
00127 
00128 for(unsigned int s =0;s<hft.size();s++)
00129 {
00130 
00131 
00132         ParticleObjectHolder *n=0;
00133         n=dynamic_cast<ParticleObjectHolder *>(hft[s]);
00134 
00135 
00136 //MSG("ParticleAna",Msg::kDebug) << &hft[s]<<"\n";
00137 
00138 //MSG("ParticleAna",Msg::kDebug) << "snarl "<<n->GetHeader().GetSnarl() <<"evt "<< n->GetHeader().GetEvent()<<"\n";
00139         
00140         RecCandHeader ntphdr(n->GetHeader().GetVldContext(),n->GetHeader().GetRun(),
00141                                         n->GetHeader().GetSubRun(),n->GetHeader().GetRunType(),n->GetHeader().GetErrorCode(),
00142                                         n->GetHeader().GetSnarl(),n->GetHeader().GetTrigSrc(),n->GetHeader().GetTimeFrame(),
00143                                         n->GetHeader().GetRemoteSpillType(),n->GetHeader().GetEvent());
00144 
00145 
00146         
00147         //get beam info
00148         if(s==0)
00149         {
00150         
00151                 RecCandHeader ntphdr(n->GetHeader().GetVldContext(),n->GetHeader().GetRun(),
00152                                         n->GetHeader().GetSubRun(),n->GetHeader().GetRunType(),n->GetHeader().GetErrorCode(),
00153                                         n->GetHeader().GetSnarl(),n->GetHeader().GetTrigSrc(),n->GetHeader().GetTimeFrame(),
00154                                         n->GetHeader().GetRemoteSpillType(),-1);
00155         
00156                 bmon = new ParticleBeamMon(ntphdr);
00157 
00158 /*      
00159                 ParticleBeamMonAna bma;
00160                 bma.ana(n,bmon);
00161                 
00162                 //FillPot(bmon);
00163                 mom->AdoptFragment(bmon);                       
00164  */     }
00165         
00166  //     if(!bmon)bmon=(ParticleBeamMon *)mom->GetFragment("ParticleBeamMon");
00167         
00168         
00169         
00170 
00171         
00172         PRecord * r = new PRecord(ntphdr);
00173 
00174 
00175         PRecordAna pra;
00176 
00177         
00178         pra.ana(n,r,bmon);
00179         r->SetName(outObjectName.c_str());
00180         mom->AdoptFragment(r);  
00181 
00182         delete bmon;
00183         bmon=0;
00184 }
00185 
00186                 
00187 
00188 
00189   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00190 }

void ParticleAna::Reset (  )  [virtual]

Implement to reset oneself

(Document me!)

Reimplemented from JobCModule.

Definition at line 235 of file ParticleAna.cxx.

00236 {
00240 }


Member Data Documentation

int ParticleAna::DoMRCC [private]

Definition at line 59 of file ParticleAna.h.

Referenced by Config(), and ParticleAna().

std::string ParticleAna::kPOTTreeName [private]

Definition at line 54 of file ParticleAna.h.

int ParticleAna::lastrun [private]

Definition at line 57 of file ParticleAna.h.

Referenced by FillPot(), and ParticleAna().

std::string ParticleAna::outObjectName [private]

Definition at line 60 of file ParticleAna.h.

Referenced by Config(), ParticleAna(), and Reco().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1