CMS 3D CMS Logo

CocoaDaqReaderRoot Class Reference

#include <Alignment/CocoaModel/interface/CocoaDaqReaderRoot.h>

Inheritance diagram for CocoaDaqReaderRoot:

CocoaDaqReader

List of all members.

Public Member Functions

virtual void BuildMeasurementsFromOptAlign (std::vector< OpticalAlignMeasurementInfo > &measList)
 CocoaDaqReaderRoot (const std::string &m_inFileName)
int GetNEvents () const
virtual bool ReadEvent (int nev)
virtual bool ReadNextEvent ()
 ~CocoaDaqReaderRoot ()

Private Member Functions

OpticalAlignMeasurementInfo GetMeasFromDist (AliDaqDistance *dist)
OpticalAlignMeasurementInfo GetMeasFromPosition2D (AliDaqPosition2D *pos2D)
OpticalAlignMeasurementInfo GetMeasFromPositionCOPS (AliDaqPositionCOPS *posCOPS)
OpticalAlignMeasurementInfo GetMeasFromTilt (AliDaqTilt *tilt)

Private Attributes

int nev
int nextEvent
CocoaDaqRootEventtheEvent
TFile * theFile
TTree * theTree


Detailed Description

Definition at line 13 of file CocoaDaqReaderRoot.h.


Constructor & Destructor Documentation

CocoaDaqReaderRoot::CocoaDaqReaderRoot ( const std::string &  m_inFileName  ) 

Definition at line 13 of file CocoaDaqReaderRoot.cc.

References nev, nextEvent, CocoaDaqReader::SetDaqReader(), theEvent, theFile, and theTree.

00014 {
00015 
00016   // Open root file
00017   theFile = new TFile(m_inFileName.c_str()); 
00018 
00019   // Read TTree named "CocoaDaq" in memory.  !! SHOULD BE CALLED Alignment_Cocoa
00020   theTree = (TTree*)theFile->Get("CocoaDaq");
00021 
00022   nev = theTree->GetEntries(); // number of entries in Tree
00023   //if ( ALIUtils::debug >= 2) std::cout << "CocoaDaqReaderRoot::CocoaDaqReaderRoot:  number of entries in Tree " << nev << std::endl;
00024  
00025   nextEvent = 0;
00026 
00027   // Event object must be created before setting the branch address
00028   theEvent = new CocoaDaqRootEvent();
00029 
00030   // link pointer to Tree branch
00031   theTree->SetBranchAddress("CocoaDaq", &theEvent);  //  !! SHOULD BE CALLED Alignment_Cocoa
00032 
00033   CocoaDaqReader::SetDaqReader( this );
00034 
00035 }

CocoaDaqReaderRoot::~CocoaDaqReaderRoot (  ) 

Definition at line 38 of file CocoaDaqReaderRoot.cc.

References theFile.

00039 {
00040   theFile->Close();
00041 }


Member Function Documentation

void CocoaDaqReaderRoot::BuildMeasurementsFromOptAlign ( std::vector< OpticalAlignMeasurementInfo > &  measList  )  [virtual]

Reimplemented from CocoaDaqReader.

Definition at line 229 of file CocoaDaqReaderRoot.cc.

Referenced by ReadEvent().

00230 {
00231 
00232 }

OpticalAlignMeasurementInfo CocoaDaqReaderRoot::GetMeasFromDist ( AliDaqDistance dist  )  [private]

Definition at line 204 of file CocoaDaqReaderRoot.cc.

References OpticalAlignParam::error_, AliDaqDistance::GetDistance(), AliDaqDistance::GetDistanceError(), AliDaqDistance::GetID(), OpticalAlignMeasurementInfo::isSimulatedValue_, OpticalAlignParam::name_, OpticalAlignMeasurementInfo::name_, OpticalAlignMeasurementInfo::type_, OpticalAlignParam::value_, and OpticalAlignMeasurementInfo::values_.

Referenced by ReadEvent().

