/// \class AliMUONAlignmentTask
/// \brief Task to align the muon spectrometer
///
-// Author Javier Castillo, CEA/Saclay - Irfu/SPhN
+/// \author Javier Castillo, CEA/Saclay - Irfu/SPhN
+/// \author Hugo Pereira Da Costa, CEA/Saclay - Irfu/SPhN
-class TList;
-class TGraphErrors;
-class AliESDEvent;
-class AliMUONAlignment;
+#include "AliAnalysisTaskSE.h"
+#include "AliMUONAlignment.h"
+
+class TString;
+class TClonesArray;
class AliMUONGeometryTransformer;
-#include "AliAnalysisTask.h"
+class AliMUONAlignmentTask : public AliAnalysisTaskSE
+{
-class AliMUONAlignmentTask : public AliAnalysisTask {
- public:
- // AliMUONAlignmentTask(const char *name = "AliMUONAlignmentTask");
- AliMUONAlignmentTask(const char *name = "AliMUONAlignmentTask", const char *geofilename = "geometry.root", const char *defaultocdb = "local://$ALICE_ROOT/OCDB", const char *misalignocdb = "local://ReAlignOCDB");
- AliMUONAlignmentTask(const AliMUONAlignmentTask& obj);
- AliMUONAlignmentTask& operator=(const AliMUONAlignmentTask& other);
+ public:
+
+ /// constructor
+ AliMUONAlignmentTask( const char *name = "AliMUONAlignmentTask" );
+
+ /// destructor
virtual ~AliMUONAlignmentTask();
-
- virtual void LocalInit();
- virtual void ConnectInputData(Option_t *);
- virtual void CreateOutputObjects();
- virtual void Exec(Option_t *option);
- virtual void Terminate(const Option_t*);
- virtual void FinishTaskOutput();
-
- /// Set geoemetry file name
- void SetGeoFilename(const char* geoFilename) {fGeoFilename = geoFilename;}
- /// Set mis align ocdb
- void SetMisAlignOCDB(const char* misalignOCDB) {fMisAlignOCDB = misalignOCDB;}
+
+ /// get pointer to alignment class
+ AliMUONAlignment* alignment( void ) const
+ { return fAlign; }
+
+ virtual void LocalInit();
+
+ ///@name flags
+ //@{
+
+ /// perform alignment from alignment records is true. Use ESD tracks otherwise
+ void SetReadRecords( Bool_t value = kTRUE )
+ { fReadRecords = value; }
+
+ /// write alignment records to AOD if true
+ void SetWriteRecords( Bool_t value = kTRUE )
+ { fWriteRecords = value; }
+
+ /// perform alignment (from either tracks or records depending on fReadRecords)
+ void SetDoAlignment( Bool_t value )
+ { fDoAlignment = value; }
+
+ /// merge old and new Align CDBs into the new one.
+ void SetMergeAlignmentCDBs( Bool_t value )
+ { fMergeAlignmentCDBs = value; }
+
+ /// field on alignment
+ void SetBFieldOn( Bool_t value )
+ {
+ fForceBField = kTRUE;
+ fBFieldOn = value;
+ }
+
+ /// run range
+ void SetRunRange( Int_t runNumberMin, Int_t runNumberMax )
+ {
+ fRunNumberMin = runNumberMin;
+ fRunNumberMax = runNumberMax;
+ }
+
+ //@}
+
+ /// output data
+ virtual void UserCreateOutputObjects();
+
+ /// per-event method
+ virtual void UserExec( Option_t* );
+ virtual void NotifyRun();
+
+ /// termination cleanup
+ virtual void Terminate( const Option_t* )
+ {}
+
+ /// end of task execution
+ virtual void FinishTaskOutput();
+
/// Set default ocdb
- void SetDefaultOCDB(const char* defaultOCDB) {fDefaultOCDB = defaultOCDB;}
- void Prepare(const char* geoFilename, const char* defaultOCDB, const char* misalignOCDB);
-
- private:
- AliESDEvent *fESD; //!< ESD object
-
- AliMUONAlignment *fAlign; ///< The MUON alignment object
- TString fGeoFilename; ///< Geometry file name
- TString fMisAlignOCDB; ///< OCDB with misalignment file
- TString fDefaultOCDB; ///< Default OCDB
- AliMUONGeometryTransformer *fTransform; ///< MUON geometry transformer
-
- Int_t fTrackTot; ///< Number of track read
- Int_t fTrackOk; ///< Number of track read
- Int_t fLastRunNumber; ///< Last run number
-
- Double_t fParameters[4*156]; ///< Array of alignment parameters
- Double_t fErrors[4*156]; ///< Array of alignment parameters errors
- Double_t fPulls[4*156]; ///< Array of alignment parameters pulls
-
- TGraphErrors *fMSDEx ; ///< Graph of translations along x
- TGraphErrors *fMSDEy ; ///< Graph of translations along y
- TGraphErrors *fMSDEz ; ///< Graph of translations along z
- TGraphErrors *fMSDEp; ///< Graph of rotation about z
-
- TList *fList; ///< list of graphs
-
- ClassDef(AliMUONAlignmentTask, 3) // example of analysis
+ void SetDefaultStorage( TString defaultOCDB )
+ { fDefaultStorage = defaultOCDB; }
+
+ /// Set old (misaligned) alignment path for ocdb
+ void SetOldAlignStorage( TString oldalignOCDB )
+ { fOldAlignStorage = oldalignOCDB; }
+
+ /// Set new (realigned) alignment path for ocdb
+ void SetNewAlignStorage( TString newalignOCDB )
+ { fNewAlignStorage = newalignOCDB; }
+
+ /// Flag to set OCDB once at first run notify
+ void SetLoadOCDBOnce( Bool_t loadOCDBOnce = kTRUE )
+ { fLoadOCDBOnce = loadOCDBOnce; }
+
+ protected:
+
+ /// store misalignment matrices from OCDB into geometry transformer
+ void SaveMisAlignmentData( AliMUONGeometryTransformer* ) const;
+
+ private:
+
+ /// copy constructor, not implemented
+ AliMUONAlignmentTask(const AliMUONAlignmentTask& obj);
+
+ /// asignment operator, not implemented
+ AliMUONAlignmentTask& operator=(const AliMUONAlignmentTask& other);
+
+ ///@name flags
+ //@{
+
+ /// perform alignment from alignment records is true. Use ESD tracks otherwise
+ Bool_t fReadRecords;
+
+ /// write alignment records to AOD if true
+ Bool_t fWriteRecords;
+
+ /// perform alignment (from either tracks or records depending on fReadRecords)
+ Bool_t fDoAlignment;
+
+ /// merge old and new Align CDBs into the new one.
+ Bool_t fMergeAlignmentCDBs;
+
+ /// true if magnetic field was forced to value, instead of reading from GRP
+ Bool_t fForceBField;
+
+ /// Flag for Magnetic field On/Off
+ Bool_t fBFieldOn;
+
+ //@}
+
+ /// The MUON alignment object
+ AliMUONAlignment *fAlign;
+
+ /// location of the default OCDB storage
+ TString fDefaultStorage;
+
+ /// location of the OCDB storage where to find old MUON/Align/Data (use the default one if empty)
+ TString fOldAlignStorage;
+
+ /// location of the OCDB storage where to put new MUON/Align/Data (use the default one if empty)
+ TString fNewAlignStorage;
+
+ /// geometry transformer used to recontruct the present data
+ AliMUONGeometryTransformer* fOldGeoTransformer;
+
+ /// new geometry transformer containing the new alignment to be applied
+ AliMUONGeometryTransformer* fNewGeoTransformer;
+
+ /// set to true if not willing to re-initialize OCDB at every new run
+ Bool_t fLoadOCDBOnce;
+
+ /// set to true when OCDB was loaded at least once
+ Bool_t fOCDBLoaded;
+
+ //! event number (internal counter)
+ Int_t fEvent;
+
+ /// Total number of track read
+ Int_t fTrackTot;
+
+ /// Number of tracks used for alignment
+ Int_t fTrackOk;
+
+ /// run range
+ Int_t fRunNumberMin;
+ Int_t fRunNumberMax;
+
+ /// Array of alignment parameters
+ Double_t fParameters[AliMUONAlignment::fNGlobal];
+
+ /// Array of alignment parameters errors
+ Double_t fErrors[AliMUONAlignment::fNGlobal];
+
+ /// Array of alignment parameters pulls
+ Double_t fPulls[AliMUONAlignment::fNGlobal];
+
+ /// list of track records
+ TClonesArray *fRecords;
+
+ /// number of records
+ Int_t fRecordCount;
+
+ ClassDef(AliMUONAlignmentTask, 3)
+
};
#endif
-