double KinZfitter::GetRefitM4l() { vector<TLorentzVector> p4s = GetRefitP4s(); TLorentzVector pH(0,0,0,0); for(unsigned int i = 0; i< p4s.size(); i++){ pH = pH + p4s[i]; } return pH.M(); }
#include "trame.h" #include "gps.h" #include "ph.h" #include "defines.h" #include "serial_out.h" #include "sd_out.h" #include "capteur_analog.h" GPS gps = GPS(ID_CAPT_GPS); CapteurAnalog press = CapteurAnalog(ID_CAPT_PRESS, PIN_PRESS); CapteurAnalog pressext = CapteurAnalog(ID_CAPT_PRESSEXT, PIN_PRESSEXT); CapteurAnalog temp = CapteurAnalog(ID_CAPT_TEMP, PIN_TEMP); CapteurAnalog conduct = CapteurAnalog(ID_CAPT_CONDUCT, PIN_CONDUCT); CapteurAnalog chamallow = CapteurAnalog(ID_CAPT_CHAMALLOW, PIN_CHAMALLOW); CapteurAnalog co2 = CapteurAnalog(ID_CAPT_CO2, PIN_CO2); pH ph = pH(ID_CAPT_PH); SerialOut so = SerialOut(); SdOut sd = SdOut(); CapteurAnalog pile (ID_CAPT_PILE, PIN_PILE); unsigned long int timer; bool refreshed; void setup() { pinMode((byte)10, OUTPUT); pinMode((byte)13, OUTPUT); so.init(); sd.init(); press.init(); pressext.init(); gps.init();
/** Open a drive for formatting. */ TInt FsFormatOpen(CFsRequest* aRequest) { TDrive& drive = *aRequest->Drive(); __PRINT1(_L("FsFormatOpen() drv:%d"), drive.DriveNumber()); TInt nMountRes = drive.CheckMount(); //-- KErrNotReady means that there is no file system mounted on this drive //-- KErrInUse means that there are some "disk access" objects, like RFormat or RRawDisk opened on the mount. if(nMountRes == KErrNotReady || nMountRes == KErrInUse) { __PRINT1(_L("FsFormatOpen() ChkMount:%d"), nMountRes); return nMountRes; } const TFormatMode fmtMode = (TFormatMode)aRequest->Message().Int1(); TName buf; TUint32 currFsNameHash = 0; //-- current file system name hash, 0 means "not set"; used during forced FS dismounting if((nMountRes == KErrNone) && drive.CurrentMount().LockStatus() < 0) {//-- the mount is locked, it has normal objects (files, directories) opened on it. //-- if someone is interested in the list of opened files and number of opened directories, compile this code in. #ifdef DUMP_OPENED_OBJECTS DumpOpenedObjects(drive); #endif //DUMP_OPENED_OBJECTS if(!(fmtMode & EForceFormat)) { __PRINT(_L("FsFormatOpen() The mount is in use")); return KErrInUse; } //-- there is a special flag that tells to force media dismounting even if it has files or dirs opened. __PRINT(_L("FsFormatOpen() The mount is in use, forcing dismounting!")); //-- record currently mounted FS name hash, it may be used after forced dismounting drive.CurrentMount().FileSystemName(buf); //-- the iCurrentMount is alive currFsNameHash = TVolFormatParam::CalcFSNameHash(buf); //-- kill the current mount FsThreadManager::LockDrive(drive.DriveNumber()); TInt nRes = drive.ForceUnmountFileSystemForFormatting(); FsThreadManager::UnlockDrive(drive.DriveNumber()); switch(nRes) { case KErrInUse: __PRINT(_L("FsFormatOpen() The mount has clamps! Can't force dismount")); return KErrInUse; //-- there are clamps on this drive - can't dismount case KErrNone: break; default: ASSERT(0); //-- unexpected error code return nRes; }; if(fmtMode & EQuickFormat) {//-- quick format may require the normally mounted FS, make the best effrot to mount it nMountRes = drive.CheckMount(); } else {//-- this will make the FS mounted by force; for full format it will be quicker nMountRes = KErrCorrupt; } } //-- if True, we will need mount (probably specific) file system by force because normal mounting has failed TBool bNeedForceMount = (nMountRes != KErrNone); //-- find out if we have optional data structure that describes format parameter TUint32 newFsNameHash = 0; //-- file system name hash, may be used for selecting which file system to put onto the volume. 0 means "not specified" const TLDFormatInfo* pLDFormatInfo = NULL; const TVolFormatParam* pVolFormatParam = NULL; __ASSERT_COMPILE(sizeof(TVolFormatParam) >= sizeof(TLDFormatInfo)); TBuf8<sizeof(TVolFormatParam)> paramBuf; if(fmtMode & ESpecialFormat) { //-- the user has provided format parameters structure. //-- IPC argument #2 contains a structure: <TUint32>[optional package descriptor] //-- where 1st mandatory TUint32 is a pointer to format counter and the optional additional package is a data structure passed to the filesystem by the client of RFormat const TInt desLen = aRequest->GetDesLength(KMsgPtr2); ASSERT((TUint32)desLen >= sizeof(TUint32)); const TInt dataPckgLen = desLen - sizeof(TUint32); if((TUint32)dataPckgLen > sizeof(TUint32)) { aRequest->ReadL(KMsgPtr2, paramBuf); } if(dataPckgLen == sizeof(TLDFormatInfo)) {//-- the user has provided formatting parameters via TLDFormatInfo structure. pLDFormatInfo = (const TLDFormatInfo*)(paramBuf.Ptr() + sizeof(TUint32)); } else if(dataPckgLen == sizeof(TVolFormatParam)) {//-- it's likely to be TVolFormatParam, need to check UId to be sure. pVolFormatParam = (const TVolFormatParam*)(const TVolFormatParam*)(paramBuf.Ptr() + sizeof(TUint32)); if(pVolFormatParam->iUId == TVolFormatParam::KUId) //-- check the class UID {//-- this is the real TVolFormatParam object passed newFsNameHash = pVolFormatParam->FSNameHash(); } } else if(dataPckgLen >0) {//-- parameters data structure has strange length return KErrArgument; } } //------------------- if(!newFsNameHash && currFsNameHash) {//-- new file system name isn't specified (default formatting), but the volume had been forcedly dismounted. //-- restore the original file system newFsNameHash = currFsNameHash; } if(newFsNameHash) {//-- check if the specified FS is already mounted on the volume if(!bNeedForceMount) { drive.CurrentMount().FileSystemName(buf); //-- the iCurrentMount is alive } else { //-- the iCurrentMount can be NULL, use the iFsys - the real file system associated with this drive buf = drive.GetFSys()->Name(); } const TUint32 currFSNameHash = TVolFormatParam::CalcFSNameHash(buf); if(currFSNameHash == newFsNameHash) {//-- no need to do anything, the required FS is already mounted newFsNameHash = 0; } } if(newFsNameHash) { //-- the user has specified some filesystem to be mounted on the volume. Check if this FS is supported at all. //-- if it is supported, but some other FS is currently mounted, it will be dismounted and the new one will be forced. TInt nRes; for(TInt cntFS=0; ;++cntFS) { nRes = drive.FSys().GetSupportedFileSystemName(cntFS, buf); //-- enumerate possible child file systems if(nRes != KErrNone) return KErrNotSupported; //-- the filesystem with the given name (fsNameHash) is not supported. if(newFsNameHash == TVolFormatParam::CalcFSNameHash(buf)) {//-- the filesystem with the given name (fsNameHash) is supported, but some other filesystem can be already mounted drive.Dismount(); bNeedForceMount = ETrue; //-- this will force the desired FS to be mounted break; } } }//if(fsNameHash) //-- try force mounting the desired file system if it is required if(bNeedForceMount) { const TInt KMaxRetries = 3; for(TInt cnt=0; ; ++cnt) { drive.MountFileSystem(ETrue, newFsNameHash); nMountRes = drive.GetReason(); if(nMountRes == KErrNone || nMountRes == KErrLocked) break; drive.Dismount(); //-- will reset mount retries counter if(cnt >= KMaxRetries) { __PRINT1(_L("FsFormatOpen() can't mount FS! res:%d"), nMountRes); return nMountRes; } } } ASSERT(nMountRes == KErrNone || nMountRes == KErrLocked); __ASSERT_DEBUG(drive.CurrentMount().LockStatus()==0, Fault(ESvrFormatOpenFailed)); TDriveInfo dInfo; drive.DriveInfo(dInfo); const TInt mediaAtt = dInfo.iMediaAtt; #if defined(_LOCKABLE_MEDIA) if (!(fmtMode & EForceErase) && (mediaAtt & KMediaAttLocked)) { // if attempting to format a locked drive, dismount otherwise subsequent // requests will operate on a mount that has been forcibly mounted (a few lines above) CMountCB* pM = &drive.CurrentMount(); if(pM) pM->Close(); drive.MountFileSystem(EFalse); // clear iCurrentMount return KErrLocked; } #endif if (!(mediaAtt & KMediaAttFormattable) || (mediaAtt & KMediaAttWriteProtected)) { CMountCB* pM = &drive.CurrentMount(); if(pM) pM->Close(); drive.MountFileSystem(EFalse); return KErrAccessDenied; } //-- instantinate and open CFormatCB object for this drive CFormatCB* formatCB=NULL; TInt fmtHandle; TRAPD(ret, formatCB = drive.FormatOpenL(aRequest, fmtHandle, fmtMode, pLDFormatInfo, pVolFormatParam )); if (ret!=KErrNone) { if(formatCB) formatCB->Close(); return ret; } TPtrC8 pH((TUint8*)&fmtHandle,sizeof(TInt)); aRequest->WriteL(KMsgPtr3,pH); TInt count=100; TPtrC8 pCount((TUint8*)&count,sizeof(TInt)); aRequest->WriteL(KMsgPtr2,pCount); aRequest->Session()->IncResourceCount(); return KErrNone; }
AliAnalysisTaskEmcalSubjet* AddTaskEmcalSubjet(const TString sTrks = "usedefault", const TString sClus = "usedefault", const TString sCells = "usedefault") { auto mgr = AliAnalysisManager::GetAnalysisManager(); if (!mgr) { ::Error("AddTaskEmcalSubjet::AddTaskEmcalSubjet", "No analysis manager to connect to"); return nullptr; } //============================================================================= AliVEventHandler *pH(mgr->GetInputEventHandler()); if (!pH) { ::Error("AddTaskEmcalSubjet::AddTaskEmcalSubjet", "This task requires an input event handler"); return nullptr; } //============================================================================= enum EDataType_t { kUnknown, kESD, kAOD }; EDataType_t wType(kUnknown); if (pH->InheritsFrom("AliESDInputHandler")) wType = kESD; if (pH->InheritsFrom("AliAODInputHandler")) wType = kAOD; if (wType==kUnknown) { ::Error("AddTaskEmcalSubjet::AddTaskEmcalSubjet", "Unkown data input"); return nullptr; } //============================================================================= auto task = new AliAnalysisTaskEmcalSubjet("AliAnalysisTaskEmcalSubjet",kTRUE); //============================================================================= TString sTrkName(sTrks); if (sTrks=="usedefault") { if (wType==kESD) sTrkName = "Tracks"; if (wType==kAOD) sTrkName = "tracks"; } if (sTrkName=="mcparticles") { task->AddMCParticleContainer(sTrkName); } else if ((sTrkName=="tracks") || (sTrkName=="Tracks")) { task->AddTrackContainer(sTrkName); } else if (!sTrkName.IsNull()) { task->AddParticleContainer(sTrkName); } //============================================================================= TString sClsName(sClus); if (sClus=="usedefault") { if (wType==kESD) sClsName = "CaloClusters"; if (wType==kAOD) sClsName = "caloClusters"; } task->AddClusterContainer(sClsName); //============================================================================= TString sCellName(sCells); if (sCells=="usedefault") { if (wType==kESD) sCellName = "EMCALCells"; if (wType==kAOD) sCellName = "emcalCells"; } task->SetCaloCellsName(sCellName); //============================================================================= mgr->AddTask(task); mgr->ConnectInput( task, 0, mgr->GetCommonInputContainer()); mgr->ConnectOutput(task, 1, mgr->CreateContainer("listSubjet", AliEmcalList::Class(), AliAnalysisManager::kOutputContainer, AliAnalysisManager::GetCommonFileName())); //============================================================================= return task; }