00205 {
00206   OpticalAlignMeasurementInfo meas;
00207   
00208   meas.type_ = "SENSOR2D";
00209   meas.name_ = dist->GetID();
00210   //-   std::vector<std::string> measObjectNames_;
00211   std::vector<bool> isSimu;
00212   for( size_t jj = 0; jj < 2; jj++ ){
00213     isSimu.push_back(false); 
00214   }
00215   meas.isSimulatedValue_ = isSimu; 
00216   std::vector<OpticalAlignParam> paramList;
00217   OpticalAlignParam oaParam;
00218   oaParam.name_ = "D:";
00219   oaParam.value_ = dist->GetDistance();
00220   oaParam.error_ = dist->GetDistanceError();
00221   paramList.push_back(oaParam);
00222 
00223   meas.values_ = paramList;
00224 
00225   return meas;
00226 
00227 }

OpticalAlignMeasurementInfo CocoaDaqReaderRoot::GetMeasFromPosition2D ( AliDaqPosition2D pos2D  )  [private]

Definition at line 99 of file CocoaDaqReaderRoot.cc.

References OpticalAlignParam::error_, AliDaqPosition2D::GetID(), AliDaqPosition2D::GetX(), AliDaqPosition2D::GetXerror(), AliDaqPosition2D::GetY(), AliDaqPosition2D::GetYerror(), OpticalAlignMeasurementInfo::isSimulatedValue_, OpticalAlignParam::name_, OpticalAlignMeasurementInfo::name_, OpticalAlignMeasurementInfo::type_, OpticalAlignParam::value_, and OpticalAlignMeasurementInfo::values_.

Referenced by ReadEvent().

00100 {
00101   OpticalAlignMeasurementInfo meas;
00102   
00103   meas.type_ = "SENSOR2D";
00104   meas.name_ = pos2D->GetID();
00105   //-   std::vector<std::string> measObjectNames_;
00106   std::vector<bool> isSimu;
00107   for( size_t jj = 0; jj < 2; jj++ ){
00108     isSimu.push_back(false); 
00109   }
00110   meas.isSimulatedValue_ = isSimu; 
00111   std::vector<OpticalAlignParam> paramList;
00112   OpticalAlignParam oaParam1;
00113   oaParam1.name_ = "H:";
00114   oaParam1.value_ = pos2D->GetX();
00115   oaParam1.error_ = pos2D->GetXerror();
00116   paramList.push_back(oaParam1);
00117   
00118   OpticalAlignParam oaParam2;
00119   oaParam2.name_ = "V:";
00120   oaParam2.value_ = pos2D->GetY();
00121   oaParam2.error_ = pos2D->GetYerror();
00122   paramList.push_back(oaParam2);
00123   
00124   meas.values_ = paramList;
00125 
00126   return meas;
00127 }

OpticalAlignMeasurementInfo CocoaDaqReaderRoot::GetMeasFromPositionCOPS ( AliDaqPositionCOPS posCOPS  )  [private]

Definition at line 131 of file CocoaDaqReaderRoot.cc.

References OpticalAlignParam::error_, AliDaqPositionCOPS::GetDown(), AliDaqPositionCOPS::GetDownError(), AliDaqPositionCOPS::GetID(), AliDaqPositionCOPS::GetLeft(), AliDaqPositionCOPS::GetLeftError(), AliDaqPositionCOPS::GetRight(), AliDaqPositionCOPS::GetRightError(), AliDaqPositionCOPS::GetUp(), AliDaqPositionCOPS::GetUpError(), OpticalAlignMeasurementInfo::isSimulatedValue_, OpticalAlignParam::name_, OpticalAlignMeasurementInfo::name_, OpticalAlignMeasurementInfo::type_, OpticalAlignParam::value_, and OpticalAlignMeasurementInfo::values_.

Referenced by ReadEvent().

