CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Alignment/HIPAlignmentAlgorithm/interface/HIPAlignmentAlgorithm.h

Go to the documentation of this file.
00001 #ifndef Alignment_HIPAlignmentAlgorithm_HIPAlignmentAlgorithm_h
00002 #define Alignment_HIPAlignmentAlgorithm_HIPAlignmentAlgorithm_h
00003 
00004 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentAlgorithmBase.h"
00005 #include "Alignment/CommonAlignment/interface/AlignableDetOrUnitPtr.h"
00006 #include "Alignment/CommonAlignmentAlgorithm/interface/AlignmentIORoot.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "Riostream.h"
00009 
00010 #include "DataFormats/Alignment/interface/AlignmentClusterFlag.h"        
00011 #include "DataFormats/Alignment/interface/AliClusterValueMap.h"          
00012 #include "Utilities/General/interface/ClassName.h"       
00013 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h"       
00014 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"       
00015 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"         
00016 #include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit1D.h"      
00017 #include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h"      
00018 #include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
00019 
00020 class AlignableNavigator;
00021 class TFile;
00022 class TTree;
00023 
00024 class HIPAlignmentAlgorithm : public AlignmentAlgorithmBase
00025 {
00026 
00027  public:
00028   
00030   HIPAlignmentAlgorithm(const edm::ParameterSet& cfg);
00031 
00033   ~HIPAlignmentAlgorithm() {};
00034 
00036   void initialize( const edm::EventSetup& setup, 
00037                    AlignableTracker* tracker, AlignableMuon* muon, AlignableExtras* extras, 
00038                    AlignmentParameterStore* store);
00039 
00041   void terminate(void);
00042 
00044   void startNewLoop(void);
00045 
00047   void run(const edm::EventSetup& setup, const EventInfo &eventInfo);
00048 
00049  private:
00050 
00051   // private member functions
00052 
00053   bool processHit1D(const AlignableDetOrUnitPtr alidet,
00054                     const Alignable* ali,
00055                     const TrajectoryStateOnSurface & tsos,
00056                     const TransientTrackingRecHit* hit);
00057 
00058   bool processHit2D(const AlignableDetOrUnitPtr alidet,
00059                     const Alignable* ali,
00060                     const TrajectoryStateOnSurface & tsos,
00061                     const TransientTrackingRecHit* hit);
00062   
00063   int readIterationFile(std::string filename);
00064   void writeIterationFile(std::string filename, int iter);
00065   void setAlignmentPositionError(void);
00066   double calcAPE(double* par, int iter, double function);
00067   void bookRoot(void);
00068   void fillRoot(void);
00069   bool calcParameters(Alignable* ali);
00070   void collector(void);
00071   int  fillEventwiseTree(const char *filename, int iter, int ierr);
00072   // private data members
00073 
00074   AlignmentParameterStore* theAlignmentParameterStore;
00075   std::vector<Alignable*> theAlignables;
00076   AlignableNavigator* theAlignableDetAccessor;
00077 
00078   AlignmentIORoot theIO;
00079   int ioerr;
00080   int theIteration;
00081 
00082   // steering parameters
00083 
00084   // verbosity flag
00085   bool verbose;
00086   // names of IO root files
00087   std::string outfile,outfile2,outpath,suvarfile,sparameterfile;
00088   std::string struefile,smisalignedfile,salignedfile,siterationfile,ssurveyfile;
00089 
00090   // alignment position error parameters
00091   bool theApplyAPE;
00092   std::vector<edm::ParameterSet> theAPEParameterSet;
00093   std::vector<std::pair<std::vector<Alignable*>, std::vector<double> > > theAPEParameters;
00094   // max allowed pull (residual / uncertainty) on a hit used in alignment
00095   double theMaxAllowedHitPull;
00096   // min number of hits on alignable to calc parameters
00097   int theMinimumNumberOfHits;
00098   // max allowed rel error on parameter (else not used)
00099   double theMaxRelParameterError;
00100   // collector mode (parallel processing)
00101   bool isCollector;
00102   int theCollectorNJobs;
00103   std::string theCollectorPath;
00104   int theEventPrescale,theCurrentPrescale;
00105   bool theFillTrackMonitoring;
00106 
00107   std::vector<align::StructureType> theLevels; // for survey residuals
00108 
00109   // root tree variables
00110   TFile* theFile;
00111   TTree* theTree; // event-wise tree
00112   TFile* theFile2;
00113   TTree* theTree2; // alignable-wise tree
00114   TFile* theFile3;
00115   TTree* theTree3; // survey tree
00116 
00117   // variables for event-wise tree
00118   static const int MAXREC = 99;
00119   //int m_Run,m_Event;
00120   int m_Ntracks,m_Nhits[MAXREC],m_nhPXB[MAXREC],m_nhPXF[MAXREC];
00121   float m_Pt[MAXREC],m_Eta[MAXREC],m_Phi[MAXREC],m_Chi2n[MAXREC],m_P[MAXREC],m_d0[MAXREC],m_dz[MAXREC];
00122 
00123   // variables for alignable-wise tree
00124   int m2_Nhit,m2_Type,m2_Layer;
00125   float m2_Xpos, m2_Ypos, m2_Zpos, m2_Eta, m2_Phi; 
00126   align::ID m2_Id;
00127   align::StructureType m2_ObjId;
00128 
00129   // variables for survey tree 
00130   align::ID m3_Id;
00131   align::StructureType m3_ObjId;
00132   float m3_par[6];
00133 };
00134 
00135 #endif