00132 {
00133   OpticalAlignMeasurementInfo meas;
00134   
00135   meas.type_ = "COPS";
00136   meas.name_ = posCOPS->GetID();
00137   //-   std::vector<std::string> measObjectNames_;
00138   std::vector<bool> isSimu;
00139   for( size_t jj = 0; jj < 4; jj++ ){
00140     isSimu.push_back(false); 
00141   }
00142   meas.isSimulatedValue_ = isSimu; 
00143 
00144   std::vector<OpticalAlignParam> paramList;
00145   OpticalAlignParam oaParam1;
00146   oaParam1.name_ = "U:";
00147   oaParam1.value_ = posCOPS->GetUp();
00148   oaParam1.error_ = posCOPS->GetUpError();
00149   paramList.push_back(oaParam1);
00150 
00151   OpticalAlignParam oaParam2;
00152   oaParam2.name_ = "U:";
00153   oaParam2.value_ = posCOPS->GetDown();
00154   oaParam2.error_ = posCOPS->GetDownError();
00155   paramList.push_back(oaParam2);
00156 
00157   OpticalAlignParam oaParam3;
00158   oaParam3.name_ = "U:";
00159   oaParam3.value_ = posCOPS->GetRight();
00160   oaParam3.error_ = posCOPS->GetRightError();
00161   paramList.push_back(oaParam3);
00162 
00163   OpticalAlignParam oaParam4;
00164   oaParam4.name_ = "U:";
00165   oaParam4.value_ = posCOPS->GetLeft();
00166   oaParam4.error_ = posCOPS->GetLeftError();
00167   paramList.push_back(oaParam4);
00168   
00169   meas.values_ = paramList;
00170 
00171   return meas;
00172 
00173 }

OpticalAlignMeasurementInfo CocoaDaqReaderRoot::GetMeasFromTilt ( AliDaqTilt tilt  )  [private]

Definition at line 176 of file CocoaDaqReaderRoot.cc.

References OpticalAlignParam::error_, AliDaqTilt::GetID(), AliDaqTilt::GetTilt(), AliDaqTilt::GetTiltError(), OpticalAlignMeasurementInfo::isSimulatedValue_, OpticalAlignParam::name_, OpticalAlignMeasurementInfo::name_, OpticalAlignMeasurementInfo::type_, OpticalAlignParam::value_, and OpticalAlignMeasurementInfo::values_.

Referenced by ReadEvent().

00177 {
00178   OpticalAlignMeasurementInfo meas;
00179   
00180   meas.type_ = "SENSOR2D";
00181   meas.name_ = tilt->GetID();
00182   //-   std::vector<std::string> measObjectNames_;
00183   std::vector<bool> isSimu;
00184   for( size_t jj = 0; jj < 2; jj++ ){
00185     isSimu.push_back(false); 
00186   }
00187   meas.isSimulatedValue_ = isSimu; 
00188   std::vector<OpticalAlignParam> paramList;
00189   OpticalAlignParam oaParam;
00190   oaParam.name_ = "T:";
00191   oaParam.value_ = tilt->GetTilt();
00192   oaParam.error_ = tilt->GetTiltError();
00193   paramList.push_back(oaParam);
00194   
00195   meas.values_ = paramList;
00196 
00197 
00198   return meas;
00199 
00200 }

int CocoaDaqReaderRoot::GetNEvents (  )  const [inline]

Reimplemented from CocoaDaqReader.

Definition at line 22 of file CocoaDaqReaderRoot.h.

00022 { return nev; }

bool CocoaDaqReaderRoot::ReadEvent ( int  nev  )  [virtual]

Reimplemented from CocoaDaqReader.

Definition at line 51 of file CocoaDaqReaderRoot.cc.

References BuildMeasurementsFromOptAlign(), dist(), AliDaqPositionCOPS::DumpIt(), CocoaDaqRootEvent::DumpIt(), CocoaDaqRootEvent::GetArray_Dist(), CocoaDaqRootEvent::GetArray_Position2D(), CocoaDaqRootEvent::GetArray_PositionCOPS(), CocoaDaqRootEvent::GetArray_Tilt(), GetMeasFromDist(), GetMeasFromPosition2D(), GetMeasFromPositionCOPS(), GetMeasFromTilt(), CocoaDaqRootEvent::GetNumDist(), CocoaDaqRootEvent::GetNumPos2D(), CocoaDaqRootEvent::GetNumPosCOPS(), CocoaDaqRootEvent::GetNumTilt(), nextEvent, theEvent, and theTree.

Referenced by ReadNextEvent().

00052 {
00053   std::vector<OpticalAlignMeasurementInfo> measList;
00054 
00055   int nb  = 0;   // dummy, number of bytes
00056   // Loop over all events
00057   nb = theTree->GetEntry(nev);  // read in entire event
00058  
00059   //if ( ALIUtils::debug >= 2) std::cout << "CocoaDaqReaderRoot reading event " << nev << " " << nb << std::endl;
00060   if( nb == 0 ) return 0; //end of file reached??
00061 
00062   // Every n events, dump one to screen
00063   if(nev%1 == 0) theEvent->DumpIt();
00064   
00065   //if ( ALIUtils::debug >= 2) std::cout<<" CocoaDaqReaderRoot::ReadEvent "<< nev <<std::endl;
00066 
00067    //if ( ALIUtils::debug >= 2) std::cout<<" CocoaDaqReaderRoot::ReadEvent npos2D "<< theEvent->GetNumPos2D() << " nCOPS " << theEvent->GetNumPosCOPS() << std::endl;
00068   
00069   for(int ii=0; ii<theEvent->GetNumPos2D(); ii++) {
00070     AliDaqPosition2D* pos2D = (AliDaqPosition2D*) theEvent->GetArray_Position2D()->At(ii);
00071  //   std::cout<<"2D sensor "<<ii<<" has ID = "<<pos2D->GetID()
00072 //      <<" and (x,y) = ("<<pos2D->GetX()<<","<<pos2D->GetY()<<")"<<std::endl;
00073      measList.push_back( GetMeasFromPosition2D( pos2D ) );
00074   }
00075   for(int ii=0; ii<theEvent->GetNumPosCOPS(); ii++) {
00076     AliDaqPositionCOPS* posCOPS = (AliDaqPositionCOPS*) theEvent->GetArray_PositionCOPS()->At(ii);
00077      measList.push_back( GetMeasFromPositionCOPS( posCOPS ) );
00078      //if ( ALIUtils::debug >= 2) std::cout<<"COPS sensor "<<ii<<" has ID = "<<posCOPS->GetID()<< std::endl;
00079      posCOPS->DumpIt("COPS"); 
00080  }
00081   for(int ii=0; ii<theEvent->GetNumTilt(); ii++) {
00082     AliDaqTilt* tilt = (AliDaqTilt*) theEvent->GetArray_Tilt()->At(ii);
00083      measList.push_back( GetMeasFromTilt( tilt ) );
00084   }
00085   for(int ii=0; ii<theEvent->GetNumDist(); ii++) {
00086     AliDaqDistance* dist = (AliDaqDistance*) theEvent->GetArray_Dist()->At(ii);
00087      measList.push_back( GetMeasFromDist( dist ) );
00088   }
00089 
00090   nextEvent = nev + 1;
00091 
00092   BuildMeasurementsFromOptAlign( measList );
00093 
00094   return 1;
00095 
00096 }

bool CocoaDaqReaderRoot::ReadNextEvent (  )  [virtual]

Implements CocoaDaqReader.

Definition at line 44 of file CocoaDaqReaderRoot.cc.

References nextEvent, and ReadEvent().

00045 {
00046   return ReadEvent( nextEvent );
00047 }


Member Data Documentation

int CocoaDaqReaderRoot::nev [private]

Reimplemented from CocoaDaqReader.

Definition at line 33 of file CocoaDaqReaderRoot.h.

Referenced by CocoaDaqReaderRoot().

int CocoaDaqReaderRoot::nextEvent [private]

Reimplemented from CocoaDaqReader.

Definition at line 34 of file CocoaDaqReaderRoot.h.

Referenced by CocoaDaqReaderRoot(), ReadEvent(), and ReadNextEvent().

CocoaDaqRootEvent* CocoaDaqReaderRoot::theEvent [private]

Definition at line 30 of file CocoaDaqReaderRoot.h.

Referenced by CocoaDaqReaderRoot(), and ReadEvent().

TFile* CocoaDaqReaderRoot::theFile [private]

Definition at line 31 of file CocoaDaqReaderRoot.h.

Referenced by CocoaDaqReaderRoot(), and ~CocoaDaqReaderRoot().

TTree* CocoaDaqReaderRoot::theTree [private]

Definition at line 32 of file CocoaDaqReaderRoot.h.

Referenced by CocoaDaqReaderRoot(), and ReadEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:26 2009 for CMSSW by  doxygen 1.5.4